From a79afeaf02fe23c0e8d2c9c46c2a45248dabff7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Jun 2021 19:58:12 +0200 Subject: [PATCH 1/2] Add info to allow debug of email collector --- .../class/emailcollector.class.php | 2 +- htdocs/langs/en_US/main.lang | 1 + htdocs/projet/class/project.class.php | 1 + htdocs/projet/list.php | 18 +++++++++++++++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index b01f1883d53..ec5e33d8bb3 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1539,7 +1539,7 @@ class EmailCollector extends CommonObject // Make Operation dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id); - dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); + dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object $actioncode = 'EMAIL_IN'; // If we scan the Sent box, we use the code for out email diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 39517ca2e1b..86c38e39b8b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1117,3 +1117,4 @@ UpdateForAllLines=Update for all lines OnHold=On hold Civility=Civility InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration. +EmailMsgID=Email MsgID diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c6e9799afa7..54e0f87a358 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -206,6 +206,7 @@ class Project extends CommonObject 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>210), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModification', 'enabled'=>1, 'visible'=>0, 'position'=>215), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>220), + 'email_msgid'=>array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'enabled'=>1, 'visible'=>-1, 'position'=>250, 'help'=>'EmailMsgIDWhenSourceisEmail'), 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500) ); // END MODULEBUILDER PROPERTIES diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 4438a9ce217..96c960e58d1 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -25,7 +25,7 @@ /** * \file htdocs/projet/list.php - * \ingroup projet + * \ingroup project * \brief Page to list projects */ @@ -300,6 +300,7 @@ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; / $distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. $sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat"; $sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount, p.usage_opportunity, p.usage_task, p.usage_bill_time"; +$sql .= ", p.email_msgid"; $sql .= ", s.rowid as socid, s.nom as name, s.email"; $sql .= ", cls.code as opp_status_code"; // Add fields from extrafields @@ -668,6 +669,12 @@ if (!empty($arrayfields['p.tms']['checked'])) print ''; print ''; } +if (!empty($arrayfields['p.email_msgid']['checked'])) +{ + // Email msg id + print ''; + print ''; +} if (!empty($arrayfields['p.fk_statut']['checked'])) { print ''; @@ -710,6 +717,7 @@ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // No print $hookmanager->resPrint; if (!empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); if (!empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (!empty($arrayfields['p.email_msgid']['checked'])) print_liste_field_titre($arrayfields['p.email_msgid']['label'], $_SERVER["PHP_SELF"], "p.email_msgid", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -948,6 +956,14 @@ while ($i < min($num, $limit)) print ''; if (!$i) $totalarray['nbfield']++; } + // Email MsgID + if (!empty($arrayfields['p.email_msgid']['checked'])) + { + print ''; + print $obj->email_msgid; + print ''; + if (!$i) $totalarray['nbfield']++; + } // Status if (!empty($arrayfields['p.fk_statut']['checked'])) { From d154ec2344f67756552f0e35b98595341cea9c36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Jun 2021 20:06:52 +0200 Subject: [PATCH 2/2] FIX Collector to create lead was broken --- htdocs/comm/action/class/actioncomm.class.php | 4 ++++ htdocs/projet/class/project.class.php | 4 +++- htdocs/ticket/class/ticket.class.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f7e0ef6acb1..d094fb0bab4 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -683,6 +683,10 @@ class ActionComm extends CommonObject { global $langs; + if (empty($id) && empty($ref) && empty($ref_ext) && empty($email_msgid)) { + return -1; + } + $sql = "SELECT a.id,"; $sql .= " a.id as ref,"; $sql .= " a.entity,"; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 54e0f87a358..c5dd1045f03 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -526,7 +526,9 @@ class Project extends CommonObject { global $conf; - if (empty($id) && empty($ref)) return -1; + if (empty($id) && empty($ref) && empty($ref_ext) && empty($email_msgid)) { + return -1; + } $sql = "SELECT rowid, entity, ref, title, description, public, datec, opp_amount, budget_amount,"; $sql .= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut as status, fk_opp_status, opp_percent,"; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 5f95c7f0dc5..20d63cea600 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -529,7 +529,7 @@ class Ticket extends CommonObject global $langs; // Check parameters - if (!$id && !$track_id && !$ref && !$email_msgid) { + if (empty($id) && empty($ref) && empty($track_id) && empty($email_msgid)) { $this->error = 'ErrorWrongParameters'; dol_print_error(get_class($this)."::fetch ".$this->error); return -1;