From 3a24a1e41fdd783caa799ce0dbc9c32aaea1f379 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 22 Apr 2011 04:18:10 -0400
Subject: [PATCH] - Fix update_contact_row() was setting wrong ID when newcid=null

---
 program/js/app.js |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index e529fa6..d0e408d 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3789,28 +3789,25 @@
   // update a contact record in the list
   this.update_contact_row = function(cid, cols_arr, newcid)
   {
-    cid = String(cid).replace(this.identifier_expr, '_');
-    newcid = String(newcid).replace(this.identifier_expr, '_');
+    var c, row, list = this.contact_list;
 
-    var row;
-    if (this.contact_list.rows[cid] && (row = this.contact_list.rows[cid].obj)) {
-      for (var c=0; c<cols_arr.length; c++)
+    cid = String(cid).replace(this.identifier_expr, '_');
+
+    if (list.rows[cid] && (row = list.rows[cid].obj)) {
+      for (c=0; c<cols_arr.length; c++)
         if (row.cells[c])
           $(row.cells[c]).html(cols_arr[c]);
 
       // cid change
       if (newcid) {
+        newcid = String(newcid).replace(this.identifier_expr, '_');
         row.id = 'rcmrow' + newcid;
-        this.contact_list.remove_row(cid);
-        this.contact_list.init_row(row);
-        this.contact_list.selection[0] = newcid;
+        list.remove_row(cid);
+        list.init_row(row);
+        list.selection[0] = newcid;
         row.style.display = '';
       }
-
-      return true;
     }
-
-    return false;
   };
 
   // add row to contacts list

--
Gitblit v1.9.1