From 456bdb5b8c6020480899165f4cbb34ee8ce40fd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 17 Oct 2018 20:04:48 +0200 Subject: [PATCH 1/2] do not trim int --- htdocs/ticket/class/ticketlogs.class.php | 33 ++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/htdocs/ticket/class/ticketlogs.class.php b/htdocs/ticket/class/ticketlogs.class.php index 79a4c95efed..68ce6481b31 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"; @@ -354,7 +355,7 @@ class Ticketlogs// extends CommonObject $this->id = 0; $this->fk_track_id = ''; - $this->fk_user_create = ''; + $this->fk_user_create = 1; $this->datec = ''; $this->message = ''; } From 4bdde9ad56108ff5ef57cb3074dffc6247394676 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Oct 2018 12:51:14 +0200 Subject: [PATCH 2/2] Update ticketlogs.class.php --- htdocs/ticket/class/ticketlogs.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticketlogs.class.php b/htdocs/ticket/class/ticketlogs.class.php index 68ce6481b31..66cecd6eb5e 100644 --- a/htdocs/ticket/class/ticketlogs.class.php +++ b/htdocs/ticket/class/ticketlogs.class.php @@ -352,10 +352,12 @@ class Ticketlogs// extends CommonObject */ public function initAsSpecimen() { + global $user; + $this->id = 0; $this->fk_track_id = ''; - $this->fk_user_create = 1; + $this->fk_user_create = $user->id; $this->datec = ''; $this->message = ''; }