koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/acqui.simple additem.pl,1.17,1.18


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/acqui.simple additem.pl,1.17,1.18
Date: Thu, 04 Sep 2003 06:04:14 -0700

Update of /cvsroot/koha/koha/acqui.simple
In directory sc8-pr-cvs1:/tmp/cvs-serv32155/acqui.simple

Modified Files:
        additem.pl 
Log Message:
fix for 565 : item barcode not checked unique

Index: additem.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/additem.pl,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** additem.pl  28 Apr 2003 13:07:17 -0000      1.17
--- additem.pl  4 Sep 2003 13:04:12 -0000       1.18
***************
*** 28,31 ****
--- 28,32 ----
  use C4::Context;
  use C4::Koha; # XXX subfield_is_koha_internal_p
+ use C4::Search;
  use HTML::Template;
  use MARC::File::USMARC;
***************
*** 59,62 ****
--- 60,64 ----
  my $itemrecord;
  my $nextop="additem";
+ my @errors; # store errors found while checking data BEFORE saving item.
  
#------------------------------------------------------------------------------------------------------------------------------
  if ($op eq "additem") {
***************
*** 74,80 ****
        }
        my $record = 
MARChtml2marc($dbh,address@hidden,address@hidden,address@hidden,%indicators);
  # MARC::Record builded => now, record in DB
!       my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = 
NEWnewitem($dbh,$record,$bibid);
!       $nextop = "additem";
  
#------------------------------------------------------------------------------------------------------------------------------
  } elsif ($op eq "edititem") {
--- 76,93 ----
        }
        my $record = 
MARChtml2marc($dbh,address@hidden,address@hidden,address@hidden,%indicators);
+ # check for item barcode # being unique
+       my $oldbibid = MARCmarc2koha($dbh,$record);
+       my $exists = itemdata($oldbibid->{'barcode'});
+       push @errors,"barcode_not_unique" if($exists);
  # MARC::Record builded => now, record in DB
!       # if barcode exists, don't create, but report The problem.
!       my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = 
NEWnewitem($dbh,$record,$bibid) unless ($exists);
!       if ($exists) {
!               $nextop = "additem";
!               $itemrecord = $record;
!               warn "==>".$record->as_formatted;
!       } else {
!               $nextop = "additem";
!       }
  
#------------------------------------------------------------------------------------------------------------------------------
  } elsif ($op eq "edititem") {
***************
*** 254,256 ****
--- 267,272 ----
                                                op => $nextop,
                                                opisadd => ($nextop eq 
"saveitem")?0:1);
+ foreach my $error (@errors) {
+       $template->param($error => 1);
+ }
  output_html_with_http_headers $input, $cookie, $template->output;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]