Author: sevein
Date: Thu Dec 3 10:41:49 2009
New Revision: 4049
Log:
Replace the way I check ISDIAH 'Location and address' field. The first way
wasn't very orthodox.
Deleted:
trunk/lib/QubitValidatorIsdiahLocationAndAddress.class.php
Modified:
trunk/apps/qubit/modules/repository/actions/showIsdiahAction.class.php
Modified: trunk/apps/qubit/modules/repository/actions/showIsdiahAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/repository/actions/showIsdiahAction.class.php
Thu Dec 3 10:34:33 2009 (r4048)
+++ trunk/apps/qubit/modules/repository/actions/showIsdiahAction.class.php
Thu Dec 3 10:41:49 2009 (r4049)
@@ -39,14 +39,34 @@
$validatorSchema = new sfValidatorSchema;
$validatorSchema->authorizedFormOfName = new
sfValidatorString(array('required' => true), array('required' =>
$this->context->i18n->__('%1%Authorized form of name%2% - This is a mandatory
field.', array('%1%' => '<a
href="http://ica-atom.org/docs/index.php?title=RS-3#4.7">', '%2%' => '</a>'))));
$validatorSchema->identifier = new sfValidatorString(array('required' =>
true), array('required' => $this->context->i18n->__('%1%Identifier%2% - This is
a mandatory field.', array('%1%' => '<a
href="http://ica-atom.org/docs/index.php?title=RS-3#4.7">', '%2%' => '</a>'))));
- $validatorSchema->locationAndAddress = new
QubitValidatorIsdiahLocationAndAddress;
+
+ $validatorSchema->primaryContact = new sfValidatorAnd(array(
+ new QubitValidatorCountable,
+ new sfValidatorOr(array(
+ new sfValidatorSchema(array('city' => new
sfValidatorString(array('required' => true))), array('allow_extra_fields' =>
true)),
+ new sfValidatorSchema(array('countryCode' => new
sfValidatorString(array('required' => true))), array('allow_extra_fields' =>
true)),
+ new sfValidatorSchema(array('postalCode' => new
sfValidatorString(array('required' => true))), array('allow_extra_fields' =>
true)),
+ new sfValidatorSchema(array('region' => new
sfValidatorString(array('required' => true))), array('allow_extra_fields' =>
true)),
+ new sfValidatorSchema(array('streetAddress' => new
sfValidatorString(array('required' => true))), array('allow_extra_fields' =>
true)),
+ ), array('required' => true), array('invalid' =>
$this->context->i18n->__('%1%Contact information%2% - At least, you must fill
one of the next fields: city, country, postal code, region or street address.',
array('%1%' => '<a href="http://ica-atom.org/docs/index.php?title=RS-3#4.7">',
'%2%' => '</a>'))))
+ ), array('required' => true), array('required' =>
$this->context->i18n->__('%1%Contact information%2% - This is a mandatory
field.', array('%1%' => '<a
href="http://ica-atom.org/docs/index.php?title=RS-3#4.7">', '%2%' => '</a>'))));
+
+ $value = array();
+ $value['authorizedFormOfName'] = $this->repository->authorizedFormOfName;
+ $value['identifier'] = $this->repository->identifier;
+
+ if (null !== $this->repository->getPrimaryContact())
+ {
+ $value['primaryContact']['city'] =
$this->repository->getPrimaryContact()->city;
+ $value['primaryContact']['countryCode'] =
$this->repository->getPrimaryContact()->countryCode;
+ $value['primaryContact']['postalCode'] =
$this->repository->getPrimaryContact()->postalCode;
+ $value['primaryContact']['region'] =
$this->repository->getPrimaryContact()->region;
+ $value['primaryContact']['streetAddress'] =
$this->repository->getPrimaryContact()->streetAddress;
+ }
try
{
- $validatorSchema->clean(array(
- 'authorizedFormOfName' => $this->repository->authorizedFormOfName,
- 'identifier' => $this->repository->identifier,
- 'locationAndAddress' => $this->repository));
+ $validatorSchema->clean($value);
}
catch (sfValidatorErrorSchema $e)
{
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.