From b67e28739cf42911a118930ec6e27c49ff095de9 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 19 Jul 2006 15:49:23 +0000 Subject: [PATCH] fixed issue where deleting all addresses makes it impossible to create a new one fixed issue where deleting an address caused required/regex errors git-svn-id: svn://svn.open-ils.org/ILS/trunk@5084 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/patron/ue.js | 13 +++++++++++-- Open-ILS/xul/staff_client/server/patron/ue_config.js | 10 ++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/ue.js b/Open-ILS/xul/staff_client/server/patron/ue.js index 0cccd28ea8..c3233ad745 100644 --- a/Open-ILS/xul/staff_client/server/patron/ue.js +++ b/Open-ILS/xul/staff_client/server/patron/ue.js @@ -171,6 +171,8 @@ function uEditCreateNewAddr() { addr.isnew(1); addr.usr(patron.id()); addr.country(defaultCountry); + if(!patron.addresses()) + patron.addresses([]); if(patron.addresses().length == 0) { patron.mailing_address(addr); patron.billing_address(addr); @@ -329,9 +331,8 @@ function uEditFindFieldByWId(id) { function uEditIterateFields(callback) { - for( var f in dataFields ) { + for( var f in dataFields ) callback(dataFields[f]); - } } @@ -545,3 +546,11 @@ function uEditMarkCardLost() { } +function compactArray(arr) { + var a = []; + for( var i = 0; arr && i < arr.length; i++ ) { + if( arr[i] != null ) + a.push(arr[i]); + } + return a; +} diff --git a/Open-ILS/xul/staff_client/server/patron/ue_config.js b/Open-ILS/xul/staff_client/server/patron/ue_config.js index 3b9208c3a5..9b713f42b5 100644 --- a/Open-ILS/xul/staff_client/server/patron/ue_config.js +++ b/Open-ILS/xul/staff_client/server/patron/ue_config.js @@ -459,6 +459,16 @@ function uEditDeleteAddr( tbody, row, address, detach ) { } ) ); + + /* XXX */ + for( var f in dataFields ) { + if( dataFields[f].object == address ) { + dataFields[f] = null; + } + } + + dataFields = compactArray(dataFields); + } else { if( detach ) { /* remove the offending address from the list */ -- 2.11.0