Sync-500: tms vor create/update explizit setzen [deploy]
All checks were successful
Deploy netdiag / deploy (push) Successful in 14s
All checks were successful
Deploy netdiag / deploy (push) Successful in 14s
Nachtrag zum tms-Fix: explicit_defaults_for_timestamp=1 auf der Prod-DB — ein INSERT mit tms=NULL in die NOT-NULL-Spalte schlaegt fehl. createCommon fuegt tms aber als NULL ein, wenn die Property leer ist. Loesung: protocols.php setzt tms = dol_now() vor jedem create/update von Protokoll, Geraet und Messung. Damit landet ein gueltiger Zeitstempel im INSERT, kein NULL. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ddb7161b00
commit
8be5297196
1 changed files with 5 additions and 0 deletions
|
|
@ -140,6 +140,9 @@ $protocol->standort = isset($p['location']) ? (string) $p['location'] :
|
|||
$protocol->subnet = isset($p['subnet']) ? (string) $p['subnet'] : '';
|
||||
$protocol->status = isset($p['status']) ? (int) $p['status'] : NetDiagProtocol::STATUS_DRAFT;
|
||||
$protocol->note = isset($p['note']) ? (string) $p['note'] : '';
|
||||
// tms explizit setzen — die Spalte ist NOT NULL ohne brauchbaren NULL-Default
|
||||
// (explicit_defaults_for_timestamp=1), createCommon würde sonst NULL einfügen.
|
||||
$protocol->tms = dol_now();
|
||||
|
||||
if ($exists > 0) {
|
||||
$result = $protocol->update($user, 1);
|
||||
|
|
@ -168,6 +171,7 @@ foreach ($devicesIn as $d) {
|
|||
$dev->vendor = isset($d['vendor']) ? (string) $d['vendor'] : '';
|
||||
$dev->devicetype = isset($d['deviceType']) ? (string) $d['deviceType'] : '';
|
||||
$dev->note = isset($d['note']) ? (string) $d['note'] : '';
|
||||
$dev->tms = dol_now();
|
||||
if ($dev->create($user, 1) <= 0) {
|
||||
$db->rollback();
|
||||
netdiag_api_error('Gerät speichern fehlgeschlagen: '.$dev->error, 500);
|
||||
|
|
@ -191,6 +195,7 @@ foreach ($measIn as $m) {
|
|||
$meas->result = isset($m['result']) ? json_encode($m['result'], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) : null;
|
||||
$meas->measure_status = isset($m['measureStatus']) ? (int) $m['measureStatus'] : 0;
|
||||
$meas->date_measure = !empty($m['dateMeasure']) ? (int) $m['dateMeasure'] : dol_now();
|
||||
$meas->tms = dol_now();
|
||||
if ($meas->create($user, 1) <= 0) {
|
||||
$db->rollback();
|
||||
netdiag_api_error('Messung speichern fehlgeschlagen: '.$meas->error, 500);
|
||||
|
|
|
|||
Loading…
Reference in a new issue