@@ -, +, @@
suggestions
North Central Regional Library (http://ncrl.org/)
---
.../Bug_15128_Add_MaxOpenSuggestions_Syspref | 1 +
installer/data/mysql/sysprefs.sql | 1 +
.../prog/en/modules/admin/preferences/opac.pref | 6 +++++-
.../bootstrap/en/modules/opac-suggestions.tt | 19 +++++++++++++++++--
opac/opac-suggestions.pl | 11 ++++++++++-
5 files changed, 34 insertions(+), 4 deletions(-)
create mode 100644 installer/data/mysql/atomicupdate/Bug_15128_Add_MaxOpenSuggestions_Syspref
--- a/installer/data/mysql/atomicupdate/Bug_15128_Add_MaxOpenSuggestions_Syspref
+++ a/installer/data/mysql/atomicupdate/Bug_15128_Add_MaxOpenSuggestions_Syspref
@@ -0,0 +1, @@
+INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('MaxOpenSuggestions','',NULL,'Limit the number of open suggestions a patron can have at once, unlimited if blank','Integer')
--- a/installer/data/mysql/sysprefs.sql
+++ a/installer/data/mysql/sysprefs.sql
@@ -233,6 +233,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('MaxFine',NULL,'','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'),
('MaxItemsForBatch','1000',NULL,'Max number of items record to process in a batch (modification or deletion)','Integer'),
('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'),
+('MaxOpenSuggestions','',NULL,'Limit the number of open suggestions a patron can have at once','Integer')
('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'),
('maxRecordsForFacets','20',NULL,NULL,'Integer'),
('maxreserves','50','','Define maximum number of holds a patron can place','Integer'),
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ -566,7 +566,11 @@ OPAC:
yes: "Block"
no: "Don't block"
- expired patrons from OPAC actions such as placing a hold or renewing. Note that the setting for a patron category takes priority over this system preference.
-
+ -
+ - Limit patrons to
+ - pref: MaxOpenSuggestions
+ class: integer
+ - "open suggestions. Leave empty for no limit. **Note: this setting does not affect anonymous suggestions"
Privacy:
-
- pref: StoreLastBorrower
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt
@@ -28,6 +28,10 @@
[% IF ( op_add ) %]
+ [% IF ( Koha.Preference('MaxOpenSuggestions') && own_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
+
You cannot place any more suggestions
+
You have reached your limit of suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') %]). Once the library has processed those suggestions you will be able to place more.
+ [% ELSE %]
Enter a new purchase suggestion
Please fill out this form to make a purchase suggestion. You will receive an email when the library processes your suggestion
@@ -88,6 +92,7 @@
Cancel
+ [% END %]
[% END # IF op_add %]
[% IF ( op_else ) %]
@@ -105,6 +110,8 @@
[% FOR m IN messages %]
[% SWITCH m.code %]
+ [% CASE 'too_many' %]
+ The suggestion has not been added. You have reached your limit of suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') %]). Once the library has processed those suggestions you will be able to place more.
[% CASE 'already_exists' %]
The suggestion has not been added. A suggestion with this title already exists.
[% CASE 'success_on_inserted' %]
@@ -145,7 +152,11 @@
[% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
- New purchase suggestion
+ [% IF ( Koha.Preference('MaxOpenSuggestions') && own_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
+
You have reached your limit of suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') %]).Once the library has processed those suggestions you will be able to place more.