From 4f18900fa71a7be085708442385de53100cadaa4 Mon Sep 17 00:00:00 2001
From: Chris Kirby <chris.kirby@ilsleypubliclibrary.org>
Date: Sun, 15 Jan 2017 03:11:22 +0000
Subject: [PATCH] Bug 12219 Purchase Suggestions branch level permissions Add a
 system preference SuggestionLibraryList

---
 installer/data/mysql/atomicupdate/bug_12219.sql                     | 1 +
 installer/data/mysql/sysprefs.sql                                   | 1 +
 koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref | 4 ++++
 3 files changed, 6 insertions(+)
 create mode 100644 installer/data/mysql/atomicupdate/bug_12219.sql

diff --git a/installer/data/mysql/atomicupdate/bug_12219.sql b/installer/data/mysql/atomicupdate/bug_12219.sql
new file mode 100644
index 0000000..43b07b9
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_12219.sql
@@ -0,0 +1 @@
+INSERT IGNORE INTO systempreferences (variable,value, explanation,options,type) VALUES ('SuggestionLibraryList','','If empty, all libraries may make suggestions,', NULL, 'Free');
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index ef83c3d..064a827 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -489,6 +489,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('SubscriptionHistory','simplified','simplified|full','Define the display preference for serials issue history in OPAC','Choice'),
 ('SubscriptionLog','1',NULL,'If ON, enables subscriptions log','YesNo'),
 ('suggestion','1','','If ON, enables patron suggestions feature in OPAC','YesNo'),
+('SuggestionLibraryList','',NULL,'Only allow purchase suggestions for libraries listed. If empty, all libraries may make purchase suggestions.','Free'),
 ('SuspendHoldsIntranet','1','Allow holds to be suspended from the intranet.',NULL,'YesNo'),
 ('SuspendHoldsOpac','1','Allow holds to be suspended from the OPAC.',NULL,'YesNo'),
 ('SvcMaxReportRows','10',NULL,'Maximum number of rows to return via the report web service.','Integer'),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
index 62aaeff..2353e71 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ -426,6 +426,10 @@ OPAC:
                   yes: Allow
                   no: "Don't allow"
             - patrons to make purchase suggestions on the OPAC.
+        -   - "Enable purchase suggestions for the following libraries."
+            - pref: SuggestionLibraryList
+            - (separate branchcode with |).
+            - If empty, all libraries may make purchase suggestions.
         -
             - pref: reviewson
               choices:
-- 
2.1.4