From 514025ee09719c6565274ca908f358fb61681b12 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 e929e21..d9ac968 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -435,6 +435,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 0000000..a960435 --- /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 fa5044e..42b5d98 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2147,8 +2147,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 NOT NULL default '', + `librariannote` LONGTEXT NOT NULL default '', PRIMARY KEY (`subscriptionid`), KEY `biblionumber` (`biblionumber`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- 2.1.4