* Set the FROM clause for the report.
*/
public function from() {
- $this->_from = "
- FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}
- INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
- ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id AND {$this->_aliases['civicrm_contribution']}.is_test = 0";
+ $this->setFromBase('civicrm_contact');
+ $this->_from .= "
+ INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
+ ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id
+ AND {$this->_aliases['civicrm_contribution']}.is_test = 0";
if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
'both'
*/
public function softCreditFrom() {
- $this->_from = "
- FROM civireport_contribution_detail_temp1 temp1_civireport
- INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
- ON temp1_civireport.civicrm_contribution_contribution_id = {$this->_aliases['civicrm_contribution']}.id
- INNER JOIN civicrm_contribution_soft contribution_soft_civireport
- ON contribution_soft_civireport.contribution_id = {$this->_aliases['civicrm_contribution']}.id
- INNER JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
- ON {$this->_aliases['civicrm_contact']}.id = contribution_soft_civireport.contact_id
- {$this->_aclFrom}";
+ $this->_from = "
+ FROM civireport_contribution_detail_temp1 temp1_civireport
+ INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
+ ON temp1_civireport.civicrm_contribution_contribution_id = {$this->_aliases['civicrm_contribution']}.id
+ INNER JOIN civicrm_contribution_soft contribution_soft_civireport
+ ON contribution_soft_civireport.contribution_id = {$this->_aliases['civicrm_contribution']}.id
+ INNER JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
+ ON {$this->_aliases['civicrm_contact']}.id = contribution_soft_civireport.contact_id
+ {$this->_aclFrom}
+ ";
$this->appendAdditionalFromJoins();
}
* @return mixed|string
*/
public function fromContribution($replaceAliasWith = 'contribution1') {
- $from = " FROM civicrm_contribution {$replaceAliasWith} ";
+ $this->setFromBase('civicrm_contribution', 'contact_id', $replaceAliasWith);
+
$temp = $this->_aliases['civicrm_contribution'];
$this->_aliases['civicrm_contribution'] = $replaceAliasWith;
- $this->_from = $from;
+ $from = $this->_from;
$from .= (string) $this->getPermissionedFTQuery($this, 'civicrm_line_item_report', TRUE);
$this->_aliases['civicrm_contribution'] = $temp;
$this->_where = '';