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) »
  • CiviCRM 2.2.8 e-mail receipt display error with custom fields
Pages: [1]

Author Topic: CiviCRM 2.2.8 e-mail receipt display error with custom fields  (Read 1695 times)

greenmachine

  • I post occasionally
  • **
  • Posts: 58
  • Karma: 6
CiviCRM 2.2.8 e-mail receipt display error with custom fields
September 03, 2009, 08:34:55 am
I found and (sort of ) fixed an error with 2.2.8 and some particular conditions, here's what I found in case it is helpful elsewhere.

The error behavior was found in the e-mail receipt mailed out to the person who is signing up. This is for a contribution page which grants CiviMembership and has the "on behalf of organization" option turned on. In the custom field area of the e-mail receipt we saw:

Quote
===========================================================
Annual Membership
===========================================================
 custom_8 : Array
 custom_81 : Array
 custom_67 : Array
 custom_68 : Array
 custom_69 : Array

Etc. etc. with the custom fields.

This error behavior only seems to be triggered when:
a) The contribution page has "on behalf of organization" signup enabled
b) The contribution page has a Civi Profile enabled containing custom fields
c) Those custom fields are used for the Membership record, they are custom fields to be stored onto the membership record, not onto the Contact or Individual record (this is the setting when you create the custom field group).

In CRM/Contribute/BAO/ContributionPage.php the code attempts to retrieve custom field values from the related (individual) contact, not the organization contact. However, if Membership custom fields are in use, then I actually want the organization's contact ID used when retrieving values, because the membership record is stored with the organization in this case (not the individual).

I inserted this code at about line 160. The key is to correctly set the contact ID valid ($cid) going into the self::buildCustomDisplay() function calls.

Code: [Select]
       
            if ($params['custom_pre_id'][0][0] == 'member_id') {
              $use_cid = $contactID;
            } else {
              $use_cid = $cid;
            }

            self::buildCustomDisplay(CRM_Utils_Array::value( 'custom_pre_id', $values ),
                                     'customPre',
                                      $use_cid,
                                      $template  ,
                                      $params['custom_pre_id']);

            if ($params['custom_post_id'][0][0] == 'member_id') {
              $use_cid = $contactID;
            } else {
              $use_cid = $cid;
            }

            self::buildCustomDisplay( CRM_Utils_Array::value( 'custom_post_id',
                                                              $values ),
                                      'customPost',
                                      $user_cid,
                                      $template   ,
                                      $params['custom_post_id'] );


I haven't tested this in cases outside of our use case.

Deepak Srivastava

  • Ask me questions
  • ****
  • Posts: 677
  • Karma: 65
Re: CiviCRM 2.2.8 e-mail receipt display error with custom fields
September 06, 2009, 11:39:24 pm
FTP: We have filed an issue - http://issues.civicrm.org/jira/browse/CRM-5001
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

greenmachine

  • I post occasionally
  • **
  • Posts: 58
  • Karma: 6
Re: CiviCRM 2.2.8 e-mail receipt display error with custom fields
September 25, 2009, 11:27:15 pm
FYI there's a typo in there - "$user_cid" near the end of my snippet should be "$use_cid"

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • CiviCRM 2.2.8 e-mail receipt display error with custom fields

This forum was archived on 2017-11-26.