Bug 17250: Do not retrieve marc subfield structure when the authorised value is not defined
GetAuthValCode did not return anything if the authorised_value column was not defined. Our new calls to Koha::MarcSubfieldStructures->search should behave the same Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
d019f86f67
commit
0b6f129ac3
|
|
@ -1852,7 +1852,7 @@ sub searchResults {
|
|||
my $shelflocations =GetKohaAuthorisedValues('items.location','');
|
||||
|
||||
# get notforloan authorised value list (see $shelflocations FIXME)
|
||||
my $av = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.notforloan' });
|
||||
my $av = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.notforloan', authorised_value => { not => undef } });
|
||||
my $notforloan_authorised_value = $av->count ? $av->next->authorised_value : undef;
|
||||
|
||||
#Get itemtype hash
|
||||
|
|
|
|||
|
|
@ -195,16 +195,16 @@ my $copynumbers = GetKohaAuthorisedValues('items.copynumber', $fw);
|
|||
my (@itemloop, @otheritemloop, %itemfields);
|
||||
my $norequests = 1;
|
||||
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost' });
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => { not => undef } });
|
||||
if ( $mss->count ) {
|
||||
$template->param( itemlostloop => GetAuthorisedValues( $mss->next->authorised_value ) );
|
||||
}
|
||||
$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.damaged' });
|
||||
$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.damaged', authorised_value => { not => undef } });
|
||||
if ( $mss->count ) {
|
||||
$template->param( itemdamagedloop => GetAuthorisedValues( $mss->next->authorised_value ) );
|
||||
}
|
||||
|
||||
$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.materials' });
|
||||
$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.materials', authorised_value => { not => undef } });
|
||||
my %materials_map;
|
||||
if ($mss->count) {
|
||||
my $materials_authvals = GetAuthorisedValues($mss->next->authorised_value);
|
||||
|
|
|
|||
|
|
@ -88,10 +88,10 @@ my ($template, $borrowernumber, $cookie) = get_template_and_user({
|
|||
flagsrequired => { catalogue => 1 },
|
||||
});
|
||||
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.notforloan' });
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.notforloan', authorised_value => { not => undef } });
|
||||
my $notforloan_values = $mss->count ? GetAuthorisedValues($mss->next->authorised_value) : [];
|
||||
|
||||
$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.location' });
|
||||
$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.location', authorised_value => { not => undef } });
|
||||
my $location_values = $mss->count ? GetAuthorisedValues($mss->next->authorised_value) : [];
|
||||
|
||||
if (scalar keys %params > 0) {
|
||||
|
|
@ -264,7 +264,7 @@ if ($format eq 'html') {
|
|||
};
|
||||
}
|
||||
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.ccode' });
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.ccode', authorised_value => { not => undef } });
|
||||
my $ccode_avcode = $mss->count ? $mss->next->authorised_value : 'CCODE';
|
||||
my $ccodes = GetAuthorisedValues($ccode_avcode);
|
||||
my @ccodes;
|
||||
|
|
|
|||
|
|
@ -194,17 +194,17 @@ foreach my $item (@items){
|
|||
|
||||
}
|
||||
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost' });
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => { not => undef } });
|
||||
if ( $mss->count ) {
|
||||
$template->param( itemlostloop => GetAuthorisedValues( $mss->next->authorisedvalue ) );
|
||||
$template->param( itemlostloop => GetAuthorisedValues( $mss->next->authorised_value ) );
|
||||
}
|
||||
$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.damaged' });
|
||||
$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.damaged', authorised_value => { not => undef } });
|
||||
if ( $mss->count ) {
|
||||
$template->param( itemdamagedloop => GetAuthorisedValues( $mss->next->authorisedvalue ) );
|
||||
$template->param( itemdamagedloop => GetAuthorisedValues( $mss->next->authorised_value ) );
|
||||
}
|
||||
$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.withdrawn' });
|
||||
$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.withdrawn', authorised_value => { not => undef } });
|
||||
if ( $mss->count ) {
|
||||
$template->param( itemwithdrawnloop => GetAuthorisedValues( $mss->next->authorisedvalue) );
|
||||
$template->param( itemwithdrawnloop => GetAuthorisedValues( $mss->next->authorised_value) );
|
||||
}
|
||||
|
||||
$template->param(count => $data->{'count'},
|
||||
|
|
|
|||
|
|
@ -341,8 +341,8 @@ if (@$barcodes) {
|
|||
# Get the item title for more information
|
||||
my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode);
|
||||
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $getmessageiteminfo->{frameworkcode}, kohafield => 'items.notforloan' });
|
||||
$template_params->{authvalcode_notforloan} = $mss->count ? $mss->next->authorisedvalue : undef;
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $getmessageiteminfo->{frameworkcode}, kohafield => 'items.notforloan', authorised_value => { not => undef } });
|
||||
$template_params->{authvalcode_notforloan} = $mss->count ? $mss->next->authorised_value : undef;
|
||||
|
||||
# Fix for bug 7494: optional checkout-time fallback search for a book
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ $frameworks->{''} = {frameworkcode => ''}; # Add the default framework
|
|||
|
||||
for my $fwk (keys %$frameworks){
|
||||
my $fwkcode = $frameworks->{$fwk}->{'frameworkcode'};
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fwkcode, kohafield => 'items.location' });
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fwkcode, kohafield => 'items.location', authorised_value => { not => 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 $statuses = [];
|
|||
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 });
|
||||
my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => $statfield, authorised_value => { not => undef } });
|
||||
$hash->{authcode} = $mss->count ? $mss->next->authorised_value : undef;
|
||||
if ($hash->{authcode}){
|
||||
my $arr = GetAuthorisedValues($hash->{authcode});
|
||||
|
|
|
|||
Loading…
Reference in New Issue