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) »
  • Event api delete when participants exist
Pages: [1]

Author Topic: Event api delete when participants exist  (Read 925 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Event api delete when participants exist
July 03, 2011, 01:58:28 pm
Hi all,
Does it make sense for the event api to delete an event if participants exists (this will delete the participants) or should it give a warning & only delete if something link

'option.deleteParticipants' is set.

If the later then this should be set to 0 as the default in the api layer & handled in the BAO layer (much like the deleteactivityassignee is in activity). Form layer apparently handles it so we'd make form layer set it to true.

http://issues.civicrm.org/jira/browse/CRM-8406?page=com.atlassian.jira.ext.fisheye%3Afisheye-issuepanel
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

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Event api delete when participants exist
July 04, 2011, 12:07:49 am
I would expect the default behaviour to be that the event is only deleted if there are no participants left (so the latter) but I can imagine it would be useful to have a param to delete the event AND all related participants?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Event api delete when participants exist
July 04, 2011, 12:13:56 am
Probably because I'm not too keen on introducing more magic params, but can't we achieve the same with some chaining ?

Code: [Select]
api.participant.delete ({event_id:42,
api.event.delete});
?

Yeap, deleting all the participants is a bit brutal as the default behaviour.

X+

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

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Event api delete when participants exist
July 04, 2011, 12:18:01 am
Agree, chaining would be best......magic params only when no other option available.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Event api delete when participants exist
July 04, 2011, 01:31:36 am
well it turns out the BAO default is to delete away so we are battling with that - unless we want to do the check in the API & give an error there - which is also a crap option & not in-line with what we are trying to do with the 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

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Event api delete when participants exist
July 04, 2011, 01:40:17 am
so really we should raise an issue and change the BAO?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Event api delete when participants exist
July 04, 2011, 01:42:50 am
tried that - see issue above
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

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Event api delete when participants exist
July 04, 2011, 01:52:03 am
Let me get this right: it was not fixed or the fix did not work?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Event api delete when participants exist
July 04, 2011, 01:53:39 am
It was fixed in that there was another error with event delete that was fixed.

However, test was fixed to say that the correct outcome is success when participants exist - i.e. blow em away without a second thought
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

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Event api delete when participants exist
July 04, 2011, 01:57:03 am
Hmmm so really we need a new issue :-)
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Event api delete when participants exist

This forum was archived on 2017-11-26.