/**
  * Process the request for Folder opertions
  * @global <type> $list_max_entries_per_page
  * @param MailManager_Request $request
  * @return MailManager_Response
  */
 function process(MailManager_Request $request)
 {
     global $list_max_entries_per_page, $current_user;
     $response = new Vtiger_Response();
     if ('open' == $request->getOperationArg()) {
         $q = $request->get('q');
         $foldername = $request->get('_folder');
         $type = $request->get('type');
         $connector = $this->getConnector($foldername);
         $folder = $connector->folderInstance($foldername);
         if (empty($q)) {
             $connector->folderMails($folder, intval($request->get('_page', 0)), $list_max_entries_per_page);
         } else {
             if (empty($type)) {
                 $type = 'ALL';
             }
             if ($type == 'ON') {
                 $dateFormat = $current_user->date_format;
                 if ($dateFormat == 'mm-dd-yyyy') {
                     $dateArray = explode('-', $q);
                     $temp = $dateArray[0];
                     $dateArray[0] = $dateArray[1];
                     $dateArray[1] = $temp;
                     $q = implode('-', $dateArray);
                 }
                 $query = date('d M Y', strtotime($q));
                 $q = '' . $type . ' "' . vtlib_purify($query) . '"';
             } else {
                 $q = '' . $type . ' "' . vtlib_purify($q) . '"';
             }
             $connector->searchMails($q, $folder, intval($request->get('_page', 0)), $list_max_entries_per_page);
         }
         $folderList = $connector->getFolderList();
         $viewer = $this->getViewer();
         $viewer->assign('TYPE', $type);
         $viewer->assign('QUERY', $request->get('q'));
         $viewer->assign('FOLDER', $folder);
         $viewer->assign('FOLDERLIST', $folderList);
         $viewer->assign('SEARCHOPTIONS', self::getSearchOptions());
         $viewer->assign("JS_DATEFORMAT", parse_calendardate(getTranslatedString('NTC_DATE_FORMAT')));
         $response->setResult($viewer->fetch($this->getModuleTpl('FolderOpen.tpl')));
     } elseif ('drafts' == $request->getOperationArg()) {
         $q = $request->get('q');
         $type = $request->get('type');
         $page = intval($request->get('_page', 0));
         $connector = $this->getConnector('__vt_drafts');
         $folder = $connector->folderInstance();
         if (empty($q)) {
             $draftMails = $connector->getDrafts($page, $list_max_entries_per_page, $folder);
         } else {
             $draftMails = $connector->searchDraftMails($q, $type, $page, $list_max_entries_per_page, $folder);
         }
         $viewer = $this->getViewer();
         $viewer->assign('MAILS', $draftMails);
         $viewer->assign('FOLDER', $folder);
         $viewer->assign('SEARCHOPTIONS', MailManager_DraftController::getSearchOptions());
         $response->setResult($viewer->fetch($this->getModuleTpl('FolderDrafts.tpl')));
     }
     return $response;
 }
/**
 * Create HTML form to enter a new record with the minimum necessary fields.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 */
function get_new_record_form()
{
    if (!ACLController::checkAccess('Tasks', 'edit', true)) {
        return '';
    }
    require_once 'include/time.php';
    global $app_strings, $mod_strings, $app_list_strings;
    global $current_user;
    global $theme;
    // Unimplemented until jscalendar language files are fixed
    // global $current_language;
    // global $default_language;
    // global $cal_codes;
    $user_id = $current_user->id;
    $default_status = $mod_strings['LBL_DEFAULT_STATUS'];
    $default_priority = $mod_strings['LBL_DEFAULT_PRIORITY'];
    $default_parent_type = $app_list_strings['record_type_default_key'];
    // Unimplemented until jscalendar language files are fixed
    // $cal_lang = (empty($cal_codes[$current_language])) ? $cal_codes[$default_language] : $cal_codes[$current_language];
    $cal_lang = "en";
    $cal_dateformat = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
    $ntc_time_format = '(' . getDisplayTimeFormat() . ')';
    $ampm = AMPMMenu('', '');
    $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
    $the_form .= <<<EOQ
\t\t<form name="TaskSave" onSubmit="return check_form('TaskSave')" method="POST" action="index.php">
\t\t\t<input type="hidden" name="module" value="Tasks">
\t\t\t<input type="hidden" name="record" value="">
\t\t\t<input type="hidden" name="status" value="{$default_status}">
\t\t\t<input type="hidden" name="assigned_user_id" value='{$user_id}'>
\t\t\t<input type="hidden" name="priority" value="{$default_priority}">
\t\t\t<input type="hidden" name="parent_type" value="{$default_parent_type}">
\t\t\t<input type="hidden" name="action" value="Save">
\t\t\t<input type="hidden" name="date_due_flag">
\t\t<p>{$mod_strings['LBL_NEW_FORM_SUBJECT']} <span class="required">{$app_strings['LBL_REQUIRED_SYMBOL']}</span><br>
\t\t<input name='name' type="text" value=""><br>
\t\t{$mod_strings['LBL_NEW_FORM_DUE_DATE']}&nbsp;<span class="dateFormat">{$app_strings['NTC_DATE_FORMAT']}</span><br>
\t\t<input name='date_due' maxlength="10" onblur="parseDate(this, '{$cal_dateformat}');" id='jscal_field' type="text" value=""> <img src="themes/{$theme}/images/jscalendar.gif" alt="{$app_strings['LBL_ENTER_DATE']}"  id="jscal_trigger" align="absmiddle"><br>
\t\t{$mod_strings['LBL_NEW_FORM_DUE_TIME']}&nbsp;<span class="dateFormat">{$ntc_time_format}</span><br>
\t\t<input name='time_due' maxlength='5' type="text">&nbsp;{$ampm}</p>
\t\t<p><input title="{$app_strings['LBL_SAVE_BUTTON_TITLE']}" accessKey="{$app_strings['LBL_SAVE_BUTTON_KEY']}" class="button" type="submit" name="button" value="{$app_strings['LBL_SAVE_BUTTON_LABEL']}" ></p>
\t\t</form>
\t\t<script type="text/javascript">
\t\tCalendar.setup ({
\t\t\tinputField : "jscal_field", ifFormat : "{$cal_dateformat}", showsTime : false, button : "jscal_trigger", singleClick : true, step : 1
\t\t});
\t\t</script>
EOQ;
    require_once 'include/javascript/javascript.php';
    require_once 'modules/Tasks/Task.php';
    $javascript = new javascript();
    $javascript->setFormName('TaskSave');
    $javascript->setSugarBean(new Task());
    $javascript->addRequiredFields('');
    $javascript->addField('date_due', false, '');
    $javascript->addField('time_due', false, '');
    $the_form .= $javascript->getScript();
    $the_form .= get_left_form_footer();
    return $the_form;
}
Example #3
0
 public static function ReportFilters(Vtiger_Request $request, $viewer)
 {
     require_once 'modules/ITS4YouReports/FilterUtils.php';
     $adb = PearDatabase::getInstance();
     $moduleName = $request->getModule();
     $R_Data = $request->getAll();
     $record = $request->get('record');
     $viewer->assign("MODULE", $moduleName);
     $reportModel = ITS4YouReports_Record_Model::getCleanInstance($record);
     $Report_Informations = $reportModel->getReportInformations();
     $primary_module = $reportModel->getPrimaryModule();
     $primary_moduleid = $reportModel->getPrimaryModuleId();
     $current_user = Users_Record_Model::getCurrentUserModel();
     $viewer->assign("DATEFORMAT", $current_user->date_format);
     $viewer->assign("JS_DATEFORMAT", parse_calendardate(vtranslate('NTC_DATE_FORMAT')));
     // ITS4YOU-CR SlOl 10. 9. 2013 16:13:47
     $LBL_INFORMATIONS_4YOU = vtranslate("LBL_STEP7_INFO", $moduleName);
     $viewer->assign("LBL_INFORMATIONS_4YOU", $LBL_INFORMATIONS_4YOU);
     // ITS4YOU-END 10. 9. 2013 16:13:50
     $BLOCK1 = "<option selected value='Not Accessible'>" . vtranslate('LBL_NOT_ACCESSIBLE') . "</option>";
     $user_privileges_path = 'user_privileges/user_privileges_' . $current_user->id . '.php';
     if (file_exists($user_privileges_path)) {
         require $user_privileges_path;
     }
     $related_modules = $reportModel->getReportRelatedModulesList();
     $advft_criteria = array();
     if ($record != "") {
         $reportModel->getSelectedStandardCriteria($reportid);
         $stdselectedcolumn = $reportModel->getSTDSelectedColumn();
         $relatedmodulesstring = $reportModel->getRelatedModulesString();
         $BLOCK1 .= getITSPrimaryStdFilterHTML($primary_module, $stdselectedcolumn);
         $BLOCK1 .= getITSSecondaryStdFilterHTML($relatedmodulesstring, $stdselectedcolumn);
         //added to fix the ticket #5117
         $selectedcolumnvalue = '"' . $stdselectedcolumn . '"';
         if (!$is_admin && isset($stdselectedcolumn) && strpos($BLOCK1, $selectedcolumnvalue) === false) {
             $viewer->assign("BLOCK1_STD", $BLOCK1);
         }
         $stdselectedfilter = $reportModel->getSTDSelectedFilter();
         $startdate = $reportModel->getStartDate();
         $enddate = $reportModel->getEndDate();
         if ($startdate != "") {
             $viewer->assign("STARTDATE_STD", getValidDisplayDate($startdate));
         }
         if ($enddate != "") {
             $viewer->assign("ENDDATE_STD", getValidDisplayDate($enddate));
         }
         $reportModel->getGroupFilterList($reportid);
         $reportModel->getAdvancedFilterList($reportid);
         $advft_criteria = $reportModel->getSelectedAdvancedFilter($reportid);
     } else {
         $primary_module = $R_Data["reportmodule"];
         $BLOCK1 .= getITSPrimaryStdFilterHTML($primary_module);
         if (!empty($related_modules[$primary_module])) {
             foreach ($related_modules[$primary_module] as $key => $value) {
                 $BLOCK1 .= getITSSecondaryStdFilterHTML($R_Data["secondarymodule_" . $value]);
             }
         }
         $viewer->assign("BLOCK1_STD", $BLOCK1);
         $stdselectedfilter = "";
     }
     $BLOCKCRITERIA = $reportModel->getSelectedStdFilterCriteria($stdselectedfilter);
     $viewer->assign("BLOCKCRITERIA_STD", $BLOCKCRITERIA);
     $BLOCKJS = $reportModel->getCriteriaJS();
     $viewer->assign("BLOCKJS_STD", $BLOCKJS);
     ///AdvancedFilter.php
     $summaries_criteria = $reportModel->getSummariesCriteria();
     $viewer->assign("CRITERIA_GROUPS", $advft_criteria);
     $viewer->assign("EMPTY_CRITERIA_GROUPS", empty($advft_criteria));
     $viewer->assign("SUMMARIES_CRITERIA", $summaries_criteria);
     /*
     if(isset($R_Data["mode"]) && $R_Data["mode"]!=""){
         $mode = vtlib_purify($R_Data["mode"]);
     }else{
         $mode = "generate";
     }
     */
     if ($record != "") {
         $viewer->assign('MODE', 'edit');
     } else {
         $viewer->assign('MODE', 'create');
     }
     $FILTER_OPTION = getAdvCriteriaHTML();
     $viewer->assign("FOPTION", $FILTER_OPTION);
     $secondarymodule = '';
     $secondarymodules = array();
     if (!empty($related_modules[$primary_module])) {
         foreach ($related_modules[$primary_module] as $key => $value) {
             if (isset($R_Data["secondarymodule_" . $value])) {
                 $secondarymodules[] = $R_Data["secondarymodule_" . $value];
             }
         }
     }
     $reportModel->getPriModuleColumnsList($primary_module);
     if (!empty($related_modules[$primary_module])) {
         foreach ($related_modules[$primary_module] as $key => $value) {
             $secondarymodules[] = $value["id"];
         }
         $secondary_modules_str = implode(":", $secondarymodules);
     }
     $reportModel->getSecModuleColumnsList($secondary_modules_str);
     if ($mode != "ChangeSteps") {
         $Options = getPrimaryColumns($Options, $reportModel->report->primarymodule, true, $reportModel->report);
         $secondarymodules = array();
         if (!empty($reportModel->report->related_modules[$reportModel->report->primarymodule])) {
             foreach ($reportModel->report->related_modules[$reportModel->report->primarymodule] as $key => $value) {
                 $exploded_mid = explode("x", $value["id"]);
                 if (strtolower($exploded_mid[1]) != "mif") {
                     $secondarymodules[] = $value["id"];
                 }
             }
         }
         $secondarymodules_str = implode(":", $secondarymodules);
         $Options_sec = getSecondaryColumns(array(), $secondarymodules_str, $reportModel->report);
         foreach ($Options_sec as $moduleid => $sec_options) {
             $Options = array_merge($Options, $sec_options);
         }
         // ITS4YOU-CR SlOl 16. 9. 2015 10:49:04 OTHER COLUMNS
         if (isset($R_Data["selectedColumnsStr"]) && $R_Data["selectedColumnsStr"] != "") {
             $selectedColumnsStr = $R_Data["selectedColumnsStr"];
             $selectedColumnsStringDecoded = html_entity_decode($selectedColumnsStr, ENT_QUOTES, $default_charset);
             $selectedColumns_arr = explode("<_@!@_>", $selectedColumnsStringDecoded);
         } else {
             $selectedColumnsStr = $reportModel->report->reportinformations["selectedColumnsString"];
             $selectedColumnsStringDecoded = html_entity_decode($selectedColumnsStr, ENT_QUOTES, $default_charset);
             $selectedColumns_arr = explode(";", $selectedColumnsStringDecoded);
         }
         if (!empty($selectedColumns_arr)) {
             $opt_label = vtranslate("LBL_Filter_SelectedColumnsGroup", "ITS4YouReports");
             foreach ($selectedColumns_arr as $sc_key => $sc_col_str) {
                 if ($sc_col_str != "") {
                     $in_options = false;
                     foreach ($Options as $opt_group => $opt_array) {
                         if ($reportModel->report->in_multiarray($sc_col_str, $opt_array, "value") === true) {
                             $in_options = true;
                             continue;
                         }
                     }
                     if ($in_options) {
                         continue;
                     } else {
                         $Options[$opt_label][] = array("value" => $sc_col_str, "text" => $reportModel->report->getColumnStr_Label($sc_col_str));
                     }
                 }
             }
         }
         // ITS4YOU-END
         foreach ($Options as $optgroup => $optionsdata) {
             if ($COLUMNS_BLOCK_JSON != "") {
                 $COLUMNS_BLOCK_JSON .= "(|@!@|)";
             }
             $COLUMNS_BLOCK_JSON .= $optgroup;
             $COLUMNS_BLOCK_JSON .= "(|@|)";
             $COLUMNS_BLOCK_JSON .= Zend_JSON::encode($optionsdata);
         }
         $viewer->assign("COLUMNS_BLOCK_JSON", $COLUMNS_BLOCK_JSON);
         $adv_sel_fields = $reportModel->getAdvSelFields();
         $sel_fields = Zend_Json::encode($adv_sel_fields);
         $viewer->assign("SEL_FIELDS", $sel_fields);
         $default_charset = vglobal("default_charset");
         $std_filter_columns = $reportModel->getStdFilterColumns();
         $std_filter_columns_js = implode("<%jsstdjs%>", $std_filter_columns);
         $std_filter_columns_js = html_entity_decode($std_filter_columns_js, ENT_QUOTES, $default_charset);
         $viewer->assign("std_filter_columns", $std_filter_columns_js);
         $Date_Filter_Values = $reportModel->getDateFilterValues();
         $std_filter_criteria = Zend_Json::encode($Date_Filter_Values);
         $viewer->assign("std_filter_criteria", $std_filter_criteria);
     }
     $rel_fields = $reportModel->getAdvRelFields();
     $viewer->assign("REL_FIELDS", Zend_Json::encode($rel_fields));
     /*NEWS*/
     //error_reporting(63);ini_set("display_errors",1);
     $primary_module = $reportModel->report->primarymodule;
     $primary_moduleid = $reportModel->report->primarymoduleid;
     // NEW ADVANCE FILTERS START
     $reportModel->report->getGroupFilterList($reportModel->report->record);
     $reportModel->report->getAdvancedFilterList($reportModel->report->record);
     $reportModel->report->getSummariesFilterList($reportModel->report->record);
     $sel_fields = Zend_Json::encode($reportModel->report->adv_sel_fields);
     $viewer->assign("SEL_FIELDS", $sel_fields);
     if (isset($_REQUEST["reload"])) {
         $criteria_groups = $reportModel->report->getRequestCriteria($sel_fields);
     } else {
         $criteria_groups = $reportModel->report->advft_criteria;
     }
     $viewer->assign("CRITERIA_GROUPS", $criteria_groups);
     $viewer->assign("EMPTY_CRITERIA_GROUPS", empty($criteria_groups));
     $viewer->assign("SUMMARIES_CRITERIA", $reportModel->report->summaries_criteria);
     $FILTER_OPTION = getAdvCriteriaHTML();
     $viewer->assign("FOPTION", $FILTER_OPTION);
     $COLUMNS_BLOCK_JSON = $reportModel->report->getAdvanceFilterOptionsJSON($primary_module);
     $viewer->assign("COLUMNS_BLOCK", $COLUMNS_BLOCK);
     if ($mode != "ajax") {
         //echo "<div class='none' style='display:none;' id='filter_columns'>" . $COLUMNS_BLOCK_JSON . "</div>";
         //echo "<input type='hidden' name='filter_columns' id='filter_columns' value='".$COLUMNS_BLOCK_JSON."' />";
         $viewer->assign("filter_columns", $COLUMNS_BLOCK_JSON);
         $sel_fields = Zend_Json::encode($reportModel->report->adv_sel_fields);
         $viewer->assign("SEL_FIELDS", $sel_fields);
         global $default_charset;
         $std_filter_columns = $reportModel->report->getStdFilterColumns();
         $std_filter_columns_js = implode("<%jsstdjs%>", $std_filter_columns);
         $std_filter_columns_js = html_entity_decode($std_filter_columns_js, ENT_QUOTES, $default_charset);
         $viewer->assign("std_filter_columns", $std_filter_columns_js);
         $std_filter_criteria = Zend_Json::encode($reportModel->report->Date_Filter_Values);
         $viewer->assign("std_filter_criteria", $std_filter_criteria);
     }
     $rel_fields = $reportModel->report->adv_rel_fields;
     $rel_fields = Zend_Json::encode($rel_fields);
     $rel_fields = str_replace("'", "\\'", $rel_fields);
     $viewer->assign("REL_FIELDS", $rel_fields);
     // NEW ADVANCE FILTERS END
     $BLOCKJS = $reportModel->getCriteriaJS();
     $viewer->assign("BLOCKJS_STD", $BLOCKJS);
     /*NEWE*/
     return $viewer->view('ReportFilters.tpl', $moduleName, true);
 }
