From 64119917a43bdbe445ca4a242a569a540984ec75 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 27 Jan 2022 13:35:03 +0100 Subject: [PATCH] FIX avoid travis error use double quote instead simple quote --- htdocs/product/class/api_products.class.php | 4 +-- .../class/productfournisseurprice.class.php | 16 ++++++------ .../inventory/class/inventory.class.php | 26 +++++++++---------- htdocs/product/stock/class/entrepot.class.php | 6 ++--- .../stock/class/mouvementstock.class.php | 12 ++++----- .../product/stock/class/productlot.class.php | 8 +++--- .../class/productstockentrepot.class.php | 24 ++++++++--------- 7 files changed, 48 insertions(+), 48 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index d271631ca22..64db556a1d6 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1484,8 +1484,8 @@ class Products extends DolibarrApi $return = array(); - $sql = 'SELECT '; - $sql .= 'v.fk_product_attribute, v.rowid, v.ref, v.value FROM '.$this->db->prefix().'product_attribute_value as v'; + $sql = "SELECT "; + $sql .= "v.fk_product_attribute, v.rowid, v.ref, v.value FROM ".$this->db->prefix()."product_attribute_value as v"; $sql .= " WHERE v.fk_product_attribute IN (SELECT rowid FROM ".$this->db->prefix()."product_attribute WHERE ref LIKE '".$this->db->escape($ref)."')"; $resql = $this->db->query($sql); diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index 0ce6868fd0c..54919ac0be6 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -316,11 +316,11 @@ class ProductFournisseurPrice extends CommonObject $records = array(); - $sql = 'SELECT '; + $sql = "SELECT "; $sql .= $this->getFieldList(); - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; - if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')'; - else $sql .= ' WHERE 1 = 1'; + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; + if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($this->element).")"; + else $sql .= " WHERE 1 = 1"; // Manage filter $sqlwhere = array(); if (count($filter) > 0) { @@ -698,10 +698,10 @@ class ProductFournisseurPrice extends CommonObject */ public function info($id) { - $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; - $sql .= ' fk_user_creat, fk_user_modif'; - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; - $sql .= ' WHERE t.rowid = '.((int) $id); + $sql = "SELECT rowid, date_creation as datec, tms as datem,"; + $sql .= " fk_user_creat, fk_user_modif"; + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; + $sql .= " WHERE t.rowid = ".((int) $id); $result = $this->db->query($sql); if ($result) { if ($this->db->num_rows($result)) { diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index f0157e52009..92061972e60 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -275,21 +275,21 @@ class Inventory extends CommonObject } // Scan existing stock to prefill the inventory - $sql = 'SELECT ps.rowid, ps.fk_entrepot as fk_warehouse, ps.fk_product, ps.reel,'; - $sql .= ' pb.batch, pb.qty'; - $sql .= ' FROM '.$this->db->prefix().'product_stock as ps'; - $sql .= ' LEFT JOIN '.$this->db->prefix().'product_batch as pb ON pb.fk_product_stock = ps.rowid,'; - $sql .= ' '.$this->db->prefix().'product as p, '.$this->db->prefix().'entrepot as e'; - $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; - $sql .= ' AND ps.fk_product = p.rowid AND ps.fk_entrepot = e.rowid'; + $sql = "SELECT ps.rowid, ps.fk_entrepot as fk_warehouse, ps.fk_product, ps.reel,"; + $sql .= " pb.batch, pb.qty"; + $sql .= " FROM ".$this->db->prefix()."product_stock as ps"; + $sql .= " LEFT JOIN ".$this->db->prefix()."product_batch as pb ON pb.fk_product_stock = ps.rowid,"; + $sql .= " ".$this->db->prefix()."product as p, ".$this->db->prefix()."entrepot as e"; + $sql .= " WHERE p.entity IN (".getEntity('product').")"; + $sql .= " AND ps.fk_product = p.rowid AND ps.fk_entrepot = e.rowid"; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $sql .= " AND p.fk_product_type = 0"; } if ($this->fk_product > 0) { - $sql .= ' AND ps.fk_product = '.((int) $this->fk_product); + $sql .= " AND ps.fk_product = ".((int) $this->fk_product); } if ($this->fk_warehouse > 0) { - $sql .= ' AND ps.fk_entrepot = '.((int) $this->fk_warehouse); + $sql .= " AND ps.fk_entrepot = ".((int) $this->fk_warehouse); } $inventoryline = new InventoryLine($this->db); @@ -640,10 +640,10 @@ class Inventory extends CommonObject */ public function info($id) { - $sql = 'SELECT rowid, date_creation as datec, tms as datem, date_validation as datev,'; - $sql .= ' fk_user_creat, fk_user_modif, fk_user_valid'; - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; - $sql .= ' WHERE t.rowid = '.((int) $id); + $sql = "SELECT rowid, date_creation as datec, tms as datem, date_validation as datev,"; + $sql .= " fk_user_creat, fk_user_modif, fk_user_valid"; + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; + $sql .= " WHERE t.rowid = ".((int) $id); $result = $this->db->query($sql); if ($result) { if ($this->db->num_rows($result)) { diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 47d63b06568..8423ebdea6f 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -852,9 +852,9 @@ class Entrepot extends CommonObject { // phpcs:enable - $sql = 'SELECT rowid - FROM '.$this->db->prefix().'entrepot - WHERE fk_parent = '.((int) $id); + $sql = "SELECT rowid + FROM ".$this->db->prefix()."entrepot + WHERE fk_parent = ".((int) $id); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index e79021e5534..b53d67f1bd2 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -626,8 +626,8 @@ class MouvementStock extends CommonObject { dol_syslog(__METHOD__, LOG_DEBUG); - $sql = 'SELECT'; - $sql .= ' t.rowid,'; + $sql = "SELECT"; + $sql .= " t.rowid,"; $sql .= " t.tms,"; $sql .= " t.datem,"; $sql .= " t.fk_product,"; @@ -644,8 +644,8 @@ class MouvementStock extends CommonObject $sql .= " t.eatby,"; $sql .= " t.sellby,"; $sql .= " t.fk_projet as fk_project"; - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; - $sql .= ' WHERE t.rowid = '.((int) $id); + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; + $sql .= " WHERE t.rowid = ".((int) $id); $resql = $this->db->query($sql); if ($resql) { @@ -824,8 +824,8 @@ class MouvementStock extends CommonObject { $nb = 0; - $sql = 'SELECT SUM(value) as nb from '.$this->db->prefix().'stock_mouvement'; - $sql .= ' WHERE fk_product = '.((int) $productidselected); + $sql = "SELECT SUM(value) as nb from ".$this->db->prefix()."stock_mouvement"; + $sql .= " WHERE fk_product = ".((int) $productidselected); $sql .= " AND datem < '".$this->db->idate($datebefore)."'"; dol_syslog(get_class($this).__METHOD__.'', LOG_DEBUG); diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 9a9106a341b..fdb82800067 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -279,8 +279,8 @@ class Productlot extends CommonObject global $conf; dol_syslog(__METHOD__, LOG_DEBUG); - $sql = 'SELECT'; - $sql .= ' t.rowid,'; + $sql = "SELECT"; + $sql .= " t.rowid,"; $sql .= " t.entity,"; $sql .= " t.fk_product,"; $sql .= " t.batch,"; @@ -296,11 +296,11 @@ class Productlot extends CommonObject $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_modif,"; $sql .= " t.import_key"; - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; if ($product_id > 0 && $batch != '') { $sql .= " WHERE t.batch = '".$this->db->escape($batch)."' AND t.fk_product = ".((int) $product_id); } else { - $sql .= ' WHERE t.rowid = '.((int) $id); + $sql .= " WHERE t.rowid = ".((int) $id); } $resql = $this->db->query($sql); diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php index 105e38c5136..95da65cd540 100644 --- a/htdocs/product/stock/class/productstockentrepot.class.php +++ b/htdocs/product/stock/class/productstockentrepot.class.php @@ -184,19 +184,19 @@ class ProductStockEntrepot extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); - $sql = 'SELECT'; - $sql .= ' t.rowid,'; + $sql = "SELECT"; + $sql .= " t.rowid,"; $sql .= " t.tms,"; $sql .= " t.fk_product,"; $sql .= " t.fk_entrepot,"; $sql .= " t.seuil_stock_alerte,"; $sql .= " t.desiredstock,"; $sql .= " t.import_key"; - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; if (!empty($id)) { - $sql .= ' WHERE t.rowid = '.((int) $id); + $sql .= " WHERE t.rowid = ".((int) $id); } else { - $sql .= ' WHERE t.fk_product = '.((int) $fk_product).' AND t.fk_entrepot = '.((int) $fk_entrepot); + $sql .= " WHERE t.fk_product = ".((int) $fk_product)." AND t.fk_entrepot = ".((int) $fk_entrepot); } $resql = $this->db->query($sql); @@ -254,8 +254,8 @@ class ProductStockEntrepot extends CommonObject { dol_syslog(__METHOD__, LOG_DEBUG); - $sql = 'SELECT'; - $sql .= ' t.rowid,'; + $sql = "SELECT"; + $sql .= " t.rowid,"; $sql .= " t.tms,"; $sql .= " t.fk_product,"; @@ -265,9 +265,9 @@ class ProductStockEntrepot extends CommonObject $sql .= " t.import_key"; - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; - $sql .= ' WHERE 1=1'; + $sql .= " WHERE 1=1"; // Manage filter $sqlwhere = array(); @@ -277,13 +277,13 @@ class ProductStockEntrepot extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND '.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere); + $sql .= " AND ".implode(' '.$this->db->escape($filtermode).' ', $sqlwhere); } if (!empty($fk_product) && $fk_product > 0) { - $sql .= ' AND fk_product = '.((int) $fk_product); + $sql .= " AND fk_product = ".((int) $fk_product); } elseif (!empty($fk_entrepot) && $fk_entrepot > 0) { - $sql .= ' AND fk_entrepot = '.((int) $fk_entrepot); + $sql .= " AND fk_entrepot = ".((int) $fk_entrepot); } // "elseif" used instead of "if" because getting list with specified fk_product and specified fk_entrepot would be the same as doing a fetch