From 6d29722edad76fed099f4534c82f3294218f8150 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 3 Jan 2023 11:43:28 +0100 Subject: [PATCH] Bug 32445: Remove non-Koha::Item support from item-status.inc Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 1c9d1e7cc5bb36d9572d26a8cd6450667031a397) Signed-off-by: Jacob O'Mara --- .../bootstrap/en/includes/item-status.inc | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 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 601cd8984e..7adeb1e0f2 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -7,6 +7,11 @@ [%#- structure is used by course reserves pages, which do -%] [%#- not use an API to fetch items that populates item.datedue. -%] +[% UNLESS item.isa('Koha::Item') %] +
Programming error, item-status.inc must be called with a Koha::Item object.
+ [% STOP %] +[% END %] + [% IF ( item.itemlost ) %] [% SET itemavailable = 0 %] [% itemlost_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost, opac => 1 ) %] @@ -17,13 +22,9 @@ [% END %] [% END %] -[% IF item.isa('Koha::Item') %] - [% SET datedue = item.checkout.date_due %] - [% SET onsite_checkout = item.checkout.onsite_checkout %] -[% ELSE %] - [% SET datedue = item.datedue || issue.date_due %] - [% SET onsite_checkout = item.onsite_checkout %] -[% END %] +[% SET datedue = item.checkout.date_due %] +[% SET onsite_checkout = item.checkout.onsite_checkout %] + [% IF datedue %] [% SET itemavailable = 0 %] [% IF onsite_checkout %] @@ -46,17 +47,11 @@ [% END %] [% END %] -[% IF item.isa('Koha::Item') %] - [% SET transfer = item.get_transfer %] - [% IF transfer AND transfer.in_transit %] - [% SET transfertwhen = transfer.datesent %] - [% SET transfertfrom = transfer.frombranch %] - [% SET transfertto = transfer.tobranch %] - [% END %] -[% ELSE %] - [% SET transfertwhen = item.transfertwhen %] - [% SET transfertfrom = item.transfertfrom %] - [% SET transfertto = item.transfertto %] +[% SET transfer = item.get_transfer %] +[% IF transfer AND transfer.in_transit %] + [% SET transfertwhen = transfer.datesent %] + [% SET transfertfrom = transfer.frombranch %] + [% SET transfertto = transfer.tobranch %] [% END %] [% IF transfertwhen %] [%# transfertwhen is set in C4::Search, do not have it for course reserves %] [% SET itemavailable = 0 %] @@ -64,7 +59,7 @@ to [% Branches.GetName( transfertto ) | html %] since [% transfertwhen | $KohaDates %] [% END %] -[% IF (item.isa('Koha::Item') AND item.holds.waiting.count) OR (item.isa('Koha::Item') AND item.holds.processing.count) OR (NOT item.isa('Koha::Item') AND item.waiting) OR (NOT item.isa('Koha::Item') AND item.processing) %] +[% IF item.holds.waiting.count OR item.holds.processing.count %] [% SET itemavailable = 0 %] On hold [% END %] @@ -108,7 +103,7 @@ [% END %] [% END %] -[% IF Koha.Preference('OPACAcquisitionDetails') AND ( item.isa('Koha::Item') ) AND ( item.orders.filter_by_active.count ) %] +[% IF Koha.Preference('OPACAcquisitionDetails') AND item.orders.filter_by_active.count %] [% SET itemavailable = 0 %] On order [% END %] -- 2.39.5