From 3ecc48ed5b01c9d03108cd94b943ade3f535f644 Mon Sep 17 00:00:00 2001 From: Mason James Date: Wed, 20 Sep 2017 15:59:19 +1200 Subject: [PATCH] Revert "Bug 17249: Remove GetKohaAuthorisedValuesFromField - inventory" This reverts commit a1b569f89eead58d274a6c75d2790bda94fc0c55. --- t/db_dependent/Items/GetItemsForInventory.t | 6 +----- tools/inventory.pl | 5 +---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/t/db_dependent/Items/GetItemsForInventory.t b/t/db_dependent/Items/GetItemsForInventory.t index 32ea963130..69451f05b9 100755 --- a/t/db_dependent/Items/GetItemsForInventory.t +++ b/t/db_dependent/Items/GetItemsForInventory.t @@ -20,8 +20,6 @@ use Modern::Perl; use Test::More tests => 6; -use Koha::AuthorisedValues; - $| = 1; BEGIN { @@ -145,9 +143,7 @@ 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 $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 }; + my $authvals = C4::Koha::GetKohaAuthorisedValuesFromField($f, $sf, $row->{'frameworkcode'}); $row->{$field} = $authvals->{$row->{$field}} if defined $authvals && defined $row->{$field} && defined $authvals->{$row->{$field}}; } } diff --git a/tools/inventory.pl b/tools/inventory.pl index 9f914b2de3..8a6f3aca13 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -37,7 +37,6 @@ use C4::Circulation; use C4::Reports::Guided; #_get_column_defs use C4::Charset; use Koha::DateUtils; -use Koha::AuthorisedValues; use List::MoreUtils qw( none ); @@ -304,9 +303,7 @@ 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 $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 }; + my $authvals = C4::Koha::GetKohaAuthorisedValuesFromField($f, $sf, $fc); if ($authvals and defined $item->{$field} and defined $authvals->{$item->{$field}}) { $item->{$field} = $authvals->{$item->{$field}}; } -- 2.39.5