From 9e8165f1ab8eef8a96a9e72e60fcb58d9d8eb1e6 Mon Sep 17 00:00:00 2001 From: data Date: Mon, 2 Feb 2026 20:33:40 +0100 Subject: [PATCH] =?UTF-8?q?SQL=20Datenbank=20anpassung=20gekl=C3=A4rt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/importline.class.php | 13 +++++-------- core/modules/modImportZugferd.class.php | 2 +- sql/dolibarr_allversions.sql | 7 +++++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/class/importline.class.php b/class/importline.class.php index 1f54d90..6932a35 100644 --- a/class/importline.class.php +++ b/class/importline.class.php @@ -215,11 +215,8 @@ class ImportLine */ public function fetch($id) { - $sql = "SELECT rowid, fk_import, line_id, supplier_ref, product_name, description,"; - $sql .= " quantity, unit_code, unit_price, unit_price_raw, basis_quantity, basis_quantity_unit,"; - $sql .= " line_total, tax_percent, ean, copper_surcharge, copper_surcharge_basis_qty,"; - $sql .= " fk_product, fk_datanorm, match_method, date_creation"; - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; + // Use SELECT * to be compatible with older database versions without fk_datanorm column + $sql = "SELECT * FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " WHERE rowid = " . ((int) $id); $resql = $this->db->query($sql); @@ -242,10 +239,10 @@ class ImportLine $this->line_total = $obj->line_total; $this->tax_percent = $obj->tax_percent; $this->ean = $obj->ean; - $this->copper_surcharge = $obj->copper_surcharge; - $this->copper_surcharge_basis_qty = $obj->copper_surcharge_basis_qty; + $this->copper_surcharge = isset($obj->copper_surcharge) ? $obj->copper_surcharge : null; + $this->copper_surcharge_basis_qty = isset($obj->copper_surcharge_basis_qty) ? $obj->copper_surcharge_basis_qty : null; $this->fk_product = $obj->fk_product; - $this->fk_datanorm = $obj->fk_datanorm; + $this->fk_datanorm = isset($obj->fk_datanorm) ? $obj->fk_datanorm : null; $this->match_method = $obj->match_method; $this->date_creation = $this->db->jdate($obj->date_creation); return 1; diff --git a/core/modules/modImportZugferd.class.php b/core/modules/modImportZugferd.class.php index 7127695..495e906 100755 --- a/core/modules/modImportZugferd.class.php +++ b/core/modules/modImportZugferd.class.php @@ -76,7 +76,7 @@ class modImportZugferd extends DolibarrModules $this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@importzugferd' // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z' - $this->version = '2.7'; + $this->version = '3.0'; // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; diff --git a/sql/dolibarr_allversions.sql b/sql/dolibarr_allversions.sql index 9533edd..0f2f20e 100755 --- a/sql/dolibarr_allversions.sql +++ b/sql/dolibarr_allversions.sql @@ -8,3 +8,10 @@ ALTER TABLE llx_importzugferd_import_line ADD COLUMN copper_surcharge_basis_qty -- Add fk_datanorm field to import_line table (v2.9) ALTER TABLE llx_importzugferd_import_line ADD COLUMN fk_datanorm integer DEFAULT NULL AFTER fk_product; + +-- Add missing datanorm fields (v3.0) +ALTER TABLE llx_importzugferd_datanorm ADD COLUMN price_unit_code tinyint DEFAULT 0 AFTER price_unit; +ALTER TABLE llx_importzugferd_datanorm ADD COLUMN price_type tinyint DEFAULT 1 AFTER price_unit_code; +ALTER TABLE llx_importzugferd_datanorm ADD COLUMN metal_surcharge double(24,8) DEFAULT 0 AFTER price_type; +ALTER TABLE llx_importzugferd_datanorm ADD COLUMN vpe integer DEFAULT NULL AFTER metal_surcharge; +ALTER TABLE llx_importzugferd_datanorm ADD COLUMN action_code char(1) DEFAULT 'N' AFTER datanorm_version;