예제 #1
0
 public function preDisplay()
 {
     $metadataFile = $this->getMetaDataFile();
     $this->ev = $this->getEditView();
     $this->ev->ss =& $this->ss;
     $this->ev->setup($this->module, $this->bean, $metadataFile, get_custom_file_if_exists('include/EditView/EditView.tpl'));
 }
예제 #2
0
 /**
  * Create new currency
  * Create fake Opportunity with created currency
  * Try to get select for currency field and assert that new currency is selected
  * 
  * @return void
  * @group 48570
  */
 public function testCurrencySelect()
 {
     $currency = new Currency();
     $currency->iso4217 = 'EUR';
     $currency->name = 'Euro';
     $currency->symbol = 'E';
     $currency->conversion_rate = 1.5;
     $currency->status = 'Active';
     $currency->save();
     $focus = new Opportunity();
     $focus->id = __CLASS__;
     $focus->currency_id = $currency->id;
     $focus->team_id = '1';
     $editView = new EditView();
     $editView->showVCRControl = false;
     $editView->view = 'EditView';
     $editView->setup('Opportunities', $focus);
     $editView->process();
     $currency->mark_deleted($currency->id);
     $this->assertRegExp('/<option value="' . $focus->currency_id . '" selected>/sim', $editView->fieldDefs['currency_id']['value'], 'No selected option here');
 }
