View | Details | Raw Unified | Return to bug 17249
Collapse All | Expand All

(-)a/t/db_dependent/Items/GetItemsForInventory.t (-1 / +5 lines)
Lines 20-25 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
use Test::More tests => 6;
21
use Test::More tests => 6;
22
22
23
use Koha::AuthorisedValues;
24
23
$| = 1;
25
$| = 1;
24
26
25
BEGIN {
27
BEGIN {
Lines 143-149 sub OldWay { Link Here
143
            my ($f, $sf) = C4::Biblio::GetMarcFromKohaField("items.$field", $row->{'frameworkcode'});
145
            my ($f, $sf) = C4::Biblio::GetMarcFromKohaField("items.$field", $row->{'frameworkcode'});
144
            if (defined($f) and defined($sf)) {
146
            if (defined($f) and defined($sf)) {
145
                # We replace the code with it's description
147
                # We replace the code with it's description
146
                my $authvals = C4::Koha::GetKohaAuthorisedValuesFromField($f, $sf, $row->{'frameworkcode'});
148
                my $av = Koha::AuthorisedValues->search_by_marc_field({ frameworkcode => $row->{frameworkcode}, tagfield => $f, tagsubfield => $sf, });
149
                $av = $av->count ? $av->unblessed : [];
150
                my $authvals = { map { ( $_->{authorised_value} => $_->{lib} ) } @$av };
147
                $row->{$field} = $authvals->{$row->{$field}} if defined $authvals && defined $row->{$field} && defined $authvals->{$row->{$field}};
151
                $row->{$field} = $authvals->{$row->{$field}} if defined $authvals && defined $row->{$field} && defined $authvals->{$row->{$field}};
148
            }
152
            }
149
        }
153
        }
(-)a/tools/inventory.pl (-2 / +4 lines)
Lines 37-42 use C4::Circulation; Link Here
37
use C4::Reports::Guided;    #_get_column_defs
37
use C4::Reports::Guided;    #_get_column_defs
38
use C4::Charset;
38
use C4::Charset;
39
use Koha::DateUtils;
39
use Koha::DateUtils;
40
use Koha::AuthorisedValues;
40
use List::MoreUtils qw( none );
41
use List::MoreUtils qw( none );
41
42
42
43
Lines 309-315 foreach my $item ( @scanned_items ) { Link Here
309
        my ($f, $sf) = GetMarcFromKohaField("items.$field", $fc);
310
        my ($f, $sf) = GetMarcFromKohaField("items.$field", $fc);
310
        if ($f and $sf) {
311
        if ($f and $sf) {
311
            # We replace the code with it's description
312
            # We replace the code with it's description
312
            my $authvals = C4::Koha::GetKohaAuthorisedValuesFromField($f, $sf, $fc);
313
            my $av = Koha::AuthorisedValues->search_by_marc_field({ frameworkcode => $fc, tagfield => $f, tagsubfield => $sf, });
314
            $av = $av->count ? $av->unblessed : [];
315
            my $authvals = { map { ( $_->{authorised_value} => $_->{lib} ) } @$av };
313
            if ($authvals and defined $item->{$field} and defined $authvals->{$item->{$field}}) {
316
            if ($authvals and defined $item->{$field} and defined $authvals->{$item->{$field}}) {
314
              $item->{$field} = $authvals->{$item->{$field}};
317
              $item->{$field} = $authvals->{$item->{$field}};
315
            }
318
            }
316
- 

Return to bug 17249