【问题标题】:SugarCRM CE 6.5 Calculation Not workingSugarCRM CE 6.5 计算不起作用
【发布时间】:2013-11-01 02:04:11
【问题描述】:

需要帮助才能进行计算。我有以下代码

crm/custom/modules/Leads/logic_hooks.php

<?php
// Do not store anything in this file that is not part of the array or the hook     version.  This file will    
// be automatically rebuilt in the future. 

$hook_version = 1; 
$hook_array = Array(); 
// position, file, function 
$hook_array['before_save'] = Array(1,'Calculating field',    'custom/modules/Leads/custom_comm.php','calculate_field_class', 'calculate_field_function');  
$hook_array['before_save'] = Array(); 
$hook_array['before_save'][] = Array(1, 'Leads push feed', 'modules/Leads/SugarFeeds/LeadFeed.php','LeadFeed', 'pushFeed'); 
$hook_array['after_retrieve'] = Array(); 
$hook_array['after_retrieve'] = Array(1, 'calculating commission', 'custom/modules/Leads/custom_comm.php','calculate_field_class', 'calculate_field_function');
$hook_array['after_ui_frame'] = Array(); 



?>

crm/custom/modules/Leads/custom_comm.php

<?php
Class calculate_field_class
{
 function calculate_field_function()
  {
  $bean->commission_c = $bean->vehicle_gross_c / 2;
   }
}  
die("I got called")
?> 

这些根本不起作用。有什么建议。我打了所有的论坛并搜索了网络

【问题讨论】:

    标签: php logic crm sugarcrm


    【解决方案1】:

    您必须将 bean 对象、当前事件和任何参数传递给方法。另外,注意不要在逻辑钩子中重置数组。

    custom/modules/Leads/custom_comm.php

    <?php
        class calculate_field_class {
            public function calculate_field_function($bean, $event, $arguments) {
                $bean->commission_c = $bean->vehicle_gross_c / 2;
            }
        }
    ?>
    

    custom/modules/Leads/logic_hooks.php

    <?php
        $hook_version = 1;
        $hook_array = Array();
        // position, file, function
        $hook_array['before_save'] = Array();
        $hook_array['before_save'][] = Array(1, 'Calculating field', 'custom/modules/Leads/custom_comm.php', 'calculate_field_class', 'calculate_field_function');  
    ?>
    

    【讨论】:

    • 哦,好吧,所以只需添加公共,应该很好。我试试看
    • 是的,还是不行。不知道从这里去哪里
    • 不行,在你的方法中传入$bean, $event, $arguments,并密切关注logic_hooks.php中事物的结构。
    猜你喜欢
    • 1970-01-01
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多