Hook 'maildao' was renamed into 'mail' into the method sendfile that
send emails, and method was renamed from 'doaction' into 'sendMail'. To process task #4875 #7969 in several steps.
This commit is contained in:
parent
12aec8f806
commit
833c7685e1
10
ChangeLog
10
ChangeLog
@ -2,6 +2,16 @@
|
|||||||
English Dolibarr ChangeLog
|
English Dolibarr ChangeLog
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 8.0.0 compared to 7.0.0 *****
|
||||||
|
|
||||||
|
WARNING:
|
||||||
|
|
||||||
|
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||||
|
* Hook 'maildao' was renamed into 'mail' into the method sendfile that send emails, and method was renamed from
|
||||||
|
'doaction' into 'sendMail'.
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 7.0.0 compared to 6.0.5 *****
|
***** ChangeLog for 7.0.0 compared to 6.0.5 *****
|
||||||
For users:
|
For users:
|
||||||
NEW: When payment is registered, PDF of invoices are also regenerated so payments
|
NEW: When payment is registered, PDF of invoices are also regenerated so payments
|
||||||
|
|||||||
@ -106,7 +106,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
|
|
||||||
$subject='';$actionmsg='';$actionmsg2='';
|
$subject='';$actionmsg='';$actionmsg2='';
|
||||||
|
|
||||||
if (! empty($conf->dolimail->enabled)) $langs->load("dolimail@dolimail");
|
|
||||||
$langs->load('mails');
|
$langs->load('mails');
|
||||||
|
|
||||||
if (is_object($object))
|
if (is_object($object))
|
||||||
@ -321,6 +320,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
|
|
||||||
|
|
||||||
// Feature to push mail sent into Sent folder
|
// Feature to push mail sent into Sent folder
|
||||||
|
/* This code must be now included into the hook mail, method sendMailAfter
|
||||||
if (! empty($conf->dolimail->enabled))
|
if (! empty($conf->dolimail->enabled))
|
||||||
{
|
{
|
||||||
$mailfromid = explode("#", $_POST['frommail'],3); // $_POST['frommail'] = 'aaa#Sent# <aaa@aaa.com>' // TODO Use a better way to define Sent dir.
|
$mailfromid = explode("#", $_POST['frommail'],3); // $_POST['frommail'] = 'aaa#Sent# <aaa@aaa.com>' // TODO Use a better way to define Sent dir.
|
||||||
@ -329,7 +329,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
{
|
{
|
||||||
$mbid = $mailfromid[1];
|
$mbid = $mailfromid[1];
|
||||||
|
|
||||||
/*IMAP Postbox*/
|
// IMAP Postbox
|
||||||
$mailboxconfig = new IMAP($db);
|
$mailboxconfig = new IMAP($db);
|
||||||
$mailboxconfig->fetch($mbid);
|
$mailboxconfig->fetch($mbid);
|
||||||
if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref();
|
if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref();
|
||||||
@ -361,6 +361,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Make substitution in email content
|
// Make substitution in email content
|
||||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, null, $object);
|
$substitutionarray=getCommonSubstitutionArray($langs, 0, null, $object);
|
||||||
@ -393,7 +394,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
$result=$mailfile->sendfile();
|
$result=$mailfile->sendfile();
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
// FIXME This must be moved into the trigger for action $trigger_name
|
// Two hooks are available into method $mailfile->sendfile, so dedicated code is no more required
|
||||||
|
/*
|
||||||
if (! empty($conf->dolimail->enabled))
|
if (! empty($conf->dolimail->enabled))
|
||||||
{
|
{
|
||||||
$mid = (GETPOST('mid','int') ? GETPOST('mid','int') : 0); // Original mail id is set ?
|
$mid = (GETPOST('mid','int') ? GETPOST('mid','int') : 0); // Original mail id is set ?
|
||||||
@ -411,7 +413,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs');
|
if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs');
|
||||||
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
|
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Initialisation of datas
|
// Initialisation of datas
|
||||||
if (is_object($object))
|
if (is_object($object))
|
||||||
@ -446,12 +448,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
// This avoid sending mail twice if going out and then back to page
|
// This avoid sending mail twice if going out and then back to page
|
||||||
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
|
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
|
||||||
setEventMessages($mesg, null, 'mesgs');
|
setEventMessages($mesg, null, 'mesgs');
|
||||||
if ($conf->dolimail->enabled)
|
|
||||||
{
|
$moreparam='';
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:'').'&'.($paramname2?$paramname2:'mid').'='.$parm2val);
|
if (isset($paramname2) || isset($paramval2)) $moreparam.= '&'.($paramname2?$paramname2:'mid').'='.$paramval2;
|
||||||
exit;
|
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:'').$moreparam);
|
||||||
}
|
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:''));
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -482,7 +482,7 @@ class CMailFile
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send mail that was prepared by constructor
|
* Send mail that was prepared by constructor.
|
||||||
*
|
*
|
||||||
* @return boolean True if mail sent, false otherwise
|
* @return boolean True if mail sent, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -499,15 +499,21 @@ class CMailFile
|
|||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
|
||||||
$hookmanager = new HookManager($db);
|
$hookmanager = new HookManager($db);
|
||||||
$hookmanager->initHooks(array('maildao'));
|
$hookmanager->initHooks(array('mail'));
|
||||||
$reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if (! empty($reshook))
|
$parameters=array(); $action='';
|
||||||
|
$reshook = $hookmanager->executeHooks('sendMail', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0)
|
||||||
{
|
{
|
||||||
$this->error = "Error in hook maildao doactions " . $reshook;
|
$this->error = "Error in hook maildao sendMail " . $reshook;
|
||||||
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
|
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
|
||||||
|
|
||||||
return $reshook;
|
return $reshook;
|
||||||
}
|
}
|
||||||
|
if ($reshook == 1) // Hook replace standard code
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
|
// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
|
||||||
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10;
|
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10;
|
||||||
@ -760,13 +766,21 @@ class CMailFile
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
// Send mail method not correctly defined
|
// Send mail method not correctly defined
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
|
|
||||||
return 'Bad value for sendmode';
|
return 'Bad value for sendmode';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$parameters=array(); $action='';
|
||||||
|
$reshook = $hookmanager->executeHooks('sendMailAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0)
|
||||||
|
{
|
||||||
|
$this->error = "Error in hook maildao sendMailAfter " . $reshook;
|
||||||
|
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
|
||||||
|
|
||||||
|
return $reshook;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -139,6 +139,9 @@ class HookManager
|
|||||||
'addMoreMassActions',
|
'addMoreMassActions',
|
||||||
'addSearchEntry',
|
'addSearchEntry',
|
||||||
'addStatisticLine',
|
'addStatisticLine',
|
||||||
|
'createDictionaryFieldList',
|
||||||
|
'editDictionaryFieldlist',
|
||||||
|
'getFormMail',
|
||||||
'deleteFile',
|
'deleteFile',
|
||||||
'doActions',
|
'doActions',
|
||||||
'doMassActions',
|
'doMassActions',
|
||||||
@ -175,10 +178,9 @@ class HookManager
|
|||||||
'formatEvent',
|
'formatEvent',
|
||||||
'printObjectLine',
|
'printObjectLine',
|
||||||
'printObjectSubLine',
|
'printObjectSubLine',
|
||||||
'createDictionaryFieldList',
|
'showLinkToObjectBlock',
|
||||||
'editDictionaryFieldlist',
|
'sendMail',
|
||||||
'getFormMail',
|
'sendMailAfter'
|
||||||
'showLinkToObjectBlock'
|
|
||||||
)
|
)
|
||||||
)) $hooktype='addreplace';
|
)) $hooktype='addreplace';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user