From 1eca6d896b0e91367c3c4cbf8254b3b4e3fc8d6e Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 7 May 2013 12:49:03 -0400 Subject: [PATCH] Bug 10215: Increase the size of opacnote and librariannote for table subscriptionhistory We have librarians that are regularly hitting the maximum number of characters for the note fields in subscription history. They would like to be able to store at least 1000 characters here. Converting the varchar(150) to text should do it. Test Plan: 1) Apply this patch 2) Run updatedatabase.pl 3) Add public and private notes to a subscription history entry where each note is greater than 150 characters. 4) Save and view the notes, the notes should not be truncated. Rescued-by: Martin Renvoize Signed-off-by: Owen Leonard --- C4/Serials.pm | 1 + installer/data/mysql/atomicupdate/bug_10215.perl | 9 +++++++++ installer/data/mysql/kohastructure.sql | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_10215.perl diff --git a/C4/Serials.pm b/C4/Serials.pm index e6eae860ff..44c3cb958e 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -428,6 +428,7 @@ sub GetSubscriptionsFromBiblionumber { } else { $subs->{histenddate} = ""; } + $subs->{opacnote} //= ""; $subs->{opacnote} =~ s/\n/\/g; $subs->{missinglist} =~ s/\n/\/g; $subs->{recievedlist} =~ s/\n/\/g; diff --git a/installer/data/mysql/atomicupdate/bug_10215.perl b/installer/data/mysql/atomicupdate/bug_10215.perl new file mode 100644 index 0000000000..a960435a24 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_10215.perl @@ -0,0 +1,9 @@ +$DBversion = 'XXX'; +if ( CheckVersion($DBversion) ) { + + $dbh->do(q{ALTER TABLE subscriptionhistory CHANGE opacnote opacnote LONGTEXT NULL}); + $dbh->do(q{ALTER TABLE subscriptionhistory CHANGE librariannote librariannote LONGTEXT NULL}); + + SetVersion ($DBversion); + print "Upgrade to $DBversion done (Bug 10215 - Increase the size of opacnote and librariannote for table subscriptionhistory)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index da3ff83f37..e171b32e19 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2110,8 +2110,8 @@ CREATE TABLE `subscriptionhistory` ( `histenddate` date default NULL, `missinglist` LONGTEXT NOT NULL, `recievedlist` LONGTEXT NOT NULL, - `opacnote` varchar(150) NOT NULL default '', - `librariannote` varchar(150) NOT NULL default '', + `opacnote` LONGTEXT NULL, + `librariannote` LONGTEXT NULL, PRIMARY KEY (`subscriptionid`), KEY `biblionumber` (`biblionumber`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- 2.20.1