From d10c5cab3424307ae42321fbd4b768e7c83e839d Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Wed, 20 Feb 2019 15:14:50 +0100 Subject: [PATCH 1/2] Company Lib : Fix url for emailing type event (link to emailing card) --- htdocs/core/lib/company.lib.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index be9c660a499..c0369921b4d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1378,7 +1378,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin } // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing. - if (! empty($conf->mailing->enabled) && ! empty($objcon->email)) + if (! empty($conf->mailing->enabled) && ! empty($objcon->email) + && (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING')) { $langs->load("mails"); @@ -1528,7 +1529,13 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin // Ref $out.=''; - $out.=$actionstatic->getNomUrl(1, -1); + if (isset($histo[$key]['type']) && $histo[$key]['type']=='mailing') { + $out.=''.img_object($langs->trans("ShowEMailing"), "email").' '; + $out.=$histo[$key]['id']; + $out.=''; + } else { + $out.=$actionstatic->getNomUrl(1, -1); + } $out.=''; // Author of event From cdc2c5ae7747bdd59c8d19f6919d2c6e0dd07586 Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Thu, 21 Feb 2019 09:49:46 +0100 Subject: [PATCH 2/2] Company Lib : Fix contact events with no thirdparty --- htdocs/core/lib/company.lib.php | 46 ++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c0369921b4d..94707467166 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1266,27 +1266,31 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql.= ", ".MAIN_DB_PREFIX."ticket as o"; $sql.= " WHERE a.entity IN (".getEntity('agenda').")"; - if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; - elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; - elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') - { - $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; - if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; - } - elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') - { - $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; - if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; - } - elseif (is_object($filterobj) && get_class($filterobj) == 'Product') - { - $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; - if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; - } - elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') - { - $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'"; - if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + if (is_object($objcon) && $objcon->id) { + $sql.= " AND a.fk_contact = ".$objcon->id; + } else { + if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; + elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; + elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') + { + $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } + elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') + { + $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } + elseif (is_object($filterobj) && get_class($filterobj) == 'Product') + { + $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } + elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') + { + $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } } // Condition on actioncode