DBD::mysql::st execute failed: Incorrect integer value: '' for column 'guarantorid'
Created attachment 55231 [details] [review] Bug 17257: Fix add/edit patrons under MySQL 5.7 If no guarantor is defined the patron won't be added/modified and an error will be raised: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'guarantorid' Test plan: Using MySQL 5.7 (and/or sql_mode=STRICT_TRANS_TABLES) Create a patron without guarantor
*** Bug 16094 has been marked as a duplicate of this bug. ***
I don't have mysql (running mariadb), and wondering how come DBIx::Class did not solve it? Anyway, if it is a problem, I think Koha::Patron is the place to solve it.
(In reply to Srdjan Jankovic from comment #3) > I don't have mysql (running mariadb), and wondering how come DBIx::Class did > not solve it? If the key exists, the default value defined at DB level is not used. > Anyway, if it is a problem, I think Koha::Patron is the place to solve it. I do not understand, we are not using Koha::Patron here.
(In reply to Jonathan Druart from comment #4) > (In reply to Srdjan Jankovic from comment #3) > > I don't have mysql (running mariadb), and wondering how come DBIx::Class did > > not solve it? > > If the key exists, the default value defined at DB level is not used. Ah I see. Then maybe delete $data{'dateofbirth'} if exists($data{'dateofbirth') && !$data{'dateofbirth'}; would make intention clearer. > I do not understand, we are not using Koha::Patron here. A couple of lines later: my $patron = Koha::Patron->new( $new_member )->store; Considering the line number mismatch, I'd say base for this patch is lagging a bit.
(In reply to Srdjan Jankovic from comment #5) > (In reply to Jonathan Druart from comment #4) > > (In reply to Srdjan Jankovic from comment #3) > > > I don't have mysql (running mariadb), and wondering how come DBIx::Class did > > > not solve it? > > > > If the key exists, the default value defined at DB level is not used. > > Ah I see. Then maybe > > delete $data{'dateofbirth'} if exists($data{'dateofbirth') && > !$data{'dateofbirth'}; > > would make intention clearer. I just mimic what existed before. > > I do not understand, we are not using Koha::Patron here. > > A couple of lines later: > > my $patron = Koha::Patron->new( $new_member )->store; > > Considering the line number mismatch, I'd say base for this patch is lagging > a bit. As I said, I just mimic what existed before. The plan is to move C4::Members::AddMember to Koha::Patron, of course. But that patch is just supposed to be a bugfix.
Created attachment 61425 [details] [review] [SIGNED-OFF] Bug 17257: Fix add/edit patrons under MySQL 5.7 If no guarantor is defined the patron won't be added/modified and an error will be raised: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'guarantorid' Test plan: Using MySQL 5.7 (and/or sql_mode=STRICT_TRANS_TABLES) Create a patron without guarantor Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
(In reply to Jonathan Druart from comment #6) > As I said, I just mimic what existed before. > The plan is to move C4::Members::AddMember to Koha::Patron, of course. But > that patch is just supposed to be a bugfix. I understand. In that light I think it would be better to fix it in Koha::Patron rather than adding more code to a legacy module. Especially when you can add it elegantly to Patron::new(), bonus moving similar lines too - a micro-refactoring that will make moving AddMember to Patroms easier.
Thanks for volunteering :)
Created attachment 63382 [details] [review] Bug 17257: Fix add/edit patrons under MySQL 5.7 If no guarantor is defined the patron won't be added/modified and an error will be raised: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'guarantorid' Test plan: Using MySQL 5.7 (and/or sql_mode=STRICT_TRANS_TABLES) Create a patron without guarantor Signed-off-by: Srdjan <srdjan@catalyst.net.nz> Tested with MariaDB 10.0.30 (sql_mode='STRICT_TRANS_TABLES') Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Pushed to master for 17.05, thanks Jonathan!
This patch has been pushed to 16.11.x and will be in 16.11.08.
Pushed to 3.22.x for 3.22.21
Pushed to 16.05.x, for 16.05.13 release