From 402bbbe83967a563e500fd5388bfdd6ec80b2fa5 Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Fri, 19 Oct 2018 17:23:53 +0200 Subject: [PATCH 1/3] fix the member e-mail on resign and validation. Since the member module is only using the new configuration and the name of the global variabels changed you have a blocking e-mail error when you try to resign or validate a member. In order to fix that I fallback on the previous variable like that it's still working. [see: #9640] --- htdocs/adherents/card.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index a3df6705df9..c9a8eebf0fe 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -634,6 +634,12 @@ if (empty($reshook)) $msg = $arraydefaultmessage->content; } + if (empty($labeltouse)) { + //fallback on the old configuration. + $subject = $conf->global->ADHERENT_MAIL_VALID_SUBJECT; + $msg = $conf->global->ADHERENT_MAIL_VALID; + } + $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); @@ -707,6 +713,12 @@ if (empty($reshook)) $msg = $arraydefaultmessage->content; } + if (empty($labeltouse)) { + //fallback on the old configuration. + $subject = $conf->global->ADHERENT_MAIL_RESIL_SUBJECT; + $msg = $conf->global->ADHERENT_MAIL_RESIL; + } + $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); From d347cf3a85b04ea11d8a2cfae348948dbac446f6 Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Fri, 26 Oct 2018 16:18:27 +0200 Subject: [PATCH 2/3] set a message --- htdocs/adherents/card.php | 66 ++++++++++++++++--------------- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index c9a8eebf0fe..2aceb437d23 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -634,25 +634,27 @@ if (empty($reshook)) $msg = $arraydefaultmessage->content; } - if (empty($labeltouse)) { + if (empty($labeltouse) || (int)$labeltouse === -1) { //fallback on the old configuration. - $subject = $conf->global->ADHERENT_MAIL_VALID_SUBJECT; - $msg = $conf->global->ADHERENT_MAIL_VALID; + setEventMessages('WarningMandatorySetupNotComplete', [], 'errors'); + $error++; + }else{ + $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs); + + $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; + + $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } } - $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); - complete_substitutions_array($substitutionarray, $outputlangs, $object); - $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); - $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs); - $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; - - $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); - if ($result < 0) - { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - } } } else @@ -713,26 +715,28 @@ if (empty($reshook)) $msg = $arraydefaultmessage->content; } - if (empty($labeltouse)) { + if (empty($labeltouse) || (int)$labeltouse === -1) { //fallback on the old configuration. - $subject = $conf->global->ADHERENT_MAIL_RESIL_SUBJECT; - $msg = $conf->global->ADHERENT_MAIL_RESIL; + setEventMessages('WarningMandatorySetupNotComplete', [], 'errors'); + $error++; + }else{ + $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs); + + $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; + + $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } } + } - $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); - complete_substitutions_array($substitutionarray, $outputlangs, $object); - $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); - $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs); - $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; - - $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); - } - if ($result < 0) - { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - } } else { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3ec1f226993..6649bf17bbb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6555,7 +6555,7 @@ function get_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0) * @see dol_htmloutput_errors * @see setEventMessages */ -function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepembedded=0) +function dol_htmloutput_mesg($mesgstring = '',$mesgarray = [], $style = 'ok', $keepembedded=0) { if (empty($mesgstring) && (! is_array($mesgarray) || count($mesgarray) == 0)) return; From 9bb1572e632761c1def90408412f9029cb90dd09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Oct 2018 12:41:06 +0100 Subject: [PATCH 3/3] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6649bf17bbb..a289c967055 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6529,7 +6529,7 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb /** * Get formated error messages to output (Used to show messages on html output). * - * @param string $mesgstring Error message + * @param string $mesgstring Error message * @param array $mesgarray Error messages array * @param int $keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify) * @return string Return html output @@ -6537,7 +6537,7 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb * @see dol_print_error * @see dol_htmloutput_mesg */ -function get_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0) +function get_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0) { return get_htmloutput_mesg($mesgstring, $mesgarray,'error',$keepembedded); } @@ -6547,15 +6547,15 @@ function get_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0) * * @param string $mesgstring Message string or message key * @param string[] $mesgarray Array of message strings or message keys - * @param string $style Which style to use ('ok', 'warning', 'error') - * @param int $keepembedded Set to 1 if message must be kept embedded into its html place (this disable jnotify) - * @return void + * @param string $style Which style to use ('ok', 'warning', 'error') + * @param int $keepembedded Set to 1 if message must be kept embedded into its html place (this disable jnotify) + * @return void * - * @see dol_print_error - * @see dol_htmloutput_errors - * @see setEventMessages + * @see dol_print_error + * @see dol_htmloutput_errors + * @see setEventMessages */ -function dol_htmloutput_mesg($mesgstring = '',$mesgarray = [], $style = 'ok', $keepembedded=0) +function dol_htmloutput_mesg($mesgstring = '',$mesgarray = array(), $style = 'ok', $keepembedded=0) { if (empty($mesgstring) && (! is_array($mesgarray) || count($mesgarray) == 0)) return; @@ -6609,7 +6609,7 @@ function dol_htmloutput_mesg($mesgstring = '',$mesgarray = [], $style = 'ok', $k * @see dol_print_error * @see dol_htmloutput_mesg */ -function dol_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0) +function dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0) { dol_htmloutput_mesg($mesgstring, $mesgarray, 'error', $keepembedded); }