我正在使用SugarCRM 6.5.20 CE
问题:添加' $'在包含货币的字段之前签名。
解决方案:$this->bean->final_sale_amount_c = '$' . $this->bean->final_sale_amount_c;
此解决方案适用于所有文本字段。它会改变' 75.00'至' $ 75.00'但是在恰好是货币字段的字段上,DetailView上的输出只是' 0.00'。
我还注意到<span>
等级等于&#39; sugar_field&#39;除了没有等级的货币领域之外的所有东西。
我做了
var_dump($this->bean->final_sale_amount_c);
回来了:
string(12)&#34; 75000.000000&#34;
除final_sale_amount_c
,initial_deposit_c
和amount
以外的所有字段均可正常使用。
以下完整代码:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/MVC/View/views/view.detail.php');
require_once('custom/include/utilities.php');
class OpportunitiesViewDetail extends ViewDetail {
// function displaySubPanels() {
// return '';
// }
function display(){
var_dump($this->bean->final_sale_amount_c);
$this->bean->initial_deposit_c = '$' . $this->bean->initial_deposit_c;
$this->bean->fees_escrowed_c = '$' . $this->bean->fees_escrowed_c;
$this->bean->amount = '$' . $this->bean->amount;
$this->bean->final_sale_amount_c = '$' . $this->bean->final_sale_amount_c;
$this->bean->a_deposit_c = ($this->bean->a_deposit_c * 100) . '%';
$this->bean->b_deposit_c = ($this->bean->b_deposit_c * 100) . '%';
$this->bean->c_deposit_c = ($this->bean->c_deposit_c * 100) . '%';
$this->bean->a_quarterly_hosting_fees_c = '$' . $this->bean->a_quarterly_hosting_fees_c;
$this->bean->b_quarterly_hosting_fees_c = '$' . $this->bean->b_quarterly_hosting_fees_c;
$this->bean->c_quarterly_hosting_fees_c = '$' . $this->bean->c_quarterly_hosting_fees_c;
$js = <<<JS
<script src="custom/include/javascript/js.cookie.js?version=1" type="text/javascript"></script>
<script src="custom/include/javascript/utilities.js" type="text/javascript"></script>
<script type="text/javascript">
var \$ = jQuery.noConflict();
</script>
JS;
parent::display();
echo $js;
}
}
?>
答案 0 :(得分:1)
您还可以选择在详细信息视图中显示自定义字段:
让我们考虑您的自定义模块detailviewdefs.php如下:
'panels' =>
array (
'default' =>
array (
0 =>
array (
0 => 'name',
1 =>
array (
'name' => 'status',
'studio' => 'visible',
'label' => 'LBL_STATUS',
'customCode' => '{$custom_value}',
),
),
1 =>
现在分配自定义值如下:
文件路径:custom / modules / YOUR_MODULE / view.detail.php
function display(){
$this->dv->process();
$this->ss->assign('custom_value', '$'.$this->bean->amount);
echo $this->dv->display();
}
答案 1 :(得分:0)
我最后只使用了jquery。
$js = <<<JS
<script src="custom/include/javascript/js.cookie.js?version=1" type="text/javascript"></script>
<script src="custom/include/javascript/utilities.js" type="text/javascript"></script>
<script type="text/javascript">
$("#final_sale_amount_c").prepend("$ ");
</script>
JS;
parent::display();
echo $js;