require_once 'modules/Pressformat/Pressformat.php'; require_once 'modules/Childformat/Childformat.php'; 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/";
function Get_Format($selected_format, $name, $module = null) { global $app_list_strings; global $app_strings; global $mod_strings; if ($module == null) { $module = 'Paperformat'; } $xtpl = new XTemplate('modules/' . $module . '/format_ui_elements.html'); $xtpl->assign('APP', $app_strings); $xtpl->assign('MOD', $mod_strings); if ($name == 'child_format') { $bean = new Childformat(); } else { $bean = $this; } $query = " SELECT id,x,y FROM {$bean->table_name} where name='{$selected_format}' AND deleted=0 "; $result = $bean->db->query($query, true, " Error getting format"); $data = $bean->db->fetchByAssoc($result); $parent_id = $data['id']; $prefix = trim($name, "_format"); echo $prefix; if ($selected_format == '-') { $data['x'] = ''; $data['y'] = ''; } $xtpl->assign($prefix . '_x', $data['x']); $xtpl->assign($prefix . '_y', $data['y']); if ($bean->object_name == "Childformat") { $bean->retrieve($data['id']); $app_list_strings['format_options'] = $bean->Get_Dropdown_Data($bean->parent_id); $this->retrieve($bean->parent_id); $coef = $this->calc_coef($this, $bean); $xtpl->assign("COEF", '1:' . $coef); } else { $app_list_strings['format_options'] = $bean->Get_Dropdown_Data(); } $type_pref = $prefix; $type_pref = strtoupper($type_pref); $xtpl->assign($type_pref . "_FORMAT_OPTIONS", get_select_options_with_id($app_list_strings['format_options'], $selected_format)); $xtpl->parse($prefix . "_format"); $xtpl->out($prefix . "_format"); if ($name == 'base_format') { //Retrieve child formats $child = new Childformat(); $query = ' SELECT id,x,y FROM ' . $child->table_name . ' where parent_id="' . $parent_id . '" AND deleted=0 '; $result = $this->db->query($query, true, " Error getting format"); $data = $this->db->fetchByAssoc($result); if ($selected_format == '-') { $xtpl->parse("empty_child"); $xtpl->out("empty_child"); } elseif ($data == null) { $xtpl->parse("no_child_defined"); $xtpl->out("no_child_defined"); } else { //TO DO $app_list_strings['format_options'] = $child->Get_Dropdown_Data($parent_id); $xtpl->assign("CHILD_FORMAT_OPTIONS", get_select_options_with_id($app_list_strings['format_options'], '')); $xtpl->parse("child_format"); $xtpl->out("child_format"); } } }