From 424a73e889edf5d8e90150ed504fa802953d8194 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 25 Apr 2013 09:47:53 +0200 Subject: [PATCH] Bug 10088: FIX adding an order from a staged file. Bug 9902 introduced an issue in the C4::Items::PrepareItemrecordDisplay routine. The existence of $defaulvalue hashref should be tested before getting to the branchcode key. Test plan: Before applying the patch, an error occurred when you try to create an order from a staged file. After applying the patch, the error does not appear anymore. Signed-off-by: Mathieu Saby Signed-off-by: Mason James Signed-off-by: Jared Camins-Esakov (cherry picked from commit f2e44716f60578b9663862d7b2ba3b16f7067143) Signed-off-by: Jared Camins-Esakov (cherry picked from commit a8ee942442d42e7ae4f42567eba22f33725188a5) --- C4/Items.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/C4/Items.pm b/C4/Items.pm index 08d7b1a51e..00bf1664bb 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -2703,7 +2703,11 @@ sub PrepareItemrecordDisplay { $authorised_lib{$branchcode} = $branchname; } } - $defaultvalue = $defaultvalues->{branchcode} || C4::Context->userenv->{branch}; + + $defaultvalue = C4::Context->userenv->{branch}; + if ( $defaultvalues and $defaultvalues->{branchcode} ) { + $defaultvalue = $defaultvalues->{branchcode}; + } #----- itemtypes } elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) { -- 2.39.5