Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 逻辑钩子仅在$bean->;状态变化_Php_Hook_Sugarcrm_Suitecrm - Fatal编程技术网

Php 逻辑钩子仅在$bean->;状态变化

Php 逻辑钩子仅在$bean->;状态变化,php,hook,sugarcrm,suitecrm,Php,Hook,Sugarcrm,Suitecrm,我想实现一个Sugar逻辑钩子,当发票状态更改为“已验证”时触发该钩子。 这是我的逻辑钩: <?php $hook_version = 1; $hook_array = Array(); $hook_array['after_save'] = Array(); $hook_array['after_save'][] = Array(1, 'status invoices Changes', '/var/www/html/suitecrm/modules/AOS_Invoices/AO

我想实现一个Sugar逻辑钩子,当发票状态更改为“已验证”时触发该钩子。
这是我的逻辑钩:

<?php
$hook_version = 1; 
$hook_array = Array(); 
$hook_array['after_save'] = Array(); 
$hook_array['after_save'][] = Array(1, 'status invoices Changes', '/var/www/html/suitecrm/modules/AOS_Invoices/AOS_LogicHooks.php','AOS_LogicHooks', 'statusInvoicesChanges'); 
?>


这是我的动作课:
<?php class AOS_LogicHooks {
 public function statusInvoicesChanges (SugarBean $bean, $event, $arguments){
if($bean->status == 'Validated' && $bean->fetched_row->status <> $bean->status){ 
$GLOBALS['log']->fatal("Status has been changed");
}}}
?>  



我遗漏了什么?

我们都犯了一个简单的错误,获取的行是一个数组,因此您无法作为属性访问内容

我刚刚测试过,效果很好!看一看:

<?php 

class AOS_LogicHooks
{
  public function statusInvoicesChanges(SugarBean $bean, $event, $arguments)
  {
    if ($bean->status == 'Validated' && !empty($bean->fetched_row) && $bean->fetched_row['status'] <> $bean->status) {
      $GLOBALS['log']->fatal("Status has been changed");
    }
  }
}

我知道,但我还没有15个名声:)