[% USE Branches %]
[% USE Koha %]
[% USE AuthorisedValues %]
[% SET itemavailable = 1 %]
[%#- This include takes two parameters: an item structure -%]
[%#- and an optional loan (issue) structure. The issue -%]
[%#- 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 %]
[% 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 checkout = item.checkout %]
[% SET waiting = item.holds.waiting.count %]
[% IF include_schema_org %]
[% IF item.damaged or checkout 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 ) %]
[% IF itemlost_lib %]
[% itemlost_lib | html %]
[% ELSE %]
Item lost
[% END %]
[% END %]
[% IF checkout %]
[% SET checkout_patron = checkout.patron %]
[% SET onsite_checkout = checkout.onsite_checkout %]
[% SET itemavailable = 0 %]
[% IF onsite_checkout %]
[% IF ( Koha.Preference('OPACShowCheckoutName') ) %]
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 ( Koha.Preference('OPACShowCheckoutName') ) %]
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 logged_in_user.borrowernumber != issue.borrowernumber %]
Recall
[% END %]
[% END %]
[% 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 waiting OR item.holds.processing.count %]
[% SET itemavailable = 0 %]
On hold
[% END %]
[% IF ( item.withdrawn ) %]
[% SET itemavailable = 0 %]
[% withdrawn_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn, opac => 1 ) %]
[% IF withdrawn_lib %]
[% withdrawn_lib | html %]
[% ELSE %]
Item withdrawn
[% END %]
[% END %]
[% SET restricted_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted, opac => 1 ) %]
[% IF item.notforloan %]
[% SET itemavailable = 0 %]
[% notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan, opac => 1 ) %]
[% IF notforloan_lib %]
[% notforloan_lib | html %] [% IF restricted_lib %]([% restricted_lib | html %])[% END %]
[% ELSE %]
Not for loan [% IF restricted_lib %]([% restricted_lib | html %])[% END %]
[% END %]
[% ELSIF item.itemtype.notforloan %]
[% SET itemavailable = 0 %]
Not for loan [% IF restricted_lib %]([% restricted_lib | html %])[% END %]
[% END %]
[% IF ( item.bundle_host ) %]
In bundle: [% INCLUDE 'biblio-title.inc' biblio = item.bundle_host.biblio %]
[% END %]
[% IF ( item.damaged ) %]
[% SET itemavailable = 0 %]
[% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged, opac => 1 ) %]
[% IF av_lib_include %]
[% av_lib_include | html %]
[% ELSE %]
Item damaged
[% END %]
[% END %]
[% IF Koha.Preference('OPACAcquisitionDetails') AND item.orders.filter_by_active.count %]
[% SET itemavailable = 0 %]
On order
[% END %]
[% IF item.has_pending_hold %]
[% SET itemavailable = 0 %]
Pending hold
[% END %]
[% IF Koha.Preference('UseRecalls') && item.has_pending_recall %]
[% SET itemavailable = 0 %]
Pending recall
[% END %]
[% IF ( itemavailable ) %]
Available [% IF restricted_lib %]([% restricted_lib | html %])[% END %]
[% END %]