From 36f0c9ae556a45e68ccff4d3e46a03ce165251e6 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Thu, 27 Jun 2019 10:54:26 +0000
Subject: [PATCH] Bug 23007: Add TransfersBlockCirc system preference

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
---
 .../bug_23007_add_transfersblockcirc_preference.perl             | 9 +++++++++
 installer/data/mysql/sysprefs.sql                                | 1 +
 .../prog/en/modules/admin/preferences/circulation.pref           | 6 ++++++
 3 files changed, 16 insertions(+)
 create mode 100644 installer/data/mysql/atomicupdate/bug_23007_add_transfersblockcirc_preference.perl

diff --git a/installer/data/mysql/atomicupdate/bug_23007_add_transfersblockcirc_preference.perl b/installer/data/mysql/atomicupdate/bug_23007_add_transfersblockcirc_preference.perl
new file mode 100644
index 0000000000..bb24f447b6
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_23007_add_transfersblockcirc_preference.perl
@@ -0,0 +1,9 @@
+$DBversion = 'XXX';
+if( CheckVersion( $DBversion ) ) {
+    $dbh->do(q{
+        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
+        ('TransfersBlockCirc','1',NULL,'Should the transfer modal block circulation staff from continuing scanning items','YesNo')
+    });
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 23007: Make transfer modals optionally block circ)\n";
+}
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 82a8402a36..84484885ff 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -614,6 +614,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('TraceSubjectSubdivisions','0','1','Create searches on all subdivisions for subject tracings.','YesNo'),
 ('TrackClicks','0',NULL,'Track links clicked','Integer'),
 ('TrackLastPatronActivity','0',NULL,'If set, the field borrowers.lastseen will be updated everytime a patron is seen','YesNo'),
+('TransfersBlockCirc','1',NULL,'Should the transfer modal block circulation staff from continuing scanning items','YesNo'),
 ('TransfersMaxDaysWarning','3',NULL,'Define the days before a transfer is suspected of having a problem','Integer'),
 ('TransferWhenCancelAllWaitingHolds','0',NULL,'Transfer items when cancelling all waiting holds','YesNo'),
 ('TranslateNotices','0',NULL, 'Allow notices to be translated','YesNo'),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
index 199809f139..4acc8ae0e9 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
@@ -567,6 +567,12 @@ Circulation:
                   yes: "Hide"
                   no: "Don't hide"
             - patrons phone number, email address, street address and city on the circulation page.
+        -
+            - pref: TransfersBlockCirc
+              choices:
+                  yes: "Block"
+                  no: "Don't block"
+            - staff from continuing to checkin items when a transfer is triggered.
     Holds Policy:
         -
             - In the staff client, split the holds queue into separate tables by
-- 
2.11.0