Bug 10088

Summary: software error when filling a basket with staged record
Product: Koha Reporter: Mathieu Saby <mathsabypro>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P1 - high CC: bgkriegel, chris, chrish, jonathan.druart, mtj
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9902
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 10088: FIX adding an order from a staged file.
[PATCH][SIGNED OFF] Bug 10088: FIX adding an order from a staged file.
Bug 10088: FIX adding an order from a staged file.

Description Mathieu Saby 2013-04-21 18:08:55 UTC
in current master, I staged a file of records, and tried to use it to create orders in a basket.

I got the following error : 

http://pro.koha-msaby/cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=18&basketno=21&booksellerid=1

'Can't use string ("") as a HASH ref while "strict refs" in use at /home/msaby/kohamaster/src/C4/Items.pm line 2712.'

Git blame says this line was changed the 27th of march, by commit 9f2189d0, created by bug 9902.

line 2712 : $defaultvalue = $defaultvalues->{branchcode} || C4::Context->userenv->{branch};

M. Saby
Comment 1 Mathieu Saby 2013-04-21 18:36:32 UTC
line 129 of addorderiso2709.pl call PrepareItemrecordDisplay this way
        my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );

I suppose this is not correct.

M. Saby
Comment 2 Jonathan Druart 2013-04-25 07:52:12 UTC Comment hidden (obsolete)
Comment 3 Mathieu Saby 2013-04-25 12:46:09 UTC Comment hidden (obsolete)
Comment 4 Mason James 2013-04-27 12:01:36 UTC
Created attachment 17750 [details] [review]
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 <mathieu.saby@univ-rennes2.fr>
Signed-off-by: Mason James <mtj@kohaaloha.com>
Comment 5 Mason James 2013-04-27 12:03:15 UTC
> Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
> Signed-off-by: Mason James <mtj@kohaaloha.com>

passing QA, patch works well!
Comment 6 Jared Camins-Esakov 2013-04-27 12:24:10 UTC
This patch has been pushed to master and 3.12.x.

I was not able to recreate this problem, but the logic is demonstrably correct, so I am pushing it anyway.
Comment 7 Chris Cormack 2013-04-27 22:24:32 UTC
Bug 9902 is not in 3.10.x so this is not needed
Comment 8 Bernardo Gonzalez Kriegel 2013-08-03 20:12:49 UTC
Bug 9902 in now on 3.10.x, so we need this.

Pushed to 3.10.x, will be in 3.10.10
Comment 9 Chris Hall 2013-08-18 04:31:53 UTC
Pushed to 3.8.x, will be in 3.8.17