[open-ils-commits] r15724 - branches/rel_1_6/Open-ILS/xul/staff_client/server/patron (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Mar 5 16:36:46 EST 2010


Author: dbs
Date: 2010-03-05 16:36:40 -0500 (Fri, 05 Mar 2010)
New Revision: 15724

Modified:
   branches/rel_1_6/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
Log:
Forward-port r15723: 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/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
===================================================================
--- branches/rel_1_6/Open-ILS/xul/staff_client/server/patron/standing_penalties.js	2010-03-05 21:35:34 UTC (rev 15723)
+++ branches/rel_1_6/Open-ILS/xul/staff_client/server/patron/standing_penalties.js	2010-03-05 21:36:40 UTC (rev 15724)
@@ -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