diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8eae0e2650e..22648189f99 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1302,7 +1302,6 @@ if ($id > 0) print ''.$langs->trans("Priority").''; print ''; print ''; - // Object linked if (! empty($object->fk_element) && ! empty($object->elementtype)) { @@ -1610,8 +1609,9 @@ if ($id > 0) print ($object->priority?$object->priority:''); print ''; - // Object linked - if (! empty($object->fk_element) && ! empty($object->elementtype)) + // Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table + // for such objects because there is already a dedicated field into table llx_actioncomm. + if (! empty($object->fk_element) && ! empty($object->elementtype) && ! in_array($object->elementtype, array('societe','contact','project'))) { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print ''.$langs->trans("LinkedObject").''; diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 9031cda06f0..ae55f589cf2 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -841,8 +841,13 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->email_subject = $object->email_subject; $actioncomm->errors_to = $object->errors_to; - $actioncomm->fk_element = $elementid; - $actioncomm->elementtype = $elementtype; + // Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table + // for such objects because there is already a dedicated field into table llx_actioncomm. + if (! in_array($elementtype, array('societe','contact','project'))) + { + $actioncomm->fk_element = $elementid; + $actioncomm->elementtype = $elementtype; + } if (property_exists($object,'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles)>0) { $actioncomm->attachedfiles=$object->attachedfiles;