Bug 15524: (RM follow-up) Fix calls and add filter
authorNick Clemens <nick@bywatersolutions.com>
Fri, 24 Aug 2018 15:10:45 +0000 (15:10 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 24 Aug 2018 16:27:27 +0000 (16:27 +0000)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

C4/Circulation.pm
C4/Reserves.pm
Koha/REST/V1/Hold.pm
koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
reserve/request.pl

index 9c14365..77885d6 100644 (file)
@@ -1183,7 +1183,7 @@ sub checkHighHolds {
             }
 
             # Remove any items that are not holdable for this patron
-            @items = grep { CanItemBeReserved( $borrower->{borrowernumber}, $_->itemnumber ) eq 'OK' } @items;
+            @items = grep { CanItemBeReserved( $borrower->{borrowernumber}, $_->itemnumber )->{status} eq 'OK' } @items;
 
             my $items_count = scalar @items;
 
index 38f9953..3b1ac5e 100644 (file)
@@ -299,7 +299,7 @@ sub CanBookBeReserved{
          { status => ageRestricted },   if the Item is age restricted for this borrower.
          { status => damaged },         if the Item is damaged.
          { status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK.
-         { status => tooManyReserves, limit => $limit }, if the borrower has exceeded his maximum reserve amount.
+         { status => tooManyReserves, limit => $limit }, if the borrower has exceeded their maximum reserve amount.
          { status => notReservable },   if holds on this item are not allowed
 
 =cut
index c152fb7..c3cb926 100644 (file)
@@ -91,7 +91,7 @@ sub add {
 
     unless ($can_reserve->{status} eq 'OK') {
         return $c->render( status => 403, openapi => {
-            error => "Reserve cannot be placed. Reason: $can_reserve"
+            error => "Reserve cannot be placed. Reason: ". $can_reserve->{status}
         } );
     }
 
index df1798a..058e70a 100644 (file)
                         <td>[% IF ( branch_cat_rule_loo.unlimited_max_holds ) %]
                                 Unlimited
                             [% ELSE %]
-                                [% branch_cat_rule_loo.max_holds %]
+                                [% branch_cat_rule_loo.max_holds | html %]
                             [% END %]
                         </td>
 
index 2fd36e8..cbbd35b 100755 (executable)
@@ -471,7 +471,7 @@ foreach my $biblionumber (@biblionumbers) {
                        !$item->{cantreserve}
                     && !$exceeded_maxreserves
                     && IsAvailableForItemLevelRequest($item, $patron_unblessed)
-                    && $can_item_be_reserved eq 'OK'
+                    && $can_item_be_reserved->{status} eq 'OK'
                   )
                 {
                     $item->{available} = 1;
@@ -479,7 +479,7 @@ foreach my $biblionumber (@biblionumbers) {
 
                     push( @available_itemtypes, $item->{itype} );
                 }
-                elsif ( $can_item_be_reserved eq 'tooManyReserves' && C4::Context->preference('AllowHoldPolicyOverride') ) {
+                elsif ( $can_item_be_reserved->{status} eq 'tooManyReserves' && C4::Context->preference('AllowHoldPolicyOverride') ) {
                     # If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules
                     $item->{override} = 1;
                     $num_override++;