function add_column_to_layouts($new_column_name) { //find out where this query exists $query = "\tSELECT data_sets.id 'parent_id'\n\t\t\t\t\tFROM data_sets\n\t\t\t\t\tWHERE data_sets.query_id = '" . $this->id . "'\n\t\t\t\t\tAND data_sets.custom_layout='Enabled'\n\t\t\t\t\tAND data_sets.deleted = '0'\n\t\t\t\t\t"; $result = $this->getSlaveDb()->query($query, true, "Error finding where query exists"); $GLOBALS['log']->debug("check custom binding add columns to layout: result is " . print_r($result, true)); //if($this->db->getRowCount($result) > 0){ //data sets exists with this query and custom layout enabled while (($row = $this->getSlaveDb()->fetchByAssoc($result)) != null) { //Get new position $layout_object = new DataSet_Layout(); $controller = new Controller(); $controller->init($layout_object, "New"); $controller->change_component_order("", "", $row['parent_id']); $layout_object->construct($row['parent_id'], "Column", false, "Normal", $new_column_name); //end while } //end if rows exist //} //end function add_column_to_layouts }
$body_is_update = false; $to_pdf = true; $focus = new DataSet_Layout(); if (!empty($_REQUEST['layout_id']) && $_REQUEST['layout_id'] != "") { $focus->retrieve($_REQUEST['layout_id']); $is_update = true; } //Update Data Set Layout Controller//////////////////////////////////////////// if ($is_update == true) { if (!empty($_REQUEST['direction'])) { $to_pdf = false; $controller = new Controller(); $magnitude = 1; $direction = $_REQUEST['direction']; $controller->init($focus, "Save"); $controller->change_component_order($magnitude, $direction, $focus->parent_id); } //End Update Data Set Layout Contoller } //New or Update DataSet Layout foreach ($focus->column_fields as $field) { if (isset($_POST[$field])) { $focus->{$field} = $_POST[$field]; } } if (!isset($_POST['hide_column'])) { $focus->hide_column = '0'; } $focus->save(); $layout_id = $focus->id; $return_id = $focus->id;
* install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ /********************************************************************************* * Description: ********************************************************************************/ require_once 'include/controller/Controller.php'; $local_log =& LoggerManager::getLogger('index'); $focus = BeanFactory::getBean('WorkFlow'); $controller = new Controller(); //if we are saving from the adddatasetform $focus->retrieve($_REQUEST['workflow_id']); $magnitude = 1; $direction = $_REQUEST['direction']; $controller->init($focus, "Save"); $controller->change_component_order($magnitude, $direction, $focus->base_module); $focus->save(); $focus->write_workflow(); if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") { $return_module = $_REQUEST['return_module']; } else { $return_module = "Workflow"; } if (isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") { $return_action = $_REQUEST['return_action']; } else { $return_action = "ProcessListView"; } //echo "index.php?action=$return_action&module=$return_module&record=$return_id"; header("Location: index.php?action={$return_action}&module={$return_module}&base_module=" . $_REQUEST['base_module'] . "");
$_POST['record'] = $_REQUEST['record']; } //Setup variables so no errors occur $handle_custom_layout = false; $custom_layout = false; $focus = BeanFactory::getBean('DataSets'); $controller = new Controller(); if (!empty($_POST['data_set_id'])) { //if we are saving from the adddatasetform $focus->retrieve($_POST['data_set_id']); //is the direction set, if not, then this is a brand new addition to the report if (!empty($_REQUEST['direction'])) { $magnitude = 1; $direction = $_REQUEST['direction']; $controller->init($focus, "Save"); $controller->change_component_order($magnitude, $direction, $focus->report_id); } else { //brand new $controller->init($focus, "New"); $controller->change_component_order("", "", $_REQUEST['report_id']); } } else { $focus->retrieve($_POST['record']); ///////////////////////////Start Handle Disabling and Enabling the Custom Layout Tool if (!empty($_REQUEST['record']) && $_REQUEST['record'] != "") { //exist //if we are have switched the queries we are using in this data set if (!empty($_REQUEST['query_id']) && $_REQUEST['query_id'] != $focus->query_id) { $handle_custom_layout = true; $custom_layout = true; $remove_layout = true;
foreach ($focus->additional_column_fields as $field) { if (isset($_POST[$field])) { $value = $_POST[$field]; $focus->{$field} = $value; } } if ($focus->status == "Active") { $focus->status = 1; } else { $focus->status = 0; } //If this is new, set the initial process order if ($is_new == true) { $controller = new Controller(); $controller->init($focus, "New"); $controller->change_component_order("", "", $_REQUEST['base_module']); } $focus->save(); if (!empty($_POST['is_duplicate']) && $_POST['is_duplicate'] == "true") { $old_workflow = BeanFactory::getBean('WorkFlow', $_POST['old_record_id']); $alerts_list =& $old_workflow->get_linked_beans('alerts', 'WorkFlowAlertShell'); $actions_list =& $old_workflow->get_linked_beans('actions', 'WorkFlowActionShell'); $triggers_list =& $old_workflow->get_linked_beans('triggers', 'WorkFlowTriggerShell'); $filters_list =& $old_workflow->get_linked_beans('trigger_filters', 'WorkFlowTriggerShell'); foreach ($alerts_list as $alert) { $alert->copy($focus->id); } foreach ($actions_list as $action) { $newActionId = $action->copy($focus->id); // BUG 44500 Duplicating workflow does not duplicate invitees for created activites $query = "SELECT id FROM workflow WHERE parent_id = '{$action->id}' ";