1

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

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")
?> 

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

4

1 回答 1

1

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

自定义/模块/潜在客户/custom_comm.php

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

自定义/模块/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');  
?>
于 2013-11-01T04:09:21.367 回答