Example #4
0
function vtWorkflowEdit($adb, $request, $requestUrl, $current_language, $app_strings)
{
    global $theme, $current_user;
    $util = new VTWorkflowUtils();
    $image_path = "themes/{$theme}/images/";
    $module = new VTWorkflowApplication("editworkflow");
    $mod = return_module_language($current_language, $module->name);
    if (!$util->checkAdminAccess()) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
        return;
    }
    $smarty = new vtigerCRM_Smarty();
    if ($request['source'] == 'from_template') {
        $tm = new VTWorkflowTemplateManager($adb);
        $template = $tm->retrieveTemplate($request['template_id']);
        $workflow = $tm->createWorkflow($template);
    } else {
        $wfs = new VTWorkflowManager($adb);
        if (isset($request["workflow_id"])) {
            $workflow = $wfs->retrieve($request["workflow_id"]);
        } else {
            $moduleName = $request["module_name"];
            $workflow = $wfs->newWorkflow($moduleName);
        }
        $smarty->assign('ScheduledWorkflowsCount', $wfs->getScheduledWorkflowsCount());
        $smarty->assign('MaxAllowedScheduledWorkflows', $wfs->getMaxAllowedScheduledWorkflows());
        $smarty->assign('schdtime_12h', date('h:ia', strtotime(substr($workflow->schtime, 0, strrpos($workflow->schtime, ':')))));
        $schannualdates = json_decode($workflow->schannualdates);
        if (count($schannualdates) > 0) {
            $schannualdates = DateTimeField::convertToUserFormat($schannualdates[0]);
        } else {
            $schannualdates = '';
        }
        $smarty->assign('schdate', $schannualdates);
        $smarty->assign('selected_days1_31', json_decode($workflow->schdayofmonth));
        $smarty->assign('dayOfWeek', json_decode($workflow->schdayofweek));
    }
    if ($workflow == null) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
        return;
    }
    $workflow->test = addslashes($workflow->test);
    $tm = new VTTaskManager($adb);
    $tasks = $tm->getTasksForWorkflow($workflow->id);
    $smarty->assign("tasks", $tasks);
    $taskTypes = $tm->getTaskTypes($workflow->moduleName);
    $smarty->assign("taskTypes", $taskTypes);
    $smarty->assign("newTaskReturnUrl", vtlib_purify($requestUrl));
    $dayrange = array();
    for ($d = 1; $d <= 31; $d++) {
        $dayrange[$d] = $d;
    }
    $smarty->assign('days1_31', $dayrange);
    $smarty->assign('wfnexttrigger_time', DateTimeField::convertToUserFormat($workflow->nexttrigger_time));
    $smarty->assign("dateFormat", parse_calendardate($current_user->date_format));
    $smarty->assign("returnUrl", vtlib_purify($request["return_url"]));
    $smarty->assign("APP", $app_strings);
    $smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, $module->name)));
    $smarty->assign("THEME", $theme);
    $smarty->assign("IMAGE_PATH", $image_path);
    $smarty->assign("MODULE_NAME", $module->label);
    $smarty->assign("PAGE_NAME", $mod['LBL_EDIT_WORKFLOW']);
    $smarty->assign("PAGE_TITLE", $mod['LBL_EDIT_WORKFLOW_TITLE']);
    $smarty->assign("workflow", $workflow);
    $smarty->assign("saveType", isset($workflow->id) ? "edit" : "new");
    $smarty->assign("module", $module);
    $smarty->assign("WORKFLOW_TRIGGER_TYPES_HELP_LINK", WORKFLOW_TRIGGER_TYPES);
    $smarty->display("{$module->name}/EditWorkflow.tpl");
}
Example #5
0
function vtTaskEdit($adb, $request, $current_language, $app_strings)
{
    global $theme;
    $util = new VTWorkflowUtils();
    $request = vtlib_purify($request);
    // this cleans all values of the array
    $image_path = "themes/{$theme}/images/";
    $module = new VTWorkflowApplication('edittask');
    $mod = return_module_language($current_language, $module->name);
    if (!$util->checkAdminAccess()) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
        return;
    }
    $smarty = new vtigerCRM_Smarty();
    $tm = new VTTaskManager($adb);
    $smarty->assign('edit', isset($request["task_id"]));
    if (isset($request["task_id"])) {
        $task = $tm->retrieveTask($request["task_id"]);
        $taskClass = get_class($task);
        $workflowId = $task->workflowId;
    } else {
        $workflowId = $request["workflow_id"];
        $taskClass = vtlib_purifyForSql($request["task_type"]);
        $task = $tm->createTask($taskClass, $workflowId);
    }
    if ($task == null) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_TASK']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_TASK']);
        return;
    }
    $wm = new VTWorkflowManager($adb);
    $workflow = $wm->retrieve($workflowId);
    if ($workflow == null) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
        return;
    }
    $smarty->assign("workflow", $workflow);
    $smarty->assign("returnUrl", $request["return_url"]);
    $smarty->assign("task", $task);
    $smarty->assign("taskType", $taskClass);
    $smarty->assign("saveType", $request['save_type']);
    $taskTypeInstance = VTTaskType::getInstanceFromTaskType($taskClass);
    $taskTemplateClass = $tm->retrieveTemplatePath($module->name, $taskTypeInstance);
    $smarty->assign("taskTemplate", $taskTemplateClass);
    $et = VTWSEntityType::usingGlobalCurrentUser($workflow->moduleName);
    $smarty->assign("entityType", $et);
    $smarty->assign('entityName', $workflow->moduleName);
    $smarty->assign("fieldNames", $et->getFieldNames());
    $repeat_date = $task->calendar_repeat_limit_date;
    if (!empty($repeat_date)) {
        $repeat_date = DateTimeField::convertToUserFormat($repeat_date);
    }
    $smarty->assign('REPEAT_DATE', $repeat_date);
    $dateFields = array();
    $fieldTypes = $et->getFieldTypes();
    $fieldLabels = $et->getFieldLabels();
    foreach ($fieldTypes as $name => $type) {
        if ($type->type == 'Date' || $type->type == 'DateTime') {
            $dateFields[$name] = $fieldLabels[$name];
        }
    }
    $smarty->assign('dateFields', $dateFields);
    if ($task->trigger != null) {
        $trigger = $task->trigger;
        $days = $trigger['days'];
        if ($days < 0) {
            $days *= -1;
            $direction = 'before';
        } else {
            $direction = 'after';
        }
        $smarty->assign('trigger', array('days' => $days, 'direction' => $direction, 'field' => $trigger['field']));
    }
    $metaVariables = $task->getMetaVariables();
    $date = new DateTimeField(null);
    $time = substr($date->getDisplayTime(), 0, 5);
    $smarty->assign("META_VARIABLES", $metaVariables);
    $smarty->assign("SYSTEM_TIMEZONE", $db_timezone);
    $smarty->assign("USER_TIME", $task->formatTimeForTimePicker($time));
    $smarty->assign("USER_DATE", $date->getDisplayDate());
    $smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, 'Calendar'), return_module_language($current_language, $module->name)));
    $smarty->assign("APP", $app_strings);
    $smarty->assign("dateFormat", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
    $smarty->assign("IMAGE_PATH", $image_path);
    $smarty->assign("THEME", $theme);
    $smarty->assign("MODULE_NAME", $module->label);
    $smarty->assign("PAGE_NAME", $mod['LBL_EDIT_TASK']);
    $smarty->assign("PAGE_TITLE", $mod['LBL_EDIT_TASK_TITLE']);
    $users = $group = array();
    $users['user'] = get_user_array();
    $users['group'] = get_group_array();
    $smarty->assign('ASSIGNED_TO', $users);
    $smarty->assign("module", $module);
    $smarty->display("{$module->name}/EditTask.tpl");
}
Example #6
0
 * All Rights Reserved.
*
 ********************************************************************************/
