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) »
  • CRM_Event_BAO_Event::eventTotalSeats via API
Pages: [1]

Author Topic: CRM_Event_BAO_Event::eventTotalSeats via API  (Read 821 times)

jcm55

  • I post occasionally
  • **
  • Posts: 96
  • Karma: 14
CRM_Event_BAO_Event::eventTotalSeats via API
February 29, 2012, 09:49:52 am
I'd like to get the output of  CRM_Event_BAO_Event::eventTotalSeats() via the API.  Based on my review of the code, it looks like this isn't currently possible, but wanted to double-check.

Assuming that it's not in there, I think I will take a stab at adding this functionality.  I'm thinking civicrm_api3_participant_get() should return a "total_seats" field if "return.total_seats" is set in the params.  CRM_Event_BAO_Event::eventTotalSeats() requires an event id, so we should generate an error if return.total_seats is set and event_id is not.

One place I'm stuck is how to generate $extraWhereClause for eventTotalSeats().  Presumably this should be constructed from the other params passed to civicrm_api3_participant_get() but I'm not coming up with an elegant way to do it.

Thoughts/suggestions much appreciated.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: CRM_Event_BAO_Event::eventTotalSeats via API
February 29, 2012, 02:10:59 pm
Hi,

I think you want to be dealing with Event get not participant get

It looks like if you set 'return.is_full' on event_get it will return a boolean 'is_full' & 'available_places'.

I think it would already return 'max_participants'
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) »
  • CRM_Event_BAO_Event::eventTotalSeats via API

This forum was archived on 2017-11-26.