Ticket system bugfix received recipients

This commit is contained in:
Xenomporio 2022-08-07 12:07:55 +02:00
parent 17f0efcc68
commit 7ff7e6bfd6

View File

@ -400,18 +400,18 @@ class TicketImportHelper
$this->updateTicketMessagesCount($ticketNumber); $this->updateTicketMessagesCount($ticketNumber);
$this->resetTicketStatus($ticketNumber); $this->resetTicketStatus($ticketNumber);
// $this->db->commit(); // $this->db->commit();
$success = 1; $result = $messageId;
$this->markTicketMessagesCompleted($ticketNumber); $this->markTicketMessagesCompleted($ticketNumber);
} catch (Throwable $e) { } catch (Throwable $e) {
// $this->db->rollBack(); // $this->db->rollBack();
$success = 0; $result = 0;
$this->logger->error('Failed to insert ticket message into db', ['exception' => $e]); $this->logger->error('Failed to insert ticket message into db', ['exception' => $e]);
} }
$this->applyTicketRules($messageId); $this->applyTicketRules($messageId);
return($success); return($result);
} }
public function applyTicketRules(int $ticketMessageId): void public function applyTicketRules(int $ticketMessageId): void
@ -692,12 +692,16 @@ class TicketImportHelper
$cc_recv = []; $cc_recv = [];
} }
$this->logger->debug('Add recipients to header',['count' => count($message->getRecipients())]);
// Add all the recipients to the header table // Add all the recipients to the header table
if (count($message->getRecipients()) > 0) { if (count($message->getRecipients()) > 0) {
foreach ($message->getRecipients() as $recipient) { foreach ($message->getRecipients() as $recipient) {
$recipient_address = $this->db->real_escape_string($recipient->getEmail()); $recipient_address = $this->db->real_escape_string($recipient->getEmail());
$this->logger->debug('Add recipient to header',['address' => $recipient_address]);
if ($recipient_address != '') { if ($recipient_address != '') {
$sql = "INSERT INTO ticket_header $sql = "INSERT INTO ticket_header
(`id`,`ticket_nachricht`,`type`,`value`) (`id`,`ticket_nachricht`,`type`,`value`)