require_once 'include/utils/CommonUtils.php';
require_once 'include/CustomFieldUtil.php';
require_once 'modules/Calendar/Activity.php';
require_once 'modules/Calendar/Calendar.php';
require_once 'modules/Calendar/CalendarCommon.php';
require_once "modules/Emails/mail.php";
global $theme, $mod_strings, $app_strings, $current_user, $currentModule;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
$category = getParentTab();
$userDetails = getOtherUserName($current_user->id, true);
$to_email = getUserEmailId('id', $current_user->id);
$date_format = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
$taskassignedto = getAssignedTo(9);
$eventassignedto = getAssignedTo(16);
$mysel = vtlib_purify($_REQUEST['view']);
$calendar_arr = array();
$calendar_arr['IMAGE_PATH'] = $image_path;
if (empty($mysel)) {
    if ($current_user->activity_view == "This Year") {
        $mysel = 'year';
    } else {
        if ($current_user->activity_view == "This Month") {
            $mysel = 'month';
        } else {
            if ($current_user->activity_view == "This Week") {
                $mysel = 'week';
            } else {
Example #7
0
 public function process(Vtiger_Request $request)
 {
     PDFMaker_Debugger_Model::GetInstance()->Init();
     $adb = PearDatabase::getInstance();
     $current_user = Users_Record_Model::getCurrentUserModel();
     $viewer = $this->getViewer($request);
     global $current_language;
     $step = $request->get('step');
     if ($step == "") {
         $step = "1";
     }
     $mode = $request->get('mode');
     $record = $request->get('record');
     if (isset($mode) && $mode == "Delete") {
         $sql1 = "SELECT module FROM vtiger_pdfmaker_relblocks WHERE relblockid = ?";
         $rel_module = $adb->query_result($adb->pquery($sql1, array($record)), 0, "module");
         $sql2 = "DELETE FROM vtiger_pdfmaker_relblocks WHERE relblockid = ?";
         $result = $adb->pquery($sql2, array($record));
         header("Location:index.php?module=PDFMaker&action=PDFMakerAjax&file=ListRelatedBlocks&parenttab=Tools&pdfmodule=" . $rel_module);
         exit;
     }
     if (isset($mode) && $mode == "add") {
         $sql = "SELECT * FROM vtiger_pdfmaker_relblocks WHERE relblockid = ?";
         $result = $adb->pquery($sql, array($record));
         $Blockdata = $adb->fetchByAssoc($result, 0);
         $body = $Blockdata["block"];
         $body = str_replace("RELBLOCK_START", "RELBLOCK" . $record . "_START", $body);
         $body = str_replace("RELBLOCK_END", "RELBLOCK" . $record . "_END", $body);
         //echo $body; exit;
         echo "<div id='block' style='display:none;'>" . $body . "</div>";
         echo "<script> \n\t\tvar oEditor = window.opener.CKEDITOR.instances.body; \n\t\t\n\t\tcontent = document.getElementById('block').innerHTML;\n\t\t\n\t\toEditor.insertHtml(content); \n\t\tself.close();\n\t\t</script>";
         exit;
     }
     $viewer->assign("PARENTTAB", getParentTab());
     $viewer->assign("DATEFORMAT", $current_user->get('date_format'));
     $viewer->assign("JS_DATEFORMAT", parse_calendardate(vtranslate('NTC_DATE_FORMAT')));
     $RelatedBlock = new PDFMaker_RelatedBlock_Model();
     $columns1 = "";
     if ($record) {
         $sql = "SELECT * FROM vtiger_pdfmaker_relblocks WHERE relblockid = ?";
         $result = $adb->pquery($sql, array($record));
         $Blockdata = $adb->fetchByAssoc($result, 0);
         $rel_module = $Blockdata["module"];
         $sec_module = $Blockdata["secmodule"];
         $blockname = $Blockdata["name"];
         $block = $Blockdata["block"];
         $sql2 = "SELECT * FROM vtiger_pdfmaker_relblockdatefilter WHERE datefilterid = ?";
         $result2 = $adb->pquery($sql2, array($record));
         $num_rows2 = $adb->num_rows($result2);
         if ($num_rows2 > 0) {
             $datecolumnname = $adb->query_result($result2, 0, "datecolumnname");
             $stdselectedfilter = $adb->query_result($result2, 0, "datefilter");
             $startdate = $adb->query_result($result2, 0, "startdate");
             $enddate = $adb->query_result($result2, 0, "enddate");
             if ($startdate != "" && $startdate != "0000-00-00") {
                 $viewer->assign("STARTDATE_STD", getValidDisplayDate($startdate));
             }
             if ($enddate != "" && $startdate != "0000-00-00") {
                 $viewer->assign("ENDDATE_STD", getValidDisplayDate($enddate));
             }
         }
         $module_list = $RelatedBlock->getModuleList($sec_module);
         $options1 = $RelatedBlock->getStdCriteriaByModule($sec_module, $module_list, $current_user);
         if (count($options1) > 0) {
             foreach ($options1 as $value => $label) {
                 if ($value == $datecolumnname) {
                     $sel = "selected";
                 } else {
                     $sel = "";
                 }
                 $columns1 .= "<option value='" . $value . "' " . $sel . ">" . $label . "</option>";
             }
         }
         $columns2 = "";
         foreach ($module_list as $blockid => $optgroup) {
             $options2 = $RelatedBlock->getColumnsListbyBlock($sec_module, $blockid, $rel_module, $current_user);
             if (count($options2) > 0) {
                 $columns2 .= "<optgroup label='" . $optgroup . "'>";
                 foreach ($options2 as $value => $label) {
                     $columns2 .= "<option value='" . $value . "'>" . $label . "</option>";
                 }
                 $columns2 .= "</optgroup>";
             }
         }
         $selected_columns = $this->getSelectedColumnsList($rel_module, $sec_module, $record, $current_user);
         list($sortCols, $sortOrder) = $this->getSortColumns($record, $selected_columns);
         $step = 3;
         $mode = 'edit';
         $RelatedBlock->setId($record);
         $reportModel = Reports_Record_Model::getCleanInstance('');
         $reportModel->setPrimaryModule($rel_module);
         $RelatedBlock->setPrimaryModule($rel_module);
         if (!empty($sec_module)) {
             $RelatedBlock->setSecondaryModule($sec_module);
             $reportModel->setSecondaryModule($sec_module);
         }
         $viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $RelatedBlock->transformToNewAdvancedFilter());
         $viewer->assign('PRIMARY_MODULE', $primaryModule);
         $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($reportModel);
         $primaryModuleRecordStructure = $recordStructureInstance->getPrimaryModuleRecordStructure();
         $secondaryModuleRecordStructures = $recordStructureInstance->getSecondaryModuleRecordStructure();
         $viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $primaryModuleRecordStructure);
         $viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $secondaryModuleRecordStructures);
         $viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
         $viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', Vtiger_Field_Model::getAdvancedFilterOpsByFieldType());
         $dateFilters = Vtiger_Field_Model::getDateFilterTypes();
         foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
             $comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
             $comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
             $comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $module);
             $dateFilters[$comparatorKey] = $comparatorInfo;
         }
         $viewer->assign('DATE_FILTERS', $dateFilters);
         $viewer->assign('PRIMARY_MODULE_FIELDS', $reportModel->getPrimaryModuleFields());
         $viewer->assign('SECONDARY_MODULE_FIELDS', $reportModel->getSecondaryModuleFields());
         $viewer->assign('SELECTED_SORT_FIELDS', $RelatedBlock->getSelectedSortFields());
     } else {
         $primaryModule = $request->get('primarymodule');
         $secondaryModules = $request->get('secondarymodule');
         $rel_module = $_REQUEST["pdfmodule"];
         $block = "";
         $record = "";
         $blockname = "";
         $columns = "";
         $columns2 = "";
         $selected_columns = "";
         $sortCols = "";
         $sortOrder = "";
         $stdselectedfilter = "";
         $mode = 'create';
     }
     $viewer->assign("MODE", $mode);
     $viewer->assign("RECORD", $record);
     $viewer->assign("BLOCKNAME", $blockname);
     $Related_Modules = PDFMaker_RelatedBlock_Model::getRelatedModulesList($rel_module);
     if ($record == "") {
         $sec_module = $Related_Modules[0];
     }
     $viewer->assign("SEC_MODULE", $sec_module);
     $viewer->assign("RELATED_MODULES", $Related_Modules);
     $version = PDFMaker_Version_Helper::$version;
     $viewer->assign("VERSION", $version);
     $viewer->assign("REL_MODULE", $rel_module);
     $viewer->assign("RELATEDBLOCK", $block);
     $viewer->assign("STEP", $step);
     $viewer->view('EditRelatedBlock.tpl', 'PDFMaker');
 }
    function draw($extra_tools)
    {
        global $app_list_strings, $current_language, $sugar_config, $currentModule, $action, $theme;
        $current_module_strings = return_module_language($current_language, 'Charts');
        if (isset($_REQUEST['obm_refresh'])) {
            $refresh = $_REQUEST['obm_refresh'];
        } else {
            $refresh = false;
        }
        $date_start = array();
        $datax = array();
        //get the dates to display
        global $current_user;
        $user_date_start = $current_user->getPreference('obm_date_start');
        if (!empty($user_date_start) && !isset($_REQUEST['obm_date_start'])) {
            $date_start = $user_date_start;
            Log::debug("USER PREFERENCES['obm_date_start'] is:");
            Log::debug($user_date_start);
        } elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') {
            $date_start = $_REQUEST['obm_year'] . '-01-01';
            $current_user->setPreference('obm_date_start', $date_start);
            Log::debug("_REQUEST['obm_date_start'] is:");
            Log::debug($_REQUEST['obm_date_start']);
            Log::debug("_SESSION['obm_date_start'] is:");
            Log::debug($current_user->getPreference('obm_date_start'));
        } else {
            $date_start = date('Y') . '-01-01';
        }
        $user_date_end = $current_user->getPreference('obm_date_end');
        if (!empty($user_date_end) && !isset($_REQUEST['obm_date_end'])) {
            $date_end = $user_date_end;
            Log::debug("USER PREFERENCES['obm_date_end'] is:");
            Log::debug($date_end);
        } elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') {
            $date_end = $_REQUEST['obm_year'] . '-12-31';
            $current_user->setPreference('obm_date_end', $date_end);
            Log::debug("_REQUEST['obm_date_end'] is:");
            Log::debug($_REQUEST['obm_date_end']);
            Log::debug("USER PREFERENCES['obm_date_end'] is:");
            Log::debug($current_user->getPreference('obm_date_end'));
        } else {
            $date_end = date('Y') . '-12-31';
        }
        $ids = array();
        //get list of user ids for which to display data
        $user_ids = $current_user->getPreference('obm_ids');
        if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['obm_ids'])) {
            $ids = $user_ids;
            Log::debug("USER PREFERENCES['obm_ids'] is:");
            Log::debug($user_ids);
        } elseif (isset($_REQUEST['obm_ids']) && count($_REQUEST['obm_ids']) > 0) {
            $ids = $_REQUEST['obm_ids'];
            $current_user->setPreference('obm_ids', $_REQUEST['obm_ids']);
            Log::debug("_REQUEST['obm_ids'] is:");
            Log::debug($_REQUEST['obm_ids']);
            Log::debug("USER PREFRENCES['obm_ids'] is:");
            Log::debug($current_user->getPreference('obm_ids'));
        } else {
            $ids = get_user_array(false);
            $ids = array_keys($ids);
        }
        //create unique prefix based on selected users for image files
        $id_hash = '1';
        if (isset($ids)) {
            sort($ids);
            $id_hash = crc32(implode('', $ids));
            if ($id_hash < 0) {
                $id_hash = $id_hash * -1;
            }
        }
        Log::debug("ids is:");
        Log::debug($ids);
        $id_md5 = substr(md5($current_user->id), 0, 9);
        // cn: format date_start|end to user's preferred
        global $timedate;
        $dateDisplayStart = strftime($timedate->get_user_date_format(), strtotime($date_start));
        $dateDisplayEnd = strftime($timedate->get_user_date_format(), strtotime($date_end));
        $seps = array("-", "/");
        $dates = array($date_start, $date_end);
        $dateFileNameSafe = str_replace($seps, "_", $dates);
        $cache_file_name = sugar_cached("xml/") . $current_user->getUserPrivGuid() . "_outcome_by_month_" . $dateFileNameSafe[0] . "_" . $dateFileNameSafe[1] . ".xml";
        Log::debug("cache file name is: {$cache_file_name}");
        global $app_strings;
        $tools = '<div align="right"><a href="index.php?module=' . $currentModule . '&action=' . $action . '&obm_refresh=true" class="tabFormAdvLink">' . SugarThemeRegistry::current()->getImage('refresh', 'border="0" align="absmiddle"', null, null, '.gif', $mod_strings['LBL_REFRESH']) . '&nbsp;' . $current_module_strings['LBL_REFRESH'] . '</a>&nbsp;&nbsp;<a href="javascript: toggleDisplay(\'outcome_by_month_edit\');" class="tabFormAdvLink">' . SugarThemeRegistry::current()->getImage('edit', 'border="0" align="absmiddle"', null, null, '.gif', $mod_strings['LBL_EDIT']) . '&nbsp;' . $current_module_strings['LBL_EDIT'] . '</a>&nbsp;&nbsp;' . $extra_tools . '</div>';
        ?>
	<?php 
        echo '<span onmouseover="this.style.cursor=\'move\'" id="chart_handle_' . $this->order . '">' . get_form_header($current_module_strings['LBL_YEAR_BY_OUTCOME'], $tools, false) . '</span>';
        ?>

<?php 
        $cal_lang = "en";
        $cal_dateformat = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
        if (empty($_SESSION['obm_ids'])) {
            $_SESSION['obm_ids'] = "";
        }
        ?>
<p>
<div id='outcome_by_month_edit' style='display: none;'>
<form name="outcome_by_month" action="index.php" method="post" >
<input type="hidden" name="module" value="<?php 
        echo $currentModule;
        ?>
">
<input type="hidden" name="action" value="<?php 
        echo $action;
        ?>
">
<input type="hidden" name="obm_refresh" value="true">
<input type="hidden" name="obm_date_start" value="<?php 
        if (isset($_SESSION['obm_date_start'])) {
            echo $_SESSION['obm_date_start'];
        }
        ?>
">
<input type="hidden" name="obm_date_end" value="<?php 
        if (isset($_SESSION['obm_date_end'])) {
            echo $_SESSION['obm_date_end'];
        }
        ?>
">
<table cellpadding="0" cellspacing="0" border="0" class="edit view" align="center">
<tr>
	<td valign='top' nowrap ><b><?php 
        echo $current_module_strings['LBL_YEAR'];
        ?>
</b><br><span class="dateFormat"><?php 
        echo $app_strings['NTC_YEAR_FORMAT'];
        ?>
</span></td>
	<td valign='top' ><input class="text" name="obm_year" size='12' maxlength='10' id='obm_year'  value='<?php 
        if (isset($date_start)) {
            echo substr($date_start, 0, 4);
        }
        ?>
'>&nbsp;&nbsp;</td>
	<td valign='top'><b><?php 
        echo $current_module_strings['LBL_USERS'];
        ?>
</b></td>
	<td valign='top'><select name="obm_ids[]" multiple size='3'><?php 
        echo get_select_options_with_id(get_user_array(false), $ids);
        ?>
</select></td>
	<td align="right" valign="top"><input class="button" onclick="return verify_chart_data_outcome_by_month();" type="submit" title="<?php 
        echo $app_strings['LBL_SELECT_BUTTON_TITLE'];
        ?>
" value="<?php 
        echo $app_strings['LBL_SELECT_BUTTON_LABEL'];
        ?>
" /><input class="button" onClick="javascript: toggleDisplay('outcome_by_month_edit');" type="button" title="<?php 
        echo $app_strings['LBL_CANCEL_BUTTON_TITLE'];
        ?>
" accessKey="<?php 
        echo $app_strings['LBL_CANCEL_BUTTON_KEY'];
        ?>
" value="<?php 
        echo $app_strings['LBL_CANCEL_BUTTON_LABEL'];
        ?>
"/></td>
</tr>
</table>
</form>

</div>
</p>
<?php 
        // draw chart
        echo "<p align='center'>" . $this->gen_xml($date_start, $date_end, $ids, $cache_file_name, $refresh, $current_module_strings) . "</p>";
        echo "<P align='center'><span class='chartFootnote'>" . $current_module_strings['LBL_MONTH_BY_OUTCOME_DESC'] . "</span></P>";
        ?>


<?php 
        if (file_exists($cache_file_name)) {
            $file_date = $timedate->asUser($timedate->fromTimestamp(filemtime($cache_file_name)));
        } else {
            $file_date = '';
        }
        ?>

<span class='chartFootnote'>
<p align="right"><i><?php 
        echo $current_module_strings['LBL_CREATED_ON'] . ' ' . $file_date;
        ?>
</i></p>
</span>
<?php 
        echo get_validate_chart_js();
    }
