From 23397e1db95ac6140546b93f1342b1dbd520a2e6 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 21 Sep 2020 15:20:12 +0100 Subject: [PATCH] Bug 26057: Add datecancelled, cancellation_reason fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds the datecancelled and cancellation_reason fields to the branchtransfers table to record when and why transfers have been cancelled. To test 1/ Run the database update 2/ Check the database for the 'datecancelled' and 'cancellation_reason' fields 3/ Signoff Signed-off-by: Kathleen Milne Signed-off-by: Joonas Kylmälä --- installer/data/mysql/atomicupdate/bug_26057.perl | 13 +++++++++++++ installer/data/mysql/kohastructure.sql | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_26057.perl diff --git a/installer/data/mysql/atomicupdate/bug_26057.perl b/installer/data/mysql/atomicupdate/bug_26057.perl new file mode 100644 index 0000000000..efcfa797ab --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_26057.perl @@ -0,0 +1,13 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + + if( !column_exists( 'branchtransfers', 'datecancelled' ) ) { + $dbh->do( "ALTER TABLE `branchtransfers` ADD COLUMN `datecancelled` datetime default NULL AFTER `datearrived`" ); + } + + if( !column_exists( 'branchtransfers', 'cancellation_reason' ) ) { + $dbh->do( "ALTER TABLE `branchtransfers` ADD COLUMN `cancellation_reason` ENUM('Manual', 'StockrotationAdvance', 'StockrotationRepatriation', 'ReturnToHome', 'ReturnToHolding', 'RotatingCollection', 'Reserve', 'LostReserve', 'CancelReserve') DEFAULT NULL AFTER `reason`" ); + } + + NewVersion( $DBversion, 26057, "Add datecancelled field to branchtransfers"); +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 8a8529d08b..ae247e67c8 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1527,9 +1527,11 @@ CREATE TABLE `branchtransfers` ( `datesent` datetime DEFAULT NULL COMMENT 'the date the transfer was initialized', `frombranch` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the branch the transfer is coming from', `datearrived` datetime DEFAULT NULL COMMENT 'the date the transfer arrived at its destination', + `datecancelled` datetime default NULL COMMENT 'the date the transfer was cancelled', `tobranch` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'the branch the transfer was going to', `comments` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any comments related to the transfer', `reason` enum('Manual','StockrotationAdvance','StockrotationRepatriation','ReturnToHome','ReturnToHolding','RotatingCollection','Reserve','LostReserve','CancelReserve') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'what triggered the transfer', + `cancellation_reason` ENUM('Manual', 'StockrotationAdvance', 'StockrotationRepatriation', 'ReturnToHome', 'ReturnToHolding', 'RotatingCollection', 'Reserve', 'LostReserve', 'CancelReserve') default NULL COMMENT 'what triggered the transfer cancellation', PRIMARY KEY (`branchtransfer_id`), KEY `frombranch` (`frombranch`), KEY `tobranch` (`tobranch`), -- 2.20.1