@@ -, +, @@ code --- C4/Items.pm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) --- a/C4/Items.pm +++ a/C4/Items.pm @@ -1133,9 +1133,28 @@ sub GetItemsForInventory { # Auth values foreach (keys %$row) { + my $new = ''; if (defined($avmapping->{"items.$_,".$row->{'frameworkcode'}.",".$row->{$_}})) { - $row->{$_} = $avmapping->{"items.$_,".$row->{'frameworkcode'}.",".$row->{$_}}; + ### WILL BE SET BELOW $row->{$_} = $avmapping->{"items.$_,".$row->{'frameworkcode'}.",".$row->{$_}}; + $new = $avmapping->{"items.$_,".$row->{'frameworkcode'}.",".$row->{$_}}; } + + #######TESTING WITH OLD CODE + #If the koha field is mapped to a marc fielda + my $old = ''; + my ($f, $sf) = GetMarcFromKohaField("items.$_", $row->{'frameworkcode'}); + if ($f and $sf) { + # We replace the code with it's description + my $authvals = C4::Koha::GetKohaAuthorisedValuesFromField($f, $sf, $row->{'frameworkcode'}); + if ( defined ($authvals->{$row->{$_}}) ) { + ### WILL BE SET BELOW $row->{$_} = $authvals->{$row->{$_}} ; + $old = $authvals->{$row->{$_}} ; + } + } + #######TEST HERE OUTPUT + #warn "$new -- $old" if ( $new || $old ); + $row->{$_} = $new if ($new); + #$row->{$_} = $old if ($old); } push @results, $row; } --