Lines 137-142
sub OldWay {
Link Here
|
137 |
$sth->execute( @bind_params ); |
137 |
$sth->execute( @bind_params ); |
138 |
my ($iTotalRecords) = $sth->fetchrow_array(); |
138 |
my ($iTotalRecords) = $sth->fetchrow_array(); |
139 |
|
139 |
|
|
|
140 |
my $marc_field_mapping; |
140 |
foreach my $row (@$tmpresults) { |
141 |
foreach my $row (@$tmpresults) { |
141 |
|
142 |
|
142 |
# Auth values |
143 |
# Auth values |
Lines 145-153
sub OldWay {
Link Here
|
145 |
my ($f, $sf) = C4::Biblio::GetMarcFromKohaField("items.$field", $row->{'frameworkcode'}); |
146 |
my ($f, $sf) = C4::Biblio::GetMarcFromKohaField("items.$field", $row->{'frameworkcode'}); |
146 |
if (defined($f) and defined($sf)) { |
147 |
if (defined($f) and defined($sf)) { |
147 |
# We replace the code with it's description |
148 |
# We replace the code with it's description |
148 |
my $av = Koha::AuthorisedValues->search_by_marc_field({ frameworkcode => $row->{frameworkcode}, tagfield => $f, tagsubfield => $sf, }); |
149 |
my $avs; |
149 |
$av = $av->count ? $av->unblessed : []; |
150 |
if ( exists $marc_field_mapping->{$row->{frameworkcode}}{$f}{$sf} ) { |
150 |
my $authvals = { map { ( $_->{authorised_value} => $_->{lib} ) } @$av }; |
151 |
$avs = $marc_field_mapping->{$row->{frameworkcode}}{$f}{$sf}; |
|
|
152 |
} else { |
153 |
$avs = Koha::AuthorisedValues->search_by_marc_field({ frameworkcode => $row->{frameworkcode}, tagfield => $f, tagsubfield => $sf, }); |
154 |
$marc_field_mapping->{$row->{frameworkcode}}{$f}{$sf} = $avs->unblessed; |
155 |
} |
156 |
my $authvals = { map { $_->{authorised_value} => $_->{lib} } @{ $marc_field_mapping->{$row->{frameworkcode}}{$f}{$sf} } }; |
151 |
$row->{$field} = $authvals->{$row->{$field}} if defined $authvals && defined $row->{$field} && defined $authvals->{$row->{$field}}; |
157 |
$row->{$field} = $authvals->{$row->{$field}} if defined $authvals && defined $row->{$field} && defined $authvals->{$row->{$field}}; |
152 |
} |
158 |
} |
153 |
} |
159 |
} |
154 |
- |
|
|