";
}
- $this->addPhoneFromClause();
- $this->addAddressFromClause();
- // include email field if email column is to be included
- if ($this->_emailField) {
- $this->_from .= "
- LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']}
- ON ({$this->_aliases['civicrm_contact']}.id =
- {$this->_aliases['civicrm_email']}.contact_id) AND
- {$this->_aliases['civicrm_email']}.is_primary = 1\n";
- }
+ $this->joinPhoneFromContact();
+ $this->joinAddressFromContact();
+ $this->joinEmailFromContact();
}
/**
if (!empty($field['required']) ||
!empty($this->_params['fields'][$fieldName])
) {
- // to include optional columns address and email, only if checked
- if ($tableName == 'civicrm_address') {
- $this->_addressField = TRUE;
- $this->_emailField = TRUE;
- }
- elseif ($tableName == 'civicrm_email') {
- $this->_emailField = TRUE;
- }
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
$this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
ON ({$this->_aliases['civicrm_pledge']}.id =
{$this->_aliases['civicrm_pledge_payment']}.pledge_id AND {$this->_aliases['civicrm_pledge_payment']}.status_id = {$pendingStatus} ) ";
- // include address field if address column is to be included
- if ($this->_addressField) {
- $this->_from .= "
- LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']}
- ON ({$this->_aliases['civicrm_contact']}.id =
- {$this->_aliases['civicrm_address']}.contact_id) AND
- {$this->_aliases['civicrm_address']}.is_primary = 1\n";
- }
+ $this->joinAddressFromContact();
+ $this->joinEmailFromContact();
- // include email field if email column is to be included
- if ($this->_emailField) {
- $this->_from .= "
- LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']}
- ON ({$this->_aliases['civicrm_contact']}.id =
- {$this->_aliases['civicrm_email']}.contact_id) AND
- {$this->_aliases['civicrm_email']}.is_primary = 1\n";
- }
}
public function groupBy() {
protected $_totalPaid = FALSE;
protected $_customGroupExtends = array('Pledge', 'Individual');
protected $_customGroupGroupBy = TRUE;
- protected $_addressField = FALSE;
- protected $_emailField = FALSE;
/**
* This report has not been optimised for group filtering.
{$this->_aliases['civicrm_pledge']}.contact_id )
{$this->_aclFrom} ";
- // include address field if address column is to be included
- if ($this->_addressField) {
- $this->_from .= "
- LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']}
- ON ({$this->_aliases['civicrm_contact']}.id =
- {$this->_aliases['civicrm_address']}.contact_id) AND
- {$this->_aliases['civicrm_address']}.is_primary = 1\n";
- }
-
- // include email field if email column is to be included
- if ($this->_emailField) {
- $this->_from .= "
- LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']}
- ON ({$this->_aliases['civicrm_contact']}.id =
- {$this->_aliases['civicrm_email']}.contact_id) AND
- {$this->_aliases['civicrm_email']}.is_primary = 1\n";
- }
+ $this->joinAddressFromContact();
+ $this->joinEmailFromContact();
if (!empty($this->_params['fields']['total_paid'])) {
$this->_from .= "
* @copyright CiviCRM LLC (c) 2004-2018
*/
class CRM_Report_Form_Walklist_Walklist extends CRM_Report_Form {
- protected $_addressField = FALSE;
-
- protected $_emailField = FALSE;
-
- protected $_phoneField = FALSE;
protected $_summary = NULL;
}
public function select() {
+ // @todo remove this function & use parent.
$select = array();
$this->_columnHeaders = array();
if (!empty($field['required']) ||
!empty($this->_params['fields'][$fieldName])
) {
- if ($tableName == 'civicrm_address') {
- $this->_addressField = TRUE;
- }
- elseif ($tableName == 'civicrm_email') {
- $this->_emailField = TRUE;
- }
- elseif ($tableName == 'civicrm_phone') {
- $this->_phoneField = TRUE;
- }
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}
";
- if ($this->_addressField) {
- $this->_from .= "LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']} ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_address']}.contact_id AND {$this->_aliases['civicrm_address']}.is_primary = 1\n";
- }
-
- if ($this->_emailField) {
- $this->_from .= "LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']} ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND {$this->_aliases['civicrm_email']}.is_primary = 1\n";
- }
- if ($this->_phoneField) {
- $this->_from .= "LEFT JOIN civicrm_phone {$this->_aliases['civicrm_phone']} ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND {$this->_aliases['civicrm_phone']}.is_primary = 1\n";
- }
+ $this->joinAddressFromContact();
+ $this->joinPhoneFromContact();
+ $this->joinEmailFromContact();
}
public function where() {