[open-ils-commits] r17314 - in trunk/Open-ILS: web/js/ui/default/actor/user xul/staff_client/server/patron (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Aug 23 14:36:31 EDT 2010
Author: phasefx
Date: 2010-08-23 14:36:26 -0400 (Mon, 23 Aug 2010)
New Revision: 17314
Modified:
trunk/Open-ILS/web/js/ui/default/actor/user/register.js
trunk/Open-ILS/xul/staff_client/server/patron/summary.js
Log:
Allow true deletion of existing addresses in patron editor. Let summary sidebar anticipate dissappearing addresses on refresh.
Modified: trunk/Open-ILS/web/js/ui/default/actor/user/register.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2010-08-23 18:23:04 UTC (rev 17313)
+++ trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2010-08-23 18:36:26 UTC (rev 17314)
@@ -1295,6 +1295,15 @@
if(!noAlert) {
if(!confirm('Delete address ' + id)) return; /* XXX i18n */
}
+ var addr = patron.addresses().filter(function(i){return (i.id() == id)})[0];
+ if (addr) { addr.isdeleted(1); }
+ var m_a = patron.mailing_address();
+ if (typeof m_a == 'object' && m_a != null) { m_a = m_a.id(); }
+ if (m_a == id) { patron.mailing_address(null); }
+ var b_a = patron.billing_address();
+ if (typeof b_a == 'object' && b_a != null) { b_a = b_a.id(); }
+ if (b_a == id) { patron.billing_address(null); }
+
var rows = dojo.query('tr[addr='+id+']', tbody);
for(var i = 0; i < rows.length; i++)
rows[i].parentNode.removeChild(rows[i]);
Modified: trunk/Open-ILS/xul/staff_client/server/patron/summary.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/summary.js 2010-08-23 18:23:04 UTC (rev 17313)
+++ trunk/Open-ILS/xul/staff_client/server/patron/summary.js 2010-08-23 18:36:26 UTC (rev 17314)
@@ -672,10 +672,14 @@
['render'],
function(e) {
return function() {
- util.widgets.set_text(e,
- obj.patron.mailing_address().street1()
- );
- if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ if (obj.patron.mailing_address()) {
+ util.widgets.set_text(e,
+ obj.patron.mailing_address().street1()
+ );
+ if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ } else {
+ util.widgets.set_text(e,'');
+ }
};
}
],
@@ -683,10 +687,14 @@
['render'],
function(e) {
return function() {
- util.widgets.set_text(e,
- obj.patron.mailing_address().street2()
- );
- if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ if (obj.patron.mailing_address()) {
+ util.widgets.set_text(e,
+ obj.patron.mailing_address().street2()
+ );
+ if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ } else {
+ util.widgets.set_text(e,'');
+ }
};
}
],
@@ -694,10 +702,14 @@
['render'],
function(e) {
return function() {
- util.widgets.set_text(e,
- obj.patron.mailing_address().city()
- );
- if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ if (obj.patron.mailing_address()) {
+ util.widgets.set_text(e,
+ obj.patron.mailing_address().city()
+ );
+ if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ } else {
+ util.widgets.set_text(e,'');
+ }
};
}
],
@@ -705,10 +717,14 @@
['render'],
function(e) {
return function() {
- util.widgets.set_text(e,
- obj.patron.mailing_address().state()
- );
- if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ if (obj.patron.mailing_address()) {
+ util.widgets.set_text(e,
+ obj.patron.mailing_address().state()
+ );
+ if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ } else {
+ util.widgets.set_text(e,'');
+ }
};
}
],
@@ -716,10 +732,14 @@
['render'],
function(e) {
return function() {
- util.widgets.set_text(e,
- obj.patron.mailing_address().post_code()
- );
- if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ if (obj.patron.mailing_address()) {
+ util.widgets.set_text(e,
+ obj.patron.mailing_address().post_code()
+ );
+ if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
+ } else {
+ util.widgets.set_text(e,'');
+ }
};
}
],
@@ -727,54 +747,74 @@
['render'],
function(e) {
return function() {
- util.widgets.set_text(e,
- obj.patron.billing_address().street1()
- );
- if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ if (obj.patron.billing_address()) {
+ util.widgets.set_text(e,
+ obj.patron.billing_address().street1()
+ );
+ if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ } else {
+ util.widgets.set_text(e,'');
+ }
};
}
],
'patron_physical_address_street2' : [
['render'],
function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.billing_address().street2()
- );
- if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ return function() {
+ if (obj.patron.billing_address()) {
+ util.widgets.set_text(e,
+ obj.patron.billing_address().street2()
+ );
+ if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ } else {
+ util.widgets.set_text(e,'');
+ }
};
}
],
'patron_physical_address_city' : [
['render'],
function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.billing_address().city()
- );
- if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ return function() {
+ if (obj.patron.billing_address()) {
+ util.widgets.set_text(e,
+ obj.patron.billing_address().city()
+ );
+ if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ } else {
+ util.widgets.set_text(e,'');
+ }
};
}
],
'patron_physical_address_state' : [
['render'],
function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.billing_address().state()
- );
- if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ return function() {
+ if (obj.patron.billing_address()) {
+ util.widgets.set_text(e,
+ obj.patron.billing_address().state()
+ );
+ if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ } else {
+ util.widgets.set_text(e,'');
+ }
};
}
],
'patron_physical_address_post_code' : [
['render'],
function(e) {
- return function() {
- util.widgets.set_text(e,
- obj.patron.billing_address().post_code()
- );
- if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ return function() {
+ if (obj.patron.billing_address()) {
+ util.widgets.set_text(e,
+ obj.patron.billing_address().post_code()
+ );
+ if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
+ } else {
+ util.widgets.set_text(e,'');
+ }
};
}
]
More information about the open-ils-commits
mailing list