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.
This commit is contained in:
james 2009-11-26 17:50:00 +00:00
parent 471d0f7d78
commit d954d148d6
3 changed files with 20 additions and 4 deletions

View File

@ -1 +1 @@
151
152

16
db/db.update.152.sql Normal file
View File

@ -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');

View File

@ -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;
}