コード例 #1
0
ファイル: ModTracker_Basic.php プロジェクト: nvh3010/quancrm
	function getDisplayName() {
		if (!isset($this->_entityName)) {
			$entityName = getEntityName($this->module, array($this->crmid));
			$this->_entityName = $entityName[$this->crmid];
		}
		return $this->_entityName;
	}
コード例 #2
0
ファイル: entityName.php プロジェクト: cin-system/cinrepo
 function pdfmakerGetEntityName($entityid)
 {
     $adb = PearDatabase::getInstance();
     $row = $adb->fetchByAssoc($adb->pquery("SELECT setype FROM vtiger_crmentity WHERE crmid=?", array($entityid)));
     $return = getEntityName($row['setype'], array($entityid));
     return $return[$entityid];
 }
コード例 #3
0
 /**
  * Getting value to display
  * @param type $value
  * @return string
  */
 public function getEditValue($value)
 {
     $referenceModule = $this->getReferenceModule($value);
     if ($referenceModule) {
         $entityNames = getEntityName($referenceModule, [$value]);
         return $entityNames[$value];
     }
     return '';
 }
コード例 #4
0
ファイル: Reference.php プロジェクト: rcrrich/YetiForceCRM
 /**
  * Function to get the display value in edit view
  * @param reference record id
  * @return link
  */
 public function getEditViewDisplayValue($value)
 {
     $referenceModule = $this->getReferenceModule($value);
     if ($referenceModule) {
         $referenceModuleName = $referenceModule->get('name');
         $entityNames = getEntityName($referenceModuleName, array($value));
         return $entityNames[$value];
     }
     return '';
 }
コード例 #5
0
 function handleEvent($eventName, $data)
 {
     global $adb;
     if ($eventName == 'vtiger.entity.aftersave') {
         $labelInfo = getEntityName($data->getModuleName(), $data->getId(), true);
         if ($labelInfo) {
             $label = decode_html($labelInfo[$data->getId()]);
             $adb->pquery('UPDATE vtiger_crmentity SET label=? WHERE crmid=?', array($label, $data->getId()));
         }
     }
 }
コード例 #6
0
ファイル: Reference.php プロジェクト: cin-system/cinrepo
 /**
  * Function to get the display value in edit view
  * @param reference record id
  * @return link
  */
 public function getEditViewDisplayValue($value)
 {
     global $log;
     $log->debug("Entering ./uitypes/Reference.php::getEditViewDisplayValue");
     $referenceModule = $this->getReferenceModule($value);
     if ($referenceModule) {
         $referenceModuleName = $referenceModule->get('name');
         $entityNames = getEntityName($referenceModuleName, array($value));
         return $entityNames[$value];
     }
     return '';
 }
コード例 #7
0
 function handleEvent($eventName, $data)
 {
     global $log;
     $log->debug("Entering ./handlers/RecordLabelUpdater.php::handleEvent");
     global $adb;
     if ($eventName == 'vtiger.entity.aftersave') {
         $module = $data->getModuleName();
         if ($module != "Users") {
             $labelInfo = getEntityName($module, $data->getId());
             if ($labelInfo) {
                 $label = decode_html($labelInfo[$data->getId()]);
                 $adb->pquery('UPDATE vtiger_crmentity SET label=? WHERE crmid=?', array($label, $data->getId()));
             }
         }
     }
 }
コード例 #8
0
 public function searchIncomingCalls(Vtiger_Request $request)
 {
     $recordModel = PBXManager_Record_Model::getCleanInstance();
     $response = new Vtiger_Response();
     $user = Users_Record_Model::getCurrentUserModel();
     $recordModels = $recordModel->searchIncomingCall();
     // To check whether user have permission on caller record
     if ($recordModels) {
         foreach ($recordModels as $recordModel) {
             // To check whether the user has permission to see contact name in popup
             $recordModel->set('callername', null);
             $callerid = $recordModel->get('customer');
             if ($callerid) {
                 $moduleName = $recordModel->get('customertype');
                 if (!Users_Privileges_Model::isPermitted($moduleName, 'DetailView', $callerid)) {
                     $name = $recordModel->get('customernumber') . vtranslate('LBL_HIDDEN', 'PBXManager');
                     $recordModel->set('callername', $name);
                 } else {
                     $entityNames = getEntityName($moduleName, array($callerid));
                     $callerName = $entityNames[$callerid];
                     $recordModel->set('callername', $callerName);
                 }
             }
             // End
             $direction = $recordModel->get('direction');
             if ($direction == 'inbound') {
                 $userid = $recordModel->get('user');
                 if ($userid) {
                     $entityNames = getEntityName('Users', array($userid));
                     $userName = $entityNames[$userid];
                     $recordModel->set('answeredby', $userName);
                 }
             }
             $recordModel->set('current_user_id', $user->id);
             $calls[] = $recordModel->getData();
         }
     }
     $response->setResult($calls);
     $response->emit();
 }
