[open-ils-commits] r15723 - branches/rel_1_6_0/Open-ILS/xul/staff_client/server/patron (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Mar 5 16:35:39 EST 2010
Author: dbs
Date: 2010-03-05 16:35:34 -0500 (Fri, 05 Mar 2010)
New Revision: 15723
Modified:
branches/rel_1_6_0/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
Log:
Prevent throwing a raw exception due to the manipulation of a non-existent node when removing a patron standing penalty
Modified: branches/rel_1_6_0/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
===================================================================
--- branches/rel_1_6_0/Open-ILS/xul/staff_client/server/patron/standing_penalties.js 2010-03-05 20:32:19 UTC (rev 15722)
+++ branches/rel_1_6_0/Open-ILS/xul/staff_client/server/patron/standing_penalties.js 2010-03-05 21:35:34 UTC (rev 15723)
@@ -136,8 +136,20 @@
var parentNode = node.parentNode;
parentNode.removeChild( node );
delete(rows[ id ]);
- var csp_id = typeof penalty.standing_penalty() == 'object' ? penalty.standing_penalty().id() : penalty.standing_penalty();
- document.getElementById('csp_'+csp_id).setAttribute('disabled','false');
+
+ var csp_id;
+ if (typeof penalty.standing_penalty() == 'object') {
+ csp_id = penalty.standing_penalty().id();
+ } else {
+ csp_id = penalty.standing_penalty();
+ }
+
+ // Protect against manipulating a node that doesn't exist - which will
+ // be the case for system penalties with an ID of < 100 -- see csp_list above
+ var csp_node = document.getElementById('csp_'+csp_id);
+ if (csp_node) {
+ csp_node.setAttribute('disabled','false');
+ }
}
} catch(E) {
alert(E);
More information about the open-ils-commits
mailing list