diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 3a6f3a7ceff..99119414971 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -434,7 +434,16 @@ if (empty($reshook)) { $from = $_POST ['fromname'] . ' <' . $_POST ['frommail'] . '>'; $replyto = $_POST ['replytoname'] . ' <' . $_POST ['replytomail'] . '>'; $message = $_POST ['message']; - $sendtocc = $_POST ['sendtocc']; + + $receivercc = GETPOST('receivercc'); + if($_POST ['sendtocc']!=='') { + $sendtocc = $_POST ['sendtocc'] ; + } + elseif($receivercc!=-1) { + $sendtocc = $object->client->contact_get_property($receivercc, 'email'); + } + + $deliveryreceipt = $_POST ['deliveryreceipt']; if (dol_strlen($_POST ['subject'])) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 4a2b13b0069..af28d80b9e9 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1571,7 +1571,15 @@ if (empty($reshook)) { $from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>'; $replyto = $_POST['replytoname'] . ' <' . $_POST['replytomail'] . '>'; $message = $_POST['message']; - $sendtocc = $_POST['sendtocc']; + + $receivercc = GETPOST('receivercc'); + if($_POST ['sendtocc']!=='') { + $sendtocc = $_POST ['sendtocc'] ; + } + elseif($receivercc!=-1) { + $sendtocc = $object->client->contact_get_property($receivercc, 'email'); + } + $deliveryreceipt = $_POST['deliveryreceipt']; if ($action == 'send') {