diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 15a79d7fdd9..539bdca0036 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -687,7 +687,8 @@ if ($resql) $formmail->withbody=1; $formmail->withdeliveryreceipt=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['__SIGNATURE__']=$user->signature; $formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 26b5cbe3460..e5833295480 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -264,8 +264,8 @@ if (! $error && $massaction == 'confirm_presend') } $replyto = $from; - $subject = GETPOST('subject'); - $message = GETPOST('message'); + $subject = GETPOST('subject','none'); + $message = GETPOST('message','none'); $sendtocc = GETPOST('sentocc'); $sendtobcc = ''; if ($objectclass == 'Propale') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 4986a093bac..18c951c7763 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -258,7 +258,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO } $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. // @@ -278,7 +279,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO 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); if ($message) { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 9bfe00e6575..2555c44b539 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -302,10 +302,18 @@ class FormMail extends Form if ($this->withform == 1) { $out.= '
'."\n"; - $out.= ''; + $out.= ''; + $out.= ''; $out.= ''; $out.= ''; - $out.= ''; + } + if (! empty($this->withfrom)) + { + if (! empty($this->withfromreadonly)) + { + $out.= ''; + $out.= ''; + } } foreach ($this->param as $key=>$value) { @@ -360,6 +368,7 @@ class FormMail extends Form if (! empty($this->withsubstit)) { $out.= ''; + //$out.='
'; $help=""; 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 else $out.= $form->textwithpicto($langs->trans($this->withsubstit), $help, 1, 'help', '', 0, 2, 'substittooltip'); // New usage $out.= "\n"; + //$out.='
'; } // From @@ -375,9 +385,7 @@ class FormMail extends Form { if (! empty($this->withfromreadonly)) { - $out.= ''; - $out.= ''; - $out.= ''.$langs->trans("MailFrom").''; + $out.= ''.$langs->trans("MailFrom").''; if (! ($this->fromtype === 'user' && $this->fromid > 0) && ! ($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.= ajax_combobox('fromtype'); } $out.= "\n"; - $out.= "\n"; } 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. * * @param string $mode 'formemail', 'formemailwithlines', 'formemailforlines', 'emailing', ... @@ -1183,7 +1191,7 @@ class FormMail extends Form } $parameters=array('mode'=>$mode); - $tmparray=getCommonSubstitutionArray($langs, 0, null, $object); + $tmparray=getCommonSubstitutionArray($langs, 2, null, $object); complete_substitutions_array($tmparray, $langs, null, $parameters); foreach($tmparray as $key => $val) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 79d982371b7..90265b079aa 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5255,9 +5255,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob $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):''; // For backward compatibility - $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 ($onlykey != 2) + { + $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))