From 1b36206cce57edc906daec83493dd20d6215b8a2 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 30 Apr 2013 16:33:33 +1200 Subject: [PATCH] CRM-12053 make getOperationPair non-static again. However, Lybunt & Sybunt form date operations remain broken :-) --- CRM/Report/Form.php | 17 +++++++++-------- CRM/Report/Form/Contribute/Lybunt.php | 2 +- CRM/Report/Form/Contribute/Sybunt.php | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index fef2c7232c..e59a3f3657 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -708,10 +708,11 @@ class CRM_Report_Form extends CRM_Core_Form { 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; @@ -991,7 +992,7 @@ class CRM_Report_Form extends CRM_Core_Form { // 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. @@ -1283,7 +1284,7 @@ class CRM_Report_Form extends CRM_Core_Form { $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} )"; } @@ -2261,9 +2262,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND ); } 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], @@ -2274,7 +2275,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND $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 ); diff --git a/CRM/Report/Form/Contribute/Lybunt.php b/CRM/Report/Form/Contribute/Lybunt.php index c819ed9bfe..f7c3dbf8f7 100644 --- a/CRM/Report/Form/Contribute/Lybunt.php +++ b/CRM/Report/Form/Contribute/Lybunt.php @@ -435,7 +435,7 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { } // Override "This Year" $op options - static function getOperationPair($type = "string", $fieldName = NULL) { + function getOperationPair($type = "string", $fieldName = NULL) { if ($fieldName == 'yid') { return array('calendar' => ts('Is Calendar Year'), 'fiscal' => ts('Fiscal Year Starting')); } diff --git a/CRM/Report/Form/Contribute/Sybunt.php b/CRM/Report/Form/Contribute/Sybunt.php index ff5f5a87f2..653e6ed9d6 100644 --- a/CRM/Report/Form/Contribute/Sybunt.php +++ b/CRM/Report/Form/Contribute/Sybunt.php @@ -449,7 +449,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { } // Override "This Year" $op options - static function getOperationPair($type = "string", $fieldName = NULL) { + function getOperationPair($type = "string", $fieldName = NULL) { if ($fieldName == 'yid') { return array('calendar' => ts('Is Calendar Year'), 'fiscal' => ts('Fiscal Year Starting')); } -- 2.25.1