diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 4e6c540d2a5..faba841e7c6 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -147,9 +147,11 @@ class Adherent extends CommonObject if ($msgishtml == -1) { $msgishtml = 0; - if (dol_textishtml($text,1)) $msgishtml = 1; + if (dol_textishtml($text,0)) $msgishtml = 1; } + dol_syslog('send_an_email msgishtml='.$msgishtml); + $texttosend=$this->makeSubstitution($text); $subjecttosend=$this->makeSubstitution($subject); if ($msgishtml) $texttosend=dol_htmlentitiesbr($texttosend); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e18a0f111ff..aee9ed61f62 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5686,6 +5686,7 @@ function dol_textishtml($msg,$option=0) elseif (preg_match('//i',$msg)) return true; elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) + return false; } } @@ -5775,6 +5776,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob '__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id )); } + if (($onlykey || is_object($object)) && (empty($exclude) || ! in_array('object', $exclude))) { if ($onlykey) @@ -5789,8 +5791,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob $substitutionarray['__THIRDPARTY_NAME__'] = '__THIRDPARTY_NAME__'; $substitutionarray['__THIRDPARTY_EMAIL__'] = '__THIRDPARTY_EMAIL__'; - if (is_object($object) && $object->element == 'shipping') + if (is_object($object) && $object->element == 'member') { + $substitutionarray['__MEMBER_ID__'] = '__MEMBER_ID__'; $substitutionarray['__MEMBER_CIVILITY__'] = '__MEMBER_CIVILITY__'; $substitutionarray['__MEMBER_FIRSTNAME__'] = '__MEMBER_FIRSTNAME__'; $substitutionarray['__MEMBER_LASTNAME__'] = '__MEMBER_LASTNAME__'; @@ -5830,6 +5833,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob $birthday = dol_print_date($object->birth,'day'); + $substitutionarray['__MEMBER_ID__']=$object->id; 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; diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 43cacab0e1c..edeabc5865d 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -108,6 +108,7 @@ if ($action == 'presend') // Create form for email include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); + $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); $formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); @@ -178,13 +179,7 @@ if ($action == 'presend') $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; $formmail->param['fileinit'] = array($file); - // Init list of files - /*if (GETPOST('mode','alpha') == 'init') - { - $formmail->clear_attached_files(); - - $formmail->add_attached_files($file, basename($file), dol_mimetype($file)); - }*/ + $formmail->withsubstit = 1; // Show form print $formmail->get_form(); diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 4eb22707bef..ec92989f031 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -512,6 +512,7 @@ if ($ispaymentok) } $result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1); + if ($result < 0) { $errmsg=$object->error;