Example #9
0
 $list_report_form->assign("MOD", $mod_strings);
 $list_report_form->assign("APP", $app_strings);
 $list_report_form->assign("IMAGE_PATH", $image_path);
 $list_report_form->assign("REPORTID", $reportid);
 $list_report_form->assign("IS_EDITABLE", $ogReport->is_editable);
 $list_report_form->assign("REP_FOLDERS", $ogReport->sgetRptFldr());
 $list_report_form->assign("REPORTNAME", htmlspecialchars($ogReport->reportname, ENT_QUOTES, $default_charset));
 if (is_array($sshtml)) {
     $list_report_form->assign("REPORTHTML", $sshtml);
 } else {
     $list_report_form->assign("ERROR_MSG", getTranslatedString('LBL_REPORT_GENERATION_FAILED', $currentModule) . "<br>" . $sshtml);
 }
 $list_report_form->assign("REPORTTOTHTML", $totalhtml);
 $list_report_form->assign("FOLDERID", $folderid);
 $list_report_form->assign("DATEFORMAT", $current_user->date_format);
 $list_report_form->assign("JS_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
 if ($modules_export_permitted == true) {
     $list_report_form->assign("EXPORT_PERMITTED", "YES");
 } else {
     $list_report_form->assign("EXPORT_PERMITTED", "NO");
 }
 $rep_in_fldr = $ogReport->sgetRptsforFldr($folderid);
 for ($i = 0; $i < count($rep_in_fldr); $i++) {
     $rep_id = $rep_in_fldr[$i]['reportid'];
     $rep_name = $rep_in_fldr[$i]['reportname'];
     $reports_array[$rep_id] = $rep_name;
 }
 $list_report_form->assign('CHECK', Button_Check($ogReport->primodule));
 if ($_REQUEST['mode'] != 'ajax') {
     $list_report_form->assign("REPINFOLDER", $reports_array);
     include 'modules/Vtiger/header.php';
Example #10
0
/** This function returns the vtiger_field details for a given vtiger_fieldname.
 * Param $uitype - UI type of the vtiger_field
 * Param $fieldname - Form vtiger_field name
 * Param $fieldlabel - Form vtiger_field label name
 * Param $maxlength - maximum length of the vtiger_field
 * Param $col_fields - array contains the vtiger_fieldname and values
 * Param $generatedtype - Field generated type (default is 1)
 * Param $module_name - module name
 * Return type is an array
 */
function getOutputHtml($uitype, $fieldname, $fieldlabel, $maxlength, $col_fields, $generatedtype, $module_name, $mode = '', $typeofdata = null)
{
    global $log, $app_strings, $adb, $default_charset, $theme, $mod_strings, $current_user;
    $log->debug("Entering getOutputHtml(" . $uitype . "," . $fieldname . "," . $fieldlabel . "," . $maxlength . "," . print_r($col_fields, true) . "," . $generatedtype . "," . $module_name . ") method ...");
    require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $fieldlabel = from_html($fieldlabel);
    $fieldvalue = array();
    $final_arr = array();
    $value = $col_fields[$fieldname];
    $custfld = '';
    $ui_type[] = $uitype;
    $editview_fldname[] = $fieldname;
    // vtlib customization: Related type field
    if ($uitype == '10') {
        global $adb;
        $fldmod_result = $adb->pquery('SELECT relmodule, status FROM vtiger_fieldmodulerel WHERE fieldid=
			(SELECT fieldid FROM vtiger_field, vtiger_tab WHERE vtiger_field.tabid=vtiger_tab.tabid AND fieldname=? AND name=? and vtiger_field.presence in (0,2)) order by sequence', array($fieldname, $module_name));
        $entityTypes = array();
        $parent_id = $value;
        for ($index = 0; $index < $adb->num_rows($fldmod_result); ++$index) {
            $entityTypes[] = $adb->query_result($fldmod_result, $index, 'relmodule');
        }
        if (!empty($value)) {
            if ($adb->num_rows($fldmod_result) == 1) {
                $valueType = $adb->query_result($fldmod_result, 0, 0);
            } else {
                $valueType = getSalesEntityType($value);
            }
            $displayValueArray = getEntityName($valueType, $value);
            if (!empty($displayValueArray)) {
                foreach ($displayValueArray as $key => $value) {
                    $displayValue = $value;
                }
            }
        } else {
            $displayValue = '';
            $valueType = '';
            $value = '';
        }
        $editview_label[] = array('options' => $entityTypes, 'selected' => $valueType, 'displaylabel' => getTranslatedString($fieldlabel, $module_name));
        $fieldvalue[] = array('displayvalue' => $displayValue, 'entityid' => $parent_id);
    } else {
        if ($uitype == 5 || $uitype == 6 || $uitype == 23) {
            $log->info("uitype is " . $uitype);
            if ($value == '') {
                //modified to fix the issue in trac(http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/1469)
                if ($fieldname != 'birthday' && $generatedtype != 2 && getTabid($module_name) != 14) {
                    $disp_value = getNewDisplayDate();
                }
                if (($module_name == 'Events' || $module_name == 'Calendar') && $uitype == 6) {
                    $curr_time = date('H:i', strtotime('+5 minutes'));
                }
                if (($module_name == 'Events' || $module_name == 'Calendar') && $uitype == 23) {
                    $curr_time = date('H:i', strtotime('+10 minutes'));
                }
                //Added to display the Contact - Support End Date as one year future instead of
                //today's date -- 30-11-2005
                if ($fieldname == 'support_end_date' && $_REQUEST['module'] == 'Contacts') {
                    $addyear = strtotime("+1 year");
                    $disp_value = DateTimeField::convertToUserFormat(date('Y-m-d', $addyear));
                } elseif ($fieldname == 'validtill' && $_REQUEST['module'] == 'Quotes') {
                    $disp_value = '';
                }
            } else {
                if ($uitype == 6) {
                    if ($col_fields['time_start'] != '' && ($module_name == 'Events' || $module_name == 'Calendar')) {
                        $curr_time = $col_fields['time_start'];
                        $value = $value . ' ' . $curr_time;
                    } else {
                        $curr_time = date('H:i', strtotime('+5 minutes'));
                    }
                }
                if (($module_name == 'Events' || $module_name == 'Calendar') && $uitype == 23) {
                    if ($col_fields['time_end'] != '') {
                        $curr_time = $col_fields['time_end'];
                        $value = $value . ' ' . $curr_time;
                    } else {
                        $curr_time = date('H:i', strtotime('+10 minutes'));
                    }
                }
                $disp_value = getValidDisplayDate($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $date_format = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
            if (!empty($curr_time)) {
                if (($module_name == 'Events' || $module_name == 'Calendar') && ($uitype == 23 || $uitype == 6)) {
                    $curr_time = DateTimeField::convertToUserTimeZone($curr_time);
                    $curr_time = $curr_time->format('H:i');
                }
            } else {
                $curr_time = '';
            }
            if (empty($disp_value)) {
                $disp_value = '';
            }
            $fieldvalue[] = array($disp_value => $curr_time);
            if ($uitype == 5 || $uitype == 23) {
                if ($module_name == 'Events' && $uitype == 23) {
                    $fieldvalue[] = array($date_format => $current_user->date_format . ' ' . $app_strings['YEAR_MONTH_DATE']);
                } else {
                    $fieldvalue[] = array($date_format => $current_user->date_format);
                }
            } else {
                $fieldvalue[] = array($date_format => $current_user->date_format . ' ' . $app_strings['YEAR_MONTH_DATE']);
            }
        } elseif ($uitype == 16) {
            require_once 'modules/PickList/PickListUtils.php';
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldname = $adb->sql_escape_string($fieldname);
            $pick_query = "select {$fieldname} from vtiger_{$fieldname} order by sortorderid";
            $params = array();
            $pickListResult = $adb->pquery($pick_query, $params);
            $noofpickrows = $adb->num_rows($pickListResult);
            $options = array();
            $pickcount = 0;
            $found = false;
            for ($j = 0; $j < $noofpickrows; $j++) {
                $value = decode_html($value);
                $pickListValue = decode_html($adb->query_result($pickListResult, $j, strtolower($fieldname)));
                if ($value == trim($pickListValue)) {
                    $chk_val = "selected";
                    $pickcount++;
                    $found = true;
                } else {
                    $chk_val = '';
                }
                $pickListValue = to_html($pickListValue);
                if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
                    $options[] = array(htmlentities(getTranslatedString($pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
                } else {
                    $options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val);
                }
            }
            $fieldvalue[] = $options;
        } elseif ($uitype == 1613) {
            require_once 'modules/PickList/PickListUtils.php';
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldname = $adb->sql_escape_string($fieldname);
            $pickListResult = getAllowedPicklistModules();
            $options = array();
            $options[] = "";
            $pickcount = 0;
            $found = false;
            foreach ($pickListResult as $pKey => $pValue) {
                $value = decode_html($value);
                $pickListValue = decode_html($pValue);
                if ($value == trim($pickListValue)) {
                    $chk_val = "selected";
                    $pickcount++;
                    $found = true;
                } else {
                    $chk_val = '';
                }
                $pickListValue = to_html($pickListValue);
                if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
                    $options[] = array(htmlentities(getTranslatedString($pickListValue, $pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
                } else {
                    $options[] = array(getTranslatedString($pickListValue, $pickListValue), $pickListValue, $chk_val);
                }
            }
            uasort($options, function ($a, $b) {
                return strtolower($a[0]) < strtolower($b[0]) ? -1 : 1;
            });
            $fieldvalue[] = $options;
        } elseif ($uitype == 15 || $uitype == 33) {
            require_once 'modules/PickList/PickListUtils.php';
            $roleid = $current_user->roleid;
            $picklistValues = getAssignedPicklistValues($fieldname, $roleid, $adb);
            $valueArr = explode("|##|", $value);
            foreach ($valueArr as $key => $value) {
                $valueArr[$key] = trim(html_entity_decode($value, ENT_QUOTES, $default_charset));
            }
            $pickcount = 0;
            if (!empty($picklistValues)) {
                foreach ($picklistValues as $order => $pickListValue) {
                    if (in_array(trim($pickListValue), $valueArr)) {
                        $chk_val = "selected";
                        $pickcount++;
                    } else {
                        $chk_val = '';
                    }
                    if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
                        $options[] = array(htmlentities(getTranslatedString($pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
                    } else {
                        $options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val);
                    }
                }
                if ($pickcount == 0 && !empty($value)) {
                    $options[] = array($app_strings['LBL_NOT_ACCESSIBLE'], $value, 'selected');
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $options;
        } elseif ($uitype == 3313) {
            require_once 'modules/PickList/PickListUtils.php';
            $picklistValues = getAllowedPicklistModules();
            $valueArr = explode("|##|", $value);
            foreach ($valueArr as $key => $value) {
                $valueArr[$key] = trim(html_entity_decode($value, ENT_QUOTES, $default_charset));
            }
            $pickcount = 0;
            if (!empty($picklistValues)) {
                foreach ($picklistValues as $order => $pickListValue) {
                    if (in_array(trim($pickListValue), $valueArr)) {
                        $chk_val = "selected";
                        $pickcount++;
                    } else {
                        $chk_val = '';
                    }
                    if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
                        $options[] = array(htmlentities(getTranslatedString($pickListValue, $pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
                    } else {
                        $options[] = array(getTranslatedString($pickListValue, $pickListValue), $pickListValue, $chk_val);
                    }
                }
                if ($pickcount == 0 && !empty($value)) {
                    $options[] = array($app_strings['LBL_NOT_ACCESSIBLE'], $value, 'selected');
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            uasort($options, function ($a, $b) {
                return strtolower($a[0]) < strtolower($b[0]) ? -1 : 1;
            });
            $fieldvalue[] = $options;
        } elseif ($uitype == 1024) {
            $options = array();
            $arr_evo = explode(' |##| ', $value);
            $roleid = $current_user->roleid;
            $subrole = getRoleSubordinates($roleid);
            $uservalues = array_merge($subrole, array($roleid));
            for ($i = 0; $i < sizeof($uservalues); $i++) {
                $currentValId = $uservalues[$i];
                $currentValName = getRoleName($currentValId);
                if (in_array(trim($currentValId), $arr_evo)) {
                    $chk_val = 'selected';
                } else {
                    $chk_val = '';
                }
                $options[] = array($currentValName, $currentValId, $chk_val);
            }
            $fieldvalue[] = $options;
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
        } elseif ($uitype == 17) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 85) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 14) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 19 || $uitype == 20) {
            if (isset($_REQUEST['body'])) {
                $value = $_REQUEST['body'];
            }
            if ($fieldname == 'terms_conditions') {
                //Assign the value from focus->column_fields (if we create Invoice from SO the SO's terms and conditions will be loaded to Invoice's terms and conditions, etc.,)
                $value = $col_fields['terms_conditions'];
                //if the value is empty then only we should get the default Terms and Conditions
                if ($value == '' && $mode != 'edit') {
                    $value = getTermsandConditions();
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 21 || $uitype == 24) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 22) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 52 || $uitype == 77) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            global $current_user;
            if ($value != '') {
                $assigned_user_id = $value;
            } else {
                $assigned_user_id = $current_user->id;
            }
            if ($uitype == 52) {
                $combo_lbl_name = 'assigned_user_id';
            } elseif ($uitype == 77) {
                $combo_lbl_name = 'assigned_user_id1';
            }
            //Control will come here only for Products - Handler and Quotes - Inventory Manager
            if ($is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module_name)] == 3 or $defaultOrgSharingPermission[getTabid($module_name)] == 0)) {
                $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $assigned_user_id, 'private'), $assigned_user_id);
            } else {
                $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $assigned_user_id), $assigned_user_id);
            }
            $fieldvalue[] = $users_combo;
        } elseif ($uitype == 53) {
            global $noof_group_rows;
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            //Security Checks
            if ($fieldname == 'assigned_user_id' && $is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module_name)] == 3 or $defaultOrgSharingPermission[getTabid($module_name)] == 0)) {
                $result = get_current_user_access_groups($module_name);
            } else {
                $result = get_group_options();
            }
            if ($result) {
                $nameArray = $adb->fetch_array($result);
            }
            $assigned_user_id = empty($value) ? $current_user->id : $value;
            if ($fieldname == 'assigned_user_id' && $is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module_name)] == 3 or $defaultOrgSharingPermission[getTabid($module_name)] == 0)) {
                $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $assigned_user_id, 'private'), $assigned_user_id);
            } else {
                $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $assigned_user_id), $assigned_user_id);
            }
            if ($noof_group_rows != 0) {
                if ($fieldname == 'assigned_user_id' && $is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module_name)] == 3 or $defaultOrgSharingPermission[getTabid($module_name)] == 0)) {
                    $groups_combo = get_select_options_array(get_group_array(FALSE, "Active", $assigned_user_id, 'private'), $assigned_user_id);
                } else {
                    $groups_combo = get_select_options_array(get_group_array(FALSE, "Active", $assigned_user_id), $assigned_user_id);
                }
            }
            $fieldvalue[] = $users_combo;
            $fieldvalue[] = $groups_combo;
        } elseif ($uitype == 51 || $uitype == 50 || $uitype == 73) {
            if (!isset($_REQUEST['convertmode']) || $_REQUEST['convertmode'] != 'update_quote_val' && $_REQUEST['convertmode'] != 'update_so_val') {
                if (isset($_REQUEST['account_id']) && $_REQUEST['account_id'] != '') {
                    $value = vtlib_purify($_REQUEST['account_id']);
                }
            }
            if ($value != '') {
                $account_name = getAccountName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $account_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 54) {
            $options = array();
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $pick_query = "select * from vtiger_groups";
            $pickListResult = $adb->pquery($pick_query, array());
            $noofpickrows = $adb->num_rows($pickListResult);
            for ($j = 0; $j < $noofpickrows; $j++) {
                $pickListValue = $adb->query_result($pickListResult, $j, "name");
                if ($value == $pickListValue) {
                    $chk_val = "selected";
                } else {
                    $chk_val = '';
                }
                $options[] = array($pickListValue => $chk_val);
            }
            $fieldvalue[] = $options;
        } elseif ($uitype == 55 || $uitype == 255) {
            require_once 'modules/PickList/PickListUtils.php';
            if ($uitype == 255) {
                $fieldpermission = getFieldVisibilityPermission($module_name, $current_user->id, 'firstname', 'readwrite');
            }
            if ($uitype == 255 && $fieldpermission == '0') {
                $fieldvalue[] = '';
            } else {
                $fieldpermission = getFieldVisibilityPermission($module_name, $current_user->id, 'salutationtype', 'readwrite');
                if ($fieldpermission == '0') {
                    $roleid = $current_user->roleid;
                    $picklistValues = getAssignedPicklistValues('salutationtype', $roleid, $adb);
                    $pickcount = 0;
                    $salt_value = $col_fields["salutationtype"];
                    foreach ($picklistValues as $order => $pickListValue) {
                        if ($salt_value == trim($pickListValue)) {
                            $chk_val = "selected";
                            $pickcount++;
                        } else {
                            $chk_val = '';
                        }
                        if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
                            $options[] = array(htmlentities(getTranslatedString($pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
                        } else {
                            $options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val);
                        }
                    }
                    if ($pickcount == 0 && $salt_value != '') {
                        $options[] = array($app_strings['LBL_NOT_ACCESSIBLE'], $salt_value, 'selected');
                    }
                    $fieldvalue[] = $options;
                } else {
                    $fieldvalue[] = '';
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 59) {
            if ($_REQUEST['module'] == 'HelpDesk') {
                if (isset($_REQUEST['product_id']) & $_REQUEST['product_id'] != '') {
                    $value = $_REQUEST['product_id'];
                }
            } elseif (isset($_REQUEST['parent_id']) & $_REQUEST['parent_id'] != '') {
                $value = vtlib_purify($_REQUEST['parent_id']);
            }
            if ($value != '') {
                $product_name = getProductName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $product_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 63) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            if ($value == '') {
                $value = 1;
            }
            $options = array();
            $pick_query = "select * from vtiger_duration_minutes order by sortorderid";
            $pickListResult = $adb->pquery($pick_query, array());
            $noofpickrows = $adb->num_rows($pickListResult);
            $salt_value = $col_fields["duration_minutes"];
            for ($j = 0; $j < $noofpickrows; $j++) {
                $pickListValue = $adb->query_result($pickListResult, $j, "duration_minutes");
                if ($salt_value == $pickListValue) {
                    $chk_val = "selected";
                } else {
                    $chk_val = '';
                }
                $options[$pickListValue] = $chk_val;
            }
            $fieldvalue[] = $value;
            $fieldvalue[] = $options;
        } elseif ($uitype == 64) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $date_format = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
            $fieldvalue[] = $value;
        } elseif ($uitype == 156) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
            $fieldvalue[] = $is_admin;
        } elseif ($uitype == 56) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 57) {
            if ($value != '') {
                $displayValueArray = getEntityName('Contacts', $value);
                if (!empty($displayValueArray)) {
                    foreach ($displayValueArray as $key => $field_value) {
                        $contact_name = $field_value;
                    }
                }
            } elseif (isset($_REQUEST['contact_id']) && $_REQUEST['contact_id'] != '') {
                if ($_REQUEST['module'] == 'Contacts' && ($fieldname = 'contact_id')) {
                    $contact_name = '';
                } else {
                    $value = $_REQUEST['contact_id'];
                    $displayValueArray = getEntityName('Contacts', $value);
                    if (!empty($displayValueArray)) {
                        foreach ($displayValueArray as $key => $field_value) {
                            $contact_name = $field_value;
                        }
                    } else {
                        $contact_name = '';
                    }
                }
            }
            //Checking for contacts duplicate
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $contact_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 58) {
            if ($value != '') {
                $campaign_name = getCampaignName($value);
            } elseif (isset($_REQUEST['campaignid']) && $_REQUEST['campaignid'] != '') {
                if ($_REQUEST['module'] == 'Campaigns' && ($fieldname = 'campaignid')) {
                    $campaign_name = '';
                } else {
                    $value = $_REQUEST['campaignid'];
                    $campaign_name = getCampaignName($value);
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $campaign_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 61) {
            if ($value != '') {
                $assigned_user_id = $value;
            } else {
                $assigned_user_id = $current_user->id;
            }
            if ($module_name == 'Emails' && $col_fields['record_id'] != '') {
                $attach_result = $adb->pquery("select * from vtiger_seattachmentsrel where crmid = ?", array($col_fields['record_id']));
                //to fix the issue in mail attachment on forwarding mails
                if (isset($_REQUEST['forward']) && $_REQUEST['forward'] != '') {
                    global $att_id_list;
                }
                for ($ii = 0; $ii < $adb->num_rows($attach_result); $ii++) {
                    $attachmentid = $adb->query_result($attach_result, $ii, 'attachmentsid');
                    if ($attachmentid != '') {
                        $attachquery = "select * from vtiger_attachments where attachmentsid=?";
                        $attachmentsname = $adb->query_result($adb->pquery($attachquery, array($attachmentid)), 0, 'name');
                        if ($attachmentsname != '') {
                            $fieldvalue[$attachmentid] = '[ ' . $attachmentsname . ' ]';
                        }
                        if (isset($_REQUEST['forward']) && $_REQUEST['forward'] != '') {
                            $att_id_list .= $attachmentid . ';';
                        }
                    }
                }
            } else {
                if ($col_fields['record_id'] != '') {
                    $attachmentid = $adb->query_result($adb->pquery("select * from vtiger_seattachmentsrel where crmid = ?", array($col_fields['record_id'])), 0, 'attachmentsid');
                    if ($col_fields[$fieldname] == '' && $attachmentid != '') {
                        $attachquery = "select * from vtiger_attachments where attachmentsid=?";
                        $value = $adb->query_result($adb->pquery($attachquery, array($attachmentid)), 0, 'name');
                    }
                }
                if ($value != '') {
                    $filename = ' [ ' . $value . ' ]';
                }
                if ($filename != '') {
                    $fieldvalue[] = $filename;
                }
                if ($value != '') {
                    $fieldvalue[] = $value;
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
        } elseif ($uitype == 28) {
            if ($col_fields['record_id'] != '') {
                $attachmentid = $adb->query_result($adb->pquery("select * from vtiger_seattachmentsrel where crmid = ?", array($col_fields['record_id'])), 0, 'attachmentsid');
                if ($col_fields[$fieldname] == '' && $attachmentid != '') {
                    $attachquery = "select * from vtiger_attachments where attachmentsid=?";
                    $value = $adb->query_result($adb->pquery($attachquery, array($attachmentid)), 0, 'name');
                }
            }
            if ($value != '' && $module_name != 'Documents') {
                $filename = ' [ ' . $value . ' ]';
            } elseif ($value != '' && $module_name == 'Documents') {
                $filename = $value;
            }
            if ($filename != '') {
                $fieldvalue[] = $filename;
            }
            if ($value != '') {
                $fieldvalue[] = $value;
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
        } elseif ($uitype == 69) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            if ($col_fields['record_id'] != "") {
                if ($module_name == 'Products') {
                    $query = 'select vtiger_attachments.path, vtiger_attachments.attachmentsid, vtiger_attachments.name ,vtiger_crmentity.setype from vtiger_products left join vtiger_seattachmentsrel on vtiger_seattachmentsrel.crmid=vtiger_products.productid inner join vtiger_attachments on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_attachments.attachmentsid where vtiger_crmentity.setype="Products Image" and productid=?';
                    $params = array($col_fields['record_id']);
                } else {
                    if ($module_name == 'Contacts') {
                        $imageattachment = 'Image';
                    } else {
                        $imageattachment = 'Attachment';
                    }
                    $query = "select vtiger_attachments.*,vtiger_crmentity.setype\n\t\t\t\t from vtiger_attachments\n\t\t\t\t inner join vtiger_seattachmentsrel on vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid\n\t\t\t\t inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_attachments.attachmentsid\n\t\t\t\t where vtiger_crmentity.setype='{$module_name} {$imageattachment}'\n\t\t\t\t  and vtiger_attachments.name = ?\n\t\t\t\t  and vtiger_seattachmentsrel.crmid=?";
                    $params = array($col_fields[$fieldname], $col_fields['record_id']);
                }
                $result_image = $adb->pquery($query, $params);
                for ($image_iter = 0; $image_iter < $adb->num_rows($result_image); $image_iter++) {
                    $image_id_array[] = $adb->query_result($result_image, $image_iter, 'attachmentsid');
                    //decode_html  - added to handle UTF-8   characters in file names
                    //urlencode    - added to handle special characters like #, %, etc.,
                    $image_array[] = urlencode(decode_html($adb->query_result($result_image, $image_iter, 'name')));
                    $image_orgname_array[] = decode_html($adb->query_result($result_image, $image_iter, 'name'));
                    $image_path_array[] = $adb->query_result($result_image, $image_iter, 'path');
                }
                if (is_array($image_array)) {
                    for ($img_itr = 0; $img_itr < count($image_array); $img_itr++) {
                        $fieldvalue[] = array('name' => $image_array[$img_itr], 'path' => $image_path_array[$img_itr] . $image_id_array[$img_itr] . "_", "orgname" => $image_orgname_array[$img_itr]);
                    }
                } else {
                    $fieldvalue[] = '';
                }
            } else {
                $fieldvalue[] = '';
            }
        } elseif ($uitype == 62) {
            if (isset($_REQUEST['parent_id']) && $_REQUEST['parent_id'] != '') {
                $value = vtlib_purify($_REQUEST['parent_id']);
            }
            if ($value != '') {
                $parent_module = getSalesEntityType($value);
            }
            if (isset($_REQUEST['account_id']) && $_REQUEST['account_id'] != '') {
                $parent_module = "Accounts";
                $value = $_REQUEST['account_id'];
            }
            if ($parent_module != 'Contacts') {
                if ($parent_module == "Leads") {
                    $displayValueArray = getEntityName($parent_module, $value);
                    if (!empty($displayValueArray)) {
                        foreach ($displayValueArray as $key => $field_value) {
                            $parent_name = $field_value;
                        }
                    }
                    $lead_selected = "selected";
                } elseif ($parent_module == "Accounts") {
                    $sql = "select * from vtiger_account where accountid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "accountname");
                    $account_selected = "selected";
                } elseif ($parent_module == "Potentials") {
                    $sql = "select * from vtiger_potential where potentialid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "potentialname");
                    $potential_selected = "selected";
                } elseif ($parent_module == "Products") {
                    $sql = "select * from vtiger_products where productid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "productname");
                    $product_selected = "selected";
                } elseif ($parent_module == "PurchaseOrder") {
                    $sql = "select * from vtiger_purchaseorder where purchaseorderid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "subject");
                    $porder_selected = "selected";
                } elseif ($parent_module == "SalesOrder") {
                    $sql = "select * from vtiger_salesorder where salesorderid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "subject");
                    $sorder_selected = "selected";
                } elseif ($parent_module == "Invoice") {
                    $sql = "select * from vtiger_invoice where invoiceid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "subject");
                    $invoice_selected = "selected";
                } elseif ($parent_module == "Quotes") {
                    $sql = "select * from vtiger_quotes where quoteid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "subject");
                    $quote_selected = "selected";
                } elseif ($parent_module == "HelpDesk") {
                    $sql = "select * from vtiger_troubletickets where ticketid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "title");
                    $ticket_selected = "selected";
                }
            }
            $editview_label[] = array($app_strings['COMBO_LEADS'], $app_strings['COMBO_ACCOUNTS'], $app_strings['COMBO_POTENTIALS'], $app_strings['COMBO_PRODUCTS'], $app_strings['COMBO_INVOICES'], $app_strings['COMBO_PORDER'], $app_strings['COMBO_SORDER'], $app_strings['COMBO_QUOTES'], $app_strings['COMBO_HELPDESK']);
            $editview_label[] = array($lead_selected, $account_selected, $potential_selected, $product_selected, $invoice_selected, $porder_selected, $sorder_selected, $quote_selected, $ticket_selected);
            $editview_label[] = array("Leads&action=Popup", "Accounts&action=Popup", "Potentials&action=Popup", "Products&action=Popup", "Invoice&action=Popup", "PurchaseOrder&action=Popup", "SalesOrder&action=Popup", "Quotes&action=Popup", "HelpDesk&action=Popup");
            $fieldvalue[] = $parent_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 66) {
            if (!empty($_REQUEST['parent_id'])) {
                $value = vtlib_purify($_REQUEST['parent_id']);
            }
            if (!empty($value)) {
                $parent_module = getSalesEntityType($value);
                if ($parent_module != "Contacts") {
                    $entity_names = getEntityName($parent_module, $value);
                    $parent_name = $entity_names[$value];
                    $fieldvalue[] = $parent_name;
                    $fieldvalue[] = $value;
                }
            }
            // Check for vtiger_activity type if task orders to be added in select option
            $act_mode = $_REQUEST['activity_mode'];
            $parentModulesList = array('Leads' => $app_strings['COMBO_LEADS'], 'Accounts' => $app_strings['COMBO_ACCOUNTS'], 'Potentials' => $app_strings['COMBO_POTENTIALS'], 'HelpDesk' => $app_strings['COMBO_HELPDESK'], 'Campaigns' => $app_strings['COMBO_CAMPAIGNS'], 'Vendors' => $app_strings['COMBO_VENDORS']);
            if ($act_mode == "Task") {
                $parentModulesList['Quotes'] = $app_strings['COMBO_QUOTES'];
                $parentModulesList['PurchaseOrder'] = $app_strings['COMBO_PORDER'];
                $parentModulesList['SalesOrder'] = $app_strings['COMBO_SORDER'];
                $parentModulesList['Invoice'] = $app_strings['COMBO_INVOICES'];
            }
            $parentModuleNames = array_keys($parentModulesList);
            $parentModuleLabels = array_values($parentModulesList);
            $editview_label[0] = $parentModuleLabels;
            $editview_label[1] = array_fill(0, count($parentModulesList), '');
            $selectedModuleIndex = array_search($parent_module, $parentModuleNames);
            if ($selectedModuleIndex > -1) {
                $editview_label[1][$selectedModuleIndex] = 'selected';
            }
            $parentModulePopupUrl = array();
            foreach ($parentModuleNames as $parentModule) {
                $parentModulePopupUrl[] = $parentModule . '&action=Popup';
            }
            $editview_label[2] = $parentModulePopupUrl;
        } elseif ($uitype == 357) {
            $pmodule = $_REQUEST['pmodule'];
            if (empty($pmodule)) {
                $pmodule = $_REQUEST['par_module'];
            }
            if ($pmodule == 'Contacts') {
                $contact_selected = 'selected';
            } elseif ($pmodule == 'Accounts') {
                $account_selected = 'selected';
            } elseif ($pmodule == 'Leads') {
                $lead_selected = 'selected';
            } elseif ($pmodule == 'Vendors') {
                $vendor_selected = 'selected';
            } elseif ($pmodule == 'Users') {
                $user_selected = 'selected';
            } elseif ($pmodule == 'Project') {
                $project_selected = 'selected';
            } elseif ($pmodule == 'ProjectTask') {
                $projecttask_selected = 'selected';
            } elseif ($pmodule == 'Potentials') {
                $potentials_selected = 'selected';
            } elseif ($pmodule == 'HelpDesk') {
                $helpdesk_selected = 'selected';
            }
            if (isset($_REQUEST['emailids']) && $_REQUEST['emailids'] != '') {
                $parent_id = $_REQUEST['emailids'];
                $parent_name = '';
                $myids = explode("|", $parent_id);
                for ($i = 0; $i < count($myids) - 1; $i++) {
                    $realid = explode("@", $myids[$i]);
                    $entityid = $realid[0];
                    $nemail = count($realid);
                    if ($pmodule == 'Accounts') {
                        require_once 'modules/Accounts/Accounts.php';
                        $myfocus = new Accounts();
                        $myfocus->retrieve_entity_info($entityid, "Accounts");
                        $fullname = br2nl($myfocus->column_fields['accountname']);
                        $account_selected = 'selected';
                    } elseif ($pmodule == 'Contacts') {
                        require_once 'modules/Contacts/Contacts.php';
                        $myfocus = new Contacts();
                        $myfocus->retrieve_entity_info($entityid, "Contacts");
                        $fname = br2nl($myfocus->column_fields['firstname']);
                        $lname = br2nl($myfocus->column_fields['lastname']);
                        $fullname = $lname . ' ' . $fname;
                        $contact_selected = 'selected';
                    } elseif ($pmodule == 'Leads') {
                        require_once 'modules/Leads/Leads.php';
                        $myfocus = new Leads();
                        $myfocus->retrieve_entity_info($entityid, "Leads");
                        $fname = br2nl($myfocus->column_fields['firstname']);
                        $lname = br2nl($myfocus->column_fields['lastname']);
                        $fullname = $lname . ' ' . $fname;
                        $lead_selected = 'selected';
                    } elseif ($pmodule == 'Project') {
                        require_once 'modules/Project/Project.php';
                        $myfocus = new Project();
                        $myfocus->retrieve_entity_info($entityid, "Project");
                        $fname = br2nl($myfocus->column_fields['projectname']);
                        $lname = br2nl($myfocus->column_fields['projectid']);
                        $fullname = $fname;
                        $project_selected = 'selected';
                    } elseif ($pmodule == 'ProjectTask') {
                        require_once 'modules/ProjectTask/ProjectTask.php';
                        $myfocus = new ProjectTask();
                        $myfocus->retrieve_entity_info($entityid, "ProjectTask");
                        $fname = br2nl($myfocus->column_fields['projecttaskname']);
                        $lname = br2nl($myfocus->column_fields['projecttaskid']);
                        $fullname = $fname;
                        $projecttask_selected = 'selected';
                    } elseif ($pmodule == 'Potentials') {
                        require_once 'modules/Potentials/Potentials.php';
                        $myfocus = new Potentials();
                        $myfocus->retrieve_entity_info($entityid, "Potentials");
                        $fname = br2nl($myfocus->column_fields['potentialname']);
                        $lname = br2nl($myfocus->column_fields['potentialid']);
                        $fullname = $fname;
                        $potentials_selected = 'selected';
                    } elseif ($pmodule == 'HelpDesk') {
                        require_once 'modules/HelpDesk/HelpDesk.php';
                        $myfocus = new HelpDesk();
                        $myfocus->retrieve_entity_info($entityid, "HelpDesk");
                        $fname = br2nl($myfocus->column_fields['title']);
                        $lname = br2nl($myfocus->column_fields['ticketid']);
                        $fullname = $fname;
                        $helpdesk_selected = 'selected';
                    }
                    for ($j = 1; $j < $nemail; $j++) {
                        $querystr = 'select columnname from vtiger_field where fieldid=? and vtiger_field.presence in (0,2)';
                        $result = $adb->pquery($querystr, array($realid[$j]));
                        $temp = $adb->query_result($result, 0, 'columnname');
                        $temp1 = br2nl($myfocus->column_fields[$temp]);
                        //Modified to display the entities in red which don't have email id
                        if (!empty($temp_parent_name) && strlen($temp_parent_name) > 150) {
                            $parent_name .= '<br>';
                            $temp_parent_name = '';
                        }
                        if ($temp1 != '') {
                            $parent_name .= $fullname . '&lt;' . $temp1 . '&gt;; ';
                            $temp_parent_name .= $fullname . '&lt;' . $temp1 . '&gt;; ';
                        } else {
                            $parent_name .= "<b style='color:red'>" . $fullname . '&lt;' . $temp1 . '&gt;; ' . "</b>";
                            $temp_parent_name .= "<b style='color:red'>" . $fullname . '&lt;' . $temp1 . '&gt;; ' . "</b>";
                        }
                    }
                }
            } else {
                if ($_REQUEST['record'] != '' && $_REQUEST['record'] != NULL) {
                    $parent_name = '';
                    $parent_id = '';
                    $myemailid = $_REQUEST['record'];
                    $mysql = "select crmid from vtiger_seactivityrel where activityid=?";
                    $myresult = $adb->pquery($mysql, array($myemailid));
                    $mycount = $adb->num_rows($myresult);
                    if ($mycount > 0) {
                        for ($i = 0; $i < $mycount; $i++) {
                            $mycrmid = $adb->query_result($myresult, $i, 'crmid');
                            $parent_module = getSalesEntityType($mycrmid);
                            if ($parent_module == "Leads") {
                                $sql = "select firstname,lastname,email from vtiger_leaddetails where leadid=?";
                                $result = $adb->pquery($sql, array($mycrmid));
                                $full_name = getFullNameFromQResult($result, 0, "Leads");
                                $myemail = $adb->query_result($result, 0, "email");
                                $parent_id .= $mycrmid . '@0|';
                                //make it such that the email adress sent is remebered and only that one is retrived
                                $parent_name .= $full_name . '<' . $myemail . '>; ';
                                $lead_selected = 'selected';
                            } elseif ($parent_module == "Contacts") {
                                $sql = "select * from vtiger_contactdetails where contactid=?";
                                $result = $adb->pquery($sql, array($mycrmid));
                                $full_name = getFullNameFromQResult($result, 0, "Contacts");
                                $myemail = $adb->query_result($result, 0, "email");
                                $parent_id .= $mycrmid . '@0|';
                                //make it such that the email adress sent is remebered and only that one is retrived
                                $parent_name .= $full_name . '<' . $myemail . '>; ';
                                $contact_selected = 'selected';
                            } elseif ($parent_module == "Accounts") {
                                $sql = "select * from vtiger_account where accountid=?";
                                $result = $adb->pquery($sql, array($mycrmid));
                                $account_name = $adb->query_result($result, 0, "accountname");
                                $myemail = $adb->query_result($result, 0, "email1");
                                $parent_id .= $mycrmid . '@0|';
                                //make it such that the email adress sent is remebered and only that one is retrived
                                $parent_name .= $account_name . '<' . $myemail . '>; ';
                                $account_selected = 'selected';
                            } elseif ($parent_module == "Users") {
                                $sql = "select user_name,email1 from vtiger_users where id=?";
                                $result = $adb->pquery($sql, array($mycrmid));
                                $account_name = $adb->query_result($result, 0, "user_name");
                                $myemail = $adb->query_result($result, 0, "email1");
                                $parent_id .= $mycrmid . '@0|';
                                //make it such that the email adress sent is remebered and only that one is retrived
                                $parent_name .= $account_name . '<' . $myemail . '>; ';
                                $user_selected = 'selected';
                            } elseif ($parent_module == "Vendors") {
                                $sql = "select * from vtiger_vendor where vendorid=?";
                                $result = $adb->pquery($sql, array($mycrmid));
                                $vendor_name = $adb->query_result($result, 0, "vendorname");
                                $myemail = $adb->query_result($result, 0, "email");
                                $parent_id .= $mycrmid . '@0|';
                                //make it such that the email adress sent is remebered and only that one is retrived
                                $parent_name .= $vendor_name . '<' . $myemail . '>; ';
                                $vendor_selected = 'selected';
                            }
                        }
                    }
                }
                $custfld .= '<td width="20%" class="dataLabel">' . $app_strings['To'] . '&nbsp;</td>';
                $custfld .= '<td width="90%" colspan="3"><input name="parent_id" type="hidden" value="' . $parent_id . '"><textarea readonly name="parent_name" cols="70" rows="2">' . $parent_name . '</textarea>&nbsp;<select name="parent_type" >';
                $custfld .= '<OPTION value="Contacts" selected>' . $app_strings['COMBO_CONTACTS'] . '</OPTION>';
                $custfld .= '<OPTION value="Accounts" >' . $app_strings['COMBO_ACCOUNTS'] . '</OPTION>';
                $custfld .= '<OPTION value="Leads" >' . $app_strings['COMBO_LEADS'] . '</OPTION>';
                $custfld .= '<OPTION value="Vendors" >' . $app_strings['COMBO_VENDORS'] . '</OPTION></select><img src="' . vtiger_imageurl('select.gif', $theme) . '" alt="Select" title="Select" LANGUAGE=javascript onclick=\'$log->debug("Exiting getOutputHtml method ..."); return window.open("index.php?module="+ document.EditView.parent_type.value +"&action=Popup&popuptype=set_$log->debug("Exiting getOutputHtml method ..."); return_emails&form=EmailEditView&form_submit=false","test","width=600,height=400,resizable=1,scrollbars=1,top=150,left=200");\' align="absmiddle" style=\'cursor:hand;cursor:pointer\'>&nbsp;<input type="image" src="' . vtiger_imageurl('clear_field.gif', $theme) . '" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.parent_id.value=\'\';this.form.parent_name.value=\'\';$log->debug("Exiting getOutputHtml method ..."); return false;" align="absmiddle" style=\'cursor:hand;cursor:pointer\'></td>';
                $editview_label[] = array('Contacts' => $contact_selected, 'Accounts' => $account_selected, 'Vendors' => $vendor_selected, 'Leads' => $lead_selected, 'Users' => $user_selected);
                $fieldvalue[] = $parent_name;
                $fieldvalue[] = $parent_id;
            }
        } elseif ($uitype == 68) {
            if (empty($value) && isset($_REQUEST['parent_id']) && $_REQUEST['parent_id'] != '') {
                $value = vtlib_purify($_REQUEST['parent_id']);
            }
            if ($value != '') {
                $parent_module = getSalesEntityType($value);
                if ($parent_module == "Contacts") {
                    $displayValueArray = getEntityName($parent_module, $value);
                    if (!empty($displayValueArray)) {
                        foreach ($displayValueArray as $key => $field_value) {
                            $parent_name = $field_value;
                        }
                    }
                    $contact_selected = "selected";
                } elseif ($parent_module == "Accounts") {
                    $sql = "select * from vtiger_account where accountid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "accountname");
                    $account_selected = "selected";
                } else {
                    $parent_name = "";
                    $value = "";
                }
            }
            $editview_label[0] = array();
            $editview_label[1] = array();
            $editview_label[2] = array();
            if (vtlib_isModuleActive('Accounts')) {
                array_push($editview_label[0], $app_strings['COMBO_ACCOUNTS']);
                array_push($editview_label[1], $account_selected);
                array_push($editview_label[2], "Accounts");
            }
            if (vtlib_isModuleActive('Contacts')) {
                array_push($editview_label[0], $app_strings['COMBO_CONTACTS']);
                array_push($editview_label[1], $contact_selected);
                array_push($editview_label[2], "Contacts");
            }
            $fieldvalue[] = $parent_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 9 || $uitype == 7) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fldrs = $adb->pquery('select typeofdata from vtiger_field
			where vtiger_field.fieldname=? and vtiger_field.tabid=?', array($fieldname, getTabid($module_name)));
            $typeofdata = $adb->query_result($fldrs, 0, 0);
            $typeinfo = explode('~', $typeofdata);
            if ($typeinfo[0] == 'I') {
                $fieldvalue[] = $value;
            } else {
                $currencyField = new CurrencyField($value);
                $decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
                $currencyField->initialize($current_user);
                $currencyField->setNumberofDecimals(min($decimals, $currencyField->getCurrencyDecimalPlaces()));
                $fieldvalue[] = $currencyField->getDisplayValue(null, false, true);
            }
        } elseif ($uitype == 71 || $uitype == 72) {
            $currencyField = new CurrencyField($value);
            // Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
            if ($col_fields['record_id'] != '' && $uitype == 72) {
                if ($fieldname == 'unit_price') {
                    $rate_symbol = getCurrencySymbolandCRate(getProductBaseCurrency($col_fields['record_id'], $module_name));
                    $currencySymbol = $rate_symbol['symbol'];
                } else {
                    $currency_info = getInventoryCurrencyInfo($module, $col_fields['record_id']);
                    $currencySymbol = $currency_info['currency_symbol'];
                }
                $fieldvalue[] = $currencyField->getDisplayValue(null, true);
            } else {
                $decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
                $currencyField->initialize($current_user);
                $currencyField->setNumberofDecimals(min($decimals, $currencyField->getCurrencyDecimalPlaces()));
                $fieldvalue[] = $currencyField->getDisplayValue(null, false, true);
                $currencySymbol = $currencyField->getCurrencySymbol();
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name) . ': (' . $currencySymbol . ')';
        } elseif ($uitype == 75 || $uitype == 81) {
            if ($value != '') {
                $vendor_name = getVendorName($value);
            } elseif (isset($_REQUEST['vendor_id']) && $_REQUEST['vendor_id'] != '') {
                $value = $_REQUEST['vendor_id'];
                $vendor_name = getVendorName($value);
            }
            $pop_type = 'specific';
            if ($uitype == 81) {
                $pop_type = 'specific_vendor_address';
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $vendor_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 76) {
            if ($value != '') {
                $potential_name = getPotentialName($value);
            } elseif (isset($_REQUEST['potential_id']) && $_REQUEST['potential_id'] != '') {
                $value = $_REQUEST['potental_id'];
                $potential_name = getPotentialName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $potential_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 78) {
            if ($value != '') {
                $quote_name = getQuoteName($value);
            } elseif (isset($_REQUEST['quote_id']) && $_REQUEST['quote_id'] != '') {
                $value = $_REQUEST['quote_id'];
                $potential_name = getQuoteName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $quote_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 79) {
            if ($value != '') {
                $purchaseorder_name = getPoName($value);
            } elseif (isset($_REQUEST['purchaseorder_id']) && $_REQUEST['purchaseorder_id'] != '') {
                $value = $_REQUEST['purchaseorder_id'];
                $purchaseorder_name = getPoName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $purchaseorder_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 80) {
            if ($value != '') {
                $salesorder_name = getSoName($value);
            } elseif (isset($_REQUEST['salesorder_id']) && $_REQUEST['salesorder_id'] != '') {
                $value = $_REQUEST['salesorder_id'];
                $salesorder_name = getSoName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $salesorder_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 30) {
            $rem_days = 0;
            $rem_hrs = 0;
            $rem_min = 0;
            if ($value != '') {
                $SET_REM = 'CHECKED';
            } else {
                $SET_REM = '';
            }
            $rem_days = floor($col_fields[$fieldname] / (24 * 60));
            $rem_hrs = floor(($col_fields[$fieldname] - $rem_days * 24 * 60) / 60);
            $rem_min = ($col_fields[$fieldname] - $rem_days * 24 * 60) % 60;
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $day_options = getReminderSelectOption(0, 31, 'remdays', $rem_days);
            $hr_options = getReminderSelectOption(0, 23, 'remhrs', $rem_hrs);
            $min_options = getReminderSelectOption(10, 59, 'remmin', $rem_min);
            $fieldvalue[] = array(array(0, 32, 'remdays', getTranslatedString('LBL_DAYS', 'Calendar'), $rem_days), array(0, 24, 'remhrs', getTranslatedString('LBL_HOURS', 'Calendar'), $rem_hrs), array(10, 60, 'remmin', getTranslatedString('LBL_MINUTES', 'Calendar') . '&nbsp;&nbsp;' . getTranslatedString('LBL_BEFORE_EVENT', 'Calendar'), $rem_min));
            $fieldvalue[] = array($SET_REM, getTranslatedString('LBL_YES'), getTranslatedString('LBL_NO'));
            $SET_REM = '';
        } elseif ($uitype == 115) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $pick_query = "select * from vtiger_" . $adb->sql_escape_string($fieldname);
            $pickListResult = $adb->pquery($pick_query, array());
            $noofpickrows = $adb->num_rows($pickListResult);
            //Mikecrowe fix to correctly default for custom pick lists
            $options = array();
            $found = false;
            for ($j = 0; $j < $noofpickrows; $j++) {
                $pickListValue = $adb->query_result($pickListResult, $j, strtolower($fieldname));
                if ($value == $pickListValue) {
                    $chk_val = "selected";
                    $found = true;
                } else {
                    $chk_val = '';
                }
                $options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val);
            }
            $fieldvalue[] = $options;
            $fieldvalue[] = $is_admin;
        } elseif ($uitype == 116 || $uitype == 117) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $pick_query = "select * from vtiger_currency_info where currency_status = 'Active' and deleted=0";
            $pickListResult = $adb->pquery($pick_query, array());
            $noofpickrows = $adb->num_rows($pickListResult);
            //Mikecrowe fix to correctly default for custom pick lists
            $options = array();
            $found = false;
            for ($j = 0; $j < $noofpickrows; $j++) {
                $pickListValue = $adb->query_result($pickListResult, $j, 'currency_name');
                $currency_id = $adb->query_result($pickListResult, $j, 'id');
                if ($value == $currency_id) {
                    $chk_val = "selected";
                    $found = true;
                } else {
                    $chk_val = '';
                }
                $options[$currency_id] = array($pickListValue => $chk_val);
            }
            $fieldvalue[] = $options;
            $fieldvalue[] = $is_admin;
        } elseif ($uitype == 98) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
            $fieldvalue[] = getRoleName($value);
            $fieldvalue[] = $is_admin;
        } elseif ($uitype == 105) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            if (isset($col_fields['record_id']) && $col_fields['record_id'] != '') {
                $query = "select vtiger_attachments.path, vtiger_attachments.name from vtiger_contactdetails left join vtiger_seattachmentsrel on vtiger_seattachmentsrel.crmid=vtiger_contactdetails.contactid inner join vtiger_attachments on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid where vtiger_contactdetails.imagename=vtiger_attachments.name and contactid=?";
                $result_image = $adb->pquery($query, array($col_fields['record_id']));
                for ($image_iter = 0; $image_iter < $adb->num_rows($result_image); $image_iter++) {
                    $image_array[] = $adb->query_result($result_image, $image_iter, 'name');
                    $image_path_array[] = $adb->query_result($result_image, $image_iter, 'path');
                }
            }
            if (is_array($image_array)) {
                for ($img_itr = 0; $img_itr < count($image_array); $img_itr++) {
                    $fieldvalue[] = array('name' => $image_array[$img_itr], 'path' => $image_path_array[$img_itr]);
                }
            } else {
                $fieldvalue[] = '';
            }
        } elseif ($uitype == 101) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = getOwnerName($value);
            $fieldvalue[] = $value;
        } elseif ($uitype == 26) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $folderid = $col_fields['folderid'];
            $foldername_query = 'select foldername from vtiger_attachmentsfolder where folderid = ?';
            $res = $adb->pquery($foldername_query, array($folderid));
            $foldername = $adb->query_result($res, 0, 'foldername');
            if ($foldername != '' && $folderid != '') {
                $fldr_name[$folderid] = $foldername;
            }
            $sql = "select foldername,folderid from vtiger_attachmentsfolder order by foldername";
            $res = $adb->pquery($sql, array());
            for ($i = 0; $i < $adb->num_rows($res); $i++) {
                $fid = $adb->query_result($res, $i, "folderid");
                $fldr_name[$fid] = $adb->query_result($res, $i, "foldername");
            }
            $fieldvalue[] = $fldr_name;
        } elseif ($uitype == 27) {
            if ($value == 'E') {
                $external_selected = "selected";
                $filename = $col_fields['filename'];
            } else {
                $internal_selected = "selected";
                $filename = $col_fields['filename'];
            }
            $editview_label[] = array(getTranslatedString('Internal'), getTranslatedString('External'));
            $editview_label[] = array($internal_selected, $external_selected);
            $editview_label[] = array("I", "E");
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
            $fieldvalue[] = $filename;
        } elseif ($uitype == '31') {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $options = array();
            $themeList = get_themes();
            foreach ($themeList as $theme) {
                if ($value == $theme) {
                    $selected = 'selected';
                } else {
                    $selected = '';
                }
                $options[] = array(getTranslatedString($theme), $theme, $selected);
            }
            $fieldvalue[] = $options;
        } elseif ($uitype == '32') {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $options = array();
            $languageList = Vtiger_Language::getAll();
            foreach ($languageList as $prefix => $label) {
                if ($value == $prefix) {
                    $selected = 'selected';
                } else {
                    $selected = '';
                }
                $options[] = array(getTranslatedString($label), $prefix, $selected);
            }
            $fieldvalue[] = $options;
        } else {
            //Added condition to set the subject if click Reply All from web mail
            if ($_REQUEST['module'] == 'Emails' && $_REQUEST['mg_subject'] != '') {
                $value = $_REQUEST['mg_subject'];
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            if ($fieldname == 'fileversion') {
                if (empty($value)) {
                    $value = '';
                } else {
                    $fieldvalue[] = $value;
                }
            } else {
                $fieldvalue[] = $value;
            }
        }
    }
    // Mike Crowe Mod --------------------------------------------------------force numerics right justified.
    if (!preg_match("/id=/i", $custfld)) {
        $custfld = preg_replace("/<input/iS", "<input id='{$fieldname}' ", $custfld);
    }
    if (in_array($uitype, array(71, 72, 7, 9, 90))) {
        $custfld = preg_replace("/<input/iS", "<input align=right ", $custfld);
    }
    $final_arr[] = $ui_type;
    $final_arr[] = $editview_label;
    $final_arr[] = $editview_fldname;
    $final_arr[] = $fieldvalue;
    $type_of_data = explode('~', $typeofdata);
    $final_arr[] = $type_of_data[1];
    $log->debug('Exiting getOutputHtml method ...');
    return $final_arr;
}
<!--*+********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 *********************************************************************************/
-->
<script src="include/js/json.js" type="text/javascript" charset="utf-8"></script>
<script language="JavaScript" type="text/javascript" src="include/js/advancefilter.js"></script>
<?php 
if ($this->_tpl_vars['JS_DATEFORMAT'] == '') {
    ?>
	<?php 
    $this->assign('JS_DATEFORMAT', parse_calendardate($this->_tpl_vars['APP']['NTC_DATE_FORMAT']));
}
?>
<input type="hidden" id="jscal_dateformat" name="jscal_dateformat" value="<?php 
echo $this->_tpl_vars['JS_DATEFORMAT'];
?>
" />
<input type="hidden" id="image_path" name="image_path" value="<?php 
echo $this->_tpl_vars['IMAGE_PATH'];
?>
" />
<input type="hidden" name="advft_criteria" id="advft_criteria" value="" />
<input type="hidden" name="advft_criteria_groups" id="advft_criteria_groups" value="" />

<script language="JavaScript" type="text/JavaScript">
function addColumnConditionGlue(columnIndex) {
Example #12
0
/**
 * Create HTML form to enter a new record with the minimum necessary fields.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 */
function get_new_record_form_old()
{
    require_once 'include/time.php';
    global $mod_strings;
    global $app_strings;
    global $app_list_strings;
    global $current_user;
    global $theme;
    // Unimplemented until jscalendar language files are fixed
    // global $current_language;
    // global $default_language;
    // global $cal_codes;
    $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
    $lbl_subject = $mod_strings['LBL_SUBJECT'];
    $lbl_date = $mod_strings['LBL_DATE'];
    $lbl_time = $mod_strings['LBL_TIME'];
    $ntc_date_format = $app_strings['NTC_DATE_FORMAT'];
    $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
    $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
    $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
    $default_parent_type = $app_list_strings['record_type_default_key'];
    $default_date_start = date('Y-m-d');
    $default_time_start = to_display_time(date('H:i'));
    $ntc_time_format = '(' . getDisplayTimeFormat() . ')';
    $ampm = AMPMMenu('', date('H:i'));
    $user_id = $current_user->id;
    // Unimplemented until jscalendar language files are fixed
    // $cal_lang = (empty($cal_codes[$current_language])) ? $cal_codes[$default_language] : $cal_codes[$current_language];
    $cal_lang = "en";
    $cal_dateformat = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
    $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
    $the_form .= <<<EOQ

\t\t<form name="EmailSave" onSubmit="return check_form('EmailSave')" method="POST" action="index.php">
\t\t\t<input type="hidden" name="module" value="Emails">
\t\t\t<input type="hidden" name="record" value="">
\t\t\t<input type="hidden" name="action" value="Save">
\t\t\t<input type="hidden" name="parent_type" value="{$default_parent_type}">
\t\t\t<input type="hidden" name="assigned_user_id" value='{$user_id}'>
<p>\t\t{$lbl_subject} <span class="required">{$lbl_required_symbol}</span><br>
\t\t<input name='name' type="text"><br>
\t\t{$lbl_date} <span class="required">{$lbl_required_symbol}</span>&nbsp;<span class="dateFormat">{$ntc_date_format}</span><br>
\t\t<input name='date_start' onblur="parseDate(this, {$cal_dateformat});" id='jscal_field' type="text" maxlength="10" value="{$default_date_start}"> <img src="themes/{$theme}/images/jscalendar.gif" alt="{$app_strings['LBL_ENTER_DATE']}"  id="jscal_trigger" align="absmiddle"><br>
\t\t{$lbl_time} <span class="required">{$lbl_required_symbol}</span>&nbsp;<span class="dateFormat">{$ntc_time_format}</span><br>
\t\t<input name='time_start' maxlength='5' type="text" value="{$default_time_start}">{$ampm}</p>
<p>\t\t<input title="{$lbl_save_button_title}" accessKey="{$lbl_save_button_key}" class="button" type="submit" name="button" value="  {$lbl_save_button_label}  " ></p>
\t\t</form>
\t\t<script type="text/javascript">
\t\tCalendar.setup ({
\t\t\tinputField : "jscal_field", ifFormat : "{$cal_dateformat}", showsTime : false, button : "jscal_trigger", singleClick : true, step : 1
\t\t});
\t\t</script>

EOQ;
    $the_form .= get_left_form_footer();
    require_once 'include/javascript/javascript.php';
    require_once 'modules/Emails/Email.php';
    $javascript = new javascript();
    $javascript->setFormName('EmailSave');
    $javascript->setSugarBean(new Email());
    $javascript->addRequiredFields('');
    $the_form .= $javascript->getScript();
    return $the_form;
}
Example #13
0
    function getWideFormBody($prefix, $mod = 'Quotes', $formname = '', $lead = '')
    {
        if (!ACLController::checkAccess('Quotes', 'edit', true)) {
            return '';
        }
        if (empty($lead)) {
            $lead = BeanFactory::getBean('Leads');
        }
        if (!empty($mod)) {
            global $current_language;
            $mod_strings = return_module_language($current_language, $mod);
        } else {
            global $mod_strings;
        }
        global $app_strings;
        global $app_list_strings;
        global $theme;
        global $current_user;
        // Unimplemented until jscalendar language files are fixed
        // global $current_language;
        // global $default_language;
        // global $cal_codes;
        $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
        $lbl_quote_name = $mod_strings['LBL_QUOTE_NAME'];
        $lbl_sales_stage = $mod_strings['LBL_SALES_STAGE'];
        $lbl_date_closed = $mod_strings['LBL_DATE_QUOTE_EXPECTED_CLOSED'];
        $lbl_amount = $mod_strings['LBL_AMOUNT'];
        $ntc_date_format = $app_strings['NTC_DATE_FORMAT'];
        $user_id = $current_user->id;
        // Unimplemented until jscalendar language files are fixed
        // $cal_lang = (empty($cal_codes[$current_language])) ? $cal_codes[$default_language] : $cal_codes[$current_language];
        $cal_lang = "en";
        $cal_dateformat = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
        $jsCalendarImage = SugarThemeRegistry::current()->getImageURL("jscalendar.gif");
        $the_form = <<<EOQ

\t\t\t<input type="hidden" name="{$prefix}record" value="">
\t\t\t<input type="hidden" name="{$prefix}billing_account_name" value="skip_me">
\t\t\t<input type="hidden" name="{$prefix}assigned_user_id" value='{$user_id}'>

<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
    <td width="20%" scope="row">{$lbl_quote_name}&nbsp;<span class="required">{$lbl_required_symbol}</span></td>
    <td width="80%" scope="row">{$mod_strings['LBL_DESCRIPTION']}</td>
</tr>
<tr>
    <td ><input name='{$prefix}name' type="text" value="{$lead->quote_name}"></td>
\t<td  rowspan="7"><textarea name='{$prefix}description' rows='5' cols='50'></textarea></td>
</tr>
<tr>
    <td scope="row">{$lbl_date_closed}&nbsp;<span class="required">{$lbl_required_symbol}</span>
\t<br><span class="dateFormat">{$ntc_date_format}</span></td>
</tr>
<tr>
<td ><input name='{$prefix}date_quote_expected_closed' onblur="parseDate(this, '{$cal_dateformat}');" size='12' maxlength='10' id='{$prefix}jscal_field' type="text" value="">&nbsp;<!--not_in_theme!--><img src="{$jsCalendarImage}" alt="{$app_strings['LBL_ENTER_DATE']}"  id="{$prefix}jscal_trigger" align="absmiddle"></td>
</tr>
<tr>
    <td scope="row">{$lbl_sales_stage}&nbsp;<span class="required">{$lbl_required_symbol}</span></td>
</tr>
<tr>
    <td ><select name='{$prefix}sales_stage'>
EOQ;
        $the_form .= get_select_options_with_id($app_list_strings['sales_stage_dom'], "");
        $the_form .= <<<EOQ
\t\t</select></td>
</tr>
<tr>
    <td scope="row">{$lbl_amount}&nbsp;<span class="required">{$lbl_required_symbol}</span></td>
</tr>
<tr>
    <td ><input name='{$prefix}amount' type="text" value='{$lead->quote_amount}'></td>
</tr>
</table>

\t\t<script type="text/javascript">
\t\tCalendar.setup ({
\t\t\tinputField : "{$prefix}jscal_field", ifFormat : "{$cal_dateformat}", showsTime : false, button : "{$prefix}jscal_trigger", singleClick : true, step : 1, weekNumbers:false
\t\t});
\t\t</script>


EOQ;
        $javascript = new javascript();
        $javascript->setFormName($formname);
        $javascript->setSugarBean(BeanFactory::getBean('Quotes'));
        $javascript->addRequiredFields($prefix);
        $the_form .= $javascript->getScript();
        return $the_form;
    }
Example #14
0
function vtTaskEdit($adb, $request, $current_language, $app_strings)
{
    global $theme;
    $util = new VTWorkflowUtils();
    $image_path = "themes/{$theme}/images/";
    $module = new VTWorkflowApplication('edittask');
    $mod = return_module_language($current_language, $module->name);
    if (!$util->checkAdminAccess()) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
        return;
    }
    $smarty = new vtigerCRM_Smarty();
    $tm = new VTTaskManager($adb);
    $smarty->assign('edit', isset($request["task_id"]));
    if (isset($request["task_id"])) {
        $task = $tm->retrieveTask($request["task_id"]);
        $workflowId = $task->workflowId;
    } else {
        $workflowId = $request["workflow_id"];
        $taskClass = $request["task_type"];
        $task = $tm->createTask($taskClass, $workflowId);
    }
    if ($task == null) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_TASK']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_TASK']);
        return;
    }
    $wm = new VTWorkflowManager($adb);
    $workflow = $wm->retrieve($workflowId);
    if ($workflow == null) {
        $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
        $util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
        return;
    }
    $smarty->assign("workflow", $workflow);
    $smarty->assign("returnUrl", $request["return_url"]);
    $smarty->assign("task", $task);
    $smarty->assign("taskType", $taskClass);
    $smarty->assign("saveType", $request['save_type']);
    $taskClass = get_class($task);
    $smarty->assign("taskTemplate", "{$module->name}/taskforms/{$taskClass}.tpl");
    $et = VTWSEntityType::usingGlobalCurrentUser($workflow->moduleName);
    $smarty->assign("entityType", $et);
    $smarty->assign('entityName', $workflow->moduleName);
    $smarty->assign("fieldNames", $et->getFieldNames());
    $dateFields = array();
    $fieldTypes = $et->getFieldTypes();
    $fieldLabels = $et->getFieldLabels();
    foreach ($fieldTypes as $name => $type) {
        if ($type->type == 'Date' || $type->type == 'DateTime') {
            $dateFields[$name] = $fieldLabels[$name];
        }
    }
    $smarty->assign('dateFields', $dateFields);
    if ($task->trigger != null) {
        $trigger = $task->trigger;
        $days = $trigger['days'];
        if ($days < 0) {
            $days *= -1;
            $direction = 'before';
        } else {
            $direction = 'after';
        }
        $smarty->assign('trigger', array('days' => $days, 'direction' => $direction, 'field' => $trigger['field']));
    }
    $curr_date = "(general : (__VtigerMeta__) date)";
    $curr_time = '(general : (__VtigerMeta__) time)';
    $smarty->assign("DATE", $curr_date);
    $smarty->assign("TIME", $curr_time);
    $smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, 'Calendar'), return_module_language($current_language, $module->name)));
    $smarty->assign("APP", $app_strings);
    $smarty->assign("dateFormat", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
    $smarty->assign("IMAGE_PATH", $image_path);
    $smarty->assign("THEME", $theme);
    $smarty->assign("MODULE_NAME", $module->label);
    $smarty->assign("PAGE_NAME", $mod['LBL_EDIT_TASK']);
    $smarty->assign("PAGE_TITLE", $mod['LBL_EDIT_TASK_TITLE']);
    $smarty->assign("module", $module);
    $smarty->display("{$module->name}/EditTask.tpl");
}
Example #15
0
/** This function returns the ec_field details for a given ec_fieldname.
 * Param $uitype - UI type of the ec_field
 * Param $fieldname - Form ec_field name
 * Param $fieldlabel - Form ec_field label name
 * Param $maxlength - maximum length of the ec_field
 * Param $col_fields - array contains the ec_fieldname and values
 * Param $generatedtype - Field generated type (default is 1)
 * Param $module_name - module name
 * Return type is an array
 */