예제 #3
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 = QuickSearchDefaults::getQuickSearchDefaults();
     $qsd->setFormName("ConvertLead");
     $this->contact = new Contact();
     /*
      * Setup filter for Account/Contact popup picker
      */
     $filter = '';
     // Check if Lead has an account set
     if (!empty($this->focus->account_name)) {
         $filter .= '&name_advanced=' . urlencode($this->focus->account_name);
     }
     // Check if Lead First name is available
     if (!empty($this->focus->first_name)) {
         $filter .= '&first_name_advanced=' . urlencode($this->focus->first_name);
     }
     // Lead Last Name is always available
     $filter .= '&last_name_advanced=' . urlencode($this->focus->last_name);
     $smarty->assign('initialFilter', $filter);
     $smarty->assign('displayParams', array('initial_filter' => '{$initialFilter}'));
     $relatedFields = $this->contact->get_related_fields();
     $selectFields = array();
     foreach ($this->defs as $moduleName => $mDefs) {
         if (!empty($mDefs[$ev->view]['select']) && !empty($relatedFields[$mDefs[$ev->view]['select']])) {
             $selectFields[$moduleName] = $mDefs[$ev->view]['select'];
             continue;
         }
         foreach ($relatedFields as $fDef) {
             if (!empty($fDef['link']) && !empty($fDef['module']) && $fDef['module'] == $moduleName) {
                 $selectFields[$moduleName] = $fDef['name'];
                 break;
             }
         }
     }
     $smarty->assign('selectFields', $selectFields);
     $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);
     global $mod_strings;
     $smarty->assign('MOD', $mod_strings);
     $smarty->display("modules/Leads/tpls/ConvertLeadHeader.tpl");
     echo "<div class='edit view' style='width:auto;'>";
     global $sugar_config, $app_list_strings, $app_strings;
     $smarty->assign('lead_conv_activity_opt', $sugar_config['lead_conv_activity_opt']);
     //Switch up list depending on copy or move
     if ($sugar_config['lead_conv_activity_opt'] == 'move') {
         $smarty->assign('convertModuleListOptions', get_select_options_with_id(array('None' => $app_strings['LBL_NONE'], 'Contacts' => $app_list_strings["moduleListSingular"]['Contacts']), ''));
     } else {
         if ($sugar_config['lead_conv_activity_opt'] == 'copy') {
             $smarty->assign('convertModuleListOptions', get_select_options_with_id(array('Contacts' => $app_list_strings["moduleListSingular"]['Contacts']), ''));
         }
     }
     foreach ($this->defs as $module => $vdef) {
         if (!isset($beanList[$module])) {
             continue;
         }
         $bean = $beanList[$module];
         $focus = new $bean();
         // skip if we aren't allowed to save this bean
         if (!$focus->ACLAccess('save')) {
             continue;
         }
         $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 (strpos($field, "billing_address") !== false && $focus->field_defs[$field]["type"] == "varchar") {
                                         $tmp_field = str_replace("billing_", "primary_", $field);
                                         $focus->field_defs[$field]["type"] = "text";
                                         if (isset($this->focus->{$tmp_field})) {
                                             $focus->{$field} = $this->focus->{$tmp_field};
                                         }
                                     } else {
                                         if (strpos($field, "shipping_address") !== false && $focus->field_defs[$field]["type"] == "varchar") {
                                             $tmp_field = str_replace("shipping_", "primary_", $field);
                                             if (isset($this->focus->{$tmp_field})) {
                                                 $focus->{$field} = $this->focus->{$tmp_field};
                                             }
                                             $focus->field_defs[$field]["type"] = "text";
                                         } 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();
     // need to re-assign bean as it gets overridden by $ev->display
     $smarty->assign("bean", $this->focus);
     $smarty->display("modules/Leads/tpls/ConvertLeadFooter.tpl");
 }
예제 #4
0
파일: EmailUI.php 프로젝트: NALSS/SuiteCRM
 /**
  * Renders the QuickCreate form from Smarty and returns HTML
  * @param array $vars request variable global
  * @param object $email Fetched email object
  * @param bool $addToAddressBook
  * @return array
  */
 function getQuickCreateForm($vars, $email, $addToAddressBookButton = false)
 {
     require_once "include/EditView/EditView2.php";
     global $app_strings;
     global $mod_strings;
     global $current_user;
     global $beanList;
     global $beanFiles;
     global $current_language;
     //Setup the current module languge
     $mod_strings = return_module_language($current_language, $_REQUEST['qc_module']);
     $bean = $beanList[$_REQUEST['qc_module']];
     $class = $beanFiles[$bean];
     require_once $class;
     $focus = new $bean();
     $people = array('Contact', 'Lead');
     $emailAddress = array();
     // people
     if (in_array($bean, $people)) {
         // lead specific
         $focus->lead_source = 'Email';
         $focus->lead_source_description = trim($email->name);
         $from = isset($email->from_name) && !empty($email->from_name) ? $email->from_name : $email->from_addr;
         if (isset($_REQUEST['sugarEmail']) && !empty($_REQUEST['sugarEmail'])) {
             if ($email->status == "sent") {
                 $from = isset($email->to_addrs_names) && !empty($email->to_addrs_names) ? $email->to_addrs_names : $email->to_addrs;
             } else {
                 $from = isset($email->from_name) && !empty($email->from_name) ? $email->from_name : $email->from_addr_name;
             }
         }
         $name = explode(" ", trim($from));
         $address = trim(array_pop($name));
         $address = str_replace(array("<", ">", "&lt;", "&gt;"), "", $address);
         $emailAddress[] = array('email_address' => $address, 'primary_address' => 1, 'invalid_email' => 0, 'opt_out' => 0, 'reply_to_address' => 1);
         $focus->email1 = $address;
         if (!empty($name)) {
             $focus->last_name = trim(array_pop($name));
             foreach ($name as $first) {
                 if (!empty($focus->first_name)) {
                     $focus->first_name .= " ";
                 }
                 $focus->first_name .= trim($first);
             }
         }
     } else {
         // bugs, cases, tasks
         $focus->name = trim($email->name);
     }
     $focus->description = trim(strip_tags($email->description));
     $focus->assigned_user_id = $current_user->id;
     $EditView = new EditView();
     $EditView->ss = new Sugar_Smarty();
     //MFH BUG#20283 - checks for custom quickcreate fields
     $EditView->setup($_REQUEST['qc_module'], $focus, 'custom/modules/' . $focus->module_dir . '/metadata/editviewdefs.php', 'include/EditView/EditView.tpl');
     $EditView->process();
     $EditView->render();
     $EditView->defs['templateMeta']['form']['buttons'] = array('email2save' => array('id' => 'e2AjaxSave', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_SAVE_BUTTON_LABEL'] . '   " onclick="SUGAR.email2.detailView.saveQuickCreate(false);" />'), 'email2saveandreply' => array('id' => 'e2SaveAndReply', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_EMAIL_SAVE_AND_REPLY'] . '   " onclick="SUGAR.email2.detailView.saveQuickCreate(\'reply\');" />'), 'email2cancel' => array('id' => 'e2cancel', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_EMAIL_CANCEL'] . '   " onclick="SUGAR.email2.detailView.quickCreateDialog.hide();" />'));
     if ($addToAddressBookButton) {
         $EditView->defs['templateMeta']['form']['buttons']['email2saveAddToAddressBook'] = array('id' => 'e2addToAddressBook', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_EMAIL_ADDRESS_BOOK_SAVE_AND_ADD'] . '   " onclick="SUGAR.email2.detailView.saveQuickCreate(true);" />');
     }
     //Get the module language for javascript
     if (!is_file(sugar_cached('jsLanguage/') . $_REQUEST['qc_module'] . '/' . $GLOBALS['current_language'] . '.js')) {
         require_once 'include/language/jsLanguage.php';
         jsLanguage::createModuleStringsCache($_REQUEST['qc_module'], $GLOBALS['current_language']);
     }
     $jsLanguage = getVersionedScript("cache/jsLanguage/{$_REQUEST['qc_module']}/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']);
     $EditView->view = 'EmailQCView';
     $EditView->defs['templateMeta']['form']['headerTpl'] = 'include/EditView/header.tpl';
     $EditView->defs['templateMeta']['form']['footerTpl'] = 'include/EditView/footer.tpl';
     $meta = array();
     $meta['html'] = $jsLanguage . $EditView->display(false, true);
     $meta['html'] = str_replace("src='" . getVersionedPath('include/SugarEmailAddress/SugarEmailAddress.js') . "'", '', $meta['html']);
     $meta['emailAddress'] = $emailAddress;
     $mod_strings = return_module_language($current_language, 'Emails');
     return $meta;
 }
예제 #5
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     $view = !empty($_REQUEST['target_view']) ? $_REQUEST['target_view'] : 'QuickCreate';
     $module = $_REQUEST['module'];
     // locate the best viewdefs to use: 1. custom/module/quickcreatedefs.php 2. module/quickcreatedefs.php 3. custom/module/editviewdefs.php 4. module/editviewdefs.php
     $base = 'modules/' . $module . '/metadata/';
     $source = 'custom/' . $base . strtolower($view) . 'defs.php';
     if (!file_exists($source)) {
         $source = $base . strtolower($view) . 'defs.php';
         if (!file_exists($source)) {
             //if our view does not exist default to EditView
             $view = 'EditView';
             $source = 'custom/' . $base . 'editviewdefs.php';
             if (!file_exists($source)) {
                 $source = $base . 'editviewdefs.php';
             }
         }
     }
     $ev = new EditView();
     $ev->view = $view;
     $ev->ss = new Sugar_Smarty();
     $ev->ss->assign('isDCForm', $this->_isDCForm);
     //$_REQUEST['return_action'] = 'SubPanelViewer';
     $ev->setup($module, null, $source);
     $ev->showSectionPanelsTitles = false;
     $ev->defs['templateMeta']['form']['headerTpl'] = 'include/EditView/header.tpl';
     $ev->defs['templateMeta']['form']['footerTpl'] = 'include/EditView/footer.tpl';
     $ev->defs['templateMeta']['form']['buttons'] = array('DCMENUSAVE', 'DCMENUCANCEL', 'DCMENUFULLFORM');
     $ev->defs['templateMeta']['form']['button_location'] = 'bottom';
     $ev->defs['templateMeta']['form']['hidden'] = '<input type="hidden" name="is_ajax_call" value="1" />';
     $ev->defs['templateMeta']['form']['hidden'] .= '<input type="hidden" name="from_dcmenu" value="1" />';
     $defaultProcess = true;
     if (file_exists('modules/' . $module . '/views/view.edit.php')) {
         include 'modules/' . $module . '/views/view.edit.php';
         $c = $module . 'ViewEdit';
         if (class_exists($c)) {
             $view = new $c();
             if ($view->useForSubpanel) {
                 $defaultProcess = false;
                 //Check if we shold use the module's QuickCreate.tpl file
                 if ($view->useModuleQuickCreateTemplate && file_exists('modules/' . $module . '/tpls/QuickCreate.tpl')) {
                     $ev->defs['templateMeta']['form']['headerTpl'] = 'modules/' . $module . '/tpls/QuickCreate.tpl';
                 }
                 $view->ev =& $ev;
                 $view->ss =& $ev->ss;
                 $class = $GLOBALS['beanList'][$module];
                 if (!empty($GLOBALS['beanFiles'][$class])) {
                     require_once $GLOBALS['beanFiles'][$class];
                     $bean = new $class();
                     $view->bean = $bean;
                 }
                 $view->ev->formName = 'form_DC' . $view->ev->view . '_' . $module;
                 $view->showTitle = false;
                 // Do not show title since this is for subpanel
                 $view->display();
             }
         }
     }
     //if
     if ($defaultProcess) {
         $form_name = 'form_DC' . $ev->view . '_' . $module;
         $ev->formName = $form_name;
         $ev->process(true, $form_name);
         echo $ev->display(false, true);
     }
 }
예제 #6
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");
 }
