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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Using civicrm_contribution_add quick question... CIVICRM 3.1.3
Pages: [1]

Author Topic: Using civicrm_contribution_add quick question... CIVICRM 3.1.3  (Read 1139 times)

ijames

  • Guest
Using civicrm_contribution_add quick question... CIVICRM 3.1.3
March 17, 2010, 09:13:46 am
Hi,

Ok this should be easy.

I've got a contribution ID on the hook_civicrm_post:

I'm doing the add API call from Contribution.php and I'm sending in this:

Code: [Select]
Array
(
    [id] => 726
    [custom_24] => mycustomreferralinfo
)

I'm getting this back: 

Code: [Select]
Array
(
    [is_error] => 1
    [error_message] => Required fields not found for contribution contact_id
)

Documentation http://wiki.civicrm.org/confluence/display/CRMDOC/Contribution+APIs says: 

Parameters:
  • 'params' (array) array of name-value for contribution
  • for updating contribution record pass contribution id in array like $params['id']

For retrieving the contribution, I used with civicrm_contribution_get:

Code: [Select]
Array
(
    [contribution_id] => 726
)

Which retrieved the correct contribution.

Is total value supposed to be be a required field?
It then asked for contact_id.
Then contribution_type_id...

I'm getting the feeling it thinks I'm adding a contribution instead of updating one...

Is that possible? 

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: Using civicrm_contribution_add quick question... CIVICRM 3.1.3
March 17, 2010, 09:45:12 am

yes, seems like the required params check is not differentiating between an update and a insert

would be great if you can take a look at the code: api/v2/Contribution.php and provide a patch. Ping us on IRC if you need help getting started

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

ijames

  • Guest
Re: Using civicrm_contribution_add quick question... CIVICRM 3.1.3
March 18, 2010, 01:31:59 am
Ok, I'm giving it a look.

IRC?  I'm not particularly familiar with the protocols of patching and IRCing. 

James

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Using civicrm_contribution_add quick question... CIVICRM 3.1.3

This forum was archived on 2017-11-26.