FIX Debug ticket module (no double event when sending private message)
FIX The backtopage after sending ticket message was ko.
This commit is contained in:
parent
780c6e3ce1
commit
26d1182838
@ -1772,7 +1772,7 @@ class CMailFile
|
||||
$matches = array();
|
||||
preg_match_all('/src="data:image\/('.implode('|', $extensions).');base64,([^"]+)"/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found
|
||||
|
||||
if (!empty($matches)) {
|
||||
if (!empty($matches) && !empty($matches[1])) {
|
||||
if (empty($images_dir)) {
|
||||
// No temp directory provided, so we are not able to support convertion of data:image into physical images.
|
||||
$this->error = 'NoTempDirProvidedInCMailConstructorSoCantConvertDataImgOnDisk';
|
||||
|
||||
@ -1408,6 +1408,12 @@ class FormTicket
|
||||
$ticketstat = new Ticket($this->db);
|
||||
$res = $ticketstat->fetch('', '', $this->track_id);
|
||||
|
||||
print '<tr><td></td><td>';
|
||||
$checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':''));
|
||||
print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';
|
||||
print '<label for="send_msg_email">'.$langs->trans('SendMessageByEmail').'</label>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Private message (not visible by customer/external user)
|
||||
if (!$user->socid) {
|
||||
print '<tr><td></td><td>';
|
||||
@ -1418,12 +1424,6 @@ class FormTicket
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td></td><td>';
|
||||
$checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':''));
|
||||
print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';
|
||||
print '<label for="send_msg_email">'.$langs->trans('SendMessageByEmail').'</label>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Zone to select its email template
|
||||
if (count($modelmail_array) > 0) {
|
||||
print '<tr class="email_line"><td></td><td colspan="2"><div style="padding: 3px 0 3px 0">'."\n";
|
||||
@ -1610,7 +1610,7 @@ class FormTicket
|
||||
print '</table>';
|
||||
|
||||
print '<center><br>';
|
||||
print '<input type="submit" class="button" name="btn_add_message" value="'.$langs->trans("AddMessage").'" />';
|
||||
print '<input type="submit" class="button" name="btn_add_message" value="'.$langs->trans("Add").'" />';
|
||||
if ($this->withcancel) {
|
||||
print " ";
|
||||
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
|
||||
@ -194,8 +194,7 @@ TicketAssigned=Ticket is now assigned
|
||||
TicketChangeType=Change type
|
||||
TicketChangeCategory=Change analytic code
|
||||
TicketChangeSeverity=Change severity
|
||||
TicketAddMessage=Add a message
|
||||
AddMessage=Add a message
|
||||
TicketAddMessage=Add private message
|
||||
MessageSuccessfullyAdded=Ticket added
|
||||
TicketMessageSuccessfullyAdded=Message successfully added
|
||||
TicketMessagesList=Message list
|
||||
|
||||
@ -371,7 +371,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
|
||||
if ($object->dao->fk_statut < Ticket::STATUS_CLOSED) {
|
||||
// New message
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=presend&mode=init&track_id='.$object->dao->track_id.(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'').'">'.$langs->trans('AddMessage').'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=presend&mode=init&track_id='.$object->dao->track_id.(!empty($entity) && isModEnabled('multicompany')?'&entity='.$entity:'').'">'.$langs->trans('TicketAddMessage').'</a></div>';
|
||||
|
||||
// Close ticket
|
||||
if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) {
|
||||
|
||||
@ -444,11 +444,7 @@ if (empty($reshook)) {
|
||||
|
||||
if ($ret > 0) {
|
||||
if (!empty($backtopage)) {
|
||||
if (empty($id)) {
|
||||
$url = $backtopage;
|
||||
} else {
|
||||
$url = 'card.php?track_id='.urlencode($object->track_id);
|
||||
}
|
||||
$url = $backtopage;
|
||||
} else {
|
||||
$url = 'card.php?track_id='.urlencode($object->track_id);
|
||||
}
|
||||
@ -456,7 +452,7 @@ if (empty($reshook)) {
|
||||
header("Location: ".$url);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, null, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'presend';
|
||||
}
|
||||
}
|
||||
@ -690,6 +686,7 @@ if (empty($reshook)) {
|
||||
$permissiontoadd = $user->rights->ticket->write;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
//var_dump($action);exit;
|
||||
|
||||
// Actions to send emails
|
||||
$triggersendname = 'TICKET_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
|
||||
@ -164,7 +164,7 @@ class ActionsTicket
|
||||
} elseif ($action == 'view') {
|
||||
return $langs->trans("TicketCard");
|
||||
} elseif ($action == 'add_message') {
|
||||
return $langs->trans("AddMessage");
|
||||
return $langs->trans("TicketAddMessage");
|
||||
} else {
|
||||
return $langs->trans("TicketsManagement");
|
||||
}
|
||||
|
||||
@ -2792,7 +2792,7 @@ class Ticket extends CommonObject
|
||||
if ($result) {
|
||||
// update last_msg_sent date
|
||||
$this->date_last_msg_sent = dol_now();
|
||||
$this->update($user);
|
||||
$this->update($user, 1); // disable trigger when updatin date_last_msg_sent. sendTicketMessageByEmail already create an event in actioncomm table.
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2800,8 +2800,8 @@ class Ticket extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Set status to "answered" if not set yet, but only if internal user
|
||||
if ($object->status < 3 && !$user->socid) {
|
||||
// Set status to "answered" if not set yet, but only if internal user and not private message
|
||||
if ($object->status < 3 && !$user->socid && !$private) {
|
||||
$object->setStatut(3);
|
||||
}
|
||||
return 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user