Beispiel #1
0
 /**
  * Global validation rules for the form.
  *
  * @param array $fields
  *   Posted values of the form.
  *
  * @return array
  *   list of errors to be posted back to the form
  */
 public static function formRule($fields)
 {
     // check for state/country mapping
     $errors = CRM_Contact_Form_Edit_Address::formRule($fields, CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullObject);
     // $errors === TRUE means no errors from above formRule excution,
     // so declaring $errors to array for further processing
     if ($errors === TRUE) {
         $errors = array();
     }
     //fix for CRM-3552,
     //as we use "fromName"<emailaddresss> format for domain email.
     if (strpos($fields['email_name'], '"') !== FALSE) {
         $errors['email_name'] = ts('Double quotes are not allow in from name.');
     }
     // Check for default from email address and organization (domain) name. Force them to change it.
     if ($fields['email_address'] == '*****@*****.**') {
         $errors['email_address'] = ts('Please enter a valid default FROM email address for system-generated emails.');
     }
     if ($fields['name'] == 'Default Domain Name') {
         $errors['name'] = ts('Please enter the name of the organization or entity which owns this CiviCRM site.');
     }
     return empty($errors) ? TRUE : $errors;
 }
Beispiel #2
0
 /**
  * global validation rules for the form
  *
  * @param array $fields posted values of the form
  *
  * @return array list of errors to be posted back to the form
  * @static
  * @access public
  */
 static function formRule(&$fields)
 {
     $errors = array();
     // check for state/country mapping
     CRM_Contact_Form_Edit_Address::formRule($fields, $errors);
     //fix for CRM-3552,
     //as we use "fromName"<emailaddresss> format for domain email.
     if (strpos($fields['email_name'], '"') !== false) {
         $errors['email_name'] = ts('Double quotes are not allow in from name.');
     }
     return empty($errors) ? true : $errors;
 }
Beispiel #3
0
 /**
  * global form rule
  *
  * @param array $fields  the input form values
  * @param array $files   the uploaded files if any
  * @param array $options additional user data
  *
  * @return true if no errors, else array of errors
  * @access public
  * @static
  */
 static function formRule(&$fields, &$files, $contactID = null)
 {
     $errors = array();
     //FIXME
     if (CRM_Utils_Array::value('state_province_id', $fields['address'][1]) == 'undefined') {
         $fields['address'][1]['state_province_id'] = '';
     }
     $primaryID = CRM_Contact_Form_Contact::formRule($fields, $errors, $contactID);
     // check for state/country mapping
     require_once 'CRM/Contact/Form/Edit/Address.php';
     CRM_Contact_Form_Edit_Address::formRule($fields, $errors);
     // make sure that firstName and lastName or a primary OpenID is set
     if (!$primaryID && (!CRM_Utils_Array::value('first_name', $fields) || !CRM_Utils_Array::value('last_name', $fields))) {
         $errors['_qf_default'] = ts('First Name and Last Name OR an email OR an OpenID in the Primary Location should be set.');
     }
     //check for duplicate - dedupe rules
     CRM_Contact_Form_Contact::checkDuplicateContacts($fields, $errors, $contactID, 'Individual');
     // if use_household_address option is checked, make sure 'valid household_name' is also present.
     if (CRM_Utils_Array::value('use_household_address', $fields) && !CRM_Utils_Array::value('shared_household_id', $fields)) {
         $errors["shared_household"] = ts("Please select a household from the 'Select Household' list");
     }
     return empty($errors) ? true : $errors;
 }
Beispiel #4
0
 /**
  * global validation rules for the form
  *
  * @param array $fields posted values of the form
  *
  * @return array list of errors to be posted back to the form
  * @static
  * @access public
  */
 static function formRule(&$fields)
 {
     $errors = array();
     // check for state/country mapping
     CRM_Contact_Form_Edit_Address::formRule($fields, $errors);
     return empty($errors) ? true : $errors;
 }
 /**
  * global validation rules for the form
  *
  * @param array $fields posted values of the form
  *
  * @return array list of errors to be posted back to the form
  * @static
  * @access public
  */
 static function formRule($fields)
 {
     // check for state/country mapping
     $errors = CRM_Contact_Form_Edit_Address::formRule($fields, CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullObject);
     return empty($errors) ? TRUE : $errors;
 }
 /**
  * global validation rules for the form
  *
  * @param array $fields posted values of the form
  *
  * @return array list of errors to be posted back to the form
  * @static
  * @access public
  */
 static function formRule($fields)
 {
     // check for state/country mapping
     $errors = CRM_Contact_Form_Edit_Address::formRule($fields);
     return empty($errors) ? TRUE : $errors;
 }
 /**
  * global validation rules for the form
  *
  * @param array $fields posted values of the form
  *
  * @return array list of errors to be posted back to the form
  * @static
  * @access public
  */
 static function formRule($fields)
 {
     $errors = array();
     // check for state/country mapping
     CRM_Contact_Form_Edit_Address::formRule($fields, $errors);
     //fix for CRM-3552,
     //as we use "fromName"<emailaddresss> format for domain email.
     if (strpos($fields['email_name'], '"') !== FALSE) {
         $errors['email_name'] = ts('Double quotes are not allow in from name.');
     }
     // Check for default from email address and organization (domain) name. Force them to change it.
     if ($fields['email_address'] == '*****@*****.**') {
         $errors['email_address'] = ts('Please enter a valid default FROM email address for system-generated emails.');
     }
     if ($fields['name'] == 'Default Domain Name') {
         $errors['name'] = ts('Please enter the name of the organization or entity which owns this CiviCRM site.');
     }
     return empty($errors) ? TRUE : $errors;
 }