foreach ($componentPanes as $name => $pane) {
// FIXME: we should change the use of $name here to keyword
$paneNames[$pane['title']] = $pane['name'];
+ if ($pane['name'] == 'CiviContribute') {
+ $paneNames[ts('Recurring Contributions')] = 'recurringcontribution';
+ if (array_key_exists('CiviContribute', $this->_searchOptions)
+ && CRM_Core_Permission::access('CiviContribute')) {
+ $this->_searchOptions['recurringcontribution'] = 1;
+ }
+ }
}
$hookPanes = array();
CRM_Case_BAO_Query::buildSearchForm($form);
}
+ /**
+ * @param $form
+ */
+ public static function recurringcontribution(&$form) {
+ $form->add('hidden', 'hidden_recurringcontribution', 1);
+ // Add field to check if payment is made for recurring contribution
+ $recurringPaymentOptions = array(
+ 0 => ts(' All recurring contributions'),
+ 1 => ts(' Recurring contributions with at least one payment'),
+ );
+ $form->addRadio('contribution_recur_payment_made', ts(''), $recurringPaymentOptions, array('allowClear' => TRUE));
+ CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_start_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
+ CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_end_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
+ CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_modified_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
+ CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_next_sched_contribution_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
+ CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_failure_retry_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
+ CRM_Core_Form_Date::buildDateRange($form, 'contribution_recur_cancel_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
+ $form->addElement('text', 'contribution_recur_processor_id', ts('Processor ID'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionRecur', 'processor_id'));
+ $form->addElement('text', 'contribution_recur_trxn_id', ts('Transaction ID'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionRecur', 'trxn_id'));
+ $contributionRecur = array('ContributionRecur');
+ $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contributionRecur);
+ if ($groupDetails) {
+ $form->assign('contributeRecurGroupTree', $groupDetails);
+ foreach ($groupDetails as $group) {
+ foreach ($group['fields'] as $field) {
+ $fieldId = $field['id'];
+ $elementName = 'custom_' . $fieldId;
+ CRM_Core_BAO_CustomField::addQuickFormElement($form,
+ $elementName,
+ $fieldId,
+ FALSE, FALSE, TRUE
+ );
+ }
+ }
+ }
+ }
+
}
CRM_Utils_Hook::post('create', 'ContributionRecur', $recurring->id, $recurring);
}
+ if (!empty($params['custom']) &&
+ is_array($params['custom'])
+ ) {
+ CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_contribution_recur', $recurring->id);
+ }
+
return $result;
}
static $_contribOrSoftCredit = "only_contribs";
+ static $_contribRecurPayment = FALSE;
+
/**
* Function get the import/export fields for contribution.
*
$query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
return;
+ case 'contribution_recur_processor_id':
+ case 'contribution_recur_trxn_id':
+ $fieldName = str_replace('contribution_recur_', '', $name);
+ $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution_recur.{$fieldName}",
+ $op, $value, "String"
+ );
+ $query->_tables['civicrm_contribution_recur'] = $query->_whereTables['civicrm_contribution_recur'] = 1;
+ return;
+
+ case 'contribution_recur_payment_made':
+ $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution_recur.id", 'IS NOT EMPTY');
+ if ($value) {
+ $query->_qill[$grouping][] = ts("Recurring contributions with at least one payment");
+ self::$_contribRecurPayment = TRUE;
+ }
+ else {
+ $query->_qill[$grouping][] = ts("All recurring contributions regardless of payments");
+ self::$_contribRecurPayment = FALSE;
+ }
+ $query->_tables['civicrm_contribution_recur'] = $query->_whereTables['civicrm_contribution_recur'] = 1;
+ return;
+
case 'contribution_note':
$value = $strtolower(CRM_Core_DAO::escapeString($value));
if ($wildcard) {
case 'civicrm_contribution_recur':
if ($mode == 1) {
- // in contact mode join directly onto profile - in case no contributions exist yet
- $from = " $side JOIN civicrm_contribution_recur ON contact_a.id = civicrm_contribution_recur.contact_id ";
+ // 'Made payment for the recurring contributions?' is ticked yes
+ if (self::$_contribRecurPayment == TRUE) {
+ $from = " $side JOIN civicrm_contribution_recur ON contact_a.id = civicrm_contribution_recur.contact_id ";
+ $from .= " INNER JOIN civicrm_contribution ON civicrm_contribution.contact_id = contact_a.id ";
+ }
+ else {
+ $from = " $side JOIN civicrm_contribution_recur ON contact_a.id = civicrm_contribution_recur.contact_id ";
+ }
}
else {
$from = " $side JOIN civicrm_contribution_recur ON civicrm_contribution.contribution_recur_id = civicrm_contribution_recur.id ";
case 'Contribution':
return 'civicrm_contribution';
+ case 'ContributionRecur':
+ return 'civicrm_contribution_recur';
+
case 'Relationship':
return 'civicrm_relationship';
'Household' => 'civicrm_contact',
'Organization' => 'civicrm_contact',
'Contribution' => 'civicrm_contribution',
+ 'ContributionRecur' => 'civicrm_contribution_recur',
'Membership' => 'civicrm_membership',
'Participant' => 'civicrm_participant',
'Group' => 'civicrm_group',
return substr(implode('-', $validParts), 0, $length);
}
+ /**
+ * Checks if backoffice recurring edit is allowed
+ *
+ * @return bool
+ */
+ public function supportsEditRecurringContribution() {
+ return FALSE;
+ }
+
}
return TRUE;
}
+ /**
+ * Checks if backoffice recurring edit is allowed
+ *
+ * @return bool
+ */
+ public function supportsEditRecurringContribution() {
+ return TRUE;
+ }
+
+ /**
+ * Submit a payment using Advanced Integration Method.
+ *
+ * @param array $params
+ * Assoc array of input parameters for this transaction.
+ */
+ public function doDirectPayment(&$params) {
+ $statuses = CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id');
+ if ($params['is_pay_later']) {
+ $result['payment_status_id'] = array_search('Pending', $statuses);
+ }
+ else {
+ $result['payment_status_id'] = array_search('Completed', $statuses);
+ }
+ }
+
}
'Activity' => ts('Activities'),
'Relationship' => ts('Relationships'),
'Contribution' => ts('Contributions'),
+ 'ContributionRecur' => ts('Recurring Contributions'),
'Group' => ts('Groups'),
'Membership' => ts('Memberships'),
'Event' => ts('Events'),
{* file to handle db changes in 4.7.beta1 during upgrade *}
+-- CRM-16901 Recurring contributions summary report template
+SELECT @option_group_id_report := max(id) from civicrm_option_group where name = 'report_template';
+SELECT @contributeCompId := max(id) FROM civicrm_component where name = 'CiviContribute';
+INSERT INTO
+ `civicrm_option_value` (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
+VALUES
+ (@option_group_id_report, {localize}'{ts escape="sql"}Recurring Contributions Summary{/ts}'{/localize}, 'contribute/recursummary', 'CRM_Report_Form_Contribute_RecurSummary', NULL, 0, NULL, 49, {localize}'{ts escape="sql"}Provides simple summary for each payment instrument for which there are recurring contributions (e.g. Credit Card, Standing Order, Direct Debit etc.), showing within a given date range.{/ts}'{/localize}, 0, 0, 1, @contributeCompId, NULL);
+
SELECT @parent_id := id from `civicrm_navigation` where name = 'Administration Console' AND domain_id = {$domainID};
INSERT INTO civicrm_navigation
( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
* api result array
*/
function civicrm_api3_contribution_recur_create($params) {
+ _civicrm_api3_custom_format_params($params, $values, 'ContributionRecur');
+ $params = array_merge($params, $values);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
{include file="CRM/Campaign/Form/addCampaignToComponent.tpl" campaignContext="componentSearch"
campaignTrClass='' campaignTdClass=''}
-<tr>
- <td colspan="2">
-{include file="CRM/Contribute/Form/Search/ContributionRecur.tpl"}
-</tr>
-
{if $contributeGroupTree}
<tr>
<td colspan="2">
+--------------------------------------------------------------------+
*}
-<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}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}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}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{/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 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}Cancel Date{/ts}</td>
- <td>
- {include file="CRM/Core/DateRange.tpl" fieldName="contribution_recur_cancel_date" from='_low' to='_high'}
- </td>
- </tr>
- </table>
- </div>
- <!-- /.crm-accordion-body -->
-</div><!-- /.crm-accordion-wrapper -->
-
-
+<tr>
+ <td colspan="4">{$form.contribution_recur_payment_made.html}</td>
+</tr>
+<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}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}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{/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 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}Cancel Date{/ts}</td>
+ <td>
+ {include file="CRM/Core/DateRange.tpl" fieldName="contribution_recur_cancel_date" from='_low' to='_high'}
+ </td>
+</tr>
+<tr>
+ <td colspan="2">{$form.contribution_recur_processor_id.label}</td>
+ <td>{$form.contribution_recur_processor_id.html}</td>
+</tr>
+<tr>
+ <td colspan="2">{$form.contribution_recur_trxn_id.label}</td>
+ <td>{$form.contribution_recur_trxn_id.html}</td>
+</tr>
+{if $contributeRecurGroupTree}
+ <tr>
+ <td colspan="4">
+ {include file="CRM/Custom/Form/Search.tpl" groupTree=$contributeRecurGroupTree showHideLinks=false}
+ </td>
+ </tr>
+{/if}
(@option_group_id_report, {localize}'{ts escape="sql"}Mail Detail Report{/ts}'{/localize}, 'mailing/detail', 'CRM_Report_Form_Mailing_Detail', NULL, 0, NULL, 47, {localize}'{ts escape="sql"}Provides reporting on Intended and Successful Deliveries, Unsubscribes and Opt-outs, Replies and Forwards.{/ts}'{/localize}, 0, 0, 1, @mailCompId, NULL),
(@option_group_id_report, {localize}'{ts escape="sql"}Contribution and Membership Details{/ts}'{/localize}, 'member/contributionDetail', 'CRM_Report_Form_Member_ContributionDetail', NULL, 0, NULL, 48, {localize}'{ts escape="sql"}Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.{/ts}'{/localize}, 0, 0, 1, @memberCompId, NULL),
(@option_group_id_report, {localize}'{ts escape="sql"}Recurring Contributions Report{/ts}'{/localize}, 'contribute/recur', 'CRM_Report_Form_Contribute_Recur', NULL, 0, NULL, 49, {localize}'{ts escape="sql"}Provides information about the status of recurring contributions{/ts}'{/localize}, 0, 0, 1, @contributeCompId, NULL),
+ (@option_group_id_report, {localize}'{ts escape="sql"}Recurring Contributions Summary{/ts}'{/localize}, 'contribute/recursummary', 'CRM_Report_Form_Contribute_RecurSummary', NULL, 0, NULL, 49, {localize}'{ts escape="sql"}Provides simple summary for each payment instrument for which there are recurring contributions (e.g. Standing Order and Direct Debit), showing within a given date range.{/ts}'{/localize}, 0, 0, 1, @contributeCompId, NULL),
(@option_group_id_acs, '{ts escape="sql"}Scheduled{/ts}', 1, 'Scheduled', NULL, 0, 1, 1, NULL, 0, 1, 1, NULL, NULL),
(@option_group_id_acs, '{ts escape="sql"}Completed{/ts}', 2, 'Completed', NULL, 0, NULL, 2, NULL, 0, 1, 1, NULL, NULL),