From 29fc2b7978ebc1400bc89218ff964de405991606 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 30 Apr 2013 16:46:47 +1200 Subject: [PATCH] CRM-12053 fix remaining static operators --- CRM/Report/Form.php | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index e59a3f3657..54b51731db 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -391,7 +391,7 @@ class CRM_Report_Form extends CRM_Core_Form { $this->_chartButtonName = $this->getButtonName('submit', 'chart'); } - static function addBreadCrumb() { + function addBreadCrumb() { $breadCrumbs = array( array( @@ -407,7 +407,7 @@ class CRM_Report_Form extends CRM_Core_Form { $this->preProcessCommon(); if (!$this->_id) { - self::addBreadCrumb(); + $this->addBreadCrumb(); } foreach ($this->_columns as $tableName => $table) { @@ -1089,7 +1089,7 @@ class CRM_Report_Form extends CRM_Core_Form { } } - static function getSQLOperator($operator = "like") { + function getSQLOperator($operator = "like") { switch ($operator) { case 'eq': return '='; @@ -1185,7 +1185,7 @@ class CRM_Report_Form extends CRM_Core_Form { else { $value = "'{$value}'"; } - $sqlOP = self::getSQLOperator($op); + $sqlOP = $this->getSQLOperator($op); $clause = "( {$field['dbAlias']} $sqlOP $value )"; } break; @@ -1193,7 +1193,7 @@ class CRM_Report_Form extends CRM_Core_Form { case 'in': case 'notin': if ($value !== NULL && is_array($value) && count($value) > 0) { - $sqlOP = self::getSQLOperator($op); + $sqlOP = $this->getSQLOperator($op); if (CRM_Utils_Array::value('type', $field) == CRM_Utils_Type::T_STRING) { //cycle through selections and esacape values foreach ($value as $key => $selection) { @@ -1217,7 +1217,7 @@ class CRM_Report_Form extends CRM_Core_Form { case 'mhas': // mhas == multiple has if ($value !== NULL && count($value) > 0) { - $sqlOP = self::getSQLOperator($op); + $sqlOP = $this->getSQLOperator($op); $clause = "{$field['dbAlias']} REGEXP '[[:<:]]" . implode('|', $value) . "[[:>:]]'"; } break; @@ -1237,14 +1237,14 @@ class CRM_Report_Form extends CRM_Core_Form { else { $value = "'{$value}'"; } - $sqlOP = self::getSQLOperator($op); + $sqlOP = $this->getSQLOperator($op); $clause = "( {$field['dbAlias']} $sqlOP $value )"; } break; case 'nll': case 'nnll': - $sqlOP = self::getSQLOperator($op); + $sqlOP = $this->getSQLOperator($op); $clause = "( {$field['dbAlias']} $sqlOP )"; break; @@ -1257,7 +1257,7 @@ class CRM_Report_Form extends CRM_Core_Form { } else { $value = CRM_Utils_Type::escape($value, $type); - $sqlOP = self::getSQLOperator($op); + $sqlOP = $this->getSQLOperator($op); if ($field['type'] == CRM_Utils_Type::T_STRING) { $value = "'{$value}'"; } @@ -1285,11 +1285,11 @@ class CRM_Report_Form extends CRM_Core_Form { ) { $clauses = array(); if (in_array($relative, array_keys($this->getOperationPair(CRM_Report_FORM::OP_DATE)))) { - $sqlOP = self::getSQLOperator($relative); + $sqlOP = $this->getSQLOperator($relative); return "( {$fieldName} {$sqlOP} )"; } - list($from, $to) = self::getFromTo($relative, $from, $to, $fromTime, $toTime); + list($from, $to) = $this->getFromTo($relative, $from, $to, $fromTime, $toTime); if ($from) { $from = ($type == CRM_Utils_Type::T_DATE) ? substr($from, 0, 8) : $from; @@ -1307,9 +1307,15 @@ class CRM_Report_Form extends CRM_Core_Form { return NULL; } - - static function dateDisplay($relative, $from, $to) { - list($from, $to) = self::getFromTo($relative, $from, $to); + /** + * @todo - could not find any instances where this is called + * @param unknown_type $relative + * @param String $from + * @param String_type $to + * @return string|NULL + */ + function dateDisplay($relative, $from, $to) { + list($from, $to) = $this->getFromTo($relative, $from, $to); if ($from) { $clauses[] = CRM_Utils_Date::customFormat($from, NULL, array('m', 'M')); @@ -1332,7 +1338,7 @@ class CRM_Report_Form extends CRM_Core_Form { return NULL; } - static function getFromTo($relative, $from, $to, $fromtime = NULL, $totime = NULL) { + function getFromTo($relative, $from, $to, $fromtime = NULL, $totime = NULL) { if (empty($totime)) { $totime = '235959'; } @@ -2535,7 +2541,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND WHERE smartgroup_contact.group_id IN ({$smartGroups}) "; } - $sqlOp = self::getSQLOperator($op); + $sqlOp = $this->getSQLOperator($op); if (!is_array($value)) { $value = array($value); } @@ -2552,7 +2558,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND // not using left join in query because if any contact // belongs to more than one tag, results duplicate // entries. - $sqlOp = self::getSQLOperator($op); + $sqlOp = $this->getSQLOperator($op); if (!is_array($value)) { $value = array($value); } -- 2.25.1