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>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2019-05-10 12:27:40 -05:00 committed by Nick Clemens
parent 9f18afa7b3
commit 8d53fae949

View file

@ -165,6 +165,7 @@ sub save {
} }
else { # otherwise create a new record else { # otherwise create a new record
my @params; my @params;
delete $self->{layout_id}; # Could be an empty string
my $query = "INSERT INTO creator_layouts ("; my $query = "INSERT INTO creator_layouts (";
foreach my $key (keys %{$self}) { foreach my $key (keys %{$self}) {
push (@params, $self->{$key}); push (@params, $self->{$key});