uvdesk / mailbox-component

The Mailbox component provides tools that allows your helpdesk to process tickets from multiple email sources.
MIT License
23 stars 40 forks source link

Emails from same sender with same subject line not created #68

Closed slawn closed 3 years ago

slawn commented 3 years ago

Using latest version of UV Desk - PHP 7.2. If the same sender sends another ticket with the same subject line and another one already exists - no new ticket is created. This is an issue because for example we have a request type form that sends an email with the same subject - "New Site Request" - and from the same sender - and only the first one got picked up. No alert, error etc is thrown.

This is because in this file - basically if it finds ticket with same subject and same sender - it rejects it. This is wrong behaviour - it should simply create a new ticket.

mailbox-component/Services/MailboxService.php

    if (empty($ticket)) {
        $mailData['threadType'] = 'create';
        $mailData['referenceIds'] = $mailData['messageId'];

        **$ticketSubjectRefrenceExist = $this->searchticketSubjectRefrence($mailData['from'], $mailData['subject']);

        if(!empty($ticketSubjectRefrenceExist)) {
            return;
        }**

        $thread = $this->container->get('ticket.service')->createTicket($mailData);

        // Trigger ticket created event
        $event = new GenericEvent(CoreWorkflowEvents\Ticket\Create::getId(), [
            'entity' =>  $thread->getTicket(),
        ]);

        $this->container->get('event_dispatcher')->dispatch('uvdesk.automation.workflow.execute', $event);
    }
papnoisanjeev commented 3 years ago

@slawn

Updated here.