From: eileen Date: Thu, 11 Feb 2016 03:25:22 +0000 (+1300) Subject: Lybunt follow on tidy up. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4400048b2ad868d4cf10e56e3ff001c60651befa;p=civicrm-core.git Lybunt follow on tidy up. It has been pointed out to me the status clause is no longer used in this report - removing references to it Also, reset the various arrays constructed in the report. --- diff --git a/CRM/Report/Form/Contribute/Lybunt.php b/CRM/Report/Form/Contribute/Lybunt.php index ccb859aec5..ed393f0b45 100644 --- a/CRM/Report/Form/Contribute/Lybunt.php +++ b/CRM/Report/Form/Contribute/Lybunt.php @@ -71,17 +71,6 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { */ protected $groupTempTable = ''; - /** - * Status clause to be added in to both contact based & contribution based queries. - * - * The rationale seems to be that we construct a list of contacts and then show the relevant contributions for them. - * - * Presumably the clause originally was only status but now type is included too. - * - * @var string - */ - protected $_statusClause = ''; - /** * Class constructor. */ @@ -398,9 +387,6 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { else { $clause = parent::whereClause($field, $op, $value, $min, $max); } - if ($field['name'] == 'contribution_status_id' || $field['name'] == 'financial_type_id') { - $this->_statusClause .= " AND " . $clause; - } return $clause; } @@ -616,7 +602,7 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { $this->buildQuery(); // @todo this acl has no test coverage and is very hard to test manually so could be fragile. $this->getPermissionedFTQuery($this); - $this->resetFormSql(); + $this->resetFormSqlAndWhereHavingClauses(); $this->contactTempTable = 'civicrm_report_temp_lybunt_c_' . date('Ymd_') . uniqid(); $this->limit(); @@ -707,10 +693,19 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { } /** - * Reset the form sql to prevent misleading developer tab info. + * Reset the form sql and where / having clause arrays. + * + * We do an early iteration of the report queries to generate the temp table. + * + * However, that iteration populates the sql for the developer tab, + * the whereClauses & the havingClauses and they are populated again in the normal + * report flow. This is harmless but confusing - ie. the where clause winds up repeating + * the same filters and the dev tab shows the query twice, so we rest them. */ - protected function resetFormSql() { + protected function resetFormSqlAndWhereHavingClauses() { $this->sql = ''; + $this->_havingClauses = array(); + $this->_whereClauses = array(); $this->sqlArray = array(); }