From 952f00f20b0ab110bc9b2b2e7cf4eb6febf31698 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 6 Jun 2022 23:36:38 +0000 Subject: [PATCH] Bug 30905: Show waiting recalls in patron account This enhancement shows recalls ready for pick-up on the patron's account so they can't be missed. To test: 1) Enable the UseRecalls system preference and set up your recalls-related circulation rules. 2) Check out an item to Patron B. 3) Log into the OPAC as Patron A and search for the item. 4) Place a recall on that item. Note the pickup library. 5) Go back to the staff client. At the top right of the page, confirm your logged in library matches the recall pickup library. Set the library to the recall pickup library if needed. 6) Check in the recalled item and confirm the recall as waiting for Patron A. 7) Go to Patron A's account (members/moremember.pl). Confirm the recall shows under 'Recalls waiting here' and all the information is correct. 8) Go to Patron A's checkouts (circ/circulation.pl). Confirm the recall shows under 'Recalls waiting here' and all the information is correct. 9) Click on the menu at the top right of the page and choose 'Set library'. Change the library to some other library. 10) Repeat steps 7 and 8, however this time the recall should show under 'Recalls waiting at other libraries'. Sponsored-by: Catalyst IT Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- circ/circulation.pl | 3 + .../prog/en/includes/patron_messages.inc | 57 +++++++++++++++++++ members/moremember.pl | 5 ++ 3 files changed, 65 insertions(+) diff --git a/circ/circulation.pl b/circ/circulation.pl index 2fd34fc068..d4b5dcfe94 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -449,10 +449,13 @@ if ($patron) { holds_count => $holds->count(), WaitingHolds => $waiting_holds, ); + if ( C4::Context->preference('UseRecalls') ) { + my $waiting_recalls = $patron->recalls->search({ status => 'waiting' }); $template->param( recalls => $patron->recalls->filter_by_current->search({},{ order_by => { -asc => 'created_date' } }), specific_patron => 1, + waiting_recalls => $waiting_recalls, ); } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc index 97219917e7..ecd297c744 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc @@ -129,6 +129,63 @@ [% END # /F ( has_modifications || warndeparture... %] +[% IF waiting_recalls.count %] +
+ [% SET waiting_here = 0 %] + [% SET waiting_elsewhere = 0 %] + [% FOREACH w IN waiting_recalls %] + [% IF ( w.pickup_library_id == Branches.GetLoggedInBranchcode() ) %] + [% waiting_here = waiting_here + 1 %] + [% ELSE %] + [% waiting_elsewhere = waiting_elsewhere + 1 %] + [% END %] + [% END %] + + [% IF ( waiting_here > 0 ) %] +

Recalls waiting here ([% waiting_here | html %])

+
    + [% FOREACH w IN waiting_recalls %] + [% IF ( w.pickup_library_id == Branches.GetLoggedInBranchcode() ) %] +
  • + [% w.biblio.title | html %] + ([% ItemTypes.GetDescription( w.item.effective_itemtype ) | html %]), + [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %] + [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber | html %]] [% END %] + Recall placed on [% w.created_date | $KohaDates %]. +
    + + [% SET expires_on = w.expiration_date %] + Waiting here [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %] + +
  • + [% END %] + [% END %] +
+ [% END %] + + [% IF ( waiting_elsewhere > 0 ) %] +

Recalls waiting at other libraries ([% waiting_elsewhere | html %])

+
    + [% FOREACH w IN waiting_recalls %] + [% IF ( w.pickup_library_id != Branches.GetLoggedInBranchcode() ) %] +
  • + [% w.biblio.title | html %] + ([% ItemTypes.GetDescription( w.item.effective_itemtype ) | html %]), + [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %] + [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber | html %]] [% END %] + Recall placed on [% w.created_date | $KohaDates %]. +
    + + [% SET expires_on = w.expiration_date %] + Waiting at [% Branches.GetName( w.pickup_library_id ) | html %] [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %] + +
  • + [% END %] + [% END %] +
+ [% END %] +
+[% END # /IF waiting_recalls.count %] [% IF WaitingHolds.count %]
diff --git a/members/moremember.pl b/members/moremember.pl index 89ec5d9af5..00e4c8e1af 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -199,6 +199,11 @@ $template->param( WaitingHolds => $waiting_holds, ); +if ( C4::Context->preference('UseRecalls') ) { + my $waiting_recalls = $patron->recalls->search({ status => 'waiting' }); + $template->param( waiting_recalls => $waiting_recalls ); +} + my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees"); $no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees ); if ( defined $no_issues_charge_guarantees ) { -- 2.39.5