CRM-19953 remove call to getUsedBy from delete.
authoreileen <emcnaughton@wikimedia.org>
Wed, 1 Feb 2017 03:49:42 +0000 (16:49 +1300)
committereileen <emcnaughton@wikimedia.org>
Wed, 1 Feb 2017 21:36:05 +0000 (10:36 +1300)
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
CRM/Price/Form/DeleteSet.php
CRM/Price/Page/Set.php

index 96c61c487823682cce77cbb63a4cd47750845cdd..be5c02d6bc4173a5283e4d364dc3d9e9d6c6a2e2 100644 (file)
@@ -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;
index 7adc42f22d5f32f959dda162bf3956d3e680f47e..a4bb5a0d8a33870fe157aa9608b1981a4a0fbc3f 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2017
- * $Id$
- *
  */
 
 /**
index 1a54f366036de6166b10794cafb9edb6e872739a..c3ec481e7b5fa770b67423f50871ded3de843e0a 100644 (file)
@@ -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();