From 9efe6332901e081cb7f7fc0a510449b697da4ce4 Mon Sep 17 00:00:00 2001 From: Rodrigo Santellan Date: Wed, 21 Jun 2017 15:40:43 -0300 Subject: [PATCH] Bug 14572 - insert_single_holiday() forces a value on an AUTO_INCREMENT column, during an INSERT Removing all the id from the columns on the inserts and removing the parameter '' of the values for the id. Test plan: 1) Go to tools -> calendar 2) Add a Holiday only on this day. 3) Add a Holiday repeated every same day of the week. 4) Add a Holiday repeated yearly on the same date. 5) Add a Holidays on a range. 6) Add a Holidays repeated yearly on a range. 7) You should have the five calendars displayed. Signed-off-by: Lee Jamison Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart (cherry picked from commit b94b16f67963b03fd17170d2c2f2efa581c12c0f) Signed-off-by: Fridolin Somers --- C4/Calendar.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/C4/Calendar.pm b/C4/Calendar.pm index 2c1b0d8924..321aad76d5 100644 --- a/C4/Calendar.pm +++ b/C4/Calendar.pm @@ -201,7 +201,7 @@ sub insert_week_day_holiday { croak "Invalid weekday $weekday" unless $weekday =~ m/^[0-6]$/; my $dbh = C4::Context->dbh(); - my $insertHoliday = $dbh->prepare("insert into repeatable_holidays (id,branchcode,weekday,day,month,title,description) values ( '',?,?,NULL,NULL,?,? )"); + my $insertHoliday = $dbh->prepare("insert into repeatable_holidays (branchcode,weekday,day,month,title,description) values ( ?,?,NULL,NULL,?,? )"); $insertHoliday->execute( $self->{branchcode}, $weekday, $options{title}, $options{description}); $self->{'week_days_holidays'}->{$weekday}{title} = $options{title}; $self->{'week_days_holidays'}->{$weekday}{description} = $options{description}; @@ -232,7 +232,7 @@ sub insert_day_month_holiday { my %options = @_; my $dbh = C4::Context->dbh(); - my $insertHoliday = $dbh->prepare("insert into repeatable_holidays (id,branchcode,weekday,day,month,title,description) values ('', ?, NULL, ?, ?, ?,? )"); + my $insertHoliday = $dbh->prepare("insert into repeatable_holidays (branchcode,weekday,day,month,title,description) values (?, NULL, ?, ?, ?,? )"); $insertHoliday->execute( $self->{branchcode}, $options{day},$options{month},$options{title}, $options{description}); $self->{'day_month_holidays'}->{"$options{month}/$options{day}"}{title} = $options{title}; $self->{'day_month_holidays'}->{"$options{month}/$options{day}"}{description} = $options{description}; @@ -269,7 +269,7 @@ sub insert_single_holiday { my $dbh = C4::Context->dbh(); my $isexception = 0; - my $insertHoliday = $dbh->prepare("insert into special_holidays (id,branchcode,day,month,year,isexception,title,description) values ('', ?,?,?,?,?,?,?)"); + my $insertHoliday = $dbh->prepare("insert into special_holidays (branchcode,day,month,year,isexception,title,description) values (?,?,?,?,?,?,?)"); $insertHoliday->execute( $self->{branchcode}, $options{day},$options{month},$options{year}, $isexception, $options{title}, $options{description}); $self->{'single_holidays'}->{"$options{year}/$options{month}/$options{day}"}{title} = $options{title}; $self->{'single_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description}; @@ -315,7 +315,7 @@ sub insert_exception_holiday { my $dbh = C4::Context->dbh(); my $isexception = 1; - my $insertException = $dbh->prepare("insert into special_holidays (id,branchcode,day,month,year,isexception,title,description) values ('', ?,?,?,?,?,?,?)"); + my $insertException = $dbh->prepare("insert into special_holidays (branchcode,day,month,year,isexception,title,description) values (?,?,?,?,?,?,?)"); $insertException->execute( $self->{branchcode}, $options{day},$options{month},$options{year}, $isexception, $options{title}, $options{description}); $self->{'exception_holidays'}->{"$options{year}/$options{month}/$options{day}"}{title} = $options{title}; $self->{'exception_holidays'}->{"$options{year}/$options{month}/$options{day}"}{description} = $options{description}; -- 2.39.5