* Contributor(s): ______________________________________.
 */
require_once 'XTemplate/xtpl.php';
require_once 'data/Tracker.php';
require_once 'modules/ProductEstimate/ProductEstimate.php';
require_once 'include/time.php';
require_once 'modules/ProductEstimate/Forms.php';
global $timedate;
global $app_strings;
global $app_list_strings;
global $current_language;
global $current_user;
global $sugar_version, $sugar_config;
$focus = new ProductEstimate();
if (!empty($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
$precalc = null;
if (isset($_REQUEST['precalc']) && !empty($_REQUEST['precalc'])) {
    $precalc = $_REQUEST['precalc'];
}
if (!empty($_REQUEST['product_id']) && isset($_REQUEST['product_id']) && !is_null($_REQUEST['product_id'])) {
    $product_id = $_REQUEST['product_id'];
    $components_estimate = $focus->componentsEstimate($product_id);
} elseif (isset($focus->product_id) && !is_null($focus->product_id)) {
    $product_id = $focus->product_id;
    $components_estimate = $focus->componentsEstimate($product_id);
} else {
    exit;
}
if (!empty($_REQUEST['product_name']) && isset($_REQUEST['product_name']) && !is_null($_REQUEST['product_name'])) {
 * requirements.
 *
 * The Original Code is: SugarCRM Open Source
 * The Initial Developer of the Original Code is SugarCRM, Inc.
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 */
require_once 'modules/ProductEstimate/ProductEstimate.php';
$sugarbean = new ProductEstimate();
// 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']) ? 'ProductEstimate' : $_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)) {