Can force recipient of unpaid invoice email reminder
This commit is contained in:
parent
055627e248
commit
7fae4d1b1c
@ -5424,9 +5424,10 @@ class Facture extends CommonInvoice
|
||||
* @param int $nbdays Delay after due date (or before if delay is negative)
|
||||
* @param string $paymentmode '' or 'all' by default (no filter), or 'LIQ', 'CHQ', CB', ...
|
||||
* @param int|string $template Name (or id) of email template (Must be a template of type 'facture_send')
|
||||
* @param string $forcerecipient Force email of recipient (for example to send the email to an accountant supervisor instead of the customer)
|
||||
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
public function sendEmailsRemindersOnInvoiceDueDate($nbdays = 0, $paymentmode = 'all', $template = '')
|
||||
public function sendEmailsRemindersOnInvoiceDueDate($nbdays = 0, $paymentmode = 'all', $template = '', $forcerecipient = '')
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
@ -5527,6 +5528,9 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Recipient
|
||||
$to = array();
|
||||
if ($forcerecipient) { // If a recipient was forced
|
||||
$to = array($forcerecipient);
|
||||
} else {
|
||||
$res = $tmpinvoice->fetch_thirdparty();
|
||||
$recipient = $tmpinvoice->thirdparty;
|
||||
if ($res > 0) {
|
||||
@ -5548,6 +5552,7 @@ class Facture extends CommonInvoice
|
||||
$errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Sender
|
||||
$from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user