Merge pull request #9757 from frederic34/patch-9

do not trim int
This commit is contained in:
Laurent Destailleur 2018-10-16 19:37:07 +02:00 committed by GitHub
commit f1c85cb36d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -103,9 +104,9 @@ class Tva extends CommonObject
$this->amount=trim($this->amount);
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
$this->fk_bank = (int) $this->fk_bank;
$this->fk_user_creat = (int) $this->fk_user_creat;
$this->fk_user_modif = (int) $this->fk_user_modif;
// Check parameters
// Put here code to add control on parameters values
@ -182,9 +183,9 @@ class Tva extends CommonObject
$this->amount=trim($this->amount);
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
$this->fk_bank = (int) $this->fk_bank;
$this->fk_user_creat = (int) $this->fk_user_creat;
$this->fk_user_modif = (int) $this->fk_user_modif;
// Check parameters
// Put here code to add control on parameters values
@ -519,9 +520,9 @@ class Tva extends CommonObject
$this->amount=price2num(trim($this->amount));
$this->label=trim($this->label);
$this->note=trim($this->note);
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
$this->fk_bank = (int) $this->fk_bank;
$this->fk_user_creat = (int) $this->fk_user_creat;
$this->fk_user_modif = (int) $this->fk_user_modif;
if (empty($this->datec)) $this->datec = dol_now();
// Check parameters
@ -663,8 +664,8 @@ class Tva extends CommonObject
function update_fk_bank($id_bank)
{
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'tva SET fk_bank = '.$id_bank;
$sql.= ' WHERE rowid = '.$this->id;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'tva SET fk_bank = '.(int) $id_bank;
$sql.= ' WHERE rowid = '.(int) $this->id;
$result = $this->db->query($sql);
if ($result)
{
@ -769,7 +770,7 @@ class Tva extends CommonObject
{
$sql = "SELECT t.rowid, t.tms, t.fk_user_modif, t.datec, t.fk_user_creat";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
$sql.= " WHERE t.rowid = ".$id;
$sql.= " WHERE t.rowid = ".(int) $id;
dol_syslog(get_class($this)."::info", LOG_DEBUG);
$result=$this->db->query($sql);