From 65fab5c89f498fe293f6ca286a8efaf92faebff6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 3 Jan 2023 11:55:25 +0100 Subject: [PATCH] Bug 32445: include item-status-schema-org.inc Can be discussed, but it will prevent to fetch several times the same related objects 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 94a32b3f864ffcdc1d787bd275df1692d016f8df) Signed-off-by: Jacob O'Mara --- .../en/includes/item-status-schema-org.inc | 9 ------ .../bootstrap/en/includes/item-status.inc | 28 ++++++++++++++----- .../bootstrap/en/modules/opac-detail.tt | 2 +- 3 files changed, 22 insertions(+), 17 deletions(-) delete mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status-schema-org.inc diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status-schema-org.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status-schema-org.inc deleted file mode 100644 index 66e4f3656e..0000000000 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status-schema-org.inc +++ /dev/null @@ -1,9 +0,0 @@ -[% IF ( item.damaged or item.checkout.date_due or item.itemlost or item.transfertwhen or item.waiting ) %] - -[% ELSIF ( item.withdrawn ) %] - -[% ELSIF ( item.itemnotforloan or item.notforloan_per_itemtype ) %] - -[% ELSE %] - -[% END %] 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 7adeb1e0f2..0573b90e06 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -12,6 +12,26 @@ [% STOP %] [% END %] +[% SET transfer = item.get_transfer %] +[% IF transfer AND transfer.in_transit %] + [% SET transfertwhen = transfer.datesent %] + [% SET transfertfrom = transfer.frombranch %] + [% SET transfertto = transfer.tobranch %] +[% END %] + +[% 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 %] + + [% ELSIF item.withdrawn %] + + [% ELSIF item.notforloan or item.itemtype.notforloan %] + + [% ELSE %] + + [% END %] +[% END %] + [% IF ( item.itemlost ) %] [% SET itemavailable = 0 %] [% itemlost_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost, opac => 1 ) %] @@ -47,19 +67,13 @@ [% END %] [% END %] -[% 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 %] In transit from [% Branches.GetName( transfertfrom ) | html %] to [% Branches.GetName( transfertto ) | html %] since [% transfertwhen | $KohaDates %] [% END %] -[% IF item.holds.waiting.count OR item.holds.processing.count %] +[% IF waiting OR item.holds.processing.count %] [% SET itemavailable = 0 %] On hold [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 7fde0c96a7..e97198aed4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1372,7 +1372,7 @@ [% END # /IF itemdata_uri %] [% IF ( itemdata_copynumber ) %][% ITEM_RESULT.copynumber | html %][% END %] - [% INCLUDE 'item-status-schema-org.inc' item = ITEM_RESULT %][% INCLUDE 'item-status.inc' item = ITEM_RESULT.object %] + [% INCLUDE 'item-status.inc' item = ITEM_RESULT.object include_schema_org = 1 %] [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes | $raw %][% END %] [% IF ITEM_RESULT.checkout %] [% ITEM_RESULT.checkout.date_due | $KohaDates as_due_date => 1 %] -- 2.39.5