コード例 #9
0
ファイル: StartCall.php プロジェクト: casati-dolibarr/corebos
function startCall()
{
    global $current_user, $adb, $log;
    require_once 'include/utils/utils.php';
    require_once 'modules/PBXManager/utils/AsteriskClass.php';
    require_once 'modules/PBXManager/AsteriskUtils.php';
    $id = $current_user->id;
    $number = $_REQUEST['number'];
    $record = $_REQUEST['recordid'];
    $result = $adb->query("select * from vtiger_asteriskextensions where userid=" . $current_user->id);
    $extension = $adb->query_result($result, 0, "asterisk_extension");
    $data = getAsteriskInfo($adb);
    if (!empty($data)) {
        $server = $data['server'];
        $port = $data['port'];
        $username = $data['username'];
        $password = $data['password'];
        $version = $data['version'];
        $errno = $errstr = NULL;
        $sock = fsockopen($server, $port, $errno, $errstr, 1);
        stream_set_blocking($sock, false);
        if ($sock === false) {
            echo "Socket cannot be created due to error: {$errno}:  {$errstr}\n";
            $log->debug("Socket cannot be created due to error:   {$errno}:  {$errstr}\n");
            exit(0);
        }
        $asterisk = new Asterisk($sock, $server, $port);
        loginUser($username, $password, $asterisk);
        $asterisk->transfer($extension, $number);
        $callerModule = getSalesEntityType($record);
        $entityNames = getEntityName($callerModule, array($record));
        $callerName = $entityNames[$record];
        $callerInfo = array('id' => $record, 'module' => $callerModule, 'name' => $callerName);
        //adds to pbx manager
        addToCallHistory($extension, $extension, $number, "outgoing", $adb, $callerInfo);
        // add to the records activity history
        addOutgoingcallHistory($current_user, $extension, $record, $adb);
    }
}
コード例 #10
0
ファイル: updateLeadDBStatus.php プロジェクト: hardikk/HNH
} elseif (isset($_REQUEST['leadval']) && $_REQUEST['leadval'] != '') {
    foreach ($storearray as $id) {
        if (isPermitted($return_module, 'EditView', $id) == 'yes') {
            if ($id != '') {
                $sql = "update vtiger_leaddetails set leadstatus=? where leadid=?";
                $result = $adb->pquery($sql, array($leadstatusval, $id));
                $query = "update vtiger_crmentity set modifiedby=?, modifiedtime=? where crmid=?";
                $result1 = $adb->pquery($query, array($current_user->id, $adb->formatDate($date_var, true), $id));
            }
        } else {
            $ids_list[] = $id;
        }
    }
}
if (count($ids_list) > 0) {
    $ret_owner = getEntityName($return_module, $ids_list);
    $errormsg = implode(',', $ret_owner);
} else {
    $errormsg = '';
}
if ($return_action == 'ActivityAjax') {
    $view = vtlib_purify($_REQUEST['view']);
    $day = vtlib_purify($_REQUEST['day']);
    $month = vtlib_purify($_REQUEST['month']);
    $year = vtlib_purify($_REQUEST['year']);
    $type = vtlib_purify($_REQUEST['type']);
    $viewOption = vtlib_purify($_REQUEST['viewOption']);
    $subtab = vtlib_purify($_REQUEST['subtab']);
    header("Location: index.php?module={$return_module}&action=" . $return_action . "&type=" . $type . $rstart . "&view=" . $view . "&day=" . $day . "&month=" . $month . "&year=" . $year . "&viewOption=" . $viewOption . "&subtab=" . $subtab . $url);
} else {
    header("Location: index.php?module={$return_module}&action=" . $return_module . "Ajax&file=ListView&ajax=changestate" . $rstart . "&viewname=" . $viewid . "&errormsg=" . $errormsg . $url);
コード例 #11
0
ファイル: RelBlockRun.php プロジェクト: cin-system/cinrepo
 public function getPDFMakerFieldValue($report, $picklistArray, $dbField, $valueArray, $fieldName)
 {
     global $current_user, $default_charset;
     $db = PearDatabase::getInstance();
     $value = $valueArray[$fieldName];
     $fld_type = $dbField->type;
     list($module, $fieldLabel) = explode('_', $dbField->name, 2);
     $fieldInfo = $this->getFieldByPDFMakerLabel($module, $fieldLabel);
     $fieldType = null;
     $fieldvalue = $value;
     if (!empty($fieldInfo)) {
         $field = WebserviceField::fromArray($db, $fieldInfo);
         $fieldType = $field->getFieldDataType();
     }
     if ($fieldType == 'currency' && $value != '') {
         // Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
         if ($field->getUIType() == '72') {
             $curid_value = explode("::", $value);
             $currency_id = $curid_value[0];
             $currency_value = $curid_value[1];
             $cur_sym_rate = getCurrencySymbolandCRate($currency_id);
             if ($value != '') {
                 if ($dbField->name == 'Products_Unit_Price') {
                     // need to do this only for Products Unit Price
                     if ($currency_id != 1) {
                         $currency_value = (double) $cur_sym_rate['rate'] * (double) $currency_value;
                     }
                 }
                 $formattedCurrencyValue = CurrencyField::convertToUserFormat($currency_value, null, true);
                 $fieldvalue = CurrencyField::appendCurrencySymbol($formattedCurrencyValue, $cur_sym_rate['symbol']);
             }
         } else {
             $currencyField = new CurrencyField($value);
             $fieldvalue = $currencyField->getDisplayValue();
         }
     } elseif ($dbField->name == "PurchaseOrder_Currency" || $dbField->name == "SalesOrder_Currency" || $dbField->name == "Invoice_Currency" || $dbField->name == "Quotes_Currency" || $dbField->name == "PriceBooks_Currency") {
         if ($value != '') {
             $fieldvalue = getTranslatedCurrencyString($value);
         }
     } elseif (in_array($dbField->name, $this->ui101_fields) && !empty($value)) {
         $entityNames = getEntityName('Users', $value);
         $fieldvalue = $entityNames[$value];
     } elseif ($fieldType == 'date' && !empty($value)) {
         if ($module == 'Calendar' && $field->getFieldName() == 'due_date') {
             $endTime = $valueArray['calendar_end_time'];
             if (empty($endTime)) {
                 $recordId = $valueArray['calendar_id'];
                 $endTime = getSingleFieldValue('vtiger_activity', 'time_end', 'activityid', $recordId);
             }
             $date = new DateTimeField($value . ' ' . $endTime);
             $fieldvalue = $date->getDisplayDate();
         } else {
             $fieldvalue = DateTimeField::convertToUserFormat($value);
         }
     } elseif ($fieldType == "datetime" && !empty($value)) {
         $date = new DateTimeField($value);
         $fieldvalue = $date->getDisplayDateTimeValue();
     } elseif ($fieldType == 'time' && !empty($value) && $field->getFieldName() != 'duration_hours') {
         if ($field->getFieldName() == "time_start" || $field->getFieldName() == "time_end") {
             $date = new DateTimeField($value);
             $fieldvalue = $date->getDisplayTime();
         } else {
             $fieldvalue = $value;
         }
     } elseif ($fieldType == "picklist" && !empty($value)) {
         if (is_array($picklistArray)) {
             if (is_array($picklistArray[$dbField->name]) && $field->getFieldName() != 'activitytype' && !in_array($value, $picklistArray[$dbField->name])) {
                 $fieldvalue = $app_strings['LBL_NOT_ACCESSIBLE'];
             } else {
                 $fieldvalue = $this->getTranslatedString($value, $module);
             }
         } else {
             $fieldvalue = $this->getTranslatedString($value, $module);
         }
     } elseif ($fieldType == "multipicklist" && !empty($value)) {
         if (is_array($picklistArray[1])) {
             $valueList = explode(' |##| ', $value);
             $translatedValueList = array();
             foreach ($valueList as $value) {
                 if (is_array($picklistArray[1][$dbField->name]) && !in_array($value, $picklistArray[1][$dbField->name])) {
                     $translatedValueList[] = $app_strings['LBL_NOT_ACCESSIBLE'];
                 } else {
                     $translatedValueList[] = $this->getTranslatedString($value, $module);
                 }
             }
         }
         if (!is_array($picklistArray[1]) || !is_array($picklistArray[1][$dbField->name])) {
             $fieldvalue = str_replace(' |##| ', ', ', $value);
         } else {
             implode(', ', $translatedValueList);
         }
     } elseif ($fieldType == 'double') {
         if ($current_user->truncate_trailing_zeros == true) {
             $fieldvalue = decimalFormat($fieldvalue);
         }
     }
     if ($fieldvalue == "") {
         return "-";
     }
     $fieldvalue = str_replace("<", "&lt;", $fieldvalue);
     $fieldvalue = str_replace(">", "&gt;", $fieldvalue);
     $fieldvalue = decode_html($fieldvalue);
     if (stristr($fieldvalue, "|##|") && empty($fieldType)) {
         $fieldvalue = str_ireplace(' |##| ', ', ', $fieldvalue);
     } elseif ($fld_type == "date" && empty($fieldType)) {
         $fieldvalue = DateTimeField::convertToUserFormat($fieldvalue);
     } elseif ($fld_type == "datetime" && empty($fieldType)) {
         $date = new DateTimeField($fieldvalue);
         $fieldvalue = $date->getDisplayDateTimeValue();
     }
     // Added to render html tag for description fields
     if ($fieldInfo['uitype'] == '19' && ($module == 'Documents' || $module == 'Emails')) {
         return $fieldvalue;
     }
     return htmlentities($fieldvalue, ENT_QUOTES, $default_charset);
 }
コード例 #12
0
/**
 * this function accepts an ID and returns the entity value for that id
 * @param integer $id - the crmid of the record
 * @return string $data - the entity name for the id
 */
function getRecordInfoFromID($id)
{
    global $adb;
    $data = array();
    $sql = "select setype from vtiger_crmentity where crmid=?";
    $result = $adb->pquery($sql, array($id));
    if ($adb->num_rows($result) > 0) {
        $setype = $adb->query_result($result, 0, "setype");
        $data = getEntityName($setype, $id);
    }
    $data = array_values($data);
    $data = $data[0];
    return $data;
}
コード例 #13
0
 public function fetchNameList($field, $result)
 {
     $referenceFieldInfoList = $this->queryGenerator->getReferenceFieldInfoList();
     $fieldName = $field->getFieldName();
     $rowCount = $this->db->num_rows($result);
     $idList = array();
     for ($i = 0; $i < $rowCount; $i++) {
         $id = $this->db->query_result($result, $i, $field->getColumnName());
         if (!isset($this->nameList[$fieldName][$id])) {
             $idList[$id] = $id;
         }
     }
     $idList = array_keys($idList);
     if (count($idList) == 0) {
         return;
     }
     $moduleList = $referenceFieldInfoList[$fieldName];
     foreach ($moduleList as $module) {
         $meta = $this->queryGenerator->getMeta($module);
         if ($meta->isModuleEntity()) {
             if ($module == 'Users') {
                 $nameList = getOwnerNameList($idList);
             } else {
                 //TODO handle multiple module names overriding each other.
                 $nameList = getEntityName($module, $idList);
             }
         } else {
             $nameList = vtws_getActorEntityName($module, $idList);
         }
         $entityTypeList = array_intersect(array_keys($nameList), $idList);
         foreach ($entityTypeList as $id) {
             $this->typeList[$id] = $module;
         }
         if (empty($this->nameList[$fieldName])) {
             $this->nameList[$fieldName] = array();
         }
         foreach ($entityTypeList as $id) {
             $this->typeList[$id] = $module;
             $this->nameList[$fieldName][$id] = $nameList[$id];
         }
     }
 }
コード例 #14
0
ファイル: ListViewUtils.php プロジェクト: latechdirect/vtiger
function getValue($field_result, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, $mode, $popuptype, $returnset = '', $viewid = '')
{
    global $log, $listview_max_textlength, $app_strings, $current_language, $currentModule;
    $log->debug("Entering getValue(" . $field_result . "," . $list_result . "," . $fieldname . "," . get_class($focus) . "," . $module . "," . $entity_id . "," . $list_result_count . "," . $mode . "," . $popuptype . "," . $returnset . "," . $viewid . ") method ...");
    global $adb, $current_user, $default_charset;
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    $tabname = getParentTab();
    $tabid = getTabid($module);
    $current_module_strings = return_module_language($current_language, $module);
    $uicolarr = $field_result[$fieldname];
    foreach ($uicolarr as $key => $value) {
        $uitype = $key;
        $colname = $value;
    }
    //added for getting event status in Custom view - Jaguar
    if ($module == 'Calendar' && ($colname == "status" || $colname == "eventstatus")) {
        $colname = "activitystatus";
    }
    //Ends
    $field_val = $adb->query_result($list_result, $list_result_count, $colname);
    if (stristr(html_entity_decode($field_val), "<a href") === false && $uitype != 8) {
        $temp_val = textlength_check($field_val);
    } elseif ($uitype != 8) {
        $temp_val = html_entity_decode($field_val, ENT_QUOTES);
    } else {
        $temp_val = $field_val;
    }
    // vtlib customization: New uitype to handle relation between modules
    if ($uitype == '10') {
        $parent_id = $field_val;
        if (!empty($parent_id)) {
            $parent_module = getSalesEntityType($parent_id);
            $valueTitle = $parent_module;
            if ($app_strings[$valueTitle]) {
                $valueTitle = $app_strings[$valueTitle];
            }
            $displayValueArray = getEntityName($parent_module, $parent_id);
            if (!empty($displayValueArray)) {
                foreach ($displayValueArray as $key => $value) {
                    $displayValue = $value;
                }
            }
            $value = "<a href='index.php?module={$parent_module}&action=DetailView&record={$parent_id}' title='{$valueTitle}'>{$displayValue}</a>";
        } else {
            $value = '';
        }
    } else {
        if ($uitype == 53) {
            $value = textlength_check($adb->query_result($list_result, $list_result_count, 'user_name'));
            // When Assigned To field is used in Popup window
            if ($value == '') {
                $user_id = $adb->query_result($list_result, $list_result_count, 'smownerid');
                if ($user_id != null && $user_id != '') {
                    $value = getOwnerName($user_id);
                }
            }
        } elseif ($uitype == 52) {
            $value = getUserName($adb->query_result($list_result, $list_result_count, $colname));
        } elseif ($uitype == 51) {
            $parentid = $adb->query_result($list_result, $list_result_count, "parentid");
            if ($module == 'Accounts') {
                $entity_name = textlength_check(getAccountName($parentid));
            } elseif ($module == 'Products') {
                $entity_name = textlength_check(getProductName($parentid));
            }
            $value = '<a href="index.php?module=' . $module . '&action=DetailView&record=' . $parentid . '&parenttab=' . $tabname . '" style="' . $P_FONT_COLOR . '">' . $entity_name . '</a>';
        } elseif ($uitype == 77) {
            $value = getUserName($adb->query_result($list_result, $list_result_count, 'inventorymanager'));
        } elseif ($uitype == 5 || $uitype == 6 || $uitype == 23 || $uitype == 70) {
            if ($temp_val != '' && $temp_val != '0000-00-00') {
                $value = getDisplayDate($temp_val);
            } elseif ($temp_val == '0000-00-00') {
                $value = '';
            } else {
                $value = $temp_val;
            }
        } elseif ($uitype == 15 || $uitype == 55 && $fieldname == "salutationtype") {
            $temp_val = decode_html($adb->query_result($list_result, $list_result_count, $colname));
            if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $temp_val != '') {
                $temp_acttype = $adb->query_result($list_result, $list_result_count, 'activitytype');
                if ($temp_acttype != 'Task' && $fieldname == "taskstatus") {
                    $temptable = "eventstatus";
                } else {
                    $temptable = $fieldname;
                }
                $roleid = $current_user->roleid;
                $roleids = array();
                $subrole = getRoleSubordinates($roleid);
                if (count($subrole) > 0) {
                    $roleids = $subrole;
                }
                array_push($roleids, $roleid);
                //here we are checking wheather the table contains the sortorder column .If  sortorder is present in the main picklist table, then the role2picklist will be applicable for this table...
                $sql = "select * from vtiger_{$temptable} where {$temptable}=?";
                $res = $adb->pquery($sql, array(decode_html($temp_val)));
                $picklistvalueid = $adb->query_result($res, 0, 'picklist_valueid');
                if ($picklistvalueid != null) {
                    $pick_query = "select * from vtiger_role2picklist where picklistvalueid={$picklistvalueid} and roleid in (" . generateQuestionMarks($roleids) . ")";
                    $res_val = $adb->pquery($pick_query, array($roleids));
                    $num_val = $adb->num_rows($res_val);
                }
                if ($num_val > 0 || $temp_acttype == 'Task' && $fieldname == 'activitytype') {
                    $temp_val = $temp_val;
                } else {
                    $temp_val = "<font color='red'>" . $app_strings['LBL_NOT_ACCESSIBLE'] . "</font>";
                }
            }
            $value = $current_module_strings[$temp_val] != '' ? $current_module_strings[$temp_val] : ($app_strings[$temp_val] != '' ? $app_strings[$temp_val] : $temp_val);
            if ($value != "<font color='red'>" . $app_strings['LBL_NOT_ACCESSIBLE'] . "</font>") {
                $value = textlength_check($value);
            }
        } elseif ($uitype == 16) {
            $value = getTranslatedString($temp_val, $currentModule);
        } elseif ($uitype == 71 || $uitype == 72) {
            if ($temp_val != '') {
                if ($fieldname == 'unit_price') {
                    $currency_id = getProductBaseCurrency($entity_id, $module);
                    $cursym_convrate = getCurrencySymbolandCRate($currency_id);
                    $value = "<font style='color:grey;'>" . $cursym_convrate['symbol'] . "</font> " . $temp_val;
                } else {
                    $rate = $user_info['conv_rate'];
                    //changes made to remove vtiger_currency symbol infront of each vtiger_potential amount
                    if ($temp_val != 0) {
                        $value = convertFromDollar($temp_val, $rate);
                    } else {
                        $value = $temp_val;
                    }
                }
            } else {
                $value = '';
            }
        } elseif ($uitype == 17) {
            $value = '<a href="http://' . $field_val . '" target="_blank">' . $temp_val . '</a>';
        } elseif ($uitype == 13 || $uitype == 104 && ($_REQUEST['action'] != 'Popup' && $_REQUEST['file'] != 'Popup')) {
            if ($_SESSION['internal_mailer'] == 1) {
                //check added for email link in user detailview
                if ($module == 'Calendar') {
                    if (getActivityType($entity_id) == 'Task') {
                        $tabid = 9;
                    } else {
                        $tabid = 16;
                    }
                } else {
                    $tabid = getTabid($module);
                }
                $fieldid = getFieldid($tabid, $fieldname);
                if (empty($popuptype)) {
                    $value = '<a href="javascript:InternalMailer(' . $entity_id . ',' . $fieldid . ',\'' . $fieldname . '\',\'' . $module . '\',\'record_id\');">' . $temp_val . '</a>';
                } else {
                    $value = $temp_val;
                }
            } else {
                $value = '<a href="mailto:' . $field_val . '">' . $temp_val . '</a>';
            }
        } elseif ($uitype == 56) {
            if ($temp_val == 1) {
                $value = $app_strings['yes'];
            } elseif ($temp_val == 0) {
                $value = $app_strings['no'];
            } else {
                $value = '';
            }
        } elseif ($uitype == 57) {
            if ($temp_val != '') {
                $sql = "SELECT * FROM vtiger_contactdetails WHERE contactid=?";
                $result = $adb->pquery($sql, array($temp_val));
                $value = '';
                if ($adb->num_rows($result)) {
                    $name = getFullNameFromQResult($result, 0, "Contacts");
                    $value = '<a href=index.php?module=Contacts&action=DetailView&record=' . $temp_val . '>' . $name . '</a>';
                }
            } else {
                $value = '';
            }
        } elseif ($uitype == 58) {
            if ($temp_val != '') {
                $sql = "SELECT * FROM vtiger_campaign WHERE campaignid=?";
                $result = $adb->pquery($sql, array($temp_val));
                $campaignname = $adb->query_result($result, 0, "campaignname");
                $value = '<a href=index.php?module=Campaigns&action=DetailView&record=' . $temp_val . '>' . $campaignname . '</a>';
            } else {
                $value = '';
            }
        } elseif ($uitype == 59) {
            if ($temp_val != '') {
                $value = getProductName($temp_val);
            } else {
                $value = '';
            }
        } elseif ($uitype == 61) {
            $attachmentid = $adb->query_result($adb->pquery("SELECT * FROM vtiger_seattachmentsrel WHERE crmid = ?", array($entity_id)), 0, 'attachmentsid');
            $value = '<a href = "index.php?module=uploads&action=downloadfile&return_module=' . $module . '&fileid=' . $attachmentid . '&filename=' . $temp_val . '">' . $temp_val . '</a>';
        } elseif ($uitype == 62) {
            $parentid = $adb->query_result($list_result, $list_result_count, "parent_id");
            $parenttype = $adb->query_result($list_result, $list_result_count, "parent_type");
            if ($parenttype == "Leads") {
                $tablename = "vtiger_leaddetails";
                $fieldname = "lastname";
                $idname = "leadid";
            }
            if ($parenttype == "Accounts") {
                $tablename = "vtiger_account";
                $fieldname = "accountname";
                $idname = "accountid";
            }
            if ($parenttype == "Products") {
                $tablename = "vtiger_products";
                $fieldname = "productname";
                $idname = "productid";
            }
            if ($parenttype == "HelpDesk") {
                $tablename = "vtiger_troubletickets";
                $fieldname = "title";
                $idname = "ticketid";
            }
            if ($parenttype == "Invoice") {
                $tablename = "vtiger_invoice";
                $fieldname = "subject";
                $idname = "invoiceid";
            }
            if ($parentid != '') {
                $sql = "SELECT * FROM {$tablename} WHERE {$idname} = ?";
                $fieldvalue = $adb->query_result($adb->pquery($sql, array($parentid)), 0, $fieldname);
                $value = '<a href=index.php?module=' . $parenttype . '&action=DetailView&record=' . $parentid . '&parenttab=' . urlencode($tabname) . '>' . $fieldvalue . '</a>';
            } else {
                $value = '';
            }
        } elseif ($uitype == 66) {
            $parentid = $adb->query_result($list_result, $list_result_count, "parent_id");
            $parenttype = $adb->query_result($list_result, $list_result_count, "parent_type");
            if ($parenttype == "Leads") {
                $tablename = "vtiger_leaddetails";
                $fieldname = "lastname";
                $idname = "leadid";
            }
            if ($parenttype == "Accounts") {
                $tablename = "vtiger_account";
                $fieldname = "accountname";
                $idname = "accountid";
            }
            if ($parenttype == "HelpDesk") {
                $tablename = "vtiger_troubletickets";
                $fieldname = "title";
                $idname = "ticketid";
            }
            if ($parentid != '') {
                $sql = "SELECT * FROM {$tablename} WHERE {$idname} = ?";
                $fieldvalue = $adb->query_result($adb->pquery($sql, array($parentid)), 0, $fieldname);
                $value = '<a href=index.php?module=' . $parenttype . '&action=DetailView&record=' . $parentid . '&parenttab=' . urlencode($tabname) . '>' . $fieldvalue . '</a>';
            } else {
                $value = '';
            }
        } elseif ($uitype == 67) {
            $parentid = $adb->query_result($list_result, $list_result_count, "parent_id");
            $parenttype = $adb->query_result($list_result, $list_result_count, "parent_type");
            if ($parenttype == "Leads") {
                $tablename = "vtiger_leaddetails";
                $fieldname = "lastname";
                $idname = "leadid";
            }
            if ($parenttype == "Contacts") {
                $tablename = "vtiger_contactdetails";
                $fieldname = "contactname";
                $idname = "contactid";
            }
            if ($parentid != '') {
                $sql = "SELECT * FROM {$tablename} WHERE {$idname} = ?";
                $fieldvalue = $adb->query_result($adb->pquery($sql, array($parentid)), 0, $fieldname);
                $value = '<a href=index.php?module=' . $parenttype . '&action=DetailView&record=' . $parentid . '&parenttab=' . urlencode($tabname) . '>' . $fieldvalue . '</a>';
            } else {
                $value = '';
            }
        } elseif ($uitype == 68) {
            $parentid = $adb->query_result($list_result, $list_result_count, "parent_id");
            $parenttype = $adb->query_result($list_result, $list_result_count, "parent_type");
            if ($parenttype == '' && $parentid != '') {
                $parenttype = getSalesEntityType($parentid);
            }
            if ($parenttype == "Contacts") {
                $tablename = "vtiger_contactdetails";
                $fieldname = "contactname";
                $idname = "contactid";
            }
            if ($parenttype == "Accounts") {
                $tablename = "vtiger_account";
                $fieldname = "accountname";
                $idname = "accountid";
            }
            if ($parentid != '') {
                $sql = "SELECT * FROM {$tablename} WHERE {$idname} = ?";
                $fieldvalue = $adb->query_result($adb->pquery($sql, array($parentid)), 0, $fieldname);
                $value = '<a href=index.php?module=' . $parenttype . '&action=DetailView&record=' . $parentid . '&parenttab=' . urlencode($tabname) . '>' . $fieldvalue . '</a>';
            } else {
                $value = '';
            }
        } elseif ($uitype == 78) {
            if ($temp_val != '') {
                $quote_name = getQuoteName($temp_val);
                $value = '<a href=index.php?module=Quotes&action=DetailView&record=' . $temp_val . '&parenttab=' . urlencode($tabname) . '>' . textlength_check($quote_name) . '</a>';
            } else {
                $value = '';
            }
        } elseif ($uitype == 79) {
            if ($temp_val != '') {
                $purchaseorder_name = getPoName($temp_val);
                $value = '<a href=index.php?module=PurchaseOrder&action=DetailView&record=' . $temp_val . '&parenttab=' . urlencode($tabname) . '>' . textlength_check($purchaseorder_name) . '</a>';
            } else {
                $value = '';
            }
        } elseif ($uitype == 80) {
            if ($temp_val != '') {
                $salesorder_name = getSoName($temp_val);
                $value = "<a href=index.php?module=SalesOrder&action=DetailView&record={$temp_val}&parenttab=" . urlencode($tabname) . ">" . textlength_check($salesorder_name) . '</a>';
            } else {
                $value = '';
            }
        } elseif ($uitype == 75 || $uitype == 81) {
            if ($temp_val != '') {
                $vendor_name = getVendorName($temp_val);
                $value = '<a href=index.php?module=Vendors&action=DetailView&record=' . $temp_val . '&parenttab=' . urlencode($tabname) . '>' . textlength_check($vendor_name) . '</a>';
            } else {
                $value = '';
            }
        } elseif ($uitype == 98) {
            $value = '<a href="index.php?action=RoleDetailView&module=Settings&parenttab=Settings&roleid=' . $temp_val . '">' . textlength_check(getRoleName($temp_val)) . '</a>';
        } elseif ($uitype == 33) {
            $value = $temp_val != "" ? str_ireplace(' |##| ', ', ', $temp_val) : "";
            if (!$is_admin && $value != '') {
                $value = $field_val != "" ? str_ireplace(' |##| ', ', ', $field_val) : "";
                if ($value != '') {
                    $value_arr = explode(',', trim($value));
                    $roleid = $current_user->roleid;
                    $subrole = getRoleSubordinates($roleid);
                    if (count($subrole) > 0) {
                        $roleids = $subrole;
                        array_push($roleids, $roleid);
                    } else {
                        $roleids = $roleid;
                    }
                    if (count($roleids) > 0) {
                        $pick_query = "select distinct {$fieldname} from vtiger_{$fieldname} inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_{$fieldname}.picklist_valueid where roleid in (" . generateQuestionMarks($roleids) . ") and picklistid in (select picklistid from vtiger_{$fieldname}) order by {$fieldname} asc";
                        $params = array($roleids);
                    } else {
                        $pick_query = "select distinct {$fieldname} from vtiger_{$fieldname} inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_{$fieldname}.picklist_valueid where picklistid in (select picklistid from vtiger_{$fieldname}) order by {$fieldname} asc";
                        $params = array();
                    }
                    $pickListResult = $adb->pquery($pick_query, $params);
                    $picklistval = array();
                    for ($i = 0; $i < $adb->num_rows($pickListResult); $i++) {
                        $picklistarr[] = $adb->query_result($pickListResult, $i, $fieldname);
                    }
                    $value_temp = array();
                    $string_temp = '';
                    $str_c = 0;
                    foreach ($value_arr as $ind => $val) {
                        $notaccess = '<font color="red">' . $app_strings['LBL_NOT_ACCESSIBLE'] . "</font>";
                        if (!$listview_max_textlength || !(strlen(preg_replace("/(<\\/?)(\\w+)([^>]*>)/i", "", $string_temp)) > $listview_max_textlength)) {
                            $value_temp1 = in_array(trim($val), $picklistarr) ? $val : $notaccess;
                            if ($str_c != 0) {
                                $string_temp .= ' , ';
                            }
                            $string_temp .= $value_temp1;
                            $str_c++;
                        } else {
                            $string_temp .= '...';
                        }
                    }
                    $value = $string_temp;
                }
            }
        } elseif ($uitype == 85) {
            $value = $temp_val != "" ? "<a href='skype:{$temp_val}?call'>{$temp_val}</a>" : "";
        } elseif ($uitype == 116) {
            $value = $temp_val != "" ? getCurrencyName($temp_val) : "";
        } elseif ($uitype == 117) {
            // NOTE: Without symbol the value could be used for filtering/lookup hence avoiding the translation
            $value = $temp_val != "" ? getCurrencyName($temp_val, false) : "";
        } elseif ($uitype == 26) {
            $sql = "select foldername from vtiger_attachmentsfolder where folderid = ?";
            $res = $adb->pquery($sql, array($temp_val));
            $foldername = $adb->query_result($res, 0, 'foldername');
            $value = $foldername;
        } elseif ($uitype == 11) {
            // Fix added for Trac Id: 6139
            if (vtlib_isModuleActive('PBXManager')) {
                $value = "<a href='javascript:;' onclick='startCall(&quot;{$temp_val}&quot;, &quot;{$entity_id}&quot;)'>" . $temp_val . "</a>";
            } else {
                $value = $temp_val;
            }
        } elseif ($uitype == 25) {
            $contactid = $_REQUEST['record'];
            $emailid = $adb->query_result($list_result, $list_result_count, "activityid");
            $result = $adb->pquery("SELECT access_count FROM vtiger_email_track WHERE crmid=? AND mailid=?", array($contactid, $emailid));
            $value = $adb->query_result($result, 0, "access_count");
            if (!$value) {
                $value = 0;
            }
        } elseif ($uitype == 8) {
            if (!empty($temp_val)) {
                $temp_val = html_entity_decode($temp_val, ENT_QUOTES, $default_charset);
                $json = new Zend_Json();
                $value = vt_suppressHTMLTags(implode(',', $json->decode($temp_val)));
            }
        } else {
            if ($fieldname == $focus->list_link_field) {
                if ($mode == "search") {
                    if ($popuptype == "specific" || $popuptype == "toDospecific") {
                        // Added for get the first name of contact in Popup window
                        if ($colname == "lastname" && $module == 'Contacts') {
                            $temp_val = getFullNameFromQResult($list_result, $list_result_count, "Contacts");
                        }
                        $slashes_temp_val = popup_from_html($temp_val);
                        $slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
                        //Added to avoid the error when select SO from Invoice through AjaxEdit
                        if ($module == 'SalesOrder') {
                            $value = '<a href="javascript:window.close();" onclick=\'set_return_specific("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '","' . $_REQUEST['form'] . '");\'>' . $temp_val . '</a>';
                        } elseif ($module == 'Contacts') {
                            require_once 'modules/Contacts/Contacts.php';
                            $cntct_focus = new Contacts();
                            $cntct_focus->retrieve_entity_info($entity_id, "Contacts");
                            $slashes_temp_val = popup_from_html($temp_val);
                            //ADDED TO CHECK THE FIELD PERMISSIONS FOR
                            $xyz = array('mailingstreet', 'mailingcity', 'mailingzip', 'mailingpobox', 'mailingcountry', 'mailingstate', 'otherstreet', 'othercity', 'otherzip', 'otherpobox', 'othercountry', 'otherstate');
                            for ($i = 0; $i < 12; $i++) {
                                if (getFieldVisibilityPermission($module, $current_user->id, $xyz[$i]) == '0') {
                                    $cntct_focus->column_fields[$xyz[$i]] = $cntct_focus->column_fields[$xyz[$i]];
                                } else {
                                    $cntct_focus->column_fields[$xyz[$i]] = '';
                                }
                            }
                            // For ToDo creation the underlying form is not named as EditView
                            $form = !empty($_REQUEST['form']) ? $_REQUEST['form'] : '';
                            if (!empty($form)) {
                                $form = htmlspecialchars($form, ENT_QUOTES, $default_charset);
                            }
                            $value = '<a href="javascript:window.close();" onclick=\'set_return_contact_address("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '", "' . popup_decode_html($cntct_focus->column_fields['mailingstreet']) . '", "' . popup_decode_html($cntct_focus->column_fields['otherstreet']) . '", "' . popup_decode_html($cntct_focus->column_fields['mailingcity']) . '", "' . popup_decode_html($cntct_focus->column_fields['othercity']) . '", "' . popup_decode_html($cntct_focus->column_fields['mailingstate']) . '", "' . popup_decode_html($cntct_focus->column_fields['otherstate']) . '", "' . popup_decode_html($cntct_focus->column_fields['mailingzip']) . '", "' . popup_decode_html($cntct_focus->column_fields['otherzip']) . '", "' . popup_decode_html($cntct_focus->column_fields['mailingcountry']) . '", "' . popup_decode_html($cntct_focus->column_fields['othercountry']) . '","' . popup_decode_html($cntct_focus->column_fields['mailingpobox']) . '", "' . popup_decode_html($cntct_focus->column_fields['otherpobox']) . '","' . $form . '");\'>' . $temp_val . '</a>';
                        } else {
                            if ($popuptype == 'toDospecific') {
                                $value = '<a href="javascript:window.close();" onclick=\'set_return_toDospecific("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '");\'>' . $temp_val . '</a>';
                            } else {
                                $value = '<a href="javascript:window.close();" onclick=\'set_return_specific("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '");\'>' . $temp_val . '</a>';
                            }
                        }
                    } elseif ($popuptype == "detailview") {
                        if ($colname == "lastname" && ($module == 'Contacts' || $module == 'Leads')) {
                            $temp_val = getFullNameFromQResult($list_result, $list_result_count, $module);
                        }
                        $slashes_temp_val = popup_from_html($temp_val);
                        $slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
                        $focus->record_id = $_REQUEST['recordid'];
                        if ($_REQUEST['return_module'] == "Calendar") {
                            $value = '<a href="javascript:window.close();" id="calendarCont' . $entity_id . '" LANGUAGE=javascript onclick=\'add_data_to_relatedlist_incal("' . $entity_id . '","' . decode_html($slashes_temp_val) . '");\'>' . $temp_val . '</a>';
                        } else {
                            $value = '<a href="javascript:window.close();" onclick=\'add_data_to_relatedlist("' . $entity_id . '","' . $focus->record_id . '","' . $module . '");\'>' . $temp_val . '</a>';
                        }
                    } elseif ($popuptype == "formname_specific") {
                        $slashes_temp_val = popup_from_html($temp_val);
                        $slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
                        $value = '<a href="javascript:window.close();" onclick=\'set_return_formname_specific("' . $_REQUEST['form'] . '", "' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '");\'>' . $temp_val . '</a>';
                    } elseif ($popuptype == "inventory_prod") {
                        $row_id = $_REQUEST['curr_row'];
                        //To get all the tax types and values and pass it to product details
                        $tax_str = '';
                        $tax_details = getAllTaxes();
                        for ($tax_count = 0; $tax_count < count($tax_details); $tax_count++) {
                            $tax_str .= $tax_details[$tax_count]['taxname'] . '=' . $tax_details[$tax_count]['percentage'] . ',';
                        }
                        $tax_str = trim($tax_str, ',');
                        $rate = $user_info['conv_rate'];
                        if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') {
                            $unitprice = $adb->query_result($list_result, $list_result_count, 'unit_price');
                            if ($_REQUEST['currencyid'] != null) {
                                $prod_prices = getPricesForProducts($_REQUEST['currencyid'], array($entity_id));
                                $unitprice = $prod_prices[$entity_id];
                            }
                        } else {
                            $unit_price = '';
                        }
                        $sub_products = '';
                        $sub_prod = '';
                        $sub_prod_query = $adb->pquery("SELECT vtiger_products.productid,vtiger_products.productname,vtiger_products.qtyinstock,vtiger_crmentity.description from vtiger_products INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_products.productid INNER JOIN vtiger_seproductsrel on vtiger_seproductsrel.crmid=vtiger_products.productid WHERE vtiger_seproductsrel.productid=? and vtiger_seproductsrel.setype='Products'", array($entity_id));
                        for ($i = 0; $i < $adb->num_rows($sub_prod_query); $i++) {
                            //$sub_prod=array();
                            $id = $adb->query_result($sub_prod_query, $i, "productid");
                            $str_sep = '';
                            if ($i > 0) {
                                $str_sep = ":";
                            }
                            $sub_products .= $str_sep . $id;
                            $sub_prod .= $str_sep . " - " . $adb->query_result($sub_prod_query, $i, "productname");
                        }
                        $sub_det = $sub_products . "::" . str_replace(":", "<br>", $sub_prod);
                        $qty_stock = $adb->query_result($list_result, $list_result_count, 'qtyinstock');
                        //fix for T6943
                        $slashes_temp_val = popup_from_html($field_val);
                        $slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
                        $description = popup_from_html($adb->query_result($list_result, $list_result_count, 'description'));
                        $slashes_temp_desc = decode_html(htmlspecialchars($description, ENT_QUOTES, $default_charset));
                        $slashes_desc = str_replace(array("\r", "\n"), array('\\r', '\\n'), $slashes_temp_desc);
                        $tmp_arr = array("entityid" => $entity_id, "prodname" => "" . stripslashes(decode_html(nl2br($slashes_temp_val))) . "", "unitprice" => "{$unitprice}", "qtyinstk" => "{$qty_stock}", "taxstring" => "{$tax_str}", "rowid" => "{$row_id}", "desc" => "{$slashes_desc}", "subprod_ids" => "{$sub_det}");
                        require_once 'include/Zend/Json.php';
                        $prod_arr = Zend_Json::encode($tmp_arr);
                        $value = '<a href="javascript:window.close();" id=\'popup_product_' . $entity_id . '\' onclick=\'set_return_inventory("' . $entity_id . '", "' . decode_html(nl2br($slashes_temp_val)) . '", "' . $unitprice . '", "' . $qty_stock . '","' . $tax_str . '","' . $row_id . '","' . $slashes_desc . '","' . $sub_det . '");\' vt_prod_arr=\'' . $prod_arr . '\' >' . $temp_val . '</a>';
                    } elseif ($popuptype == "inventory_prod_po") {
                        $row_id = $_REQUEST['curr_row'];
                        //To get all the tax types and values and pass it to product details
                        $tax_str = '';
                        $tax_details = getAllTaxes();
                        for ($tax_count = 0; $tax_count < count($tax_details); $tax_count++) {
                            $tax_str .= $tax_details[$tax_count]['taxname'] . '=' . $tax_details[$tax_count]['percentage'] . ',';
                        }
                        $tax_str = trim($tax_str, ',');
                        $rate = $user_info['conv_rate'];
                        if (getFieldVisibilityPermission($module, $current_user->id, 'unit_price') == '0') {
                            $unitprice = $adb->query_result($list_result, $list_result_count, 'unit_price');
                            if ($_REQUEST['currencyid'] != null) {
                                $prod_prices = getPricesForProducts($_REQUEST['currencyid'], array($entity_id), $module);
                                $unitprice = $prod_prices[$entity_id];
                            }
                        } else {
                            $unit_price = '';
                        }
                        $sub_products = '';
                        $sub_prod = '';
                        $sub_prod_query = $adb->pquery("SELECT vtiger_products.productid,vtiger_products.productname,vtiger_products.qtyinstock,vtiger_crmentity.description from vtiger_products INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_products.productid INNER JOIN vtiger_seproductsrel on vtiger_seproductsrel.crmid=vtiger_products.productid WHERE vtiger_seproductsrel.productid=? and vtiger_seproductsrel.setype='Products'", array($entity_id));
                        for ($i = 0; $i < $adb->num_rows($sub_prod_query); $i++) {
                            //$sub_prod=array();
                            $id = $adb->query_result($sub_prod_query, $i, "productid");
                            $str_sep = '';
                            if ($i > 0) {
                                $str_sep = ":";
                            }
                            $sub_products .= $str_sep . $id;
                            $sub_prod .= $str_sep . " - {$id}." . $adb->query_result($sub_prod_query, $i, "productname");
                        }
                        $sub_det = $sub_products . "::" . str_replace(":", "<br>", $sub_prod);
                        $slashes_temp_val = popup_from_html($field_val);
                        $slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
                        $description = popup_from_html($adb->query_result($list_result, $list_result_count, 'description'));
                        $slashes_temp_desc = decode_html(htmlspecialchars($description, ENT_QUOTES, $default_charset));
                        $slashes_desc = str_replace(array("\r", "\n"), array('\\r', '\\n'), $slashes_temp_desc);
                        $tmp_arr = array("entityid" => $entity_id, "prodname" => "" . stripslashes(decode_html(nl2br($slashes_temp_val))) . "", "unitprice" => "{$unitprice}", "qtyinstk" => "{$qty_stock}", "taxstring" => "{$tax_str}", "rowid" => "{$row_id}", "desc" => "{$slashes_desc}", "subprod_ids" => "{$sub_det}");
                        require_once 'include/Zend/Json.php';
                        $prod_arr = Zend_Json::encode($tmp_arr);
                        $value = '<a href="javascript:window.close();" id=\'popup_product_' . $entity_id . '\' onclick=\'set_return_inventory_po("' . $entity_id . '", "' . decode_html(nl2br($slashes_temp_val)) . '", "' . $unitprice . '", "' . $tax_str . '","' . $row_id . '","' . $slashes_desc . '","' . $sub_det . '"); \'  vt_prod_arr=\'' . $prod_arr . '\' >' . $temp_val . '</a>';
                    } elseif ($popuptype == "inventory_service") {
                        $row_id = $_REQUEST['curr_row'];
                        //To get all the tax types and values and pass it to product details
                        $tax_str = '';
                        $tax_details = getAllTaxes();
                        for ($tax_count = 0; $tax_count < count($tax_details); $tax_count++) {
                            $tax_str .= $tax_details[$tax_count]['taxname'] . '=' . $tax_details[$tax_count]['percentage'] . ',';
                        }
                        $tax_str = trim($tax_str, ',');
                        $rate = $user_info['conv_rate'];
                        if (getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') {
                            $unitprice = $adb->query_result($list_result, $list_result_count, 'unit_price');
                            if ($_REQUEST['currencyid'] != null) {
                                $prod_prices = getPricesForProducts($_REQUEST['currencyid'], array($entity_id), $module);
                                $unitprice = $prod_prices[$entity_id];
                            }
                        } else {
                            $unit_price = '';
                        }
                        $slashes_temp_val = popup_from_html($field_val);
                        $slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
                        $description = popup_from_html($adb->query_result($list_result, $list_result_count, 'description'));
                        $slashes_temp_desc = decode_html(htmlspecialchars($description, ENT_QUOTES, $default_charset));
                        $slashes_desc = str_replace(array("\r", "\n"), array('\\r', '\\n'), $slashes_temp_desc);
                        $tmp_arr = array("entityid" => $entity_id, "prodname" => "" . stripslashes(decode_html(nl2br($slashes_temp_val))) . "", "unitprice" => "{$unitprice}", "taxstring" => "{$tax_str}", "rowid" => "{$row_id}", "desc" => "{$slashes_desc}");
                        require_once 'include/Zend/Json.php';
                        $prod_arr = Zend_Json::encode($tmp_arr);
                        $value = '<a href="javascript:window.close();" id=\'popup_product_' . $entity_id . '\' onclick=\'set_return_inventory("' . $entity_id . '", "' . decode_html(nl2br($slashes_temp_val)) . '", "' . $unitprice . '", "' . $tax_str . '","' . $row_id . '","' . $slashes_desc . '");\'  vt_prod_arr=\'' . $prod_arr . '\' >' . $temp_val . '</a>';
                    } elseif ($popuptype == "inventory_pb") {
                        $prod_id = $_REQUEST['productid'];
                        $flname = $_REQUEST['fldname'];
                        $listprice = getListPrice($prod_id, $entity_id);
                        $temp_val = popup_from_html($temp_val);
                        $value = '<a href="javascript:window.close();" onclick=\'set_return_inventory_pb("' . $listprice . '", "' . $flname . '"); \'>' . $temp_val . '</a>';
                    } elseif ($popuptype == "specific_account_address") {
                        require_once 'modules/Accounts/Accounts.php';
                        $acct_focus = new Accounts();
                        $acct_focus->retrieve_entity_info($entity_id, "Accounts");
                        $slashes_temp_val = popup_from_html($temp_val);
                        $slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
                        $xyz = array('bill_street', 'bill_city', 'bill_code', 'bill_pobox', 'bill_country', 'bill_state', 'ship_street', 'ship_city', 'ship_code', 'ship_pobox', 'ship_country', 'ship_state');
                        for ($i = 0; $i < 12; $i++) {
                            if (getFieldVisibilityPermission($module, $current_user->id, $xyz[$i]) == '0') {
                                $acct_focus->column_fields[$xyz[$i]] = $acct_focus->column_fields[$xyz[$i]];
                            } else {
                                $acct_focus->column_fields[$xyz[$i]] = '';
                            }
                        }
                        $bill_street = str_replace(array("\r", "\n"), array('\\r', '\\n'), popup_decode_html($acct_focus->column_fields['bill_street']));
                        $ship_street = str_replace(array("\r", "\n"), array('\\r', '\\n'), popup_decode_html($acct_focus->column_fields['ship_street']));
                        $value = '<a href="javascript:window.close();" onclick=\'set_return_address("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '", "' . $bill_street . '", "' . $ship_street . '", "' . popup_decode_html($acct_focus->column_fields['bill_city']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_city']) . '", "' . popup_decode_html($acct_focus->column_fields['bill_state']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_state']) . '", "' . popup_decode_html($acct_focus->column_fields['bill_code']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_code']) . '", "' . popup_decode_html($acct_focus->column_fields['bill_country']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_country']) . '","' . popup_decode_html($acct_focus->column_fields['bill_pobox']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_pobox']) . '");\'>' . $temp_val . '</a>';
                    } elseif ($popuptype == "specific_contact_account_address") {
                        require_once 'modules/Accounts/Accounts.php';
                        $acct_focus = new Accounts();
                        $acct_focus->retrieve_entity_info($entity_id, "Accounts");
                        $slashes_temp_val = popup_from_html($temp_val);
                        $slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
                        $bill_street = str_replace(array("\r", "\n"), array('\\r', '\\n'), popup_decode_html($acct_focus->column_fields['bill_street']));
                        $ship_street = str_replace(array("\r", "\n"), array('\\r', '\\n'), popup_decode_html($acct_focus->column_fields['ship_street']));
                        $value = '<a href="javascript:window.close();" onclick=\'set_return_contact_address("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '", "' . $bill_street . '", "' . $ship_street . '", "' . popup_decode_html($acct_focus->column_fields['bill_city']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_city']) . '", "' . popup_decode_html($acct_focus->column_fields['bill_state']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_state']) . '", "' . popup_decode_html($acct_focus->column_fields['bill_code']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_code']) . '", "' . popup_decode_html($acct_focus->column_fields['bill_country']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_country']) . '","' . popup_decode_html($acct_focus->column_fields['bill_pobox']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_pobox']) . '");\'>' . $temp_val . '</a>';
                    } elseif ($popuptype == "specific_potential_account_address") {
                        $slashes_temp_val = popup_from_html($temp_val);
                        $slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
                        // For B2C support, Potential was enabled to be linked to Contacts also.
                        // Hence we need case handling for it.
                        $relatedid = $adb->query_result($list_result, $list_result_count, "related_to");
                        $relatedentity = getSalesEntityType($relatedid);
                        if ($relatedentity == 'Accounts') {
                            require_once 'modules/Accounts/Accounts.php';
                            $acct_focus = new Accounts();
                            $acct_focus->retrieve_entity_info($relatedid, "Accounts");
                            $account_name = getAccountName($relatedid);
                            $slashes_account_name = popup_from_html($account_name);
                            $slashes_account_name = htmlspecialchars($slashes_account_name, ENT_QUOTES, $default_charset);
                            $xyz = array('bill_street', 'bill_city', 'bill_code', 'bill_pobox', 'bill_country', 'bill_state', 'ship_street', 'ship_city', 'ship_code', 'ship_pobox', 'ship_country', 'ship_state');
                            for ($i = 0; $i < 12; $i++) {
                                if (getFieldVisibilityPermission('Accounts', $current_user->id, $xyz[$i]) == '0') {
                                    $acct_focus->column_fields[$xyz[$i]] = $acct_focus->column_fields[$xyz[$i]];
                                } else {
                                    $acct_focus->column_fields[$xyz[$i]] = '';
                                }
                            }
                            $bill_street = str_replace(array("\r", "\n"), array('\\r', '\\n'), popup_decode_html($acct_focus->column_fields['bill_street']));
                            $ship_street = str_replace(array("\r", "\n"), array('\\r', '\\n'), popup_decode_html($acct_focus->column_fields['ship_street']));
                            $value = '<a href="javascript:window.close();" onclick=\'set_return_address("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '", "' . $relatedid . '", "' . nl2br(decode_html($slashes_account_name)) . '", "' . $bill_street . '", "' . $ship_street . '", "' . popup_decode_html($acct_focus->column_fields['bill_city']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_city']) . '", "' . popup_decode_html($acct_focus->column_fields['bill_state']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_state']) . '", "' . popup_decode_html($acct_focus->column_fields['bill_code']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_code']) . '", "' . popup_decode_html($acct_focus->column_fields['bill_country']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_country']) . '","' . popup_decode_html($acct_focus->column_fields['bill_pobox']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_pobox']) . '");\'>' . $temp_val . '</a>';
                        } else {
                            if ($relatedentity == 'Contacts') {
                                require_once 'modules/Contacts/Contacts.php';
                                $contact_name = getContactName($relatedid);
                                $slashes_contact_name = popup_from_html($contact_name);
                                $slashes_contact_name = htmlspecialchars($slashes_contact_name, ENT_QUOTES, $default_charset);
                                $value = '<a href="javascript:window.close();" onclick=\'set_return_contact("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '", "' . $relatedid . '", "' . nl2br(decode_html($slashes_contact_name)) . '");\'>' . $temp_val . '</a>';
                            } else {
                                $value = $temp_val;
                            }
                        }
                    } elseif ($popuptype == "set_return_emails") {
                        if ($module == 'Accounts') {
                            $name = $adb->query_result($list_result, $list_result_count, 'accountname');
                            $accid = $adb->query_result($list_result, $list_result_count, 'accountid');
                            if (CheckFieldPermission('email1', $module) == "true") {
                                $emailaddress = $adb->query_result($list_result, $list_result_count, "email1");
                                $email_check = 1;
                            } else {
                                $email_check = 0;
                            }
                            if ($emailaddress == '') {
                                if (CheckFieldPermission('email2', $module) == 'true') {
                                    $emailaddress2 = $adb->query_result($list_result, $list_result_count, "email2");
                                    $email_check = 2;
                                } else {
                                    if ($email_check == 1) {
                                        $email_check = 4;
                                    } else {
                                        $email_check = 3;
                                    }
                                }
                            }
                            $querystr = "SELECT fieldid,fieldlabel,columnname FROM vtiger_field WHERE tabid=? and uitype=13 and vtiger_field.presence in (0,2)";
                            $queryres = $adb->pquery($querystr, array(getTabid($module)));
                            //Change this index 0 - to get the vtiger_fieldid based on email1 or email2
                            $fieldid = $adb->query_result($queryres, 0, 'fieldid');
                            $slashes_name = popup_from_html($name);
                            $slashes_name = htmlspecialchars($slashes_name, ENT_QUOTES, $default_charset);
                            $value = '<a href="javascript:window.close();" onclick=\'return set_return_emails(' . $entity_id . ',' . $fieldid . ',"' . decode_html($slashes_name) . '","' . $emailaddress . '","' . $emailaddress2 . '","' . $email_check . '"); \'>' . textlength_check($name) . '</a>';
                        } elseif ($module == 'Vendors') {
                            $name = $adb->query_result($list_result, $list_result_count, 'vendorname');
                            $venid = $adb->query_result($list_result, $list_result_count, 'vendorid');
                            if (CheckFieldPermission('email', $module) == "true") {
                                $emailaddress = $adb->query_result($list_result, $list_result_count, "email");
                                $email_check = 1;
                            } else {
                                $email_check = 0;
                            }
                            $querystr = "SELECT fieldid,fieldlabel,columnname FROM vtiger_field WHERE tabid=? and uitype=13 and vtiger_field.presence in (0,2)";
                            $queryres = $adb->pquery($querystr, array(getTabid($module)));
                            //Change this index 0 - to get the vtiger_fieldid based on email1 or email2
                            $fieldid = $adb->query_result($queryres, 0, 'fieldid');
                            $slashes_name = popup_from_html($name);
                            $slashes_name = htmlspecialchars($slashes_name, ENT_QUOTES, $default_charset);
                            $value = '<a href="javascript:window.close();" onclick=\'return set_return_emails(' . $entity_id . ',' . $fieldid . ',"' . decode_html($slashes_name) . '","' . $emailaddress . '","' . $emailaddress2 . '","' . $email_check . '"); \'>' . textlength_check($name) . '</a>';
                        } elseif ($module == 'Contacts' || $module == 'Leads') {
                            $name = getFullNameFromQResult($list_result, $list_result_count, $module);
                            if (CheckFieldPermission('email', $module) == "true") {
                                $emailaddress = $adb->query_result($list_result, $list_result_count, "email");
                                $email_check = 1;
                            } else {
                                $email_check = 0;
                            }
                            if ($emailaddress == '') {
                                if (CheckFieldPermission('yahooid', $module) == 'true') {
                                    $emailaddress2 = $adb->query_result($list_result, $list_result_count, "yahooid");
                                    $email_check = 2;
                                } else {
                                    if ($email_check == 1) {
                                        $email_check = 4;
                                    } else {
                                        $email_check = 3;
                                    }
                                }
                            }
                            $querystr = "SELECT fieldid,fieldlabel,columnname FROM vtiger_field WHERE tabid=? and uitype=13 and vtiger_field.presence in (0,2)";
                            $queryres = $adb->pquery($querystr, array(getTabid($module)));
                            //Change this index 0 - to get the vtiger_fieldid based on email or yahooid
                            $fieldid = $adb->query_result($queryres, 0, 'fieldid');
                            $slashes_name = popup_from_html($name);
                            $slashes_name = htmlspecialchars($slashes_name, ENT_QUOTES, $default_charset);
                            $value = '<a href="javascript:window.close();" onclick=\'return set_return_emails(' . $entity_id . ',' . $fieldid . ',"' . decode_html($slashes_name) . '","' . $emailaddress . '","' . $emailaddress2 . '","' . $email_check . '"); \'>' . $name . '</a>';
                        } else {
                            $firstname = $adb->query_result($list_result, $list_result_count, "first_name");
                            $lastname = $adb->query_result($list_result, $list_result_count, "last_name");
                            $name = $lastname . ' ' . $firstname;
                            $emailaddress = $adb->query_result($list_result, $list_result_count, "email1");
                            $slashes_name = popup_from_html($name);
                            $slashes_name = htmlspecialchars($slashes_name, ENT_QUOTES, $default_charset);
                            $email_check = 1;
                            $value = '<a href="javascript:window.close();" onclick=\'return set_return_emails(' . $entity_id . ',-1,"' . decode_html($slashes_name) . '","' . $emailaddress . '","' . $emailaddress2 . '","' . $email_check . '"); \'>' . textlength_check($name) . '</a>';
                        }
                    } elseif ($popuptype == "specific_vendor_address") {
                        require_once 'modules/Vendors/Vendors.php';
                        $acct_focus = new Vendors();
                        $acct_focus->retrieve_entity_info($entity_id, "Vendors");
                        $slashes_temp_val = popup_from_html($temp_val);
                        $slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
                        $xyz = array('street', 'city', 'postalcode', 'pobox', 'country', 'state');
                        for ($i = 0; $i < 6; $i++) {
                            if (getFieldVisibilityPermission($module, $current_user->id, $xyz[$i]) == '0') {
                                $acct_focus->column_fields[$xyz[$i]] = $acct_focus->column_fields[$xyz[$i]];
                            } else {
                                $acct_focus->column_fields[$xyz[$i]] = '';
                            }
                        }
                        $bill_street = str_replace(array("\r", "\n"), array('\\r', '\\n'), popup_decode_html($acct_focus->column_fields['street']));
                        $value = '<a href="javascript:window.close();" onclick=\'set_return_address("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '", "' . $bill_street . '", "' . popup_decode_html($acct_focus->column_fields['city']) . '", "' . popup_decode_html($acct_focus->column_fields['state']) . '", "' . popup_decode_html($acct_focus->column_fields['postalcode']) . '", "' . popup_decode_html($acct_focus->column_fields['country']) . '","' . popup_decode_html($acct_focus->column_fields['pobox']) . '");\'>' . $temp_val . '</a>';
                    } elseif ($popuptype == "specific_campaign") {
                        $slashes_temp_val = popup_from_html($temp_val);
                        $slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
                        $value = '<a href="javascript:window.close();" onclick=\'set_return_specific_campaign("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '");\'>' . $temp_val . '</a>';
                    } else {
                        if ($colname == "lastname") {
                            $temp_val = getFullNameFromQResult($list_result, $list_result_count, $module);
                        }
                        $slashes_temp_val = popup_from_html($temp_val);
                        $slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
                        $log->debug("Exiting getValue method ...");
                        if ($_REQUEST['maintab'] == 'Calendar') {
                            $value = '<a href="javascript:window.close();" onclick=\'set_return_todo("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '");\'>' . $temp_val . '</a>';
                        } else {
                            $value = '<a href="javascript:window.close();" onclick=\'set_return("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '");\'>' . $temp_val . '</a>';
                        }
                    }
                } else {
                    if ($module == "Leads" && $colname == "lastname" || $module == "Contacts" && $colname == "lastname") {
                        $value = '<a href="index.php?action=DetailView&module=' . $module . '&record=' . $entity_id . '&parenttab=' . $tabname . '">' . $temp_val . '</a>';
                    } elseif ($module == "Calendar") {
                        $actvity_type = $adb->query_result($list_result, $list_result_count, 'activitytype');
                        $actvity_type = $actvity_type != '' ? $actvity_type : $adb->query_result($list_result, $list_result_count, 'type');
                        if ($actvity_type == "Task") {
                            $value = '<a href="index.php?action=DetailView&module=' . $module . '&record=' . $entity_id . '&activity_mode=Task&parenttab=' . $tabname . '">' . $temp_val . '</a>';
                        } else {
                            $value = '<a href="index.php?action=DetailView&module=' . $module . '&record=' . $entity_id . '&activity_mode=Events&parenttab=' . $tabname . '">' . $temp_val . '</a>';
                        }
                    } elseif ($module == "Vendors") {
                        $value = '<a href="index.php?action=DetailView&module=Vendors&record=' . $entity_id . '&parenttab=' . $tabname . '">' . $temp_val . '</a>';
                    } elseif ($module == "PriceBooks") {
                        $value = '<a href="index.php?action=DetailView&module=PriceBooks&record=' . $entity_id . '&parenttab=' . $tabname . '">' . $temp_val . '</a>';
                    } elseif ($module == "SalesOrder") {
                        $value = '<a href="index.php?action=DetailView&module=SalesOrder&record=' . $entity_id . '&parenttab=' . $tabname . '">' . $temp_val . '</a>';
                    } elseif ($module == 'Emails') {
                        $value = $temp_val;
                    } else {
                        $value = '<a href="index.php?action=DetailView&module=' . $module . '&record=' . $entity_id . '&parenttab=' . $tabname . '">' . $temp_val . '</a>';
                    }
                }
            } elseif ($fieldname == 'expectedroi' || $fieldname == 'actualroi' || $fieldname == 'actualcost' || $fieldname == 'budgetcost' || $fieldname == 'expectedrevenue') {
                $rate = $user_info['conv_rate'];
                $value = convertFromDollar($temp_val, $rate);
            } elseif (($module == 'Invoice' || $module == 'Quotes' || $module == 'PurchaseOrder' || $module == 'SalesOrder') && ($fieldname == 'hdnGrandTotal' || $fieldname == 'hdnSubTotal' || $fieldname == 'txtAdjustment' || $fieldname == 'hdnDiscountAmount' || $fieldname == 'hdnS_H_Amount')) {
                $currency_info = getInventoryCurrencyInfo($module, $entity_id);
                $currency_id = $currency_info['currency_id'];
                $currency_symbol = $currency_info['currency_symbol'];
                $value = $currency_symbol . $temp_val;
            } else {
                $value = $temp_val;
            }
        }
    }
    // Mike Crowe Mod --------------------------------------------------------Make right justified and vtiger_currency value
    if (in_array($uitype, array(71, 72, 7, 9, 90))) {
        $value = '<span align="right">' . $value . '</div>';
    }
    $log->debug("Exiting getValue method ...");
    return $value;
}
コード例 #15
0
    }
    $sql = 'select vtiger_users.*,vtiger_invitees.* from vtiger_invitees left join vtiger_users on vtiger_invitees.inviteeid=vtiger_users.id where activityid=?';
    $result = $adb->pquery($sql, array($focus->id));
    $num_rows = $adb->num_rows($result);
    $invited_users = array();
    for ($i = 0; $i < $num_rows; $i++) {
        $userid = $adb->query_result($result, $i, 'inviteeid');
        $username = getFullNameFromQResult($result, $i, 'Users');
        $invited_users[$userid] = $username;
    }
    $smarty->assign("INVITEDUSERS", $invited_users);
    $related_array = getRelatedListsInformation("Calendar", $focus);
    $fieldsname = $related_array['Contacts']['header'];
    $contact_info = $related_array['Contacts']['entries'];
    $entityIds = array_keys($contact_info);
    $displayValueArray = getEntityName('Contacts', $entityIds);
    $entityname = array();
    if (!empty($displayValueArray)) {
        foreach ($displayValueArray as $key => $field_value) {
            $entityname[$key] = '<a href="index.php?module=Contacts&action=DetailView&record=' . $key . '">' . $field_value . '</a>';
        }
    }
    $smarty->assign("CONTACTS", $entityname);
    $is_fname_permitted = getFieldVisibilityPermission("Contacts", $current_user->id, 'firstname');
    $smarty->assign("IS_PERMITTED_CNT_FNAME", $is_fname_permitted);
}
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
$log->info("Calendar-Activities detail view");
$category = getParentTab();
コード例 #16
0
 /**
  * this function takes in an array of values for an user and sanitizes it for export
  * @param array $arr - the array of values
  */
 function sanitizeValues($arr)
 {
     $db = PearDatabase::getInstance();
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $roleid = $currentUser->get('roleid');
     if (empty($this->fieldArray)) {
         $this->fieldArray = $this->moduleFieldInstances;
         foreach ($this->fieldArray as $fieldName => $fieldObj) {
             //In database we have same column name in two tables. - inventory modules only
             if ($fieldObj->get('table') == 'vtiger_inventoryproductrel' && ($fieldName == 'discount_amount' || $fieldName == 'discount_percent')) {
                 $fieldName = 'item_' . $fieldName;
                 $this->fieldArray[$fieldName] = $fieldObj;
             } else {
                 $columnName = $fieldObj->get('column');
                 $this->fieldArray[$columnName] = $fieldObj;
             }
         }
     }
     $moduleName = $this->moduleInstance->getName();
     foreach ($arr as $fieldName => &$value) {
         if (isset($this->fieldArray[$fieldName])) {
             $fieldInfo = $this->fieldArray[$fieldName];
         } else {
             unset($arr[$fieldName]);
             continue;
         }
         $value = trim(decode_html($value), "\"");
         $uitype = $fieldInfo->get('uitype');
         $fieldname = $fieldInfo->get('name');
         if (!$this->fieldDataTypeCache[$fieldName]) {
             $this->fieldDataTypeCache[$fieldName] = $fieldInfo->getFieldDataType();
         }
         $type = $this->fieldDataTypeCache[$fieldName];
         if ($fieldname != 'hdnTaxType' && ($uitype == 15 || $uitype == 16 || $uitype == 33)) {
             if (empty($this->picklistValues[$fieldname])) {
                 $this->picklistValues[$fieldname] = $this->fieldArray[$fieldname]->getPicklistValues();
             }
             // If the value being exported is accessible to current user
             // or the picklist is multiselect type.
             if ($uitype == 33 || $uitype == 16 || array_key_exists($value, $this->picklistValues[$fieldname])) {
                 // NOTE: multipicklist (uitype=33) values will be concatenated with |# delim
                 $value = trim($value);
             } else {
                 $value = '';
             }
         } elseif ($uitype == 52 || $type == 'owner') {
             $value = Vtiger_Util_Helper::getOwnerName($value);
         } elseif ($type == 'reference') {
             $value = trim($value);
             if (!empty($value)) {
                 $parent_module = getSalesEntityType($value);
                 $displayValueArray = getEntityName($parent_module, $value);
                 if (!empty($displayValueArray)) {
                     foreach ($displayValueArray as $k => $v) {
                         $displayValue = $v;
                     }
                 }
                 if (!empty($parent_module) && !empty($displayValue)) {
                     $value = $parent_module . "::::" . $displayValue;
                 } else {
                     $value = "";
                 }
             } else {
                 $value = '';
             }
         } elseif ($uitype == 72 || $uitype == 71) {
             $value = CurrencyField::convertToUserFormat($value, null, true, true);
         } elseif ($uitype == 7 && $fieldInfo->get('typeofdata') == 'N~O' || $uitype == 9) {
             $value = decimalFormat($value);
         } else {
             if ($type == 'date' || $type == 'datetime') {
                 $value = DateTimeField::convertToUserFormat($value);
             }
         }
         if ($moduleName == 'Documents' && $fieldname == 'description') {
             $value = strip_tags($value);
             $value = str_replace('&nbsp;', '', $value);
             array_push($new_arr, $value);
         }
     }
     return $arr;
 }
