From: Bill Erickson Date: Fri, 3 Jun 2011 13:27:26 +0000 (-0400) Subject: Permission to control patron-collections-exempt X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6719fcef8faceab7a355a9f405eb31d6cbda9190;p=evergreen%2Fequinox.git 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 --- 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 0767cae3f9..d82af0b729 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -1422,7 +1422,9 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES ( 505, 'UPDATE_WORKSTATION', oils_i18n_gettext(505, 'Allows update of a workstation during workstation registration override.', 'ppl', 'description')), ( 506, 'VIEW_USER_SETTING_TYPE', oils_i18n_gettext(506, - 'Allows viewing of configurable user setting types.', 'ppl', 'description')); + 'Allows viewing of configurable user setting types.', 'ppl', 'description')), + ( 509, 'UPDATE_PATRON_COLLECTIONS_EXEMPT', oils_i18n_gettext(509, + 'Allows a user to indicate that a patron is exempt from collections processing', 'ppl', 'description')); SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000); @@ -1905,6 +1907,7 @@ INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable) 'UPDATE_HOLD_REQUEST_TIME', 'UPDATE_NET_ACCESS_LEVEL', 'VIEW_CIRC_MATRIX_MATCHPOINT', + '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 12ee21effa..8e3c1dd9ae 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;