This commit is contained in:
Laurent Destailleur 2017-09-16 09:15:10 +02:00
parent baa32f6ed8
commit 4e7e6cc658
5 changed files with 28 additions and 16 deletions

View File

@ -687,7 +687,8 @@ if ($resql)
$formmail->withbody=1; $formmail->withbody=1;
$formmail->withdeliveryreceipt=1; $formmail->withdeliveryreceipt=1;
$formmail->withcancel=1; $formmail->withcancel=1;
// Tableau des substitutions // Array of substitution
// TODO Use getCommonSubstitutionArray like in actions_sendmails.inc.php
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag $formmail->substit['__REF__']='__REF__'; // We want to keep the tag
$formmail->substit['__SIGNATURE__']=$user->signature; $formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag $formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag

View File

@ -264,8 +264,8 @@ if (! $error && $massaction == 'confirm_presend')
} }
$replyto = $from; $replyto = $from;
$subject = GETPOST('subject'); $subject = GETPOST('subject','none');
$message = GETPOST('message'); $message = GETPOST('message','none');
$sendtocc = GETPOST('sentocc'); $sendtocc = GETPOST('sentocc');
$sendtobcc = ''; $sendtobcc = '';
if ($objectclass == 'Propale') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO); if ($objectclass == 'Propale') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO);

View File

@ -258,7 +258,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
} }
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
$message = $_POST['message']; $message = GETPOST('message','none');
$subject = GETPOST('subject','none');
// Make a change into HTML code to allow to include images from medias directory with an external reabable URL. // Make a change into HTML code to allow to include images from medias directory with an external reabable URL.
// <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" /> // <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
@ -278,7 +279,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($action == 'send' || $action == 'relance') if ($action == 'send' || $action == 'relance')
{ {
if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
$actionmsg2=$langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from,4,0,1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto,4,0,1); $actionmsg2=$langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from,4,0,1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto,4,0,1);
if ($message) if ($message)
{ {

View File

@ -302,10 +302,18 @@ class FormMail extends Form
if ($this->withform == 1) if ($this->withform == 1)
{ {
$out.= '<form method="POST" name="mailform" id="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'#formmail">'."\n"; $out.= '<form method="POST" name="mailform" id="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'#formmail">'."\n";
$out.= '<input style="display:none" type="submit" id="sendmail" name="sendmail">'; $out.= '<a id="formmail" name="formmail"></a>';
$out.= '<input style="display:none" type="submit" id="sendmail" name="sendmail">';
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />'; $out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
$out.= '<input type="hidden" name="trackid" value="'.$this->trackid.'" />'; $out.= '<input type="hidden" name="trackid" value="'.$this->trackid.'" />';
$out.= '<a id="formmail" name="formmail"></a>'; }
if (! empty($this->withfrom))
{
if (! empty($this->withfromreadonly))
{
$out.= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />';
$out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
}
} }
foreach ($this->param as $key=>$value) foreach ($this->param as $key=>$value)
{ {
@ -360,6 +368,7 @@ class FormMail extends Form
if (! empty($this->withsubstit)) if (! empty($this->withsubstit))
{ {
$out.= '<tr><td colspan="2" align="right">'; $out.= '<tr><td colspan="2" align="right">';
//$out.='<div class="floatright">';
$help=""; $help="";
foreach($this->substit as $key => $val) foreach($this->substit as $key => $val)
{ {
@ -368,6 +377,7 @@ class FormMail extends Form
if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage
else $out.= $form->textwithpicto($langs->trans($this->withsubstit), $help, 1, 'help', '', 0, 2, 'substittooltip'); // New usage else $out.= $form->textwithpicto($langs->trans($this->withsubstit), $help, 1, 'help', '', 0, 2, 'substittooltip'); // New usage
$out.= "</td></tr>\n"; $out.= "</td></tr>\n";
//$out.='</div>';
} }
// From // From
@ -375,9 +385,7 @@ class FormMail extends Form
{ {
if (! empty($this->withfromreadonly)) if (! empty($this->withfromreadonly))
{ {
$out.= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />'; $out.= '<tr><td class="titlefield fieldrequired">'.$langs->trans("MailFrom").'</td><td>';
$out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
$out.= '<tr><td width="180" class="fieldrequired">'.$langs->trans("MailFrom").'</td><td>';
if (! ($this->fromtype === 'user' && $this->fromid > 0) if (! ($this->fromtype === 'user' && $this->fromid > 0)
&& ! ($this->fromtype === 'company') && ! ($this->fromtype === 'company')
@ -430,10 +438,10 @@ class FormMail extends Form
} }
} }
$out.= ' '.$form->selectarray('fromtype', $liste, $this->fromtype, 0, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails); $out.= ' '.$form->selectarray('fromtype', $liste, $this->fromtype, 0, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails);
//$out.= ajax_combobox('fromtype');
} }
$out.= "</td></tr>\n"; $out.= "</td></tr>\n";
$out.= "</td></tr>\n";
} }
else else
{ {
@ -1076,7 +1084,7 @@ class FormMail extends Form
} }
/** /**
* Get list of substitution keys available for emails. * Get list of substitution keys available for emails. This is used for tooltips help.
* This include the complete_substitutions_array. * This include the complete_substitutions_array.
* *
* @param string $mode 'formemail', 'formemailwithlines', 'formemailforlines', 'emailing', ... * @param string $mode 'formemail', 'formemailwithlines', 'formemailforlines', 'emailing', ...
@ -1183,7 +1191,7 @@ class FormMail extends Form
} }
$parameters=array('mode'=>$mode); $parameters=array('mode'=>$mode);
$tmparray=getCommonSubstitutionArray($langs, 0, null, $object); $tmparray=getCommonSubstitutionArray($langs, 2, null, $object);
complete_substitutions_array($tmparray, $langs, null, $parameters); complete_substitutions_array($tmparray, $langs, null, $parameters);
foreach($tmparray as $key => $val) foreach($tmparray as $key => $val)
{ {

View File

@ -5255,9 +5255,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__AMOUNT_WO_TAX__']= is_object($object)?$object->total_ht:''; $substitutionarray['__AMOUNT_WO_TAX__']= is_object($object)?$object->total_ht:'';
$substitutionarray['__AMOUNT_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):''; $substitutionarray['__AMOUNT_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
// For backward compatibility // For backward compatibility
$substitutionarray['__TOTAL_TTC__'] = is_object($object)?$object->total_ttc:''; if ($onlykey != 2)
$substitutionarray['__TOTAL_HT__'] = is_object($object)?$object->total_ht:''; {
$substitutionarray['__TOTAL_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):''; $substitutionarray['__TOTAL_TTC__'] = is_object($object)?$object->total_ttc:'';
$substitutionarray['__TOTAL_HT__'] = is_object($object)?$object->total_ht:'';
$substitutionarray['__TOTAL_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
}
} }
if (empty($exclude) || ! in_array('date', $exclude)) if (empty($exclude) || ! in_array('date', $exclude))