epcqr/sql/llx_epcqr_extrafields.sql
2026-01-29 20:37:59 +01:00

104 lines
3.2 KiB
SQL

-- Copyright (C) 2025 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.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.
--
-- EPCQR-Modul Version 2.0 - Initiale Installation
-- Erstellt alle notwendigen Extrafelder für die QR-Code-Funktionalität
--
-- ============================================
-- Extrafeld 1: qrcode (HTML-Anzeige mit <img>-Tag)
-- ============================================
INSERT INTO llx_extrafields (
name, label, type, size, elementtype,
fieldunique, fieldrequired, pos, alwayseditable,
param, enabled, perms, list, totalizable, printable,
langs, help, entity
) VALUES (
'qrcode',
'EPC QR-Code',
'html',
'500',
'facture',
0, 0, 800, 0,
'', '1', '', '1', 0, 0,
NULL,
'QR-Code als HTML-Bild für Anzeige im Formular',
0
)
ON DUPLICATE KEY UPDATE
label = 'EPC QR-Code',
type = 'html',
size = '500';
-- ============================================
-- Extrafeld 2: qrcodepfad (URL zum QR-Code)
-- ============================================
INSERT INTO llx_extrafields (
name, label, type, size, elementtype,
fieldunique, fieldrequired, pos, alwayseditable,
param, enabled, perms, list, totalizable, printable,
langs, help, entity
) VALUES (
'qrcodepfad',
'QR-Code URL',
'html',
'500',
'facture',
0, 0, 801, 0,
'', '1', '', '0', 0, 0,
NULL,
'URL zum QR-Code-Bild (klickbarer Link)',
0
)
ON DUPLICATE KEY UPDATE
label = 'QR-Code URL',
type = 'html',
size = '500';
-- ============================================
-- Extrafeld 3: qrcodepath (Lokaler Dateipfad für ODT)
-- ============================================
INSERT INTO llx_extrafields (
name, label, type, size, elementtype,
fieldunique, fieldrequired, pos, alwayseditable,
param, enabled, perms, list, totalizable, printable,
langs, help, entity
) VALUES (
'qrcodepath',
'QR-Code Bildpfad (lokal)',
'varchar',
'255',
'facture',
0, 0, 802, 0,
'', '1', '', '0', 0, 0,
NULL,
'Lokaler Pfad zur QR-Code-Bilddatei für ODT-Integration',
0
)
ON DUPLICATE KEY UPDATE
label = 'QR-Code Bildpfad (lokal)',
type = 'varchar',
size = '255';
-- ============================================
-- Tabellen-Spalten in facture_extrafields
-- ============================================
-- MySQL/MariaDB: ADD COLUMN IF NOT EXISTS erfordert MariaDB 10.0.2+
-- Für ältere Versionen werden Fehler ignoriert
ALTER TABLE llx_facture_extrafields ADD COLUMN qrcode TEXT DEFAULT NULL;
ALTER TABLE llx_facture_extrafields ADD COLUMN qrcodepfad TEXT DEFAULT NULL;
ALTER TABLE llx_facture_extrafields ADD COLUMN qrcodepath VARCHAR(255) DEFAULT NULL;