}
/**
- * Delete the price set.
+ * Delete the price set, including the fields.
*
* @param int $id
* Price Set id.
*
*/
public static function deleteSet($id) {
- // remove from all inactive forms
- $usedBy = self::getUsedBy($id);
- if (isset($usedBy['civicrm_event'])) {
- foreach ($usedBy['civicrm_event'] as $eventId => $unused) {
- $eventDAO = new CRM_Event_DAO_Event();
- $eventDAO->id = $eventId;
- $eventDAO->find();
- while ($eventDAO->fetch()) {
- self::removeFrom('civicrm_event', $eventDAO->id);
- }
- }
- }
-
// delete price fields
$priceField = new CRM_Price_DAO_PriceField();
$priceField->price_set_id = $id;
$this->preview($sid);
}
elseif ($action & CRM_Core_Action::COPY) {
- $session = CRM_Core_Session::singleton();
CRM_Core_Session::setStatus(ts('A copy of the price set has been created'), ts('Saved'), 'success');
$this->copy();
}
if (empty($usedBy)) {
// prompt to delete
- $session = CRM_Core_Session::singleton();
- $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/price', 'action=browse'));
+ CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin/price', 'action=browse'));
$controller = new CRM_Core_Controller_Simple('CRM_Price_Form_DeleteSet', 'Delete Price Set', NULL);
- // $id = CRM_Utils_Request::retrieve('sid', 'Positive', $this, false, 0);
$controller->set('sid', $sid);
$controller->setEmbedded(TRUE);
$controller->process();