@@ -, +, @@
---
.../prog/en/includes/item-status.inc | 113 +++++++++---------
1 file changed, 54 insertions(+), 59 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc
@@ -1,72 +1,54 @@
-[% USE Branches %]
[% USE AuthorisedValues %]
-[% SET itemavailable = 1 %]
+[% USE Branches %]
+[% USE Koha %]
+[% USE KohaDates %]
-[%#- 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. -%]
+[% SET itemavailable = 1 %]
[% IF ( item.itemlost ) %]
[% SET itemavailable = 0 %]
- [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) %]
- [% IF ( av_lib_include ) %]
- [% av_lib_include | html %]
+ [% itemlost_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) %]
+ [% IF ( itemlost_description ) %]
+ [% itemlost_description | html %]
[% ELSE %]
- Item lost
+ Lost
[% END %]
[% END %]
-[% IF item.isa('Koha::Item') %]
- [% SET datedue = issue.date_due %]
- [% SET onsite_checkout = issue.onsite_checkout %]
-[% ELSE %]
- [% SET datedue = item.datedue || issue.date_due %]
- [% SET onsite_checkout = item.onsite_checkout %]
-[% END %]
-[% IF datedue %]
+[% checkout = item.checkout %]
+[% IF ( checkout ) %]
[% 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 %]
+ [% IF checkout.onsite_checkout %]
+ Currently in local use by [% INCLUDE 'patron-title.inc' patron=checkout.patron hide_patron_infos_if_needed=1 %]
[% ELSE %]
- [% IF ( OPACShowCheckoutName ) %]
- Checked out to [% item.firstname | html %] [% item.surname | html %] [% IF ( item.cardnumber ) %]([% item.cardnumber | html %])[% END %]
- [% ELSE %]
- Checked out
- [% END %]
+ Checked out to [% INCLUDE 'patron-title.inc' patron=checkout.patron hide_patron_infos_if_needed=1 %]
[% END %]
+ Due: [% checkout.date_due | $KohaDates %]
[% END %]
-[% IF NOT ( item.isa('Koha::Item') ) AND item.transfertwhen %] [%# transfertwhen is set in C4::Search, do not have it for course reserves %]
+[% transfer = item.get_transfer %]
+[% IF ( transfer.in_transit ) %]
[% SET itemavailable = 0 %]
- In transit from [% Branches.GetName( item.transfertfrom ) | html %]
- to [% Branches.GetName( item.transfertto ) | html %] since [% item.transfertwhen | $KohaDates %]
-[% END %]
-
-[% IF NOT( item.isa('Koha::Item') ) AND item.waiting %] [%# Not sure where does come from this waiting flag %]
- [% SET itemavailable = 0 %]
- On hold
+ In transit from [% Branches.GetName( transfer.frombranch ) | html %]
+ to [% Branches.GetName( transfer.tobranch ) | html %] since [% transfer.datesent | $KohaDates %]
[% END %]
[% IF ( item.withdrawn ) %]
[% SET itemavailable = 0 %]
- [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) %]
- [% IF av_lib_include %]
- [% av_lib_include | html %]
+ [% withdrawn_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) %]
+ [% IF withdrawn_description %]
+ [% withdrawn_description | html %]
[% ELSE %]
- Item withdrawn
+ Withdrawn
[% END %]
[% END %]
-[% IF ( item.notforloan ) %]
+[% IF ( item.notforloan || item.effective_itemtype.notforloan ) %]
[% SET itemavailable = 0 %]
- [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %]
- [% IF av_lib_include %]
- [% av_lib_include | html %]
+ [% SET notforloan = item.notforloan || item.effective_itemtype.notforloan %]
+ [% notforloan_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => notforloan ) %]
+ [% IF notforloan_description %]
+ [% notforloan_description | html %]
[% ELSE %]
Not for loan
[% END %]
@@ -74,21 +56,11 @@
[% IF ( item.damaged ) %]
[% SET itemavailable = 0 %]
- [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged ) %]
- [% IF av_lib_include %]
- [% av_lib_include | html %]
- [% ELSE %]
- Item damaged
- [% END %]
-[% END %]
-
-[% IF ( item.restricted ) %]
- [% SET itemavailable = 0 %]
- [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) %]
- [% IF av_lib_include %]
- [% av_lib_include | html %]
+ [% damaged_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged ) %]
+ [% IF damaged_description %]
+ [% damaged_description | html %]
[% ELSE %]
- On order
+ Damaged
[% END %]
[% END %]
@@ -97,6 +69,29 @@
Pending hold
[% END %]
+[% hold = item.holds.next %]
+[% IF hold %]
+ [% IF hold.waitingdate %]
+ [% SET itemavailable = 0 %]
+ Waiting at [% Branches.GetName(hold.get_column('branchcode')) | html %] since [% hold.waitingdate | $KohaDates %].
+ [% ELSE %]
+ Item-level hold (placed [% hold.reservedate | $KohaDates %]) for delivery at [% Branches.GetName(hold.get_column('branchcode')) | html %].
+ [% END %]
+ [% IF Koha.Preference('canreservefromotherbranches') %]
+ Hold for: [% INCLUDE 'patron-title.inc' patron=hold.borrower hide_patron_infos_if_needed=1 %]
+ [% END %]
+
+[% END %]
+
[% IF ( itemavailable ) %]
Available
[% END %]
+
+[% IF ( item.restricted ) %]
+ [% restricted_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) %]
+ [% IF restricted_description %]
+ [% restricted_description | html %]
+ [% ELSE %]
+ Restricted
+ [% END %]
+[% END %]
--