mahnung/sql/llx_mahnung_stufe.sql
Eduard Wisch bfc89917b1
All checks were successful
Deploy mahnung / deploy (push) Successful in 14s
fix(mahnung): tms-Spalten auf ON UPDATE CURRENT_TIMESTAMP umstellen [deploy]
tms war als reines TIMESTAMP angelegt -> unter explicit_defaults_for_timestamp
NULL DEFAULT NULL, blieb daher bei jedem UPDATE leer. Jetzt Dolibarr-Standard
DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP fuer mahnung/stufe/
trackingpattern. Neue idempotente Migration migrateTimestampSpalten() im init()
befuellt Alt-NULLs aus datec und stellt die Spalte per ALTER TABLE um.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 18:13:25 +02:00

35 lines
1.8 KiB
SQL

-- Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
--
-- 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
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
-- Mahnstufen-Konfiguration (3-stufig nach BGB §288)
CREATE TABLE llx_mahnung_stufe (
rowid INTEGER AUTO_INCREMENT PRIMARY KEY,
entity INTEGER DEFAULT 1 NOT NULL,
stufe TINYINT NOT NULL,
label VARCHAR(60) NOT NULL,
frist_tage INTEGER DEFAULT 0 NOT NULL,
neue_frist_tage INTEGER DEFAULT 7 NOT NULL,
mahngebuehr_b2c DOUBLE(10,2) DEFAULT 0,
mahngebuehr_b2b DOUBLE(10,2) DEFAULT 0,
pauschale_b2b_einmalig TINYINT DEFAULT 0,
zinssatz_b2c_uebersteuern DECIMAL(5,4),
zinssatz_b2b_uebersteuern DECIMAL(5,4),
versandart_default VARCHAR(20) DEFAULT 'pdf',
email_subject VARCHAR(255),
email_body TEXT,
pdf_intro TEXT,
active TINYINT DEFAULT 1 NOT NULL,
datec DATETIME,
tms TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB;
-- Default-Stufen (idempotent: INSERT IGNORE wegen UNIQUE entity+stufe)
INSERT IGNORE INTO llx_mahnung_stufe (entity, stufe, label, frist_tage, neue_frist_tage, mahngebuehr_b2c, mahngebuehr_b2b, pauschale_b2b_einmalig, versandart_default, datec) VALUES
(1, 1, 'Zahlungserinnerung', 7, 14, 0.00, 0.00, 1, 'pdf', NOW()),
(1, 2, '1. Mahnung', 14, 10, 5.00, 5.00, 0, 'pdf', NOW()),
(1, 3, 'Letzte Mahnung', 10, 7, 10.00, 10.00, 0, 'pdf', NOW());