/** * Validates that at least one groupBy has been selected, since this is required for a summation report * @return bool */ public function validateGroupBys() { $validated = parent::validateGroupBys(); if (count($this->groupBys) == 0) { $this->addError('groupBys', Zurmo::t('ReportsModule', 'At least one grouping must be selected')); $validated = false; } return $validated; }
/** * Validates that at least one x and y axis groupBy has been selected. * @return bool */ public function validateGroupBys() { $validated = parent::validateGroupBys(); $xAxisFound = false; $yAxisFound = false; foreach ($this->groupBys as $groupBy) { if ($groupBy->axis == 'x') { $xAxisFound = true; } if ($groupBy->axis == 'y') { $yAxisFound = true; } } if (!$xAxisFound || !$yAxisFound) { $this->addError('groupBys', Zurmo::t('ReportsModule', 'At least one x-axis and one y-axis grouping must be selected')); $validated = false; } return $validated; }