Org setting for the result cap for Patron Search
authorJason Etheridge <jason@esilibrary.com>
Sun, 31 Jul 2011 05:39:39 +0000 (01:39 -0400)
committerThomas Berezansky <tsbere@mvlc.org>
Tue, 9 Aug 2011 18:10:19 +0000 (14:10 -0400)
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.patron_search.result_cap.sql [new file with mode: 0644]
Open-ILS/xul/staff_client/server/patron/search_result.js

index 29a4f90..01416a0 100644 (file)
@@ -2840,6 +2840,24 @@ INSERT into config.org_unit_setting_type
         ),
         'bool'
     )
+,(
+        'ui.patron_search.result_cap',
+        oils_i18n_gettext(
+            'ui.patron_search.result_cap',
+            'GUI: Cap results in Patron Search at this number.',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'ui.patron_search.result_cap',
+            'So for example, if you search for John Doe, normally you would get'
+            || ' at most 50 results.  This setting allows you to raise or lower'
+            || ' that limit.',
+            'coust',
+            'description'
+        ),
+        'integer'
+    )
 ;
 
 UPDATE config.org_unit_setting_type
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.patron_search.result_cap.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.patron_search.result_cap.sql
new file mode 100644 (file)
index 0000000..aacc6c9
--- /dev/null
@@ -0,0 +1,30 @@
+-- Evergreen DB patch XXXX.data.org-setting-ui.patron_search.result_cap.sql
+--
+-- New org setting ui.patron_search.result_cap
+--
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype )
+    VALUES (
+        'ui.patron_search.result_cap',
+        oils_i18n_gettext(
+            'ui.patron_search.result_cap',
+            'GUI: Cap results in Patron Search at this number.',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'ui.patron_search.result_cap',
+            'So for example, if you search for John Doe, normally you would get'
+            || ' at most 50 results.  This setting allows you to raise or lower'
+            || ' that limit.',
+            'coust',
+            'description'
+        ),
+        'integer'
+    );
+
+COMMIT;
index 5449753..6d71bd5 100644 (file)
@@ -26,6 +26,13 @@ patron.search_result.prototype = {
         obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
         var obscure_dob = String( obj.OpenILS.data.hash.aous['circ.obscure_dob'] ) == 'true';
 
+        var result_cap_setting = obj.OpenILS.data.hash.aous[
+            'ui.patron_search.result_cap'
+        ];
+        if (typeof result_cap_setting != 'undefined') {
+            obj.result_cap = Math.abs( result_cap_setting );
+        }
+
         JSAN.use('util.list'); obj.list = new util.list('patron_list');
 
         JSAN.use('patron.util');