From 5654ddbe730b69fa17c34d9a0b912e80a2cfdb48 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Eric Gosselin Signed-off-by: Marc VĂ©ron --- 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 2dcb1e9..b598e6f 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -477,6 +477,7 @@ sub TooMany { reason => 'TOO_MANY_ONSITE_CHECKOUTS', count => $onsite_checkout_count, max_allowed => $max_onsite_checkouts_allowed, + issuing_rule => $issuing_rule, } } } @@ -487,6 +488,7 @@ sub TooMany { reason => 'TOO_MANY_CHECKOUTS', count => $checkout_count, max_allowed => $max_checkouts_allowed, + issuing_rule => $issuing_rule, }; } } elsif ( not $onsite_checkout ) { @@ -495,6 +497,7 @@ sub TooMany { reason => 'TOO_MANY_CHECKOUTS', count => $checkout_count - $onsite_checkout_count, max_allowed => $max_checkouts_allowed, + issuing_rule => $issuing_rule, }; } } @@ -531,6 +534,7 @@ sub TooMany { reason => 'TOO_MANY_ONSITE_CHECKOUTS', count => $onsite_checkout_count, max_allowed => $max_onsite_checkouts_allowed, + issuing_rule => $issuing_rule, } } } @@ -541,6 +545,7 @@ sub TooMany { reason => 'TOO_MANY_CHECKOUTS', count => $checkout_count, max_allowed => $max_checkouts_allowed, + issuing_rule => $issuing_rule, }; } } elsif ( not $onsite_checkout ) { @@ -549,13 +554,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 !!! @@ -842,13 +848,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 114f2e7..80e35ce 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 ) %] @@ -1039,3 +1051,32 @@ No patron matched [% message | html %] [% INCLUDE 'intranet-bottom.inc' %] + +[% BLOCK issuing_rule_criteria %] +
      +
    • + Item type: + [% IF issuing_rule.itemtype == '*' %] + All + [% ELSE %] + [% ItemTypes.GetDescription( issuing_rule.itemtype ) %] + [% END %] +
    • +
    • + Patron category: + [% IF issuing_rule.categorycode == '*' %] + All + [% ELSE %] + [% Categories.GetName( issuing_rule.categorycode ) %] + [% END %] +
    • +
    • + Library: + [% IF issuing_rule.branchcode == '*' %] + All libraries + [% ELSE %] + [% Branches.GetName( issuing_rule.branchcode ) %] + [% END %] +
    • +
    +[% END %] -- 2.1.4