-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-21677 - Report improvements #11550
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
af98ae6
CRM-21677 - Report improvements
yashodha 9d3edef
fix warninga
yashodha 46a835e
fixes as per comments
yashodha 5a04938
CRM-21677 - fix DB error and more clean up
yashodha b1c173f
CRM-21677 - generalised function
yashodha ec4ca21
minor fix
yashodha 8514a55
CRM-21677 - keep the naming consistent
yashodha 2bd4199
style fix
yashodha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4304,33 +4304,82 @@ public function fiscalYearOffset($fieldName) { | |
|
||
/** | ||
* Add Address into From Table if required. | ||
* | ||
* Prefix will be added to both tables as | ||
* it is assumed you are using it to get address of a secondary contact. | ||
* | ||
* @param string $prefix | ||
* @param array $extra Additional options. | ||
* Not currently used in core but may be used in override extensions. | ||
*/ | ||
public function addAddressFromClause() { | ||
public function joinAddressFromContact($prefix = '', $extra = array()) { | ||
// include address field if address column is to be included | ||
if ((isset($this->_addressField) && | ||
$this->_addressField | ||
) || | ||
$this->isTableSelected('civicrm_address') | ||
) { | ||
if ((isset($this->_addressField) && $this->_addressField) || $this->isTableSelected($prefix . 'civicrm_address')) { | ||
$this->_from .= " | ||
LEFT JOIN civicrm_address {$this->_aliases[$prefix . 'civicrm_address']} | ||
ON ({$this->_aliases[$prefix . 'civicrm_contact']}.id = | ||
{$this->_aliases[$prefix . 'civicrm_address']}.contact_id) AND | ||
{$this->_aliases[$prefix . 'civicrm_address']}.is_primary = 1\n"; | ||
} | ||
} | ||
|
||
/** | ||
* Add Country into From Table if required. | ||
* | ||
* Prefix will be added to both tables as | ||
* it is assumed you are using it to get address of a secondary contact. | ||
* | ||
* @param string $prefix | ||
* @param array $extra Additional options. | ||
* Not currently used in core but may be used in override extensions. | ||
*/ | ||
public function joinCountryFromClause($prefix = '', $extra = array()) { | ||
// include country field if country column is to be included | ||
if ($this->isTableSelected($prefix . 'civicrm_country')) { | ||
$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"; | ||
LEFT JOIN civicrm_country {$this->_aliases[$prefix . 'civicrm_country']} | ||
ON {$this->_aliases[$prefix . 'civicrm_address']}.country_id = {$this->_aliases[$prefix . 'civicrm_country']}.id AND | ||
{$this->_aliases[$prefix . 'civicrm_address']}.is_primary = 1 "; | ||
} | ||
} | ||
|
||
/** | ||
* Add Phone into From Table if required. | ||
* | ||
* Prefix will be added to both tables as | ||
* it is assumed you are using it to get address of a secondary contact. | ||
* | ||
* @param string $prefix | ||
* @param array $extra Additional options. | ||
* Not currently used in core but may be used in override extensions. | ||
*/ | ||
public function addPhoneFromClause() { | ||
// include address field if address column is to be included | ||
if ($this->isTableSelected('civicrm_phone')) { | ||
public function joinPhoneFromClause($prefix = '', $extra = array()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we change to joinPhoneFromContactClause |
||
// include phone field if phone column is to be included | ||
if ($this->isTableSelected($prefix . 'civicrm_phone')) { | ||
$this->_from .= " | ||
LEFT JOIN civicrm_phone {$this->_aliases[$prefix . 'civicrm_phone']} | ||
ON {$this->_aliases[$prefix . 'civicrm_contact']}.id = {$this->_aliases[$prefix . 'civicrm_phone']}.contact_id AND | ||
{$this->_aliases[$prefix . 'civicrm_phone']}.is_primary = 1\n"; | ||
} | ||
} | ||
|
||
/** | ||
* Add Email into From Table if required. | ||
* | ||
* Prefix will be added to both tables as | ||
* it is assumed you are using it to get address of a secondary contact. | ||
* | ||
* @param string $prefix | ||
* @param array $extra Additional options. | ||
* Not currently used in core but may be used in override extensions. | ||
*/ | ||
public function joinEmailFromClause($prefix = '', $extra = array()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we change to joinEmailFromContactClause |
||
// include email field if email column is to be included | ||
if ($this->isTableSelected($prefix . 'civicrm_email')) { | ||
$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"; | ||
LEFT JOIN civicrm_email {$this->_aliases[$prefix . 'civicrm_email']} | ||
ON ({$this->_aliases[$prefix . 'civicrm_contact']}.id = {$this->_aliases[$prefix . 'civicrm_email']}.contact_id AND | ||
{$this->_aliases[$prefix . 'civicrm_email']}.is_primary = 1) "; | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to joinCountryFromAddressClause