From 7bd9e223e94bb06dcb5a155ca82f0e39c10bd121 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 15 Dec 2010 21:30:38 -0500 Subject: [PATCH] Fix for Bug 4946 - hold warning needs rewording This patch improves the phrasing of several messages by breaking the message variable into distinct parts for more natural-sounding warnings when: - Checking out an item on hold for another patron - Checking out an item which is waiting for another patron - Checking out an item which is checked out to another patron - Checking out an item which is checked out to this patron - Checking out to a patron who has too many checked out I would appreciate special attention to my changes to the TooMany function in Circulation.pm to make sure I handled it correctly. Signed-off-by: Nicole Engard Signed-off-by: Chris Cormack (cherry picked from commit 324991fefd1c6f336308b0f7aec8e8f0047e6e1a) Signed-off-by: Chris Nighswonger --- C4/Circulation.pm | 42 +++++++++++++------ C4/Reserves.pm | 1 + circ/circulation.pl | 1 + .../prog/en/modules/circ/circulation.tmpl | 10 ++--- 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 1ecef0c7a4..0d40ef61a9 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -31,6 +31,7 @@ use C4::Dates; use C4::Calendar; use C4::Accounts; use C4::ItemCirculationAlertPreference; +use C4::Dates qw(format_date); use C4::Message; use C4::Debug; use Date::Calc qw( @@ -412,7 +413,7 @@ sub TooMany { my $max_loans_allowed = $issuing_rule->{'maxissueqty'}; if ($current_loan_count >= $max_loans_allowed) { - return "$current_loan_count / $max_loans_allowed"; + return ($current_loan_count, $max_loans_allowed); } } @@ -440,7 +441,7 @@ sub TooMany { my $max_loans_allowed = $branch_borrower_circ_rule->{maxissueqty}; if ($current_loan_count >= $max_loans_allowed) { - return "$current_loan_count / $max_loans_allowed"; + return ($current_loan_count, $max_loans_allowed); } } @@ -752,12 +753,16 @@ sub CanBookBeIssued { # # JB34 CHECKS IF BORROWERS DONT HAVE ISSUE TOO MANY BOOKS # - my $toomany = TooMany( $borrower, $item->{biblionumber}, $item ); - # if TooMany return / 0, then the user has no permission to check out this book - if ($toomany =~ /\/ 0/) { + my ($current_loan_count, $max_loans_allowed) = TooMany( $borrower, $item->{biblionumber}, $item ); + # if TooMany max_loans_allowed returns 0 the user doesn't have permission to check out this book + if ($max_loans_allowed eq 0) { $needsconfirmation{PATRON_CANT} = 1; } else { - $needsconfirmation{TOO_MANY} = $toomany if $toomany; + if($max_loans_allowed){ + $needsconfirmation{TOO_MANY} = 1; + $needsconfirmation{current_loan_count} = $current_loan_count; + $needsconfirmation{max_loans_allowed} = $max_loans_allowed; + } } # @@ -840,8 +845,11 @@ sub CanBookBeIssued { my $currborinfo = C4::Members::GetMemberDetails( $issue->{borrowernumber} ); # warn "=>.$currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})"; - $needsconfirmation{ISSUED_TO_ANOTHER} = -"$currborinfo->{'reservedate'} : $currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})"; + $needsconfirmation{ISSUED_TO_ANOTHER} = 1; + $needsconfirmation{issued_firstname} = $currborinfo->{'firstname'}; + $needsconfirmation{issued_surname} = $currborinfo->{'surname'}; + $needsconfirmation{issued_cardnumber} = $currborinfo->{'cardnumber'}; + $needsconfirmation{issued_borrowernumber} = $currborinfo->{'borrowernumber'}; } # See if the item is on reserve. @@ -855,13 +863,23 @@ sub CanBookBeIssued { { # The item is on reserve and waiting, but has been # reserved by some other patron. - $needsconfirmation{RESERVE_WAITING} = -"$resborrower->{'firstname'} $resborrower->{'surname'} ($resborrower->{'cardnumber'}, $branchname)"; + $needsconfirmation{RESERVE_WAITING} = 1; + $needsconfirmation{'resfirstname'} = $resborrower->{'firstname'}; + $needsconfirmation{'ressurname'} = $resborrower->{'surname'}; + $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; + $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; + $needsconfirmation{'resbranchname'} = $branchname; + $needsconfirmation{'reswaitingdate'} = format_date($res->{'waitingdate'}); } elsif ( $restype eq "Reserved" ) { # The item is on reserve for someone else. - $needsconfirmation{RESERVED} = -"$res->{'reservedate'} : $resborrower->{'firstname'} $resborrower->{'surname'} ($resborrower->{'cardnumber'})"; + $needsconfirmation{RESERVED} = 1; + $needsconfirmation{'resfirstname'} = $resborrower->{'firstname'}; + $needsconfirmation{'ressurname'} = $resborrower->{'surname'}; + $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; + $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; + $needsconfirmation{'resbranchname'} = $branchname; + $needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'}); } } return ( \%issuingimpossible, \%needsconfirmation ); diff --git a/C4/Reserves.pm b/C4/Reserves.pm index fcf92093bb..e15d32f5a0 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1612,6 +1612,7 @@ sub _Findgroupreserve { SELECT reserves.biblionumber AS biblionumber, reserves.borrowernumber AS borrowernumber, reserves.reservedate AS reservedate, + reserves.waitingdate AS waitingdate, reserves.branchcode AS branchcode, reserves.cancellationdate AS cancellationdate, reserves.found AS found, diff --git a/circ/circulation.pl b/circ/circulation.pl index 5bd5463380..8cd9fa91d9 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -302,6 +302,7 @@ if ($barcode) { $template->param( $needsconfirmation => $$question{$needsconfirmation}, getTitleMessageIteminfo => $getmessageiteminfo->{'title'}, + getBarcodeMessageIteminfo => $getmessageiteminfo->{'barcode'}, NEEDSCONFIRMATION => 1 ); $confirm_required = 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl index ec4060f69a..77041535fd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl @@ -203,23 +203,23 @@ function refocus(calendar) { -
  • Item is currently checked out to this patron. Renew?
  • +
  • Item () is currently checked out to this patron. Renew?
  • -
  • Item is consigned for
  • +
  • Item () has been waiting for "> () at since
  • -
  • Item is on hold for
  • +
  • Item () has been on hold for "> () at since
  • -
  • Item ( ) checked out to . Check in and check out?
  • +
  • Item () is checked out to "> (). Check in and check out?
  • -
  • Too many checked out (already checked out / max : )
  • +
  • Too many checked out. checked out, only are allowed.
  • -- 2.39.5