Bug 22878

Summary: Cannot add a patron card layout with mysql strict mode on
Product: Koha Reporter: Liz Rea <wizzyrea>
Component: Label/patron card printingAssignee: Jonathan Druart <jonathan.druart>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, katrin.fischer, martin.renvoize, nick, wizzyrea
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Who signed the patch off: Text to go in the release notes:
Version(s) released in:
19.05.00, 18.11.06
Bug Depends on:    
Bug Blocks: 17258    
Attachments: Bug 22878: Add tests
Bug 22878: Do not pass layout_id on creating a layout
Bug 22878: Add tests
Bug 22878: Do not pass layout_id on creating a layout
Bug 22878: Add tests
Bug 22878: Do not pass layout_id on creating a layout

Description Liz Rea 2019-05-09 14:49:51 UTC
Attempting to create a patron card layout with mysql strict mode on gives the following error:

DBD::mysql::st execute failed: Incorrect integer value: '' for column 'layout_id' at row 1 [for Statement "INSERT INTO creator_layouts (creator, layout_id, units, layout_xml, layout_name) VALUES (?,?,?,?,?);" with ParamValues: 0='Patroncards', 1="", 2="POINT", 3="<opt guide_box="0" guide_grid="0" page_side="F" units="POINT">
</opt>
", 4="something"] at /kohadevbox/koha/C4/Creators/Layout.pm line 181.
Database returned the following error: Incorrect integer value: '' for column 'layout_id' at row 1 at /kohadevbox/koha/C4/Creators/Layout.pm line 183.
Comment 1 Jonathan Druart 2019-05-10 17:30:08 UTC
Created attachment 89562 [details] [review]
Bug 22878: Add tests
Comment 2 Jonathan Druart 2019-05-10 17:30:11 UTC
Created attachment 89563 [details] [review]
Bug 22878: Do not pass layout_id on creating a layout

Attempting to create a patron card layout with mysql strict mode on gives the following error:
  DBD::mysql::st execute failed: Incorrect integer value: '' for column 'layout_id' at row 1

Test plan:
- Turn on sql_strict_modes
- Create a new patron card
=> Must success with this patch applied
Comment 3 Liz Rea 2019-05-11 01:35:40 UTC
Created attachment 89575 [details] [review]
Bug 22878: Add tests

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 4 Liz Rea 2019-05-11 01:35:50 UTC
Created attachment 89576 [details] [review]
Bug 22878: Do not pass layout_id on creating a layout

Attempting to create a patron card layout with mysql strict mode on gives the following error:
  DBD::mysql::st execute failed: Incorrect integer value: '' for column 'layout_id' at row 1

Test plan:
- Turn on sql_strict_modes
- Create a new patron card
=> Must success with this patch applied

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 5 Katrin Fischer 2019-05-11 10:22:23 UTC
Created attachment 89594 [details] [review]
Bug 22878: Add tests

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Katrin Fischer 2019-05-11 10:22:27 UTC
Created attachment 89595 [details] [review]
Bug 22878: Do not pass layout_id on creating a layout

Attempting to create a patron card layout with mysql strict mode on gives the following error:
  DBD::mysql::st execute failed: Incorrect integer value: '' for column 'layout_id' at row 1

Test plan:
- Turn on sql_strict_modes
- Create a new patron card
=> Must success with this patch applied

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Nick Clemens 2019-05-15 12:17:42 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize 2019-05-30 07:12:11 UTC
Pushed to 18.11.x for 18.11.06
Comment 9 Liz Rea 2019-07-02 16:20:47 UTC
Pushed to 18.05 for 18.05.14