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) »
  • Pledge API does not honor contribution_type_id
Pages: [1]

Author Topic: Pledge API does not honor contribution_type_id  (Read 1606 times)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Pledge API does not honor contribution_type_id
June 12, 2011, 03:48:29 pm
I am calling the create Pledge API ( v3) as follows:

Params for pledge API: Array ( [contact_id] => 8351 [pledge_create_date] => 20011231 [start_date] => 20011231 [scheduled_date] => 20011231 [pledge_amount] => 110.25 [pledge_status_id] => 2 [contribution_type_id] => 57 [pledge_original_installment_amount] => 110.25 [frequency_interval] => 1 [frequency_unit] => month [frequency_day] => 1 [note] => Carried forward balance [installments] => 1 [version] => 3 )


the call itself:
 $created_result_pledge =& civicrm_api('Pledge','Create',$params_pledge);

Then I print out the result:

Array ( [is_error] => 0 [version] => 3 [count] => 1 [id] => 76277 [values] => Array ( [76277] => Array ( [id] => 76277 [contact_id] => 8351 [contribution_type_id] => [contribution_page_id] => [amount] => 110.25 [original_installment_amount] => 110.25 [currency] => USD [frequency_unit] => month [frequency_interval] => 1 [frequency_day] => 1 [installments] => 1 [start_date] => 20011231 [create_date] => 20011231 [acknowledge_date] => [modified_date] => [cancel_date] => [end_date] => [honor_contact_id] => [honor_type_id] => [max_reminders] => [initial_reminder_day] => [additional_reminder_day] => [status_id] => 2 [is_test] => [campaign_id] => ) ) )


For some reason the "contribution_type_id" is not honored. If I look at the records in the table "civicrm_pledge" the column for contribution type is null.
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Pledge API does not honor contribution_type_id
June 12, 2011, 04:19:03 pm
I think it might take 'pledge_contribution_type_id' ?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Pledge API does not honor contribution_type_id
June 12, 2011, 09:01:52 pm
I got it working by changing the parm name to "pledge_contribution_type_id".

But, what is the purpose of the other parm ( which I had been using without issue with v2 of the API) ?
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Pledge API does not honor contribution_type_id
June 12, 2011, 09:22:46 pm
I recall there being some conflict with contribution_type_id applying to contributions - can't rmember the detail
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Pledge API does not honor contribution_type_id
June 12, 2011, 11:58:28 pm
Eileen you are right usually we prefix like "pledge_contribution_type_id" to avoid conflicts between fields that have same name and are in different tables.

Kurund
Found this reply helpful? Support CiviCRM

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Pledge API does not honor contribution_type_id
June 13, 2011, 02:49:57 am
So I understrand, ahat is/are the other contribution_type_id that could be valid in this context beside the pledge one ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Pledge API does not honor contribution_type_id
June 13, 2011, 03:07:49 am
Not sure about the create but pretty sure on the GET it uses the BAO Query.php which also touches contribution_type_id.

Pledge is a real minefield from the point of view of unique fields & somewhat random field behaviour. The fields you get back on GET are plucked out of thin air.

Not sure why I started with the hardest api.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Pledge API does not honor contribution_type_id

This forum was archived on 2017-11-26.