$recurID = implode(',', $ids);
$totalCount = array();
- $query = "
+ $query = "
SELECT contribution_recur_id, count( contribution_recur_id ) as commpleted
FROM civicrm_contribution
WHERE contribution_recur_id IN ( {$recurID}) AND is_test = 0
static function getSubscriptionDetails($entityID, $entity = 'recur') {
$sql = "
-SELECT rec.id as recur_id,
- rec.processor_id as subscription_id,
+SELECT rec.id as recur_id,
+ rec.processor_id as subscription_id,
rec.frequency_interval,
rec.installments,
rec.frequency_unit,
rec.is_test,
rec.auto_renew,
rec.currency,
- con.id as contribution_id,
+ con.id as contribution_id,
con.contribution_page_id,
con.contact_id,
mp.membership_id";
if ($entity == 'recur') {
$sql .= "
- FROM civicrm_contribution_recur rec
+ FROM civicrm_contribution_recur rec
INNER JOIN civicrm_contribution con ON ( con.contribution_recur_id = rec.id )
LEFT JOIN civicrm_membership_payment mp ON ( mp.contribution_id = con.id )
WHERE rec.id = %1
elseif ($entity == 'contribution') {
$sql .= "
FROM civicrm_contribution con
-INNER JOIN civicrm_contribution_recur rec
+INNER JOIN civicrm_contribution_recur rec ON ( con.contribution_recur_id = rec.id )
LEFT JOIN civicrm_membership_payment mp ON ( mp.contribution_id = con.id )
WHERE con.id = %1";
}
elseif ($entity == 'membership') {
$sql .= "
- FROM civicrm_membership_payment mp
-INNER JOIN civicrm_membership mem ON ( mp.membership_id = mem.id )
+ FROM civicrm_membership_payment mp
+INNER JOIN civicrm_membership mem ON ( mp.membership_id = mem.id )
INNER JOIN civicrm_contribution_recur rec ON ( mem.contribution_recur_id = rec.id )
INNER JOIN civicrm_contribution con ON ( con.id = mp.contribution_id )
WHERE mp.membership_id = %1";
if ($dao->fetch()) {
return $dao;
}
- else return CRM_Core_DAO::$_nullObject;
+ else {
+ return CRM_Core_DAO::$_nullObject;
+ }
}
static function setSubscriptionContext() {