Bug 26134

Summary: Error when adding to basket from new/staged file when using MARCItemFieldsToOrder
Product: Koha Reporter: Andrew Fuerste-Henry <andrewfh>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: critical    
Priority: P5 - low CC: aleisha, jonathan.druart, lucas
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.04
Bug Depends on: 23463    
Bug Blocks:    
Attachments: Bug 26134: (bug 23463 follow-up) Fix add to basket from staged file
Bug 26134: (bug 23463 follow-up) Fix add to basket from staged file
Bug 26134: (bug 23463 follow-up) Fix add to basket from staged file

Description Andrew Fuerste-Henry 2020-08-04 12:29:58 UTC
To recreate:
- set at least one value in MARCItemFieldsToOrder
- add to a basket via staged file with at least one value matching your MARCItemFields mappings
- set required fields for your order and click Save
- receive error: "DBIx::Class::Storage::DBI::_dbh_execute(): Column 'itemnumber' cannot be null at /kohadevbox/koha/Koha/Acquisition/Order.pm line 113
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77"
Comment 1 Jonathan Druart 2020-08-06 10:50:13 UTC
Caused by
  commit 2075a22ed3c71196002dd8da28a061f791baf393
  Bug 23463: Replace AddItem calls with Koha::Item->store
Comment 2 Jonathan Druart 2020-08-06 10:52:25 UTC
Created attachment 107873 [details] [review]
Bug 26134: (bug 23463 follow-up) Fix add to basket from staged file

There is a ->store call missing when we attempt to create a new item.

Test plan:
- set at least one value in MARCItemFieldsToOrder
- add to a basket via staged file with at least one value matching your MARCItemFields mappings
- set required fields for your order and click Save
=> Without this patch you got:
receive error: "DBIx::Class::Storage::DBI::_dbh_execute(): Column 'itemnumber' cannot be null at /kohadevbox/koha/Koha/Acquisition/Order.pm line 113
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77"
=> With this patch applied the order has been created successfully
Comment 3 Andrew Fuerste-Henry 2020-08-13 01:51:03 UTC
Created attachment 108158 [details] [review]
Bug 26134: (bug 23463 follow-up) Fix add to basket from staged file

There is a ->store call missing when we attempt to create a new item.

Test plan:
- set at least one value in MARCItemFieldsToOrder
- add to a basket via staged file with at least one value matching your MARCItemFields mappings
- set required fields for your order and click Save
=> Without this patch you got:
receive error: "DBIx::Class::Storage::DBI::_dbh_execute(): Column 'itemnumber' cannot be null at /kohadevbox/koha/Koha/Acquisition/Order.pm line 113
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77"
=> With this patch applied the order has been created successfully

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 4 Katrin Fischer 2020-08-15 08:05:38 UTC
Created attachment 108316 [details] [review]
Bug 26134: (bug 23463 follow-up) Fix add to basket from staged file

There is a ->store call missing when we attempt to create a new item.

Test plan:
- set at least one value in MARCItemFieldsToOrder
- add to a basket via staged file with at least one value matching your MARCItemFields mappings
- set required fields for your order and click Save
=> Without this patch you got:
receive error: "DBIx::Class::Storage::DBI::_dbh_execute(): Column 'itemnumber' cannot be null at /kohadevbox/koha/Koha/Acquisition/Order.pm line 113
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77"
=> With this patch applied the order has been created successfully

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Jonathan Druart 2020-08-19 07:36:27 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 6 Lucas Gass 2020-09-04 16:11:27 UTC
backported to 20.05.x for 20.05.04
Comment 7 Aleisha Amohia 2020-09-20 21:42:30 UTC
missing dependencies, not backported to 19.11.x