Hi to all, i have a problem with a hook i’ve made.
in custom\modules\Projects i edited logic_hook
$hook_array = Array();
// position, file, function
$hook_array['after_save'] = Array();
$hook_array['after_save'][] = Array(1,'after_save update account name','custom/modules/Projects/update_account_name_class.php', 'update_account_name_class', 'after_save_method');
then in custom\modules\Projects i’ve created the class update_account_name_class
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class update_account_name_class
{
function after_save_method($bean, $event, $arguments)
{
$bean_projects=BeanFactory::getBean('Project',$bean->project_id);
$bean_projects->load_relationship('accounts');
$stringa_aziende ="";
foreach ($bean_projects->accounts->getBeans() as $account) {
file_put_contents('C:\SITI\delbarbaCRM\custom\modules\Projects\log3_.txt', print_r($account->name, true), FILE_APPEND);
$stringa_aziende .=$account->name.", ";
}
$bean->nome_azienda_c = substr($stringa_aziende,0,-2);
}
}
But nothing happend. i’ve tried to put a die() after function declaration, but still nothing happens. what i’m missing?
thanks all