* Contributor(s): ______________________________________.
 */
require_once 'XTemplate/xtpl.php';
require_once 'data/Tracker.php';
require_once 'modules/Estimates/Estimates.php';
require_once 'include/time.php';
require_once 'modules/Estimates/Forms.php';
global $timedate;
global $app_strings;
global $app_list_strings;
global $current_language;
global $current_user;
global $sugar_version, $sugar_config;
$focus = new Estimates();
if (!empty($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'] . ": " . $focus->name, true);
echo "\n</p>\n";
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
require_once $theme_path . 'layout_utils.php';
$GLOBALS['log']->info("Estimates detail view");
$xtpl = new XTemplate('modules/Estimates/ProductSelect.html');
$json = getJSONobj();
$popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'product_id', 'name' => 'product_name'));
$encoded_product_popup_request_data = $json->encode($popup_request_data);
$xtpl->assign('encoded_products_popup_request_data', $encoded_product_popup_request_data);
///
 function get_status($id = null)
 {
     if (!is_null($id)) {
         $esteimate = new Estimates();
         $esteimate->retrieve($id);
         $product = new Products();
         $product->retrieve($esteimate->product_id);
         if (!is_null($product->status)) {
             return $product->status;
         }
     }
     return 'new_estimate';
 }
$popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'calculant_id', 'user_name' => 'calculant_name'));
$xtpl->assign('encoded_calculant_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'contact_id', 'name' => 'contact_name'));
$encoded_contact_popup_request_data = $json->encode($popup_request_data);
$xtpl->assign('encoded_contact_popup_request_data', $encoded_contact_popup_request_data);
$popup_request_data = array('call_back_function' => 'set_return_product', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'product_id', 'name' => 'product_name', 'account_id' => 'account_id', 'account_name' => 'account_name', 'contact_id' => 'contact_id', 'contact_name' => 'contact_name', 'number' => 'number'));
$encoded_contact_popup_request_data = $json->encode($popup_request_data);
$xtpl->assign('encoded_products_popup_request_data', $encoded_contact_popup_request_data);
///
/// Assign the template variables
///
$xtpl->assign('MOD', $mod_strings);
$xtpl->assign('APP', $app_strings);
if (isset($_REQUEST['estimate_id']) && !empty($_REQUEST['estimate_id'])) {
    $estimate = new Estimates();
    $estimate->retrieve($_REQUEST['estimate_id']);
    $ClientRequest = new ClientRequest();
    $ClientRequest->retrieve($estimate->clientrequest_id);
    if (isset($estimate->id) && !empty($estimate->id)) {
        $focus->product_id = $estimate->product_id;
        $focus->name = $estimate->name;
        $focus->number = 'ORD' . $focus->generate_number('number', $focus->table_name);
        $focus->estimate_id = $estimate->id;
        $focus->deadline = $estimate->deadline;
        $focus->quantity = $estimate->quantity;
        //$focus->sub_status = $estimate->sub_status;
        $focus->period = $estimate->period;
        $focus->samples = $estimate->samples;
        $focus->file = $estimate->file;
        $focus->note = $estimate->note;
        $focus->description = $estimate->description;
 * 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/Estimates/Estimates.php';
$sugarbean = new Estimates();
// 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->estimate_update($sugarbean->id);
    $sugarbean->mark_deleted($record);
}
// handle the return location variables
$return_module = empty($_REQUEST['return_module']) ? 'Estimates' : $_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)) {
}
if (isset($_REQUEST['estimate_id']) && !empty($_REQUEST['estimate_id'])) {
    $xtpl->assign('estimate_id', $_REQUEST['estimate_id']);
    $xtpl->assign("PRODUCTROWS", $focus->add_quote_estimate($_REQUEST['estimate_id']));
    $xtpl->parse("main.row1");
    $estimate_id = $_REQUEST['estimate_id'];
}
if (isset($focus->estimate_id) && !empty($focus->estimate_id)) {
    $xtpl->assign('estimate_id', $focus->estimate_id);
    $xtpl->assign("PRODUCTROWS", $focus->add_quote_estimate($focus->estimate_id));
    $xtpl->parse("main.row1");
    $estimate_id = $focus->estimate_id;
}
if (isset($estimate_id) && !empty($estimate_id)) {
    $Estimate = new Estimates();
    $Estimate->retrieve($estimate_id);
    $product = new Products();
    $product->retrieve($Estimate->product_id);
    $xtpl->assign("number", $product->pnum);
    $xtpl->assign("prod_product_name", $product->name);
    $xtpl->assign("prod_product_id", $product->id);
    $xtpl->assign("prod_account_name", $product->account_name);
    $xtpl->assign("prod_account_id", $product->account_id);
    $xtpl->assign("prod_contact_name", $product->contact_name);
    $xtpl->assign("prod_contact_id", $product->contact_id);
    $style_display = '';
    $xtpl->assign("product_readOnly", 'readOnly');
}
if (!is_null($focus->id)) {
    $xtpl_data['ACCOUNT_ID'] = $focus->account_id;
    $xtpl_data['ACCOUNT_NAME'] = $focus->account_name;
Example #6
0
 * 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/EstimateCalc/EstimateCalc.php';
require_once 'modules/Estimates/Estimates.php';
require_once 'include/formbase.php';
$sugarbean = new EstimateCalc();
$sugarbean = populateFromPost('', $sugarbean);
$sugarbean->status = "uptodate";
if (isset($_REQUEST['email_id'])) {
    $sugarbean->email_id = $_REQUEST['email_id'];
}
if (!$sugarbean->ACLAccess('Save')) {
    ACLController::displayNoAccess(true);
    sugar_cleanup(true);
}
$sugarbean->save($GLOBALS['check_notify']);
$return_id = $sugarbean->id;
$estimate = new Estimates();
$estimate->retrieve($sugarbean->estimate_id);
//// Status Update
if (isset($_REQUEST['stat_action']) && !empty($_REQUEST['stat_action']) && !is_null($_REQUEST['stat_action'])) {
    $estimate->status_update('', $estimate->id, $_REQUEST['stat_action'], '');
} else {
    $estimate->status_update('', $estimate->id, '', '');
}
/////////////////
handleRedirect($return_id, 'EstimateCalc');