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 <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 94a32b3f86)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2023-01-03 11:55:25 +01:00 committed by Jacob O'Mara
parent 6d29722eda
commit 65fab5c89f
3 changed files with 22 additions and 17 deletions

View File

@ -1,9 +0,0 @@
[% IF ( item.damaged or item.checkout.date_due or item.itemlost or item.transfertwhen or item.waiting ) %]
<link property="availability" href="http://schema.org/OutOfStock" />
[% ELSIF ( item.withdrawn ) %]
<link property="availability" href="http://schema.org/Discontinued" />
[% ELSIF ( item.itemnotforloan or item.notforloan_per_itemtype ) %]
<link property="availability" href="http://schema.org/InStoreOnly" />
[% ELSE %]
<link property="availability" href="http://schema.org/InStock" />
[% END %]

View File

@ -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 %]
<link property="availability" href="http://schema.org/OutOfStock" />
[% ELSIF item.withdrawn %]
<link property="availability" href="http://schema.org/Discontinued" />
[% ELSIF item.notforloan or item.itemtype.notforloan %]
<link property="availability" href="http://schema.org/InStoreOnly" />
[% ELSE %]
<link property="availability" href="http://schema.org/InStock" />
[% 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 %]
<span class="item-status intransit">In transit from [% Branches.GetName( transfertfrom ) | html %]
to [% Branches.GetName( transfertto ) | html %] since [% transfertwhen | $KohaDates %]</span>
[% END %]
[% IF item.holds.waiting.count OR item.holds.processing.count %]
[% IF waiting OR item.holds.processing.count %]
[% SET itemavailable = 0 %]
<span class="item-status onhold">On hold</span>
[% END %]

View File

@ -1372,7 +1372,7 @@
</td>
[% END # /IF itemdata_uri %]
[% IF ( itemdata_copynumber ) %]<td class="copynumber">[% ITEM_RESULT.copynumber | html %]</td>[% END %]
<td class="status">[% INCLUDE 'item-status-schema-org.inc' item = ITEM_RESULT %][% INCLUDE 'item-status.inc' item = ITEM_RESULT.object %]</td>
<td class="status">[% INCLUDE 'item-status.inc' item = ITEM_RESULT.object include_schema_org = 1 %]</td>
[% IF ( itemdata_itemnotes ) %]<td class="notes" property="description">[% ITEM_RESULT.itemnotes | $raw %]</td>[% END %]
[% IF ITEM_RESULT.checkout %]
<td class="date_due" data-order="[% ITEM_RESULT.checkout.date_due | html %]">[% ITEM_RESULT.checkout.date_due | $KohaDates as_due_date => 1 %]</td>