fix: aggiunta nota ticket unito. feat: possiblità di visualizzare ticket in schede. feat: possibilità di creare un nuovo gruppo dall'interfaccia del ticket.
This commit is contained in:
+31
-2
@@ -742,7 +742,7 @@ router.patch('/:id', async (req, res) => {
|
||||
let current;
|
||||
try {
|
||||
const currentResult = await pool.query(
|
||||
`SELECT ticket_state_id, ticket_priority_id, queue_id, user_id, type_id, title, ticket_lock_id, customer_id, customer_user_id
|
||||
`SELECT ticket_state_id, ticket_priority_id, queue_id, user_id, responsible_user_id, type_id, title, ticket_lock_id, customer_id, customer_user_id
|
||||
FROM ticket WHERE id = $1`,
|
||||
[id]
|
||||
);
|
||||
@@ -763,6 +763,7 @@ router.patch('/:id', async (req, res) => {
|
||||
if (updates.ticket_priority_id !== undefined) ticketFields.PriorityID = updates.ticket_priority_id;
|
||||
if (updates.queue_id !== undefined) ticketFields.QueueID = updates.queue_id;
|
||||
if (updates.user_id !== undefined) ticketFields.OwnerID = updates.user_id;
|
||||
if (updates.responsible_user_id !== undefined) ticketFields.ResponsibleID = updates.responsible_user_id;
|
||||
if (updates.type_id !== undefined) ticketFields.TypeID = updates.type_id;
|
||||
if (updates.title !== undefined) ticketFields.Title = updates.title;
|
||||
if (updates.ticket_lock_id !== undefined) ticketFields.LockID = updates.ticket_lock_id;
|
||||
@@ -854,7 +855,7 @@ router.patch('/:id', async (req, res) => {
|
||||
const setParams = [];
|
||||
let pIdx = 1;
|
||||
|
||||
const allowedFields = ['ticket_state_id', 'ticket_priority_id', 'queue_id', 'user_id', 'type_id', 'title', 'ticket_lock_id', 'customer_id', 'customer_user_id'];
|
||||
const allowedFields = ['ticket_state_id', 'ticket_priority_id', 'queue_id', 'user_id', 'responsible_user_id', 'type_id', 'title', 'ticket_lock_id', 'customer_id', 'customer_user_id'];
|
||||
for (const field of allowedFields) {
|
||||
if (updates[field] !== undefined && updates[field] !== current[field]) {
|
||||
setClauses.push(`${field} = $${pIdx++}`);
|
||||
@@ -895,6 +896,7 @@ router.patch('/:id', async (req, res) => {
|
||||
ticket_priority_id: 'PriorityUpdate',
|
||||
queue_id: 'Move',
|
||||
user_id: 'OwnerUpdate',
|
||||
responsible_user_id: 'ResponsibleUpdate',
|
||||
type_id: 'TypeUpdate',
|
||||
ticket_lock_id: 'Lock',
|
||||
customer_id: 'CustomerUpdate',
|
||||
@@ -1795,6 +1797,33 @@ router.post('/merge', async (req, res) => {
|
||||
)`,
|
||||
[articleId, mergeNoteBody, contentPath, operatorId]
|
||||
);
|
||||
|
||||
// Create internal system note inside source ticket B (the merged ticket)
|
||||
const sourceArtResult = await client.query(
|
||||
`INSERT INTO article (
|
||||
ticket_id, article_sender_type_id, communication_channel_id,
|
||||
is_visible_for_customer, search_index_needs_rebuild,
|
||||
create_time, create_by, change_time, change_by
|
||||
) VALUES ($1, 1, 1, 0, 1, NOW(), $2, NOW(), $2) RETURNING id`,
|
||||
[sourceId, operatorId]
|
||||
);
|
||||
const sourceArticleId = sourceArtResult.rows[0].id;
|
||||
const sourceMergeNoteText = `Merged Ticket ${sourceTn} to ${targetTn}`;
|
||||
|
||||
await client.query(
|
||||
`INSERT INTO article_data_mime (
|
||||
article_id, a_from, a_to, a_reply_to, a_cc, a_bcc, a_subject, a_body,
|
||||
a_message_id, a_in_reply_to, a_references,
|
||||
a_content_type, incoming_time, content_path,
|
||||
create_time, create_by, change_time, change_by
|
||||
) VALUES (
|
||||
$1, 'Sistema OTRS Turbo', '', '', '', '', $2, $2,
|
||||
'', '', '',
|
||||
'text/plain; charset=utf-8', EXTRACT(EPOCH FROM NOW())::INTEGER, $3,
|
||||
NOW(), $4, NOW(), $4
|
||||
)`,
|
||||
[sourceArticleId, sourceMergeNoteText, contentPath, operatorId]
|
||||
);
|
||||
}
|
||||
|
||||
await client.query('COMMIT');
|
||||
|
||||
Reference in New Issue
Block a user