From 9a5127b8a8580958e3ef4a305f730476144ee11e Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Mon, 26 Oct 2020 10:49:49 +0100 Subject: [PATCH] Bug 26032: (follow-up 2) show 'is new' filter only if items.new_status is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also adds a class 'item-new-status' to this filter to be able to hidde even if items.new_status used. Addition to test plan: 1) Apply on a database without Koha to MARC mapping on items.new_status 2) Check you dont see the 'is new' filter in items search form 3) Apply on a database with Koha to MARC mapping on items.new_status 4) Check you see class 'form-field item-new-status' Signed-off-by: Séverine QUEUNE --- catalogue/itemsearch.pl | 4 ++++ koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl index 2ea3215..f5f66fe 100755 --- a/catalogue/itemsearch.pl +++ b/catalogue/itemsearch.pl @@ -102,6 +102,10 @@ my $itemlost_values = $mss->count ? GetAuthorisedValues($mss->next->authorised_v $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.withdrawn', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); my $withdrawn_values = $mss->count ? GetAuthorisedValues($mss->next->authorised_value) : []; +if ( Koha::MarcSubfieldStructures->search( { frameworkcode => '', kohafield => 'items.new_status' } )->count ) { + $template->param( has_new_status => 1 ); +} + if (scalar keys %params > 0) { # Parameters given, it's a search diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt index 22d3ca6..9172657 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt @@ -90,7 +90,7 @@ [% END %] [% BLOCK form_field_radio_yes_no %] -
+
@@ -195,7 +195,9 @@ (inclusive)
[% INCLUDE form_field_radio_yes_no name="damaged" %] - [% INCLUDE form_field_radio_yes_no name="new_status" %] + [% IF ( has_new_status ) %] + [% INCLUDE form_field_radio_yes_no name="new_status" divclass='item-new-status' %] + [% END %]