From ddb7161b00bf7e05e42491ff9d11a6b1fa4f107c Mon Sep 17 00:00:00 2001 From: Eduard Wisch Date: Tue, 19 May 2026 18:28:58 +0200 Subject: [PATCH] Sync-500 behoben: tms-Feld auf notnull=0 [deploy] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit protocols.php (POST) gab bei JEDEM Sync HTTP 500 zurueck — 0 Protokolle wurden je gespeichert. Ursache: protocol/device/measurement-Klassen deklarierten das tms-Feld im $fields-Array als 'notnull' => 1. Dolibarrs createCommon() bricht ab (-1), wenn ein notnull-Feld den Wert NULL hat und kein 'default' gesetzt ist. tms wird von der App nie gesetzt (die DB fuellt es per CURRENT_TIMESTAMP), also schlug jedes Insert fehl, bevor es ueberhaupt an die DB ging. Fix: tms auf 'notnull' => 0 — so wie es der Dolibarr-Modul-Builder auch generiert. Die DB-Spalte bleibt NOT NULL DEFAULT CURRENT_TIMESTAMP. Co-Authored-By: Claude Opus 4.7 (1M context) --- class/netdiagdevice.class.php | 2 +- class/netdiagmeasurement.class.php | 2 +- class/netdiagprotocol.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/class/netdiagdevice.class.php b/class/netdiagdevice.class.php index 3ea9c88..a0b0c73 100644 --- a/class/netdiagdevice.class.php +++ b/class/netdiagdevice.class.php @@ -57,7 +57,7 @@ class NetDiagDevice extends CommonObject 'devicetype' => array('type' => 'varchar(64)', 'label' => 'DeviceType', 'enabled' => 1, 'visible' => 1, 'position' => 40), 'note' => array('type' => 'text', 'label' => 'Note', 'enabled' => 1, 'visible' => 3, 'position' => 50), 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 500), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 501), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => 0, 'notnull' => 0, 'position' => 501), ); public $rowid; diff --git a/class/netdiagmeasurement.class.php b/class/netdiagmeasurement.class.php index 5b939e1..85d388b 100644 --- a/class/netdiagmeasurement.class.php +++ b/class/netdiagmeasurement.class.php @@ -66,7 +66,7 @@ class NetDiagMeasurement extends CommonObject 'measure_status' => array('type' => 'smallint', 'label' => 'MeasureStatus', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'default' => 0, 'position' => 50), 'date_measure' => array('type' => 'datetime', 'label' => 'DateMeasure', 'enabled' => 1, 'visible' => 1, 'position' => 55), 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 500), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 501), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => 0, 'notnull' => 0, 'position' => 501), ); public $rowid; diff --git a/class/netdiagprotocol.class.php b/class/netdiagprotocol.class.php index 9e4acad..2379802 100644 --- a/class/netdiagprotocol.class.php +++ b/class/netdiagprotocol.class.php @@ -68,7 +68,7 @@ class NetDiagProtocol extends CommonObject 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'default' => 0, 'index' => 1, 'position' => 60, 'arrayofkeyval' => array(0 => 'Draft', 1 => 'Done')), 'note' => array('type' => 'text', 'label' => 'Note', 'enabled' => 1, 'visible' => 3, 'position' => 70), 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 500), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 501), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => 0, 'notnull' => 0, 'position' => 501), 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 510), 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'visible' => 0, 'position' => 511), );