2
0
forked from Wavyzz/dolibarr

set a message

This commit is contained in:
De Coninck Laurent
2018-10-26 16:18:27 +02:00
parent 402bbbe839
commit d347cf3a85
2 changed files with 36 additions and 32 deletions

View File

@@ -634,25 +634,27 @@ if (empty($reshook))
$msg = $arraydefaultmessage->content; $msg = $arraydefaultmessage->content;
} }
if (empty($labeltouse)) { if (empty($labeltouse) || (int)$labeltouse === -1) {
//fallback on the old configuration. //fallback on the old configuration.
$subject = $conf->global->ADHERENT_MAIL_VALID_SUBJECT; setEventMessages('WarningMandatorySetupNotComplete', [], 'errors');
$msg = $conf->global->ADHERENT_MAIL_VALID; $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 else
@@ -713,26 +715,28 @@ if (empty($reshook))
$msg = $arraydefaultmessage->content; $msg = $arraydefaultmessage->content;
} }
if (empty($labeltouse)) { if (empty($labeltouse) || (int)$labeltouse === -1) {
//fallback on the old configuration. //fallback on the old configuration.
$subject = $conf->global->ADHERENT_MAIL_RESIL_SUBJECT; setEventMessages('WarningMandatorySetupNotComplete', [], 'errors');
$msg = $conf->global->ADHERENT_MAIL_RESIL; $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 else
{ {

View File

@@ -6555,7 +6555,7 @@ function get_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)
* @see dol_htmloutput_errors * @see dol_htmloutput_errors
* @see setEventMessages * @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; if (empty($mesgstring) && (! is_array($mesgarray) || count($mesgarray) == 0)) return;