From a304b958bba04bd84431d1a80f83a51b2fc00ff2 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 17 Feb 2017 10:15:00 -0500 Subject: [PATCH] Bug 18139 - 'Too many checked out' can confuse librarians The too many checked out message can be very confusing for librarians when the limit specified is more or less than the number of checkouts the patron already has. We should make it clear to the librarian that his is only counting certain types of checkouts by giving them the issuing rule criteria used. Test Plan: 1) Apply this patch 2) Try to check out more items than the circ rules allow for regular and on-site checkouts --- C4/Circulation.pm | 18 +++++++--- .../prog/en/modules/circ/circulation.tt | 41 ++++++++++++++++++++++ 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index e2cd626..abe451a 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -478,6 +478,7 @@ sub TooMany { reason => 'TOO_MANY_ONSITE_CHECKOUTS', count => $onsite_checkout_count, max_allowed => $max_onsite_checkouts_allowed, + issuing_rule => $issuing_rule, } } } @@ -488,6 +489,7 @@ sub TooMany { reason => 'TOO_MANY_CHECKOUTS', count => $checkout_count, max_allowed => $max_checkouts_allowed, + issuing_rule => $issuing_rule, }; } } elsif ( not $onsite_checkout ) { @@ -496,6 +498,7 @@ sub TooMany { reason => 'TOO_MANY_CHECKOUTS', count => $checkout_count - $onsite_checkout_count, max_allowed => $max_checkouts_allowed, + issuing_rule => $issuing_rule, }; } } @@ -532,6 +535,7 @@ sub TooMany { reason => 'TOO_MANY_ONSITE_CHECKOUTS', count => $onsite_checkout_count, max_allowed => $max_onsite_checkouts_allowed, + issuing_rule => $issuing_rule, } } } @@ -542,6 +546,7 @@ sub TooMany { reason => 'TOO_MANY_CHECKOUTS', count => $checkout_count, max_allowed => $max_checkouts_allowed, + issuing_rule => $issuing_rule, }; } } elsif ( not $onsite_checkout ) { @@ -550,13 +555,14 @@ sub TooMany { reason => 'TOO_MANY_CHECKOUTS', count => $checkout_count - $onsite_checkout_count, max_allowed => $max_checkouts_allowed, + issuing_rule => $issuing_rule, }; } } } if ( not defined( $issuing_rule ) and not defined($branch_borrower_circ_rule->{maxissueqty}) ) { - return { reason => 'NO_RULE_DEFINED', max_allowed => 0 }; + return { reason => 'NO_RULE_DEFINED', max_allowed => 0, issuing_rule => $issuing_rule }; } # OK, the patron can issue !!! @@ -843,13 +849,15 @@ sub CanBookBeIssued { $needsconfirmation{PATRON_CANT} = 1; } if ( C4::Context->preference("AllowTooManyOverride") ) { - $needsconfirmation{TOO_MANY} = $toomany->{reason}; + $needsconfirmation{TOO_MANY} = $toomany->{reason}; $needsconfirmation{current_loan_count} = $toomany->{count}; - $needsconfirmation{max_loans_allowed} = $toomany->{max_allowed}; + $needsconfirmation{max_loans_allowed} = $toomany->{max_allowed}; + $needsconfirmation{issuing_rule} = $toomany->{issuing_rule}; } else { - $issuingimpossible{TOO_MANY} = $toomany->{reason}; + $issuingimpossible{TOO_MANY} = $toomany->{reason}; $issuingimpossible{current_loan_count} = $toomany->{count}; - $issuingimpossible{max_loans_allowed} = $toomany->{max_allowed}; + $issuingimpossible{max_loans_allowed} = $toomany->{max_allowed}; + $issuingimpossible{issuing_rule} = $toomany->{issuing_rule}; } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index d6608d7..da49b26 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -230,10 +230,18 @@ $(document).ready(function() { [% IF TOO_MANY and TOO_MANY == 'TOO_MANY_CHECKOUTS' %]
  • Too many checked out. [% current_loan_count %] checked out, only [% max_loans_allowed %] are allowed.
  • +
  • + Maximum checkouts calculated from the circulation rule for + [% INCLUDE issuing_rule_criteria %] +
  • [% END %] [% IF TOO_MANY and TOO_MANY == 'TOO_MANY_ONSITE_CHECKOUTS' %]
  • Too many on-site checked out. [% current_loan_count %] on-site checked out, only [% max_loans_allowed %] are allowed.
  • +
  • + Maximum on-site checkouts calculated from the circulation rule for + [% INCLUDE issuing_rule_criteria %] +
  • [% END %] [% IF ( BORRNOTSAMEBRANCH ) %] @@ -513,6 +521,10 @@ $(document).ready(function() { [% IF ( TOO_MANY ) %]
  • Too many checked out. [% current_loan_count %] checked out, only [% max_loans_allowed %] are allowed.
  • +
  • + Maximum checkouts calculated from the circulation rule for + [% INCLUDE issuing_rule_criteria %] +
  • [% END %] [% IF ( ITEMNOTSAMEBRANCH ) %] @@ -1027,3 +1039,32 @@ No patron matched [% message | html %] [% INCLUDE 'intranet-bottom.inc' %] + +[% BLOCK issuing_rule_criteria %] + +[% END %] -- 2.1.4