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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Export Contribution: Contribution is exported twice
Pages: [1]

Author Topic: Export Contribution: Contribution is exported twice  (Read 493 times)

kaless

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
Export Contribution: Contribution is exported twice
October 31, 2013, 07:13:45 am
Hello,

I mention the following bug:

I search contributions of a specific financial type of the current year. The page offers X contributions with sum Y. When I export these set, one contribution appears five times and so the sum differs. The same wrong sum appears in the contribution report.

I checked the tables civicrm_contribution: I can find the right only X contributions.

May I have an error in my database. The SQL-Database has been updated regularly from version 3.4 to 4.4.

Greetings

Benedikt

kaless

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
Re: Export Contribution: Contribution is exported twice
October 31, 2013, 08:06:30 am
you can try it on demo.civicrm.org

Search all contributions -> 99 results are found (23255)

export it: the file has 100 results (23480)

Hmm, not very reliable, isn't it?

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: Export Contribution: Contribution is exported twice
October 31, 2013, 08:40:55 am

many a times this has happened due to some inconsistencies in the DB data. i.e. 2 primary address / email / phone etc

might want to check and see if you can discover whats inconsistent in the duplicates. would be good to switch to temp tables so we can do a better job collecting and outputting the results

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

kaless

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
Re: Export Contribution: Contribution is exported twice
October 31, 2013, 08:50:18 am
yes, one contact had 5 identical primary phone numbers.

How do I find such duplicates?


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: Export Contribution: Contribution is exported twice
October 31, 2013, 09:13:48 am

you'll need to run sql queries against the db and fix them as you find them. From our upgrade scripts (ThreeOne/ThreeOne.php) this should do the trick (please test before using)

Code: [Select]
UPDATE civicrm_address as address
INNER JOIN ( SELECT id, contact_id FROM civicrm_address WHERE is_primary = 1 GROUP BY contact_id HAVING count( id ) > 1 ) as dup_address
         ON ( address.contact_id = dup_address.contact_id AND address.id != dup_address.id )
        SET address.is_primary = 0";

and u can repeat the process for email/phone

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

kaless

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
[Solved] Re: Export Contribution: Contribution is exported twice
October 31, 2013, 09:14:55 am
Thanks,

I found them with this query:

Code: [Select]
SELECT contact_id, count( * )
FROM `civicrm_phone`
WHERE is_primary =1
GROUP BY contact_id
HAVING count( * ) > 1.
« Last Edit: October 31, 2013, 09:40:53 am by kaless »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Export Contribution: Contribution is exported twice

This forum was archived on 2017-11-26.