예제 #7
0
    /**
     * Renders the QuickCreate form from Smarty and returns HTML
     * @param array $vars request variable global
     * @param object $email Fetched email object
     * @param bool $addToAddressBook
     * @return array
     */
    function getQuickCreateForm($vars, $email, $addToAddressBookButton = false)
    {
        require_once "include/EditView/EditView2.php";
        global $app_strings;
        global $mod_strings;
        global $current_user;
        global $current_language;
        $module = $_REQUEST['qc_module'];
        $beanName = BeanFactory::getBeanName($module);
        //Setup the current module languge
        $mod_strings = return_module_language($current_language, $module);
        $focus = BeanFactory::getBean($module);
        $people = array('Contact', 'Lead');
        $emailAddress = array();
        // people
        if (in_array($beanName, $people)) {
            // lead specific
            $focus->lead_source = 'Email';
            $focus->lead_source_description = trim($email->name);
            $from = isset($email->from_name) && !empty($email->from_name) ? $email->from_name : $email->from_addr;
            if (isset($_REQUEST['sugarEmail']) && !empty($_REQUEST['sugarEmail'])) {
                if ($email->status == "sent") {
                    $from = isset($email->to_addrs_names) && !empty($email->to_addrs_names) ? $email->to_addrs_names : $email->to_addrs;
                } else {
                    $from = isset($email->from_name) && !empty($email->from_name) ? $email->from_name : $email->from_addr_name;
                }
            }
            $name = explode(" ", trim($from));
            $address = trim(array_pop($name));
            $address = str_replace(array("<", ">", "&lt;", "&gt;"), "", $address);
            $emailAddress[] = array('email_address' => $address, 'primary_address' => 1, 'invalid_email' => 0, 'opt_out' => 0, 'reply_to_address' => 1);
            $focus->email1 = $address;
            if (!empty($name)) {
                $focus->last_name = trim(array_pop($name));
                foreach ($name as $first) {
                    if (!empty($focus->first_name)) {
                        $focus->first_name .= " ";
                    }
                    $focus->first_name .= trim($first);
                }
            }
        } else {
            // case & bug specific
            $focus->source = 'InboundEmail';
            // bugs, cases, tasks
            $focus->name = trim($email->name);
        }
        $focus->description = trim(strip_tags($email->description));
        $focus->assigned_user_id = $current_user->id;
        $focus->team_id = $current_user->default_team;
        $EditView = new EditView();
        $EditView->ss = new Sugar_Smarty();
        //MFH BUG#20283 - checks for custom quickcreate fields
        $EditView->setup($module, $focus, SugarAutoLoader::loadWithMetafiles($module, 'editviewdefs'));
        $EditView->process();
        $EditView->render();
        $EditView->defs['templateMeta']['form']['buttons'] = array('email2save' => array('id' => 'e2AjaxSave', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_SAVE_BUTTON_LABEL'] . '   " onclick="SUGAR.email2.detailView.saveQuickCreate(false);" />'), 'email2saveandreply' => array('id' => 'e2SaveAndReply', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_EMAIL_SAVE_AND_REPLY'] . '   " onclick="SUGAR.email2.detailView.saveQuickCreate(\'reply\');" />'), 'email2cancel' => array('id' => 'e2cancel', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_EMAIL_CANCEL'] . '   " onclick="SUGAR.email2.detailView.quickCreateDialog.hide();" />'));
        if ($addToAddressBookButton) {
            $EditView->defs['templateMeta']['form']['buttons']['email2saveAddToAddressBook'] = array('id' => 'e2addToAddressBook', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_EMAIL_ADDRESS_BOOK_SAVE_AND_ADD'] . '   " onclick="SUGAR.email2.detailView.saveQuickCreate(true);" />');
        }
        //Get the module language for javascript
        if (!is_file(sugar_cached('jsLanguage/') . "{$module}/{$GLOBALS['current_language']}.js")) {
            require_once 'include/language/jsLanguage.php';
            jsLanguage::createModuleStringsCache($module, $GLOBALS['current_language']);
        }
        $jsLanguage = getVersionedScript("cache/jsLanguage/{$module}/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']);
        if ($focus->object_name == 'Contact') {
            $admin = Administration::getSettings();
            if (empty($admin->settings['portal_on']) || !$admin->settings['portal_on']) {
                unset($EditView->sectionPanels[strtoupper('lbl_portal_information')]);
            } else {
                $jsLanguage .= getVersionedScript("modules/Contacts/Contact.js");
                $jsLanguage .= getVersionedScript("modules/Contacts/QuickCreateEmailContact.js");
                $jsLanguage .= <<<EOQ
\t\t\t    <script language="javascript">
\t\t\t\t   addToValidateComparison('form_EmailQCView_Contacts', 'portal_password', 'varchar', false, SUGAR.language.get('app_strings', 'ERR_SQS_NO_MATCH_FIELD') + SUGAR.language.get('Contacts', 'LBL_PORTAL_PASSWORD'), 'portal_password1');
\t\t           addToValidateVerified('form_EmailQCView_Contacts', 'portal_name_verified', 'bool', false, SUGAR.language.get('app_strings', 'ERR_EXISTING_PORTAL_USERNAME'));
\t\t           YAHOO.util.Event.on('portal_name', 'blur', validatePortalName);
\t\t\t\t   YAHOO.util.Event.on('portal_name', 'keydown', handleKeyDown);
\t\t\t    </script>
EOQ;
            }
        }
        $EditView->view = 'EmailQCView';
        $EditView->defs['templateMeta']['form']['headerTpl'] = 'include/EditView/header.tpl';
        $EditView->defs['templateMeta']['form']['footerTpl'] = 'include/EditView/footer.tpl';
        $meta = array();
        $meta['html'] = $jsLanguage . $EditView->display(false, true);
        $meta['html'] = str_replace("src='" . getVersionedPath('include/SugarEmailAddress/SugarEmailAddress.js') . "'", '', $meta['html']);
        $meta['emailAddress'] = $emailAddress;
        $mod_strings = return_module_language($current_language, 'Emails');
        return $meta;
    }