From e03f4b4de98e426046f55cd726f7414ab2ba799e Mon Sep 17 00:00:00 2001 From: phf <phf@atm-consulting.fr> Date: Fri, 4 Mar 2016 12:21:14 +0100 Subject: [PATCH] Fix can't send mail to thirdparty contact if no mail defined on thirdparty card --- htdocs/societe/soc.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 4bad452110b..76a2c948636 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -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.'&action=presend&mode=init">'.$langs->trans('SendMail').'</a></div>'; -- GitLab