function getOutputHtml($uitype, $fieldname, $fieldlabel, $maxlength, $col_fields, $generatedtype, $module_name, $mode = '', $mandatory = 0, $typeofdata = "")
{
    global $log;
    $log->debug("Entering getOutputHtml() method ...");
    global $adb, $log;
    global $theme;
    global $mod_strings;
    global $app_strings;
    global $current_user;
    global $noof_group_rows;
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    //$fieldlabel = from_html($fieldlabel);
    $fieldvalue = array();
    $final_arr = array();
    $value = $col_fields[$fieldname];
    $custfld = '';
    $ui_type[] = $uitype;
    $editview_fldname[] = $fieldname;
    if ($generatedtype == 2) {
        $mod_strings[$fieldlabel] = $fieldlabel;
    }
    if (!isset($mod_strings[$fieldlabel])) {
        $mod_strings[$fieldlabel] = $fieldlabel;
    }
    if ($uitype == 5) {
        if ($value == '') {
            if ($mandatory == 1) {
                $disp_value = getNewDisplayDate();
            }
        } else {
            $disp_value = getDisplayDate($value);
        }
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $disp_value;
    } elseif ($uitype == 15 || $uitype == 16 || $uitype == 111) {
        $editview_label[] = $mod_strings[$fieldlabel];
        //changed by dingjianting on 2007-10-3 for cache pickListResult
        $key = "picklist_array_" . $fieldname;
        $picklist_array = getSqlCacheData($key);
        if (!$picklist_array) {
            $pick_query = "select colvalue from ec_picklist where colname='" . $fieldname . "' order by sequence asc";
            $pickListResult = $adb->getList($pick_query);
            $picklist_array = array();
            foreach ($pickListResult as $row) {
                $picklist_array[] = $row['colvalue'];
            }
            setSqlCacheData($key, $picklist_array);
        }
        //Mikecrowe fix to correctly default for custom pick lists
        $options = array();
        $found = false;
        foreach ($picklist_array as $pickListValue) {
            if ($value == $pickListValue) {
                $chk_val = "selected";
                $found = true;
            } else {
                $chk_val = '';
            }
            $options[] = array($pickListValue => $chk_val);
        }
        $fieldvalue[] = $options;
    } elseif ($uitype == '1021' || $uitype == '1022' || $uitype == '1023') {
        $typearr = explode("::", $typeofdata);
        $multifieldid = $typearr[1];
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = getMultiFieldEditViewValue($multifieldid, $uitype, $col_fields);
        $fieldvalue[] = $multifieldid;
        //print_r($fieldvalue);
    } elseif ($uitype == 10) {
        $query = "SELECT ec_entityname.* FROM ec_crmentityrel inner join ec_entityname on ec_entityname.modulename=ec_crmentityrel.relmodule WHERE ec_crmentityrel.module='" . $module_name . "' and ec_entityname.entityidfield='" . $fieldname . "'";
        $fldmod_result = $adb->query($query);
        $rownum = $adb->num_rows($fldmod_result);
        if ($rownum > 0) {
            $rel_modulename = $adb->query_result($fldmod_result, 0, 'modulename');
            $rel_tablename = $adb->query_result($fldmod_result, 0, 'tablename');
            $rel_entityname = $adb->query_result($fldmod_result, 0, 'fieldname');
            $rel_entityid = $adb->query_result($fldmod_result, 0, 'entityidfield');
        }
        if ($value != '') {
            $module_entityname = getEntityNameForTen($rel_tablename, $rel_entityname, $fieldname, $value);
        } elseif (isset($_REQUEST[$fieldname]) && $_REQUEST[$fieldname] != '') {
            if ($_REQUEST['module'] == $rel_modulename) {
                $module_entityname = '';
            } else {
                $value = $_REQUEST[$fieldname];
                $module_entityname = getEntityNameForTen($rel_tablename, $rel_entityname, $fieldname, $value);
            }
        }
        if (isset($app_strings[$fieldlabel])) {
            $editview_label[] = $app_strings[$fieldlabel];
        } elseif (isset($mod_strings[$fieldlabel])) {
            $editview_label[] = $mod_strings[$fieldlabel];
        } else {
            $editview_label[] = $fieldlabel;
        }
        $fieldvalue[] = $module_entityname;
        $fieldvalue[] = $value;
        $fieldvalue[] = $rel_entityname;
        $fieldvalue[] = $rel_modulename;
    } elseif ($uitype == 17) {
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $value;
    } elseif ($uitype == 85) {
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $value;
    } elseif ($uitype == 86) {
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $value;
    } elseif ($uitype == 87) {
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $value;
    } elseif ($uitype == 88) {
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $value;
    } elseif ($uitype == 89) {
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $value;
    } elseif ($uitype == 33) {
        $pick_query = "select colvalue from ec_picklist where colname='" . $fieldname . "' order by sequence asc";
        $pickListResult = $adb->getList($pick_query);
        $picklist_array = array();
        foreach ($pickListResult as $row) {
            $picklist_array[] = $row['colvalue'];
        }
        $editview_label[] = $mod_strings[$fieldlabel];
        $mulsel = "select colvalue from ec_picklist where colname='" . $fieldname . "' order by sequence asc";
        $multiselect_result = $adb->query($mulsel);
        $noofoptions = $adb->num_rows($multiselect_result);
        $options = array();
        $found = false;
        $valur_arr = explode(' |##| ', $value);
        for ($j = 0; $j < $noofoptions; $j++) {
            $multiselect_combo = $adb->query_result($multiselect_result, $j, "colvalue");
            if (in_array($multiselect_combo, $valur_arr)) {
                $chk_val = "selected";
                $found = true;
            } else {
                $chk_val = '';
            }
            $options[] = array($multiselect_combo => $chk_val);
        }
        $fieldvalue[] = $options;
    } elseif ($uitype == 19 || $uitype == 20) {
        if (isset($_REQUEST['body'])) {
            $value = $_REQUEST['body'];
        }
        $editview_label[] = $mod_strings[$fieldlabel];
        //$value = to_html($value);
        //$value = htmlspecialchars($value, ENT_QUOTES, "UTF-8");
        $fieldvalue[] = $value;
    } elseif ($uitype == 21 || $uitype == 24) {
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $value;
    } elseif ($uitype == 22) {
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $value;
    } elseif ($uitype == 52) {
        $editview_label[] = $mod_strings[$fieldlabel];
        global $current_user;
        if ($value != '') {
            $assigned_user_id = $value;
        } else {
            $assigned_user_id = $current_user->id;
        }
        $combo_lbl_name = 'assigned_user_id';
        if ($fieldlabel == 'Assigned To') {
            $user_array = get_user_array(FALSE, "Active", $assigned_user_id);
            $users_combo = get_select_options_array($user_array, $assigned_user_id);
        } else {
            $user_array = get_user_array(FALSE, "Active", $assigned_user_id);
            $users_combo = get_select_options_array($user_array, $assigned_user_id);
        }
        $fieldvalue[] = $users_combo;
    } elseif ($uitype == 77) {
        $editview_label[] = $mod_strings[$fieldlabel];
        global $current_user;
        if ($value != '') {
            $assigned_user_id = $value;
        } else {
            $assigned_user_id = $current_user->id;
        }
        $combo_lbl_name = 'assigned_user_id';
        $user_array = get_user_array(FALSE, "Active", $assigned_user_id);
        $users_combo = get_select_options_array($user_array, $assigned_user_id);
        $fieldvalue[] = $users_combo;
    } elseif ($uitype == 53) {
        $editview_label[] = $mod_strings[$fieldlabel];
        global $current_user;
        if ($value != '' && $value != 0) {
            $assigned_user_id = $value;
        } else {
            $assigned_user_id = $current_user->id;
        }
        if ($fieldlabel == 'Assigned To') {
            $user_array = get_user_array(FALSE, "Active", $assigned_user_id);
            $users_combo = get_select_options_array($user_array, $assigned_user_id);
        } else {
            $user_array = get_user_array(FALSE, "Active", $assigned_user_id);
            $users_combo = get_select_options_array($user_array, $assigned_user_id);
        }
        $fieldvalue[] = $users_combo;
    } elseif ($uitype == 1004) {
        if (isset($mod_strings[$fieldlabel])) {
            $editview_label[] = $mod_strings[$fieldlabel];
        } else {
            $editview_label[] = $fieldlabel;
        }
        if (empty($value)) {
            global $current_user;
            $value = $current_user->id;
        }
        $fieldvalue[] = getUserName($value);
    } elseif ($uitype == 1008) {
        if (isset($mod_strings[$fieldlabel])) {
            $editview_label[] = $mod_strings[$fieldlabel];
        } else {
            $editview_label[] = $fieldlabel;
        }
        if (empty($value)) {
            global $current_user;
            $value = $current_user->id;
        }
        $fieldvalue[] = getUserName($value);
    } elseif ($uitype == 51 || $uitype == 50 || $uitype == 73) {
        $account_name = "";
        /*$convertmode = "";
        		if(isset($_REQUEST['convertmode']))
        		{
        			$convertmode = $_REQUEST['convertmode'];
        		}
        		if($convertmode != 'update_quote_val' && $convertmode != 'update_so_val')
        		{
        			if(isset($_REQUEST['account_id']) && $_REQUEST['account_id'] != '')
        				$value = $_REQUEST['account_id'];	
        		}*/
        if (isset($_REQUEST['account_id']) && $_REQUEST['account_id'] != '') {
            $value = $_REQUEST['account_id'];
        }
        if ($value != '') {
            $account_name = getAccountName($value);
        }
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $account_name;
        $fieldvalue[] = $value;
    } elseif ($uitype == 54) {
        $options = array();
        if ($value == "") {
            $key = "currentuser_group_" . $current_user->id;
            $currentuser_group = getSqlCacheData($key);
            if (!$currentuser_group) {
                $query = "select ec_groups.groupname from ec_groups left join ec_users2group on ec_users2group.groupid=ec_groups.groupid where ec_users2group.userid='" . $current_user->id . "' and ec_users2group.groupid!=0";
                $result = $adb->query($query);
                $noofrows = $adb->num_rows($result);
                if ($noofrows > 0) {
                    $currentuser_group = $adb->query_result($result, 0, "groupname");
                }
                setSqlCacheData($key, $currentuser_group);
            }
            $value = $currentuser_group;
        }
        $key = "picklist_array_group";
        $picklist_array = getSqlCacheData($key);
        if (!$picklist_array) {
            $pick_query = "select * from ec_groups order by groupid";
            $pickListResult = $adb->getList($pick_query);
            $picklist_array = array();
            foreach ($pickListResult as $row) {
                $picklist_array[] = $row["groupname"];
            }
            setSqlCacheData($key, $picklist_array);
        }
        $editview_label[] = $mod_strings[$fieldlabel];
        foreach ($picklist_array as $pickListValue) {
            if ($value == $pickListValue) {
                $chk_val = "selected";
            } else {
                $chk_val = '';
            }
            $options[] = array($pickListValue => $chk_val);
        }
        $fieldvalue[] = $options;
    } elseif ($uitype == 59) {
        if ($value != '') {
            $product_name = getProductName($value);
        }
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $product_name;
        $fieldvalue[] = $value;
    } elseif ($uitype == 64) {
        $editview_label[] = $mod_strings[$fieldlabel];
        $date_format = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
        $fieldvalue[] = $value;
    } elseif ($uitype == 56) {
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $value;
    } elseif ($uitype == 57) {
        $accountid = $col_fields['account_id'];
        if (empty($accountid)) {
            $convertmode = "";
            if (isset($_REQUEST['convertmode'])) {
                $convertmode = $_REQUEST['convertmode'];
            }
            if ($convertmode != 'update_quote_val' && $convertmode != 'update_so_val') {
                if (isset($_REQUEST['account_id']) && $_REQUEST['account_id'] != '') {
                    $accountid = $_REQUEST['account_id'];
                }
            }
        }
        $contact_name = '';
        //		if(trim($value) != '')
        //		{
        //			$contact_name = getContactName($value);
        //		}
        //		elseif(isset($_REQUEST['contact_id']) && $_REQUEST['contact_id'] != '')
        //		{
        //			if(isset($_REQUEST['module']) && $_REQUEST['module'] == 'Contacts' && $fieldname = 'contact_id')
        //			{
        //				$contact_name = '';
        //			}
        //			else
        //			{
        //				$value = $_REQUEST['contact_id'];
        //				$contact_name = getContactName($value);
        //			}
        //
        //		}
        if (trim($value) == '') {
            if (isset($_REQUEST['module']) && $_REQUEST['module'] == 'Contacts' && ($fieldname = 'contact_id')) {
            } else {
                $value = $_REQUEST['contact_id'];
            }
        }
        $contactopts = getContactOptions($accountid, $value);
        //Checking for contacts duplicate
        $editview_label[] = $mod_strings[$fieldlabel];
        //		$fieldvalue[] = $contact_name;
        $fieldvalue[] = $contactopts;
        $fieldvalue[] = $value;
    } elseif ($uitype == 76) {
        if ($value != '') {
            $potential_name = getPotentialName($value);
        } elseif (isset($_REQUEST['potential_id']) && $_REQUEST['potential_id'] != '') {
            $value = $_REQUEST['potental_id'];
            $potential_name = getPotentialName($value);
        } elseif (isset($_REQUEST['potentialid']) && $_REQUEST['potentialid'] != '') {
            $value = $_REQUEST['potentalid'];
            $potential_name = getPotentialName($value);
        }
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $potential_name;
        $fieldvalue[] = $value;
    } elseif ($uitype == 80) {
        if ($value != '') {
            $salesorder_name = getSoName($value);
        } elseif (isset($_REQUEST['salesorder_id']) && $_REQUEST['salesorder_id'] != '') {
            $value = $_REQUEST['salesorder_id'];
            $salesorder_name = getSoName($value);
        }
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $salesorder_name;
        $fieldvalue[] = $value;
    } elseif ($uitype == 101) {
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = getUserName($value);
        $fieldvalue[] = $value;
    } else {
        $editview_label[] = $mod_strings[$fieldlabel];
        $fieldvalue[] = $value;
    }
    $final_arr[] = $ui_type;
    $final_arr[] = $editview_label;
    $final_arr[] = $editview_fldname;
    $final_arr[] = $fieldvalue;
    $log->debug("Exiting getOutputHtml method ...");
    return $final_arr;
}
Example #16
0
 /**
  * Process the request for Folder opertions
  * @global <type> $maxEntriesPerPage
  * @param Vtiger_Request $request
  * @return MailManager_Response
  */
 public function process(Vtiger_Request $request)
 {
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $maxEntriesPerPage = vglobal('list_max_entries_per_page');
     $response = new Vtiger_Response();
     $moduleName = $request->getModule();
     if ('open' == $this->getOperationArg($request)) {
         $q = $request->get('q');
         $foldername = $request->get('_folder');
         $type = $request->get('type');
         $connector = $this->getConnector($foldername);
         $folder = $connector->folderInstance($foldername);
         if (empty($q)) {
             $connector->folderMails($folder, intval($request->get('_page', 0)), $maxEntriesPerPage);
         } else {
             if (empty($type)) {
                 $type = 'ALL';
             }
             if ($type == 'ON') {
                 $dateFormat = $currentUserModel->get('date_format');
                 if ($dateFormat == 'mm-dd-yyyy') {
                     $dateArray = explode('-', $q);
                     $temp = $dateArray[0];
                     $dateArray[0] = $dateArray[1];
                     $dateArray[1] = $temp;
                     $q = implode('-', $dateArray);
                 }
                 $query = date('d M Y', strtotime($q));
                 $q = '' . $type . ' "' . vtlib_purify($query) . '"';
             } else {
                 $q = '' . $type . ' "' . vtlib_purify($q) . '"';
             }
             $connector->searchMails($q, $folder, intval($request->get('_page', 0)), $maxEntriesPerPage);
         }
         $folderList = $connector->getFolderList();
         $viewer = $this->getViewer($request);
         $viewer->assign('TYPE', $type);
         $viewer->assign('QUERY', $request->get('q'));
         $viewer->assign('FOLDER', $folder);
         $viewer->assign('FOLDERLIST', $folderList);
         $viewer->assign('SEARCHOPTIONS', self::getSearchOptions());
         $viewer->assign("JS_DATEFORMAT", parse_calendardate(getTranslatedString('NTC_DATE_FORMAT')));
         $viewer->assign('USER_DATE_FORMAT', $currentUserModel->get('date_format'));
         $viewer->assign('MODULE', $moduleName);
         $response->setResult($viewer->view('FolderOpen.tpl', $moduleName, true));
     } elseif ('drafts' == $this->getOperationArg($request)) {
         $q = $request->get('q');
         $type = $request->get('type');
         $page = intval($request->get('_page', 0));
         $connector = $this->getConnector('__vt_drafts');
         $folder = $connector->folderInstance();
         if (empty($q)) {
             $draftMails = $connector->getDrafts($page, $maxEntriesPerPage, $folder);
         } else {
             $draftMails = $connector->searchDraftMails($q, $type, $page, $maxEntriesPerPage, $folder);
         }
         $viewer = $this->getViewer($request);
         $viewer->assign('MAILS', $draftMails);
         $viewer->assign('FOLDER', $folder);
         $viewer->assign('SEARCHOPTIONS', MailManager_Draft_View::getSearchOptions());
         $viewer->assign('USER_DATE_FORMAT', $currentUserModel->get('date_format'));
         $viewer->assign('MODULE', $moduleName);
         $response->setResult($viewer->view('FolderDrafts.tpl', 'MailManager', true));
     } else {
         if ('getFoldersList' == $this->getOperationArg($request)) {
             $viewer = $this->getViewer($request);
             if ($this->hasMailboxModel()) {
                 $connector = $this->getConnector();
                 if (!$connector->hasError()) {
                     $folders = $connector->folders();
                     $connector->updateFolders();
                     $viewer->assign('FOLDERS', $folders);
                 }
                 $this->closeConnector();
             }
             $viewer->assign('MODULE', $request->getModule());
             $response->setResult($viewer->view('FolderList.tpl', $moduleName, true));
         }
     }
     return $response;
 }
