From cae51878c607004a735c4f0f00c4047cfd05828e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Fri, 24 Apr 2015 22:19:37 +0200 Subject: [PATCH] [TESTPATCH] Bug 14057 - A Rough Start - Compare old and new code This patch gets values using both methods to compare the results. For testing purposes only. To test: Apply patch Compare results by commenting /uncommenting appropriate lines after line 1154 in C4/Items.pm If found one difference: Old code could not handle Withdrawn status (displays 1 instead of the text) --- C4/Items.pm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/C4/Items.pm b/C4/Items.pm index 2ab3b16..fbde45e 100644 --- a/C4/Items.pm +++ b/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; } -- 1.7.10.4