本文整理汇总了PHP中getProductBaseCurrency函数的典型用法代码示例。如果您正苦于以下问题:PHP getProductBaseCurrency函数的具体用法?PHP getProductBaseCurrency怎么用?PHP getProductBaseCurrency使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getProductBaseCurrency函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
$saveimage = isset($_REQUEST['saveimage']) ? vtlib_purify($_REQUEST['saveimage']) : "false";
$errormessage = isset($_REQUEST['error_msg']) ? vtlib_purify($_REQUEST['error_msg']) : "false";
$image_error = isset($_REQUEST['image_error']) ? vtlib_purify($_REQUEST['image_error']) : "false";
$smarty = new vtigerCRM_Smarty();
$category = getParentTab($currentModule);
$record = $_REQUEST['record'];
$isduplicate = vtlib_purify($_REQUEST['isDuplicate']);
//added to fix the issue4600
$searchurl = getBasic_Advance_SearchURL();
$smarty->assign("SEARCH", $searchurl);
//4600 ends
if ($record) {
$focus->id = $record;
$focus->mode = 'edit';
$focus->retrieve_entity_info($record, $currentModule);
$product_base_currency = getProductBaseCurrency($focus->id, $currentModule);
} else {
$product_base_currency = fetchCurrency($current_user->id);
}
if ($image_error == "true") {
$explode_decode_val = explode("&", $decode_val);
for ($i = 1; $i < count($explode_decode_val); $i++) {
$test = $explode_decode_val[$i];
$values = explode("=", $test);
$field_name_val = $values[0];
$field_value = $values[1];
$focus->column_fields[$field_name_val] = $field_value;
}
}
if ($isduplicate == 'true') {
$focus->id = '';
示例2: getValue
//.........这里部分代码省略.........
$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 {
示例3: getPriceDetailsForProduct
/** Function used to get all the price details for different currencies which are associated to the given product
* @param int $productid - product id to which we want to get all the associated prices
* @param decimal $unit_price - Unit price of the product
* @param string $available - available or available_associated where as default is available, if available then the prices in the currencies which are available now will be returned, otherwise if the value is available_associated then prices of all the associated currencies will be retruned
* @return array $price_details - price details as a array with productid, curid, curname
*/
function getPriceDetailsForProduct($productid, $unit_price, $available = 'available', $itemtype = 'Products')
{
global $log, $adb;
$log->debug("Entering into function getPriceDetailsForProduct({$productid})");
if ($productid != '') {
$product_currency_id = getProductBaseCurrency($productid, $itemtype);
$product_base_conv_rate = getBaseConversionRateForProduct($productid, 'edit', $itemtype);
// Detail View
if ($available == 'available_associated') {
$query = "select vtiger_currency_info.*, vtiger_productcurrencyrel.converted_price, vtiger_productcurrencyrel.actual_price\n\t\t\t\t\tfrom vtiger_currency_info\n\t\t\t\t\tinner join vtiger_productcurrencyrel on vtiger_currency_info.id = vtiger_productcurrencyrel.currencyid\n\t\t\t\t\twhere vtiger_currency_info.currency_status = 'Active' and vtiger_currency_info.deleted=0\n\t\t\t\t\tand vtiger_productcurrencyrel.productid = ? and vtiger_currency_info.id != ?";
$params = array($productid, $product_currency_id);
} else {
// Edit View
$query = "select vtiger_currency_info.*, vtiger_productcurrencyrel.converted_price, vtiger_productcurrencyrel.actual_price\n\t\t\t\t\tfrom vtiger_currency_info\n\t\t\t\t\tleft join vtiger_productcurrencyrel\n\t\t\t\t\ton vtiger_currency_info.id = vtiger_productcurrencyrel.currencyid and vtiger_productcurrencyrel.productid = ?\n\t\t\t\t\twhere vtiger_currency_info.currency_status = 'Active' and vtiger_currency_info.deleted=0";
$params = array($productid);
}
//Postgres 8 fixes
if ($adb->dbType == "pgsql") {
$query = fixPostgresQuery($query, $log, 0);
}
$res = $adb->pquery($query, $params);
for ($i = 0; $i < $adb->num_rows($res); $i++) {
$price_details[$i]['productid'] = $productid;
$price_details[$i]['currencylabel'] = $adb->query_result($res, $i, 'currency_name');
$price_details[$i]['currencycode'] = $adb->query_result($res, $i, 'currency_code');
$price_details[$i]['currencysymbol'] = $adb->query_result($res, $i, 'currency_symbol');
$currency_id = $adb->query_result($res, $i, 'id');
$price_details[$i]['curid'] = $currency_id;
$price_details[$i]['curname'] = 'curname' . $adb->query_result($res, $i, 'id');
$cur_value = $adb->query_result($res, $i, 'actual_price');
// Get the conversion rate for the given currency, get the conversion rate of the product currency to base currency.
// Both together will be the actual conversion rate for the given currency.
$conversion_rate = $adb->query_result($res, $i, 'conversion_rate');
$actual_conversion_rate = $product_base_conv_rate * $conversion_rate;
if ($cur_value == null || $cur_value == '') {
$price_details[$i]['check_value'] = false;
if ($unit_price != null) {
$cur_value = convertFromMasterCurrency($unit_price, $actual_conversion_rate);
} else {
$cur_value = '0';
}
} else {
$price_details[$i]['check_value'] = true;
}
$price_details[$i]['curvalue'] = CurrencyField::convertToUserFormat($cur_value, null, true);
$price_details[$i]['conversionrate'] = $actual_conversion_rate;
$is_basecurrency = false;
if ($currency_id == $product_currency_id) {
$is_basecurrency = true;
}
$price_details[$i]['is_basecurrency'] = $is_basecurrency;
}
} else {
if ($available == 'available') {
// Create View
global $current_user;
$user_currency_id = fetchCurrency($current_user->id);
$query = "select vtiger_currency_info.* from vtiger_currency_info\n\t\t\t\t\twhere vtiger_currency_info.currency_status = 'Active' and vtiger_currency_info.deleted=0";
$params = array();
$res = $adb->pquery($query, $params);
for ($i = 0; $i < $adb->num_rows($res); $i++) {
$price_details[$i]['currencylabel'] = $adb->query_result($res, $i, 'currency_name');
$price_details[$i]['currencycode'] = $adb->query_result($res, $i, 'currency_code');
$price_details[$i]['currencysymbol'] = $adb->query_result($res, $i, 'currency_symbol');
$currency_id = $adb->query_result($res, $i, 'id');
$price_details[$i]['curid'] = $currency_id;
$price_details[$i]['curname'] = 'curname' . $adb->query_result($res, $i, 'id');
// Get the conversion rate for the given currency, get the conversion rate of the product currency(logged in user's currency) to base currency.
// Both together will be the actual conversion rate for the given currency.
$conversion_rate = $adb->query_result($res, $i, 'conversion_rate');
$user_cursym_convrate = getCurrencySymbolandCRate($user_currency_id);
$product_base_conv_rate = 1 / $user_cursym_convrate['rate'];
$actual_conversion_rate = $product_base_conv_rate * $conversion_rate;
$price_details[$i]['check_value'] = false;
$price_details[$i]['curvalue'] = '0';
$price_details[$i]['conversionrate'] = $actual_conversion_rate;
$is_basecurrency = false;
if ($currency_id == $user_currency_id) {
$is_basecurrency = true;
}
$price_details[$i]['is_basecurrency'] = $is_basecurrency;
}
} else {
$log->debug("Product id is empty. we cannot retrieve the associated prices.");
}
}
$log->debug("Exit from function getPriceDetailsForProduct({$productid})");
return $price_details;
}
示例4: getListViewRecords
//.........这里部分代码省略.........
if ($fieldName == 'due_date') {
$timeField = 'time_end';
}
}
$timeFieldValue = $this->db->query_result($result, $i, $timeField);
if (!empty($timeFieldValue)) {
$value .= ' ' . $timeFieldValue;
//TO make sure it takes time value as well
$fieldDataType = 'datetime';
}
}
if ($fieldDataType == 'datetime') {
$value = Vtiger_Datetime_UIType::getDateTimeValue($value);
} else {
if ($fieldDataType == 'date') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
}
}
} elseif ($value == '0000-00-00') {
$value = '';
}
} elseif ($field->getFieldDataType() == 'time') {
if (!empty($value)) {
$userModel = Users_Privileges_Model::getCurrentUserModel();
if ($userModel->get('hour_format') == '12') {
$value = Vtiger_Time_UIType::getTimeValueInAMorPM($value);
}
}
} elseif ($field->getFieldDataType() == 'currency') {
if ($value != '') {
if ($field->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $module);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($module, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$value = CurrencyField::convertToUserFormat($value, null, true);
$row['currencySymbol'] = $currencySymbol;
$value = CurrencyField::appendCurrencySymbol($value, $currencySymbol);
} else {
if (!empty($value)) {
$value = CurrencyField::convertToUserFormat($value);
$currencyModal = new CurrencyField($value);
$currencyModal->initialize();
$value = $currencyModal->appendCurrencySymbol($value, $currencyModal->currencySymbol);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $rawValue, $matches);
if (!empty($matches[0])) {
$value = '<a class="urlField cursorPointer" title="' . $rawValue . '" href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
} else {
$value = '<a class="urlField cursorPointer" title="' . $rawValue . '" href="http://' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'email') {
$current_user = vglobal('current_user');
if ($current_user->internal_mailer == 1) {
//check added for email link in user detailview
$value = "<a class='emailField' onclick=\"Vtiger_Helper_Js.getInternalMailer({$recordId}," . "'{$fieldName}','{$module}');\">" . textlength_check($value) . "</a>";
} else {
示例5: getListViewEntries
//.........这里部分代码省略.........
$downloadType = $db->query_result($result, $i, 'filelocationtype');
if ($downloadType == 'E' || $downloadType != 'I') {
$value = '--';
}
} elseif ($field->getUIType() == '27') {
if ($value == 'I') {
$value = getTranslatedString('LBL_INTERNAL', $module);
} elseif ($value == 'E') {
$value = getTranslatedString('LBL_EXTERNAL', $module);
} else {
$value = ' --';
}
} elseif ($field->getFieldDataType() == 'picklist') {
if ($value != '' && !$is_admin && $this->picklistRoleMap[$fieldName] && !in_array($value, $this->picklistValueMap[$fieldName])) {
$value = "<font color='red'>" . getTranslatedString('LBL_NOT_ACCESSIBLE', $module) . "</font>";
} else {
$value = getTranslatedString($value, $module);
$value = textlength_check($value);
}
} elseif ($field->getFieldDataType() == 'date' || $field->getFieldDataType() == 'datetime') {
if ($value != '' && $value != '0000-00-00') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
if ($field->getFieldDataType() == 'datetime') {
$value .= ' ' . $date->getDisplayTime();
}
} elseif ($value == '0000-00-00') {
$value = '';
}
} elseif ($field->getFieldDataType() == 'currency') {
if ($value != '') {
if ($field->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $module);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($module, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$value = number_format($value, 2, '.', '');
$currencyValue = CurrencyField::convertToUserFormat($value, null, true);
$value = CurrencyField::appendCurrencySymbol($currencyValue, $currencySymbol);
} else {
//changes made to remove vtiger_currency symbol infront of each
//vtiger_potential amount
if ($value != 0) {
$value = CurrencyField::convertToUserFormat($value);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $rawValue, $matches);
if (!empty($matches[0])) {
$value = '<a href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
} else {
$value = '<a href="http://' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'email') {
if ($_SESSION['internal_mailer'] == 1) {
//check added for email link in user detailview
$fieldId = $field->getFieldId();
$value = "<a href=\"javascript:InternalMailer({$recordId},{$fieldId}," . "'{$fieldName}','{$module}','record_id');\">" . textlength_check($value) . "</a>";
} else {
$value = '<a href="mailto:' . $rawValue . '">' . textlength_check($value) . '</a>';
示例6: getDetailViewDisplayValue
/**
* Function that converts the Number into Users Currency along with currency symbol
* @param Users $user
* @param Boolean $skipConversion
* @return Formatted Currency
*/
public function getDetailViewDisplayValue($value, $recordId, $uiType)
{
$currencyModal = new CurrencyField($value);
$currencyModal->initialize();
if ($uiType == '72' && $recordId) {
$moduleName = $this->get('field')->getModuleName();
if ($this->get('field')->getName() == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $moduleName);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($moduleName, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
} else {
$currencySymbol = $currencyModal->currencySymbol;
}
return $currencyModal->appendCurrencySymbol($value, $currencySymbol);
}
示例7: getOutputHtml
//.........这里部分代码省略.........
$editview_label[2] = array();
if (vtlib_isModuleActive('Accounts')) {
array_push($editview_label[0], $app_strings['COMBO_ACCOUNTS']);
array_push($editview_label[1], $account_selected);
array_push($editview_label[2], "Accounts");
}
if (vtlib_isModuleActive('Contacts')) {
array_push($editview_label[0], $app_strings['COMBO_CONTACTS']);
array_push($editview_label[1], $contact_selected);
array_push($editview_label[2], "Contacts");
}
$fieldvalue[] = $parent_name;
$fieldvalue[] = $value;
} elseif ($uitype == 9 || $uitype == 7) {
$editview_label[] = getTranslatedString($fieldlabel, $module_name);
$fldrs = $adb->pquery('select typeofdata from vtiger_field
where vtiger_field.fieldname=? and vtiger_field.tabid=?', array($fieldname, getTabid($module_name)));
$typeofdata = $adb->query_result($fldrs, 0, 0);
$typeinfo = explode('~', $typeofdata);
if ($typeinfo[0] == 'I') {
$fieldvalue[] = $value;
} else {
$currencyField = new CurrencyField($value);
$decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
$currencyField->initialize($current_user);
$currencyField->setNumberofDecimals(min($decimals, $currencyField->getCurrencyDecimalPlaces()));
$fieldvalue[] = $currencyField->getDisplayValue(null, false, true);
}
} elseif ($uitype == 71 || $uitype == 72) {
$currencyField = new CurrencyField($value);
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($col_fields['record_id'] != '' && $uitype == 72) {
if ($fieldname == 'unit_price') {
$rate_symbol = getCurrencySymbolandCRate(getProductBaseCurrency($col_fields['record_id'], $module_name));
$currencySymbol = $rate_symbol['symbol'];
} else {
$currency_info = getInventoryCurrencyInfo($module, $col_fields['record_id']);
$currencySymbol = $currency_info['currency_symbol'];
}
$fieldvalue[] = $currencyField->getDisplayValue(null, true);
} else {
$decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
$currencyField->initialize($current_user);
$currencyField->setNumberofDecimals(min($decimals, $currencyField->getCurrencyDecimalPlaces()));
$fieldvalue[] = $currencyField->getDisplayValue(null, false, true);
$currencySymbol = $currencyField->getCurrencySymbol();
}
$editview_label[] = getTranslatedString($fieldlabel, $module_name) . ': (' . $currencySymbol . ')';
} elseif ($uitype == 75 || $uitype == 81) {
if ($value != '') {
$vendor_name = getVendorName($value);
} elseif (isset($_REQUEST['vendor_id']) && $_REQUEST['vendor_id'] != '') {
$value = $_REQUEST['vendor_id'];
$vendor_name = getVendorName($value);
}
$pop_type = 'specific';
if ($uitype == 81) {
$pop_type = 'specific_vendor_address';
}
$editview_label[] = getTranslatedString($fieldlabel, $module_name);
$fieldvalue[] = $vendor_name;
$fieldvalue[] = $value;
} elseif ($uitype == 76) {
if ($value != '') {
$potential_name = getPotentialName($value);
} elseif (isset($_REQUEST['potential_id']) && $_REQUEST['potential_id'] != '') {
示例8: getListViewRecords
//.........这里部分代码省略.........
if ($fieldName == 'date_start') {
$timeField = 'time_start';
} else {
if ($fieldName == 'due_date') {
$timeField = 'time_end';
}
}
$timeFieldValue = $this->db->query_result($result, $i, $timeField);
if (!empty($timeFieldValue)) {
$value .= ' ' . $timeFieldValue;
//TO make sure it takes time value as well
$fieldDataType = 'datetime';
}
}
if ($fieldDataType == 'datetime') {
$value = Vtiger_Datetime_UIType::getDateTimeValue($value);
} else {
if ($fieldDataType == 'date') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
}
}
} elseif ($value == '0000-00-00') {
$value = '';
}
} elseif ($field->getFieldDataType() == 'time') {
if (!empty($value)) {
$value = Vtiger_Time_UIType::getTimeValueInAMorPM($value);
}
} elseif ($field->getFieldDataType() == 'currency') {
if ($value != '') {
if ($field->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $module);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($module, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$value = CurrencyField::convertToUserFormat($value, null, true);
$row['currencySymbol'] = $currencySymbol;
// $value = CurrencyField::appendCurrencySymbol($currencyValue, $currencySymbol);
} else {
if (!empty($value)) {
$value = CurrencyField::convertToUserFormat($value);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $rawValue, $matches);
if (!empty($matches[0])) {
$value = '<a class="urlField cursorPointer" href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
} else {
$value = '<a class="urlField cursorPointer" href="http://' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'email') {
global $current_user;
if ($current_user->internal_mailer == 1) {
//check added for email link in user detailview
$value = "<a class='emailField' onclick=\"Vtiger_Helper_Js.getInternalMailer({$recordId}," . "'{$fieldName}');\">" . textlength_check($value) . "</a>";
} else {
$value = '<a class="emailField" href="mailto:' . $rawValue . '">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'boolean') {
示例9: getListViewEntries
//.........这里部分代码省略.........
$downloadType = $db->query_result($result, $i, 'filelocationtype');
if ($downloadType == 'E' || $downloadType != 'I') {
$value = '--';
}
} elseif ($field->getUIType() == '27') {
if ($value == 'I') {
$value = getTranslatedString('LBL_INTERNAL', $module);
} elseif ($value == 'E') {
$value = getTranslatedString('LBL_EXTERNAL', $module);
} else {
$value = ' --';
}
} elseif ($field->getFieldDataType() == 'picklist') {
if ($value != '' && !$is_admin && $this->picklistRoleMap[$fieldName] && !in_array($value, $this->picklistValueMap[$fieldName])) {
$value = "<font color='red'>" . getTranslatedString('LBL_NOT_ACCESSIBLE', $module) . "</font>";
} else {
$value = getTranslatedString($value, $module);
$value = textlength_check($value);
}
} elseif ($field->getFieldDataType() == 'date' || $field->getFieldDataType() == 'datetime') {
if ($value != '' && $value != '0000-00-00') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
if ($field->getFieldDataType() == 'datetime') {
$value .= ' ' . $date->getDisplayTime();
}
} elseif ($value == '0000-00-00') {
$value = '';
}
} elseif ($field->getFieldDataType() == 'currency') {
if ($value != '') {
if ($field->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $module);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($module, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$value = number_format($value, 2, '.', '');
$currencyValue = CurrencyField::convertToUserFormat($value, null, true);
$value = CurrencyField::appendCurrencySymbol($currencyValue, $currencySymbol);
} else {
//changes made to remove vtiger_currency symbol in front of each potential amount
if ($value != 0) {
$value = CurrencyField::convertToUserFormat($value);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $rawValue, $matches);
if (!empty($matches[0])) {
$value = '<a href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
} else {
$value = '<a href="http://' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'email') {
if ($_SESSION['internal_mailer'] == 1) {
//check added for email link in user detailview
$fieldId = $field->getFieldId();
$value = "<a href=\"javascript:InternalMailer({$recordId},{$fieldId}," . "'{$fieldName}','{$module}','record_id');\">" . textlength_check($value) . "</a>";
} else {
$value = '<a href="mailto:' . $rawValue . '">' . textlength_check($value) . '</a>';
}
示例10: getBaseCurrencyDetails
/**
* Function to get base currency details
* @return <Array>
*/
public function getBaseCurrencyDetails()
{
$baseCurrencyDetails = $this->get('baseCurrencyDetails');
if (!empty($baseCurrencyDetails)) {
return $baseCurrencyDetails;
}
$recordId = $this->getId();
if (!empty($recordId)) {
$baseCurrency = getProductBaseCurrency($recordId, $this->getModuleName());
} else {
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$baseCurrency = fetchCurrency($currentUserModel->getId());
}
$baseCurrencyDetails = array('currencyid' => $baseCurrency);
$baseCurrencySymbolDetails = getCurrencySymbolandCRate($baseCurrency);
$baseCurrencyDetails = array_merge($baseCurrencyDetails, $baseCurrencySymbolDetails);
$this->set('baseCurrencyDetails', $baseCurrencyDetails);
return $baseCurrencyDetails;
}
示例11: getFieldDisplayValue
function getFieldDisplayValue($moduleName, $recordId, $fieldInstance, $value)
{
global $current_user;
$adb = PearDatabase::getInstance();
$fieldName = $fieldInstance->getFieldName();
$uitype = $fieldInstance->getUIType();
if ($moduleName == 'Documents') {
if ($fieldName == 'filesize') {
$filesize = $value;
if (empty($fieldsize)) {
$value = '--';
} elseif ($filesize < 1024) {
$value = $filesize . ' B';
} elseif ($filesize > 1024 && $filesize < 1048576) {
$value = round($filesize / 1024, 2) . ' KB';
} else {
if ($filesize > 1048576) {
$value = round($filesize / (1024 * 1024), 2) . ' MB';
}
}
}
if ($fieldName == 'filestatus') {
if ($value == 1) {
$value = getTranslatedString('yes', $moduleName);
} elseif ($value == 0) {
$value = getTranslatedString('no', $moduleName);
} else {
$value = '--';
}
}
if ($fieldName == 'filetype') {
if ($value == 1) {
$value = getTranslatedString('yes', $moduleName);
} elseif ($value == 0) {
$value = getTranslatedString('no', $moduleName);
} else {
$value = '--';
}
}
}
if ($fieldInstance->getUIType() == '27') {
if ($value == 'I') {
$value = getTranslatedString('LBL_INTERNAL', $moduleName);
} elseif ($value == 'E') {
$value = getTranslatedString('LBL_EXTERNAL', $moduleName);
} else {
$value = ' --';
}
}
if ($fieldInstance->getFieldDataType() == 'picklist') {
$isRoleBased = vtws_isRoleBasedPicklist($fieldName);
if ($isRoleBased && ($fieldName != 'activitytype' || $value != 'Task')) {
$accessiblePicklistValues = getAssignedPicklistValues($fieldName, $current_user->roleid, $adb);
if (!empty($value) && !is_admin($current_user) && !in_array($value, $accessiblePicklistValues)) {
$value = "<font color='red'>" . getTranslatedString('LBL_NOT_ACCESSIBLE', $moduleName) . "</font>";
} else {
$value = getTranslatedString($value, $moduleName);
}
} else {
$value = getTranslatedString($value, $moduleName);
}
}
if ($fieldInstance->getFieldDataType() == 'date' || $fieldInstance->getFieldDataType() == 'datetime' || $fieldInstance->getFieldDataType() == 'time') {
if ($value != '' && $value != '0000-00-00') {
$date = new DateTimeField($value);
if ($fieldInstance->getFieldDataType() == 'date') {
$value = $date->getDisplayDate();
}
if ($fieldInstance->getFieldDataType() == 'datetime') {
$value = $date->getDisplayDateTimeValue();
}
if ($fieldInstance->getFieldDataType() == 'time') {
$value = $date->getDisplayTime();
}
} else {
$value = '';
}
}
if ($fieldInstance->getFieldDataType() == 'currency') {
if ($value != '' && $value != 0) {
if ($fieldInstance->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $moduleName);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($moduleName, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$currencyValue = CurrencyField::convertToUserFormat($value, null, true);
$value = CurrencyField::appendCurrencySymbol($currencyValue, $currencySymbol);
} else {
$currencyField = new CurrencyField($value);
$value = $currencyField->getDisplayValueWithSymbol();
}
}
}
if ($fieldInstance->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $value, $matches);
//.........这里部分代码省略.........
示例12: getDetailViewOutputHtml
//.........这里部分代码省略.........
$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];