global $app_list_strings;
global $mod_strings;
$current_module_strings = return_module_language($current_language, 'Reports');
global $list_max_entries_per_page;
global $urlPrefix;
$log = LoggerManager::getLogger('report_type');
global $currentModule;
global $image_path;
global $theme;
global $current_user;
$report_std_filter = new vtigerCRM_Smarty();
$report_std_filter->assign("MOD", $mod_strings);
$report_std_filter->assign("APP", $app_strings);
$report_std_filter->assign("IMAGE_PATH", $image_path);
$report_std_filter->assign("DATEFORMAT", $current_user->date_format);
$report_std_filter->assign("JS_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
$roleid = $current_user->column_fields['roleid'];
$user_array = getAllUserName();
$userIdStr = "";
$userNameStr = "";
$m = 0;
foreach ($user_array as $userid => $username) {
    if ($userid != $current_user->id) {
        if ($m != 0) {
            $userIdStr .= ",";
            $userNameStr .= ",";
        }
        $userIdStr .= "'" . $userid . "'";
        $userNameStr .= "'" . escape_single_quotes(decode_html($username)) . "'";
        $m++;
    }
Example #18
0
/*+********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ******************************************************************************* */
require_once 'data/Tracker.php';
require_once 'include/utils/utils.php';
require_once 'include/utils/UserInfoUtil.php';
require_once 'include/Webservices/DescribeObject.php';
require_once 'Smarty_setup.php';
global $currentModule, $app_strings, $log, $current_user, $theme;
$theme_path = "themes/" . $theme . "/";
if (isset($_REQUEST['record'])) {
    $id = vtlib_purify($_REQUEST['record']);
    $log->debug(" the id is " . $id);
}
$category = getParentTab();
require_once 'modules/Leads/ConvertLeadUI.php';
$uiinfo = new ConvertLeadUI($id, $current_user);
$smarty = new vtigerCRM_Smarty();
$smarty->assign('UIINFO', $uiinfo);
$smarty->assign('MODULE', 'Leads');
$smarty->assign('CATEGORY', $category);
$smarty->assign('THEME', $theme_path);
$smarty->assign('DATE_FORMAT', $current_user->date_format);
$smarty->assign('CAL_DATE_FORMAT', parse_calendardate($app_strings['NTC_DATE_FORMAT']));
$smarty->display(vtlib_getModuleTemplate($currentModule, 'ConvertLead.tpl'));
}
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("Meeting detail view");
$xtpl = new XTemplate('modules/Meetings/EditView.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
// Unimplemented until jscalendar language files are fixed
// $xtpl->assign("CALENDAR_LANG", ((empty($cal_codes[$current_language])) ? $cal_codes[$default_language] : $cal_codes[$current_language]));
$xtpl->assign("CALENDAR_LANG", "en");
$xtpl->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
if (empty($focus->id)) {
    $xtpl->assign("USER_ID", $current_user->id);
}
if (empty($focus->id) && isset($_REQUEST['contact_id'])) {
    $xtpl->assign("CONTACT_ID", $_REQUEST['contact_id']);
}
if (isset($_REQUEST['return_module'])) {
    $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
}
if (isset($_REQUEST['return_action'])) {
    $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
}
if (isset($_REQUEST['return_id'])) {
    $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
} else {
Example #20
0
 ********************************************************************************/
require_once 'Smarty_setup.php';
require_once 'include/CustomFieldUtil.php';
require_once 'include/utils/UserInfoUtil.php';
require_once 'include/utils/utils.php';
require_once 'modules/PickList/PickListUtils.php';
global $mod_strings, $app_strings, $log, $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
require_once 'modules/Vtiger/layout_utils.php';
$smarty = new vtigerCRM_Smarty();
$subMode = vtlib_purify($_REQUEST['sub_mode']);
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("JS_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
if ($subMode == 'updateFieldProperties') {
    updateFieldProperties();
} elseif ($subMode == 'deleteCustomField') {
    deleteCustomField();
} elseif ($subMode == 'changeOrder') {
    changeFieldOrder();
} elseif ($subMode == 'addBlock') {
    $duplicate = addblock();
} elseif ($subMode == 'deleteCustomBlock') {
    deleteBlock();
} elseif ($subMode == 'addCustomField') {
    $duplicate = addCustomField();
} elseif ($subMode == 'movehiddenfields' || $subMode == 'showhiddenfields') {
    show_move_hiddenfields($subMode);
} elseif ($subMode == 'changeRelatedInfoOrder') {
									<?php echo $this->_tpl_vars['tax']['taxlabel']; ?>
 <?php echo $this->_tpl_vars['APP']['COVERED_PERCENTAGE']; ?>


								</td>
								<td class="dvtCellInfo" align="left">
									<?php echo $this->_tpl_vars['tax']['percentage']; ?>

								</td>
								<td colspan="2" class="dvtCellInfo">&nbsp;</td>
							   </tr>
							<?php endforeach; endif; unset($_from); ?>

				<?php elseif ($this->_tpl_vars['keyid'] == 5): ?>
										<?php if (empty ( $this->_tpl_vars['dateFormat'] )): ?>
						<?php $this->assign('dateFormat', parse_calendardate($this->_tpl_vars['APP']['NTC_DATE_FORMAT'])); ?>
					<?php endif; ?>
					<td width=25% class="dvtCellInfo" align="left" id="mouseArea_<?php echo $this->_tpl_vars['label']; ?>
" onmouseover="hndMouseOver(<?php echo $this->_tpl_vars['keyid']; ?>
,'<?php echo $this->_tpl_vars['label']; ?>
');" onmouseout="fnhide('crmspanid');">
						&nbsp;&nbsp;<span id="dtlview_<?php echo $this->_tpl_vars['label']; ?>
">
							<?php echo $this->_tpl_vars['keyval']; ?>

						</span>
						<div id="editarea_<?php echo $this->_tpl_vars['label']; ?>
" style="display:none;">
							<input style="border:1px solid #bababa;" size="11" maxlength="10" type="text" id="txtbox_<?php echo $this->_tpl_vars['label']; ?>
" name="<?php echo $this->_tpl_vars['keyfldname']; ?>
" maxlength='100' value="<?php echo ((is_array($_tmp=$this->_tpl_vars['keyval'])) ? $this->_run_mod_handler('regex_replace', true, $_tmp, '/[^-]*(--)[^-]*$/', '') : smarty_modifier_regex_replace($_tmp, '/[^-]*(--)[^-]*$/', '')); ?>