コード例 #1
0
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 */
require_once 'modules/ComponentEstimateCalc/ComponentEstimateCalc.php';
$sugarbean = new ComponentEstimateCalc();
// perform the delete if given a record to delete
if (empty($_REQUEST['record'])) {
    $GLOBALS['log']->info('delete called without a record id specified');
} else {
    $record = $_REQUEST['record'];
    $sugarbean->retrieve($record);
    if (!$sugarbean->ACLAccess('Delete')) {
        ACLController::displayNoAccess(true);
        sugar_cleanup(true);
    }
    $GLOBALS['log']->info("deleting record: {$record}");
    $sugarbean->delete_estimate($record);
    $sugarbean->mark_deleted($record);
}
// handle the return location variables
$return_module = empty($_REQUEST['return_module']) ? 'ComponentEstimateCalc' : $_REQUEST['return_module'];
$return_action = empty($_REQUEST['return_action']) ? 'index' : $_REQUEST['return_action'];
$return_id = empty($_REQUEST['return_id']) ? '' : $_REQUEST['return_id'];
$return_location = "index.php?module={$return_module}&action={$return_action}";
// append the return_id if given
if (!empty($return_id)) {
    $return_location .= "&record={$return_id}";
}
// now that the delete has been performed, return to given location
header("Location: {$return_location}");
コード例 #2
0
 function component_update($id, $close = false)
 {
     $estimate_estimate = new EstimateCalc();
     $components_estimate = new ComponentEstimateCalc();
     $estimate = new Estimates();
     $query = ' SELECT id FROM ' . $components_estimate->table_name . ' WHERE component_id="' . $id . '" AND deleted=0 ';
     $result = $this->db->query($query, true, "");
     if ($result != false) {
         while ($data = $this->db->fetchByAssoc($result)) {
             $components_estimate->mark_deleted($data['id']);
         }
     }
     $query = ' UPDATE ' . $estimate->table_name . ' SET status="draft" WHERE id="' . $this->parent_id . '" AND deleted=0 ';
     $this->db->query($query, true, "");
     $query = ' UPDATE ' . $estimate_estimate->table_name . ' SET status="outdated" WHERE id="' . $this->parent_id . '" AND deleted=0 ';
     $this->db->query($query, true, "");
 }