CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Bug: Recurring contribution email links point to the wrong contribution
Pages: [1]

Author Topic: Bug: Recurring contribution email links point to the wrong contribution  (Read 552 times)

rjlang

  • I post occasionally
  • **
  • Posts: 48
  • Karma: 1
  • CiviCRM version: 4.2.8
  • CMS version: Drupal 6
  • MySQL version: 5.0.77
  • PHP version: 5.3.19
Bug: Recurring contribution email links point to the wrong contribution
March 31, 2013, 11:53:44 am
Version: CiviCRM 4.2.8/Drupal 6

Symptom: the emailed receipts for recurring contributions contains links to update contribution amounts and billing details. When followed, those links load information for the wrong recurring subscription. In fact, they always load the information for the chronologically first subscription in the db (a hint to the cause).

Location of the problem: in CRM/Contribution/BAO/ContributionRecur.php, the function getSubscriptionDetails(), which attempts to match subscriptions against a contribution ID, is finding multiple matches, one for every subscription in the civicrm_contribution_recur table. It returns the first one, instead of the correct one.

The fix:

Lines 393--399 currently are:

Code: [Select]
    elseif ($entity == 'contribution') {
      $sql .= "
      FROM civicrm_contribution       con
INNER JOIN civicrm_contribution_recur rec
LEFT  JOIN civicrm_membership_payment mp  ON ( mp.contribution_id = con.id )
     WHERE con.id = %1";
    }

Should be (note addition to INNER JOIN):

Code: [Select]
    elseif ($entity == 'contribution') {
      $sql .= "
      FROM civicrm_contribution       con
INNER JOIN civicrm_contribution_recur rec ON ( rec.id = con.contribution_recur_id )
LEFT  JOIN civicrm_membership_payment mp  ON ( mp.contribution_id = con.id )
     WHERE con.id = %1";
    }

I have verified on our own installation that this change fixes the problem.

Seems like a pretty serious issue, since the bug effectively allows one person to alter the billing details of another user's subscription. This may also be the cause of some others' reported experiences in being unable to update recurring subscriptions.

Robert

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Bug: Recurring contribution email links point to the wrong contribution
March 31, 2013, 02:03:47 pm

can you please file an issue along with the patch (a unified diff would be great). Please do link to this forum post on the issue

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

rjlang

  • I post occasionally
  • **
  • Posts: 48
  • Karma: 1
  • CiviCRM version: 4.2.8
  • CMS version: Drupal 6
  • MySQL version: 5.0.77
  • PHP version: 5.3.19
Re: Bug: Recurring contribution email links point to the wrong contribution
March 31, 2013, 02:17:02 pm
Issue added with diff:
http://issues.civicrm.org/jira/browse/CRM-12256

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Bug: Recurring contribution email links point to the wrong contribution

This forum was archived on 2017-11-26.