Fixed problems with non-US date such as 28/10/1983.
[koha.git] / updatebibitem.pl
index 67875a6..cf19a3e 100755 (executable)
@@ -1,6 +1,24 @@
 #!/usr/bin/perl
 
-use C4::Database;
+# $Id$
+
+# Copyright 2000-2002 Katipo Communications
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
 use CGI;
 use strict;
 use C4::Acquisitions;
@@ -8,6 +26,8 @@ use C4::Output;
 use C4::Search;
 
 my $input= new CGI;
+#print $input->header;
+#print $input->Dump;
 
 my $bibitemnum      = checkinp($input->param('bibitemnum'));
 my $bibnum          = checkinp($input->param('bibnum'));
@@ -32,6 +52,7 @@ if ($itemtype ne 'NF') {
 } # if
 
 if ($class =~/[0-9]+/) {
+#   print $class;
    $dewey= $class;
    $dewey=~ s/[a-z]+//gi;
    my @temp;
@@ -42,14 +63,16 @@ if ($class =~/[0-9]+/) {
    } # else
    $classification=$temp[0];
    $subclass=$temp[1];
-
+#   print $classification,$dewey,$subclass;
 } else {
   $dewey='';
   $subclass='';
 } # else
 
 my (@items) = &itemissues($bibitemnum);
+#print @items;
 my $count   = @items;
+#print $count;
 my @barcodes;
 
 my $existing=$input->param('existing');
@@ -61,7 +84,11 @@ if ($existing eq 'YES'){
     my $temp="check_group_".$items[$i]->{'barcode'};
     my $barcode=$input->param($temp);
     if ($barcode ne ''){
-      moditem($items[$i]->{'notforloan'},$items[$i]->{'itemnumber'},$group);
+      moditem({ biblionumber => $bibnum,
+               notforloan   => $items[$i]->{'notforloan'},
+               itemnumber   => $items[$i]->{'itemnumber'},
+               group        => $group
+                   });
 #      print "modify $items[$i]->{'itemnumber'} $group";
     }
   }
@@ -103,13 +130,18 @@ if ($existing eq 'YES'){
       }
       for (my $i=0;$i<$count;$i++){
         if ($barcodes[$i] ne ''){
-         moditem($loan,$items[$i]->{'itemnumber'},$bibitemnum);
+         moditem({ biblionumber => $bibnum,
+                   loan         => $loan,
+                   itemnumber   => $items[$i]->{'itemnumber'},
+                   bibitemnum   => $bibitemnum
+                   });
        }
       }
-      
+
    } elsif ($flag2 eq 'leastone') {
       &modbibitem({
          biblioitemnumber => $bibitemnum,
+         biblionumber     => $bibnum,
          itemtype         => $itemtype?$itemtype:"",
          url              => $url?$url:"",
          isbn             => $isbn?$isbn:"",
@@ -129,12 +161,16 @@ if ($existing eq 'YES'){
       } else {
         $loan=0;
       }
-       for (my $i=0;$i<$count;$i++){                                             
-         if ($barcodes[$i] ne ''){                                               
-           moditem($loan,$items[$i]->{'itemnumber'},$bibitemnum);                
-         }                                                                       
+       for (my $i=0;$i<$count;$i++){
+         if ($barcodes[$i] ne ''){
+           moditem( {biblionumber => $bibnum,
+                     loan         => $loan,
+                     itemnumber   => $items[$i]->{'itemnumber'},
+                     bibitemnum   => $bibitemnum
+                     });
+         }
        }
-      
+
    } else {
      &modbibitem({
          biblioitemnumber => $bibitemnum,