From 9007c6e8587196ab05e5727eac1e4bbb6c4ae9e4 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Fri, 23 Feb 2018 14:29:48 +0100 Subject: [PATCH] Bug 20067: Fix other checks for linked authorised value categories The same pattern was used in other files, this patch fixes it. Signed-off-by: Jesse Maseto Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- C4/Search.pm | 2 +- catalogue/detail.pl | 4 ++-- catalogue/itemsearch.pl | 6 +++--- catalogue/moredetail.pl | 6 +++--- circ/circulation.pl | 2 +- tools/inventory.pl | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index c11a61e812..d92abe9276 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1865,7 +1865,7 @@ sub searchResults { { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' } ) }; # get notforloan authorised value list (see $shelflocations FIXME) - my $av = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.notforloan', authorised_value => { not => undef } }); + my $av = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.notforloan', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); my $notforloan_authorised_value = $av->count ? $av->next->authorised_value : undef; #Get itemtype hash diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 6455604eb3..86a0698c2f 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -203,11 +203,11 @@ my $copynumbers = my (@itemloop, @otheritemloop, %itemfields); my $norequests = 1; -my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => { not => undef } }); +my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); if ( $mss->count ) { $template->param( itemlostloop => GetAuthorisedValues( $mss->next->authorised_value ) ); } -$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.damaged', authorised_value => { not => undef } }); +$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.damaged', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); if ( $mss->count ) { $template->param( itemdamagedloop => GetAuthorisedValues( $mss->next->authorised_value ) ); } diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl index 517aa81935..ab833db3e2 100755 --- a/catalogue/itemsearch.pl +++ b/catalogue/itemsearch.pl @@ -97,10 +97,10 @@ my ($template, $borrowernumber, $cookie) = get_template_and_user({ flagsrequired => { catalogue => 1 }, }); -my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.notforloan', authorised_value => { not => undef } }); +my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.notforloan', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); my $notforloan_values = $mss->count ? GetAuthorisedValues($mss->next->authorised_value) : []; -$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.location', authorised_value => { not => undef } }); +$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.location', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); my $location_values = $mss->count ? GetAuthorisedValues($mss->next->authorised_value) : []; if (scalar keys %params > 0) { @@ -285,7 +285,7 @@ foreach my $itemtype ( Koha::ItemTypes->search ) { }; } -$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.ccode', authorised_value => { not => undef } }); +$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.ccode', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); my $ccode_avcode = $mss->count ? $mss->next->authorised_value : 'CCODE'; my $ccodes = GetAuthorisedValues($ccode_avcode); my @ccodes; diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index c82e6538ff..845d10e9e9 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -190,15 +190,15 @@ foreach my $item (@items){ } } -my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => { not => undef } }); +my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); if ( $mss->count ) { $template->param( itemlostloop => GetAuthorisedValues( $mss->next->authorised_value ) ); } -$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.damaged', authorised_value => { not => undef } }); +$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.damaged', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); if ( $mss->count ) { $template->param( itemdamagedloop => GetAuthorisedValues( $mss->next->authorised_value ) ); } -$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.withdrawn', authorised_value => { not => undef } }); +$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.withdrawn', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); if ( $mss->count ) { $template->param( itemwithdrawnloop => GetAuthorisedValues( $mss->next->authorised_value) ); } diff --git a/circ/circulation.pl b/circ/circulation.pl index 9ddf3d5a45..1617584cf4 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -352,7 +352,7 @@ if (@$barcodes) { if ( $item ) { $biblio = $item->biblio; - my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.notforloan', authorised_value => { not => undef } }); + my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.notforloan', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); $template_params->{authvalcode_notforloan} = $mss->count ? $mss->next->authorised_value : undef; } diff --git a/tools/inventory.pl b/tools/inventory.pl index c671488ef4..3da000afc0 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -71,7 +71,7 @@ unshift @$frameworks, { frameworkcode => '' }; for my $fwk ( @$frameworks ){ my $fwkcode = $fwk->{frameworkcode}; - my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fwkcode, kohafield => 'items.location', authorised_value => { not => undef } }); + my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fwkcode, kohafield => 'items.location', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); my $authcode = $mss->count ? $mss->next->authorised_value : undef; if ($authcode && $authorisedvalue_categories!~/\b$authcode\W/){ $authorisedvalue_categories.="$authcode "; @@ -88,7 +88,7 @@ my @notforloans; for my $statfield (qw/items.notforloan items.itemlost items.withdrawn items.damaged/){ my $hash = {}; $hash->{fieldname} = $statfield; - my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => $statfield, authorised_value => { not => undef } }); + my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => $statfield, authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); $hash->{authcode} = $mss->count ? $mss->next->authorised_value : undef; if ($hash->{authcode}){ my $arr = GetAuthorisedValues($hash->{authcode}); -- 2.39.5