fix: tentativo di fix per il riconoscimento del ticket ma otrs è stronzo-merda. feat: nella pagina di anteprima del ticket, aggiunto pulsante per aprire in una scheda interna.
This commit is contained in:
+4
-3
@@ -226,7 +226,7 @@ router.post('/send', async (req, res) => {
|
||||
if (!ticketResult.rows.length) return res.status(404).json({ error: 'Ticket non trovato' });
|
||||
|
||||
const { tn, title } = ticketResult.rows[0];
|
||||
const subject = customSubject || `Re: [Ticket#${tn}] ${title}`;
|
||||
const subject = customSubject || `[Ticket#${tn}] Re: ${title}`;
|
||||
|
||||
// 2. Build BCC list (include OTRS system mailbox if keepHelpdeskCopy is true)
|
||||
const bccList = [...bcc];
|
||||
@@ -263,7 +263,8 @@ router.post('/send', async (req, res) => {
|
||||
const messageId = `<${Date.now()}.${Math.random().toString(36).substring(2)}@pharmaidea.com>`;
|
||||
|
||||
// 3. Send via configured mailer (Graph API or SMTP)
|
||||
await sendMail({ to, cc, bcc: bccList, subject, bodyHtml: processedBodyHtml, attachments, inlineImages: finalInlineImages, inReplyTo, references, messageId });
|
||||
const mailResult = await sendMail({ to, cc, bcc: bccList, subject, bodyHtml: processedBodyHtml, attachments, inlineImages: finalInlineImages, inReplyTo, references, messageId });
|
||||
const finalMessageId = (mailResult && mailResult.internetMessageId) || messageId;
|
||||
|
||||
// 4. Log article in OTRS ticket via DB as a standard Email article
|
||||
try {
|
||||
@@ -308,7 +309,7 @@ router.post('/send', async (req, res) => {
|
||||
await pool.query(`
|
||||
INSERT INTO article_data_mime (article_id, a_from, a_to, a_cc, a_bcc, a_subject, a_body, a_content_type, a_message_id, incoming_time, create_time, create_by, change_time, change_by)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, 'text/html; charset=utf-8', $8, $9, $11, $10, $11, $10)`,
|
||||
[articleId, aFrom, toList, cc.join(', '), bccList.join(', '), subject, processedBodyHtml, messageId, now, agentId || 1, localNow]
|
||||
[articleId, aFrom, toList, cc.join(', '), bccList.join(', '), subject, processedBodyHtml, finalMessageId, now, agentId || 1, localNow]
|
||||
);
|
||||
|
||||
// Helper to strip HTML tags
|
||||
|
||||
Reference in New Issue
Block a user