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) »
  • Duplicate amounts for some contributions
Pages: [1]

Author Topic: Duplicate amounts for some contributions  (Read 3847 times)

mtndan

  • Guest
Duplicate amounts for some contributions
July 10, 2007, 04:38:13 pm
Hi, I'm having a strange problem. I have contacts where, for example, there are 2 contributions on record, for $1000 each, for a total of $2000.

However, in "summary", CiviCRM says they have contributed 4 times, for a total of $4000. Any idea why this would occur? Attached is a screenshot.
« Last Edit: July 10, 2007, 04:43:17 pm by mtndan »

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Duplicate amounts for some contributions
July 11, 2007, 12:14:33 am
hey,

Can you give more details,  CiviCRM version ?

Can you try to replicate it on: http://sandbox.civicrm.org/drupal

- kurund
Found this reply helpful? Support CiviCRM

mtndan

  • Guest
Re: Duplicate amounts for some contributions
July 11, 2007, 05:52:24 am
Hi, I'm now running CiviCRM 1.7.9821 on Drupal 5.1, with php5 and mysql5.

I tried it on the sandbox and of course, I can't duplicate.

What's very strange is I actually looked in the Civi database tables and only see 2 contributions for this contact in the contribution table. However, on the "contributions" tab it is showing 4.

I'm completely confused. Thanks in advance.

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: Duplicate amounts for some contributions
July 11, 2007, 07:03:05 am

hey dan:

1. I suspect the 2 contributions are repeated twice, and if u do a view contribution, u'll see that the 4 contribs are actually just the 2 in the database

2. Can u check your notes tables (civicrm_note) and see if there are two notes for each contribution

3. u can manually delete the notes to make the duplicates vanish. If this is the issue, we'd like to figure out why you got multiple notes in the db? did u import the contribs? The code is structured to allow only one note per contrib (for the query)

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

mtndan

  • Guest
Re: Duplicate amounts for some contributions
July 13, 2007, 02:27:55 pm
Hi, yes, here is some more info:

We did not import the contribs - they have been entered manually.

I did not see duplicate notes.

I’ve noticed that it doubles the amount if I don’t fill in everything correctly the first time such as forgetting a required field. The programs prompts me that I have forgotten the field and then resets every field, doubles the amounts and number entries, but then only displays the single contribution.

Thanks

mtndan

  • Guest
Re: Duplicate amounts for some contributions
July 17, 2007, 09:01:56 am
Hi, any ideas on this? It's driving us crazy? Where else would we look for the duplicate contribution entries? How is that total being calculated?

Thank you

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: Duplicate amounts for some contributions
July 17, 2007, 10:36:57 am

Here's how I would go about debugging this:

1. Enable mysql query logging (add: log             = /var/log/mysql.log to your my.cnf)

2. goto the above totals page and reproduce the issue

3. See the queries generated see what part of the query triggers the multiple count

(i get this query:)

SELECT sum( total_amount ) as total_amount, count( id ) as total_count
FROM   civicrm_contribution
WHERE  domain_id = 1 AND contribution_status_id = 3 AND receive_date >= '20070101000000' AND receive_date <= '20080101000000'
 AND is_test=0

kinda hard to debug if we cannot reproduce :(. I suspect the above should help you/us. Also I could not reproduce: http://issues.civicrm.org/jira/browse/CRM-2104 which i assume is on the same issue?

lobo


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

mtndan

  • Guest
Re: Duplicate amounts for some contributions
July 20, 2007, 12:29:39 pm
Thank you, we'll give it a try.

Yes, same issue. sorry!

mtndan

  • Guest
Re: Duplicate amounts for some contributions
July 20, 2007, 12:48:24 pm
OK, I've attached a file with output from the query log. Unfortunately I don't understand where specifically I am looking... I hope it helps.

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: Duplicate amounts for some contributions
July 20, 2007, 01:24:58 pm

What does this query give you when run directly in your mysql db:

SELECT COUNT( civicrm_contribution.total_amount ) as total_count,
       SUM(   civicrm_contribution.total_amount ) as total_amount,
       AVG(   civicrm_contribution.total_amount ) as total_avg  FROM civicrm_contact contact_a LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contact' AND
                                                        contact_a.id = civicrm_note.entity_id )  LEFT JOIN civicrm_contribution ON civicrm_contribution.contact_id = contact_a.id  INNER JOIN civicrm_contribution_type ON civicrm_contribution.contribution_type_id = civicrm_contribution_type.id  WHERE  ( contact_a.id = 156 AND  civicrm_contribution.is_test = '0' )  AND civicrm_contribution.cancel_date IS NULL


I suspect it gives u 2x the number of contributions u have, if so, what does this query give u:

SELECT * FROM civicrm_note WHERE entity_table = 'civicrm_contact' AND entity_id = 156;

I suspect it will give u 2 notes

Can u check and let us know

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

mtndan

  • Guest
Re: Duplicate amounts for some contributions
July 20, 2007, 02:01:46 pm
see attached

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: Duplicate amounts for some contributions
July 20, 2007, 07:17:15 pm
So looks like CiviCRM has a bug if a contact has multiple notes attached to it.

Have filed a bug report here: http://issues.civicrm.org/jira/browse/CRM-2114

We'll get fixed for the next 1.8 release

lobo
« Last Edit: July 20, 2007, 07:43:30 pm by Donald 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

mtndan

  • Guest
Re: Duplicate amounts for some contributions
July 20, 2007, 07:18:26 pm
Woohoo! Thanks for helping me with this :)

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: Duplicate amounts for some contributions
July 20, 2007, 08:35:16 pm

This is now fixed in 1.8. You can backport it to 1.7 via this patch:

http://fisheye.civicrm.org/browse/CiviCRM/branches/v1.8/CRM/Contribute/BAO/Query.php?r1=10014&r2=10482

The deletion of line 127 is the fix that causes this bug

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

mtndan

  • Guest
Re: Duplicate amounts for some contributions
July 21, 2007, 07:32:07 am
Again, thank you very much!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Duplicate amounts for some contributions

This forum was archived on 2017-11-26.