From 3791be6da5eb8189fd210293a527d291cfe164aa Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Mon, 4 Dec 2017 15:23:02 +1300 Subject: [PATCH] Bug 18450 - Followup - Implemented 'IF A OR B OR C {stuff}" for checking what to display Implemented a conditional checking if the item that the patron is trying to renew has more than 1 copy available which can be renewed. This means the AllowRebnewalIfOtherItemsAvailable system preference is now appropriately implemented. Test plan: 1. In More->Administration->Global system preferences ensure that both the AllowRenewalLimitOverride and AllowRenewalIfOtherItemsAvaliable preferences are both set to 'Dont allow'. 2. Place a hold on an item 3. Checkout the item out to a different patron 4. Renew the item and notice the 'Cannot renew: The item is on hold for another patron' warning 5. Click the 'Override and renew' button and notice that you can bypass the hold 6. Apply patch 7. Try to renew an item (with item level hold on it) which belongs to a biblio with either only one item or a biblio with multiple items all of which have holds on them. Notice the only button in the yellow message box displayed is 'Continue without renewing' 8. Repeat step 7 but change the hold to a 'Next available' hold rather than an item level hold. Again notice only the 'Continue without renewing' button is displayed 9. Try to renew an item (with item level hold on it) which belongs to a biblio with mutliple aviable items of it in the catalogue. Notice only the 'Continue without renewing' button is displayed 10. Repeat step 9 but change the hold to a 'Next available' hold rather than an item level hold. Notice only the 'Continue without renewing' button is displayed 11. Set both AllowRenewalLimitOverride and AllowRenewalIfOtherItemsAvaliable systempreferences to 'Allow' and repeat step 7 notice only the 'Continue without renewing' button is displayed in the yellow message box 12. Repeat step 8 and notice only the 'Continue without renewing' button is displayed 13. Repeat step 9 and notice only the 'Continue without renewing' button is displayed 14. Repeat step 10 and notice the item is immediately renewed and the yellow message box is not displayed 15. Set the AllowRenewalIfOtheritemsAvailable to 'Dont' Allow' and repeat step 7 and notice that both the 'Override and renew' and 'Continue without renewal' buttons are displayed 16. Repeat step 8 and notice both buttons are displayed 17. Repeat step 9 and notice both buttons are displayed 18. Repeat step 10 and notice both buttons are displayed 19. Set AllowRenewalIfOtherItemsAvailable syspref to 'Allow' and AllowRenewalLimitOverride syspref to 'Dont' Allow' and repeat step 7 and notice only the 'Continue without renewal' button is displayed 20. Repeat step 8 and notice only 'Continue without renewal' button is displayed 21. Repeat step 9 and notice only the 'Continue without renewal' button is displayed 22. Repeat step 10 and notice both buttons are displayed Sponsored-By: Catalyst IT --- C4/Circulation.pm | 1 + circ/renew.pl | 2 ++ .../intranet-tmpl/prog/en/modules/circ/renew.tt | 21 +++++++-------------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 9397cbc..17c321b 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2639,6 +2639,7 @@ sub CanBookBeRenewed { my ( $reserve_found, $reserve, undef ) = C4::Reserves::CheckReserves( $itemnumber, undef, undef, \@borrowernumbers ); + warn $reserve_found; if ($reserve_found) { push( @borrowernumbers, $reserve->{borrowernumber} ); } diff --git a/circ/renew.pl b/circ/renew.pl index 246c266..fdcfe9d 100755 --- a/circ/renew.pl +++ b/circ/renew.pl @@ -76,6 +76,8 @@ if ($barcode) { else { $can_renew = 0; } + + $template->param(can_renew => $can_renew ); } if ( $error && ($error eq 'too_soon' or $error eq 'auto_too_soon') ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt index 7603710..c5769d5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt @@ -106,20 +106,13 @@

This item is on hold for another patron.

- [% IF (Koha.Preference('AllowRenewalLimitOverride')) && (Koha.Preference('AllowRenewalIfOtherItemsAvailable')) %] -
- - - - -
- [% ELSIF (!(Koha.Preference('AllowRenewalLimitOverride')) && (Koha.Preference('AllowRenewalIfOtherItemsAvailable'))) || (Koha.Preference('AllowRenewalLimitOverride') && (!(Koha.Preference('AllowRenewalIfOtherItemsAvaliable')))) %] -
- - - - -
+ [% IF (can_renew == 1 && (!Koha.Preference('AllowRenewalLimitOverride')) && ((Koha.Preference('AllowRenewalIfOtherItemsAvailable')))) || (can_renew==1 && (Koha.Preference('AllowRenewalLimitOverride')) && (!(Koha.Preference('AllowRenewalIfOtherItemsAvaliable')))) || (can_renew == 1 && (Koha.Preference('AllowRenewalLimitOverride')) && ((Koha.Preference('AllowRenewalIfOtherItemsAvailable')))) %] +
+ + + + +
[% END %] [% ELSIF error == "patron_restricted" %] -- 2.1.4