Bug 14634: Warns when placing hold on record with no items
[koha.git] / reserve / request.pl
index c30fb21..0d82f1c 100755 (executable)
@@ -201,6 +201,7 @@ foreach my $biblionumber (@biblionumbers) {
     my $dat = GetBiblioData($biblionumber);
 
     my $canReserve = CanBookBeReserved( $borrowerinfo->{borrowernumber}, $biblionumber );
+    $canReserve //= '';
     if ( $canReserve eq 'OK' ) {
 
         #All is OK and we can continue
@@ -417,19 +418,11 @@ foreach my $biblionumber (@biblionumbers) {
             my $branch = C4::Circulation::_GetCircControlBranch($item, $borrowerinfo);
 
             my $branchitemrule = GetBranchItemRule( $branch, $item->{'itype'} );
-            my $policy_holdallowed = 1;
 
             $item->{'holdallowed'} = $branchitemrule->{'holdallowed'};
 
-            if ( $branchitemrule->{'holdallowed'} == 0 ||
-                 ( $branchitemrule->{'holdallowed'} == 1 &&
-                     $borrowerinfo->{'branchcode'} ne $item->{'homebranch'} ) ) {
-                $policy_holdallowed = 0;
-            }
-            
             if (
-                   $policy_holdallowed
-                && !$item->{cantreserve}
+                   !$item->{cantreserve}
                 && IsAvailableForItemLevelRequest($item, $borrowerinfo)
                 && CanItemBeReserved(
                     $borrowerinfo->{borrowernumber}, $itemnumber
@@ -534,8 +527,6 @@ foreach my $biblionumber (@biblionumbers) {
         $reserve{'notes'}          = $res->{'reservenotes'};
         $reserve{'wait'}           =
           ( ( defined $res->{'found'} and $res->{'found'} eq 'W' ) or ( $res->{'priority'} eq '0' ) );
-        $reserve{'constrainttypea'} = ( $res->{'constrainttype'} eq 'a' );
-        $reserve{'constrainttypeo'} = ( $res->{'constrainttype'} eq 'o' );
         $reserve{'voldesc'}         = $res->{'volumeddesc'};
         $reserve{'ccode'}           = $res->{'ccode'};
         $reserve{'barcode'}         = $res->{'barcode'};