コード例 #17
0
ファイル: HelpDesk.php プロジェクト: kikojover/corebos
 /** Function to get the list of comments for the given ticket id
  * @param  int  $ticketid - Ticket id
  * @return list $list - return the list of comments and comment informations as a html output where as these comments and comments informations will be formed in div tag.
  **/
 function getCommentInformation($ticketid)
 {
     global $log;
     $log->debug("Entering getCommentInformation(" . $ticketid . ") method ...");
     global $adb;
     global $mod_strings, $default_charset;
     $sql = "select * from vtiger_ticketcomments where ticketid=?";
     $result = $adb->pquery($sql, array($ticketid));
     $noofrows = $adb->num_rows($result);
     //In ajax save we should not add this div
     if ($_REQUEST['action'] != 'HelpDeskAjax') {
         $list .= '<div id="comments_div" style="overflow: auto;height:200px;width:100%;">';
         $enddiv = '</div>';
     }
     for ($i = 0; $i < $noofrows; $i++) {
         if ($adb->query_result($result, $i, 'comments') != '') {
             //this div is to display the comment
             $comment = $adb->query_result($result, $i, 'comments');
             // Asha: Fix for ticket #4478 . Need to escape html tags during ajax save.
             if ($_REQUEST['action'] == 'HelpDeskAjax') {
                 $comment = htmlentities($comment, ENT_QUOTES, $default_charset);
             }
             $list .= '<div valign="top" style="width:99%;padding-top:10px;" class="dataField">';
             $list .= make_clickable(nl2br($comment));
             $list .= '</div>';
             //this div is to display the author and time
             $list .= '<div valign="top" style="width:99%;border-bottom:1px dotted #CCCCCC;padding-bottom:5px;" class="dataLabel"><font color=darkred>';
             $list .= $mod_strings['LBL_AUTHOR'] . ' : ';
             if ($adb->query_result($result, $i, 'ownertype') == 'user') {
                 $list .= getUserFullName($adb->query_result($result, $i, 'ownerid'));
             } elseif ($adb->query_result($result, $i, 'ownertype') == 'customer') {
                 $contactid = $adb->query_result($result, $i, 'ownerid');
                 $displayValueArray = getEntityName('Contacts', $contactid);
                 if (!empty($displayValueArray)) {
                     foreach ($displayValueArray as $key => $field_value) {
                         $contact_name = $field_value;
                     }
                 } else {
                     $contact_name = '';
                 }
                 $list .= $contact_name;
             }
             $date = new DateTimeField($adb->query_result($result, $i, 'createdtime'));
             $list .= ' on ' . $date->getDisplayDateTimeValue() . ' &nbsp;';
             $list .= '</font></div>';
         }
     }
     $list .= $enddiv;
     $log->debug("Exiting getCommentInformation method ...");
     return $list;
 }
