diff --git a/htdocs/ticket/class/ticketlogs.class.php b/htdocs/ticket/class/ticketlogs.class.php index 79a4c95efed..66cecd6eb5e 100644 --- a/htdocs/ticket/class/ticketlogs.class.php +++ b/htdocs/ticket/class/ticketlogs.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2013-2016 Jean-François FERRY + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,12 +64,12 @@ class Ticketlogs// extends CommonObject public $id; /** - * @var int ID + * @var string trackid */ public $fk_track_id; /** - * @var int ID + * @var int user create ID */ public $fk_user_create; @@ -104,7 +105,7 @@ class Ticketlogs// extends CommonObject } if (isset($this->fk_user_create)) { - $this->fk_user_create = trim($this->fk_user_create); + $this->fk_user_create = (int) $this->fk_user_create; } if (isset($this->message)) { @@ -143,7 +144,7 @@ class Ticketlogs// extends CommonObject if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "ticket_logs"); - if (!$notrigger) { + //if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -153,7 +154,7 @@ class Ticketlogs// extends CommonObject //$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } + //} } // Commit or rollback @@ -232,7 +233,7 @@ class Ticketlogs// extends CommonObject } if (isset($this->fk_user_create)) { - $this->fk_user_create = trim($this->fk_user_create); + $this->fk_user_create = (int) $this->fk_user_create; } if (isset($this->message)) { @@ -261,8 +262,8 @@ class Ticketlogs// extends CommonObject $this->errors[] = "Error " . $this->db->lasterror(); } - if (!$error) { - if (!$notrigger) { + //if (!$error) { + //if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -272,8 +273,8 @@ class Ticketlogs// extends CommonObject //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + //} + //} // Commit or rollback if ($error) { @@ -303,8 +304,8 @@ class Ticketlogs// extends CommonObject $this->db->begin(); - if (!$error) { - if (!$notrigger) { + //if (!$error) { + //if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -314,8 +315,8 @@ class Ticketlogs// extends CommonObject //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + //} + //} if (!$error) { $sql = "DELETE FROM " . MAIN_DB_PREFIX . "ticket_logs"; @@ -351,10 +352,12 @@ class Ticketlogs// extends CommonObject */ public function initAsSpecimen() { + global $user; + $this->id = 0; $this->fk_track_id = ''; - $this->fk_user_create = ''; + $this->fk_user_create = $user->id; $this->datec = ''; $this->message = ''; }