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) »
  • Discussion (deprecated) »
  • Professional CiviCRM Services (Moderator: Dave Greenberg) »
  • Re: Exporting In Honor and In Memory of Data from CiviContribute
Pages: [1]

Author Topic: Re: Exporting In Honor and In Memory of Data from CiviContribute  (Read 3963 times)

angara

  • Guest
Re: Exporting In Honor and In Memory of Data from CiviContribute
September 15, 2009, 08:45:54 am
Is there anyone out there that would be willing to help us with our CiviCRM and Drupal problems and updates. The current issue at hand, which was responded to by the CiviCRM group is:
Whenever I download the information collected from CiviContribute it doesn't show the In Honor of or In Memory of Information we set up the form to include. This information can be found if you click through to the detail screen, but that's a very time consuming. We just want to be able to have it in the spreadsheet. What step am I missing? I've also tried going through Contact to Contribute but there is even less information available there. Thanks for your help with this.

 
 
Donald Lobo

Administrator
I’m (like) Lobo ;)


Karma: 247
[applaud] [smite]
Online

CiviCRM: 2.2
CMS: Drupal 6.x, Joomla 1.5.x
MySQL: MySQL 5.0.67
PHP: PHP 5.2.6


--------------------------------------------------------------------------------


Posts: 6349






 
 Re: Exporting In Honor and In Memory of Data from CiviContribute

« Reply #1 on: September 14, 2009, 11:59:28 am »
 Quote
 


--------------------------------------------------------------------------------

You will need to write a custom search (http://wiki.civicrm.org/confluence/display/CRMDOC/Custom+Search+Components, php/mysql coding skills needed) to export honor and in memory of information

if you do so, please publish your custom search so other folks can benefit.

Another better option might be to write a custom report for this and expose this information via that. This would be super cool

thanx

lobo
 
 
 
 

 

 

 

 


jday

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 6
  • CiviCRM version: 4.2
  • CMS version: 7.15
Re: Exporting In Honor and In Memory of Data from CiviContribute
October 04, 2009, 11:12:16 pm
I would love to be able to write a report for this task, I don't think I could write the correct join statements...it looks like a new contact record is created for the honoree and the contact id is stored in the contributions table.

In my case the donors are spelling the honoree's name a little differently each time so I have 5 different contact records. What happens if I merge those records into one contact? will the honoree id in the contributions table get updated or will I orphan those contact ids?

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Exporting In Honor and In Memory of Data from CiviContribute
October 05, 2009, 12:12:22 pm
RE: custom search or report to allow export of this data.... would be great for your or someone to do this. The join is fairly straightforward...

Simple example might be something like this (of course you may need/want more columns):
Code: [Select]
SELECT d.sort_name as 'Donor Name', c.id, c.total_amount, c.receive_date, h.sort_name as 'Honoree Name'
FROM civicrm_contribution c
LEFT JOIN civicrm_contact d ON c.contact_id = d.id
LEFT JOIN civicrm_contact h ON c.honor_contact_id = h.id

Regarding merge - I did a quick test on 3.0 and the in honor of contribution linkages were moved from the "duplicate" into the merged contact as expected. I would test in your environment with some test data first if you're not on 3.0.
Protect your investment in CiviCRM by  becoming a Member!

jday

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 6
  • CiviCRM version: 4.2
  • CMS version: 7.15
Re: Exporting In Honor and In Memory of Data from CiviContribute
October 07, 2009, 10:40:05 pm
mmm, I think I was close, but I got this error:

DB Error: no such field
Database Error Code: Unknown column 'c.contact_id' in 'on clause', 1054

Code: [Select]
Error Details:

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -19
    [message] => DB Error: no such field
    [mode] => 16
    [debug_info] =>
SELECT
c.contact_id as contact_id,
d.display_name as donor_name,
h.display_name as honoree_name,
c.honor_contact_id as honoree_id,
c.receive_date as receive_date,
sum(c.total_amount) as amount

FROM   
      civicrm_contribution c,
      civicrm_contact
      LEFT JOIN civicrm_contact d ON d.id = c.contact_id
      LEFT JOIN civicrm_contact h ON h.id = c.honor_contact_id

WHERE  civicrm_contact.contact_type = 'Individual' AND c.honor_contact_id IS NOT NULL
GROUP BY c.honor_contact_id
 [nativecode=1054 ** Unknown column 'c.contact_id' in 'on clause']
    [type] => DB_Error
    [user_info] =>
SELECT
c.contact_id as contact_id,
d.display_name as donor_name,
h.display_name as honoree_name,
c.honor_contact_id as honoree_id,
c.receive_date as receive_date,
sum(c.total_amount) as amount

FROM   
      civicrm_contribution c,
      civicrm_contact
      LEFT JOIN civicrm_contact d ON d.id = c.contact_id
      LEFT JOIN civicrm_contact h ON h.id = c.honor_contact_id

WHERE  civicrm_contact.contact_type = 'Individual' AND c.honor_contact_id IS NOT NULL
GROUP BY c.honor_contact_id
 [nativecode=1054 ** Unknown column 'c.contact_id' in 'on clause']
    [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="
SELECT
c.contact_id as contact_id,
d.display_name as donor_name,
h.display_name as honoree_name,
c.honor_contact_id as honoree_id,
c.receive_date as receive_date,
sum(c.total_amount) as amount

FROM   
      civicrm_contribution c,
      civicrm_contact
      LEFT JOIN civicrm_contact d ON d.id = c.contact_id
      LEFT JOIN civicrm_contact h ON h.id = c.honor_contact_id

WHERE  civicrm_contact.contact_type = 'Individual' AND c.honor_contact_id IS NOT NULL
GROUP BY c.honor_contact_id
 [nativecode=1054 ** Unknown column 'c.contact_id' in 'on clause']"]
)
[/code]

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Exporting In Honor and In Memory of Data from CiviContribute
October 08, 2009, 01:13:05 am
hi jday,

your error free query might be look like :

Code: [Select]
SELECT
c.contact_id as contact_id,
d.display_name as donor_name,
h.display_name as honoree_name,
c.honor_contact_id as honoree_id,
c.receive_date as receive_date,
sum(c.total_amount) as amount
FROM   
      civicrm_contribution c
      INNER JOIN civicrm_contact d ON d.id = c.contact_id
      INNER JOIN civicrm_contact h ON h.id = c.honor_contact_id
WHERE  d.contact_type = 'Individual'
AND h.contact_type = 'Individual'
AND c.honor_contact_id IS NOT NULL
GROUP BY c.honor_contact_id

kiran
You Are Designed To Choose... Defined By Choice.

jday

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 6
  • CiviCRM version: 4.2
  • CMS version: 7.15
Re: Exporting In Honor and In Memory of Data from CiviContribute
October 08, 2009, 11:49:15 am
wow that worked perfectly, thanks kiran!

I'll attach the file for anyone who would like to see it.

hwdornbush

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 0
Re: Exporting In Honor and In Memory of Data from CiviContribute
May 09, 2010, 03:49:59 pm
I tried to replicate this search on my site.  I am using CiviCRM 3.1.3.

I copied the attached file to my site into CRM/Contact/Form/Search/Custom/

I registered the custom search component.  I added the custom search to the navigation menu.

When I run the search, I get:

    Sorry. A non-recoverable error has occurred.

    QuickForm Error: the rule does not exist as a registered rule

    Return to home page.

Error Details:
Code: [Select]
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -2
    [message] => QuickForm Error: the rule does not exist as a registered rule
    [mode] => 16
    [debug_info] => Rule 'qfDate' is not registered in HTML_QuickForm::addRule()
    [type] => HTML_QuickForm_Error
    [user_info] => Rule 'qfDate' is not registered in HTML_QuickForm::addRule()
    [to_string] => [html_quickform_error: message="the rule does not exist as a registered rule" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="QuickForm Error: " info="Rule 'qfDate' is not registered in HTML_QuickForm::addRule()"]
)
Can you suggest how to fix this?
[/code]
« Last Edit: May 09, 2010, 03:53:54 pm by hwdornbush »

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: Exporting In Honor and In Memory of Data from CiviContribute
May 09, 2010, 04:51:27 pm

