From 9d8f190f4617bd91f86c59579e3ac63543a63e08 Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 1 Feb 2017 16:49:42 +1300 Subject: [PATCH] CRM-19953 remove call to getUsedBy from delete. This function is only ever called from Price_Page_Set, which does not proceed to the price set delete if there are price sets, so that call is redundant --- CRM/Price/BAO/PriceSet.php | 15 +-------------- CRM/Price/Form/DeleteSet.php | 2 -- CRM/Price/Page/Set.php | 5 +---- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index 96c61c4878..be5c02d6bc 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -226,7 +226,7 @@ WHERE cpf.price_set_id = %1"; } /** - * Delete the price set. + * Delete the price set, including the fields. * * @param int $id * Price Set id. @@ -237,19 +237,6 @@ WHERE cpf.price_set_id = %1"; * */ 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; diff --git a/CRM/Price/Form/DeleteSet.php b/CRM/Price/Form/DeleteSet.php index 7adc42f22d..a4bb5a0d8a 100644 --- a/CRM/Price/Form/DeleteSet.php +++ b/CRM/Price/Form/DeleteSet.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2017 - * $Id$ - * */ /** diff --git a/CRM/Price/Page/Set.php b/CRM/Price/Page/Set.php index 1a54f36603..c3ec481e7b 100644 --- a/CRM/Price/Page/Set.php +++ b/CRM/Price/Page/Set.php @@ -143,7 +143,6 @@ class CRM_Price_Page_Set extends CRM_Core_Page { $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(); } @@ -155,10 +154,8 @@ class CRM_Price_Page_Set extends CRM_Core_Page { 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(); -- 2.25.1