Bug 17642: use find_by_koha_field when needed
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
864aa5805d
commit
c45b26aea2
10
C4/Items.pm
10
C4/Items.pm
|
|
@ -1376,20 +1376,18 @@ sub GetItemsInfo {
|
|||
|
||||
my $av;
|
||||
# get notforloan complete status if applicable
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.notforloan', authorised_value => $data->{itemnotforloan} });
|
||||
$av = $av->count ? $av->next : undef;
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.notforloan', authorised_value => $data->{itemnotforloan} });
|
||||
$data->{notforloanvalue} = $av ? $av->lib : '';
|
||||
$data->{notforloanvalueopac} = $av ? $av->opac_description : '';
|
||||
|
||||
# get restricted status and description if applicable
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.restricted', authorised_value => $data->{restricted} });
|
||||
$av = $av->count ? $av->next : undef;
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.restricted', authorised_value => $data->{restricted} });
|
||||
$data->{restricted} = $av ? $av->lib : '';
|
||||
$data->{restrictedopac} = $av ? $av->opac_description : '';
|
||||
|
||||
# my stack procedures
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.stack', authorised_value => $data->{stack} });
|
||||
$data->{stack} = $av->count ? $av->next->lib : '';
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.stack', authorised_value => $data->{stack} });
|
||||
$data->{stack} = $av ? $av->lib : '';
|
||||
|
||||
# Find the last 3 people who borrowed this item.
|
||||
my $sth2 = $dbh->prepare("SELECT * FROM old_issues,borrowers
|
||||
|
|
|
|||
|
|
@ -129,20 +129,20 @@ if ($AcqCreateItem eq 'receiving') {
|
|||
foreach (@itemnumbers) {
|
||||
my $item = GetItem($_);
|
||||
my $av;
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $fw, kohafield => 'items.notforloan', authorised_value => $item->{notforloan} });
|
||||
$item->{notforloan} = $av->count ? $av->next->lib : '';
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $fw, kohafield => 'items.notforloan', authorised_value => $item->{notforloan} });
|
||||
$item->{notforloan} = $av ? $av->lib : '';
|
||||
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $fw, kohafield => 'items.restricted', authorised_value => $item->{restricted} });
|
||||
$item->{restricted} = $av->count ? $av->next->lib : '';
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $fw, kohafield => 'items.restricted', authorised_value => $item->{restricted} });
|
||||
$item->{restricted} = $av ? $av->lib : '';
|
||||
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $fw, kohafield => 'items.location', authorised_value => $item->{location} });
|
||||
$item->{location} = $av->count ? $av->next->lib : '';
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $fw, kohafield => 'items.location', authorised_value => $item->{location} });
|
||||
$item->{location} = $av ? $av->lib : '';
|
||||
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $fw, kohafield => 'items.collection', authorised_value => $item->{collection} });
|
||||
$item->{collection} = $av->count ? $av->next->lib : '';
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $fw, kohafield => 'items.collection', authorised_value => $item->{collection} });
|
||||
$item->{collection} = $av ? $av->lib : '';
|
||||
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} });
|
||||
$item->{materials} = $av->count ? $av->next->lib : '';
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} });
|
||||
$item->{materials} = $av ? $av->lib : '';
|
||||
|
||||
my $itemtype = getitemtypeinfo($item->{itype});
|
||||
$item->{itemtype} = $itemtype->{description};
|
||||
|
|
|
|||
|
|
@ -56,20 +56,20 @@ if($itemnumber) {
|
|||
}
|
||||
|
||||
my $av;
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $fw, kohafield => 'items.notforloan', authorised_value => $item->{notforloan} });
|
||||
$item->{notforloan} = $av->count ? $av->next->lib : '';
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({ frameworkcode => $fw, kohafield => 'items.notforloan', authorised_value => $item->{notforloan} });
|
||||
$item->{notforloan} = $av ? $av->lib : '';
|
||||
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $fw, kohafield => 'items.restricted', authorised_value => $item->{restricted} });
|
||||
$item->{restricted} = $av->count ? $av->next->lib : '';
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({ frameworkcode => $fw, kohafield => 'items.restricted', authorised_value => $item->{restricted} });
|
||||
$item->{restricted} = $av ? $av->lib : '';
|
||||
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $fw, kohafield => 'items.location', authorised_value => $item->{location} });
|
||||
$item->{location} = $av->count ? $av->next->lib : '';
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({ frameworkcode => $fw, kohafield => 'items.location', authorised_value => $item->{location} });
|
||||
$item->{location} = $av ? $av->lib : '';
|
||||
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $fw, kohafield => 'items.collection', authorised_value => $item->{collection} });
|
||||
$item->{collection} = $av->count ? $av->next->lib : '';
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({ frameworkcode => $fw, kohafield => 'items.collection', authorised_value => $item->{collection} });
|
||||
$item->{collection} = $av ? $av->lib : '';
|
||||
|
||||
$av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} });
|
||||
$item->{materials} = $av->count ? $av->next->lib : '';
|
||||
$av = Koha::AuthorisedValues->find_by_koha_field({ frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} });
|
||||
$item->{materials} = $av ? $av->lib : '';
|
||||
|
||||
my $itemtype = getitemtypeinfo($item->{itype});
|
||||
$item->{itemtype} = $itemtype->{description};
|
||||
|
|
|
|||
|
|
@ -393,8 +393,8 @@ if (@$barcodes) {
|
|||
unless($issueconfirmed){
|
||||
# Get the item title for more information
|
||||
my $materials = $iteminfo->{'materials'};
|
||||
my $av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $getmessageiteminfo->{frameworkcode}, kohafield => 'items.materials', authorised_value => $materials });
|
||||
$materials = $av->count ? $av->next->lib : '';
|
||||
my $av = Koha::AuthorisedValues->find_by_koha_field({ frameworkcode => $getmessageiteminfo->{frameworkcode}, kohafield => 'items.materials', authorised_value => $materials });
|
||||
$materials = $av ? $av->lib : '';
|
||||
$template_params->{additional_materials} = $materials;
|
||||
$template_params->{itemhomebranch} = $iteminfo->{'homebranch'};
|
||||
|
||||
|
|
|
|||
|
|
@ -279,8 +279,8 @@ if ($barcode) {
|
|||
$returnbranch = $biblio->{$hbr};
|
||||
|
||||
my $materials = $biblio->{'materials'};
|
||||
my $av = Koha::AuthorisedValues->search_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials });
|
||||
$materials = $av->count ? $av->next->lib : '';
|
||||
my $av = Koha::AuthorisedValues->find_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials });
|
||||
$materials = $av ? $av->lib : '';
|
||||
|
||||
$template->param(
|
||||
title => $biblio->{'title'},
|
||||
|
|
|
|||
Loading…
Reference in New Issue