CC-4090: Make code style PSR compliant
-removed all trailing whitespace in forms directory -replace all tabs with 4 spaces
This commit is contained in:
parent
d9cde230cd
commit
7ce4934cdc
25 changed files with 297 additions and 297 deletions
|
@ -4,34 +4,34 @@
|
|||
* Check if a field is empty but only when specific fields have specific values
|
||||
*/
|
||||
class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
||||
|
||||
|
||||
const KEY_IS_EMPTY = 'keyIsEmpty';
|
||||
|
||||
|
||||
protected $_messageTemplates = array(
|
||||
self::KEY_IS_EMPTY => 'Value is required and can\'t be empty'
|
||||
);
|
||||
|
||||
|
||||
protected $_fieldValues;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new ConditionalNotEmpty validator.
|
||||
*
|
||||
*
|
||||
* @param array $fieldValues - the names and expected values of the fields we're depending on;
|
||||
* E.g., if we have a field that should only be validated when two other
|
||||
* fields PARENT_1 and PARENT_2 have values of '1' and '0' respectively, then
|
||||
* fields PARENT_1 and PARENT_2 have values of '1' and '0' respectively, then
|
||||
* $fieldValues should contain ('PARENT_1'=>'1', 'PARENT_2'=>'0')
|
||||
*/
|
||||
public function __construct($fieldValues)
|
||||
{
|
||||
$this->_fieldValues = $fieldValues;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements Zend_Validate_Abstract.
|
||||
* Given names and expected values of the fields we're depending on ($_fieldValues),
|
||||
* this function returns true if the expected values doesn't match the actual user input,
|
||||
* or if $value is not empty. Returns false otherwise.
|
||||
*
|
||||
*
|
||||
* @param String $value - this field's value
|
||||
* @param array $context - names and values of the rest of the fields in this form
|
||||
* @return boolean - true if valid; false otherwise
|
||||
|
@ -41,7 +41,7 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
|||
if ($value != "") {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (is_array($context)) {
|
||||
foreach($this->_fieldValues as $fieldName=>$fieldValue) {
|
||||
if (!isset($context[$fieldName]) || $context[$fieldName] != $fieldValue) {
|
||||
|
@ -53,7 +53,7 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->_error(self::KEY_IS_EMPTY);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue