Пример #1
0
function mark_delete_components($sub_object_array, $run_second_level = false, $sub_sub_array = "")
{
    if (!empty($sub_object_array)) {
        foreach ($sub_object_array as $sub_object) {
            //run_second level is set to true if you need to remove sub-sub components
            if ($run_second_level == true) {
                mark_delete_components($sub_object->get_linked_beans($sub_sub_array['rel_field'], $sub_sub_array['rel_module']));
                //end if run_second_level is true
            }
            $sub_object->mark_deleted($sub_object->id);
            //end foreach sub component
        }
        //end if this is not empty
    }
    //end function mark_delete_components
}
Пример #2
0
 /**
  * Deletes the Trigger.
  * If it's the primary Trigger, deletes all the Triggers
  * and Schedules for the parent WorkFlow
  *
  * @param $id - $id of the Trigger to be deleted. If empty use $this->id
  */
 public function mark_deleted($id = null)
 {
     if (!empty($id)) {
         $this->id = $id;
     }
     //mark delete trigger components
     mark_delete_components($this->get_linked_beans('future_triggers', 'Expression'));
     mark_delete_components($this->get_linked_beans('past_triggers', 'Expression'));
     mark_delete_components($this->get_linked_beans('expressions', 'Expression'));
     parent::mark_deleted($this->id);
     $workflow_object = $this->get_workflow_type();
     if ($this->frame_type == "Primary") {
         // Deleting a primary means we delete all triggers, and related schedules
         $workflow_object->deleteTriggers();
         $workflow_object->deleteTriggerFilters();
         $workflow_object->deleteSchedules();
     }
     //reload $workflow_object to make the trigger changes take effect.
     $workflow_object = $this->get_workflow_type();
     $workflow_object->write_workflow();
 }
Пример #3
0
 /**
  * Deletes all actions for the workflow
  *
  * @return void
  */
 public function deleteActions()
 {
     $action_shell_list = $this->get_linked_beans('actions', 'WorkFlowActionShell');
     foreach ($action_shell_list as $action_shell_object) {
         //check for bridged child (invites for meetings/calls
         $action_shell_object->check_for_child_bridge(true);
         //mark delete actionshell sub components and actionshell
         mark_delete_components($action_shell_object->get_linked_beans('actions', 'WorkFlowAction'));
         mark_delete_components($action_shell_object->get_linked_beans('rel1_action_fil', 'Expression'));
         $action_shell_object->mark_deleted($action_shell_object->id);
     }
 }
Пример #4
0
if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
/*
 * Your installation or use of this SugarCRM file is subject to the applicable
 * terms available at
 * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
 * If you do not agree to all of the applicable terms or do not have the
 * authority to bind the entity as an authorized representative, then do not
 * install or use this SugarCRM file.
 *
 * Copyright (C) SugarCRM Inc. All rights reserved.
 */
/*********************************************************************************
 * Description:  
 ********************************************************************************/
global $mod_strings;
$focus = BeanFactory::getBean('WorkFlowAlerts');
if (!isset($_REQUEST['record'])) {
    sugar_die($mod_strings['ERR_DELETE_RECORD']);
}
$focus->retrieve($_REQUEST['record']);
//mark delete alert expression components
mark_delete_components($focus->get_linked_beans('expressions', 'Expression'));
mark_delete_components($focus->get_linked_beans('rel1_alert_fil', 'Expression'));
mark_delete_components($focus->get_linked_beans('rel2_alert_fil', 'Expression'));
$focus->mark_deleted($_REQUEST['record']);
$workflow_object = $focus->get_workflow_object();
$workflow_object->write_workflow();
header("Location: index.php?module=" . $_REQUEST['return_module'] . "&action=" . $_REQUEST['return_action'] . "&record=" . $_REQUEST['return_id'] . "&workflow_id=" . $_REQUEST['workflow_id']);
 /**
  * Delete all the Alerts that do something on the RevenueLineItems Module
  *
  * @throws SugarQueryException
  */
 private function deleteRevenueLineItemsRelatedAlerts()
 {
     // get the action shells
     $alertShells = BeanFactory::getBean('WorkFlowAlertShells');
     $sq = new SugarQuery();
     $sq->select(array('id', 'parent_id'));
     $sq->from($alertShells);
     $sq->where()->queryOr()->equals('rel_module2', 'revenuelineitems')->equals('rel_module2', 'revenuelineitems');
     $rows = $sq->execute();
     foreach ($rows as $row) {
         $alertShells->retrieve($row['id']);
         //mark delete alert components and sub expression components
         $alert_object_list = $alertShells->get_linked_beans('alert_components', 'WorkFlowAlert');
         foreach ($alert_object_list as $alert_object) {
             mark_delete_components($alert_object->get_linked_beans('expressions', 'Expression'));
             mark_delete_components($alert_object->get_linked_beans('rel1_alert_fil', 'Expression'));
             mark_delete_components($alert_object->get_linked_beans('rel2_alert_fil', 'Expression'));
             $alert_object->mark_deleted($alert_object->id);
         }
         $alertShells->mark_deleted($row['id']);
         $alertShells->get_workflow_object()->write_workflow();
     }
 }
Пример #6
0
if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
/*
 * Your installation or use of this SugarCRM file is subject to the applicable
 * terms available at
 * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
 * If you do not agree to all of the applicable terms or do not have the
 * authority to bind the entity as an authorized representative, then do not
 * install or use this SugarCRM file.
 *
 * Copyright (C) SugarCRM Inc. All rights reserved.
 */
/*********************************************************************************
 * Description:  
 ********************************************************************************/
global $mod_strings;
$focus = BeanFactory::getBean('WorkFlowActionShells');
if (!isset($_REQUEST['record'])) {
    sugar_die($mod_strings['ERR_DELETE_RECORD']);
}
$focus->retrieve($_REQUEST['record']);
//check for bridged child (invites for meetings/calls
$focus->check_for_child_bridge(true);
//mark delete alertshell components
mark_delete_components($focus->get_linked_beans('actions', 'WorkFlowAction'));
mark_delete_components($focus->get_linked_beans('rel1_action_fil', 'Expression'));
$focus->mark_deleted($_REQUEST['record']);
$workflow_object = $focus->get_workflow_object();
$workflow_object->write_workflow();
header("Location: index.php?module=" . $_REQUEST['return_module'] . "&action=" . $_REQUEST['return_action'] . "&record=" . $_REQUEST['return_id']);