Fix regression in email title (must contains ref of ticket)

Fix the status private is already stored in code, so we can show it in
list with a picto.
This commit is contained in:
Laurent Destailleur 2026-04-19 17:47:39 +02:00
parent 37bcbadc19
commit 531311c1be
5 changed files with 17 additions and 16 deletions

View file

@ -322,8 +322,11 @@ class FormActions
// Type
$labeltypelong = $actioncomm->getTypeLabel(2);
print '<td class="tdoverflowmax100 center" title="'.dolPrintHTML($labeltypelong).'">';
print '<td class="tdoverflowmax100 center valignmiddle" title="'.dolPrintHTML($labeltypelong).'">';
print $actioncomm->getTypePicto('valignmiddle');
if (preg_match('/PRIVATE/', $actioncomm->code)) {
print ' '.img_picto($langs->transnoentitiesnoconv("Private"), 'lock', 'class="valignmiddle"');
}
//$labeltype = $actioncomm->getTypeLabel(0);
//print $labeltype;
print '</td>';

View file

@ -1780,13 +1780,11 @@ class FormTicket
if ($this->withtitletopic) {
print '<tr><td><label for="summary"><span>'.$langs->trans("Summary").'</span></label></td><td>';
// Answer to a ticket : display of the thread title in readonly
if ($this->withtopicreadonly) {
if ($this->withtopicreadonly && $this->topic_title) {
print $langs->trans('Summary').' '.$this->topic_title;
} else {
if (isset($this->withreadid) && $this->withreadid > 0) {
$subject = $langs->trans('Summary').' '.$this->withreadid.' : '.$this->topic_title;
}
print '<input class="text minwidth500" maxlength="42" id="summary" name="summary" value="'.dolPrintHTMLForAttribute($this->topic_title).'"'.(empty($this->withemail) ? ' autofocus' : '').' />';
} elseif (empty($this->withtopicreadonly)) {
$subject = $this->topic_title;
print '<input class="text minwidth500" maxlength="42" id="summary" name="summary" placeholder="" value="'.dolPrintHTMLForAttribute($subject).'"'.(empty($this->withemail) ? ' autofocus' : '').' />';
}
print '</td></tr>';
}

View file

@ -219,6 +219,7 @@ if (in_array($action, array("view_ticket", "presend", "close", "confirm_public_c
}
}
// Actions to send emails (for ticket, we need to manage the addfile and removefile only)
$triggersendname = 'TICKET_SENTBYMAIL';
$paramname = 'id';
@ -408,7 +409,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
$formticket->withfile = 2;
$formticket->withcancel = 1;
$formticket->withtitletopic = 1;
$formticket->topic_title = $langs->trans('Summary').' '.$langs->trans('CreatedByPublicPortal');
//$formticket->topic_title = $langs->trans('Summary').' '.$langs->trans('CreatedByPublicPortal');
$formticket->showMessageForm('100%');
}

View file

@ -1603,7 +1603,7 @@ if ($action == 'create' || $action == 'presend') {
$formticket->backtopage = $backtopage;
$formticket->withtitletopic = 1;
$formticket->topic_title = $langs->trans('Message').' '.$langs->trans('Summary');
//$formticket->topic_title = $langs->trans('Message').' '.$langs->trans('Summary');
$formticket->showMessageForm('100%');
print '</div>';

View file

@ -1925,16 +1925,15 @@ class Ticket extends CommonObject
$actioncomm->email_from = $_SESSION['email_customer'];
}
$actioncomm->socid = $this->socid;
$actioncomm->label = $this->subject;
if ($summary) {
if ($this->private) {
$actioncomm->label = '['.$langs->trans('Private').'] '.((string) $summary);
} else {
$actioncomm->label = (string) $summary;
$actioncomm->label = preg_replace('/(\[[^\]]*\]).*$/', '\1', $actioncomm->label);
if ($actioncomm->label) {
$actioncomm->label .= ' ';
}
$actioncomm->email_subject = $this->subject;
} else {
$actioncomm->label = $this->subject;
$actioncomm->label .= (string) $summary;
}
$actioncomm->note_private = $this->message;
$actioncomm->userassigned = array($user->id => array('id' => $user->id,'transparency' => 0));
$actioncomm->userownerid = $user->id;