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) »
  • Issue with API change in 4.2.2
Pages: [1]

Author Topic: Issue with API change in 4.2.2  (Read 603 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
Issue with API change in 4.2.2
October 02, 2012, 03:18:05 pm
I am calling the Participant API  from JavaScript in order to change the participant status, such as from registered to cancelled.  My call is

  cj().crmAPI('Participant','update',{'version' :'3', 'participant_id' :participant_id_parm, 'status_id' :cancel_status_id}
 ,{callBack: function(result,settings){

This worked under CiviCRM 4.1.5. But when I upgraded to version 4.2.2, it returned the  error message "fee_amount is not a valid amount:"

So I changed the call to
 cj().crmAPI('Participant','update',{'version' :'3', 'participant_id' :participant_id_parm, 'status_id' :cancel_status_id, 'fee_amount' :'15' }
         ,{callBack: function(result,settings){

And it worked. BUT, why is the fee_amount now a required parameter?  I do not have any interest in updating the fee amount, and in many cases the event was not a paid event anyhow.
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Issue with API change in 4.2.2
October 03, 2012, 03:16:50 am
Hi,

Code: [Select]
cj().crmAPI('Participant','update',{'version' :'3', 'participant_id' :participant_id_parm, 'status_id' :cancel_status_id}
FYI, the version is optional on the ajax calls (and defaults to 3), and try to use id instead of participant_id, tends to makes more readable what is the primary key IMO.

Update was a read+create, it might be that the red format changed (I have had issues with the decimal separator localisation for instance).

Can you try 'create' instead of 'update' (with all the params staying identical) ?
-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: Issue with API change in 4.2.2
October 03, 2012, 03:02:43 pm
Hi Sarah - all events are saved as price sets now so you might need to look at how these are recorded when created through the front end & see what changes there are to the how the data is stored.
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) »
  • Issue with API change in 4.2.2

This forum was archived on 2017-11-26.