From 9436b1d046c1d67d62f232963743d2120100f83c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Aug 2014 09:26:40 +0200 Subject: [PATCH] New: Prepare to be able to defined a bcc for each type of email sent from dolibarr. --- htdocs/core/actions_sendmails.inc.php | 10 ++++++++-- htdocs/societe/soc.php | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 3af164abfab..337cf59c9b0 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -26,7 +26,8 @@ // $id must be defined // $actiontypecode must be defined - +// $paramname must be defined +// $mode must be defined /* * Add file in email form @@ -115,6 +116,11 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $message = $_POST['message']; $sendtocc = $_POST['sendtocc']; + $sendtobcc=''; + if ($mode == 'emailfromproposal') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO); + if ($mode == 'emailfromorder') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO); + if ($mode == 'emailfrominvoice') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO); + $deliveryreceipt = $_POST['deliveryreceipt']; if ($action == 'send' || $action == 'relance') @@ -141,7 +147,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // Send mail require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1); + $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1); if ($mailfile->error) { $mesgs[]='
'.$mailfile->error.'
'; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 7ca032cf422..d1bdfa898d4 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -513,6 +513,7 @@ if (empty($reshook)) $id=$socid; $actiontypecode='AC_OTH_AUTO'; $paramname='socid'; + $mode='emailfromthirdparty'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';