Skip to content

Commit

Permalink
Merge pull request #6540 from laudeco/fix/mailMassAction
Browse files Browse the repository at this point in the history
fix the from e-mail on mass action
  • Loading branch information
eldy committed Mar 18, 2017
2 parents 1e3c287 + 8c65c47 commit 4d6b20b
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion htdocs/core/actions_massactions.inc.php
Expand Up @@ -209,7 +209,26 @@
if (count($listofqualifiedinvoice) > 0)
{
$langs->load("commercial");
$from = $user->getFullName($langs) . ' <' . $user->email .'>';

$fromtype = GETPOST('fromtype');
if ($fromtype === 'user') {
$from = $user->getFullName($langs) .' <'.$user->email.'>';
}
elseif ($fromtype === 'company') {
$from = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
}
elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
$tmp=explode(',', $user->email_aliases);
$from = trim($tmp[($reg[1] - 1)]);
}
elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
$tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
$from = trim($tmp[($reg[1] - 1)]);
}
else {
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
}

$replyto = $from;
$subject = GETPOST('subject');
$message = GETPOST('message');
Expand Down

0 comments on commit 4d6b20b

Please sign in to comment.