From 0db7847ba7cf64658b5ab48b86a1b0da57936fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 22 Oct 2020 23:24:11 +0200 Subject: [PATCH 1/3] Update intracommreport.class.php --- htdocs/intracommreport/class/intracommreport.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index b07d26150d6..982370c8657 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2019-2020 Open-DSI + * Copyright (C) 2020 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 @@ -189,7 +190,7 @@ class IntracommReport extends CommonObject } if ($exporttype == 'deb' && $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT > 0) { - $categ_fraisdeport = new Categorie(); + $categ_fraisdeport = new Categorie($this->db); $categ_fraisdeport->fetch($conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT); $TLinesFraisDePort = array(); } From 2146ce2deed39d0861625476d0c81f723e9e3456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 22 Oct 2020 23:37:29 +0200 Subject: [PATCH 2/3] Update intracommreport.class.php --- .../class/intracommreport.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index 982370c8657..fa5ba784124 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -92,7 +92,7 @@ class IntracommReport extends CommonObject /**************Construction de quelques variables********************/ $party_id = substr(strtr($mysoc->tva_intra, array(' '=>'')), 0, 4).$mysoc->idprof2; $declarant = substr($mysoc->managers, 0, 14); - $id_declaration = self::getNumeroDeclaration($this->numero_declaration); + $id_declaration = $this->getDeclarationNumber($this->numero_declaration); /********************************************************************/ /**************Construction du fichier XML***************************/ @@ -153,7 +153,7 @@ class IntracommReport extends CommonObject $declaration_des->addChild('an_des', $period_year); /**************Ajout des lignes de factures**************************/ - $res = self::addItemsFact($declaration_des, $type_declaration, $period_year.'-'.$period_month, 'des'); + $res = $this->addItemsFact($declaration_des, $type_declaration, $period_year.'-'.$period_month, 'des'); /********************************************************************/ $this->errors = array_unique($this->errors); @@ -317,11 +317,11 @@ class IntracommReport extends CommonObject /** * This function adds an item by retrieving the customs code of the product with the highest amount in the invoice * - * @param int $declaration Reference declaration - * @param int $TLinesFraisDePort Data of shipping costs line - * @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des) - * @param int $categ_fraisdeport Id of category of shipping costs - * @param int $i Line Id + * @param int $declaration Reference declaration + * @param int $TLinesFraisDePort Data of shipping costs line + * @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des) + * @param Categorie $categ_fraisdeport category of shipping costs + * @param int $i Line Id * @return void */ public function addItemFraisDePort(&$declaration, &$TLinesFraisDePort, $type, &$categ_fraisdeport, $i) From c2ea4f063b1c3f40a40457ae37f6950c59ebbd4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 22 Oct 2020 23:50:20 +0200 Subject: [PATCH 3/3] Update intracommreport.class.php --- .../class/intracommreport.class.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index fa5ba784124..4ed78234fbc 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -44,6 +44,11 @@ class IntracommReport extends CommonObject */ public $fk_element='fk_intracommreport'; + /** + * @var string declaration number + */ + public $declaration_number; + /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int @@ -92,7 +97,7 @@ class IntracommReport extends CommonObject /**************Construction de quelques variables********************/ $party_id = substr(strtr($mysoc->tva_intra, array(' '=>'')), 0, 4).$mysoc->idprof2; $declarant = substr($mysoc->managers, 0, 14); - $id_declaration = $this->getDeclarationNumber($this->numero_declaration); + $id_declaration = self::getDeclarationNumber($this->numero_declaration); /********************************************************************/ /**************Construction du fichier XML***************************/ @@ -380,17 +385,17 @@ class IntracommReport extends CommonObject */ public function getNextDeclarationNumber() { - $resql = $this->db->query('SELECT MAX(numero_declaration) as max_numero_declaration FROM '.$this->get_table().' WHERE exporttype="'.$this->exporttype.'"'); + $resql = $this->db->query('SELECT MAX(numero_declaration) as max_declaration_number FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE exporttype="'.$this->exporttype.'"'); if ($resql) $res = $this->db->fetch_object($resql); - return ($res->max_numero_declaration + 1); + return ($res->max_declaration_number + 1); } /** * Verify declaration number. Positive integer of a maximum of 6 characters recommended by the documentation * - * @param int $number Number to verify / convert - * @return int Number + * @param string $number Number to verify / convert + * @return string Number */ public static function getDeclarationNumber($number) {