FIX Send email from bulk action of list of thirdparties

This commit is contained in:
Laurent Destailleur 2020-04-05 15:26:16 +02:00
parent 9bbedce3d6
commit 62387f712c

View File

@ -253,7 +253,11 @@ if (!$error && $massaction == 'confirm_presend')
// Test recipient // Test recipient
if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send) if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send)
{ {
if ($objectobj->element == 'expensereport') if ($objectobj->element == 'societe')
{
$sendto = $objectobj->email;
}
elseif ($objectobj->element == 'expensereport')
{ {
$fuser = new User($db); $fuser = new User($db);
$fuser->fetch($objectobj->fk_user_author); $fuser->fetch($objectobj->fk_user_author);
@ -289,6 +293,10 @@ if (!$error && $massaction == 'confirm_presend')
if (empty($sendto)) if (empty($sendto))
{ {
if ($objectobj->element == 'societe') {
$objectobj->thirdparty = $objectobj; // Hack so following code is comaptible when objectobj is a thirdparty
}
//print "No recipient for thirdparty ".$objectobj->thirdparty->name; //print "No recipient for thirdparty ".$objectobj->thirdparty->name;
$nbignored++; $nbignored++;
if (empty($thirdpartywithoutemail[$objectobj->thirdparty->id])) if (empty($thirdpartywithoutemail[$objectobj->thirdparty->id]))