foreach ($this->_filters as $table => $attributes) {
foreach ($attributes as $fieldName => $field) {
// get ready with option value pair
- $operations = self::getOperationPair(
+ // @ todo being able to specific options for a field (e.g a date field) in the field spec as an array rather than an override
+ // would be useful
+ $operations = $this->getOperationPair(
CRM_Utils_Array::value('operatorType', $field),
- $fieldName
- );
+ $fieldName);
$filters[$table][$fieldName] = $field;
// Note: $fieldName param allows inheriting class to build operationPairs
// specific to a field.
- static function getOperationPair($type = "string", $fieldName = NULL) {
+ function getOperationPair($type = "string", $fieldName = NULL) {
// FIXME: At some point we should move these key-val pairs
// to option_group and option_value table.
$relative, $from, $to, $type = NULL, $fromTime = NULL, $toTime = NULL
) {
$clauses = array();
- if (in_array($relative, array_keys(self::getOperationPair(CRM_Report_FORM::OP_DATE)))) {
+ if (in_array($relative, array_keys($this->getOperationPair(CRM_Report_FORM::OP_DATE)))) {
$sqlOP = self::getSQLOperator($relative);
return "( {$fieldName} {$sqlOP} )";
}
);
}
elseif (in_array($rel = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params),
- array_keys(self::getOperationPair(CRM_Report_FORM::OP_DATE))
+ array_keys($this->getOperationPair(CRM_Report_FORM::OP_DATE))
)) {
- $pair = self::getOperationPair(CRM_Report_FORM::OP_DATE);
+ $pair = $this->getOperationPair(CRM_Report_FORM::OP_DATE);
$statistics['filters'][] = array(
'title' => $field['title'],
'value' => $pair[$rel],
$op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
$value = NULL;
if ($op) {
- $pair = self::getOperationPair(
+ $pair = $this->getOperationPair(
CRM_Utils_Array::value('operatorType', $field),
$fieldName
);