Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix emailcollector ticket tracking #29393

Merged
merged 6 commits into from Apr 27, 2024

Conversation

Hystepik
Copy link
Contributor

Fix email collector to parmit the tracking of emails for ticket


if (get_class($objectemail) == 'Ticket') {
$changeonticket_references = false;
$trackid = $objectemail->track_id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this line ?

Copy link
Contributor Author

@Hystepik Hystepik Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we do need this line because if the track id isn't found in the mail, then it recreate a ticket after the mail was collected even if a ticket was already created with an earlier email

@eldy eldy added the Discussion Some questions or discussions are opened and wait answers of author or other people to be processed label Apr 18, 2024
@@ -3043,7 +3063,7 @@ public function doCollectOneCollector($mode = 0)
// Create ticket
$tickettocreate = new Ticket($this->db);

$alreadycreated = $tickettocreate->fetch(0, '', '', $msgid);
$alreadycreated = $tickettocreate->fetch(0, '', $trackid, $msgid);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to add $trackid ?
$msgid is already unique so if we found a ticket with the msgid, we know it is already recorded in database.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but the $msgid is never the same between the mails, so if a ticket is already created and we receive a mail that responds to the mail that had created the ticket then the new mail needs to not create a ticket and be linked to the ticket (Done with another operation in collector config)

Copy link
Member

@eldy eldy Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but the $msgid is never the same between the mails, so if a ticket is already created and we receive a mail that responds to the mail that had created the ticket then the new mail needs to not create a ticket and be linked to the ticket (Done with another operation in collector config)

I see.

Note that if the ticket was created with the msgid and trackid was not set, if we collect another email for the same trackid, we will not find the email with the fetch() because into the fetch, the test on trackid and msgid is a AND, and we need a OR.
I think we must do a
$alreadycreated1 = $tickettocreate->fetch(0, '', $trackid, '');
$alreadycreated2 = $tickettocreate->fetch(0, '', '', $msgid);
$alreadycreated = $alreadycreated1 + $alreadycreated2;

Bur we need OR.

@eldy eldy merged commit bfa3853 into Dolibarr:develop Apr 27, 2024
7 checks passed
@Hystepik Hystepik deleted the Fix-emailcollector-ticket-tracking branch April 29, 2024 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Some questions or discussions are opened and wait answers of author or other people to be processed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants