From d954d148d67a4c60e34d75b98083bab3d099be08 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 26 Nov 2009 17:50:00 +0000 Subject: [PATCH] Add all the missing judge registration fields, and let them be configurable. Notify user if invalid regexp's are entered in fields (there was no feedback as to why it wasnt saving!) Also make the space in the postalcode optional FIXME: still need to change the "incomplete" to "complete" message once everything is saved properly, it stays as incomplete right now until they navigate away and come back. --- db/db.code.version.txt | 2 +- db/db.update.152.sql | 16 ++++++++++++++++ user_personal.php | 6 +++--- 3 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 db/db.update.152.sql diff --git a/db/db.code.version.txt b/db/db.code.version.txt index 1b9cba4..492dff0 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -151 +152 diff --git a/db/db.update.152.sql b/db/db.update.152.sql new file mode 100644 index 0000000..53eecc1 --- /dev/null +++ b/db/db.update.152.sql @@ -0,0 +1,16 @@ +INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year` ) +VALUES ( +'judge_personal_fields', 'phonehome,phonecell,phonework,org,address,city,province,lang', +'Judge Registration', 'multisel', +'sex=Gender|phonehome=Home Phone|phonework=Work Phone|phonecell=Cell Phone|fax=Fax|org=Organization|birthdate=Birthdate|lang=Preferred Language|address=Address and PostalCode|city=City|province=Province', +'500', 'Personal Information to ask for on the Judge personal information page (in addition to Name and Email)', '-1'); + + +INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year` ) +VALUES ( +'judge_personal_required', 'phonehome,address,city,province', +'Judge Registration', 'multisel', +'sex=Gender|phonehome=Home Phone|phonework=Work Phone|phonecell=Cell Phone|fax=Fax|org=Organization|birthdate=Birthdate|lang=Preferred Language|address=Address and PostalCode|city=City|province=Province', +'600', 'Required Personal Information on the Judge personal information page (Name and Email is always required)', '-1'); + + diff --git a/user_personal.php b/user_personal.php index 938132c..2db6c0f 100644 --- a/user_personal.php +++ b/user_personal.php @@ -63,8 +63,8 @@ 'regexp' => '^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}$', 'format' => '\'NNN-NNN-NNNN\'',), 'postalcode' => array('name' => $config['postalzip'], - 'regexp' => '^(([A-Z][0-9][A-Z] [0-9][A-Z][0-9])|([0-9]{5}))$', - 'format' => '\'ANA NAN\' or \'NNNNN\'',), + 'regexp' => '^(([A-Z][0-9][A-Z]( )?[0-9][A-Z][0-9])|([0-9]{5}))$', + 'format' => '\'ANA NAN\' or \'ANANAN\' or \'NNNNN\'',), ); @@ -121,7 +121,7 @@ case 'save': /* Match the regex */ if(!ereg($user_personal_fields[$f]['regexp'], $u[$f])) { /* Bad */ - echo "bad regex match ({$user_personal_fields[$f]['regexp']})"; + error_("Invalid format for $f expecting ({$user_personal_fields[$f]['format']})"); $save = false; $errorfields[] = $f; }