fix: dopo l'unificazione messaggio rapido e nota, non funzionava più la consuntivazione senza inserire oggetto o corpo.

This commit is contained in:
Gabriele Cimaschi committed 2026-09-14 10:53:49 +02:00
1 parent 44c89aa92f
commit c33a7a4666
1 file changed
+6 -4
+6 -4
View File
@@ -3755,14 +3755,16 @@ const TicketDetailView = {
// 2. Perform article note creation if note fields are populated // 2. Perform article note creation if note fields are populated
if (hasNoteContent) { if (hasNoteContent) {
if (!noteBody && noteSubject) { if (!noteSubject && !noteBody) {
noteSubject = 'consuntivazione';
noteBody = '<p>consuntivazione</p>';
} else if (!noteBody && noteSubject) {
noteBody = `<p>${App.escapeHtml(noteSubject)}</p>`; noteBody = `<p>${App.escapeHtml(noteSubject)}</p>`;
} } else if (noteBody && !noteSubject) {
if (noteBody && !noteSubject) {
const tempDiv = document.createElement('div'); const tempDiv = document.createElement('div');
tempDiv.innerHTML = noteBody; tempDiv.innerHTML = noteBody;
const plainText = tempDiv.textContent || tempDiv.innerText || ''; const plainText = tempDiv.textContent || tempDiv.innerText || '';
noteSubject = plainText.trim().substring(0, 50) || 'Nota interna'; noteSubject = plainText.trim().substring(0, 50) || 'consuntivazione';
} }
const resNote = await App.api(`/api/tickets/${this.ticketId}/articles`, { const resNote = await App.api(`/api/tickets/${this.ticketId}/articles`, {