diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 17e063244df..7c16ecb5e5c 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -253,7 +253,11 @@ if (!$error && $massaction == 'confirm_presend') // Test recipient 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->fetch($objectobj->fk_user_author); @@ -289,6 +293,10 @@ if (!$error && $massaction == 'confirm_presend') 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; $nbignored++; if (empty($thirdpartywithoutemail[$objectobj->thirdparty->id]))