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) »
  • undefined index 'onbehalf' error in Confirm.php when making a contribution
Pages: [1]

Author Topic: undefined index 'onbehalf' error in Confirm.php when making a contribution  (Read 724 times)

thomasat12meter

  • I’m new here
  • *
  • Posts: 21
  • Karma: 1
undefined index 'onbehalf' error in Confirm.php when making a contribution
October 10, 2011, 09:26:50 am
Hi,
Wanted to share this with everyone. We experienced this error message after conpleting an online contribution.
Error message: undefined index 'onbehalf' in .../civicrm/CRM/Contribute/Form/Contribution/Confirm.php, line 740
This was for a contribution page that did not have "Allow Individuals to make contributions on behalf of an Organization" box checked.

This was with Drupal 7.8 and Civicrm 4.0.4 (sorry did not have time to check this against 4.0.6).

To solve this issue we changed the following code (starting on line 740) from:
           if ( is_array( $paymentParams['onbehalf'] ) && !empty( $paymentParams['onbehalf'] ) ) {
                foreach ( $paymentParams['onbehalf'] as $key => $value ) {
                    if ( strstr( $key, 'custom_' ) ) {
                        $this->_params[$key] = $value;
                    }
                }
                $fieldTypes = array( 'Contact', 'Organization', 'Contribution' );
            }

to:
            if ( isset( $paymentParams['onbehalf'] ) ) {
            if ( is_array( $paymentParams['onbehalf'] ) && !empty( $paymentParams['onbehalf'] ) ) {
                foreach ( $paymentParams['onbehalf'] as $key => $value ) {
                    if ( strstr( $key, 'custom_' ) ) {
                        $this->_params[$key] = $value;
                    }
                }
                $fieldTypes = array( 'Contact', 'Organization', 'Contribution' );
            }
            }

Can someone check this against the latest code base and make sure this is covered and potentially create a patch for earier versions if necessary? I have not done a patch before so I am hoping someone more experienced can jump in.
I am also somewhat puzzled that I might be the first one to find/experience this so I wanted to share.

Regards, Thomas

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: undefined index 'onbehalf' error in Confirm.php when making a contribution
October 10, 2011, 03:37:28 pm

this has been fixed in recent versions of 4.0

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

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: undefined index 'onbehalf' error in Confirm.php when making a contribution
October 10, 2011, 08:37:42 pm
I thought we were only hitting problems on the above for Contribs that were allowing 'on behalf of' but maybe you picked up and fixed this as part of the same deal?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

thomasat12meter

  • I’m new here
  • *
  • Posts: 21
  • Karma: 1
Re: undefined index 'onbehalf' error in Confirm.php when making a contribution
October 11, 2011, 06:46:02 am
@lobo: thanks for pointing this out. Will update soon to catch the official fix

@petednz: we definitely saw this on a contribution page where "on behalf of" functionality was not enabled.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • undefined index 'onbehalf' error in Confirm.php when making a contribution

This forum was archived on 2017-11-26.