the date format changed between 3.0 and 3.1 (i.e we moved to a jQuery widget from QF date)

u'll need to upgrade the code to use the new date code (check CRM/Contribute/Form/Contribution.php, search for addDate) for some examples to follow

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

hwdornbush

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 0
Re: Exporting In Honor and In Memory of Data from CiviContribute
May 09, 2010, 07:20:04 pm
I changed the date search form fields to:

Code: [Select]
        $form->addDate('start_date',
                    ts('Contribution Date From'),
                    false, array('formatType' => 'custom' ) );

        $form->addDate('end_date',
                    ts('...through'),
                    false, array('formatType' => 'custom' ) );

and it seemed to work great.  I have one remaining small problem: when I run the search, I have a small section at the top of the results which says:

n Results
Select Records: o All n records  o Selected records only

with a box right below this which is grayed out: more actions - followed by - Go

The problem is that if I select "All n records," the "more actions" box and the Go button are still grayed out.  See attachment for an example.  I have to select the "selected records only" in order to get the "more actions" box to be active, and then I can select "all n records" and the "more actions" box is still active.  What is needed to get the "more actions" box to be active if I just select "all n records?"


Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Exporting In Honor and In Memory of Data from CiviContribute
May 09, 2010, 10:53:35 pm
Quote
The problem is that if I select "All n records," the "more actions" box and the Go button are still grayed out.  See attachment for an example.  I have to select the "selected records only" in order to get the "more actions" box to be active, and then I can select "all n records" and the "more actions" box is still active.  What is needed to get the "more actions" box to be active if I just select "all n records?"

I suspect your custom search displaying multiple rows/record for same contact id.

kiran
You Are Designed To Choose... Defined By Choice.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Professional CiviCRM Services (Moderator: Dave Greenberg) »
  • Re: Exporting In Honor and In Memory of Data from CiviContribute

This forum was archived on 2017-11-26.