diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index dab36ec250d..e1df1156239 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -329,6 +329,7 @@ class FormMail extends Form $out.= ''."\n"; } + $modelmail_array=array(); if ($this->param['models'] != 'none') { $result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs); @@ -336,7 +337,6 @@ class FormMail extends Form { setEventMessages($this->error, $this->errors, 'errors'); } - $modelmail_array=array(); foreach($this->lines_model as $line) { $langs->trans("members"); @@ -1076,11 +1076,11 @@ class FormMail extends Form * @return void * @see getCommonSubstitutionArray */ - function setSubstitFromObject($object, $outputlangs=null) + function setSubstitFromObject($object, $outputlangs) { global $conf, $user; - $parameters=array('mode'=>$mode); + $parameters=array(); $tmparray=getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($tmparray, $outputlangs, null, $parameters); @@ -1135,6 +1135,7 @@ class FormMail extends Form { global $conf, $langs; + $tmparray=array(); if ($mode == 'formemail' || $mode == 'formemailwithlines' || $mode == 'formemailforlines') { $parameters=array('mode'=>$mode); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c3c80a3c54a..ba8e9f4d085 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5280,10 +5280,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob // TODO USe this ? $msgishtml = 0; + $birthday = dol_print_date($object->birth,'day'); + if (method_exists($object, 'getCivilityLabel')) $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel(); $substitutionarray['__MEMBER_FIRSTNAME__']=$msgishtml?dol_htmlentitiesbr($object->firstname):$object->firstname; $substitutionarray['__MEMBER_LASTNAME__']=$msgishtml?dol_htmlentitiesbr($object->lastname):$object->lastname; - if (method_exists($object, 'getFullName')) $substitutionarray['__MEMBER_FULLNAME__']=$msgishtml?dol_htmlentitiesbr($object->getFullName($langs)):$object->getFullName($langs); + if (method_exists($object, 'getFullName')) $substitutionarray['__MEMBER_FULLNAME__']=$msgishtml?dol_htmlentitiesbr($object->getFullName($outputlangs)):$object->getFullName($outputlangs); $substitutionarray['__MEMBER_COMPANY__']=$msgishtml?dol_htmlentitiesbr($object->societe):$object->societe; $substitutionarray['__MEMBER_ADDRESS__']=$msgishtml?dol_htmlentitiesbr($object->address):$object->address; $substitutionarray['__MEMBER_ZIP__']=$msgishtml?dol_htmlentitiesbr($object->zip):$object->zip; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 17777e6e228..ef4bf2a9a70 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2221,7 +2221,7 @@ else if ($id || $ref) $formmail->withdeliveryreceipt=1; $formmail->withcancel=1; // Tableau des substitutions - $formmail->setSubstitFromObject($object); + $formmail->setSubstitFromObject($object, $outputlangs); $formmail->substit['__SHIPPINGREF__']=$object->ref; $formmail->substit['__SHIPPINGTRACKNUM__']=$object->tracking_number; $formmail->substit['__SHIPPINGTRACKNUMURL__']=$object->tracking_url; diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 7ef847855e5..dae399a9907 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -542,7 +542,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formmail->withdeliveryreceipt = 1; $formmail->withcancel = 1; // Tableau des substitutions - $formmail->setSubstitFromObject($object); + $formmail->setSubstitFromObject($object, $outputlangs); $formmail->substit ['__ORDERREF__'] = $object->ref; $custcontact = ''; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 3b56046e55f..236faaaa232 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2485,7 +2485,7 @@ else $formmail->withdeliveryreceipt=1; $formmail->withcancel=1; // Array of substitutions - $formmail->setSubstitFromObject($object); + $formmail->setSubstitFromObject($object, $outputlangs); $formmail->substit['__THIRDPARTY_ID__']=$object->id; // substit in setSubstitFromObject was wrong for this one $formmail->substit['__THIRDPARTY_NAME__']=$object->name; // substit in setSubstitFromObject was wrong for this one $formmail->substit['__PERSONALIZED__']=''; // deprecated diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 273c71d8e8c..40fa4db7a37 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1760,7 +1760,7 @@ else $formmail->withdeliveryreceipt=1; $formmail->withcancel=1; // Tableau des substitutions - $formmail->setSubstitFromObject($object); + $formmail->setSubstitFromObject($object, $outputlangs); $formmail->substit['__LASTNAME__']=$object->lastname; $formmail->substit['__FIRSTNAME__']=$object->firstname;