From 70796c5d314c7d13924dbf5a64dfff7cbba7d6ac Mon Sep 17 00:00:00 2001 From: Fridolin Somers <fridolin.somers@biblibre.com> Date: Fri, 2 Feb 2018 14:34:34 +0100 Subject: [PATCH] Bug 20131: Inventory optional filters correct "For loan" addition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In inventory, optional filters are build from authorize values categories used for items.notforloan, items.itemlost, items.withdrawn and items.damaged. The bug is that description of value 0 is always "For loan". This seems to be only for "notforloan". Second bug is that if a description exists for "notforloan" value 0, it is not used. This patch corrects by adding "For loan" only for "notforloan" authorized values and if there is no 0 value. It changes the description added by code from "ignore" to a more unlikly user defined "__IGNORE__". Test plan: 1) Make sure you have authorized values defined on items.notforloan, say "NFL" category, with at least a value and description but no 0 value 2) Make sure you have authorized values defined on items.itemlost, say "LOST" category, with 0 = "Not lost" and 1 = "Lost" 3) Go to inventory /cgi-bin/koha/tools/inventory.pl 4) Without patch you see "For loan" on both items.notforloan and items.itemlost 5) With patch you see "For loan" only in items.notforloan, you see for items.itemlost : "Not lost" and "Lost" 6) Create in authorized values category "NFL" a value 0 with description "Available" 7) Go to inventory /cgi-bin/koha/tools/inventory.pl 8) Without patch you see "For loan" in items.notforloan for value 0 9) With patch you see "Available" in items.notforloan for value 0 Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> --- koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt | 2 +- tools/inventory.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt index ed55ceb..1b3a9a2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -96,7 +96,7 @@ [% IF (value.lib) %] <li> <label for="[% value.id %]"> - [% IF value.authorised_value==0 %] + [% IF ( status.fieldname == 'items.notforloan' && value.authorised_value == 0 && value.lib == '__IGNORE__' ) %] For loan [% ELSE %] [% value.lib %] diff --git a/tools/inventory.pl b/tools/inventory.pl index c671488..e03b0bd 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -95,7 +95,7 @@ for my $statfield (qw/items.notforloan items.itemlost items.withdrawn items.dama if ( $statfield eq 'items.notforloan') { # Add notforloan == 0 to the list of possible notforloan statuses # The lib value is replaced in the template - push @$arr, { authorised_value => 0, id => 'stat0' , lib => 'ignore' } if ! grep { $_->{authorised_value} eq '0' } @$arr; + push @$arr, { authorised_value => 0, id => 'stat0' , lib => '__IGNORE__' } if ! grep { $_->{authorised_value} eq '0' } @$arr; @notforloans = map { $_->{'authorised_value'} } @$arr; } $hash->{values} = $arr; -- 2.1.4