Bug 21599

Summary: Incorrect decimal value: '' for column 'defaultreplacecost' - Cannot create item type
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: fridolin.somers, martin.renvoize, nick
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21610
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 21597    
Attachments: Bug 21599: Fix item type creation by defining default values
Bug 21599: Fix item type creation by defining default values
Bug 21599: Fix item type creation by defining default values

Description Jonathan Druart 2018-10-18 11:41:01 UTC
DBD::mysql::st execute failed: Incorrect decimal value: '' for column 'defaultreplacecost' at row 1 [for Statement "INSERT INTO `itemtypes` ( `checkinmsg`, `checkinmsgtype`, `defaultreplacecost`, `description`, `hideinopac`, `imageurl`, `itemtype`, `notforloan`, `processfee`, `rentalcharge`, `searchcategory`, `sip_media_type`, `summary`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 0="", 1="message", 2="", 3="xx", 4=0, 5='', 6="XX", 7=0, 8="", 9="", 10="", 11=undef, 12=""] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.


And so, selenium basic_workflow.t is broken
Comment 1 Jonathan Druart 2018-10-18 11:44:37 UTC
Created attachment 80805 [details] [review]
Bug 21599: Fix item type creation by defining default values

Same as what we have in Koha::Patron->new, empty strings should not be
inserted in integer or date column type

DBD::mysql::st execute failed: Incorrect decimal value: '' for column 'defaultreplacecost' at row 1 [for Statement "INSERT INTO `itemtypes` ( `checkinmsg`, `checkinmsgtype`, `defaultreplacecost`, `description`, `hideinopac`, `imageurl`, `itemtype`, `notforloan`, `processfee`, `rentalcharge`, `searchcategory`, `sip_media_type`, `summary`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 0="", 1="message", 2="", 3="xx", 4=0, 5='', 6="XX", 7=0, 8="", 9="", 10="", 11=undef, 12=""] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.

Test plan:
Create a new itemtype
Comment 2 Jonathan Druart 2018-10-18 11:45:35 UTC
Note that there are other failures for basic_workflow.t and this patch will not be enough to make it pass.
Comment 3 Claire Gravely 2018-10-18 12:52:40 UTC
Created attachment 80828 [details] [review]
Bug 21599: Fix item type creation by defining default values

Same as what we have in Koha::Patron->new, empty strings should not be
inserted in integer or date column type

DBD::mysql::st execute failed: Incorrect decimal value: '' for column 'defaultreplacecost' at row 1 [for Statement "INSERT INTO `itemtypes` ( `checkinmsg`, `checkinmsgtype`, `defaultreplacecost`, `description`, `hideinopac`, `imageurl`, `itemtype`, `notforloan`, `processfee`, `rentalcharge`, `searchcategory`, `sip_media_type`, `summary`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 0="", 1="message", 2="", 3="xx", 4=0, 5='', 6="XX", 7=0, 8="", 9="", 10="", 11=undef, 12=""] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.

Test plan:
Create a new itemtype

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Comment 4 Martin Renvoize 2018-10-18 13:15:02 UTC
Created attachment 80835 [details] [review]
Bug 21599: Fix item type creation by defining default values

Same as what we have in Koha::Patron->new, empty strings should not be
inserted in integer or date column type

DBD::mysql::st execute failed: Incorrect decimal value: '' for column 'defaultreplacecost' at row 1 [for Statement "INSERT INTO `itemtypes` ( `checkinmsg`, `checkinmsgtype`, `defaultreplacecost`, `description`, `hideinopac`, `imageurl`, `itemtype`, `notforloan`, `processfee`, `rentalcharge`, `searchcategory`, `sip_media_type`, `summary`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 0="", 1="message", 2="", 3="xx", 4=0, 5='', 6="XX", 7=0, 8="", 9="", 10="", 11=undef, 12=""] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.

Test plan:
Create a new itemtype

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2018-10-18 13:15:53 UTC
Passing QA.. I can't see any regressions creeping in from this.
Comment 6 Nick Clemens 2018-10-18 14:32:52 UTC
Pushed to master for 18.11
Comment 7 Martin Renvoize 2018-11-05 12:24:08 UTC
Pushed to 18.05.x for 18.05.06
Comment 8 Fridolin Somers 2018-11-09 15:21:58 UTC
Pushed to 17.11.x for 17.11.12