mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix email collector to add update of ticket email collector (#29541)
* Fix email collector to add update of ticket email collector * update lang file * fix lang file --------- Co-authored-by: Hystepik <lmarcouiller@nltechno.com>
This commit is contained in:
parent
960063a531
commit
2928ae54c2
|
|
@ -2277,7 +2277,7 @@ class EmailCollector extends CommonObject
|
|||
if ($mode < 2) { // 0=Mode production, 1=Mode test (read IMAP and try SQL update then rollback), 2=Mode test with no SQL updates
|
||||
foreach ($this->actions as $operation) {
|
||||
$errorforthisaction = 0;
|
||||
|
||||
$ticketalreadyexists = 0;
|
||||
if ($errorforactions) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -2313,6 +2313,31 @@ class EmailCollector extends CommonObject
|
|||
$descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailCC").($langs->trans("MailCC") != 'CC' ? ' (CC)' : '').' : '.dol_escape_htmltag($sendtocc));
|
||||
}
|
||||
|
||||
if ($operation['type'] == 'ticket') {
|
||||
// Verify if ticket already exists to fall back on the right operation
|
||||
$tickettocreate = new Ticket($this->db);
|
||||
$errorfetchticket = 0;
|
||||
$alreadycreated1 = 0;
|
||||
if (!empty($trackid)) {
|
||||
$alreadycreated1 = $tickettocreate->fetch(0, '', $trackid);
|
||||
}
|
||||
$alreadycreated2 = $tickettocreate->fetch(0, '', '', $msgid);
|
||||
$alreadycreated = $alreadycreated1 + $alreadycreated2;
|
||||
if ($alreadycreated1 < 0 || $alreadycreated2 < 0) {
|
||||
$errorfetchticket ++;
|
||||
}
|
||||
if (empty($errorfetchticket)) {
|
||||
if ($alreadycreated == 0) {
|
||||
$ticketalreadyexists = 0;
|
||||
} else {
|
||||
$ticketalreadyexists = 1;
|
||||
$operation['type'] = 'recordevent';
|
||||
}
|
||||
} else {
|
||||
$ticketalreadyexists = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Search and create thirdparty
|
||||
if ($operation['type'] == 'loadthirdparty' || $operation['type'] == 'loadandcreatethirdparty') {
|
||||
if (empty($operation['actionparam'])) {
|
||||
|
|
@ -3067,15 +3092,7 @@ class EmailCollector extends CommonObject
|
|||
} elseif ($operation['type'] == 'ticket') {
|
||||
// Create ticket
|
||||
$tickettocreate = new Ticket($this->db);
|
||||
$errorfetchticket = 0;
|
||||
|
||||
$alreadycreated1 = $tickettocreate->fetch(0, '', $trackid);
|
||||
$alreadycreated2 = $tickettocreate->fetch(0, '', '', $msgid);
|
||||
$alreadycreated = $alreadycreated1 + $alreadycreated2;
|
||||
if ($alreadycreated1 < 0 || $alreadycreated2 < 0) {
|
||||
$errorfetchticket ++;
|
||||
}
|
||||
if (empty($errorfetchticket) && $alreadycreated == 0) {
|
||||
if ($ticketalreadyexists == 0) {
|
||||
if ($thirdpartystatic->id > 0) {
|
||||
$tickettocreate->socid = $thirdpartystatic->id;
|
||||
$tickettocreate->fk_soc = $thirdpartystatic->id;
|
||||
|
|
|
|||
|
|
@ -2181,7 +2181,7 @@ NoNewEmailToProcess=No new email (matching filters) to process
|
|||
NothingProcessed=Nothing done
|
||||
RecordEvent=Record an event in agenda (with type Email sent or received)
|
||||
CreateLeadAndThirdParty=Create a lead (and a third party if necessary)
|
||||
CreateTicketAndThirdParty=Create a ticket (linked to a third party if the third party was loaded by a previous operation or was guessed from a tracker in email header, without third party otherwise)
|
||||
CreateTicketAndThirdParty=Create or complete a ticket (linked to a third party if the third party was loaded by a previous operation or was guessed from a tracker in email header, without third party otherwise)
|
||||
CodeLastResult=Latest result code
|
||||
NbOfEmailsInInbox=Number of emails in source directory
|
||||
LoadThirdPartyFromName=Load third party searching on %s (load only)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user