global $timedate;
global $app_strings;
global $app_list_strings;
global $current_language;
global $current_user;
global $sugar_version, $sugar_config;
// Unimplemented until jscalendar language files are fixed
// global $current_language;
// global $default_language;
// global $cal_codes;
$focus = new EstimateComponents();
$format = new Paperformat();
$pressformat = new Pressformat();
$childformat = new Childformat();
if (!empty($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
echo "\n<p>\n";
if ($focus->parent_bean == 'ClientRequest') {
    $mod_strings['LBL_MODULE_NAME'] = $mod_strings['LBL_CLIENTREQUEST_MODULE_NAME'];
}
if ($focus->parent_bean == 'Estimates') {
    $mod_strings['LBL_MODULE_NAME'] = $mod_strings['LBL_ESTIMATES_MODULE_NAME'];
}
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("EstimateComponents detail view");
$bodyHtml .= $pdf->genCells($mod_strings["LBL_COLORS_B"], false, false, true);
$bodyHtml .= $pdf->CompRows($list);
$bodyHtml .= "</table>";
$bodyHtml .= "<newpage>";
//Get the components' ids
$list = null;
$query = "SELECT id FROM `estimates_components` WHERE parent_id='" . $focus->id . "' AND deleted=0 AND parent_bean = 'ClientRequest'";
//$query = "SELECT id FROM `estimates_components` WHERE deleted=0 AND parent_bean = 'ClientRequest'";
$result = $focus->db->query($query, true, "Error filling layout fields: ");
while ($row = $focus->db->fetchByAssoc($result)) {
    $list[] = $row['id'];
}
//Initializing of EstimateComponents object needs to be done for every record
for ($i = 0; $i < count($list); $i++) {
    $RqComps = new EstimateComponents();
    $RqComps->retrieve($list[$i]);
    //get the $mod_strings from EstimateComponents module
    $mod_strings = return_module_language($current_language, "EstimateComponents");
    //shortcut variables
    $format = $RqComps->fsize_h . "x" . $RqComps->fsize_w;
    $runFormat = $RqComps->run_size_x . "x" . $RqComps->run_size_y;
    $bleed = $RqComps->bleed_size_x . "x" . $RqComps->bleed_size_y;
    $baseFormat = $RqComps->base_x . "x" . $RqComps->base_y;
    $compsHtml .= "<br />";
    $compsHtml .= $pdf->sectionHeading($mod_strings["LBL_COMPONENTS_PDF_TITLE"], $RqComps->name, $RqComps->number);
    $compsHtml .= $pdf->createHeading($mod_strings["LBL_GENERAL"]);
    $compsHtml .= $pdf->createTr(false, $mod_strings["LBL_NUMBER"], $RqComps->number, $mod_strings["LBL_QUANTITY"], $RqComps->quantity);
    $compsHtml .= $pdf->createTr(false, $mod_strings["LBL_VOLUME"], $RqComps->volume);
    $compsHtml .= $pdf->createTr(true, $mod_strings["LBL_DESCRIPTION"], $RqComps->description, null, null, true);
    $compsHtml .= $pdf->createHeading($mod_strings["LBL_COMPONENT_FORMATS"]);
    $compsHtml .= $pdf->createTr(false, $mod_strings["LBL_FORMAT"], $format, $mod_strings["LBL_RUN_FORMAT"], $runFormat);
 * 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/EstimateComponents/EstimateComponents.php';
$sugarbean = new EstimateComponents();
// 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->mark_deleted($record);
}
// handle the return location variables
$return_module = empty($_REQUEST['return_module']) ? 'EstimateComponents' : $_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}";
$bodyHtml .= $pdf->genCells($mod_strings["LBL_COMP_PAPER"], false, false, false, "25%");
$bodyHtml .= $pdf->genCells($mod_strings["LBL_COMP_FSIZE_H"]);
$bodyHtml .= $pdf->genCells($mod_strings["LBL_COMP_FSIZE_W"], false, false, true);
$bodyHtml .= $pdf->CompRows($list);
$bodyHtml .= "</table>";
$bodyHtml .= "<newpage>";
$list = null;
$query = "SELECT id FROM `estimates_components` WHERE parent_id='" . $focus->id . "' AND deleted=0";
$result = $focus->db->query($query, true, "Error filling layout fields: ");
while ($row = $focus->db->fetchByAssoc($result)) {
    $list[] = $row['id'];
}
//Initializing of EstimateComponents object, needs to be done for every record
for ($i = 0; $i < count($list); $i++) {
    $estComps = new EstimateComponents();
    $estComps->retrieve($list[$i]);
    //get the $mod_strings from EstimateComponents module
    $comp_mod_strings = return_module_language($current_language, "EstimateComponents");
    $description = nl2br(url2html($estComps->description));
    $type = $app_list_strings['type_options'][$estComps->type];
    $color = $estComps->color_side_a . "x" . $estComps->color_side_b;
    $fsize = $estComps->fsize_h . "x" . $estComps->fsize_w;
    $base = $estComps->base_x . "x" . $estComps->base_y;
    $bleed_size = $estComps->bleed_size_x . "x" . $estComps->bleed_size_y;
    $child = $estComps->child_x . "x" . $estComps->child_y;
    $run_size = $estComps->run_size_x . "x" . $estComps->run_size_y;
    $pressformat = $estComps->pressformat_x . "x" . $estComps->pressformat_y;
    $colorSideA = $comp_mod_strings["LBL_COLOR_SIDE_A"] . "(" . $estComps->color_side_a . ")";
    $colorSideB = $comp_mod_strings["LBL_COLOR_SIDE_B"] . "(" . $estComps->color_side_b . ")";
    $ink_rows = $estComps->getInkRows();
    $inks_side_a = array();
 function build_component_estimates_list($id)
 {
     $fields = array("id", "price");
     $query_fields = " id, price ";
     $where = " parent_id = '{$id}' ";
     $component_list = $this->getComponentListData($fields, $query_fields, 'estimates_components', $where);
     $components_to_estimate = array();
     for ($i = 0; $i < count($component_list); $i++) {
         $component = new EstimateComponents();
         $component->retrieve($component_list[$i]['id']);
         $query = " SELECT id, status FROM componentestimatecalc WHERE deleted=0 and component_id='{$component->id}'  ";
         $result = $this->db->query($query, true, "Error filling layout fields: ");
         $data = $this->db->fetchByAssoc($result);
         if ($data == null) {
             $temp = array();
             $temp['id'] = $component->id;
             $temp['name'] = $component->name;
             $temp['price'] = $component->price;
             $temp['outdated'] = false;
             $components_to_estimate[] = $temp;
         }
         if ($data['status'] == "outdated") {
             $temp = array();
             $temp['id'] = $component->id;
             $temp['name'] = $component->name;
             $temp['estimate_id'] = $component->parent_id;
             $temp['estimate_name'] = $component->parent_name;
             $temp['price'] = $component->price;
             $temp['estimate_id'] = $data['id'];
             $temp['outdated'] = true;
             $components_to_estimate[] = $temp;
         }
     }
     return $components_to_estimate;
 }
Example #6
0
 * 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/ComponentEstimateCalc/ComponentEstimateCalc.php';
require_once 'modules/EstimateComponents/EstimateComponents.php';
require_once 'include/formbase.php';
global $app_list_strings;
$sugarbean = new ComponentEstimateCalc();
$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']);
$component = new EstimateComponents();
$component->retrieve($sugarbean->component_id);
//// Status Update
if (isset($_REQUEST['stat_action']) && !empty($_REQUEST['stat_action']) && !is_null($_REQUEST['stat_action'])) {
    $component->status_update('', $component->id, $_REQUEST['stat_action'], '');
} else {
    $component->status_update('', $component->id, '', '');
}
/////////////////
$return_id = $sugarbean->id;
handleRedirect($return_id, 'ComponentEstimateCalc');