Lines 1120-1135
sub GetItemsForInventory {
Link Here
|
1120 |
$sth->execute( @bind_params ); |
1120 |
$sth->execute( @bind_params ); |
1121 |
my ($iTotalRecords) = $sth->fetchrow_array(); |
1121 |
my ($iTotalRecords) = $sth->fetchrow_array(); |
1122 |
|
1122 |
|
|
|
1123 |
my $query_mapping = "select TA.kohafield,TA.authorised_value AS category,TA.frameworkcode,TB.authorised_value,IF(TB.lib_opac>'',TB.lib_opac,TB.lib) AS OPAC,TB.lib AS Intranet,TB.lib_opac from marc_subfield_structure as TA JOIN authorised_values as TB ON TA.authorised_value=TB.category where TA.kohafield>'' and TA.authorised_value>''"; |
1124 |
$sth = $dbh->prepare($query_mapping); |
1125 |
$sth->execute(); |
1126 |
my $avmapping; |
1127 |
while (my $row = $sth->fetchrow_hashref) { |
1128 |
$avmapping->{$row->{kohafield}}->{$row->{frameworkcode}}->{$row->{authorised_value}} = $row->{OPAC}; |
1129 |
} |
1130 |
|
1123 |
foreach my $row (@$tmpresults) { |
1131 |
foreach my $row (@$tmpresults) { |
1124 |
|
1132 |
|
1125 |
# Auth values |
1133 |
# Auth values |
1126 |
foreach (keys %$row) { |
1134 |
foreach (keys %$row) { |
1127 |
# If the koha field is mapped to a marc field |
1135 |
if (defined($avmapping->{"items.$_"}->{$row->{'frameworkcode'}}->{$row->{$_}})) { |
1128 |
my ($f, $sf) = GetMarcFromKohaField("items.$_", $row->{'frameworkcode'}); |
1136 |
$row->{$_} = $avmapping->{"items.$_"}->{$row->{'frameworkcode'}}->{$row->{$_}}; |
1129 |
if ($f and $sf) { |
|
|
1130 |
# We replace the code with it's description |
1131 |
my $authvals = C4::Koha::GetKohaAuthorisedValuesFromField($f, $sf, $row->{'frameworkcode'}); |
1132 |
$row->{$_} = $authvals->{$row->{$_}} if defined $authvals->{$row->{$_}}; |
1133 |
} |
1137 |
} |
1134 |
} |
1138 |
} |
1135 |
push @results, $row; |
1139 |
push @results, $row; |
1136 |
- |
|
|