From 65be8b9ac1aa3720eeee8e19499a6c87311332a9 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 26 Mar 2018 13:20:53 +0200 Subject: [PATCH] Bug 20469: Add item status to staff article request form Content-Type: text/plain; charset=utf-8 The template checks if an item is checked out, on hold (waiting or transit), not for loan. (Note: This can be extended in the future in a general include as we have at opac side.) Test plan: [1] Place an article request on an item on loan. Verify status on form. [2] Place an article request on a waiting item. Check status again. Signed-off-by: Marcel de Rooy Signed-off-by: Owen Leonard [EDIT] Simplified on 2020-07-23. Removed Koha::Item->is_waiting_or_transit. Added template plugin call ItemTypes->Notforloan. Adjusted commit message accordingly. Additional test: [3] Place an article request on a not for loan item. Check status. NOTE: Not for loan is informational too. It does not say that this item is not available for an article request. Depends on local situation. Signed-off-by: Marcel de Rooy --- Koha/Template/Plugin/ItemTypes.pm | 7 +++++++ .../intranet-tmpl/prog/en/modules/circ/article-requests.tt | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/Koha/Template/Plugin/ItemTypes.pm b/Koha/Template/Plugin/ItemTypes.pm index 20910562b0..e8f3c6e5b1 100644 --- a/Koha/Template/Plugin/ItemTypes.pm +++ b/Koha/Template/Plugin/ItemTypes.pm @@ -34,4 +34,11 @@ sub Get { return Koha::ItemTypes->search_with_localization->unblessed; } +sub Notforloan { + my ( $self, $itemtypecode ) = @_; + my $itemtype = Koha::ItemTypes->find( $itemtypecode ); + return if !$itemtype; + return $itemtype->notforloan; +} + 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt index 10e69f48a4..824d72cd48 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt @@ -42,6 +42,13 @@ [% END %] +[% BLOCK item_status %] + [% IF myitem.onloan %]Checked out + [% ELSIF myitem.holds({ found => ['W', 'T'] }).count > 0 %]On hold + [% ELSIF myitem.notforloan > 0 OR ItemTypes.Notforloan(myitem.effective_itemtype) %]Not for loan + [% ELSIF myitem.notforloan < 0 %]On order + [% END %] +[% END %] [% INCLUDE 'header.inc' %] @@ -107,6 +114,7 @@ Collection Item type Call number + Status Copy number Enumeration Barcode @@ -176,6 +184,7 @@ [% ar.item.itemcallnumber | html %] + [% PROCESS 'item_status' myitem = ar.item IF ar.item %] [% ar.item.copynumber | html %] [% ar.item.enumchron | html %] [% ar.item.barcode | html %] @@ -212,6 +221,7 @@ Collection Item type Call number + Status Copy number Enumeration Barcode @@ -281,6 +291,7 @@ [% ar.item.itemcallnumber | html %] + [% PROCESS 'item_status' myitem = ar.item IF ar.item %] [% ar.item.copynumber | html %] [% ar.item.enumchron | html %] [% ar.item.barcode | html %] -- 2.11.0