From 3c182d4dee3a6670e974bcc1a113c4f7b4fb4e4d Mon Sep 17 00:00:00 2001 From: atm-florian Date: Thu, 11 Aug 2022 14:57:56 +0200 Subject: [PATCH] NEW: add oldcopy to Ticket so triggers intercepting TICKET_MODIFY have access to old values of the updated properties --- htdocs/ticket/class/ticket.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 496e6607bf7..d88fc15ade4 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -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++;