Fix emailing in test mode use correct user or sender signature
This commit is contained in:
parent
6da5df45b2
commit
dbf3df5210
@ -223,7 +223,6 @@ if (empty($reshook)) {
|
||||
|
||||
$signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : '');
|
||||
|
||||
$targetobject = null; // Not defined with mass emailing
|
||||
$parameters = array('mode'=>'emailing');
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object
|
||||
|
||||
@ -468,19 +467,25 @@ if (empty($reshook)) {
|
||||
|
||||
if (!$error) {
|
||||
// Is the message in html
|
||||
$msgishtml = -1; // Unknow by default
|
||||
$msgishtml = -1; // Unknow = autodetect by default
|
||||
if (preg_match('/[\s\t]*<html>/i', $object->body)) {
|
||||
$msgishtml = 1;
|
||||
}
|
||||
|
||||
$signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : '');
|
||||
|
||||
$parameters = array('mode'=>'emailing');
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object
|
||||
|
||||
// other are set at begin of page
|
||||
$object->substitutionarrayfortest['__EMAIL__'] = $object->sendto;
|
||||
$object->substitutionarrayfortest['__MAILTOEMAIL__'] = '<a href="mailto:'.$object->sendto.'">'.$object->sendto.'</a>';
|
||||
$substitutionarray['__EMAIL__'] = $object->sendto;
|
||||
$substitutionarray['__MAILTOEMAIL__'] = '<a href="mailto:'.$object->sendto.'">'.$object->sendto.'</a>';
|
||||
|
||||
// Subject and message substitutions
|
||||
complete_substitutions_array($object->substitutionarrayfortest, $langs);
|
||||
$tmpsujet = make_substitutions($object->sujet, $object->substitutionarrayfortest);
|
||||
$tmpbody = make_substitutions($object->body, $object->substitutionarrayfortest);
|
||||
complete_substitutions_array($substitutionarray, $langs, $targetobject);
|
||||
|
||||
$tmpsujet = make_substitutions($object->sujet, $substitutionarray);
|
||||
$tmpbody = make_substitutions($object->body, $substitutionarray);
|
||||
|
||||
$arr_file = array();
|
||||
$arr_mime = array();
|
||||
@ -935,7 +940,7 @@ if ($action == 'create') {
|
||||
*/
|
||||
|
||||
// From
|
||||
print '<tr><td>';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $form->editfieldkey("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string');
|
||||
|
||||
@ -241,7 +241,7 @@ if ($object->fetch($id) >= 0) {
|
||||
|
||||
//print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td colspan="3">';
|
||||
$emailarray = CMailFile::getArrayAddress($object->email_from);
|
||||
foreach ($emailarray as $email => $name) {
|
||||
if ($name && $name != $email) {
|
||||
@ -291,7 +291,7 @@ if ($object->fetch($id) >= 0) {
|
||||
}
|
||||
}
|
||||
if (empty($nbemail)) {
|
||||
$nbemail .= ' '.img_warning('').' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
|
||||
$nbemail .= ' '.img_warning('');//.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
|
||||
}
|
||||
if ($text) {
|
||||
print $form->textwithpicto($nbemail, $text, 1, 'warning');
|
||||
|
||||
@ -540,11 +540,15 @@ class FormMail extends Form
|
||||
// Substitution array/string
|
||||
$helpforsubstitution = '';
|
||||
if (is_array($this->substit) && count($this->substit)) {
|
||||
$helpforsubstitution .= $langs->trans('AvailableVariables').' :<br>'."\n";
|
||||
$helpforsubstitution .= $langs->trans('AvailableVariables').' :<br><br><span class="small">'."\n";
|
||||
}
|
||||
foreach ($this->substit as $key => $val) {
|
||||
$helpforsubstitution .= $key.' -> '.$langs->trans(dol_string_nohtmltag(dolGetFirstLineOfText($val))).'<br>';
|
||||
}
|
||||
if (is_array($this->substit) && count($this->substit)) {
|
||||
$helpforsubstitution .= '</span>';
|
||||
}
|
||||
|
||||
if (!empty($this->withsubstit)) { // Unset or set ->withsubstit=0 to disable this.
|
||||
$out .= '<tr><td colspan="2" class="right">';
|
||||
//$out.='<div class="floatright">';
|
||||
@ -1599,7 +1603,7 @@ class FormMail extends Form
|
||||
$tmparray = getCommonSubstitutionArray($langs, 2, array('object', 'objectamount'), $object); // Note: On email templated edition, this is null because it is related to all type of objects
|
||||
complete_substitutions_array($tmparray, $langs, null, $parameters);
|
||||
|
||||
// For mass emailing, we have different keys
|
||||
// For mass emailing, we have different keys specific to the data into tagerts list
|
||||
$tmparray['__ID__'] = 'IdRecord';
|
||||
$tmparray['__THIRDPARTY_CUSTOMER_CODE__'] = 'CustomerCode';
|
||||
$tmparray['__EMAIL__'] = 'EMailRecipient';
|
||||
@ -1611,8 +1615,6 @@ class FormMail extends Form
|
||||
$tmparray['__OTHER3__'] = 'Other3';
|
||||
$tmparray['__OTHER4__'] = 'Other4';
|
||||
$tmparray['__OTHER5__'] = 'Other5';
|
||||
$tmparray['__USER_SIGNATURE__'] = 'TagUserSignature';
|
||||
$tmparray['__SENDEREMAIL_SIGNATURE__'] = 'TagEmailSenderSignature';
|
||||
$tmparray['__CHECK_READ__'] = 'TagCheckMail';
|
||||
$tmparray['__UNSUBSCRIBE__'] = 'TagUnsubscribe';
|
||||
//,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet in mass emailing
|
||||
|
||||
@ -201,11 +201,11 @@ class mailing_fraise extends MailingTargets
|
||||
$s .= '</select>';
|
||||
|
||||
|
||||
$s .= '<br>';
|
||||
$s .= '<br><span class="opacitymedium">';
|
||||
$s .= $langs->trans("DateEndSubscription").': ';
|
||||
$s .= $langs->trans("After").' > '.$form->selectDate(-1, 'subscriptionafter', 0, 0, 1, 'fraise', 1, 0, 0);
|
||||
$s .= $langs->trans("After").' > </span>'.$form->selectDate(-1, 'subscriptionafter', 0, 0, 1, 'fraise', 1, 0, 0);
|
||||
$s .= ' ';
|
||||
$s .= $langs->trans("Before").' < '.$form->selectDate(-1, 'subscriptionbefore', 0, 0, 1, 'fraise', 1, 0, 0);
|
||||
$s .= '<span class="opacitymedium">'.$langs->trans("Before").' < </span>'.$form->selectDate(-1, 'subscriptionbefore', 0, 0, 1, 'fraise', 1, 0, 0);
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ class mailing_pomme extends MailingTargets
|
||||
$langs->load("users");
|
||||
|
||||
$s = '';
|
||||
$s .= '<select id="filter_pomme"" name="filter" class="flat">';
|
||||
$s .= '<select id="filter_pomme"" name="filter" class="flat minwidth100">';
|
||||
$s .= '<option value="-1">'.$langs->trans("Status").'</option>';
|
||||
$s .= '<option value="1">'.$langs->trans("Enabled").'</option>';
|
||||
$s .= '<option value="0">'.$langs->trans("Disabled").'</option>';
|
||||
@ -126,7 +126,7 @@ class mailing_pomme extends MailingTargets
|
||||
$s .= ajax_combobox("filter_pomme");
|
||||
|
||||
$s .= ' ';
|
||||
$s .= '<select id="filteremployee_pomme" name="filteremployee" class="flat">';
|
||||
$s .= '<select id="filteremployee_pomme" name="filteremployee" class="flat minwidth100">';
|
||||
$s .= '<option value="-1">'.$langs->trans("Employee").'</option>';
|
||||
$s .= '<option value="1">'.$langs->trans("Yes").'</option>';
|
||||
$s .= '<option value="0">'.$langs->trans("No").'</option>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user