From a2e9d7a1148109ecba504422be996aebfef879b7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 10 Jan 2017 12:19:35 -0500 Subject: [PATCH] LP#1655399 webstaff: User perm editor grantable fix Correctly handle the boolean grantable flag in the user permission editor. In some cases, the boolean 0/1 values returned from storage are returned as strings. Cast them to numbers before checking truthiness. Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- Open-ILS/xul/staff_client/server/patron/user_edit_xhtml.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/user_edit_xhtml.js b/Open-ILS/xul/staff_client/server/patron/user_edit_xhtml.js index 3b78ad5ccf..9a336bd8ba 100644 --- a/Open-ILS/xul/staff_client/server/patron/user_edit_xhtml.js +++ b/Open-ILS/xul/staff_client/server/patron/user_edit_xhtml.js @@ -360,7 +360,7 @@ function display_perm (root,perm_def,staff_perms, r) { var dis = false; - if ((up && up.id() < 0) || !sp || !sp.grantable()) dis = true; + if ((up && up.id() < 0) || !sp || !Number(sp.grantable())) dis = true; if (all) dis = false; var label_cell = findNodeByName(prow,'plabel'); @@ -391,7 +391,9 @@ function display_perm (root,perm_def,staff_perms, r) { var grant_cell = findNodeByName(prow,'pgrant'); findNodeByName(grant_cell,'p.grantable').disabled = dis; - findNodeByName(grant_cell,'p.grantable').checked = up ? (up.grantable() ? true : false) : false; + findNodeByName(grant_cell,'p.grantable').checked = + up ? (Number(up.grantable()) ? true : false) : false; + if (r % 2) grant_cell.className += ' odd'; } -- 2.11.0