Bug 7295: More granular permissions for baskets
[koha.git] / tools / inventory.pl
index cc7e8a7..824906b 100755 (executable)
@@ -77,6 +77,8 @@ my @authorised_value_list;
 my $authorisedvalue_categories = '';
 
 my $frameworks = getframeworks();
+$frameworks->{''} = {frameworkcode => ''}; # Add the default framework
+
 for my $fwk (keys %$frameworks){
   my $fwkcode = $frameworks->{$fwk}->{'frameworkcode'};
   my $authcode = GetAuthValCode('items.location', $fwkcode);
@@ -91,7 +93,7 @@ for my $fwk (keys %$frameworks){
 }
 
 my $statuses = [];
-for my $statfield (qw/items.notforloan items.itemlost items.wthdrawn items.damaged/){
+for my $statfield (qw/items.notforloan items.itemlost items.withdrawn items.damaged/){
     my $hash = {};
     $hash->{fieldname} = $statfield;
     $hash->{authcode} = GetAuthValCode($statfield);
@@ -123,7 +125,6 @@ $statussth =~ s, and $,,g;
  
 $template->param(branchloop => \@branch_loop,
                 authorised_values=>\@authorised_value_list,   
-                DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
                 today                  =>      C4::Dates->today(),
                 minlocation => $minlocation,
                 maxlocation => $maxlocation,
@@ -142,13 +143,13 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){
 #      warn "$date";
     my $strsth="select * from issues, items where items.itemnumber=issues.itemnumber and items.barcode =?";
     my $qonloan = $dbh->prepare($strsth);
-    $strsth="select * from items where items.barcode =? and items.wthdrawn = 1";
-    my $qwthdrawn = $dbh->prepare($strsth);
+    $strsth="select * from items where items.barcode =? and items.withdrawn = 1";
+    my $qwithdrawn = $dbh->prepare($strsth);
     my @errorloop;
     my $count=0;
     while (my $barcode=<$uploadbarcodes>){
         $barcode =~ s/\r?\n$//;
-        if ($qwthdrawn->execute($barcode) &&$qwthdrawn->rows){
+        if ($qwithdrawn->execute($barcode) &&$qwithdrawn->rows){
             push @errorloop, {'barcode'=>$barcode,'ERR_WTHDRAWN'=>1};
         }else{
             my $item = GetItem('', $barcode);
@@ -172,7 +173,7 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){
         }
     }
     $qonloan->finish;
-    $qwthdrawn->finish;
+    $qwithdrawn->finish;
     $template->param(date=>format_date($date),Number=>$count);
 #      $template->param(errorfile=>$errorfile) if ($errorfile);
     $template->param(errorloop=>\@errorloop) if (@errorloop);
@@ -194,7 +195,7 @@ if ( ! ($uploadbarcodes && length($uploadbarcodes)>0 ) || ( $input->param('compa
     if ( defined $input->param('compareinv2barcd') && ( ( $input->param('compareinv2barcd') eq 'on' ) && ( scalar @brcditems != scalar @$res ) ) && length($uploadbarcodes) > 0 ){
         if ( scalar @brcditems > scalar @$res ){
             for my $brcditem (@brcditems) {
-                if (! grep(/$brcditem->{barcode}/, @$res) ){
+                if (! grep( $_->{barcode} =~ /$brcditem->{barcode}/ , @$res) ){
                     $brcditem->{notfoundkoha} = 1;
                     push @$res, $brcditem;
                 }
@@ -202,7 +203,7 @@ if ( ! ($uploadbarcodes && length($uploadbarcodes)>0 ) || ( $input->param('compa
         } else {
             my @notfound;
             for my $item (@$res) {
-                if ( ! grep(/$item->{barcode}/, @brcditems) ){
+                if ( ! grep( $_->{barcode} =~ /$item->{barcode}/ , @brcditems) ){
                     $item->{notfoundbarcode} = 1;
                     push @notfound, $item;
                 }