Skip to content

Commit

Permalink
Update ticket.class.php Bug-fix Issue #31206 (#31208)
Browse files Browse the repository at this point in the history
Fix Issue #31206 for the v.18 branch because unrelated tests failing on develop branch.
  • Loading branch information
cbeasley-sbb authored Oct 3, 2024
1 parent 5d58a33 commit 9af212a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions htdocs/ticket/class/ticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,8 @@ public function markAsRead($user, $notrigger = 0)
$this->oldcopy = dol_clone($this);

$this->db->begin();
$oldStatus = $this->fk_statut;
$this->fk_statut = Ticket::STATUS_READ;

$sql = "UPDATE ".MAIN_DB_PREFIX."ticket";
$sql .= " SET fk_statut = ".Ticket::STATUS_READ.", date_read = '".$this->db->idate(dol_now())."'";
Expand All @@ -1583,13 +1585,14 @@ public function markAsRead($user, $notrigger = 0)
dol_syslog(get_class($this)."::markAsRead");
$resql = $this->db->query($sql);
if ($resql) {
$this->actionmsg = $langs->trans('TicketLogMesgReadBy', $this->ref, $user->getFullName($langs));
$this->actionmsg2 = $langs->trans('TicketLogMesgReadBy', $this->ref, $user->getFullName($langs));
$this->context['actionmsg'] = $langs->trans('TicketLogMesgReadBy', $this->ref, $user->getFullName($langs));
$this->context['actionmsg2'] = $langs->trans('TicketLogMesgReadBy', $this->ref, $user->getFullName($langs));

if (!$error && !$notrigger) {
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('TICKET_MODIFY', $user);
if ($result < 0) {
$this->fk_statut = $oldStatus;
$error++;
}
// End call triggers
Expand All @@ -1599,12 +1602,14 @@ public function markAsRead($user, $notrigger = 0)
$this->db->commit();
return 1;
} else {
$this->fk_statut = $oldStatus;
$this->db->rollback();
$this->error = join(',', $this->errors);
$this->error = implode(',', $this->errors);
dol_syslog(get_class($this)."::markAsRead ".$this->error, LOG_ERR);
return -1;
}
} else {
$this->fk_statut = $oldStatus;
$this->db->rollback();
$this->error = $this->db->lasterror();
dol_syslog(get_class($this)."::markAsRead ".$this->error, LOG_ERR);
Expand Down

0 comments on commit 9af212a

Please sign in to comment.