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 36-41 use C4::Circulation; Link Here
36
use C4::Reports::Guided;    #_get_column_defs
36
use C4::Reports::Guided;    #_get_column_defs
37
use C4::Charset;
37
use C4::Charset;
38
use Koha::DateUtils;
38
use Koha::DateUtils;
39
use Koha::AuthorisedValues;
39
use List::MoreUtils qw( none );
40
use List::MoreUtils qw( none );
40
41
41
42
Lines 297-303 foreach my $item ( @scanned_items ) { Link Here
297
        my ($f, $sf) = GetMarcFromKohaField("items.$field", $fc);
298
        my ($f, $sf) = GetMarcFromKohaField("items.$field", $fc);
298
        if ($f and $sf) {
299
        if ($f and $sf) {
299
            # We replace the code with it's description
300
            # We replace the code with it's description
300
            my $authvals = C4::Koha::GetKohaAuthorisedValuesFromField($f, $sf, $fc);
301
            my $av = Koha::AuthorisedValues->search_by_marc_field({ frameworkcode => $fc, tagfield => $f, tagsubfield => $sf, });
302
            $av = $av->count ? $av->unblessed : [];
303
            my $authvals = { map { ( $_->{authorised_value} => $_->{lib} ) } @$av };
301
            if ($authvals and defined $item->{$field} and defined $authvals->{$item->{$field}}) {
304
            if ($authvals and defined $item->{$field} and defined $authvals->{$item->{$field}}) {
302
              $item->{$field} = $authvals->{$item->{$field}};
305
              $item->{$field} = $authvals->{$item->{$field}};
303
            }
306
            }
304
- 

Return to bug 17249