From ec59ae212739b35fb6cbf991a6da51d55f92b728 Mon Sep 17 00:00:00 2001
From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Date: Thu, 26 Apr 2018 11:56:19 +0100
Subject: [PATCH] Bug 18837: Add ILL Unmediated syspref stuff

This patch adds the syspref requirements for unmediated ILL requests. It
is a recreation of
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66628&action=diff
which had diverged sufficiently as to make it impossible to apply.

* installer/data/mysql/atomicupdate/illunmediated_tables.sql: New
  file.
* installer/data/mysql/sysprefs.sql: Add `ILLModuleUnmediated`.
* koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref:
    Add `ILLModuleUnmediated` handling.

Signed-off-by: Stephen Graham <s.graham4@herts.ac.uk>
Signed-off-by: David Peacock <d.m.peacock@herts.ac.uk>
Signed-off-by: Jayne Maisey <j.maisey@herts.ac.uk>
---
 installer/data/mysql/atomicupdate/illunmediated_tables.sql         | 4 ++++
 installer/data/mysql/sysprefs.sql                                  | 1 +
 .../prog/en/modules/admin/preferences/circulation.pref             | 7 +++++++
 3 files changed, 12 insertions(+)
 create mode 100644 installer/data/mysql/atomicupdate/illunmediated_tables.sql

diff --git a/installer/data/mysql/atomicupdate/illunmediated_tables.sql b/installer/data/mysql/atomicupdate/illunmediated_tables.sql
new file mode 100644
index 0000000000..8bb64bd391
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/illunmediated_tables.sql
@@ -0,0 +1,4 @@
+-- System preferences
+
+INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES
+       ('ILLModuleUnmediated','0','','If enabled, try to immediately progress newly placed ILL requests.','YesNo');
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 145cca0f62..1efab48ea7 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -219,6 +219,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('IllLog', 0, '', 'If ON, log information about ILL requests', 'YesNo'),
 ('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'),
 ('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea'),
+('ILLModuleUnmediated','0','','If enabled, try to immediately progress newly placed ILL requests.','YesNo'),
 ('ILS-DI','0','','Enables ILS-DI services at OPAC.','YesNo'),
 ('ILS-DI:AuthorizedIPs','','Restricts usage of ILS-DI to some IPs','.','Free'),
 ('ImageLimit','5','','Limit images stored in the database by the Patron Card image manager to this number.','Integer'),
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 2d80bdd5c7..be470d01d9 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
@@ -796,6 +796,13 @@ Circulation:
             - pref: ILLModuleCopyrightClearance
               type: textarea
               class: long
+        -
+            - Allow unmediated Interlibrary loan requests
+            - pref: ILLModuleUnmediated
+              default: 0
+              choices:
+                  yes: Enable
+                  no: Disable
     Fines Policy:
         -
             - Calculate fines based on days overdue
-- 
2.11.0