Merge pull request #3134 from atm-alexis/NEW_add_hook_in_sendmail

NEW add hook in send mail
This commit is contained in:
Laurent Destailleur 2015-07-11 20:46:01 +02:00
commit c83cb730fc

View File

@ -366,7 +366,7 @@ class CMailFile
*/
function sendfile()
{
global $conf;
global $conf,$db;
$errorlevel=error_reporting();
error_reporting($errorlevel ^ E_WARNING); // Desactive warnings
@ -375,6 +375,20 @@ class CMailFile
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS))
{
dol_include_once('/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('maildao'));
$reshook=$hookmanager->executeHooks('doactions',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (!empty($reshook))
{
$this->error="Error in hook maildao doactions ".$reshook;
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
return $reshook;
}
// Action according to choosed sending method
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
{