From 9372e496a350c8f8e2d36cdc35d50cb6afd8d0e3 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! --- ...ULL_description_in_serial_numberpatterns.pl | 18 ++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 +- 2 files changed, 19 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 00000000000..aa9dace8602 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_31297_allow_NULL_description_in_serial_numberpatterns.pl @@ -0,0 +1,18 @@ +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(q{ + ALTER TABLE subscription_numberpatterns MODIFY description mediumtext DEFAULT NULL + }); + + say $out "Added new table 'XXX'"; + 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 0b59ad8d85c..16310f0f449 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.30.2