Bug 17249: Remove GetKohaAuthorisedValuesFromField - inventory
This patch deals with the inventory files calling GetKohaAuthorisedValuesFromField. Test plan: prove t/db_dependent/Items/GetItemsForInventory.t should still return green Use the inventory tool, on the result page the AV descriptions should correctly replace the codes Signed-off-by: Owen Leonard <oleonard@myacpl.org> 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
1626087562
commit
7ea9b72c67
|
|
@ -20,6 +20,8 @@
|
|||
use Modern::Perl;
|
||||
use Test::More tests => 6;
|
||||
|
||||
use Koha::AuthorisedValues;
|
||||
|
||||
$| = 1;
|
||||
|
||||
BEGIN {
|
||||
|
|
@ -143,7 +145,9 @@ sub OldWay {
|
|||
my ($f, $sf) = C4::Biblio::GetMarcFromKohaField("items.$field", $row->{'frameworkcode'});
|
||||
if (defined($f) and defined($sf)) {
|
||||
# We replace the code with it's description
|
||||
my $authvals = C4::Koha::GetKohaAuthorisedValuesFromField($f, $sf, $row->{'frameworkcode'});
|
||||
my $av = Koha::AuthorisedValues->search_by_marc_field({ frameworkcode => $row->{frameworkcode}, tagfield => $f, tagsubfield => $sf, });
|
||||
$av = $av->count ? $av->unblessed : [];
|
||||
my $authvals = { map { ( $_->{authorised_value} => $_->{lib} ) } @$av };
|
||||
$row->{$field} = $authvals->{$row->{$field}} if defined $authvals && defined $row->{$field} && defined $authvals->{$row->{$field}};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ use C4::Circulation;
|
|||
use C4::Reports::Guided; #_get_column_defs
|
||||
use C4::Charset;
|
||||
use Koha::DateUtils;
|
||||
use Koha::AuthorisedValues;
|
||||
use List::MoreUtils qw( none );
|
||||
|
||||
|
||||
|
|
@ -297,7 +298,9 @@ foreach my $item ( @scanned_items ) {
|
|||
my ($f, $sf) = GetMarcFromKohaField("items.$field", $fc);
|
||||
if ($f and $sf) {
|
||||
# We replace the code with it's description
|
||||
my $authvals = C4::Koha::GetKohaAuthorisedValuesFromField($f, $sf, $fc);
|
||||
my $av = Koha::AuthorisedValues->search_by_marc_field({ frameworkcode => $fc, tagfield => $f, tagsubfield => $sf, });
|
||||
$av = $av->count ? $av->unblessed : [];
|
||||
my $authvals = { map { ( $_->{authorised_value} => $_->{lib} ) } @$av };
|
||||
if ($authvals and defined $item->{$field} and defined $authvals->{$item->{$field}}) {
|
||||
$item->{$field} = $authvals->{$item->{$field}};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue