From 1360b061b727a7c9f5c236edcc35724bc87d5b7a Mon Sep 17 00:00:00 2001 From: data Date: Mon, 16 Feb 2026 11:22:58 +0100 Subject: [PATCH] Version 3.2.1 - System-agnostische Begriffe & Globale Typen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Änderungen: - Sammelschienen-Typen: Elektrische Begriffe durch system-agnostische ersetzt - "Phasenschienen" -> "Sammelschienen" - "Phasen" -> "Kanäle" (Channels) - Presets: L1/L2/L3/N/PE -> A/B/C/AB/ABC (+ Rückwärtskompatibilität) - Alle Admin-Seiten: Session-basierte Filter-Persistenz hinzugefügt - Element-Typen & Sammelschienen-Typen: "Alle Systeme" Option für globale Typen - fetchAllBySystem() Methoden: Globale Typen (fk_system=0/NULL) einbezogen - Sprachdatei: Neue Übersetzungen (AllSystems, AllSystemsHint, Channels, etc.) Co-Authored-By: Claude Opus 4.5 --- admin/anlage_types.php | 31 ++++++++--- admin/busbar_types.php | 80 +++++++++++++++++---------- admin/equipment_types.php | 12 +++- class/anlagetype.class.php | 3 +- class/busbartype.class.php | 9 +-- core/modules/modKundenKarte.class.php | 6 +- langs/de_DE/kundenkarte.lang | 13 +++-- 7 files changed, 105 insertions(+), 49 deletions(-) diff --git a/admin/anlage_types.php b/admin/anlage_types.php index b54fe3f..742da01 100755 --- a/admin/anlage_types.php +++ b/admin/anlage_types.php @@ -24,7 +24,17 @@ if (!$user->admin && !$user->hasRight('kundenkarte', 'admin')) { $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $typeId = GETPOSTINT('typeid'); -$systemFilter = GETPOSTINT('system'); + +// System filter - save in session for persistence +$sessionKey = 'kundenkarte_anlage_types_system_filter'; +if (GETPOSTISSET('system')) { + $systemFilter = GETPOSTINT('system'); + $_SESSION[$sessionKey] = $systemFilter; +} elseif (isset($_SESSION[$sessionKey])) { + $systemFilter = $_SESSION[$sessionKey]; +} else { + $systemFilter = 0; +} $form = new Form($db); $anlageType = new AnlageType($db); @@ -58,7 +68,7 @@ if ($action == 'add') { $anlageType->position = GETPOSTINT('position'); $anlageType->active = 1; - if (empty($anlageType->ref) || empty($anlageType->label) || empty($anlageType->fk_system)) { + if (empty($anlageType->ref) || empty($anlageType->label)) { setEventMessages($langs->trans('ErrorFieldRequired'), null, 'errors'); $action = 'create'; } else { @@ -329,14 +339,17 @@ if (in_array($action, array('create', 'edit'))) { print ''; // System - print ''; - print ''; + print ''; + print ''; + print ' ('.$langs->trans('AllSystemsHint').')'; + print ''; // Reference print ''; @@ -632,7 +645,11 @@ if (in_array($action, array('create', 'edit'))) { } print ''; - print ''; + if (empty($type->fk_system)) { + print ''; + } else { + print ''; + } print ''; print ''; diff --git a/admin/busbar_types.php b/admin/busbar_types.php index 1cb5bcf..d44d80e 100644 --- a/admin/busbar_types.php +++ b/admin/busbar_types.php @@ -1,7 +1,7 @@ admin && !$user->hasRight('kundenkarte', 'admin')) { $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $typeId = GETPOSTINT('typeid'); -$systemFilter = GETPOSTINT('system'); + +// System filter - save in session for persistence +$sessionKey = 'kundenkarte_busbar_types_system_filter'; +if (GETPOSTISSET('system')) { + $systemFilter = GETPOSTINT('system'); + $_SESSION[$sessionKey] = $systemFilter; +} elseif (isset($_SESSION[$sessionKey])) { + $systemFilter = $_SESSION[$sessionKey]; +} else { + $systemFilter = 0; +} $form = new Form($db); $busbarType = new BusbarType($db); @@ -49,17 +59,19 @@ if ($resql) { } } -// Predefined phase configurations -$phasePresets = array( - 'L1' => array('label' => 'L1 (Phase 1)', 'num_lines' => 1, 'colors' => '#e74c3c'), - 'L2' => array('label' => 'L2 (Phase 2)', 'num_lines' => 1, 'colors' => '#2ecc71'), - 'L3' => array('label' => 'L3 (Phase 3)', 'num_lines' => 1, 'colors' => '#9b59b6'), - 'N' => array('label' => 'N (Neutralleiter)', 'num_lines' => 1, 'colors' => '#3498db'), - 'PE' => array('label' => 'PE (Schutzleiter)', 'num_lines' => 1, 'colors' => '#f1c40f'), - 'L1N' => array('label' => 'L1+N (Wechselstrom)', 'num_lines' => 2, 'colors' => '#e74c3c,#3498db'), - '3P' => array('label' => '3P (Drehstrom)', 'num_lines' => 3, 'colors' => '#e74c3c,#2ecc71,#9b59b6'), - '3P+N' => array('label' => '3P+N (Drehstrom+N)', 'num_lines' => 4, 'colors' => '#e74c3c,#2ecc71,#9b59b6,#3498db'), - '3P+N+PE' => array('label' => '3P+N+PE (Vollausstattung)', 'num_lines' => 5, 'colors' => '#e74c3c,#2ecc71,#9b59b6,#3498db,#f1c40f'), +// Predefined channel configurations (system-independent) +$channelPresets = array( + // General presets + 'A' => array('label' => 'Kanal A (1 Linie)', 'num_lines' => 1, 'colors' => '#e74c3c'), + 'B' => array('label' => 'Kanal B (1 Linie)', 'num_lines' => 1, 'colors' => '#2ecc71'), + 'C' => array('label' => 'Kanal C (1 Linie)', 'num_lines' => 1, 'colors' => '#9b59b6'), + 'AB' => array('label' => 'Kanal A+B (2 Linien)', 'num_lines' => 2, 'colors' => '#e74c3c,#2ecc71'), + 'ABC' => array('label' => 'Kanal A+B+C (3 Linien)', 'num_lines' => 3, 'colors' => '#e74c3c,#2ecc71,#9b59b6'), + '4CH' => array('label' => '4 Kanaele', 'num_lines' => 4, 'colors' => '#e74c3c,#2ecc71,#9b59b6,#3498db'), + '5CH' => array('label' => '5 Kanaele', 'num_lines' => 5, 'colors' => '#e74c3c,#2ecc71,#9b59b6,#3498db,#f1c40f'), + // Electrical presets (for backward compatibility) + 'L1' => array('label' => 'L1 (Strom)', 'num_lines' => 1, 'colors' => '#e74c3c'), + '3P+N' => array('label' => '3P+N (Strom)', 'num_lines' => 4, 'colors' => '#e74c3c,#2ecc71,#9b59b6,#3498db'), ); /* @@ -84,7 +96,7 @@ if ($action == 'add') { $busbarType->position = GETPOSTINT('position'); $busbarType->active = 1; - if (empty($busbarType->ref) || empty($busbarType->label) || empty($busbarType->fk_system) || empty($busbarType->phases)) { + if (empty($busbarType->ref) || empty($busbarType->label) || empty($busbarType->phases)) { setEventMessages($langs->trans('ErrorFieldRequired'), null, 'errors'); $action = 'create'; } else { @@ -223,28 +235,32 @@ if ($action == 'create' || $action == 'edit') { print ''; // System - print ''; - print ''; + print ''; + print ''; + print '
'.$langs->trans('AllSystemsHint').'
'; + print ''; - // Phase configuration - print ''; + // Channel configuration + print ''; print ''; // Number of lines @@ -310,9 +326,9 @@ if ($action == 'create' || $action == 'edit') { // JavaScript for preset selection and preview print '
'.$langs->trans('System').'
'.$langs->trans('System').'
'.$langs->trans('TypeRef').''.dol_escape_htmltag($type->system_label).''.$langs->trans('AllSystems').''.dol_escape_htmltag($type->system_label).''.($type->can_have_children ? img_picto('', 'tick') : '').''.$type->position.'
'.$langs->trans('System').'
'.$langs->trans('System').'
'.$langs->trans('Phases').'
'.$langs->trans('Channels').''; print '
'; - print 'Schnellauswahl:
'; - foreach ($phasePresets as $code => $preset) { + print ''.$langs->trans('QuickSelect').':
'; + foreach ($channelPresets as $code => $preset) { $style = 'display:inline-block;margin:3px;padding:5px 10px;border:1px solid #ccc;border-radius:4px;cursor:pointer;background:#f8f8f8;'; - print ''; + print ''; print dol_escape_htmltag($preset['label']); print ''; } print '
'; - print ''; - print '
Phasen-Konfiguration: L1, L2, L3, N, PE oder Kombinationen wie L1N, 3P, 3P+N, 3P+N+PE
'; + print ''; + print '
'.$langs->trans('ChannelsHint').'
'; print '