/** This function returns the detail view form ec_field and and its properties in array format. * Param $uitype - UI type of the ec_field * Param $fieldname - Form ec_field name * Param $fieldlabel - Form ec_field label name * Param $col_fields - array contains the ec_fieldname and values * Param $generatedtype - Field generated type (default is 1) * Param $tabid - ec_tab id to which the Field belongs to (default is "") * Return type is an array */ function getDetailViewOutputHtml($uitype, $fieldname, $fieldlabel, $col_fields, $generatedtype, $tabid = '') { global $log; $log->debug("Entering getDetailViewOutputHtml() method ..."); global $adb; global $mod_strings; global $app_strings; global $current_user; //$fieldlabel = from_html($fieldlabel); $custfld = ''; $value = ''; $arr_data = array(); $label_fld = array(); $data_fld = array(); if ($generatedtype == 2) { $mod_strings[$fieldlabel] = $fieldlabel; } if (!isset($mod_strings[$fieldlabel])) { $mod_strings[$fieldlabel] = $fieldlabel; } if ($col_fields[$fieldname] == '--None--') { $col_fields[$fieldname] = ''; } if ($uitype == 116) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 13) { $label_fld[] = $mod_strings[$fieldlabel]; $temp_val = $col_fields[$fieldname]; $label_fld[] = $temp_val; $linkvalue = getComposeMailUrl($temp_val); $label_fld["link"] = $linkvalue; } elseif ($uitype == 5 || $uitype == 23 || $uitype == 70) { $label_fld[] = $mod_strings[$fieldlabel]; $cur_date_val = $col_fields[$fieldname]; if (!isValidDate($cur_date_val)) { $display_val = ''; } else { $display_val = getDisplayDate($cur_date_val); } $label_fld[] = $display_val; } elseif ($uitype == 15 || $uitype == 16 || $uitype == 115 || $uitype == 111) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 10) { if (isset($app_strings[$fieldlabel])) { $label_fld[] = $app_strings[$fieldlabel]; } elseif (isset($mod_strings[$fieldlabel])) { $label_fld[] = $mod_strings[$fieldlabel]; } else { $label_fld[] = $fieldlabel; } $value = $col_fields[$fieldname]; $module_entityname = ""; if ($value != '') { $query = "SELECT ec_entityname.* FROM ec_crmentityrel inner join ec_entityname on ec_entityname.modulename=ec_crmentityrel.relmodule inner join ec_tab on ec_tab.name=ec_crmentityrel.module WHERE ec_tab.tabid='" . $tabid . "' 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'); $module_entityname = getEntityNameForTen($rel_tablename, $rel_entityname, $fieldname, $value); } } $label_fld[] = $module_entityname; $label_fld["secid"] = $value; $label_fld["link"] = "index.php?module=" . $rel_modulename . "&action=DetailView&record=" . $value; } elseif ($uitype == 33) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = str_ireplace(' |##| ', ', ', $col_fields[$fieldname]); } elseif ($uitype == 17) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; //$label_fld[] = '<a href="http://'.$col_fields[$fieldname].'" target="_blank">'.$col_fields[$fieldname].'</a>'; } elseif ($uitype == 19) { //$tmp_value = str_replace("<","<",nl2br($col_fields[$fieldname])); //$tmp_value = str_replace(">",">",$tmp_value); //$col_fields[$fieldname]= make_clickable($tmp_value); $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 20 || $uitype == 21 || $uitype == 22 || $uitype == 24) { //$col_fields[$fieldname]=nl2br($col_fields[$fieldname]); $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 51 || $uitype == 50 || $uitype == 73) { $account_id = $col_fields[$fieldname]; $account_name = ""; if ($account_id != '') { $account_name = getAccountName($account_id); } //Account Name View $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $account_name; $label_fld["secid"] = $account_id; $label_fld["link"] = "index.php?module=Accounts&action=DetailView&record=" . $account_id; } elseif ($uitype == 52 || $uitype == 77 || $uitype == 101) { $label_fld[] = $mod_strings[$fieldlabel]; $user_id = $col_fields[$fieldname]; $user_name = getUserName($user_id); $label_fld[] = $user_name; } elseif ($uitype == 53) { $user_id = $col_fields[$fieldname]; $user_name = getUserName($user_id); $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $user_name; } elseif ($uitype == 1004) { if (isset($mod_strings[$fieldlabel])) { $label_fld[] = $mod_strings[$fieldlabel]; } else { $label_fld[] = $fieldlabel; } $value = $col_fields[$fieldname]; $label_fld[] = getUserName($value); } elseif ($uitype == 56) { $label_fld[] = $mod_strings[$fieldlabel]; $value = $col_fields[$fieldname]; if ($value == 1) { //Since "yes" is not been translated it is given as app strings here.. $display_val = $app_strings['yes']; } else { $display_val = ''; } $label_fld[] = $display_val; } elseif ($uitype == 57) { $label_fld[] = $mod_strings[$fieldlabel]; $contact_id = $col_fields[$fieldname]; $contact_name = ""; if (trim($contact_id) != '') { $contact_name = getContactName($contact_id); } $label_fld[] = $contact_name; $label_fld["secid"] = $contact_id; $label_fld["link"] = "index.php?module=Contacts&action=DetailView&record=" . $contact_id; } elseif ($uitype == 59) { $label_fld[] = $mod_strings[$fieldlabel]; $product_id = $col_fields[$fieldname]; if ($product_id != '') { $product_name = getProductName($product_id); } //Account Name View $label_fld[] = $product_name; $label_fld["secid"] = $product_id; $label_fld["link"] = "index.php?module=Products&action=DetailView&record=" . $product_id; } elseif ($uitype == 71 || $uitype == 72) { $label_fld[] = $mod_strings[$fieldlabel]; $display_val = $col_fields[$fieldname]; $label_fld[] = $display_val; } elseif ($uitype == 76) { $label_fld[] = $mod_strings[$fieldlabel]; $potential_id = $col_fields[$fieldname]; if ($potential_id != '') { $potential_name = getPotentialName($potential_id); } $label_fld[] = $potential_name; $label_fld["secid"] = $potential_id; $label_fld["link"] = "index.php?module=Potentials&action=DetailView&record=" . $potential_id; } elseif ($uitype == 80) { $label_fld[] = $mod_strings[$fieldlabel]; $salesorder_id = $col_fields[$fieldname]; if ($salesorder_id != '') { $salesorder_name = getSoName($salesorder_id); } $label_fld[] = $salesorder_name; $label_fld["secid"] = $salesorder_id; $label_fld["link"] = "index.php?module=SalesOrder&action=DetailView&record=" . $salesorder_id; } elseif ($uitype == 85) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 86) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 87) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 88) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 89) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } else { $label_fld[] = $mod_strings[$fieldlabel]; if ($col_fields[$fieldname] == '0') { $col_fields[$fieldname] = ''; } $label_fld[] = $col_fields[$fieldname]; } $label_fld[] = $uitype; $log->debug("Exiting getDetailViewOutputHtml method ..."); return $label_fld; }
/** 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; }
/** This function returns the detail view form ec_field and and its properties in array format. * Param $uitype - UI type of the ec_field * Param $fieldname - Form ec_field name * Param $fieldlabel - Form ec_field label name * Param $col_fields - array contains the ec_fieldname and values * Param $generatedtype - Field generated type (default is 1) * Param $tabid - ec_tab id to which the Field belongs to (default is "") * Return type is an array */ function getDetailViewOutputHtml($uitype, $fieldname, $fieldlabel, $col_fields, $generatedtype, $tabid = '') { global $log; $log->debug("Entering getDetailViewOutputHtml() method ..."); global $adb; global $mod_strings; global $app_strings; global $current_user; //$fieldlabel = from_html($fieldlabel); $custfld = ''; $value = ''; $arr_data = array(); $label_fld = array(); $data_fld = array(); if ($generatedtype == 2) { $mod_strings[$fieldlabel] = $fieldlabel; } if (!isset($mod_strings[$fieldlabel])) { $mod_strings[$fieldlabel] = $fieldlabel; } if ($col_fields[$fieldname] == '--None--') { $col_fields[$fieldname] = ''; } if ($uitype == 116) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 13) { $label_fld[] = $mod_strings[$fieldlabel]; $temp_val = $col_fields[$fieldname]; $label_fld[] = $temp_val; $linkvalue = getComposeMailUrl($temp_val); $label_fld["link"] = $linkvalue; } elseif ($uitype == 15 || $uitype == 16 || $uitype == 115 || $uitype == 111) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 10) { if (isset($app_strings[$fieldlabel])) { $label_fld[] = $app_strings[$fieldlabel]; } elseif (isset($mod_strings[$fieldlabel])) { $label_fld[] = $mod_strings[$fieldlabel]; } else { $label_fld[] = $fieldlabel; } $value = $col_fields[$fieldname]; $module_entityname = ""; if ($value != '') { $query = "SELECT ec_entityname.* FROM ec_crmentityrel inner join ec_entityname on ec_entityname.modulename=ec_crmentityrel.relmodule inner join ec_tab on ec_tab.name=ec_crmentityrel.module WHERE ec_tab.tabid='" . $tabid . "' 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'); $module_entityname = getEntityNameForTen($rel_tablename, $rel_entityname, $fieldname, $value); } } $label_fld[] = $module_entityname; $label_fld["secid"] = $value; $label_fld["link"] = "index.php?module=" . $rel_modulename . "&action=DetailView&record=" . $value; } elseif ($uitype == 33) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = str_ireplace(' |##| ', ', ', $col_fields[$fieldname]); } elseif ($uitype == 17) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; //$label_fld[] = '<a href="http://'.$col_fields[$fieldname].'" target="_blank">'.$col_fields[$fieldname].'</a>'; } elseif ($uitype == 19) { //$tmp_value = str_replace("<","<",nl2br($col_fields[$fieldname])); //$tmp_value = str_replace(">",">",$tmp_value); //$col_fields[$fieldname]= make_clickable($tmp_value); $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 20 || $uitype == 21 || $uitype == 22 || $uitype == 24) { //$col_fields[$fieldname]=nl2br($col_fields[$fieldname]); $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 51 || $uitype == 50 || $uitype == 73) { $account_id = $col_fields[$fieldname]; $account_name = ""; if ($account_id != '') { $account_name = getAccountName($account_id); } //Account Name View $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $account_name; $label_fld["secid"] = $account_id; $label_fld["link"] = "index.php?module=Accounts&action=DetailView&record=" . $account_id; } elseif ($uitype == 52 || $uitype == 77 || $uitype == 101) { $label_fld[] = $mod_strings[$fieldlabel]; $user_id = $col_fields[$fieldname]; $user_name = getUserName($user_id); $label_fld[] = $user_name; } elseif ($uitype == 53) { $user_id = $col_fields[$fieldname]; $user_name = getUserName($user_id); $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $user_name; } elseif ($uitype == 1004) { if (isset($mod_strings[$fieldlabel])) { $label_fld[] = $mod_strings[$fieldlabel]; } else { $label_fld[] = $fieldlabel; } $value = $col_fields[$fieldname]; $label_fld[] = getUserName($value); } elseif ($uitype == 55) { if ($tabid == 4) { $query = "select ec_contactdetails.imagename from ec_contactdetails where contactid=" . $col_fields['record_id']; $result = $adb->query($query); $imagename = $adb->query_result($result, 0, 'imagename'); if ($imagename != '') { $imgpath = "test/contact/" . $imagename; $label_fld[] = $mod_strings[$fieldlabel]; //This is used to show the contact image as a thumbnail near First Name field //$label_fld["cntimage"] ='<div style="position:absolute;height=100px"><img class="thumbnail" src="'.$imgpath.'" width="60" height="60" border="0"></div> '.$mod_strings[$fieldlabel]; } else { $label_fld[] = $mod_strings[$fieldlabel]; } } else { $label_fld[] = $mod_strings[$fieldlabel]; } $value = $col_fields[$fieldname]; $sal_value = $col_fields["salutationtype"]; if ($sal_value == '--None--') { $sal_value = ''; } $label_fld["salut"] = $sal_value; $label_fld[] = $value; //$label_fld[] =$sal_value.' '.$value; } elseif ($uitype == 56) { $label_fld[] = $mod_strings[$fieldlabel]; $value = $col_fields[$fieldname]; if ($value == 1) { //Since "yes" is not been translated it is given as app strings here.. $display_val = $app_strings['yes']; } else { $display_val = ''; } $label_fld[] = $display_val; } elseif ($uitype == 57) { $label_fld[] = $mod_strings[$fieldlabel]; $contact_id = $col_fields[$fieldname]; $contact_name = ""; if (trim($contact_id) != '') { $contact_name = getContactName($contact_id); } $label_fld[] = $contact_name; $label_fld["secid"] = $contact_id; $label_fld["link"] = "index.php?module=Contacts&action=DetailView&record=" . $contact_id; } elseif ($uitype == 154) { $label_fld[] = $mod_strings[$fieldlabel]; $cangkusid = $col_fields[$fieldname]; $cangkuname = ""; if (trim($cangkusid) != '') { $cangkuname = getCangkuName($cangkusid); } $label_fld[] = $cangkuname; $label_fld["secid"] = $cangkusid; $label_fld["link"] = "index.php?module=Cangkus&action=DetailView&record=" . $cangkusid; } elseif ($uitype == 155) { $label_fld[] = $mod_strings[$fieldlabel]; $cangkusid = $col_fields[$fieldname]; $cangkuname = ""; if (trim($cangkusid) != '') { $cangkuname = getCangkuName($cangkusid); } $label_fld[] = $cangkuname; $label_fld["secid"] = $cangkusid; // $label_fld["link"] = "index.php?module=Cangkus&action=DetailView&record=".$cangkusid; } elseif ($uitype == 58) { $label_fld[] = $mod_strings[$fieldlabel]; $campaign_id = $col_fields[$fieldname]; if ($campaign_id != '') { $campaign_name = getCampaignName($campaign_id); } $label_fld[] = $campaign_name; $label_fld["secid"] = $campaign_id; $label_fld["link"] = "index.php?module=Campaigns&action=DetailView&record=" . $campaign_id; } elseif ($uitype == 59) { $label_fld[] = $mod_strings[$fieldlabel]; $product_id = $col_fields[$fieldname]; if ($product_id != '') { $product_name = getProductName($product_id); } //Account Name View $label_fld[] = $product_name; $label_fld["secid"] = $product_id; $label_fld["link"] = "index.php?module=Products&action=DetailView&record=" . $product_id; } elseif ($uitype == 61) { global $adb; $label_fld[] = $mod_strings[$fieldlabel]; if ($tabid == 10) { $attach_result = $adb->query("select * from ec_seattachmentsrel where crmid = " . $col_fields['record_id']); for ($ii = 0; $ii < $adb->num_rows($attach_result); $ii++) { $attachmentid = $adb->query_result($attach_result, $ii, 'attachmentsid'); if ($attachmentid != '') { $attachquery = "select * from ec_attachments where attachmentsid=" . $attachmentid; $result = $adb->query($attachquery); $attachmentsname = $adb->query_result($result, 0, 'name'); if ($attachmentsname != '') { $custfldval = '<a href = "index.php?module=uploads&action=downloadfile&return_module=' . $col_fields['record_module'] . '&fileid=' . $attachmentid . '&entityid=' . $col_fields['record_id'] . '">' . $attachmentsname . '</a>'; } else { $custfldval = ''; } } $label_fld['options'][] = $custfldval; } } else { $result = $adb->query("select * from ec_seattachmentsrel where crmid = " . $col_fields['record_id']); $attachmentid = $adb->query_result($result, 0, 'attachmentsid'); if ($col_fields[$fieldname] == '' && $attachmentid != '') { $attachquery = "select * from ec_attachments where attachmentsid=" . $attachmentid; $result = $adb->query($attachquery); $col_fields[$fieldname] = $adb->query_result($result, 0, 'name'); } //This is added to strip the crmid and _ from the file name and show the original filename $org_filename = ltrim($col_fields[$fieldname], $col_fields['record_id'] . '_'); if ($org_filename != '') { $custfldval = '<a href = "index.php?module=uploads&action=downloadfile&return_module=' . $col_fields['record_module'] . '&fileid=' . $attachmentid . '&entityid=' . $col_fields['record_id'] . '">' . $org_filename . '</a>'; } else { $custfldval = ''; } } $label_fld[] = $custfldval; } elseif ($uitype == 69) { $label_fld[] = $mod_strings[$fieldlabel]; if ($tabid == 14) { $images = array(); $image_array = array(); $imagepath_array = array(); $query = "select productname, ec_attachments.path, ec_attachments.attachmentsid, ec_attachments.name from ec_products left join ec_seattachmentsrel on ec_seattachmentsrel.crmid=ec_products.productid inner join ec_attachments on ec_attachments.attachmentsid=ec_seattachmentsrel.attachmentsid where (ec_attachments.type like '%image%' or ec_attachments.type like '%img%') and productid=" . $col_fields['record_id']; $result_image = $adb->query($query); for ($image_iter = 0; $image_iter < $adb->num_rows($result_image); $image_iter++) { $image_id_array[] = $adb->query_result($result_image, $image_iter, 'attachmentsid'); $image_array[] = $adb->query_result($result_image, $image_iter, 'name'); $imagepath_array[] = $adb->query_result($result_image, $image_iter, 'path'); } if (count($image_array) > 1) { // if(count($image_array) < 4) // $sides=count($image_array)*2; // else // $sides=8; // // $image_lists = '<div id="Carousel" style="position:relative;vertical-align: middle;"> // <img src="modules/Products/placeholder.gif" width="571" height="117" style="position:relative;"> // </div><script>var Car_NoOfSides='.$sides.'; Car_Image_Sources=new Array('; // // for($image_iter=0;$image_iter < count($image_array);$image_iter++) // { // $images[]='"'.$imagepath_array[$image_iter].$image_id_array[$image_iter]."_".base64_encode_filename($image_array[$image_iter]).'","'.$imagepath_array[$image_iter].$image_id_array[$image_iter]."_".base64_encode_filename($image_array[$image_iter]).'"'; // } // $image_lists .=implode(',',$images).'); /**</script><script language="JavaScript" type="text/javascript" src="modules/Products/Productsslide.js"></script><script language="JavaScript" type="text/javascript">Carousel();</script>';**/ // $label_fld[] =$image_lists; $num = count($image_array); for ($image_iter = 0; $image_iter < count($image_array); $image_iter++) { $images[] = $imagepath_array[$image_iter] . $image_id_array[$image_iter] . "_" . base64_encode_filename($image_array[$image_iter]); } for ($i = 0; $i < $num; $i++) { $image_lists .= '<a href="' . $images[$i] . '" target="_blank"><img src="' . $images[$i] . '" border="0" width="150" height="150" ></a> '; } //end $label_fld[] = $image_lists; } elseif (count($image_array) == 1) { $label_fld[] = '<a href="' . $imagepath_array[0] . $image_id_array[0] . "_" . base64_encode_filename($image_array[0]) . '" target="_blank" ><img src="' . $imagepath_array[0] . $image_id_array[0] . "_" . base64_encode_filename($image_array[0]) . '" border="0" width="150" height="150"></a>'; } else { $label_fld[] = ''; } } if ($tabid == 4) { //$imgpath = getModuleFileStoragePath('Contacts').$col_fields[$fieldname]; $sql = "select ec_attachments.* from ec_attachments inner join ec_seattachmentsrel on ec_seattachmentsrel.attachmentsid = ec_attachments.attachmentsid where (ec_attachments.type like '%image%' or ec_attachments.type like '%img%') and ec_seattachmentsrel.crmid='" . $col_fields['record_id'] . "'"; $image_res = $adb->query($sql); $image_id = $adb->query_result($image_res, 0, 'attachmentsid'); $image_path = $adb->query_result($image_res, 0, 'path'); $image_name = $adb->query_result($image_res, 0, 'name'); $imgpath = $image_path . $image_id . "_" . base64_encode_filename($image_name); $width = 160; $height = get_scale_height($imgpath, $width); if ($image_name != '') { $label_fld[] = '<img src="' . $imgpath . '" width="' . $width . '" height="' . $height . '" class="reflect" alt="">'; } else { $label_fld[] = ''; } } } elseif ($uitype == 63) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname] . 'h ' . $col_fields['duration_minutes'] . 'm'; } elseif ($uitype == 6) { $label_fld[] = $mod_strings[$fieldlabel]; if ($col_fields[$fieldname] == '0') { $col_fields[$fieldname] = ''; } if ($col_fields['time_start'] != '') { $start_time = $col_fields['time_start']; } if (!isValidDate($col_fields[$fieldname])) { $displ_date = ''; } else { $displ_date = getDisplayDate($col_fields[$fieldname]); } $label_fld[] = $displ_date . ' ' . $start_time; } elseif ($uitype == 5 || $uitype == 23 || $uitype == 70) { $label_fld[] = $mod_strings[$fieldlabel]; $cur_date_val = $col_fields[$fieldname]; $end_time = ""; if (isset($col_fields['time_end']) && $col_fields['time_end'] != '' && ($tabid == 9 || $tabid == 16) && $uitype == 23) { $end_time = $col_fields['time_end']; } if (!isValidDate($cur_date_val)) { $display_val = ''; } else { $display_val = getDisplayDate($cur_date_val); } $label_fld[] = $display_val . ' ' . $end_time; } elseif ($uitype == 1007) { $label_fld[] = isset($mod_strings[$fieldlabel]) ? $mod_strings[$fieldlabel] : $fieldlabel; $cur_approve_val = $col_fields[$fieldname]; $label_fld[] = getApproveStatusById($cur_approve_val); } elseif ($uitype == 1008) { if (isset($mod_strings[$fieldlabel])) { $label_fld[] = $mod_strings[$fieldlabel]; } else { $label_fld[] = $fieldlabel; } $value = $col_fields[$fieldname]; $label_fld[] = getUserName($value); } elseif ($uitype == 71 || $uitype == 72) { $label_fld[] = $mod_strings[$fieldlabel]; $display_val = $col_fields[$fieldname]; $label_fld[] = $display_val; } elseif ($uitype == 75 || $uitype == 81) { $vendor_name = ""; $label_fld[] = $mod_strings[$fieldlabel]; $vendor_id = $col_fields[$fieldname]; if ($vendor_id != '') { $vendor_name = getVendorName($vendor_id); } $label_fld[] = $vendor_name; $label_fld["secid"] = $vendor_id; $label_fld["link"] = "index.php?module=Vendors&action=DetailView&record=" . $vendor_id; //$label_fld[] = '<a href="index.php?module=Products&action=VendorDetailView&record='.$vendor_id.'">'.$vendor_name.'</a>'; } elseif ($uitype == 76) { $label_fld[] = $mod_strings[$fieldlabel]; $potential_id = $col_fields[$fieldname]; if ($potential_id != '') { $potential_name = getPotentialName($potential_id); } $label_fld[] = $potential_name; $label_fld["secid"] = $potential_id; $label_fld["link"] = "index.php?module=Potentials&action=DetailView&record=" . $potential_id; } elseif ($uitype == 78) { $label_fld[] = $mod_strings[$fieldlabel]; $quote_id = $col_fields[$fieldname]; if ($quote_id != '') { $quote_name = getQuoteName($quote_id); } $label_fld[] = $quote_name; $label_fld["secid"] = $quote_id; $label_fld["link"] = "index.php?module=Quotes&action=DetailView&record=" . $quote_id; } elseif ($uitype == 79) { $label_fld[] = $mod_strings[$fieldlabel]; $purchaseorder_id = $col_fields[$fieldname]; if ($purchaseorder_id != '') { $purchaseorder_name = getPoName($purchaseorder_id); } $label_fld[] = $purchaseorder_name; $label_fld["secid"] = $purchaseorder_id; $label_fld["link"] = "index.php?module=PurchaseOrder&action=DetailView&record=" . $purchaseorder_id; } elseif ($uitype == 80) { $label_fld[] = $mod_strings[$fieldlabel]; $salesorder_id = $col_fields[$fieldname]; if ($salesorder_id != '') { $salesorder_name = getSoName($salesorder_id); } $label_fld[] = $salesorder_name; $label_fld["secid"] = $salesorder_id; $label_fld["link"] = "index.php?module=SalesOrder&action=DetailView&record=" . $salesorder_id; } elseif ($uitype == 1010) { $label_fld[] = $mod_strings[$fieldlabel]; $invoice_id = $col_fields[$fieldname]; $invoice_name = ""; if ($invoice_id != '') { $invoice_name = getInvoiceName($invoice_id); } $label_fld[] = $invoice_name; $label_fld["secid"] = $invoice_id; $label_fld["link"] = "index.php?module=Invoice&action=DetailView&record=" . $invoice_id; } elseif ($uitype == 30) { $rem_days = 0; $rem_hrs = 0; $rem_min = 0; $reminder_str = ""; $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; $label_fld[] = $mod_strings[$fieldlabel]; if ($col_fields[$fieldname]) { $reminder_str = $rem_days . ' ' . $mod_strings['LBL_DAYS'] . ' ' . $rem_hrs . ' ' . $mod_strings['LBL_HOURS'] . ' ' . $rem_min . ' ' . $mod_strings['LBL_MINUTES'] . ' ' . $mod_strings['LBL_BEFORE_EVENT']; } $label_fld[] = ' ' . $reminder_str; } elseif ($uitype == 85) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 86) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 87) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 88) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 89) { $label_fld[] = $mod_strings[$fieldlabel]; $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 1006) { //added by dingjianting on 2007-1-27 for new module Exhibitions $catalog_name = ""; $label_fld[] = $mod_strings[$fieldlabel]; $catalogid = $col_fields[$fieldname]; if ($catalogid != '') { $catalog_name = getCatalogName($catalogid); } $label_fld[] = $catalog_name; $label_fld["secid"] = $catalogid; $label_fld["link"] = "index.php?module=Catalogs&action=CatalogDetailView&parenttab=Product&catalogid=" . $catalogid; } elseif ($uitype == 1009) { $vcontact_name = ""; $label_fld[] = $mod_strings[$fieldlabel]; $vcontactsid = $col_fields[$fieldname]; if ($vcontactsid != '') { $vcontact_name = getVcontactName($vcontactsid); } $label_fld[] = $vcontact_name; $label_fld["secid"] = $vcontactsid; $label_fld["link"] = "index.php?module=Vcontacts&action=DetailView&record=" . $vcontactsid; } elseif ($uitype == 1013) { $faqcategory_name = ""; $label_fld[] = $mod_strings[$fieldlabel]; $faqcategoryid = $col_fields[$fieldname]; if ($faqcategoryid != '') { $faqcategory_name = getFaqcategoryName($faqcategoryid); } $label_fld[] = $faqcategory_name; $label_fld["secid"] = $faqcategoryid; $label_fld["link"] = "index.php?module=Faqcategorys&action=FaqcategoryDetailView&faqcategoryid=" . $faqcategoryid; } else { $label_fld[] = $mod_strings[$fieldlabel]; if ($col_fields[$fieldname] == '0') { $col_fields[$fieldname] = ''; } $label_fld[] = $col_fields[$fieldname]; } $label_fld[] = $uitype; $log->debug("Exiting getDetailViewOutputHtml method ..."); return $label_fld; }