Bug 16950: Serials subscriptions advanced search shows '0 found' pre-search
[srvgit] / circ / branchtransfers.pl
index 454fbef..5ed99b9 100755 (executable)
@@ -29,7 +29,6 @@ use C4::Reserves;
 use C4::Biblio;
 use C4::Items;
 use C4::Auth qw/:DEFAULT get_session/;
-use C4::Branch; # GetBranches
 use C4::Koha;
 use C4::Members;
 
@@ -61,8 +60,6 @@ my ($template, $user, $cookie) = get_template_and_user(
     }
 );
 
-my $branches = GetBranches;
-
 my $messages;
 my $found;
 my $reserved;
@@ -108,8 +105,8 @@ elsif ( $request eq 'KillReserved' ) {
 my @trsfitemloop;
 my $transfered;
 my $barcode = $query->param('barcode');
-# strip whitespace
-defined $barcode and $barcode =~ s/\s*//g;  # FIXME: barcodeInputFilter
+# remove leading/trailing whitespace
+defined $barcode and $barcode =~ s/^\s*|\s*$//g;  # FIXME: barcodeInputFilter
 # warn "barcode : $barcode";
 if ($barcode) {
 
@@ -131,8 +128,6 @@ if ($barcode) {
         $item{'ccode'}                 = $iteminformation->{'ccode'};
         $item{'itemcallnumber'}        = $iteminformation->{'itemcallnumber'};
         $item{'location'}              = GetKohaAuthorisedValueLib("LOC",$iteminformation->{'location'});
-        $item{'frbrname'}              = $branches->{$frbranchcd}->{'branchname'};
-        $item{'tobrname'}              = $branches->{$tobranchcd}->{'branchname'};
 #         }
         $item{counter}  = 0;
         $item{barcode}  = $barcode;
@@ -164,8 +159,6 @@ foreach ( $query->param ) {
     $item{'ccode'}                 = $iteminformation->{'ccode'};
     $item{'itemcallnumber'}        = $iteminformation->{'itemcallnumber'};
     $item{'location'}              = GetKohaAuthorisedValueLib("LOC",$iteminformation->{'location'});
-    $item{'frbrname'}              = $branches->{$frbcd}->{'branchname'};
-    $item{'tobrname'}              = $branches->{$tobcd}->{'branchname'};
     push( @trsfitemloop, \%item );
 }
 
@@ -196,16 +189,16 @@ foreach my $code ( keys %$messages ) {
             $err{errbadcode} = 1;
         }
         elsif ( $code eq "NotAllowed" ) {
-            warn "NotAllowed: $messages->{'NotAllowed'} to  " . $branches->{ $messages->{'NotAllowed'} }->{'branchname'};
+            warn "NotAllowed: $messages->{'NotAllowed'} to branchcode " . $messages->{'NotAllowed'};
             # Do we really want a error log message here? --atz
             $err{errnotallowed} =  1;
             my ( $tbr, $typecode ) = split( /::/,  $messages->{'NotAllowed'} );
-            $err{tbr}      = $branches->{ $tbr }->{'branchname'};
+            $err{tbr}      = $tbr;
             $err{code}     = $typecode;
         }
         elsif ( $code eq 'IsPermanent' ) {
             $err{errispermanent} = 1;
-            $err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'};
+            $err{msg} = $messages->{'IsPermanent'};
         }
         elsif ( $code eq 'WasReturned' ) {
             $err{errwasreturned} = 1;
@@ -236,7 +229,6 @@ $template->param(
     cancelled               => $cancelled,
     setwaiting              => $setwaiting,
     trsfitemloop            => \@trsfitemloop,
-    branchoptionloop        => GetBranchesLoop($tobranchcd),
     errmsgloop              => \@errmsgloop,
     CircAutocompl           => C4::Context->preference("CircAutocompl")
 );