From 2ace57415b6d5876dd7bbaee68808bf5e4c2db68 Mon Sep 17 00:00:00 2001
From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Mon, 27 Sep 2010 16:29:19 +0000
Subject: [PATCH] since we're enforcing the requiredness of address type, let's
 give it a default value (since empty strings don't work with these widgets)

git-svn-id: svn://svn.open-ils.org/ILS/trunk@18029 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/web/js/dojo/openils/actor/nls/register.js | 1 +
 Open-ILS/web/js/ui/default/actor/user/register.js  | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/Open-ILS/web/js/dojo/openils/actor/nls/register.js b/Open-ILS/web/js/dojo/openils/actor/nls/register.js
index 6e0f8af804..5cdc0235b4 100644
--- a/Open-ILS/web/js/dojo/openils/actor/nls/register.js
+++ b/Open-ILS/web/js/dojo/openils/actor/nls/register.js
@@ -1,4 +1,5 @@
 {
+    "DEFAULT_ADDRESS_TYPE" : "MAILING",
     "DELETE_ADDRESS" : "Delete address ${0}?",
     "NEED_ADDRESS" : "An address is required during registration.",
     "DUPE_PATRON_NAME" : "Found ${0} patron(s) with the same name",
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 cff9071e32..eb53ecd9cf 100644
--- a/Open-ILS/web/js/ui/default/actor/user/register.js
+++ b/Open-ILS/web/js/ui/default/actor/user/register.js
@@ -1213,6 +1213,10 @@ function uEditNewAddr(evt, id, mkLinks) {
             if(row.getAttribute('fmclass')) {
                 var widget = fleshFMRow(row, 'aua', {addr:id});
 
+                // make new addresses a default address type
+                if(id < 0 && row.getAttribute('fmfield') == 'address_type') 
+                    widget.widget.attr('value', localeStrings.DEFAULT_ADDRESS_TYPE); 
+
                 // make new addresses valid by default
                 if(id < 0 && row.getAttribute('fmfield') == 'valid') 
                     widget.widget.attr('value', true); 
-- 
2.11.0