egg... i'm sorry you weren't too confusing at all, i put my old code
. I did the changes like you said but nothing has happened.
I show you the code for logic_hooks.php
PHP Code:
<?php
$hook_array['before_save'][] =
Array(1,
'createLead',
'modules/Accounts/AccountHookHandler.php',
'AccountHookHandler',
'createLead');
?>
a the follow is the code for AccountHookHandler.php
PHP Code:
<?php
class AccountHookHandler {
function createLead(&$bean, $event, $arguments) {
//$bean->description = html_entity_decode($bean->description);
//$bean->fetched_row['description'] = $bean->description;
//check sugarcrm.log to see if this is getting called
$GLOBALS['log']->fatal("Executing AccountHookHandler...");
$client = new nusoapclient("http://localhost/sugarcrm/soap.php?wsdl", true);
$user_auth = array(
'user_auth' => array(
'user_name' => 'admin',
'password' => md5('admin')
));
$login_results = $client->call('login',$user_auth);
$session_id = $login_results['id'];
$user_guid = $soapclient->call('get_user_id',$session_id);
$set_entry_params = array(
'session' => $session_id,
'module_name' => 'Leads',
'name_value_list'=>array(
array('name'=>'first_name', 'value'=>'FEDEPHP'),
array('name'=>'last_name', 'value'=>'PIAPHP'),
array('name'=>'status', 'value'=>'New'),
array('name'=>'phone_work', 'value'=>'0880038383'),
array('name'=>'phone_fax', 'value'=>''),
array('name'=>'account_name', 'value'=>''),
array('name'=>'lead_source','value'=>'Web Site'),
array('name'=>'description', 'value'=>'PROBANDO INSERCION DESDE PHP'),
array('name'=>'assigned_user_id','value'=>$user_guid)));
$result = $soapclient->call('set_entry',$set_entry_params);
}
}
?>
it still doesn't work and the log doesn't report anything. Any idea?
Bye thanks!!
Bookmarks