return;
case 'member_auto_renew':
- $op = "!=";
- if ($value) {
+ $op = "=";
+ if ($value == 1) {
+ $query->_where[$grouping][] = " civicrm_membership.contribution_recur_id IS NULL";
+ $query->_qill[$grouping][] = ts("Membership is NOT Auto-Renew");
+ }
+ elseif ($value == 2) {
+ $query->_where[$grouping][] = " civicrm_membership.contribution_recur_id IS NOT NULL";
+ $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause(
+ "ccr.contribution_status_id",
+ $op,
+ array_search(
+ 'In Progress',
+ CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name')
+ ),
+ "Integer");
+ $query->_qill[$grouping][] = ts("Membership is Auto-Renew and In Progress");
+ }
+ elseif ($value == 3) {
+ $query->_where[$grouping][] = " civicrm_membership.contribution_recur_id IS NOT NULL";
+ $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause(
+ "ccr.contribution_status_id",
+ $op,
+ array_search(
+ 'Failed',
+ CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name')
+ ),
+ "Integer");
+ $query->_qill[$grouping][] = ts("Membership is Auto-Renew and Failed");
+ }
+ elseif ($value == 4) {
$query->_where[$grouping][] = " civicrm_membership.contribution_recur_id IS NOT NULL";
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause(
"ccr.contribution_status_id",
),
"Integer"
);
- $query->_qill[$grouping][] = ts("Membership is Auto-Renew");
- }
- else {
- $query->_where[$grouping][] = " civicrm_membership.contribution_recur_id IS NULL";
- $query->_qill[$grouping][] = ts("Membership is NOT Auto-Renew");
+ $query->_qill[$grouping][] = ts("Membership is Auto-Renew and Cancelled");
+ }
+ elseif ($value == 5) {
+ $query->_where[$grouping][] = " civicrm_membership.contribution_recur_id IS NOT NULL";
+ $query->_where[$grouping][] = " ccr.end_date IS NOT NULL";
+ $query->_qill[$grouping][] = ts("Membership is Auto-Renew and Ended");
}
$query->_tables['civicrm_membership'] = $query->_whereTables['civicrm_membership'] = 1;
return;
'membership_recur_id' => 1,
'member_campaign_id' => 1,
'member_is_override' => 1,
+ 'member_auto_renew' => '1',
);
if ($includeCustomFields) {
$form->addYesNo('member_is_primary', ts('Primary Member?'), TRUE);
$form->addYesNo('member_pay_later', ts('Pay Later?'), TRUE);
- $form->addYesNo('member_auto_renew', ts('Auto-Renew?'), TRUE);
+
+ $form->add('select', 'member_auto_renew',
+ ts('Auto-Renew Subscription Status?'),
+ array(
+ '1' => ts('- None -'),
+ '2' => ts('In Progress'),
+ '3' => ts('Failed'),
+ '4' => ts('Cancelled'),
+ '5' => ts('Ended'),
+ )
+ );
+
$form->addYesNo('member_test', ts('Membership is a Test?'), TRUE);
$form->addYesNo('member_is_override', ts('Membership Status Is Override?'), TRUE);
<li>{ts}Select neither to show all memberships{/ts}</li>
</ul>
{/htxt}
+{htxt id="id-member_auto_renew-title"}
+ {ts}Auto-Renew Subscription Status{/ts}
+{/htxt}
+{htxt id="id-member_auto_renew"}
+ <ul>
+ <li>{ts}Select "None" to display memberships that have never had an auto-renew subscription.{/ts}</li>
+ <li>{ts}Select "In Progress" to display memberships with current auto-renew subscriptions.{/ts}</li>
+ <li>{ts}Select "Failed" to display memberships with failed subscription payment.{/ts}</li>
+ <li>{ts}Select "Cancelled" to display memberships with cancelled auto-renew subscriptions.{/ts}</li>
+ <li>{ts}Select "Ended" to display memberships with an ended auto-renew subscription.{/ts}</li>
+ </ul>
+{/htxt}
+