From b78fe14e4cdecb28fa67c7afbac4a1593467f690 Mon Sep 17 00:00:00 2001
From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Date: Thu, 13 Feb 2020 14:11:05 +0000
Subject: [PATCH] Bug 24608: Add EditDueDates syspref

This patch adds a EditDueDates syspref which determines whether a button
for editing due dates appears in a patron's checkouts list
---
 .../data/mysql/atomicupdate/bug_24083_EditDueDates_syspref.perl     | 6 ++++++
 installer/data/mysql/sysprefs.sql                                   | 1 +
 .../prog/en/modules/admin/preferences/circulation.pref              | 6 ++++++
 3 files changed, 13 insertions(+)
 create mode 100644 installer/data/mysql/atomicupdate/bug_24083_EditDueDates_syspref.perl

diff --git a/installer/data/mysql/atomicupdate/bug_24083_EditDueDates_syspref.perl b/installer/data/mysql/atomicupdate/bug_24083_EditDueDates_syspref.perl
new file mode 100644
index 0000000000..778696ef30
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_24083_EditDueDates_syspref.perl
@@ -0,0 +1,6 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+	$dbh->do( q| INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('EditDueDates', '0', 'If enabled, it is possible to modify due dates in a patron checkout list ', '', 'YesNo'); | );
+	SetVersion( $DBversion );
+	print "Upgrade to $DBversion done (Bug 24083 - Add EditDueDates syspref)\n";
+}
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index cfa295e197..8e834a32ae 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -163,6 +163,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('DumpTemplateVarsIntranet',  '0', NULL ,  'If enabled, dump all Template Toolkit variable to a comment in the html source for the staff intranet.',  'YesNo'),
 ('DumpTemplateVarsOpac',  '0', NULL ,  'If enabled, dump all Template Toolkit variable to a comment in the html source for the opac.',  'YesNo'),
 ('EasyAnalyticalRecords','0','','If on, display in the catalogue screens tools to easily setup analytical record relationships','YesNo'),
+('EditDueDates','0','','If on, it is possible to edit due dates within a patron checkouts list','YesNo'),
 ('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL),
 ('ElasticsearchIndexStatus_biblios', '0', 'Biblios index status', NULL, NULL),
 ('ElasticsearchMARCFormat', 'ISO2709', 'ISO2709|ARRAY', 'Elasticsearch MARC format. ISO2709 format is recommended as it is faster and takes less space, whereas array is searchable.', 'Choice'),
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 6eb5af0660..de202ea3b9 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
@@ -157,6 +157,12 @@ Circulation:
                   yes: Allow
                   no: "Don't allow"
             - patrons to submit notes about checked out items.
+        -
+            - pref: EditDueDates
+              choices:
+                  yes: Allow
+                  no: "Don't allow"
+            - editing of due dates in a patron checkouts list
 
     Checkout Policy:
         -
-- 
2.11.0