Merge pull request #4728 from atm-ph/fix_send_mail_from_thirdparty

Fix can't send mail to thirdparty contact if no mail defined on thirdparty card
This commit is contained in:
Laurent Destailleur 2016-03-04 16:18:15 +01:00
commit a73b53ff9c

View File

@ -2366,7 +2366,18 @@ else
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
if (! empty($object->email))
$at_least_one_email_contact = false;
$TContact = $object->contact_array_objects();
foreach ($TContact as &$contact)
{
if (!empty($contact->email))
{
$at_least_one_email_contact = true;
break;
}
}
if (! empty($object->email) || $at_least_one_email_contact)
{
$langs->load("mails");
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendMail').'</a></div>';