}
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
- $datesToBuild = array(
- 'contribution_recur_start_date' => 'Recurring Contribution Start Date',
- 'contribution_recur_next_sched_contribution_date' => 'Next Scheduled Recurring Payment',
- 'contribution_recur_cancel_date' => 'Recurring Contribution Cancel Date',
- 'contribution_recur_end_date' => 'Recurring Contribution End Date',
- 'contribution_recur_create_date' => 'Recurring Contribution Create Date',
- 'contribution_recur_modified_date' => 'Recurring Contribution Modified Date',
- 'contribution_recur_failure_retry_date' => 'Recurring Contribution Failure Retry Date',
- );
- foreach ($datesToBuild as $dateField => $dateFieldTitle) {
+ foreach (self::getRecurringFields() as $dateField => $dateFieldTitle) {
if(self::buildDateWhere($values, $query, $name, $dateField, $dateFieldTitle)) {
return;
}
$form->addYesNo('contribution_pay_later', ts('Contribution is Pay Later?'));
$form->addYesNo('contribution_recurring', ts('Contribution is Recurring?'));
-// $form->addElement('contribution_recur_frequency_unit', ts('Recurring Frequency Unit?'));
-// $form->addElement('contribution_recur_frequency_interval', ts('Recurring Frequency Interval?'));
-// $form->addElement('contribution_recur_frequency_installments', ts('Number of Recurring Installments?'));
- CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_start_date', 1, '_low', '_high', ts('Recurring Start Date?'), FALSE);
- CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_next_sched_contribution_date', 1, '_low', '_high', ts('Next scheduled Recurring Contribution?'), FALSE);
- CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_failure_retry_date', 1, '_low', '_high', ts('Retry Date for Recurring Contribution?'), FALSE);
- CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_end_date', 1, '_low', '_high', ts('End Date for Recurring Contribution?'), FALSE);
- CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_cancel_date', 1, '_low', '_high', ts('Cancel Date for Recurring Contribution?'), FALSE);
- CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_modified_date', 1, '_low', '_high', ts('Modified Date for Recurring Contribution?'), FALSE);
+
+ // Recurring contribution fields
+ foreach (self::getRecurringFields() as $key => $label) {
+ CRM_Core_Form_Date::buildDateRange($form, $key, 1, '_low', '_high', $label, FALSE);
+ // If data has been entered for a recurring field, tell the tpl layer to open the pane
+ if (!empty($form->_formValues[$key . '_relative']) || !empty($form->_formValues[$key . '_low']) || !empty($form->_formValues[$key . '_high'])) {
+ $form->assign('contribution_recur_pane_open', TRUE);
+ }
+ }
$form->addYesNo('contribution_test', ts('Contribution is a Test?'));
);
return TRUE;
}
+
+ static function getRecurringFields() {
+ return array(
+ 'contribution_recur_start_date' => ts('Recurring Contribution Start Date'),
+ 'contribution_recur_next_sched_contribution_date' => ts('Next Scheduled Recurring Contribution'),
+ 'contribution_recur_cancel_date' => ts('Recurring Contribution Cancel Date'),
+ 'contribution_recur_end_date' => ts('Recurring Contribution End Date'),
+ 'contribution_recur_create_date' => ('Recurring Contribution Create Date'),
+ 'contribution_recur_modified_date' => ('Recurring Contribution Modified Date'),
+ 'contribution_recur_failure_retry_date' => ts('Failed Recurring Contribution Retry Date'),
+ );
+ }
}
+--------------------------------------------------------------------+
*}
- <div class="crm-accordion-wrapper crm-contactDetails-accordion collapsed" id="{contribution_recur}" >
+ <div class="crm-accordion-wrapper crm-contactDetails-accordion {if empty($contribution_recur_pane_open)}collapsed{/if}" id="{contribution_recur}" >
<div class="crm-accordion-header">
{ts}Recurring Contributions{/ts}
</div>
<div class="crm-accordion-body">
<table class="form-layout-compressed">
- <tr><td>{ts}Recurring Payments Start Date{/ts}</td>
+ <tr><td>{ts}Start Date{/ts}</td>
<td>
{include file="CRM/Core/DateRange.tpl" fieldName="contribution_recur_start_date" from='_low' to='_high'}
</td>
</tr>
<tr>
- <td>{ts}Recurring Contribution End Date{/ts}</td>
+ <td>{ts}End Date{/ts}</td>
<td>
{include file="CRM/Core/DateRange.tpl" fieldName="contribution_recur_end_date" from='_low' to='_high'}
</td>
</tr>
<tr>
- <td>{ts}Recurring Contribution Modified Date{/ts}</td>
+ <td>{ts}Modified Date{/ts}</td>
<td>
{include file="CRM/Core/DateRange.tpl" fieldName="contribution_recur_modified_date" from='_low' to='_high'}
</td>
</tr>
<tr>
- <td>{ts}Next Scheduled Recurring Contribution{/ts}</td>
+ <td>{ts}Next Scheduled{/ts}</td>
<td>
{include file="CRM/Core/DateRange.tpl" fieldName="contribution_recur_next_sched_contribution_date" from='_low' to='_high'}
</td>
</tr>
<tr>
- <td>{ts}Retry Failed Recurring Contribution On{/ts}</td>
+ <td>{ts}Retry Date{/ts}</td>
<td>
{include file="CRM/Core/DateRange.tpl" fieldName="contribution_recur_failure_retry_date" from='_low' to='_high'}
</td>
</tr>
<tr>
- <td>{ts}Recurring Contribution Cancel Date{/ts}</td>
+ <td>{ts}Cancel Date{/ts}</td>
<td>
{include file="CRM/Core/DateRange.tpl" fieldName="contribution_recur_cancel_date" from='_low' to='_high'}
</td>