From 3bb7a902d0e76f0b0499f9ce7c9182dc02999a8b 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 --- 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 c11a61e..d92abe9 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 c50869f..3702078 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 369142e..c035a64 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) { @@ -284,7 +284,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 c82e653..845d10e 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 93ed09c..1aa6d55 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -350,7 +350,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 c671488..3da000a 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.1.4