[% USE Branches %]
[% 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. -%]
[% IF ( item.itemlost ) %]
[% SET itemavailable = 0 %]
[% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost, opac => 1 ) %]
[% IF ( av_lib_include ) %]
[% av_lib_include | html %]
[% ELSE %]
Item lost
[% 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 %]
[% 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 %]
[% 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 %]
[% ELSE %]
Checked out
[% END %]
[% END %]
[%# FIXME We should move avail_for_recall to a Koha::Item method %]
[% IF !item.isa('Koha::Item') AND item.avail_for_recall %]Recall[% 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 %]
[% 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.isa('Koha::Item') AND item.holds.waiting.count) OR (NOT item.isa('Koha::Item') AND item.waiting) %]
[% SET itemavailable = 0 %]
On hold
[% END %]
[% IF ( item.withdrawn ) %]
[% SET itemavailable = 0 %]
[% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn, opac => 1 ) %]
[% IF av_lib_include %]
[% av_lib_include | html %]
[% ELSE %]
Item withdrawn
[% END %]
[% END %]
[% IF NOT ( item.isa('Koha::Item') ) AND item.itemnotforloan %]
[% SET itemavailable = 0 %]
[% IF ( item.notforloanvalueopac ) %]
[% item.notforloanvalueopac | html %] [% IF ( item.restrictedvalueopac ) %]([% item.restrictedvalueopac | html %])[% END %]
[% ELSE %]
Not for loan [% IF ( item.restrictedvalueopac ) %]([% item.restrictedvalueopac | html %])[% END %]
[% END %]
[% ELSIF NOT ( item.isa('Koha::Item') ) AND item.notforloan_per_itemtype %]
[% SET itemavailable = 0 %]
Not for loan [% IF ( item.restrictedvalueopac ) %]([% item.restrictedvalueopac | 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.isa('Koha::Item') ) 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 ) %]
[% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %]
Available [% IF restrictedvalueopac %]([% restrictedvalueopac | html %])[% END %]
[% END %]