From 0caaa8e88457c65fdf303fa4a49f361ab07e67cc 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 Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize (cherry picked from commit 8592474c3fe6af408c7265a50bd1776a76942397) Signed-off-by: Fridolin Somers (cherry picked from commit c42c44e932133e6df6c3b9ccda30932d2835f5ee) Signed-off-by: Lucas Gass --- 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 f85795adf1..c7cbd70a91 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 bdb4816e74..0354aea9de 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2146,8 +2146,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.39.2