diff --git a/CRM/Dataprocessor/Form/DataProcessor.php b/CRM/Dataprocessor/Form/DataProcessor.php index 21c931bd88a01522e04584e740a875e7ceb1f6af..0b6e2e29ea3b6c173410f0d654369cc49cc77cf0 100644 --- a/CRM/Dataprocessor/Form/DataProcessor.php +++ b/CRM/Dataprocessor/Form/DataProcessor.php @@ -191,8 +191,19 @@ class CRM_Dataprocessor_Form_DataProcessor extends CRM_Core_Form { public function postProcess() { $session = CRM_Core_Session::singleton(); if ($this->_action == CRM_Core_Action::DELETE) { + $result = civicrm_api3('DataProcessorOutput', 'get', [ + 'sequential' => 1, + 'return' => ["configuration"], + 'data_processor_id' => $this->dataProcessorId, + ]); + foreach($result['values'] as $output_navigation){ + // $output_navigation['configuration']['navigation_id'] outputs the navigation id for each of the output + civicrm_api3('Navigation', 'delete', ['id' => $output_navigation['configuration']['navigation_id']]); + } + civicrm_api3('DataProcessor', 'delete', array('id' => $this->dataProcessorId)); $session->setStatus(E::ts('Data Processor removed'), E::ts('Removed'), 'success'); + CRM_Core_BAO_Navigation::resetNavigation(); $redirectUrl = $session->popUserContext(); CRM_Utils_System::redirect($redirectUrl); } diff --git a/CRM/Dataprocessor/Form/Output.php b/CRM/Dataprocessor/Form/Output.php index b8ebbda67ebf6a8019f548e5369f516e08331b22..6d1c8266dce46bee4089d3065458577eab49d94d 100644 --- a/CRM/Dataprocessor/Form/Output.php +++ b/CRM/Dataprocessor/Form/Output.php @@ -116,12 +116,7 @@ class CRM_Dataprocessor_Form_Output extends CRM_Core_Form { 'return' => ["configuration"], 'id' => $this->id, ]); - // Civi::log()->info(print_r($result)); - // Civi::log()->error('{name}. do that.', array('name' => 'Stanley Kubrick')); - // echo "<pre>"; - // print_r($result['values'][0]['configuration']['navigation_id']); - // echo "</pre>"; - // exit; + civicrm_api3('Navigation', 'delete', ['id' => $result['values'][0]['configuration']['navigation_id']]); civicrm_api3('DataProcessorOutput', 'delete', array('id' => $this->id)); $session->setStatus(E::ts('Data Processor Output removed'), E::ts('Removed'), 'success'); diff --git a/Civi/DataProcessor/Output/UIOutputHelper.php b/Civi/DataProcessor/Output/UIOutputHelper.php index df0e6f744bfc8c50c8089ed74605df8319822a64..bd906c5f756d6d51b8c9b8b3c89564168d79a1b9 100644 --- a/Civi/DataProcessor/Output/UIOutputHelper.php +++ b/Civi/DataProcessor/Output/UIOutputHelper.php @@ -68,7 +68,6 @@ class UIOutputHelper { if ($op == 'delete') { $output = civicrm_api3('DataProcessorOutput', 'getsingle', array('id' => $id)); if (isset($output['configuration']['navigation_id'])) { - echo "here"; $navId = $output['configuration']['navigation_id']; CRM_Core_BAO_Navigation::processDelete($navId); CRM_Core_BAO_Navigation::resetNavigation();