From ce14391da6a0820c00c0528520cb0174638feda7 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 30 Jan 2023 17:08:36 -0300 Subject: [PATCH] Bug 32712: Fix OPAC breakage when OPACShowCheckoutName enabled Bug 31313 removed GetItemsInfo and proper Koha::Object-based objects are passed now. But some automatic search & replace kept patron-related attributes incorrectly linked to Koha::Item. This patch makes the item-status.inc file reuse the checkout object and get the linked patron to gather the required information. Some simplification is done on hte same patch... should be trivial. To test: 1. Have OpacShowCheckoutName enabled 2. Pick a biblio with items (all of them not checkecd-out) 3. Open the OPAC detail view for the biblio => SUCCESS: You see the biblio and the items 4. Check one of the items out 5. Refresh the OPAC page => FAIL: The page explodes! 6. Apply this patch 7. Refresh the OPAC page => SUCCESS: You see the biblio and the items, the patron info is correctly displayed. 8. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Lucas Gass --- .../bootstrap/en/includes/item-status.inc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc index 0573b90e06..305282861c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -19,9 +19,10 @@ [% SET transfertto = transfer.tobranch %] [% END %] -[% SET waiting = item.holds.waiting.count %] +[% SET checkout = item.checkout %] +[% SET waiting = item.holds.waiting.count %] [% IF include_schema_org %] - [% IF item.damaged or item.checkout.date_due or item.itemlost or transfertwhen or waiting %] + [% IF item.damaged or checkout or item.itemlost or transfertwhen or waiting %] [% ELSIF item.withdrawn %] @@ -42,26 +43,26 @@ [% END %] [% END %] -[% SET datedue = item.checkout.date_due %] -[% SET onsite_checkout = item.checkout.onsite_checkout %] +[% IF checkout %] + [% SET checkout_patron = checkout.patron %] + [% SET onsite_checkout = checkout.onsite_checkout %] -[% IF datedue %] [% SET itemavailable = 0 %] [% IF onsite_checkout %] [% IF ( OPACShowCheckoutName ) %] - Currently in local use by [% item.firstname | html %] [% item.surname | html %] [% IF ( item.cardnumber ) %]([% item.cardnumber | html %])[% END %] + Currently in local use by [% checkout_patron.firstname | html %] [% checkout_patron.surname | html %] [% IF ( checkout_patron.cardnumber ) %]([% checkout_patron.cardnumber | html %])[% END %] [% ELSE %] Currently in local use [% END %] [% ELSE %] [% IF ( OPACShowCheckoutName ) %] - Checked out to [% item.firstname | html %] [% item.surname | html %] [% IF ( item.cardnumber ) %]([% item.cardnumber | html %])[% END %] + Checked out to [% checkout_patron.firstname | html %] [% checkout_patron.surname | html %] [% IF ( checkout_patron.cardnumber ) %]([% checkout_patron.cardnumber | html %])[% END %] [% ELSE %] Checked out [% END %] [% END %] [% IF show_recall_link %] - [% IF datedue && logged_in_user.borrowernumber != issue.borrowernumber %] + [% IF logged_in_user.borrowernumber != issue.borrowernumber %] Recall [% END %] [% END %] -- 2.30.2