From 368f391165fef5b71810f324d33f5c1720ab0f18 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 3 Jun 2011 09:27:26 -0400 Subject: [PATCH] Permission to control patron-collections-exempt Adds a new permission 'UPDATE_PATRON_COLLECTIONS_EXEMPT' which controls who can toggle the circ.collections.exempt user setting in the patron registration interface. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 5 ++++- Open-ILS/web/js/ui/default/actor/user/register.js | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 8dd539cec6..5659043e5e 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -1427,7 +1427,9 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES 'Allows a user to abort a transit on a copy with status of LOST', 'ppl', 'description')), ( 508, 'ABORT_TRANSIT_ON_MISSING', oils_i18n_gettext(508, 'Allows a user to abort a transit on a copy with status of MISSING', 'ppl', 'description')), - ( 509, 'TRANSIT_CHECKIN_INTERVAL_BLOCK.override', oils_i18n_gettext(509, + ( 509, 'UPDATE_PATRON_COLLECTIONS_EXEMPT', oils_i18n_gettext(509, + 'Allows a user to indicate that a patron is exempt from collections processing', 'ppl', 'description')), + ( 510, 'TRANSIT_CHECKIN_INTERVAL_BLOCK.override', oils_i18n_gettext(510, 'Allows a user to override the TRANSIT_CHECKIN_INTERVAL_BLOCK event', 'ppl', 'description')); @@ -1913,6 +1915,7 @@ INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable) 'VIEW_CIRC_MATRIX_MATCHPOINT', 'ABORT_TRANSIT_ON_LOST', 'ABORT_TRANSIT_ON_MISSING', + 'UPDATE_PATRON_COLLECTIONS_EXEMPT', 'VIEW_HOLD_MATRIX_MATCHPOINT'); INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable) diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index 43864d3d53..be1c111ae6 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -593,6 +593,10 @@ function uEditDrawSettingRow(tbody, dividerRow, template, stype) { dojo.connect(cb, 'onChange', function(newVal) { userSettingsToUpdate[stype.name()] = newVal; }); tbody.insertBefore(row, dividerRow.nextSibling); openils.Util.show(row, 'table-row'); + + if(stype.name() == 'circ.collections.exempt') { + checkCollectionsExemptPerm(cb); + } } function uEditUpdateUserSettings(userId) { @@ -894,6 +898,22 @@ function checkClaimsNoCheckoutCountPerm() { ); } +var collectExemptCBox; +function checkCollectionsExemptPerm(cbox) { + if(cbox) collectExemptCBox = cbox; + new openils.User().getPermOrgList( + 'UPDATE_PATRON_COLLECTIONS_EXEMPT', + function(orgList) { + if(orgList.indexOf(patron.home_ou()) == -1) + collectExemptCBox.attr('disabled', true); + else + collectExemptCBox.attr('disabled', false); + }, + true, + true + ); +} + function attachWidgetEvents(fmcls, fmfield, widget) { @@ -1085,6 +1105,7 @@ function attachWidgetEvents(fmcls, fmfield, widget) { function(newVal) { checkClaimsReturnCountPerm(); checkClaimsNoCheckoutCountPerm(); + checkCollectionsExemptPerm(); } ); return; -- 2.11.0