Fix confirmation email for membership payment

This commit is contained in:
Laurent Destailleur 2018-03-25 15:00:43 +02:00
parent a5dd98701e
commit 53dde8dc0c
4 changed files with 11 additions and 9 deletions

View File

@ -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);

View File

@ -5686,6 +5686,7 @@ function dol_textishtml($msg,$option=0)
elseif (preg_match('/<h[0-9]>/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;

View File

@ -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();

View File

@ -512,6 +512,7 @@ if ($ispaymentok)
}
$result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1);
if ($result < 0)
{
$errmsg=$object->error;