[open-ils-commits] r14277 - trunk/Open-ILS/web/js/ui/default/actor/user (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Oct 6 09:05:15 EDT 2009


Author: erickson
Date: 2009-10-06 09:05:14 -0400 (Tue, 06 Oct 2009)
New Revision: 14277

Modified:
   trunk/Open-ILS/web/js/ui/default/actor/user/register.js
Log:
added support for setting billing/mailing address on the user account.  closes #74

Modified: trunk/Open-ILS/web/js/ui/default/actor/user/register.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/actor/user/register.js	2009-10-06 04:35:06 UTC (rev 14276)
+++ trunk/Open-ILS/web/js/ui/default/actor/user/register.js	2009-10-06 13:05:14 UTC (rev 14277)
@@ -643,6 +643,13 @@
                         addr.ischanged(1);
                 }
                 addr[w._fmfield](val);
+
+                if(dojo.byId('uedit-billing-address-' + addr.id()).checked) 
+                    patron.billing_address(addr.id());
+
+                if(dojo.byId('uedit-mailing-address-' + addr.id()).checked)
+                    patron.mailing_address(addr.id());
+
                 break;
 
             case 'survey':
@@ -733,7 +740,10 @@
 
 
 function uEditNewAddr(evt, id) {
-    if(id == null) id = --uEditAddrVirtId;
+
+    if(id == null) 
+        id = --uEditAddrVirtId; // new address
+
     dojo.forEach(addrTemplateRows, 
         function(row) {
 
@@ -763,6 +773,21 @@
                     }
                 }
 
+            } else if(row.getAttribute('name') == 'uedit-addr-divider') {
+                // link up the billing/mailing address and give the inputs IDs so we can acces the later
+                
+                // billing address
+                var ba = getByName(row, 'billing_address');
+                ba.id = 'uedit-billing-address-' + id;
+                if(patron.billing_address() && patron.billing_address().id() == id)
+                    ba.checked = true;
+
+                // mailing address
+                var ma = getByName(row, 'mailing_address');
+                ma.id = 'uedit-mailing-address-' + id;
+                if(patron.mailing_address() && patron.mailing_address().id() == id)
+                    ma.checked = true;
+
             } else {
                 var btn = dojo.query('[name=delete-button]', row)[0];
                 if(btn) btn.onclick = function(){ uEditDeleteAddr(id) };



More information about the open-ils-commits mailing list