function action_mapping() { global $mod_strings, $current_user; $results = array('message' => ''); // handle publishing and deleting import maps if (isset($_REQUEST['delete_map_id'])) { $import_map = BeanFactory::deleteBean('Import_1', $_REQUEST['delete_map_id']); } if (isset($_REQUEST['publish'])) { $import_map = BeanFactory::getBean('Import_1', $_REQUEST['import_map_id'], array("encode" => false)); if ($_REQUEST['publish'] == 'yes') { $result = $import_map->mark_published($current_user->id, true); if (!$result) { $results['message'] = $mod_strings['LBL_ERROR_UNABLE_TO_PUBLISH']; } } elseif ($_REQUEST['publish'] == 'no') { // if you don't own this importmap, you do now, unless you have a map by the same name $result = $import_map->mark_published($current_user->id, false); if (!$result) { $results['message'] = $mod_strings['LBL_ERROR_UNABLE_TO_UNPUBLISH']; } } } echo json_encode($results); sugar_cleanup(TRUE); }
sugar_cleanup(true); } //Retrieve all related kbdocument revisions. $kbdocrevs = KBDocument::get_kbdocument_revisions($_REQUEST['record']); //Loop through kbdocument revisions and delete one by one. if (!empty($kbdocrevs) && is_array($kbdocrevs)) { foreach ($kbdocrevs as $key => $thiskbid) { $thiskbversion = BeanFactory::getBean('KBDocumentRevisions', $thiskbid); //Check for related documentrevision and delete. if ($thiskbversion->document_revision_id != null) { $docrev_id = $thiskbversion->document_revision_id; $thisdocrev = BeanFactory::getBean('DocumentRevisions', $docrev_id); UploadFile::unlink_file($docrev_id, $thisdocrev->filename); UploadFile::unlink_file($docrev_id); //mark version deleted $thisdocrev->mark_deleted($thisdocrev->id); } //Also check for related kbcontent and delete. if ($thiskbversion->kbcontent_id != null) { BeanFactory::deleteBean('KBContents', $thiskbversion->kbcontent_id); } //Finally delete the kbdocument revision. $thiskbversion->mark_deleted($thiskbversion->id); } } //delete kbdocuments_kbtags $deleted = 1; $q = 'UPDATE kbdocuments_kbtags SET deleted = ' . $deleted . ' WHERE kbdocument_id = \'' . $_REQUEST['record'] . '\''; $focus->db->query($q); $focus->mark_deleted($_REQUEST['record']); header("Location: index.php?module=" . $_REQUEST['return_module'] . "&action=" . $_REQUEST['return_action'] . "&record=" . $_REQUEST['return_id']);
ARGS: $_REQUEST['module']; : the module associated with this Bean instance (will be used to get the class name) $_REQUEST['record']; : the id of the Bean instance $_REQUEST['linked_field']; : the linked field name of the Parent Bean $_REQUEST['linked_id']; : the id of the Related Bean instance to $_REQUEST['return_url']; : the URL to redirect to or use: 1) $_REQUEST['return_id']; : 2) $_REQUEST['return_module']; : 3) $_REQUEST['return_action']; : */ //_ppd($_REQUEST); require_once 'include/formbase.php'; $focus = BeanFactory::getBean($_REQUEST['module']); if (empty($_REQUEST['linked_id']) || empty($_REQUEST['linked_field']) || empty($_REQUEST['record'])) { die("need linked_field, linked_id and record fields"); } $linked_field = $_REQUEST['linked_field']; $record = $_REQUEST['record']; $linked_id = $_REQUEST['linked_id']; // cut it off: $focus->load_relationship($linked_field); $focus->{$linked_field}->delete($record, $linked_id); BeanFactory::deleteBean('Holidays', $linked_id); $GLOBALS['log']->debug("deleted relationship: bean: {$_REQUEST['module']}, linked_field: {$linked_field}, linked_id:{$linked_id}"); if (empty($_REQUEST['refresh_page'])) { handleRedirect(); } exit;
//this attribute is set, so lets store or update $action_object = BeanFactory::getBean('WorkFlowActions'); if (!empty($_REQUEST['action_id'][$i])) { $action_object->retrieve($_REQUEST['action_id'][$i]); //end if action id is already present } foreach ($action_object->column_fields as $field) { $action_object->populate_from_save($field, $i); } $action_object->parent_id = $focus->id; $action_object->save(); } else { //possibility exists that this attribute is being removed if (!empty($_REQUEST['action_id'][$i])) { //delete attribute BeanFactory::deleteBean('WorkFlowActions', $_REQUEST['action_id'][$i]); //end if to remove attribute } } } //Rewrite the workflow files $workflow_object = $focus->get_workflow_object(); // If this action_module is Meeting or Call then create a bridging object if ($is_new == true) { $focus->check_for_invitee_bridge($workflow_object); } $workflow_object->write_workflow(); $workflow_id = $focus->parent_id; $return_id = $focus->id; if (!empty($_POST['return_module'])) { $return_module = $_POST['return_module'];
function clear_all_layout($data_set_id) { //Select all layout records $query = "SELECT * from {$this->table_name}\n\t\t\t\t\t where {$this->table_name}.parent_id='{$data_set_id}'\n\t\t\t\t \t"; $result = $this->db->query($query, true, " Error retrieving layout records for this data set: "); // Print out the calculation column info while (($row = $this->db->fetchByAssoc($result)) != null) { //Mark all attributes deleted BeanFactory::deleteBean('DataSet_Attribute', $row['id']); //Remove the layout records $this->mark_deleted($row['id']); //end while } //end if rows exist //} //end function mark_all_layout }
<?php 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. */ if (isset($_REQUEST['record']) && !empty($_REQUEST['record'])) { BeanFactory::deleteBean('Groups', $_REQUEST['record']); } header("Location: index.php?module=Groups&action=index");
$query .= " and email_marketing_prospect_lists.prospect_list_id='{$linked_id}'"; $result = $focus->db->query($query); while (($row = $focus->db->fetchByAssoc($result)) != null) { $del_query = " update email_marketing_prospect_lists set email_marketing_prospect_lists.deleted=1, email_marketing_prospect_lists.date_modified=" . $focus->db->convert("'" . TimeDate::getInstance()->nowDb() . "'", 'datetime'); $del_query .= " WHERE email_marketing_prospect_lists.id='{$row['id']}'"; $focus->db->query($del_query); } $focus->db->query($query); } if ($focus->object_name == "Meeting") { $focus->retrieve($record); $user = BeanFactory::getBean('Users', $linked_id); if (!empty($user->id)) { //make sure that record exists. we may have a contact on our hands. if ($focus->update_vcal) { vCal::cache_sugar_vcal($user); } } } if ($focus->object_name == "User" && $linked_field == 'eapm') { BeanFactory::deleteBean('EAPM', $linked_id); } SugarRelationship::resaveRelatedBeans(); if (!empty($_REQUEST['return_url'])) { $_REQUEST['return_url'] = urldecode($_REQUEST['return_url']); } $GLOBALS['log']->debug("deleted relationship: bean: {$focus->object_name}, linked_field: {$linked_field}, linked_id:{$linked_id}"); if (empty($_REQUEST['refresh_page'])) { handleRedirect(); } exit;
//todo check_notify $id = $projectTask->save(false); //$projectTask->save($GLOBALS['check_notify']); // Keep track of the newly generated Id to pass back to the grid so that we avoid // saving the row multiple times. if (empty($_REQUEST["obj_id_" . $i])) { $newIds[$i] = $id; } } } // get random ProjectTask from current project $ind = rand(1, $_REQUEST['numRowsToSave']); $projectTask = BeanFactory::getBean('ProjectTask'); $projectTask->skipParentUpdate(); if (isset($_REQUEST["obj_id_" . $ind]) && !empty($_REQUEST["obj_id_" . $ind])) { $projectTask->retrieve($_REQUEST["obj_id_" . $ind]); } else { $projectTask->retrieve($newIds[$ind]); } //updating percentage complete for tasks with child tasks in current project $projectTask->updateStatistic(); // Handle deleted rows. $deletedRows = $_REQUEST['deletedRows']; if ($deletedRows != "") { $deletedRowsArray = explode(",", $deletedRows); foreach ($deletedRowsArray as $rowid) { BeanFactory::deleteBean('ProjectTask', $rowid); } } $json = getJSONobj(); echo 'result = ' . $json->encode($newIds);
function control(&$args) { global $current_user; global $mod_strings; $error_msg = ''; // SAVE MAPPING IF REQUESTED if (isset($_REQUEST['save_report']) && $_REQUEST['save_report'] == 'on') { if (!empty($_REQUEST['record'])) { if (!check_report_perms($_REQUEST['record'])) { print $mod_strings['MSG_NO_PERMISSIONS']; return; } } $args['save_result'] = $args['reporter']->save($_REQUEST['save_report_as']); header("location: index.php?module=Reports&action=index&page=report&id=" . $args['reporter']->saved_report->id); exit; } if (isset($_REQUEST['delete_report_id'])) { if (!check_report_perms($_REQUEST['delete_report_id'])) { print $mod_strings['MSG_NO_PERMISSIONS']; return; } BeanFactory::deleteBean('Reports', $_REQUEST['delete_report_id']); } if (isset($_REQUEST['publish'])) { if (!check_report_perms($_REQUEST['publish_report_id'])) { print $mod_strings['MSG_NO_PERMISSIONS']; return; } $saved_report = BeanFactory::getBean('Reports'); $result = 0; $saved_report = $saved_report->retrieve($_REQUEST['publish_report_id'], false); if ($_REQUEST['publish'] == 'yes') { $result = $saved_report->mark_published("yes"); if ($result == -1) { $error_msg = $mod_strings['MSG_UNABLE_PUBLISH_ANOTHER']; } } else { if ($_REQUEST['publish'] == 'no') { // if you don't own this importmap, you do now! // unless you have a map by the same name $result = $saved_report->mark_published("no"); if ($result == -1) { $error_msg = $mod_strings['MSG_UNABLE_PUBLISH_YOU_OWN']; } } } if (isset($error_msg)) { echo $error_msg; } } }
//filter, so an expression object is needed or present $exp_object = BeanFactory::getBean('Expressions'); if (!empty($_POST['rel_custom2_exp_id'])) { $exp_object->retrieve($_POST['rel_custom2_exp_id']); } foreach ($exp_object->column_fields as $field) { if (isset($_POST["rel_custom2_" . $field])) { $exp_object->{$field} = $_POST["rel_custom2_" . $field]; } } $save_expression_object = true; //end if expression object is needed } else { if (!empty($_POST['rel_custom2_exp_id'])) { //expression object existing prior, so remove it. BeanFactory::deleteBean('Expressions', $_POST['rel_custom2_exp_id']); } //else if expression object is not needed, but could be present so needs to be removed } $focus->array_type = "future"; $focus->user_type = $_POST['user_type']; $focus->relate_type = "Self"; $focus->address_type = $_REQUEST['address_type']; //end if user_type related_user_custom } //Choosing a specific User, Team, or Role if ($_POST['user_type'] == "specific_user" || $_POST['user_type'] == "specific_team" || $_POST['user_type'] == "specific_role") { $focus->array_type = "future"; $focus->user_type = $_POST['user_type']; $focus->relate_type = "Self"; $focus->rel_module1 = "";
case "getSignature": $GLOBALS['log']->debug("********** EMAIL 2.0 - Asynchronous - at: getSignature"); if (isset($_REQUEST['id'])) { $signature = $current_user->getSignature($_REQUEST['id']); $signature['signature_html'] = from_html($signature['signature_html']); $out = $json->encode($signature); echo $out; } else { die; } break; case "deleteSignature": $GLOBALS['log']->debug("********** EMAIL 2.0 - Asynchronous - at: deleteSignature"); if (isset($_REQUEST['id'])) { require_once "modules/UserSignatures/UserSignature.php"; BeanFactory::deleteBean('UserSignatures', $_REQUEST['id']); $signatureArray = $current_user->getSignaturesArray(); // clean "none" foreach ($signatureArray as $k => $v) { if ($k == "") { $sigs[$k] = $app_strings['LBL_NONE']; } else { if (is_array($v) && isset($v['name'])) { $sigs[$k] = $v['name']; } else { $sigs[$k] = $v; } } } $out['signatures'] = $sigs; $ret = $json->encode($out);
/** * Delete a job * @param string $jobId */ public function deleteJob($jobId) { return BeanFactory::deleteBean('SchedulersJobs', $jobId); }
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; if (!is_admin($current_user)) { sugar_die($app_strings['LBL_UNAUTH_ADMIN']); } if (!isset($_REQUEST['record'])) { sugar_die($mod_strings['ERR_DELETE_RECORD']); } $focus = BeanFactory::deleteBean('CustomQueries', $_REQUEST['record']); if (!$focus) { sugar_die($mod_strings['ERR_DELETE_RECORD']); } //Remove the query_id from any data_sets that are currently using it. $focus->mark_relationships_deleted($_REQUEST['record']); header("Location: index.php?module=" . $_REQUEST['return_module'] . "&action=" . $_REQUEST['return_action'] . "&record=" . $_REQUEST['return_id']);