Fix phpcs

This commit is contained in:
Laurent Destailleur 2022-06-13 15:03:45 +02:00
parent 00d3750ab1
commit 7ff9c86817

View File

@ -24,6 +24,7 @@
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/** /**
* Class to manage intracomm report * Class to manage intracomm report
*/ */
@ -285,34 +286,34 @@ class IntracommReport extends CommonObject
global $mysoc, $conf; global $mysoc, $conf;
if ($type == 'expedition' || $exporttype == 'des') { if ($type == 'expedition' || $exporttype == 'des') {
$sql = 'SELECT f.ref as refinvoice, f.total_ht'; $sql = "SELECT f.ref as refinvoice, f.total_ht";
$table = 'facture'; $table = 'facture';
$table_extraf = 'facture_extrafields'; $table_extraf = 'facture_extrafields';
$tabledet = 'facturedet'; $tabledet = 'facturedet';
$field_link = 'fk_facture'; $field_link = 'fk_facture';
} else { // Introduction } else { // Introduction
$sql = 'SELECT f.ref_supplier as refinvoice, f.total_ht'; $sql = "SELECT f.ref_supplier as refinvoice, f.total_ht";
$table = 'facture_fourn'; $table = 'facture_fourn';
$table_extraf = 'facture_fourn_extrafields'; $table_extraf = 'facture_fourn_extrafields';
$tabledet = 'facture_fourn_det'; $tabledet = 'facture_fourn_det';
$field_link = 'fk_facture_fourn'; $field_link = 'fk_facture_fourn';
} }
$sql .= ', l.fk_product, l.qty $sql .= ", l.fk_product, l.qty
, p.weight, p.rowid as id_prod, p.customcode , p.weight, p.rowid as id_prod, p.customcode
, s.rowid as id_client, s.nom, s.zip, s.fk_pays, s.tva_intra , s.rowid as id_client, s.nom, s.zip, s.fk_pays, s.tva_intra
, c.code , c.code
, ext.mode_transport , ext.mode_transport
FROM '.MAIN_DB_PREFIX.$tabledet.' l FROM ".MAIN_DB_PREFIX.$tabledet." l
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = l.'.$field_link.') INNER JOIN ".MAIN_DB_PREFIX.$table." f ON (f.rowid = l.".$this->db->escape($field_link).")
LEFT JOIN '.MAIN_DB_PREFIX.$table_extraf.' ext ON (ext.fk_object = f.rowid) LEFT JOIN ".MAIN_DB_PREFIX.$table_extraf." ext ON (ext.fk_object = f.rowid)
INNER JOIN '.MAIN_DB_PREFIX.'product p ON (p.rowid = l.fk_product) INNER JOIN ".MAIN_DB_PREFIX."product p ON (p.rowid = l.fk_product)
INNER JOIN '.MAIN_DB_PREFIX.'societe s ON (s.rowid = f.fk_soc) INNER JOIN ".MAIN_DB_PREFIX."societe s ON (s.rowid = f.fk_soc)
LEFT JOIN '.MAIN_DB_PREFIX.'c_country c ON (c.rowid = s.fk_pays) LEFT JOIN ".MAIN_DB_PREFIX."c_country c ON (c.rowid = s.fk_pays)
WHERE f.fk_statut > 0 WHERE f.fk_statut > 0
AND l.product_type = '.($exporttype == 'des' ? 1 : 0).' AND l.product_type = ".($exporttype == "des" ? 1 : 0)."
AND f.entity = '.$conf->entity.' AND f.entity = ".((int) $conf->entity)."
AND (s.fk_pays <> '.$mysoc->country_id.' OR s.fk_pays IS NULL) AND (s.fk_pays <> ".((int) $mysoc->country_id)." OR s.fk_pays IS NULL)
AND f.datef BETWEEN "'.$period_reference.'-01" AND "'.$period_reference.'-'.date('t').'"'; AND f.datef BETWEEN '".$this->db->escape($period_reference)."-01' AND '".$this->db->escape($period_reference)."-".date('t')."'";
return $sql; return $sql;
} }
@ -398,27 +399,27 @@ class IntracommReport extends CommonObject
} }
foreach ($TLinesFraisDePort as $res) { foreach ($TLinesFraisDePort as $res) {
$sql = 'SELECT p.customcode $sql = "SELECT p.customcode
FROM '.MAIN_DB_PREFIX.$tabledet.' d FROM ".MAIN_DB_PREFIX.$tabledet." d
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = d.'.$field_link.') INNER JOIN ".MAIN_DB_PREFIX.$table." f ON (f.rowid = d.".$this->db->escape($field_link).")
INNER JOIN '.MAIN_DB_PREFIX.'product p ON (p.rowid = d.fk_product) INNER JOIN ".MAIN_DB_PREFIX."product p ON (p.rowid = d.fk_product)
WHERE d.fk_product IS NOT NULL WHERE d.fk_product IS NOT NULL
AND f.entity = '.$conf->entity.' AND f.entity = ".((int) $conf->entity)."
AND '.$more_sql.' = "'.$res->refinvoice.'" AND ".$more_sql." = '".$this->db->escape($res->refinvoice)."'
AND d.total_ht = AND d.total_ht =
( (
SELECT MAX(d.total_ht) SELECT MAX(d.total_ht)
FROM '.MAIN_DB_PREFIX.$tabledet.' d FROM ".MAIN_DB_PREFIX.$tabledet." d
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = d.'.$field_link.') INNER JOIN ".MAIN_DB_PREFIX.$table." f ON (f.rowid = d.".$this->db->escape($field_link).")
WHERE d.fk_product IS NOT NULL WHERE d.fk_product IS NOT NULL
AND '.$more_sql.' = "'.$res->refinvoice.'" AND ".$more_sql." = '".$this->db->escape($res->refinvoice)."'
AND d.fk_product NOT IN AND d.fk_product NOT IN
( (
SELECT fk_product SELECT fk_product
FROM '.MAIN_DB_PREFIX.'categorie_product FROM ".MAIN_DB_PREFIX."categorie_product
WHERE fk_categorie = '.((int) $categ_fraisdeport->id).' WHERE fk_categorie = ".((int) $categ_fraisdeport->id)."
) )
)'; )";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
$ress = $this->db->fetch_object($resql); $ress = $this->db->fetch_object($resql);
@ -436,7 +437,8 @@ class IntracommReport extends CommonObject
*/ */
public function getNextDeclarationNumber() public function getNextDeclarationNumber()
{ {
$sql = 'SELECT MAX(numero_declaration) as max_declaration_number FROM '.MAIN_DB_PREFIX.$this->table_element." WHERE exporttype='".$this->db->escape($this->exporttype)."'"; $sql = "SELECT MAX(numero_declaration) as max_declaration_number FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE exporttype = '".$this->db->escape($this->exporttype)."'";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$res = $this->db->fetch_object($resql); $res = $this->db->fetch_object($resql);