コード例 #18
0
ファイル: Campaigns.php プロジェクト: kikojover/corebos
    public static function createPotentialRelatedTo($relatedto, $campaignid)
    {
        global $adb, $current_user;
        $checkrs = $adb->pquery('select 1
			from vtiger_potential
			inner join vtiger_crmentity on crmid=potentialid
			where deleted=0 and related_to=? and campaignid=?', array($relatedto, $campaignid));
        if ($adb->num_rows($checkrs) == 0) {
            require_once 'modules/Potentials/Potentials.php';
            $entity = new Potentials();
            $entity->mode = '';
            $cname = getEntityName('Campaigns', $campaignid);
            $cname = $cname[$campaignid] . ' - ';
            $setype = getSalesEntityType($relatedto);
            $rname = getEntityName($setype, $relatedto);
            $rname = $rname[$relatedto];
            $cbMapid = GlobalVariable::getVariable('BusinessMapping_PotentialOnCampaignRelation', cbMap::getMapIdByName('PotentialOnCampaignRelation'));
            if ($cbMapid) {
                $cmp = CRMEntity::getInstance('Campaigns');
                $cmp->retrieve_entity_info($campaignid, 'Campaigns');
                if ($setype == 'Accounts') {
                    $cmp->column_fields['AccountName'] = $rname;
                    $cmp->column_fields['ContactName'] = '';
                } else {
                    $cmp->column_fields['AccountName'] = '';
                    $cmp->column_fields['ContactName'] = $rname;
                }
                $cbMap = cbMap::getMapByID($cbMapid);
                $entity->column_fields = $cbMap->Mapping($cmp->column_fields, array());
            }
            if (empty($entity->column_fields['assigned_user_id'])) {
                $entity->column_fields['assigned_user_id'] = $current_user->id;
            }
            $entity->column_fields['related_to'] = $relatedto;
            $entity->column_fields['campaignid'] = $campaignid;
            if (empty($entity->column_fields['closingdate'])) {
                $dt = new DateTimeField();
                $entity->column_fields['closingdate'] = $dt->getDisplayDate();
            }
            if (empty($entity->column_fields['potentialname'])) {
                $entity->column_fields['potentialname'] = $cname . $rname;
            }
            if (empty($entity->column_fields['sales_stage'])) {
                $entity->column_fields['sales_stage'] = 'Prospecting';
            }
            $_REQUEST['assigntype'] = 'U';
            $_REQUEST['assigned_user_id'] = $entity->column_fields['assigned_user_id'];
            $entity->save('Potentials');
        }
    }
コード例 #19
0
ファイル: Record.php プロジェクト: JeRRimix/YetiForceCRM
 /**
  * Function to get the Owner Name
  * @return <String> Custom View creator User Name
  */
 public function getOwnerName()
 {
     $ownerId = $this->getOwnerId();
     $entityNames = getEntityName('Users', array($ownerId));
     return $entityNames[$ownerId];
 }
コード例 #20
0
ファイル: yetiportal.php プロジェクト: JeRRimix/YetiForceCRM
function get_service_list_values($id, $modulename, $sessionid, $only_mine = 'true')
{
    require_once 'modules/Services/Services.php';
    require_once 'include/utils/UserInfoUtil.php';
    $adb = PearDatabase::getInstance();
    $log = vglobal('log');
    $log->debug("Entering customer portal Function get_service_list_values");
    $check = checkModuleActive($modulename);
    if ($check == false) {
        return array("#MODULE INACTIVE#");
    }
    $user = new Users();
    $userid = getPortalUserid();
    $current_user = $user->retrieveCurrentUserInfoFromFile($userid);
    //To avoid SQL injection we are type casting as well as bound the id variable
    $id = (int) vtlib_purify($id);
    $entity_ids_list = array();
    $show_all = show_all($modulename);
    if (!validateSession($id, $sessionid)) {
        return null;
    }
    if ($only_mine == 'true' || $show_all == 'false') {
        array_push($entity_ids_list, $id);
    } else {
        $contactquery = "SELECT contactid, parentid FROM vtiger_contactdetails " . " INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid" . " AND vtiger_crmentity.deleted = 0 " . " WHERE (parentid = (SELECT parentid FROM vtiger_contactdetails WHERE contactid = ?)  AND parentid != 0) OR contactid = ?";
        $contactres = $adb->pquery($contactquery, array($id, $id));
        $no_of_cont = $adb->num_rows($contactres);
        for ($i = 0; $i < $no_of_cont; $i++) {
            $cont_id = $adb->query_result($contactres, $i, 'contactid');
            $acc_id = $adb->query_result($contactres, $i, 'parentid');
            if (!in_array($cont_id, $entity_ids_list)) {
                $entity_ids_list[] = $cont_id;
            }
            if (!in_array($acc_id, $entity_ids_list) && $acc_id != '0') {
                $entity_ids_list[] = $acc_id;
            }
        }
    }
    $focus = new Services();
    $focus->filterInactiveFields('Services');
    foreach ($focus->list_fields as $fieldlabel => $values) {
        foreach ($values as $table => $fieldname) {
            $fields_list[$fieldlabel] = $fieldname;
        }
    }
    $fields_list['Related To'] = 'entityid';
    $query = array();
    $params = array();
    $query[] = "select vtiger_service.*," . "case when vtiger_crmentityrel.crmid != vtiger_service.serviceid then vtiger_crmentityrel.crmid else vtiger_crmentityrel.relcrmid end as entityid, " . "'' as setype from vtiger_service " . "inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_service.serviceid " . "left join vtiger_crmentityrel on (vtiger_crmentityrel.relcrmid=vtiger_service.serviceid or vtiger_crmentityrel.crmid=vtiger_service.serviceid) " . "where vtiger_crmentity.deleted = 0 and " . "( vtiger_crmentityrel.crmid in (" . generateQuestionMarks($entity_ids_list) . ") OR " . "(vtiger_crmentityrel.relcrmid in (" . generateQuestionMarks($entity_ids_list) . ") AND vtiger_crmentityrel.module = 'Services')" . ")";
    $params[] = array($entity_ids_list, $entity_ids_list);
    $checkQuotes = checkModuleActive('Quotes');
    if ($checkQuotes == true) {
        $query[] = "select distinct vtiger_service.*,\n\t\t\tvtiger_quotes.accountid as entityid,\n\t\t\t'Accounts' as setype\n\t\t\tfrom vtiger_quotes INNER join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_quotes.quoteid\n\t\t\tleft join vtiger_inventoryproductrel on vtiger_inventoryproductrel.id=vtiger_quotes.quoteid\n\t\t\tleft join vtiger_service on vtiger_service.serviceid = vtiger_inventoryproductrel.productid\n\t\t\twhere vtiger_inventoryproductrel.productid = vtiger_service.serviceid AND vtiger_crmentity.deleted=0 and accountid in  (" . generateQuestionMarks($entity_ids_list) . ")";
        $params[] = array($entity_ids_list);
    }
    $checkInvoices = checkModuleActive('Invoice');
    if ($checkInvoices == true) {
        $query[] = "select distinct vtiger_service.*, vtiger_invoice.accountid as entityid, 'Accounts' as setype\n\t\t\tfrom vtiger_invoice\n\t\t\tINNER join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_invoice.invoiceid\n\t\t\tleft join vtiger_inventoryproductrel on vtiger_inventoryproductrel.id=vtiger_invoice.invoiceid\n\t\t\tleft join vtiger_service on vtiger_service.serviceid = vtiger_inventoryproductrel.productid\n\t\t\twhere vtiger_inventoryproductrel.productid = vtiger_service.serviceid AND vtiger_crmentity.deleted=0 and accountid in (" . generateQuestionMarks($entity_ids_list) . ")";
        $params[] = array($entity_ids_list, $entity_ids_list);
    }
    $ServicesfieldVisibilityPermissions = array();
    foreach ($fields_list as $fieldlabel => $fieldname) {
        $ServicesfieldVisibilityPermissions[$fieldname] = getFieldVisibilityPermission('Services', $current_user->id, $fieldname);
    }
    $fieldValuesToRound = array('unit_price', 'commissionrate');
    for ($k = 0; $k < count($query); $k++) {
        $res[$k] = $adb->pquery($query[$k], $params[$k]);
        $noofdata[$k] = $adb->num_rows($res[$k]);
        if ($noofdata[$k] == 0) {
            $output[$k][$modulename]['data'] = '';
        }
        for ($j = 0; $j < $noofdata[$k]; $j++) {
            $i = 0;
            foreach ($fields_list as $fieldlabel => $fieldname) {
                $fieldper = $ServicesfieldVisibilityPermissions[$fieldname];
                if ($fieldper == '1' && $fieldname != 'entityid') {
                    continue;
                }
                $output[$k][$modulename]['head'][0][$i]['fielddata'] = Vtiger_Language_Handler::getTranslatedString($fieldlabel, 'Services', vglobal('default_language'));
                $fieldvalue = $adb->query_result($res[$k], $j, $fieldname);
                $fieldid = $adb->query_result($res[$k], $j, 'serviceid');
                if (in_array($fieldname, $fieldValuesToRound)) {
                    $fieldvalue = round($fieldvalue, 2);
                }
                if ($fieldname == 'entityid') {
                    $crmid = $fieldvalue;
                    $module = $adb->query_result($res[$k], $j, 'setype');
                    if ($module == '') {
                        $module = $adb->query_result($adb->pquery("SELECT setype FROM vtiger_crmentity WHERE crmid = ?", array($crmid)), 0, 'setype');
                    }
                    if ($crmid != '' && $module != '') {
                        $fieldvalues = getEntityName($module, array($crmid));
                        if ($module == 'Contacts') {
                            $fieldvalue = '<a href="index.php?module=Contacts&action=index&id=' . $crmid . '">' . $fieldvalues[$crmid] . '</a>';
                        } elseif ($module == 'Accounts') {
                            $fieldvalue = '<a href="index.php?module=Accounts&action=index&id=' . $crmid . '">' . $fieldvalues[$crmid] . '</a>';
                        }
                    } else {
                        $fieldvalue = '';
                    }
                }
                if ($fieldname == 'servicename') {
                    $fieldvalue = '<a href="index.php?module=Services&action=index&id=' . $fieldid . '">' . $fieldvalue . '</a>';
                }
                if ($fieldname == 'unit_price') {
                    $sym = getCurrencySymbol($res[$k], $j, 'currency_id');
                    $fieldvalue = $sym . $fieldvalue;
                }
                $output[$k][$modulename]['data'][$j][$i]['fielddata'] = $fieldvalue;
                $i++;
            }
        }
    }
    $log->debug("Exiting customerportal function get_product_list_values.....");
    return $output;
}
コード例 #21
0
 $cbrows = $adb->num_rows($result);
 if ($cbrows > 0) {
     for ($index = 0; $index < $cbrows; ++$index) {
         $reminderid = $adb->query_result($result, $index, "reminderid");
         $cbrecord = $adb->query_result($result, $index, "recordid");
         $cbmodule = $adb->query_result($result, $index, "semodule");
         $focus = CRMEntity::getInstance($cbmodule);
         if ($cbmodule == 'Calendar') {
             $focus->retrieve_entity_info($cbrecord, $cbmodule);
             $cbsubject = $focus->column_fields['subject'];
             $cbactivitytype = $focus->column_fields['activitytype'];
             $cbdate = $focus->column_fields["date_start"];
             $cbtime = $focus->column_fields["time_start"];
         } else {
             // For non-calendar records.
             $cbsubject = array_values(getEntityName($cbmodule, $cbrecord));
             $cbsubject = $cbsubject[0];
             $cbactivitytype = getTranslatedString($cbmodule, $cbmodule);
             $cbdate = $adb->query_result($result, $index, 'date_start');
             $cbtime = $adb->query_result($result, $index, 'time_start');
         }
         if ($cbtime != '') {
             $date = new DateTimeField($cbdate . ' ' . $cbtime);
             $cbtime = $date->getDisplayTime();
             $cbdate = $date->getDisplayDate();
             $cbtimeArr = getaddEventPopupTime($cbtime, '', 'am/pm');
             $cbtime = $cbtimeArr['starthour'] . ':' . $cbtimeArr['startmin'] . '' . $cbtimeArr['startfmt'];
         }
         if ($cbactivitytype == 'Task') {
             $cbstatus = $focus->column_fields["taskstatus"];
         } else {
コード例 #22
0
ファイル: vtigerCRMHandler.php プロジェクト: nvh3010/quancrm
    public function translateTheReferenceFieldIdsToName($records,$module,$user){
        $db = PearDatabase::getInstance();
        global $current_user;
        $current_user = $user;
        $handler = vtws_getModuleHandlerFromName($module, $user);
        $meta = $handler->getMeta();
        $referenceFieldDetails = $meta->getReferenceFieldDetails();
        foreach($referenceFieldDetails as $referenceFieldName=>$referenceModuleDetails){
            $referenceFieldIds = array();
            $referenceModuleIds = array();
            $referenceIdsName = array();
            foreach($records as $recordDetails){
                $referenceWsId = $recordDetails[$referenceFieldName];
                if(!empty ($referenceWsId)){
                    $referenceIdComp = vtws_getIdComponents($referenceWsId);
                    $webserviceObject = VtigerWebserviceObject::fromId($db, $referenceIdComp[0]);
                    $referenceModuleIds[$webserviceObject->getEntityName()][]= $referenceIdComp[1];
                    $referenceFieldIds[] =$referenceIdComp[1];
                }
            }

            foreach($referenceModuleIds as $referenceModule=>$idLists){
                $nameList = getEntityName($referenceModule, $idLists);
                foreach($nameList as $key=>$value)
                    $referenceIdsName[$key] = $value;
            }
	        $recordCount = count($records);
            for($i=0;$i<$recordCount;$i++){
                $record = $records[$i];
                if(!empty($record[$referenceFieldName])){
                    $wsId = vtws_getIdComponents($record[$referenceFieldName]);
                    $record[$referenceFieldName] = decode_html($referenceIdsName[$wsId[1]]);
                }
                $records[$i]= $record;
            }
        }
        return $records;
    }
コード例 #23
0
ファイル: PDFContent.php プロジェクト: jmangarret/vtigercrm
 private function x10($x92, $x93, $x94 = false, $x95 = false)
 {
     global $x15d, $x15e, $x15f, $x160, $x161, $x162, $x163, $x164, $x165, $x166, $x167, $x168, $x169, $x16a, $x16b, $x16c, $x16d, $x16e, $x16f, $x170, $x171, $x172, $x173, $x174, $x175, $x176, $x177, $x178;
     $x96 = Users_Record_Model::getCurrentUserModel();
     $x97 = array("related_to", "relatedto", "parent_id", "parentid", "product_id", "productid", "service_id", "serviceid", "vendor_id", "product", "account", "invoiceid", "linktoaccountscontacts", "projectid", "sc_related_to");
     if ($x95 !== false) {
         $x98 = array();
     }
     $x51 = getTabid($x92);
     $x99 = $x92;
     if ($x94 === false) {
         $x9a = "";
     } else {
         $x9a = "R_";
         if ($x94 !== true) {
             $x99 = $x94;
         }
     }
     $x9b = array();
     $x9c = array();
     $x9d = array();
     $x9e = array();
     $x9f = array();
     $xa0 = array();
     $xa1 = array();
     if ($x51 == '9') {
         $x3d = "SELECT fieldname, uitype FROM vtiger_field WHERE tabid IN (9,16)";
     } else {
         $x3d = "SELECT fieldname, uitype FROM vtiger_field WHERE tabid = '" . $x51 . "'";
     }
     $x3e = self::$x0f->query($x3d);
     while ($x42 = self::$x0f->fetchByAssoc($x3e)) {
         switch ($x42['uitype']) {
             case '19':
             case '20':
             case '21':
             case '24':
                 $x9d[] = $x42['fieldname'];
                 break;
             case '5':
             case '6':
             case '23':
             case '70':
                 $x9e[] = $x42['fieldname'];
                 break;
             case '15':
                 $x9c[] = $x42['fieldname'];
                 break;
             case '56':
                 $x9b[] = $x42['fieldname'];
                 break;
             case '33':
                 $x9f[] = $x42['fieldname'];
                 break;
             case '71':
                 $xa0[] = $x42['fieldname'];
                 break;
             case '9':
                 $xa1[] = $x42['fieldname'];
                 break;
         }
         if ($x42["fieldname"] == "salutationtype") {
             $x9c[] = $x42["fieldname"];
         }
     }
     foreach ($x93->column_fields as $xa2 => $x83) {
         if ($xa2 == "assigned_user_id") {
             $x83 = $this->x1e($x83);
         } elseif ($xa2 == "account_id") {
             $x83 = getAccountName($x83);
         } elseif ($xa2 == "potential_id") {
             $x83 = getPotentialName($x83);
         } elseif ($xa2 == "contact_id") {
             $x83 = getContactName($x83);
         } elseif ($xa2 == "quote_id") {
             $x83 = getQuoteName($x83);
         } elseif ($xa2 == "salesorder_id") {
             $x83 = getSoName($x83);
         } elseif ($xa2 == "campaignid") {
             $x83 = getCampaignName($x83);
         } elseif ($xa2 == "terms_conditions") {
             $x83 = $this->x25($x83);
         } elseif ($xa2 == "comments") {
             $x83 = $this->x26($x93);
         } elseif ($xa2 == "folderid") {
             $x83 = $this->x27($x83);
         } elseif ($xa2 == "time_start" || $xa2 == "time_end") {
             $xa3 = DateTimeField::convertToUserTimeZone($x83);
             $x83 = $xa3->format('H:i');
         } elseif ($x168($xa2, $x97)) {
             if ($x83 != "") {
                 $xa4 = getSalesEntityType($x83);
                 $xa5 = getEntityName($xa4, $x83);
                 if (!empty($xa5)) {
                     foreach ($xa5 as $xa6) {
                         $x83 = $xa6;
                     }
                 }
                 if ($xa2 == "invoiceid" && $x83 == "0") {
                     $x83 = "";
                 }
             }
         }
         if ($x168($xa2, $x9e)) {
             if ($x92 == "Events" || $x92 == "Calendar") {
                 if ($xa2 == "date_start" && $x93->column_fields["time_start"] != "") {
                     $xa3 = $x93->column_fields['time_start'];
                     $x83 = $x83 . ' ' . $xa3;
                 } elseif ($xa2 == "due_date" && $x93->column_fields["time_end"] != "") {
                     $xa3 = $x93->column_fields['time_end'];
                     $x83 = $x83 . ' ' . $xa3;
                 }
             }
             if ($x83 != "") {
                 $x83 = getValidDisplayDate($x83);
             }
         } elseif ($x168($xa2, $x9c)) {
             if (!$x168($x178($x83), self::$x18)) {
                 $x83 = $this->x20($x83, $x92);
             } else {
                 $x83 = "";
             }
         } elseif ($x168($xa2, $x9b)) {
             if ($x83 == 1) {
                 $x83 = vtranslate('LBL_YES');
             } else {
                 $x83 = vtranslate('LBL_NO');
             }
         } elseif ($x168($xa2, $x9d)) {
             $x83 = $x16d($x83);
             $x83 = $x165($x83, ENT_QUOTES, self::$x11);
         } elseif ($x168($xa2, $x9f)) {
             $x83 = $x173(' |##| ', ', ', $x83);
         } elseif ($x168($xa2, $xa0)) {
             if ($x16a($x83)) {
                 if ($x95 === false) {
                     $xa7 = getCurrencySymbolandCRate($x96->currency_id);
                     $xa8 = $xa7["rate"];
                 } else {
                     $xa8 = $x95["conversion_rate"];
                 }
                 $x83 = $x83 * $xa8;
             }
             $x83 = $this->x23($x83);
         } elseif ($x168($xa2, $xa1)) {
             $x83 = $this->x23($x83);
         }
         if ($x95 !== false) {
             $x98[$x175($x92 . "_" . $xa2)] = $x83;
         } else {
             self::$x21["\$" . $x9a . $x175($x99 . "_" . $xa2) . "\$"] = $x83;
         }
     }
     if ($x95 !== false) {
         return $x98;
     } else {
         $this->x15();
     }
 }
コード例 #24
0
ファイル: EditView.php プロジェクト: casati-dolibarr/corebos
$smarty->assign('OP_MODE', $disp_view);
$smarty->assign('APP', $app_strings);
$smarty->assign('MOD', $mod_strings);
$smarty->assign('MODULE', $currentModule);
// TODO: Update Single Module Instance name here.
$smarty->assign('SINGLE_MOD', 'SINGLE_' . $currentModule);
$smarty->assign('CATEGORY', $category);
$smarty->assign("THEME", $theme);
$smarty->assign('IMAGE_PATH', "themes/{$theme}/images/");
$smarty->assign('ID', $focus->id);
$smarty->assign('MODE', $focus->mode);
$smarty->assign('CREATEMODE', isset($_REQUEST['createmode']) ? vtlib_purify($_REQUEST['createmode']) : '');
$smarty->assign('CHECK', Button_Check($currentModule));
$smarty->assign('DUPLICATE', $isduplicate);
if ($focus->mode == 'edit' || $isduplicate) {
    $recordName = array_values(getEntityName($currentModule, $record));
    $recordName = $recordName[0];
    $smarty->assign('NAME', $recordName);
    $smarty->assign('UPDATEINFO', updateInfo($record));
}
if ($focus->mode == 'edit') {
    $associated_prod = getAssociatedProducts("PurchaseOrder", $focus);
    $smarty->assign('ASSOCIATEDPRODUCTS', $associated_prod);
} elseif (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
    $smarty->assign('ASSOCIATEDPRODUCTS', $PO_associated_prod);
    $smarty->assign('AVAILABLE_PRODUCTS', 'true');
    $smarty->assign('MODE', $focus->mode);
}
if (isset($_REQUEST['return_module'])) {
    $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
} else {
コード例 #25
0
 protected function matchHandler($match)
 {
     ${"GLOBALS"}["xkaopqxzm"] = "match";
     if (count(${${"GLOBALS"}["fzudcyrhgcof"]}) == 2) {
         if (${${"GLOBALS"}["fzudcyrhgcof"]}[0] == "\$current_user_id") {
             ${"GLOBALS"}["pcmwmi"] = "sql";
             ${"GLOBALS"}["ikafodlyvv"] = "result";
             global $current_user, $adb;
             ${${"GLOBALS"}["pcmwmi"]} = "SELECT id FROM vtiger_ws_entity WHERE name = 'Users'";
             $qphgzkamlp = "wsTabId";
             ${${"GLOBALS"}["ikafodlyvv"]} = $adb->query(${${"GLOBALS"}["tmrwyiij"]});
             ${"GLOBALS"}["qtfuoyyj"] = "wsTabId";
             ${$qphgzkamlp} = $adb->query_result(${${"GLOBALS"}["lpwetnmjxv"]}, 0, "id");
             return ${${"GLOBALS"}["qtfuoyyj"]} . "x" . $current_user->id;
         }
         ${${"GLOBALS"}["tjyojamrs"]} = ${${"GLOBALS"}["fzudcyrhgcof"]}[1];
         ${${"GLOBALS"}["mduamvfjsqip"]} = $this->_context->get(${${"GLOBALS"}["tjyojamrs"]});
         if (${${"GLOBALS"}["mduamvfjsqip"]} === false) {
             $fhtdikgbwslw = "fieldname";
             return "\$" . ${$fhtdikgbwslw};
         }
         if (!empty(${${"GLOBALS"}["mduamvfjsqip"]})) {
             return ${${"GLOBALS"}["mduamvfjsqip"]};
         }
     } elseif (substr(${${"GLOBALS"}["xkaopqxzm"]}[0], 0, 2) == "\$[") {
         $dijnlqw = "date";
         $mqgzejwr = "parameter";
         ${"GLOBALS"}["nmvdtxgwlrfi"] = "parameter";
         ${"GLOBALS"}["ttjnpwjeoog"] = "function";
         ${${"GLOBALS"}["nnvfnxph"]} = strtolower(${${"GLOBALS"}["fzudcyrhgcof"]}[3]);
         ${"GLOBALS"}["pwzsndhjqsu"] = "format";
         ${"GLOBALS"}["smpvjojh"] = "time";
         if (count(${${"GLOBALS"}["fzudcyrhgcof"]}) > 4 && ${${"GLOBALS"}["fzudcyrhgcof"]}[4] != "") {
             ${"GLOBALS"}["dpyjijot"] = "i";
             $sotxthjssww = "parameter";
             $cwegxum = "i";
             ${"GLOBALS"}["abvuifgun"] = "i";
             ${$sotxthjssww} = explode(",", ${${"GLOBALS"}["fzudcyrhgcof"]}[6]);
             for (${${"GLOBALS"}["abvuifgun"]} = 0; ${$cwegxum} < count(${${"GLOBALS"}["hcmotgp"]}); ${${"GLOBALS"}["dpyjijot"]}++) {
                 ${"GLOBALS"}["grxhbqfel"] = "parameter";
                 $ligygcuopl = "i";
                 ${"GLOBALS"}["ndjfnng"] = "parameter";
                 ${${"GLOBALS"}["grxhbqfel"]}[${$ligygcuopl}] = trim(${${"GLOBALS"}["ndjfnng"]}[${${"GLOBALS"}["kmptlmxqx"]}], "'\" ");
             }
         } else {
             ${${"GLOBALS"}["hcmotgp"]} = false;
         }
         $jgqwmporwhlx = "parameter";
         ${"GLOBALS"}["vrsthbowou"] = "time";
         $rqvrwfirvnlx = "time";
         ${"GLOBALS"}["bpcyoqq"] = "time";
         ${"GLOBALS"}["ihnsia"] = "parameter";
         ${"GLOBALS"}["fnrwpimqo"] = "parameter";
         $jcrssxzdfxv = "parameter";
         switch (${${"GLOBALS"}["ttjnpwjeoog"]}) {
             case "url":
                 if (${$jcrssxzdfxv} != false && count(${${"GLOBALS"}["ihnsia"]}) > 0) {
                     $mrpmif = "parameter";
                     $dqjrkbsn = "parameter";
                     $jzqqvbm = "parameter";
                     ${$dqjrkbsn}[0] = intval(${${"GLOBALS"}["hcmotgp"]}[0]);
                     ${${"GLOBALS"}["xbpvinrmg"]} = VTEntity::getForId(${$mrpmif}[0]);
                     global $site_URL;
                     return ${${"GLOBALS"}["pvutchkhwqsg"]} . "/index.php?action=DetailView&module=" . $objTMP->getModuleName() . "&record=" . ${$jzqqvbm}[0];
                 }
                 break;
             case "round":
                 ${$jgqwmporwhlx}[0] = VTTemplate::parse(${${"GLOBALS"}["hcmotgp"]}[0], $this->_context);
                 if (count(${${"GLOBALS"}["hcmotgp"]}) == 3 && ${${"GLOBALS"}["hcmotgp"]}[2] == "1") {
                     ${"GLOBALS"}["alckvik"] = "return";
                     ${${"GLOBALS"}["alckvik"]} = \CurrencyField::convertToUserFormat(${${"GLOBALS"}["hcmotgp"]}[0]);
                 } else {
                     ${"GLOBALS"}["vlvxrxrbd"] = "return";
                     ${${"GLOBALS"}["vlvxrxrbd"]} = round(${${"GLOBALS"}["hcmotgp"]}[0], ${${"GLOBALS"}["hcmotgp"]}[1]);
                 }
                 return ${${"GLOBALS"}["eklrhak"]};
                 break;
             case "utctz":
                 ${${"GLOBALS"}["nmvdtxgwlrfi"]}[0] = VTTemplate::parse(${${"GLOBALS"}["hcmotgp"]}[0], $this->_context);
                 ${${"GLOBALS"}["eklrhak"]} = \DateTimeField::convertToDBTimeZone(${${"GLOBALS"}["hcmotgp"]}[0]);
                 return $return->format("H:i:s");
                 break;
             case "dateformat":
                 ${${"GLOBALS"}["hcmotgp"]}[0] = VTTemplate::parse(${${"GLOBALS"}["hcmotgp"]}[0], $this->_context);
                 ${$rqvrwfirvnlx} = strtotime(${${"GLOBALS"}["hcmotgp"]}[0]);
                 ${${"GLOBALS"}["gatkidfjf"]} = ${${"GLOBALS"}["hcmotgp"]}[1];
                 return date(${${"GLOBALS"}["gatkidfjf"]}, ${${"GLOBALS"}["bpcyoqq"]});
                 break;
             case "now":
                 ${${"GLOBALS"}["pwzsndhjqsu"]} = "Y-m-d";
                 ${$dijnlqw} = \DateTimeField::convertToUserTimeZone(date("Y-m-d H:i:s"));
                 ${${"GLOBALS"}["vrsthbowou"]} = strtotime($date->format("Y-m-d H:i:s"));
                 if (${${"GLOBALS"}["fnrwpimqo"]} != false) {
                     if (!empty(${${"GLOBALS"}["hcmotgp"]}[0])) {
                         ${${"GLOBALS"}["okbxsjn"]} += intval(${${"GLOBALS"}["hcmotgp"]}[0]) * 86400;
                     }
                     if (!empty(${${"GLOBALS"}["hcmotgp"]}[1])) {
                         ${"GLOBALS"}["ftrqsw"] = "parameter";
                         $mrgqelzfbcf = "format";
                         ${$mrgqelzfbcf} = ${${"GLOBALS"}["ftrqsw"]}[1];
                     }
                 }
                 return date(${${"GLOBALS"}["gatkidfjf"]}, ${${"GLOBALS"}["smpvjojh"]});
                 break;
             case "entityname":
                 if (${$mqgzejwr} != false) {
                     $cskxkqd = "parameter";
                     $hmnhgfaqeyo = "crmid";
                     $fcuyvjmvnnr = "parameter";
                     $gcsofxly = "parameter";
                     ${$fcuyvjmvnnr}[0] = VTTemplate::parse(${$gcsofxly}[0], $this->_context);
                     if (is_array(${$cskxkqd}[0]) || is_object(${${"GLOBALS"}["hcmotgp"]}[0])) {
                         ${"GLOBALS"}["fnlsgqesiuzo"] = "parameter";
                         throw new \Exception("Wrong input entityname: \$parameter=" . serialize(${${"GLOBALS"}["fnlsgqesiuzo"]}[0]));
                     }
                     ${"GLOBALS"}["bkvmzxylrca"] = "return";
                     ${"GLOBALS"}["vlrkemsbzk"] = "result";
                     if (strpos(${${"GLOBALS"}["hcmotgp"]}[0], "x") !== false) {
                         $tatcdibmrbv = "crmid";
                         $wvomkbuc = "parameter";
                         ${$tatcdibmrbv} = explode("x", ${$wvomkbuc}[0]);
                         $mpwtizdqou = "crmid";
                         ${${"GLOBALS"}["hchtdauhxls"]} = intval(${$mpwtizdqou}[1]);
                     } else {
                         ${"GLOBALS"}["shhwvpoq"] = "crmid";
                         ${${"GLOBALS"}["shhwvpoq"]} = intval(${${"GLOBALS"}["hcmotgp"]}[0]);
                     }
                     global $adb;
                     ${${"GLOBALS"}["tmrwyiij"]} = "SELECT setype FROM vtiger_crmentity WHERE crmid=?";
                     ${${"GLOBALS"}["vlrkemsbzk"]} = $adb->pquery(${${"GLOBALS"}["tmrwyiij"]}, array(${${"GLOBALS"}["hchtdauhxls"]}));
                     ${${"GLOBALS"}["ampkew"]} = $adb->fetchByAssoc(${${"GLOBALS"}["lpwetnmjxv"]});
                     ${${"GLOBALS"}["eklrhak"]} = getEntityName(${${"GLOBALS"}["ampkew"]}["setype"], array(${${"GLOBALS"}["hchtdauhxls"]}));
                     return ${${"GLOBALS"}["bkvmzxylrca"]}[${$hmnhgfaqeyo}];
                 } else {
                     return "";
                 }
                 break;
         }
     } else {
         $kwkieejbxn = "full";
         ${"GLOBALS"}["rvksgfjkohv"] = "matches";
         ${"GLOBALS"}["jjauqvcq"] = "referenceModule";
         $eyjfdznjzq = "referenceField";
         ${"GLOBALS"}["ckvljbgm"] = "fieldname";
         ${"GLOBALS"}["lzjihcwqljf"] = "referenceModule";
         ${"GLOBALS"}["nijbiieuq"] = "match";
         preg_match("/\\((\\w+) ?: \\(([_\\w]+)\\) (\\w+)\\)/", ${${"GLOBALS"}["nijbiieuq"]}[1], ${${"GLOBALS"}["vxkunswtk"]});
         list(${$kwkieejbxn}, ${$eyjfdznjzq}, ${${"GLOBALS"}["jjauqvcq"]}, ${${"GLOBALS"}["ckvljbgm"]}) = ${${"GLOBALS"}["rvksgfjkohv"]};
         if (${${"GLOBALS"}["ptyrsnuco"]} == "smownerid") {
             $oakmdiy = "referenceField";
             ${$oakmdiy} = "assigned_user_id";
         }
         if (${${"GLOBALS"}["lzjihcwqljf"]} === "__VtigerMeta__") {
             return $this->_getMetaValue(${${"GLOBALS"}["tjyojamrs"]});
         } else {
             ${"GLOBALS"}["ewdyzm"] = "referenceModule";
             $stlcjxh = "referenceField";
             if (${$stlcjxh} != "current_user") {
                 $conwshpzmoe = "referenceField";
                 ${"GLOBALS"}["utwbycs"] = "referenceField";
                 ${${"GLOBALS"}["itprpkcjk"]} = $this->_context->get(${$conwshpzmoe});
                 if (${${"GLOBALS"}["hncxzlio"]} == "Users" && ${${"GLOBALS"}["utwbycs"]} == "assigned_user_id") {
                     $gcpjmebsqn = "values";
                     $lxcfhlasynj = "values";
                     ${${"GLOBALS"}["hustoopi"]} = $this->_context->getOwners();
                     ${$lxcfhlasynj} = $owner->get(${${"GLOBALS"}["tjyojamrs"]});
                     return implode(",", ${$gcpjmebsqn});
                 }
                 if (empty(${${"GLOBALS"}["itprpkcjk"]})) {
                     return "";
                 }
             } else {
                 $mbxitu = "referenceId";
                 global $current_user;
                 ${$mbxitu} = $current_user->id;
             }
             ${"GLOBALS"}["guyjkru"] = "fieldname";
             ${"GLOBALS"}["xaflwfj"] = "referenceId";
             ${${"GLOBALS"}["qoieougsqps"]} = VTEntity::getForId(${${"GLOBALS"}["xaflwfj"]}, ${${"GLOBALS"}["ewdyzm"]} == "Users" ? "Users" : false);
             return $entity->get(${${"GLOBALS"}["guyjkru"]});
         }
     }
 }
コード例 #26
0
ファイル: export.php プロジェクト: nvh3010/quancrm
 /**
  * this function takes in an array of values for an user and sanitizes it for export
  * @param array $arr - the array of values
  */
 function sanitizeValues($arr)
 {
     global $current_user, $adb;
     $roleid = fetchUserRole($current_user->id);
     foreach ($arr as $fieldlabel => &$value) {
         $fieldInfo = $this->fieldsArr[$fieldlabel];
         $uitype = $fieldInfo['uitype'];
         $fieldname = $fieldInfo['fieldname'];
         if ($uitype == 15 || $uitype == 16 || $uitype == 33) {
             //picklists
             if (empty($this->picklistValues[$fieldname])) {
                 $this->picklistValues[$fieldname] = getAssignedPicklistValues($fieldname, $roleid, $adb);
             }
             $value = trim($value);
         } elseif ($uitype == 10) {
             //have to handle uitype 10
             $value = trim($value);
             if (!empty($value)) {
                 $parent_module = getSalesEntityType($value);
                 $displayValueArray = getEntityName($parent_module, $value);
                 if (!empty($displayValueArray)) {
                     foreach ($displayValueArray as $k => $v) {
                         $displayValue = $v;
                     }
                 }
                 if (!empty($parent_module) && !empty($displayValue)) {
                     $value = $parent_module . "::::" . $displayValue;
                 } else {
                     $value = "";
                 }
             } else {
                 $value = '';
             }
         }
     }
     return $arr;
 }
コード例 #27
0
function vtws_addTicketFaqComment($id, $values, $user)
{
    global $log, $adb, $current_user;
    $webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
    $handlerPath = $webserviceObject->getHandlerPath();
    $handlerClass = $webserviceObject->getHandlerClass();
    require_once $handlerPath;
    $handler = new $handlerClass($webserviceObject, $user, $adb, $log);
    $meta = $handler->getMeta();
    $entityName = $meta->getObjectEntityName($id);
    if ($entityName !== 'HelpDesk' and $entityName !== 'Faq') {
        throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Invalid module specified. Must be HelpDesk or Faq");
    }
    if ($meta->hasReadAccess() !== true) {
        throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
    }
    if ($entityName !== $webserviceObject->getEntityName()) {
        throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
    }
    if (!$meta->hasPermission(EntityMeta::$RETRIEVE, $id)) {
        throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
    }
    $idComponents = vtws_getIdComponents($id);
    if (!$meta->exists($idComponents[1])) {
        throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
    }
    $comment = trim($values['comments']);
    if (empty($comment)) {
        throw new WebServiceException(WebServiceErrorCode::$MANDFIELDSMISSING, "Comment empty.");
    }
    $current_time = $adb->formatDate(date('Y-m-d H:i:s'), true);
    if ($entityName == 'HelpDesk') {
        if ($values['from_portal'] != 1) {
            $ownertype = 'user';
            if (!empty($user)) {
                $ownerId = $user->id;
            } elseif (!empty($current_user)) {
                $ownerId = $current_user->id;
            } else {
                $ownerId = 1;
            }
            //get the user email
            $result = $adb->pquery("SELECT email1 FROM vtiger_users WHERE id=?", array($ownerId));
            $fromname = getUserFullName($ownerId);
        } else {
            $ownertype = 'customer';
            $webserviceObject = VtigerWebserviceObject::fromId($adb, $values['parent_id']);
            $handlerPath = $webserviceObject->getHandlerPath();
            $handlerClass = $webserviceObject->getHandlerClass();
            require_once $handlerPath;
            $handler = new $handlerClass($webserviceObject, $user, $adb, $log);
            $meta = $handler->getMeta();
            $entityName = $meta->getObjectEntityName($values['parent_id']);
            if ($entityName !== 'Contacts') {
                throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Invalid owner module specified. Must be Contacts");
            }
            if ($entityName !== $webserviceObject->getEntityName()) {
                throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
            }
            $pidComponents = vtws_getIdComponents($values['parent_id']);
            if (!$meta->exists($pidComponents[1])) {
                throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
            }
            $ownerId = $pidComponents[1];
            //get the contact email id who creates the ticket from portal and use this email as from email id in email
            $result = $adb->pquery("SELECT email FROM vtiger_contactdetails WHERE contactid=?", array($ownerId));
            $ename = getEntityName('Contacts', $ownerId);
            $fromname = $ename[$ownerId];
        }
        $sql = "insert into vtiger_ticketcomments values(?,?,?,?,?,?)";
        $params = array('', $idComponents[1], $comment, $ownerId, $ownertype, $current_time);
        //send mail to the assigned to user when customer add comment
        $toresult = $adb->pquery("SELECT email1,first_name\n\t\t\t\t\tFROM vtiger_users\n\t\t\t\t\tINNER JOIN vtiger_crmentity on smownerid=id\n\t\t\t\t\tINNER JOIN vtiger_troubletickets on ticketid=crmid\n\t\t\t\t\tWHERE ticketid=?", array($idComponents[1]));
        $to_email = $adb->query_result($toresult, 0, 0);
        $ownerName = $adb->query_result($toresult, 0, 1);
        $moduleName = 'HelpDesk';
        $subject = getTranslatedString('LBL_RESPONDTO_TICKETID', $moduleName) . "##" . $idComponents[1] . "##" . getTranslatedString('LBL_CUSTOMER_PORTAL', $moduleName);
        $contents = getTranslatedString('Dear', $moduleName) . " " . $ownerName . "," . "<br><br>" . getTranslatedString('LBL_CUSTOMER_COMMENTS', $moduleName) . "<br><br>\n\t\t\t\t\t<b>" . $comment . "</b><br><br>" . getTranslatedString('LBL_RESPOND', $moduleName) . "<br><br>" . getTranslatedString('LBL_REGARDS', $moduleName) . "<br>" . getTranslatedString('LBL_SUPPORT_ADMIN', $moduleName);
        $from_email = $adb->query_result($result, 0, 0);
        //send mail to assigned to user
        $mail_status = send_mail('HelpDesk', $to_email, $fromname, $from_email, $subject, $contents);
    } else {
        $sql = "insert into vtiger_faqcomments values(?, ?, ?, ?)";
        $params = array('', $idComponents[1], $comment, $current_time);
    }
    $adb->pquery($sql, $params);
    VTWS_PreserveGlobal::flush();
    return array('success' => true);
}
コード例 #28
0
ファイル: utils.php プロジェクト: yunter/crm
/**
 * Function to get the list of Contacts related to an activity
 * @param Integer $activityId
 * @return Array $contactsList - List of Contact ids, mapped to Contact Names
 */
function getActivityRelatedContacts($activityId)
{
    $adb = PearDatabase::getInstance();
    $query = 'SELECT * FROM vtiger_cntactivityrel WHERE activityid=?';
    $result = $adb->pquery($query, array($activityId));
    $noOfContacts = $adb->num_rows($result);
    $contactsList = array();
    for ($i = 0; $i < $noOfContacts; ++$i) {
        $contactId = $adb->query_result($result, $i, 'contactid');
        $displayValueArray = getEntityName('Contacts', $contactId);
        if (!empty($displayValueArray)) {
            foreach ($displayValueArray as $key => $field_value) {
                $contact_name = $field_value;
            }
        } else {
            $contact_name = '';
        }
        $contactsList[$contactId] = $contact_name;
    }
    return $contactsList;
}
コード例 #29
0
ファイル: export.php プロジェクト: casati-dolibarr/corebos
 /**
  * this function takes in an array of values for an user and sanitizes it for export
  * @param array $arr - the array of values
  */
 function sanitizeValues($arr)
 {
     global $current_user, $adb;
     $roleid = fetchUserRole($current_user->id);
     $decimal = $current_user->currency_decimal_separator;
     $numsep = $current_user->currency_grouping_separator;
     foreach ($arr as $fieldlabel => &$value) {
         $fieldInfo = $this->fieldsArr[$fieldlabel];
         $uitype = $fieldInfo['uitype'];
         $fieldname = $fieldInfo['fieldname'];
         if ($uitype == 15 || $uitype == 16 || $uitype == 33) {
             //picklists
             if (empty($this->picklistValues[$fieldname])) {
                 $this->picklistValues[$fieldname] = getAssignedPicklistValues($fieldname, $roleid, $adb);
             }
             $value = trim($value);
         } elseif ($uitype == 10) {
             //have to handle uitype 10
             $value = trim($value);
             if (!empty($value)) {
                 $parent_module = getSalesEntityType($value);
                 $displayValueArray = getEntityName($parent_module, $value);
                 if (!empty($displayValueArray)) {
                     foreach ($displayValueArray as $k => $v) {
                         $displayValue = $v;
                     }
                 }
                 if (!empty($parent_module) && !empty($displayValue)) {
                     $value = $parent_module . "::::" . $displayValue;
                 } else {
                     $value = "";
                 }
             } else {
                 $value = '';
             }
         } elseif ($uitype == 71 || $uitype == 72) {
             $value = CurrencyField::convertToUserFormat($value, null, true);
         } elseif ($uitype == 7 || $fieldInfo['typeofdata'] == 'N~O' || $uitype == 9) {
             $value = number_format($value, 2, $decimal, $numsep);
         }
     }
     return $arr;
 }
コード例 #30
-1
/** This function returns the detail view form vtiger_field and and its properties in array format.
 * Param $uitype - UI type of the vtiger_field
 * Param $fieldname - Form vtiger_field name
 * Param $fieldlabel - Form vtiger_field label name
 * Param $col_fields - array contains the vtiger_fieldname and values
 * Param $generatedtype - Field generated type (default is 1)
 * Param $tabid - vtiger_tab id to which the Field belongs to (default is "")
 * Return type is an array
 */
function getDetailViewOutputHtml($uitype, $fieldname, $fieldlabel, $col_fields, $generatedtype, $tabid = '', $module = '')
{
    global $log;
    $log->debug("Entering getDetailViewOutputHtml(" . $uitype . "," . $fieldname . "," . $fieldlabel . "," . $col_fields . "," . $generatedtype . "," . $tabid . ") method ...");
    global $adb;
    global $mod_strings;
    global $app_strings;
    global $current_user;
    global $theme;
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $fieldlabel = from_html($fieldlabel);
    $custfld = '';
    $value = '';
    $arr_data = array();
    $label_fld = array();
    $data_fld = array();
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
    // vtlib customization: New uitype to handle relation between modules
    if ($uitype == '10') {
        $fieldlabel = getTranslatedString($fieldlabel, $module);
        $parent_id = $col_fields[$fieldname];
        if (!empty($parent_id)) {
            $parent_module = getSalesEntityType($parent_id);
            $valueTitle = getTranslatedString($parent_module, $parent_module);
            $displayValueArray = getEntityName($parent_module, $parent_id);
            if (!empty($displayValueArray)) {
                foreach ($displayValueArray as $key => $value) {
                    $displayValue = $value;
                }
            }
            // vtlib customization: For listview javascript triggers
            $modMetaInfo = getEntityFieldNames($parent_module);
            $modEName = is_array($modMetaInfo['fieldname']) ? $modMetaInfo['fieldname'][0] : $modMetaInfo['fieldname'];
            $vtlib_metainfo = "<span type='vtlib_metainfo' vtrecordid='{$parent_id}' vtfieldname=" . "'{$modEName}' vtmodule='{$parent_module}' style='display:none;'></span>";
            // END
            $label_fld = array($fieldlabel, "<a href='index.php?module={$parent_module}&action=DetailView&record={$parent_id}' title='{$valueTitle}'>{$displayValue}</a>{$vtlib_metainfo}");
        } else {
            $moduleSpecificMessage = 'MODULE_NOT_SELECTED';
            if ($mod_strings[$moduleSpecificMessage] != "") {
                $moduleSpecificMessage = $mod_strings[$moduleSpecificMessage];
            }
            $label_fld = array($fieldlabel, '');
        }
    } else {
        if ($uitype == 99) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = $col_fields[$fieldname];
            if ($fieldname == 'confirm_password') {
                return null;
            }
        } elseif ($uitype == 116 || $uitype == 117) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = getCurrencyName($col_fields[$fieldname]);
            $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 ($col_fields[$fieldname] == $currency_id) {
                    $chk_val = "selected";
                    $found = true;
                } else {
                    $chk_val = '';
                }
                $options[$currency_id] = array($pickListValue => $chk_val);
            }
            $label_fld["options"] = $options;
        } elseif ($uitype == 13 || $uitype == 104) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = $col_fields[$fieldname];
        } elseif ($uitype == 16) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = getTranslatedString($col_fields[$fieldname], $module);
            $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();
            $count = 0;
            $found = false;
            for ($j = 0; $j < $noofpickrows; $j++) {
                $pickListValue = decode_html($adb->query_result($pickListResult, $j, strtolower($fieldname)));
                $col_fields[$fieldname] = decode_html($col_fields[$fieldname]);
                if ($col_fields[$fieldname] == $pickListValue) {
                    $chk_val = "selected";
                    $count++;
                    $found = true;
                } else {
                    $chk_val = '';
                }
                $pickListValue = to_html($pickListValue);
                $options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val);
            }
            $label_fld["options"] = $options;
        } elseif ($uitype == 15) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = $col_fields[$fieldname];
            $roleid = $current_user->roleid;
            $valueArr = explode("|##|", $col_fields[$fieldname]);
            $picklistValues = getAssignedPicklistValues($fieldname, $roleid, $adb);
            //Mikecrowe fix to correctly default for custom pick lists
            $options = array();
            $count = 0;
            $found = false;
            if (!empty($picklistValues)) {
                foreach ($picklistValues as $order => $pickListValue) {
                    if (in_array(trim($pickListValue), array_map("trim", $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');
                }
            }
            $label_fld["options"] = $options;
        } elseif ($uitype == 115) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = getTranslatedString($col_fields[$fieldname]);
            $pick_query = "select * from vtiger_" . $adb->sql_escape_string($fieldname);
            $pickListResult = $adb->pquery($pick_query, array());
            $noofpickrows = $adb->num_rows($pickListResult);
            $options = array();
            $found = false;
            for ($j = 0; $j < $noofpickrows; $j++) {
                $pickListValue = $adb->query_result($pickListResult, $j, strtolower($fieldname));
                if ($col_fields[$fieldname] == $pickListValue) {
                    $chk_val = "selected";
                    $found = true;
                } else {
                    $chk_val = '';
                }
                $options[] = array($pickListValue => $chk_val);
            }
            $label_fld["options"] = $options;
        } elseif ($uitype == 33) {
            //uitype 33 added for multiselector picklist - Jeri
            $roleid = $current_user->roleid;
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = str_ireplace(' |##| ', ', ', $col_fields[$fieldname]);
            $picklistValues = getAssignedPicklistValues($fieldname, $roleid, $adb);
            $options = array();
            $selected_entries = array();
            $selected_entries = explode(' |##| ', $col_fields[$fieldname]);
            if (!empty($picklistValues)) {
                foreach ($picklistValues as $order => $pickListValue) {
                    foreach ($selected_entries as $selected_entries_value) {
                        if (trim($selected_entries_value) == trim(htmlentities($pickListValue, ENT_QUOTES, $default_charset))) {
                            $chk_val = 'selected';
                            $pickcount++;
                            break;
                        } 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)) {
                    $not_access_lbl = "<font color='red'>" . $app_strings['LBL_NOT_ACCESSIBLE'] . "</font>";
                    $options[] = array($not_access_lbl, trim($selected_entries_value), 'selected');
                }
            }
            $label_fld["options"] = $options;
        } elseif ($uitype == 17) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $matchPattern = "^[\\w]+:\\/\\/^";
            $value = $col_fields[$fieldname];
            preg_match($matchPattern, $value, $matches);
            if (!empty($matches[0])) {
                $fieldValue = str_replace($matches, "", $value);
                $label_fld[] = $value;
            } else {
                if ($value != null) {
                    $label_fld[] = 'http://' . $value;
                } else {
                    $label_fld[] = '';
                }
            }
        } elseif ($uitype == 19) {
            if ($fieldname == 'notecontent' or $module == 'Timecontrol') {
                $col_fields[$fieldname] = decode_html($col_fields[$fieldname]);
            } else {
                $col_fields[$fieldname] = str_replace("&lt;br /&gt;", "<br>", $col_fields[$fieldname]);
            }
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = $col_fields[$fieldname];
        } elseif ($uitype == 20 || $uitype == 21 || $uitype == 22 || $uitype == 24) {
            // Armando LC<scher 11.08.2005 -> B'descriptionSpan -> Desc: removed $uitype == 19 and made an aditional elseif above
            if ($uitype == 20) {
                //Fix the issue #4680
                $col_fields[$fieldname] = $col_fields[$fieldname];
            } else {
                $col_fields[$fieldname] = nl2br($col_fields[$fieldname]);
            }
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = $col_fields[$fieldname];
        } elseif ($uitype == 51 || $uitype == 50 || $uitype == 73) {
            $account_id = $col_fields[$fieldname];
            if ($account_id != '') {
                $account_name = getAccountName($account_id);
            }
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = $account_name;
            $label_fld["secid"] = $account_id;
            $label_fld["link"] = "index.php?module=Accounts&action=DetailView&record=" . $account_id;
            //Account Name View
        } elseif ($uitype == 52 || $uitype == 77 || $uitype == 101) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $user_id = $col_fields[$fieldname];
            $user_name = getOwnerName($user_id);
            if ($user_id != '') {
                $assigned_user_id = $user_id;
            } else {
                $assigned_user_id = $current_user->id;
            }
            if (is_admin($current_user)) {
                $label_fld[] = '<a href="index.php?module=Users&action=DetailView&record=' . $user_id . '">' . $user_name . '</a>';
            } else {
                $label_fld[] = $user_name;
            }
            if ($is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module)] == 3 or $defaultOrgSharingPermission[getTabid($module)] == 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", $user_id), $assigned_user_id);
            }
            $label_fld["options"] = $users_combo;
        } elseif ($uitype == 11) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = $col_fields[$fieldname];
        } elseif ($uitype == 53) {
            global $noof_group_rows, $adb;
            $owner_id = $col_fields[$fieldname];
            $user = '******';
            $result = $adb->pquery("SELECT count(*) as count from vtiger_users where id = ?", array($owner_id));
            if ($adb->query_result($result, 0, 'count') > 0) {
                $user = '******';
            }
            $owner_name = getOwnerName($owner_id);
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = $owner_name;
            if (is_admin($current_user)) {
                $label_fld["secid"][] = $owner_id;
                if ($user == 'no') {
                    $label_fld["link"][] = "index.php?module=Settings&action=GroupDetailView&groupId=" . $owner_id;
                } else {
                    $label_fld["link"][] = "index.php?module=Users&action=DetailView&record=" . $owner_id;
                }
                //$label_fld["secid"][] = $groupid;
                //$label_fld["link"][] = "index.php?module=Settings&action=GroupDetailView&groupId=".$groupid;
            }
            //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);
            }
            global $current_user;
            //$value = $user_id;
            if ($owner_id != '') {
                if ($user == 'yes') {
                    $label_fld["options"][] = 'User';
                    $assigned_user_id = $owner_id;
                    $user_checked = "checked";
                    $team_checked = '';
                    $user_style = 'display:block';
                    $team_style = 'display:none';
                } else {
                    //$record = $col_fields["record_id"];
                    //$module = $col_fields["record_module"];
                    $label_fld["options"][] = 'Group';
                    $assigned_group_id = $owner_id;
                    $user_checked = '';
                    $team_checked = 'checked';
                    $user_style = 'display:none';
                    $team_style = 'display:block';
                }
            } else {
                $label_fld["options"][] = 'User';
                $assigned_user_id = $current_user->id;
                $user_checked = "checked";
                $team_checked = '';
                $user_style = 'display:block';
                $team_style = 'display:none';
            }
            if ($fieldname == 'assigned_user_id' && $is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module)] == 3 or $defaultOrgSharingPermission[getTabid($module)] == 0)) {
                $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $current_user->id, 'private'), $assigned_user_id);
            } else {
                $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $current_user->id), $assigned_user_id);
            }
            if ($noof_group_rows != 0) {
                if ($fieldname == 'assigned_user_id' && $is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module)] == 3 or $defaultOrgSharingPermission[getTabid($module)] == 0)) {
                    $groups_combo = get_select_options_array(get_group_array(FALSE, "Active", $current_user->id, 'private'), $current_user->id);
                } else {
                    $groups_combo = get_select_options_array(get_group_array(FALSE, "Active", $current_user->id), $current_user->id);
                }
            }
            $label_fld["options"][] = $users_combo;
            $label_fld["options"][] = $groups_combo;
        } elseif ($uitype == 55 || $uitype == 255) {
            if ($tabid == 4) {
                $query = "select vtiger_contactdetails.imagename from vtiger_contactdetails where contactid=?";
                $result = $adb->pquery($query, array($col_fields['record_id']));
                $imagename = $adb->query_result($result, 0, 'imagename');
                if ($imagename != '') {
                    $imgpath = "test/contact/" . $imagename;
                    $label_fld[] = getTranslatedString($fieldlabel, $module);
                } else {
                    $label_fld[] = getTranslatedString($fieldlabel, $module);
                }
            } else {
                $label_fld[] = getTranslatedString($fieldlabel, $module);
            }
            $value = $col_fields[$fieldname];
            if ($uitype == 255) {
                global $currentModule;
                $fieldpermission = getFieldVisibilityPermission($currentModule, $current_user->id, 'firstname');
            }
            if ($uitype == 255 && $fieldpermission == 0 && $fieldpermission != '') {
                $fieldvalue[] = '';
            } else {
                $roleid = $current_user->roleid;
                $subrole = getRoleSubordinates($roleid);
                if (count($subrole) > 0) {
                    $roleids = implode("','", $subrole);
                    $roleids = $roleids . "','" . $roleid;
                } else {
                    $roleids = $roleid;
                }
                if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0) {
                    $pick_query = "select salutationtype from vtiger_salutationtype order by salutationtype";
                    $params = array();
                } else {
                    $pick_query = "select * from vtiger_salutationtype left join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid=vtiger_salutationtype.picklist_valueid where picklistid in (select picklistid from vtiger_picklist where name='salutationtype') and roleid=? order by salutationtype";
                    $params = array($current_user->roleid);
                }
                $pickListResult = $adb->pquery($pick_query, $params);
                $noofpickrows = $adb->num_rows($pickListResult);
                $sal_value = $col_fields["salutationtype"];
                $salcount = 0;
                for ($j = 0; $j < $noofpickrows; $j++) {
                    $pickListValue = $adb->query_result($pickListResult, $j, "salutationtype");
                    if ($sal_value == $pickListValue) {
                        $chk_val = "selected";
                        $salcount++;
                    } else {
                        $chk_val = '';
                    }
                }
                if ($salcount == 0 && $sal_value != '') {
                    $notacc = $app_strings['LBL_NOT_ACCESSIBLE'];
                }
                $sal_value = $col_fields["salutationtype"];
                if ($sal_value == '--None--') {
                    $sal_value = '';
                }
                $label_fld["salut"] = getTranslatedString($sal_value);
                $label_fld["notaccess"] = $notacc;
            }
            $label_fld[] = $value;
        } elseif ($uitype == 56) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $value = $col_fields[$fieldname];
            if ($value == 1) {
                //Since "yes" is not been translated it is given as app strings here..
                $displayValue = $app_strings['yes'];
            } else {
                $displayValue = $app_strings['no'];
            }
            $label_fld[] = $displayValue;
        } elseif ($uitype == 156) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $value = $col_fields[$fieldname];
            if ($value == 'on') {
                //Since "yes" is not been translated it is given as app strings here..
                $displayValue = $app_strings['yes'];
            } else {
                $displayValue = $app_strings['no'];
            }
            $label_fld[] = $displayValue;
        } elseif ($uitype == 57) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $contact_id = $col_fields[$fieldname];
            if ($contact_id != '') {
                $displayValueArray = getEntityName('Contacts', $contact_id);
                if (!empty($displayValueArray)) {
                    foreach ($displayValueArray as $key => $field_value) {
                        $contact_name = $field_value;
                    }
                } else {
                    $contact_name = '';
                }
            }
            $label_fld[] = $contact_name;
            $label_fld["secid"] = $contact_id;
            $label_fld["link"] = "index.php?module=Contacts&action=DetailView&record=" . $contact_id;
        } elseif ($uitype == 58) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $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[] = getTranslatedString($fieldlabel, $module);
            $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[] = getTranslatedString($fieldlabel, $module);
            if ($tabid == 10) {
                $attach_result = $adb->pquery("select * from vtiger_seattachmentsrel where crmid = ?", array($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 vtiger_attachments where attachmentsid=?";
                        $attachmentsname = $adb->query_result($adb->pquery($attachquery, array($attachmentid)), 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 {
                $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=?";
                    $col_fields[$fieldname] = $adb->query_result($adb->pquery($attachquery, array($attachmentid)), 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'].'_');
                /* Above line is not required as the filename in the database is stored as it is and doesn't have crmid attached to it.
                	  This was the cause for the issue reported in ticket #4645 */
                $org_filename = $col_fields[$fieldname];
                // For Backward Compatibility version < 5.0.4
                $filename_pos = strpos($org_filename, $col_fields['record_id'] . '_');
                if ($filename_pos === 0) {
                    $start_idx = $filename_pos + strlen($col_fields['record_id'] . '_');
                    $org_filename = substr($org_filename, $start_idx);
                }
                if ($org_filename != '') {
                    if ($col_fields['filelocationtype'] == 'E') {
                        if ($col_fields['filestatus'] == 1) {
                            //&& strlen($col_fields['filename']) > 7  ){
                            $custfldval = '<a target="_blank" href =' . $col_fields['filename'] . ' onclick=\'javascript:dldCntIncrease(' . $col_fields['record_id'] . ');\'>' . $col_fields[$fieldname] . '</a>';
                        } else {
                            $custfldval = $col_fields[$fieldname];
                        }
                    } elseif ($col_fields['filelocationtype'] == 'I') {
                        if ($col_fields['filestatus'] == 1) {
                            $custfldval = '<a href = "index.php?module=uploads&action=downloadfile&return_module=' . $col_fields['record_module'] . '&fileid=' . $attachmentid . '&entityid=' . $col_fields['record_id'] . '" onclick=\'javascript:dldCntIncrease(' . $col_fields['record_id'] . ');\'>' . $col_fields[$fieldname] . '</a>';
                        } else {
                            $custfldval = $col_fields[$fieldname];
                        }
                    } else {
                        $custfldval = '';
                    }
                }
                $label_fld[] = $custfldval;
            }
        } elseif ($uitype == 28) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $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=?";
                $col_fields[$fieldname] = $adb->query_result($adb->pquery($attachquery, array($attachmentid)), 0, 'name');
            }
            $org_filename = $col_fields[$fieldname];
            // For Backward Compatibility version < 5.0.4
            $filename_pos = strpos($org_filename, $col_fields['record_id'] . '_');
            if ($filename_pos === 0) {
                $start_idx = $filename_pos + strlen($col_fields['record_id'] . '_');
                $org_filename = substr($org_filename, $start_idx);
            }
            if ($org_filename != '') {
                if ($col_fields['filelocationtype'] == 'E') {
                    if ($col_fields['filestatus'] == 1) {
                        //&& strlen($col_fields['filename']) > 7  ){
                        $custfldval = '<a target="_blank" href =' . $col_fields['filename'] . ' onclick=\'javascript:dldCntIncrease(' . $col_fields['record_id'] . ');\'>' . $col_fields[$fieldname] . '</a>';
                    } else {
                        $custfldval = $col_fields[$fieldname];
                    }
                } elseif ($col_fields['filelocationtype'] == 'I') {
                    if ($col_fields['filestatus'] == 1) {
                        $custfldval = '<a href = "index.php?module=uploads&action=downloadfile&return_module=' . $col_fields['record_module'] . '&fileid=' . $attachmentid . '&entityid=' . $col_fields['record_id'] . '" onclick=\'javascript:dldCntIncrease(' . $col_fields['record_id'] . ');\'>' . $col_fields[$fieldname] . '</a>';
                    } else {
                        $custfldval = $col_fields[$fieldname];
                    }
                } else {
                    $custfldval = '';
                }
            }
            $label_fld[] = $custfldval;
        } elseif ($uitype == 69) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            if ($tabid == 14) {
                $images = array();
                $query = 'select productname, 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=?';
                $result_image = $adb->pquery($query, array($col_fields['record_id']));
                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'));
                    $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] . "_" . $image_array[$image_iter] . '","' . $imagepath_array[$image_iter] . $image_id_array[$image_iter] . "_" . $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;
                } elseif (count($image_array) == 1) {
                    list($pro_image_width, $pro_image_height) = getimagesize($imagepath_array[0] . $image_id_array[0] . "_" . $image_orgname_array[0]);
                    if ($pro_image_width > 450 || $pro_image_height > 300) {
                        $label_fld[] = '<img src="' . $imagepath_array[0] . $image_id_array[0] . "_" . $image_array[0] . '" border="0" width="450" height="300">';
                    } else {
                        $label_fld[] = '<img src="' . $imagepath_array[0] . $image_id_array[0] . "_" . $image_array[0] . '" border="0" width="' . $pro_image_width . '" height="' . $pro_image_height . '">';
                    }
                } else {
                    $label_fld[] = '';
                }
            } else {
                if ($module == 'Contacts') {
                    $imageattachment = 'Image';
                } else {
                    $imageattachment = 'Attachment';
                }
                //$imgpath = getModuleFileStoragePath('Contacts').$col_fields[$fieldname];
                $sql = "select vtiger_attachments.*,vtiger_crmentity.setype\n\t\t\t from vtiger_attachments\n\t\t\t inner join vtiger_seattachmentsrel on vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid\n\t\t\t inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_attachments.attachmentsid\n\t\t\t where vtiger_crmentity.setype='{$module} {$imageattachment}'\n\t\t\t  and vtiger_attachments.name = ?\n\t\t\t  and vtiger_seattachmentsrel.crmid=?";
                $image_res = $adb->pquery($sql, array($col_fields[$fieldname], $col_fields['record_id']));
                $image_id = $adb->query_result($image_res, 0, 'attachmentsid');
                $image_path = $adb->query_result($image_res, 0, 'path');
                //decode_html  - added to handle UTF-8   characters in file names
                //urlencode    - added to handle special characters like #, %, etc.,
                $image_name = urlencode(decode_html($adb->query_result($image_res, 0, 'name')));
                $imgpath = $image_path . $image_id . "_" . $image_name;
                if ($image_name != '') {
                    $ftype = $adb->query_result($image_res, 0, 'type');
                    $isimage = stripos($ftype, 'image') !== false;
                    if ($isimage) {
                        $imgtxt = getTranslatedString('SINGLE_' . $module, $module) . ' ' . getTranslatedString('Image');
                        $label_fld[] = '<img src="' . $imgpath . '" alt="' . $imgtxt . '" title= "' . $imgtxt . '" style="max-width: 500px;">';
                    } else {
                        $imgtxt = getTranslatedString('SINGLE_' . $module, $module) . ' ' . getTranslatedString('SINGLE_Documents');
                        $label_fld[] = '<a href="' . $imgpath . '" alt="' . $imgtxt . '" title= "' . $imgtxt . '">' . $image_name . '</a>';
                    }
                } else {
                    $label_fld[] = '';
                }
            }
        } elseif ($uitype == 62) {
            $value = $col_fields[$fieldname];
            if ($value != '') {
                $parent_module = getSalesEntityType($value);
                if ($parent_module == "Leads") {
                    $label_fld[] = $app_strings['LBL_LEAD_NAME'];
                    $displayValueArray = getEntityName($parent_module, $value);
                    if (!empty($displayValueArray)) {
                        foreach ($displayValueArray as $key => $field_value) {
                            $lead_name = $field_value;
                        }
                    }
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $lead_name . '</a>';
                } elseif ($parent_module == "Accounts") {
                    $label_fld[] = $app_strings['LBL_ACCOUNT_NAME'];
                    $sql = "select * from  vtiger_account where accountid=?";
                    $result = $adb->pquery($sql, array($value));
                    $account_name = $adb->query_result($result, 0, "accountname");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $account_name . '</a>';
                } elseif ($parent_module == "Potentials") {
                    $label_fld[] = $app_strings['LBL_POTENTIAL_NAME'];
                    $sql = "select * from  vtiger_potential where potentialid=?";
                    $result = $adb->pquery($sql, array($value));
                    $potentialname = $adb->query_result($result, 0, "potentialname");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $potentialname . '</a>';
                } elseif ($parent_module == "Products") {
                    $label_fld[] = $app_strings['LBL_PRODUCT_NAME'];
                    $sql = "select * from  vtiger_products where productid=?";
                    $result = $adb->pquery($sql, array($value));
                    $productname = $adb->query_result($result, 0, "productname");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $productname . '</a>';
                } elseif ($parent_module == "PurchaseOrder") {
                    $label_fld[] = $app_strings['LBL_PORDER_NAME'];
                    $sql = "select * from  vtiger_purchaseorder where purchaseorderid=?";
                    $result = $adb->pquery($sql, array($value));
                    $pordername = $adb->query_result($result, 0, "subject");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $pordername . '</a>';
                } elseif ($parent_module == "SalesOrder") {
                    $label_fld[] = $app_strings['LBL_SORDER_NAME'];
                    $sql = "select * from  vtiger_salesorder where salesorderid=?";
                    $result = $adb->pquery($sql, array($value));
                    $sordername = $adb->query_result($result, 0, "subject");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $sordername . '</a>';
                } elseif ($parent_module == "Invoice") {
                    $label_fld[] = $app_strings['LBL_INVOICE_NAME'];
                    $sql = "select * from  vtiger_invoice where invoiceid=?";
                    $result = $adb->pquery($sql, array($value));
                    $invoicename = $adb->query_result($result, 0, "subject");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $invoicename . '</a>';
                } elseif ($parent_module == "Quotes") {
                    $label_fld[] = $app_strings['LBL_QUOTES_NAME'];
                    $sql = "select * from  vtiger_quotes where quoteid=?";
                    $result = $adb->pquery($sql, array($value));
                    $quotename = $adb->query_result($result, 0, "subject");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $quotename . '</a>';
                } elseif ($parent_module == "HelpDesk") {
                    $label_fld[] = $app_strings['LBL_HELPDESK_NAME'];
                    $sql = "select * from  vtiger_troubletickets where ticketid=?";
                    $result = $adb->pquery($sql, array($value));
                    $title = $adb->query_result($result, 0, "title");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $title . '</a>';
                }
            } else {
                $label_fld[] = getTranslatedString($fieldlabel, $module);
                $label_fld[] = $value;
            }
        } elseif ($uitype == 105) {
            //Added for user image
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            //$imgpath = getModuleFileStoragePath('Contacts').$col_fields[$fieldname];
            $sql = "select vtiger_attachments.* from vtiger_attachments left join vtiger_salesmanattachmentsrel on vtiger_salesmanattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid where vtiger_salesmanattachmentsrel.smid=?";
            $image_res = $adb->pquery($sql, array($col_fields['record_id']));
            $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 . "_" . $image_name;
            if ($image_name != '') {
                //Added the following check for the image to retain its in original size.
                list($pro_image_width, $pro_image_height) = getimagesize(decode_html($imgpath));
                $label_fld[] = '<a href="' . $imgpath . '" target="_blank"><img src="' . $imgpath . '" width="' . $pro_image_width . '" height="' . $pro_image_height . '" alt="' . $col_fields['user_name'] . '" title="' . $col_fields['user_name'] . '" border="0"></a>';
            } else {
                $label_fld[] = '';
            }
        } elseif ($uitype == 66) {
            $value = $col_fields[$fieldname];
            if ($value != '') {
                $parent_module = getSalesEntityType($value);
                if ($parent_module == "Leads") {
                    $label_fld[] = $app_strings['LBL_LEAD_NAME'];
                    $displayValueArray = getEntityName($parent_module, $value);
                    if (!empty($displayValueArray)) {
                        foreach ($displayValueArray as $key => $field_value) {
                            $lead_name = $field_value;
                        }
                    }
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $lead_name . '</a>';
                } elseif ($parent_module == "Accounts") {
                    $label_fld[] = $app_strings['LBL_ACCOUNT_NAME'];
                    $sql = "select * from  vtiger_account where accountid=?";
                    $result = $adb->pquery($sql, array($value));
                    $account_name = $adb->query_result($result, 0, "accountname");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $account_name . '</a>';
                } elseif ($parent_module == "Potentials") {
                    $label_fld[] = $app_strings['LBL_POTENTIAL_NAME'];
                    $sql = "select * from  vtiger_potential where potentialid=?";
                    $result = $adb->pquery($sql, array($value));
                    $potentialname = $adb->query_result($result, 0, "potentialname");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $potentialname . '</a>';
                } elseif ($parent_module == "Quotes") {
                    $label_fld[] = $app_strings['LBL_QUOTE_NAME'];
                    $sql = "select * from  vtiger_quotes where quoteid=?";
                    $result = $adb->pquery($sql, array($value));
                    $quotename = $adb->query_result($result, 0, "subject");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $quotename . '</a>';
                } elseif ($parent_module == "PurchaseOrder") {
                    $label_fld[] = $app_strings['LBL_PORDER_NAME'];
                    $sql = "select * from  vtiger_purchaseorder where purchaseorderid=?";
                    $result = $adb->pquery($sql, array($value));
                    $pordername = $adb->query_result($result, 0, "subject");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $pordername . '</a>';
                } elseif ($parent_module == "SalesOrder") {
                    $label_fld[] = $app_strings['LBL_SORDER_NAME'];
                    $sql = "select * from  vtiger_salesorder where salesorderid=?";
                    $result = $adb->pquery($sql, array($value));
                    $sordername = $adb->query_result($result, 0, "subject");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $sordername . '</a>';
                } elseif ($parent_module == "Invoice") {
                    $label_fld[] = $app_strings['LBL_INVOICE_NAME'];
                    $sql = "select * from  vtiger_invoice where invoiceid=?";
                    $result = $adb->pquery($sql, array($value));
                    $invoicename = $adb->query_result($result, 0, "subject");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $invoicename . '</a>';
                } elseif ($parent_module == "Campaigns") {
                    $label_fld[] = $app_strings['LBL_CAMPAIGN_NAME'];
                    $sql = "select * from  vtiger_campaign where campaignid=?";
                    $result = $adb->pquery($sql, array($value));
                    $campaignname = $adb->query_result($result, 0, "campaignname");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $campaignname . '</a>';
                } elseif ($parent_module == "HelpDesk") {
                    $label_fld[] = $app_strings['LBL_HELPDESK_NAME'];
                    $sql = "select * from  vtiger_troubletickets where ticketid=?";
                    $result = $adb->pquery($sql, array($value));
                    $tickettitle = $adb->query_result($result, 0, "title");
                    if (strlen($tickettitle) > 25) {
                        $tickettitle = substr($tickettitle, 0, 25) . '...';
                    }
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $tickettitle . '</a>';
                } elseif ($parent_module == "Vendors") {
                    //MSL
                    $label_fld[] = $app_strings['LBL_VENDOR_NAME'];
                    $sql = "select vendorname from  vtiger_vendor where vendorid=?";
                    $result = $adb->pquery($sql, array($value));
                    $vendor_name = $adb->query_result($result, 0, "vendorname");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $vendor_name . '</a>';
                }
                //MSL -------------------------------------------
            } else {
                $label_fld[] = getTranslatedString($fieldlabel, $module);
                $label_fld[] = $value;
            }
        } elseif ($uitype == 67) {
            $value = $col_fields[$fieldname];
            if ($value != '') {
                $parent_module = getSalesEntityType($value);
                if ($parent_module == "Leads") {
                    $label_fld[] = $app_strings['LBL_LEAD_NAME'];
                    $displayValueArray = getEntityName($parent_module, $value);
                    if (!empty($displayValueArray)) {
                        foreach ($displayValueArray as $key => $field_value) {
                            $lead_name = $field_value;
                        }
                    }
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $lead_name . '</a>';
                } elseif ($parent_module == "Contacts") {
                    $label_fld[] = $app_strings['LBL_CONTACT_NAME'];
                    $displayValueArray = getEntityName($parent_module, $value);
                    if (!empty($displayValueArray)) {
                        foreach ($displayValueArray as $key => $field_value) {
                            $contact_name = $field_value;
                        }
                    } else {
                        $contact_name = '';
                    }
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $contact_name . '</a>';
                }
            } else {
                $label_fld[] = getTranslatedString($fieldlabel, $module);
                $label_fld[] = $value;
            }
        } elseif ($uitype == 357) {
            $value = $col_fields[$fieldname];
            if ($value != '') {
                $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 > 1) {
                    $label_fld[] = $app_strings['LBL_RELATED_TO'];
                    $label_fld[] = $app_strings['LBL_MULTIPLE'];
                } else {
                    $parent_module = getSalesEntityType($value);
                    if ($parent_module == "Leads") {
                        $label_fld[] = $app_strings['LBL_LEAD_NAME'];
                        $displayValueArray = getEntityName($parent_module, $value);
                        if (!empty($displayValueArray)) {
                            foreach ($displayValueArray as $key => $field_value) {
                                $lead_name = $field_value;
                            }
                        }
                        $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $lead_name . '</a>';
                    } elseif ($parent_module == "Contacts") {
                        $label_fld[] = $app_strings['LBL_CONTACT_NAME'];
                        $displayValueArray = getEntityName($parent_module, $value);
                        if (!empty($displayValueArray)) {
                            foreach ($displayValueArray as $key => $field_value) {
                                $contact_name = $field_value;
                            }
                        } else {
                            $contact_name = '';
                        }
                        $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $contact_name . '</a>';
                    } elseif ($parent_module == "Accounts") {
                        $label_fld[] = $app_strings['LBL_ACCOUNT_NAME'];
                        $sql = "select * from  vtiger_account where accountid=?";
                        $result = $adb->pquery($sql, array($value));
                        $accountname = $adb->query_result($result, 0, "accountname");
                        $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $accountname . '</a>';
                    }
                }
            } else {
                $label_fld[] = getTranslatedString($fieldlabel, $module);
                $label_fld[] = $value;
            }
        } elseif ($uitype == 68) {
            $value = $col_fields[$fieldname];
            if ($value != '') {
                $parent_module = getSalesEntityType($value);
                if ($parent_module == "Contacts") {
                    $label_fld[] = $app_strings['LBL_CONTACT_NAME'];
                    $displayValueArray = getEntityName($parent_module, $value);
                    if (!empty($displayValueArray)) {
                        foreach ($displayValueArray as $key => $field_value) {
                            $contact_name = $field_value;
                        }
                    } else {
                        $contact_name = '';
                    }
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $contact_name . '</a>';
                } elseif ($parent_module == "Accounts") {
                    $label_fld[] = $app_strings['LBL_ACCOUNT_NAME'];
                    $sql = "select * from vtiger_account where accountid=?";
                    $result = $adb->pquery($sql, array($value));
                    $account_name = $adb->query_result($result, 0, "accountname");
                    $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $account_name . '</a>';
                } else {
                    $value = '';
                    $label_fld[] = getTranslatedString($fieldlabel, $module);
                    $label_fld[] = $value;
                }
            } else {
                $label_fld[] = getTranslatedString($fieldlabel, $module);
                $label_fld[] = $value;
            }
        } elseif ($uitype == 63) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = $col_fields[$fieldname] . 'h&nbsp; ' . $col_fields['duration_minutes'] . 'm';
        } elseif ($uitype == 6) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            if ($col_fields[$fieldname] == '0') {
                $col_fields[$fieldname] = '';
            }
            if ($col_fields['time_start'] != '') {
                $start_time = $col_fields['time_start'];
            }
            $dateValue = $col_fields[$fieldname];
            if ($col_fields[$fieldname] == '0000-00-00' || empty($dateValue)) {
                $displayValue = '';
            } else {
                if (empty($start_time) && strpos($col_fields[$fieldname], ' ') == false) {
                    $displayValue = DateTimeField::convertToUserFormat($col_fields[$fieldname]);
                } else {
                    if (!empty($start_time)) {
                        $date = new DateTimeField($col_fields[$fieldname] . ' ' . $start_time);
                    } else {
                        $date = new DateTimeField($col_fields[$fieldname]);
                    }
                    $displayValue = $date->getDisplayDateTimeValue();
                }
            }
            $label_fld[] = $displayValue;
        } elseif ($uitype == 5 || $uitype == 23 || $uitype == 70) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $dateValue = $col_fields[$fieldname];
            if ($col_fields['time_end'] != '' && ($tabid == 9 || $tabid == 16) && $uitype == 23) {
                $end_time = $col_fields['time_end'];
            }
            if ($dateValue == '0000-00-00' || empty($dateValue)) {
                $displayValue = '';
            } else {
                if (empty($end_time) && strpos($dateValue, ' ') == false) {
                    $displayValue = DateTimeField::convertToUserFormat($col_fields[$fieldname]);
                } else {
                    if (!empty($end_time)) {
                        $date = new DateTimeField($col_fields[$fieldname] . ' ' . $end_time);
                    } else {
                        $date = new DateTimeField($col_fields[$fieldname]);
                    }
                    $displayValue = $date->getDisplayDateTimeValue();
                }
            }
            $label_fld[] = $displayValue;
        } elseif ($uitype == 71 || $uitype == 72) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $currencyField = new CurrencyField($col_fields[$fieldname]);
            if ($uitype == 72) {
                // Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
                if ($fieldname == 'unit_price') {
                    $rate_symbol = getCurrencySymbolandCRate(getProductBaseCurrency($col_fields['record_id'], $module));
                    $label_fld[] = $currencyField->getDisplayValue(null, true);
                    $label_fld["cursymb"] = $rate_symbol['symbol'];
                } else {
                    $currency_info = getInventoryCurrencyInfo($module, $col_fields['record_id']);
                    $label_fld[] = $currencyField->getDisplayValue(null, true);
                    $label_fld["cursymb"] = $currency_info['currency_symbol'];
                }
            } else {
                $label_fld[] = $currencyField->getDisplayValue();
                $label_fld["cursymb"] = $currencyField->getCurrencySymbol();
            }
        } elseif ($uitype == 75 || $uitype == 81) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $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;
        } elseif ($uitype == 76) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $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[] = getTranslatedString($fieldlabel, $module);
            $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[] = getTranslatedString($fieldlabel, $module);
            $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[] = getTranslatedString($fieldlabel, $module);
            $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 == 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[] = getTranslatedString($fieldlabel, $module);
            if ($col_fields[$fieldname]) {
                $reminder_str = $rem_days . '&nbsp;' . $mod_strings['LBL_DAYS'] . '&nbsp;' . $rem_hrs . '&nbsp;' . $mod_strings['LBL_HOURS'] . '&nbsp;' . $rem_min . '&nbsp;' . $mod_strings['LBL_MINUTES'] . '&nbsp;&nbsp;' . $mod_strings['LBL_BEFORE_EVENT'];
            }
            $label_fld[] = '&nbsp;' . $reminder_str;
        } elseif ($uitype == 98) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            if (is_admin($current_user)) {
                $label_fld[] = '<a href="index.php?module=Settings&action=RoleDetailView&roleid=' . $col_fields[$fieldname] . '">' . getRoleName($col_fields[$fieldname]) . '</a>';
            } else {
                $label_fld[] = getRoleName($col_fields[$fieldname]);
            }
        } elseif ($uitype == 85) {
            //Added for Skype by Minnie
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = $col_fields[$fieldname];
        } elseif ($uitype == 26) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $query = "select foldername from vtiger_attachmentsfolder where folderid = ?";
            $result = $adb->pquery($query, array($col_fields[$fieldname]));
            $folder_name = $adb->query_result($result, 0, "foldername");
            $label_fld[] = $folder_name;
        } elseif ($uitype == 27) {
            if ($col_fields[$fieldname] == 'I') {
                $label_fld[] = getTranslatedString($fieldlabel, $module);
                $label_fld[] = $mod_strings['LBL_INTERNAL'];
            } else {
                $label_fld[] = getTranslatedString($fieldlabel, $module);
                $label_fld[] = $mod_strings['LBL_EXTERNAL'];
            }
        } elseif ($uitype == 31) {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = $col_fields[$fieldname];
            $options = array();
            $themeList = get_themes();
            foreach ($themeList as $theme) {
                if ($current_user->theme == $theme) {
                    $selected = 'selected';
                } else {
                    $selected = '';
                }
                $options[] = array(getTranslatedString($theme), $theme, $selected);
            }
            $label_fld["options"] = $options;
        } elseif ($uitype == 32) {
            $options = array();
            $languageList = Vtiger_Language::getAll();
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            $label_fld[] = isset($languageList[$col_fields[$fieldname]]) ? $languageList[$col_fields[$fieldname]] : $col_fields[$fieldname];
            foreach ($languageList as $prefix => $label) {
                if ($current_user->language == $prefix) {
                    $selected = 'selected';
                } else {
                    $selected = '';
                }
                $options[] = array(getTranslatedString($label), $prefix, $selected);
            }
            $label_fld["options"] = $options;
        } else {
            $label_fld[] = getTranslatedString($fieldlabel, $module);
            if ($col_fields[$fieldname] == '0' && $fieldname != 'filedownloadcount' && $fieldname != 'filestatus' && $fieldname != 'filesize') {
                $col_fields[$fieldname] = '';
            }
            //code for Documents module :start
            if ($tabid == 8) {
                $downloadtype = $col_fields['filelocationtype'];
                if ($fieldname == 'filename') {
                    if ($downloadtype == 'I') {
                        //$file_value = $mod_strings['LBL_INTERNAL'];
                        $fld_value = $col_fields['filename'];
                        $ext_pos = strrpos($fld_value, ".");
                        $ext = substr($fld_value, $ext_pos + 1);
                        $ext = strtolower($ext);
                        if ($ext == 'bin' || $ext == 'exe' || $ext == 'rpm') {
                            $fileicon = "<img src='" . vtiger_imageurl('fExeBin.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>";
                        } elseif ($ext == 'jpg' || $ext == 'gif' || $ext == 'bmp') {
                            $fileicon = "<img src='" . vtiger_imageurl('fbImageFile.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>";
                        } elseif ($ext == 'txt' || $ext == 'doc' || $ext == 'xls') {
                            $fileicon = "<img src='" . vtiger_imageurl('fbTextFile.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>";
                        } elseif ($ext == 'zip' || $ext == 'gz' || $ext == 'rar') {
                            $fileicon = "<img src='" . vtiger_imageurl('fbZipFile.gif', $theme) . "' hspace='3' align='absmiddle'\tborder='0'>";
                        } else {
                            $fileicon = "<img src='" . vtiger_imageurl('fbUnknownFile.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>";
                        }
                    } else {
                        $fld_value = $col_fields['filename'];
                        $fileicon = "<img src='" . vtiger_imageurl('fbLink.gif', $theme) . "' alt='" . $mod_strings['LBL_EXTERNAL_LNK'] . "' title='" . $mod_strings['LBL_EXTERNAL_LNK'] . "' hspace='3' align='absmiddle' border='0'>";
                    }
                    $label_fld[] = $fileicon . $fld_value;
                }
                if ($fieldname == 'filesize') {
                    if ($col_fields['filelocationtype'] == 'I') {
                        $filesize = $col_fields[$fieldname];
                        if ($filesize < 1024) {
                            $label_fld[] = $filesize . ' B';
                        } elseif ($filesize > 1024 && $filesize < 1048576) {
                            $label_fld[] = round($filesize / 1024, 2) . ' KB';
                        } else {
                            if ($filesize > 1048576) {
                                $label_fld[] = round($filesize / (1024 * 1024), 2) . ' MB';
                            }
                        }
                    } else {
                        $label_fld[] = ' --';
                    }
                }
                if ($fieldname == 'filetype' && $col_fields['filelocationtype'] == 'E') {
                    $label_fld[] = ' --';
                }
                /* if($fieldname == 'filestatus')
                	  {
                	  $filestatus = $col_fields[$fieldname];
                	  if($filestatus == 0)
                	  $label_fld[]=$mod_strings['LBL_ACTIVE'];
                	  else
                	  $label_fld[]=$mod_strings['LBL_INACTIVE'];
                	  } */
            }
            //code for Documents module :end
            $label_fld[] = $col_fields[$fieldname];
        }
    }
    $label_fld[] = $uitype;
    //sets whether the currenct user is admin or not
    if (is_admin($current_user)) {
        $label_fld["isadmin"] = 1;
    } else {
        $label_fld["isadmin"] = 0;
    }
    $log->debug("Exiting getDetailViewOutputHtml method ...");
    return $label_fld;
}