Skip to content

Commit

Permalink
Merge branch '18.0' of [email protected]:Dolibarr/dolibarr.git into 19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Oct 3, 2024
2 parents 6a09e7c + 9af212a commit bb69cd7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions htdocs/ticket/class/ticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,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 @@ -1639,10 +1641,11 @@ public function markAsRead($user, $notrigger = 0)
$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 @@ -1652,12 +1655,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 bb69cd7

Please sign in to comment.