From 2c93ef400223bced3d84eb25ccfe0ebc3130807d Mon Sep 17 00:00:00 2001 From: erickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Tue, 6 Oct 2009 13:05:14 +0000 Subject: [PATCH] added support for setting billing/mailing address on the user account. closes #74 git-svn-id: svn://svn.open-ils.org/ILS/trunk@14277 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/ui/default/actor/user/register.js | 27 ++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index fffc9429fa..ff5cd31503 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -643,6 +643,13 @@ function _uEditSave(doClone) { 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 uEditRefreshXUL(newuser) { 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 @@ function uEditNewAddr(evt, id) { } } + } 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) }; -- 2.11.0