Dall'omonimo post del forum di SugarCRM after_save hook and email addresses
Comportamento segnalato come bug 46029
ho risolto modificando cosi' il file /include/SugarObjects/templates/person/Person.php:
function save($check_notify=false)
{
$this->add_address_streets('primary_address_street');
$this->add_address_streets('alt_address_street');
$ori_in_workflow = empty($this->in_workflow) ? false : true;
$this->emailAddress->handleLegacySave($this, $this->module_dir);
// Move from here
// parent::save($check_notify);
$override_email = array();
if(!empty($this->email1_set_in_workflow))
{
$override_email['emailAddress0'] = $this->email1_set_in_workflow;
}
if(!empty($this->email2_set_in_workflow))
{
$override_email['emailAddress1'] = $this->email2_set_in_workflow;
}
if(!isset($this->in_workflow))
{
$this->in_workflow = false;
}
// To here
parent::save($check_notify);
if($ori_in_workflow === false || !empty($override_email))
{
$this->emailAddress->save($this->id, $this->module_dir, $override_email,'','','','',$this->in_workflow);
}
return $this->id;
}
e tutto funziona cosi' come ci si aspetta