[OPEN-ILS-GENERAL] Canadian Addresses

Dan Scott denials at gmail.com
Fri May 23 20:32:52 EDT 2008


Hi Grant:

2008/5/23 Grant Johnson <fgjohnson at upei.ca>:
> Good evening ...
>
> Anyone know how to fix the Patron Address screens?

Sure!

> Create, View and Edit in Staff Client/OPAC??
>
> - I need to have Province not State
> - Postal Code not ZIP


Edit Open-ILS/xul/staff_client/server/patron/user_editor.xhtml - there
are two occurrences each of "State" and "Zip" to change (just change
the label matching the exact case).

Also change the same occurrences in
Open-ILS/xul/staff_client/server/patron/ue.xhtml.

(I think one of these files is probably deadwood but they're easy
enough to change anyway).

> - Default CAN not USA

Edit Open-ILS/xul/staff_client/server/patron/ue_config.js and change
the following lines at the top:

const defaultState      = 'PE';
const defaultCountry        = 'CAN';

In the same file, you'll also probably want to change the zipRegex to
match postal codes instead:

const zipRegex      = /^[A-Z]\d[A-Z] \d[A-Z]\d$/; /* e.g. "C1A 4P3" --
all caps, with a space */

user_editor.js also sets a default state to GA - might as well change
that one, too.

>
> We'll hopefully going to be importing a load of Patron records next week, and should understand this before we get started!

Attached is a patch for the 1.2 branch that should help you along.
Note that in trunk the labels, at least, will be translated into the
en-CA locale so we'll have postal code / province - but we still have
to figure out how to properly manage regexes for different regions.

-- 
Dan Scott
Laurentian University
-------------- next part --------------
Index: Open-ILS/xul/staff_client/server/patron/user_editor.js
===================================================================
--- Open-ILS/xul/staff_client/server/patron/user_editor.js	(revision 9692)
+++ Open-ILS/xul/staff_client/server/patron/user_editor.js	(working copy)
@@ -18,7 +18,7 @@
 var deletedStatCats			= {};
 var cachedAddresses			= {};
 var deletedAddresses			= {};
-var defaultState				= 'GA';
+var defaultState				= 'PE';
 
 /* if they don't have these perms, they shouldn't be here */
 //var myPerms = [ 'CREATE_USER', 'UPDATE_USER', 'CREATE_PATRON_STAT_CAT_ENTRY_MAP' ];
Index: Open-ILS/xul/staff_client/server/patron/user_editor.xhtml
===================================================================
--- Open-ILS/xul/staff_client/server/patron/user_editor.xhtml	(revision 9692)
+++ Open-ILS/xul/staff_client/server/patron/user_editor.xhtml	(working copy)
@@ -451,13 +451,13 @@
 														</td>
 													</tr>
 													<tr>
-														<td><div class='wide right'>State</div></td>
+														<td><div class='wide right'>Province</div></td>
 														<td>
 															<div class='wide left'>
 																<input type='text' name='ue_addr_state' size='2' maxlength='2'/>
 															</div>
 														</td>
-														<td><div class='wide right'>Zip</div></td>
+														<td><div class='wide right'>Postal Code</div></td>
 														<td>
 															<div class='wide left'>
 																<input type='text' name='ue_addr_zip' size='6' maxlength='6'/>
@@ -767,7 +767,7 @@
 											<tbody>
 												<tr>
 													<td>Address Label</td><td name='label'/>
-													<td>Zip Code</td><td name='zip'/>
+													<td>Postal Code</td><td name='zip'/>
 												</tr>
 												<tr>
 													<td>Street1</td><td name='street1'/>
@@ -786,7 +786,7 @@
 													<td>Valid</td><td name='valid'/>
 												</tr>
 												<tr>
-													<td>State</td><td name='state'/>
+													<td>Province</td><td name='state'/>
 													<td>Incorporated</td><td name='incorporated'/>
 												</tr>
 											</tbody>
Index: Open-ILS/xul/staff_client/server/patron/ue.xhtml
===================================================================
--- Open-ILS/xul/staff_client/server/patron/ue.xhtml	(revision 9692)
+++ Open-ILS/xul/staff_client/server/patron/ue.xhtml	(working copy)
@@ -462,7 +462,7 @@
 																<input type='text' name='ue_addr_label' id='ue_addr_label'/>
 															</div>
 														</td>
-														<td><div class='wide right'>Zip</div></td>
+														<td><div class='wide right'>Postal</div></td>
 														<td>
 															<div class='wide left'>
 																<input type='text' name='ue_addr_zip' size='10' maxlength='10'/>
@@ -500,7 +500,7 @@
 														</td>
 													</tr>
 													<tr>
-														<td><div class='wide right'>State</div></td>
+														<td><div class='wide right'>Province</div></td>
 														<td colspan='3'>
 															<div class='wide left'>
 																<input type='text' name='ue_addr_state' size='2' maxlength='2'/>
@@ -841,7 +841,7 @@
 											<tbody>
 												<tr>
 													<td><b>Address Label</b></td><td name='label'/>
-													<td><b>Zip Code</b></td><td name='zip'/>
+													<td><b>Postal Code</b></td><td name='zip'/>
 												</tr>
 												<tr>
 													<td><b>Street1</b></td><td name='street1'/>
@@ -860,7 +860,7 @@
 													<td><b>Valid</b></td><td name='valid'/>
 												</tr>
 												<tr>
-													<td><b>State</b></td><td name='state'/>
+													<td><b>Province</b></td><td name='state'/>
 													<td><b>Within City Limits</b></td><td name='incorporated'/>
 												</tr>
 											</tbody>
Index: Open-ILS/xul/staff_client/server/patron/ue_config.js
===================================================================
--- Open-ILS/xul/staff_client/server/patron/ue_config.js	(revision 9692)
+++ Open-ILS/xul/staff_client/server/patron/ue_config.js	(working copy)
@@ -13,8 +13,8 @@
 const FETCH_GRP_MEMS		= 'open-ils.actor:open-ils.actor.usergroup.members.retrieve';
 const CREATE_USER_NOTE	= 'open-ils.actor:open-ils.actor.note.create';
 const CHECK_BARCODE		= 'open-ils.actor:open-ils.actor.barcode.exists';
-const defaultState		= 'GA';
-const defaultCountry		= 'USA';
+const defaultState		= 'PE';
+const defaultCountry		= 'CAN';
 const defaultNetAccess	= 'None';
 const CSS_INVALID_DATA	= 'invalid_value';
 const ADULT_AGE			= 18;
@@ -45,7 +45,7 @@
 const phoneRegex	= /^\d{3}-\d{3}-\d{4}(| ex\d+)$/i;
 const nonumRegex	= /^[a-zA-Z]\D*$/; /* no numbers, no beginning whitespace */
 const dateRegex	= /^\d{4}-\d{2}-\d{2}/;
-const zipRegex		= /^\d{5}(-\d{4}|$)/; /* 12345 or 12345-6789 */
+const zipRegex		= /^[A-Z]\d[A-Z] \d[A-Z]\d$/; /* L4M 4G5 - all caps with a space */
 
 var barredAlerted = false;
 


More information about the Open-ils-general mailing list