예제 #1
0
 /**
  * Set form rules.
  *
  * @param array $fields
  * @param array $files
  * @param CRM_Report_Form_Contribute_Summary $self
  *
  * @return array
  */
 public static function formRule($fields, $files, $self)
 {
     // Check for searching combination of display columns and
     // grouping criteria
     $ignoreFields = array('total_amount', 'sort_name');
     $errors = $self->customDataFormRule($fields, $ignoreFields);
     if (empty($fields['fields']['total_amount'])) {
         foreach (array('total_count_value', 'total_sum_value', 'total_avg_value') as $val) {
             if (!empty($fields[$val])) {
                 $errors[$val] = ts("Please select the Amount Statistics");
             }
         }
     }
     return $errors;
 }
 /**
  * Replace the filter fields for Is New.
  */
 public function addFilters()
 {
     parent::addFilters();
     foreach ($this->_filters as $table => $attributes) {
         foreach ($attributes as $fieldName => $field) {
             $operations = $this->getOperationPair(CRM_Utils_Array::value('operatorType', $field), $fieldName);
             if ($fieldName == 'not_new') {
                 $this->removeElement("{$fieldName}_op");
                 $this->removeElement("{$fieldName}_value");
                 $this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations);
                 break;
             }
         }
     }
 }