NEW: add oldcopy to Ticket so triggers intercepting TICKET_MODIFY have access to old values of the updated properties

This commit is contained in:
atm-florian 2022-08-11 14:57:56 +02:00
parent febc1b8600
commit 3c182d4dee

View File

@ -212,6 +212,11 @@ class Ticket extends CommonObject
*/
public $email_date;
/**
* @var Ticket $oldcopy State of this ticket as it was stored before an update operation (for triggers)
*/
public $oldcopy;
public $lines;
@ -974,6 +979,10 @@ class Ticket extends CommonObject
if (!$error && !$notrigger) {
// Call trigger
if (empty($this->oldcopy)) {
$this->oldcopy = new self($this->db);
$this->oldcopy->fetch($this->id);
}
$result = $this->call_trigger('TICKET_MODIFY', $user);
if ($result < 0) {
$error++;