From f9b57c5342641e1b8efa68aa202857edadb8f605 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 22 Dec 2023 14:52:04 +0000 Subject: [PATCH] Bug 31297: Allow null value for description in subscription_numberpatterns To test: 1 - Go to Serials 2 - Add a enw subscription 3 - Select Vendor and record, click next 4 - Select Numbring pattern: Number, or any to populate forms 4 - Click 'show advanced pattern' 5 - 'Modify pattern' 6 - Add a new name 7 - 'Save as new pattern' 8 - Nothin happens 9 - Check logs: C4::Serials::Numberpattern::AddSubscriptionNumberpattern(): DBI Exception: DBD::mysql::st execute failed: Field 'description' doesn't have a default value at /kohadevbox/koha/serials/create-numberpattern.pl line 58 10 - Apply patch 11 - Update database 12 - Restart all 13 - Click save again 14 - Success! Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Martin Renvoize Removed wrong 'out' from atomic update file. Signed-off-by: Katrin Fischer --- ...ow_NULL_description_in_serial_numberpatterns.pl | 14 ++++++++++++++ installer/data/mysql/kohastructure.sql | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_31297_allow_NULL_description_in_serial_numberpatterns.pl diff --git a/installer/data/mysql/atomicupdate/bug_31297_allow_NULL_description_in_serial_numberpatterns.pl b/installer/data/mysql/atomicupdate/bug_31297_allow_NULL_description_in_serial_numberpatterns.pl new file mode 100755 index 0000000000..e92b70661f --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_31297_allow_NULL_description_in_serial_numberpatterns.pl @@ -0,0 +1,14 @@ +use Modern::Perl; + +return { + bug_number => "31297", + description => "Allow subscription number pattern description to be NULL", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do("ALTER TABLE subscription_numberpatterns MODIFY description mediumtext DEFAULT NULL"); + + say $out "Modified column 'subscription_numberpatterns.description' to allow and default to NULL"; + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 0b59ad8d85..16310f0f44 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -6018,7 +6018,7 @@ CREATE TABLE `subscription_numberpatterns` ( `id` int(11) NOT NULL AUTO_INCREMENT, `label` varchar(255) NOT NULL, `displayorder` int(11) DEFAULT NULL, - `description` mediumtext NOT NULL, + `description` mediumtext DEFAULT NULL, `numberingmethod` varchar(255) NOT NULL, `label1` varchar(255) DEFAULT NULL, `add1` int(11) DEFAULT NULL, -- 2.39.5