<?php
class AOS_LogicHooks {
public function statusInvoicesChanges ($bean, $event, $arguments) {
if ($bean->status == 'Validated'){
$GLOBALS['log']->debug("Status has been changed");
}
}
}
?>
Check capital letter for value ‘Validated’ or ‘validated’
@p.konetskiy I try it and nothing happen. I think maybe the location of my logic hook and action class file is worng. i put it under the modules AOS_Invoices : /var/www/html/suitecrm/modules/AOS_Invoices
Sorry to get into the conversation. I think you have to learn and understand the basic logic-hook structure and implementation before you embark in doing your own hooks. As @crmspace and @p.konetskiy point out before, you should start by reading the documentation: https://docs.suitecrm.com/developer/logic-hooks/
@BrozTechnologies Thank for your help,
the problem was solved, i had to change the name of my hook file to “logic_hooks” and it works. special thank to @p.konetskiy and @crmspace
@p.konetskiy This is my logic hooks:
<?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[‘after_save’] = Array();
$hook_array[‘after_save’][] = Array(1, ‘status invoices Changes’, ‘custom/modules/AOS_Invoices/statusChange.php’,‘statusChange’, ‘statusInvoicesChanges’);
?>
my class :
<?php
class statusChange {
public function statusInvoicesChanges ($bean, $event, $arguments) {
// addition line:
$GLOBALS[‘log’]-> debug(get_class()." “. FUNCTION.” Status:\n ".print_r($bean->status,true));
if ($bean->status == ‘Validated’ && $bean->fetched_row->status <> $bean->status){
$GLOBALS[‘log’]-> debug(“Status has been changed”);
}
}
}
?>