From f2dbc418f1723abb43c26735d20730e8873ec705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Tue, 12 Sep 2023 18:40:55 +0200 Subject: [PATCH] phpstan --- .../modules/import/import_csv.modules.php | 12 ----- .../modules/import/import_xlsx.modules.php | 12 ----- htdocs/core/modules/import/modules_import.php | 49 ++++++++++++++++--- 3 files changed, 43 insertions(+), 30 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 29cd8ca5a21..70371759c26 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -38,18 +38,6 @@ class ImportCsv extends ModeleImports */ public $db; - public $datatoimport; - - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); - /** * @var string Code of driver */ diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index c05fabc5968..2cc901bdda1 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -42,18 +42,6 @@ class ImportXlsx extends ModeleImports */ public $db; - public $datatoimport; - - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); - /** * @var string Code of driver */ diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index 5b665c8e2cf..e7df2f9dd14 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -22,7 +22,7 @@ * \ingroup export * \brief File of parent class for import file readers */ -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; /** @@ -42,6 +42,16 @@ class ModeleImports */ public $error = ''; + /** + * @var string[] Error codes (or messages) + */ + public $errors = array(); + + /** + * @var string[] warnings codes (or messages) + */ + public $warnings = array(); + /** * @var string Code of driver */ @@ -75,8 +85,35 @@ class ModeleImports public $libversion = array(); + /** + * @var string charset + */ public $charset; + /** + * @var string picto + */ + public $picto; + + /** + * @var string description + */ + public $desc; + + /** + * @var string escape + */ + public $escape; + + /** + * @var string enclosure + */ + public $enclosure; + + /** + * @var Societe thirdparty + */ + public $thirdpartyobject; /** * @var array Element mapping from table name @@ -206,9 +243,9 @@ class ModeleImports */ public function listOfAvailableImportFormat($db, $maxfilenamelength = 0) { - dol_syslog(get_class($this)."::listOfAvailableImportFormat"); + dol_syslog(get_class($this) . "::listOfAvailableImportFormat"); - $dir = DOL_DOCUMENT_ROOT."/core/modules/import/"; + $dir = DOL_DOCUMENT_ROOT . "/core/modules/import/"; $handle = opendir($dir); // Recherche des fichiers drivers imports disponibles @@ -219,8 +256,8 @@ class ModeleImports $moduleid = $reg[1]; // Loading Class - $file = $dir."/import_".$moduleid.".modules.php"; - $classname = "Import".ucfirst($moduleid); + $file = $dir . "/import_" . $moduleid . ".modules.php"; + $classname = "Import" . ucfirst($moduleid); require_once $file; $module = new $classname($db, ''); @@ -318,7 +355,7 @@ class ModeleImports */ public function getElementFromTableWithPrefix($tableNameWithPrefix) { - $tableElement = preg_replace('/^'.preg_quote($this->db->prefix(), '/').'/', '', $tableNameWithPrefix); + $tableElement = preg_replace('/^' . preg_quote($this->db->prefix(), '/') . '/', '', $tableNameWithPrefix); $element = $tableElement; if (isset(self::$mapTableToElement[$tableElement])) {