Exemplo n.º 1
0
    $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
}
if (isset($_REQUEST['return_id'])) {
    $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
} else {
    // if no $_REQUEST['return_id'] is set, and we press "Cancel" we get an error.
    // if RETURN_ACTION is "index", we just go back to module's default page.
    $xtpl->assign("RETURN_ACTION", "index");
}
$xtpl->assign("THEME", $theme);
$xtpl->assign("IMAGE_PATH", $image_path);
$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('parent_name' => $qsd->getQSParent(), 'assigned_user_name' => $qsd->getQSUser());
$quicksearch_js = $qsd->getQSScriptsJSONAlreadyDefined();
$quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . ';changeQS();</script>';
// change the parent type of the quicksearch
$xtpl->assign("JAVASCRIPT", get_set_focus_js() . get_validate_record_js() . $quicksearch_js);
$xtpl->assign("ID", $focus->id);
if (isset($json_id) && !empty($json_id)) {
    $xtpl->assign("JSON_ID", $json_id);
    $xtpl->assign('JSON_CONFIG_JAVASCRIPT', $json_config->get_static_json_server(false, true, 'Calls', $json_id));
} else {
    $xtpl->assign("JSON_ID", $focus->id);
    $xtpl->assign('JSON_CONFIG_JAVASCRIPT', $json_config->get_static_json_server(false, true, 'Calls', $focus->id));
}
$xtpl->assign("MODULE_NAME", "Calls");
$xtpl->assign("PARENT_NAME", $focus->parent_name);
$xtpl->assign("PARENT_RECORD_TYPE", $focus->parent_type);
$xtpl->assign("PARENT_ID", $focus->parent_id);
Exemplo n.º 2
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     if (!empty($_REQUEST['handle']) && $_REQUEST['handle'] == 'save') {
         return $this->handleSave();
     }
     global $beanList;
     // get the EditView defs to check if opportunity_name exists, for a check below for populating data
     $opportunityNameInLayout = false;
     $editviewFile = 'modules/Leads/metadata/editviewdefs.php';
     $this->medataDataFile = $editviewFile;
     if (file_exists("custom/{$editviewFile}")) {
         $this->medataDataFile = "custom/{$editviewFile}";
     }
     include $this->medataDataFile;
     foreach ($viewdefs['Leads']['EditView']['panels'] as $panel_index => $section) {
         foreach ($section as $row_array) {
             foreach ($row_array as $cell) {
                 if (isset($cell['name']) && $cell['name'] == 'opportunity_name') {
                     $opportunityNameInLayout = true;
                 }
             }
         }
     }
     $this->medataDataFile = $this->fileName;
     if (file_exists("custom/{$this->fileName}")) {
         $this->medataDataFile = "custom/{$this->fileName}";
     }
     $this->loadDefs();
     $this->getRecord();
     $this->checkForDuplicates($this->focus);
     $smarty = new Sugar_Smarty();
     $ev = new EditView();
     $ev->ss = $smarty;
     $ev->view = "ConvertLead";
     echo $this->getModuleTitle();
     require_once "include/QuickSearchDefaults.php";
     $qsd = new QuickSearchDefaults();
     $qsd->setFormName("ConvertLead");
     $this->contact = new Contact();
     $smarty->assign("contact_def", $this->contact->field_defs);
     $smarty->assign("form_name", "ConvertLead");
     $smarty->assign("form_id", "ConvertLead");
     $smarty->assign("module", "Leads");
     $smarty->assign("view", "convertlead");
     $smarty->assign("bean", $this->focus);
     $smarty->assign("record_id", $this->focus->id);
     $smarty->display("modules/Leads/tpls/ConvertLeadHeader.tpl");
     echo "<div class='edit view' style='width:auto;'>";
     foreach ($this->defs as $module => $vdef) {
         if (!isset($beanList[$module])) {
             continue;
         }
         $bean = $beanList[$module];
         $focus = new $bean();
         $focus->fill_in_additional_detail_fields();
         foreach ($focus->field_defs as $field => $def) {
             if (isset($vdef[$ev->view]['copyData']) && $vdef[$ev->view]['copyData']) {
                 if ($module == "Accounts" && $field == 'name') {
                     $focus->name = $this->focus->account_name;
                 } else {
                     if ($module == "Opportunities" && $field == 'amount') {
                         $focus->amount = unformat_number($this->focus->opportunity_amount);
                     } else {
                         if ($module == "Opportunities" && $field == 'name') {
                             if ($opportunityNameInLayout && !empty($this->focus->opportunity_name)) {
                                 $focus->name = $this->focus->opportunity_name;
                             }
                         } else {
                             if ($field == "id") {
                                 //If it is not a contact, don't copy the ID from the lead
                                 if ($module == "Contacts") {
                                     $focus->{$field} = $this->focus->{$field};
                                 }
                             } else {
                                 if (is_a($focus, "Company") && $field == 'phone_office') {
                                     //Special case where company and person have the same field with a different name
                                     $focus->phone_office = $this->focus->phone_work;
                                 } else {
                                     if (isset($this->focus->{$field})) {
                                         $focus->{$field} = $this->focus->{$field};
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //Copy over email data
         $ev->setup($module, $focus, $this->medataDataFile, "modules/Leads/tpls/ConvertLead.tpl", false);
         $ev->process();
         echo $ev->display(false);
         echo $this->getValidationJS($module, $focus, $vdef[$ev->view]);
     }
     echo "</div>";
     echo $qsd->getQSScriptsJSONAlreadyDefined();
     $smarty->display("modules/Leads/tpls/ConvertLeadFooter.tpl");
 }