Merge pull request #21718 from ATM-Consulting/NEW_add_oldcopy_for_ticket_triggers

NEW: add oldcopy to Ticket for modules intercepting TICKET_MODIFY
This commit is contained in:
Laurent Destailleur 2022-08-22 14:25:16 +02:00 committed by GitHub
commit 35de9843d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;
@ -865,6 +870,10 @@ class Ticket extends CommonObject
global $conf, $langs, $hookmanager;
$error = 0;
if (empty($notrigger)) {
$this->oldcopy = dol_clone($this, 1);
}
// Clean parameters
if (isset($this->ref)) {
$this->ref = trim($this->ref);
@ -1454,6 +1463,9 @@ class Ticket extends CommonObject
$error = 0;
if ($this->statut != self::STATUS_CANCELED) { // no closed
if (empty($notrigger)) {
$this->oldcopy = dol_clone($this, 1);
}
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."ticket";