本文整理汇总了PHP中CRMEntity::dbvalues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRMEntity::dbvalues方法的具体用法?PHP CRMEntity::dbvalues怎么用?PHP CRMEntity::dbvalues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRMEntity
的用法示例。
在下文中一共展示了CRMEntity::dbvalues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adjustCurrencyField
/** Function to retrieve maximum decimal values of currency field on save
* @param $fieldname currency field name
* @param $fldvalue currency value they want to save
* @returns field value from database with maximum decimals if it is the same as value being saved
*/
function adjustCurrencyField($fieldname, $fldvalue, $tabid)
{
global $adb, $log, $current_user;
$log->debug("Entering adjustCurrencyField({$fieldname},{$fldvalue})");
if (isset(self::$dbvalues[$fieldname])) {
$dbvalue = self::$dbvalues[$fieldname];
} else {
$dbvals = $result = array();
foreach ($this->tab_name_index as $table_name => $index) {
$result = $adb->pquery("select * from {$table_name} where {$index}=?", array($this->id));
$flds = $adb->fetch_array($result);
$dbvals = array_merge($dbvals, $flds);
}
self::$dbvalues = $dbvals;
$dbvalue = self::$dbvalues[$fieldname];
$fldrs = $adb->pquery('select fieldname,typeofdata from vtiger_field
where vtiger_field.uitype in (7,9,71,72) and vtiger_field.tabid=?', array($tabid));
while ($fldinf = $adb->fetch_array($fldrs)) {
self::$todvalues[$fldinf['fieldname']] = $fldinf['typeofdata'];
}
}
$typeofdata = self::$todvalues[$fieldname];
$decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
if (round($dbvalue, min($decimals, $current_user->no_of_currency_decimals)) == $fldvalue) {
$fldvalue = $dbvalue;
}
$log->debug("Exiting adjustCurrencyField ({$fldvalue})");
return $fldvalue;
}