Merge pull request #9794 from frederic34/patch-19

do not trim int
This commit is contained in:
Laurent Destailleur 2018-10-19 12:51:26 +02:00 committed by GitHub
commit 9eed87da8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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