Skip to content
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

(dev/core/50) Add Separate Sub-tabs for Contributions and Recurring Contributions #11956

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CRM/Contribute/BAO/ContributionRecur.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
*/
class CRM_Contribute_BAO_ContributionRecur extends CRM_Contribute_DAO_ContributionRecur {

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MiyaNoctem can you do git config core.filemode=false to stop committing file permission changes?

(This commit looks like it would be fairly easy to merge by itself it it were in a separate pr - although maybe not the tpl part if it doesn't apply over core by itself)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File permissions have been fixed.

* Array with statuses that mark a recurring contribution as inactive.
*
* @var array
*/
private static $inactiveStatuses = array('Cancelled', 'Chargeback', 'Refunded', 'Completed');

/**
* Create recurring contribution.
*
Expand Down Expand Up @@ -938,4 +945,14 @@ public static function calculateRecurLineItems($recurId, $total_amount, $financi
return $lineSets;
}

/**
* Returns array with statuses that are considered to make a recurring
* contribution inacteve.
*
* @return array
*/
public static function getInactiveStatuses() {
return self::$inactiveStatuses;
}

}
11 changes: 2 additions & 9 deletions CRM/Contribute/Page/Tab.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page {
public $_contactId = NULL;
public $_crid = NULL;

/**
* Array with statuses that mark a recurring contribution as inactive.
*
* @var array
*/
private $inactiveStatuses = array('Cancelled', 'Chargeback', 'Refunded', 'Completed');

/**
* This method returns the links that are given for recur search row.
* currently the links added for each row are:
Expand Down Expand Up @@ -195,7 +188,7 @@ private function getActiveRecurringContributions() {
try {
$contributionRecurResult = civicrm_api3('ContributionRecur', 'get', array(
'contact_id' => $this->_contactId,
'contribution_status_id' => array('NOT IN' => $this->inactiveStatuses),
'contribution_status_id' => array('NOT IN' => CRM_Contribute_BAO_ContributionRecur::getInactiveStatuses()),
'options' => array('limit' => 0, 'sort' => 'start_date ASC'),
));
$recurContributions = CRM_Utils_Array::value('values', $contributionRecurResult);
Expand All @@ -217,7 +210,7 @@ private function getInactiveRecurringContributions() {
try {
$contributionRecurResult = civicrm_api3('ContributionRecur', 'get', array(
'contact_id' => $this->_contactId,
'contribution_status_id' => array('IN' => $this->inactiveStatuses),
'contribution_status_id' => array('IN' => CRM_Contribute_BAO_ContributionRecur::getInactiveStatuses()),
'options' => array('limit' => 0, 'sort' => 'start_date ASC'),
));
$recurContributions = CRM_Utils_Array::value('values', $contributionRecurResult);
Expand Down
4 changes: 2 additions & 2 deletions templates/CRM/Contribute/Page/Tab.tpl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@
</div>
<div id="recurring-subtab" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
{if $recur}
<div class="crm-block crm-contact-contribute-recur">
<div class="crm-block crm-contact-contribute-recur crm-contact-contribute-recur-active">
<h3>{ts}Active Recurring Contributions{/ts}</h3>
{include file="CRM/Contribute/Page/ContributionRecur.tpl" recurRows=$activeRecurRows}
</div>
<div class="crm-block crm-contact-contribute-recur">
<div class="crm-block crm-contact-contribute-recur crm-contact-contribute-recur-inactive">
<h3>{ts}Inactive Recurring Contributions{/ts}</h3>
{include file="CRM/Contribute/Page/ContributionRecur.tpl" recurRows=$inactiveRecurRows}
</div>
Expand Down