Bug 24299: Add 'RotatingCollection' branchtransfer trigger
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 16 Jan 2020 16:43:09 +0000 (16:43 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 20 Mar 2020 15:54:49 +0000 (15:54 +0000)
This patch adds the RotatingCollection value to the database enum for
branchtransfer.reason

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Schema/Result/Branchtransfer.pm
installer/data/mysql/atomicupdate/bug_24299.perl [new file with mode: 0644]
installer/data/mysql/kohastructure.sql

index bc73307..1caca87 100644 (file)
@@ -72,7 +72,7 @@ __PACKAGE__->table("branchtransfers");
 =head2 reason
 
   data_type: 'enum'
-  extra: {list => ["Manual","StockrotationAdvance","StockrotationRepatriation","ReturnToHome","ReturnToHolding"]}
+  extra: {list => ["Manual","StockrotationAdvance","StockrotationRepatriation","ReturnToHome","ReturnToHolding","RotatingCollection"]}
   is_nullable: 1
 
 =cut
@@ -127,6 +127,7 @@ __PACKAGE__->add_columns(
         "StockrotationRepatriation",
         "ReturnToHome",
         "ReturnToHolding",
+        "RotatingCollection",
       ],
     },
     is_nullable => 1,
@@ -193,8 +194,8 @@ __PACKAGE__->belongs_to(
 );
 
 
-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-19 09:20:20
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PLfyg+VMkwXhVqkTeTdGWw
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-20 10:50:34
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Z5PcwyW+X3XM1CeO6CZKBw
 
 sub koha_object_class {
     'Koha::Item::Transfer';
diff --git a/installer/data/mysql/atomicupdate/bug_24299.perl b/installer/data/mysql/atomicupdate/bug_24299.perl
new file mode 100644 (file)
index 0000000..96b0bc8
--- /dev/null
@@ -0,0 +1,24 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+
+    # Add rotating collection states to reason enum
+    $dbh->do(
+        qq{
+            ALTER TABLE
+                `branchtransfers`
+            MODIFY COLUMN
+                `reason` enum(
+                    'Manual',
+                    'StockrotationAdvance',
+                    'StockrotationRepatriation',
+                    'ReturnToHome',
+                    'ReturnToHolding',
+                    'RotatingCollection'
+                )
+            AFTER `comments`
+          }
+    );
+
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 24299 - Add 'collection' reasons to branchtransfers enum)\n";
+}
index d806845..572e13e 100644 (file)
@@ -906,7 +906,7 @@ CREATE TABLE `branchtransfers` ( -- information for items that are in transit be
   `datearrived` datetime default NULL, -- the date the transfer arrived at its destination
   `tobranch` varchar(10) NOT NULL default '', -- the branch the transfer was going to
   `comments` LONGTEXT, -- any comments related to the transfer
-  `reason` ENUM('Manual', 'StockrotationAdvance', 'StockrotationRepatriation', 'ReturnToHome', 'ReturnToHolding'), -- what triggered the transfer
+  `reason` ENUM('Manual', 'StockrotationAdvance', 'StockrotationRepatriation', 'ReturnToHome', 'ReturnToHolding', 'RotatingCollection'), -- what triggered the transfer
   PRIMARY KEY (`branchtransfer_id`),
   KEY `frombranch` (`frombranch`),
   KEY `tobranch` (`tobranch`),