From fd8d11e764c9c7d5b87a8317c9e15cb0953539b4 Mon Sep 17 00:00:00 2001 From: data Date: Tue, 3 Mar 2026 19:49:31 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20Ausgebaut-Status=20f=C3=BCr=20Anlagen-E?= =?UTF-8?q?lemente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Elemente können als "ausgebaut" markiert werden mit Datum. Bleiben in der DB für Nachvollziehbarkeit, werden ausgegraut dargestellt und können per Toggle ein-/ausgeblendet werden. - DB: decommissioned + date_decommissioned Spalten - Dialog mit Datumsauswahl beim Ausbauen - Toggle-Button in Baum- und Graph-Toolbar - Ausgebaute Elemente ausgegraut (opacity 0.4, durchgestrichen) - Badge mit Ausbau-Datum im Baum - Kontextmenü im Graph für Ausbauen/Einbauen Co-Authored-By: Claude Opus 4.6 --- ajax/anlage.php | 37 ++++++++- ajax/graph_data.php | 4 +- class/anlage.class.php | 6 ++ core/modules/modKundenKarte.class.php | 25 ++++++- css/kundenkarte.css | 40 ++++++++++ js/kundenkarte.js | 104 ++++++++++++++++++++++++++ js/kundenkarte_cytoscape.js | 51 +++++++++++++ langs/de_DE/kundenkarte.lang | 6 ++ langs/en_US/kundenkarte.lang | 6 ++ lib/graph_view.lib.php | 1 + tabs/anlagen.php | 31 ++++++++ tabs/contact_anlagen.php | 31 ++++++++ 12 files changed, 338 insertions(+), 4 deletions(-) diff --git a/ajax/anlage.php b/ajax/anlage.php index c9383b8..6666e5c 100755 --- a/ajax/anlage.php +++ b/ajax/anlage.php @@ -48,7 +48,8 @@ function treeToArray($nodes) { 'fk_parent' => $node->fk_parent, 'fk_system' => $node->fk_system, 'type_label' => $node->type_label, - 'status' => $node->status + 'status' => $node->status, + 'decommissioned' => (int) $node->decommissioned ); if (!empty($node->children)) { $item['children'] = treeToArray($node->children); @@ -94,7 +95,8 @@ switch ($action) { 'display_label' => $prefix . $node->label, 'fk_parent' => $node->fk_parent, 'type_label' => $node->type_label, - 'status' => $node->status + 'status' => $node->status, + 'decommissioned' => (int) $node->decommissioned ); if (!empty($node->children)) { $flattenTree($node->children, $prefix . ' '); @@ -123,6 +125,7 @@ switch ($action) { 'type_label' => $anlage->type_label, 'fk_system' => $anlage->fk_system, 'status' => $anlage->status, + 'decommissioned' => (int) $anlage->decommissioned, 'field_values' => $anlage->getFieldValues() ); } else { @@ -130,6 +133,36 @@ switch ($action) { } break; + case 'toggle_decommissioned': + // Ausgebaut-Status umschalten + if (!$user->hasRight('kundenkarte', 'write')) { + $response['error'] = $langs->trans('ErrorPermissionDenied'); + break; + } + + if ($anlageId > 0 && $anlage->fetch($anlageId) > 0) { + $anlage->decommissioned = $anlage->decommissioned ? 0 : 1; + if ($anlage->decommissioned) { + // Ausbau: Datum setzen (aus POST oder heute) + $dateStr = GETPOST('date_decommissioned', 'alpha'); + $anlage->date_decommissioned = !empty($dateStr) ? $dateStr : date('Y-m-d'); + } else { + // Wieder einbauen: Datum löschen + $anlage->date_decommissioned = null; + } + $result = $anlage->update($user); + if ($result > 0) { + $response['success'] = true; + $response['decommissioned'] = (int) $anlage->decommissioned; + $response['date_decommissioned'] = $anlage->date_decommissioned; + } else { + $response['error'] = 'Fehler beim Speichern'; + } + } else { + $response['error'] = $langs->trans('ErrorRecordNotFound'); + } + break; + case 'reorder': // Reihenfolge der Elemente aktualisieren if (!$user->hasRight('kundenkarte', 'write')) { diff --git a/ajax/graph_data.php b/ajax/graph_data.php index c3758d2..36331a4 100755 --- a/ajax/graph_data.php +++ b/ajax/graph_data.php @@ -66,7 +66,7 @@ if ($resFields) { // Elemente laden - OHNE GLOBAL-System (das ist nur die separate Gebäudestruktur) // Gebäude/Räume werden über den Typ erkannt (type_system_code = GLOBAL) // Hierarchie kommt aus fk_parent (wie im Baum) -$sql = "SELECT a.rowid, a.label, a.fk_parent, a.fk_system, a.fk_anlage_type,"; +$sql = "SELECT a.rowid, a.label, a.fk_parent, a.fk_system, a.fk_anlage_type, a.decommissioned, a.date_decommissioned,"; $sql .= " a.field_values, a.fk_contact, a.graph_x, a.graph_y, a.graph_width, a.graph_height,"; $sql .= " t.label as type_label, t.picto as type_picto, t.color as type_color,"; $sql .= " t.can_have_children as type_can_have_children,"; @@ -128,6 +128,8 @@ if ($resql) { 'fk_parent' => (int) $obj->fk_parent, 'fk_anlage_type' => (int) $obj->fk_anlage_type, 'is_building' => $isBuilding, + 'decommissioned' => isset($obj->decommissioned) ? (int) $obj->decommissioned : 0, + 'date_decommissioned' => isset($obj->date_decommissioned) ? $obj->date_decommissioned : null, 'image_count' => (int) $obj->image_count, 'doc_count' => (int) $obj->doc_count, 'graph_x' => $obj->graph_x !== null ? (float) $obj->graph_x : null, diff --git a/class/anlage.class.php b/class/anlage.class.php index 6fd3c75..cac7377 100755 --- a/class/anlage.class.php +++ b/class/anlage.class.php @@ -40,6 +40,8 @@ class Anlage extends CommonObject public $note_private; public $note_public; public $status; + public $decommissioned; + public $date_decommissioned; public $date_creation; public $fk_user_creat; @@ -217,6 +219,8 @@ class Anlage extends CommonObject $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->status = $obj->status; + $this->decommissioned = isset($obj->decommissioned) ? (int) $obj->decommissioned : 0; + $this->date_decommissioned = isset($obj->date_decommissioned) ? $obj->date_decommissioned : null; $this->date_creation = $this->db->jdate($obj->date_creation); $this->tms = $this->db->jdate($obj->tms); @@ -287,6 +291,8 @@ class Anlage extends CommonObject $sql .= ", note_private = ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "NULL"); $sql .= ", note_public = ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "NULL"); $sql .= ", status = ".((int) $this->status); + $sql .= ", decommissioned = ".((int) $this->decommissioned); + $sql .= ", date_decommissioned = ".($this->date_decommissioned ? "'".$this->db->escape($this->date_decommissioned)."'" : "NULL"); $sql .= ", fk_user_modif = ".((int) $user->id); $sql .= " WHERE rowid = ".((int) $this->id); diff --git a/core/modules/modKundenKarte.class.php b/core/modules/modKundenKarte.class.php index 73ea888..afce6f9 100755 --- a/core/modules/modKundenKarte.class.php +++ b/core/modules/modKundenKarte.class.php @@ -76,7 +76,7 @@ class modKundenKarte extends DolibarrModules $this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@kundenkarte' // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z' - $this->version = '8.3'; + $this->version = '8.4'; // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; @@ -633,6 +633,9 @@ class modKundenKarte extends DolibarrModules // v6.8.0: Schutzgruppen-Zuordnung (fk_protection) $this->migrate_v680_protection_groups(); + + // v8.0.0: Ausgebaut-Status für Anlagen + $this->migrate_v800_decommissioned(); } /** @@ -927,6 +930,26 @@ class modKundenKarte extends DolibarrModules } } + /** + * Migration v8.0.0: Ausgebaut-Status für Anlagen + */ + private function migrate_v800_decommissioned() + { + $table = MAIN_DB_PREFIX."kundenkarte_anlage"; + + $resql = $this->db->query("SHOW COLUMNS FROM ".$table." LIKE 'decommissioned'"); + if (!$resql || $this->db->num_rows($resql) == 0) { + $this->db->query("ALTER TABLE ".$table." ADD COLUMN decommissioned tinyint DEFAULT 0 NOT NULL AFTER status"); + $this->db->query("ALTER TABLE ".$table." ADD INDEX idx_anlage_decommissioned (decommissioned)"); + } + + // Ausbau-Datum + $resql = $this->db->query("SHOW COLUMNS FROM ".$table." LIKE 'date_decommissioned'"); + if (!$resql || $this->db->num_rows($resql) == 0) { + $this->db->query("ALTER TABLE ".$table." ADD COLUMN date_decommissioned DATE NULL AFTER decommissioned"); + } + } + /** * Function called when module is disabled. * Remove from database constants, boxes and permissions from Dolibarr database. diff --git a/css/kundenkarte.css b/css/kundenkarte.css index 3a445a2..48389fb 100755 --- a/css/kundenkarte.css +++ b/css/kundenkarte.css @@ -2846,3 +2846,43 @@ body.kundenkarte-drag-active * { .edit-product-clear:hover { color: #e74c3c !important; } + +/* ======================================== + AUSGEBAUTE ELEMENTE (Decommissioned) + ======================================== */ + +/* Ausgebaute Elemente im Baum standardmäßig ausgeblendet */ +/* Funktion 1: kundenkarte-tree-node, Funktion 2: kundenkarte-tree-row */ +.kundenkarte-tree .decommissioned { + display: none !important; +} + +/* Sichtbar wenn Toggle aktiv */ +.kundenkarte-tree.show-decommissioned .decommissioned { + display: flex !important; + opacity: 0.4 !important; +} + +/* Ausgegraut: Label durchgestrichen */ +.kundenkarte-tree.show-decommissioned .decommissioned .tree-label, +.kundenkarte-tree.show-decommissioned .decommissioned .tree-item-label { + text-decoration: line-through !important; +} + +/* Badge "Ausgebaut" mit Datum */ +.badge-decommissioned { + display: inline-block !important; + margin-left: 8px !important; + padding: 1px 6px !important; + font-size: 10px !important; + background: #8b4513 !important; + color: #ddd !important; + border-radius: 3px !important; + vertical-align: middle !important; +} + +/* Toggle-Button aktiver Zustand */ +#btn-toggle-decommissioned.active { + background: rgba(139, 69, 19, 0.3) !important; + border-color: #8b4513 !important; +} diff --git a/js/kundenkarte.js b/js/kundenkarte.js index bb4bd6d..cd60f4f 100755 --- a/js/kundenkarte.js +++ b/js/kundenkarte.js @@ -99,6 +99,69 @@ }); }; + // Dialog zum Ausbauen mit Datumsauswahl + KundenKarte.showDecommissionDialog = function(anlageId, onSuccess) { + $('#kundenkarte-decommission-dialog').remove(); + + var today = new Date().toISOString().split('T')[0]; + + var html = '
'; + html += '
'; + html += '

Element ausbauen

'; + html += '×
'; + html += '
'; + html += '

Element als ausgebaut markieren?

'; + html += ''; + html += ''; + html += '
'; + html += ''; + html += '
'; + + $('body').append(html); + $('#kundenkarte-decommission-dialog').addClass('visible'); + $('#decommission-date').focus(); + + $('#decommission-confirm').on('click', function() { + var dateVal = $('#decommission-date').val(); + $('#kundenkarte-decommission-dialog').remove(); + $(document).off('keydown.decommDialog'); + + $.post(KundenKarte.ajaxUrl + '/anlage.php', { + action: 'toggle_decommissioned', + anlage_id: anlageId, + date_decommissioned: dateVal, + token: KundenKarte.token + }, function(res) { + if (res.success) { + if (typeof onSuccess === 'function') { + onSuccess(res); + } else { + location.reload(); + } + } else { + alert(res.error || 'Fehler'); + } + }, 'json'); + }); + + $('#decommission-cancel, #kundenkarte-decommission-dialog .kundenkarte-modal-close').on('click', function() { + $('#kundenkarte-decommission-dialog').remove(); + $(document).off('keydown.decommDialog'); + }); + + $(document).on('keydown.decommDialog', function(e) { + if (e.key === 'Escape') { + $('#kundenkarte-decommission-dialog').remove(); + $(document).off('keydown.decommDialog'); + } else if (e.key === 'Enter') { + $('#decommission-confirm').click(); + } + }); + }; + // Global error display with details KundenKarte.showError = function(title, message, details) { $('#kundenkarte-error-dialog').remove(); @@ -216,6 +279,47 @@ self.toggleCompactMode(); }); + // Ausgebaute Elemente ein-/ausblenden + $(document).on('click', '#btn-toggle-decommissioned', function(e) { + e.preventDefault(); + var $btn = $(this); + $btn.toggleClass('active'); + var show = $btn.hasClass('active'); + $btn.find('i').toggleClass('fa-eye-slash', !show).toggleClass('fa-eye', show); + $('.kundenkarte-tree').toggleClass('show-decommissioned', show); + }); + + // Ausbauen/Einbauen per Klick + $(document).on('click', '.btn-toggle-decommissioned', function(e) { + e.preventDefault(); + e.stopPropagation(); + var $btn = $(this); + var anlageId = $btn.data('anlage-id'); + if (!anlageId) return; + + // Prüfen ob Element bereits ausgebaut ist + var $row = $btn.closest('.decommissioned'); + if ($row.length) { + // Wieder einbauen - einfache Bestätigung + KundenKarte.showConfirm('Wieder einbauen', 'Element wieder als eingebaut markieren?', function() { + $.post(KundenKarte.ajaxUrl + '/anlage.php', { + action: 'toggle_decommissioned', + anlage_id: anlageId, + token: KundenKarte.token + }, function(res) { + if (res.success) { + location.reload(); + } else { + alert(res.error || 'Fehler'); + } + }, 'json'); + }); + } else { + // Ausbauen - Dialog mit Datumsfeld + KundenKarte.showDecommissionDialog(anlageId); + } + }); + // In compact mode, click on item to expand/show details $(document).on('click', '.kundenkarte-tree.compact-mode .kundenkarte-tree-item', function(e) { // Don't trigger on action buttons or toggle diff --git a/js/kundenkarte_cytoscape.js b/js/kundenkarte_cytoscape.js index bb47565..1e1df14 100755 --- a/js/kundenkarte_cytoscape.js +++ b/js/kundenkarte_cytoscape.js @@ -338,6 +338,11 @@ n.data.display_label = lines.join('\n'); } + // Ausgebaut-Markierung + if (n.data.decommissioned) { + n.classes = (n.classes || '') + ' decommissioned'; + } + cyElements.push(n); }); } @@ -539,6 +544,14 @@ 'opacity': 0.6 } }, + // Ausgebaute Elemente - ausgegraut + { + selector: '.decommissioned', + style: { + 'opacity': 0.35, + 'border-style': 'dashed' + } + }, // Hover { selector: 'node:active', @@ -606,6 +619,35 @@ case 'add-child': window.location.href = baseUrl + '&action=create&parent_id=' + anlageId; break; + case 'toggle-decommissioned': + var nodeEl = self.cy.$('#n_' + anlageId); + var isDecomm = nodeEl.length && nodeEl.data('decommissioned'); + if (isDecomm) { + // Wieder einbauen - Bestätigung + window.KundenKarte.showConfirm('Wieder einbauen', 'Element wieder als eingebaut markieren?', function() { + $.post(window.KundenKarte.ajaxUrl + '/anlage.php', { + action: 'toggle_decommissioned', + anlage_id: anlageId, + token: window.KundenKarte.token + }, function(res) { + if (res.success) { + nodeEl.data('decommissioned', 0); + nodeEl.removeClass('decommissioned'); + } else { + alert(res.error || 'Fehler'); + } + }, 'json'); + }); + } else { + // Ausbauen - Dialog mit Datum + window.KundenKarte.showDecommissionDialog(anlageId, function(res) { + if (nodeEl.length) { + nodeEl.data('decommissioned', 1); + nodeEl.addClass('decommissioned'); + } + }); + } + break; } self.hideContextMenu(); }); @@ -620,6 +662,15 @@ if (!this.contextMenuEl) return; this.contextMenuNodeId = node.data('id').replace('n_', ''); + // Ausgebaut-Label im Kontextmenü anpassen + var isDecomm = node.data('decommissioned'); + var $decommLabel = $(this.contextMenuEl).find('.ctx-decommission-label'); + var $decommIcon = $(this.contextMenuEl).find('.ctx-decommission i'); + if ($decommLabel.length) { + $decommLabel.text(isDecomm ? 'Wieder einbauen' : 'Ausbauen'); + $decommIcon.attr('class', isDecomm ? 'fa fa-plug' : 'fa fa-power-off'); + } + var container = document.getElementById(this.containerId); var rect = container.getBoundingClientRect(); var x = rect.left + renderedPos.x; diff --git a/langs/de_DE/kundenkarte.lang b/langs/de_DE/kundenkarte.lang index 6621ecd..1505a42 100755 --- a/langs/de_DE/kundenkarte.lang +++ b/langs/de_DE/kundenkarte.lang @@ -555,3 +555,9 @@ ViewModes = Verfuegbare Ansichten ViewModesBoth = Baum & Graph ViewModesTreeOnly = Nur Baum ViewModesGraphOnly = Nur Graph + +# Ausgebaut-Status +Decommissioned = Ausgebaut +Decommission = Ausbauen +Recommission = Wieder einbauen +ShowDecommissioned = Ausgebaute Elemente anzeigen diff --git a/langs/en_US/kundenkarte.lang b/langs/en_US/kundenkarte.lang index 7d5aef8..eaa1329 100755 --- a/langs/en_US/kundenkarte.lang +++ b/langs/en_US/kundenkarte.lang @@ -303,3 +303,9 @@ ViewModes = Available Views ViewModesBoth = Tree & Graph ViewModesTreeOnly = Tree Only ViewModesGraphOnly = Graph Only + +# Decommissioned status +Decommissioned = Decommissioned +Decommission = Decommission +Recommission = Recommission +ShowDecommissioned = Show decommissioned elements diff --git a/lib/graph_view.lib.php b/lib/graph_view.lib.php index b4642f8..38d18b4 100755 --- a/lib/graph_view.lib.php +++ b/lib/graph_view.lib.php @@ -151,6 +151,7 @@ function kundenkarte_graph_print_container($params) print ' '.$langs->trans('AddChild').''; print ' '.$langs->trans('Edit').''; print ' '.$langs->trans('Copy').''; + print ' '.$langs->trans('Decommission').''; } if ($permissiontodelete) { print ' '.$langs->trans('Delete').''; diff --git a/tabs/anlagen.php b/tabs/anlagen.php index dbf18ae..5b2b0b4 100755 --- a/tabs/anlagen.php +++ b/tabs/anlagen.php @@ -507,6 +507,9 @@ if ($isTreeView) { print ''; + print ''; if ($systemId > 0) { $exportUrl = dol_buildpath('/kundenkarte/ajax/export_tree_pdf.php', 1).'?socid='.$id.'&system='.$systemId; print ''; @@ -1227,6 +1230,9 @@ function printTree($nodes, $socid, $systemId, $canEdit, $canDelete, $langs, $lev if (!$hasConnection && $level > 0) { $nodeClass .= ' no-cable'; // durchgeschleift - kein eigenes Kabel } + if (!empty($node->decommissioned)) { + $nodeClass .= ' decommissioned'; + } if ($node->type_can_have_equipment) { $nodeClass .= ' node-equipment'; // Geräte-Container (Schaltschrank, Verteiler) } elseif ($node->type_can_have_children) { @@ -1262,6 +1268,14 @@ function printTree($nodes, $socid, $systemId, $canEdit, $canDelete, $langs, $lev } print ''; + // Ausgebaut-Badge mit Datum + if (!empty($node->decommissioned)) { + $decommDate = !empty($node->date_decommissioned) ? dol_print_date(strtotime($node->date_decommissioned), 'day') : ''; + $decommText = $langs->trans('Decommissioned'); + if ($decommDate) $decommText .= ' '.$decommDate; + print ' '.$decommText.''; + } + // Spacer to push badges to the right print ''; @@ -1304,6 +1318,9 @@ function printTree($nodes, $socid, $systemId, $canEdit, $canDelete, $langs, $lev print ''; print ''; + $decommLabel = $node->decommissioned ? $langs->trans('Recommission') : $langs->trans('Decommission'); + $decommIcon = $node->decommissioned ? 'fa-plug' : 'fa-power-off'; + print ''; } if ($canDelete) { print ''; @@ -1473,6 +1490,9 @@ function printTreeWithCableLines($nodes, $socid, $systemId, $canEdit, $canDelete if (!$hasConnection && $level > 0) { $nodeClass .= ' no-cable'; } + if (!empty($node->decommissioned)) { + $nodeClass .= ' decommissioned'; + } print '
'; @@ -1529,6 +1549,14 @@ function printTreeWithCableLines($nodes, $socid, $systemId, $canEdit, $canDelete } print ''; + // Ausgebaut-Badge mit Datum + if (!empty($node->decommissioned)) { + $decommDate = !empty($node->date_decommissioned) ? dol_print_date(strtotime($node->date_decommissioned), 'day') : ''; + $decommText = $langs->trans('Decommissioned'); + if ($decommDate) $decommText .= ' '.$decommDate; + print ' '.$decommText.''; + } + // Spacer to push badges to the right print ''; @@ -1568,6 +1596,9 @@ function printTreeWithCableLines($nodes, $socid, $systemId, $canEdit, $canDelete print ''; print ''; + $decommLabel = $node->decommissioned ? $langs->trans('Recommission') : $langs->trans('Decommission'); + $decommIcon = $node->decommissioned ? 'fa-plug' : 'fa-power-off'; + print ''; } if ($canDelete) { print ''; diff --git a/tabs/contact_anlagen.php b/tabs/contact_anlagen.php index e727144..bb51485 100755 --- a/tabs/contact_anlagen.php +++ b/tabs/contact_anlagen.php @@ -505,6 +505,9 @@ if ($isTreeView) { print ''; + print ''; if ($systemId > 0) { $exportUrl = dol_buildpath('/kundenkarte/ajax/export_tree_pdf.php', 1).'?socid='.$object->socid.'&contactid='.$id.'&system='.$systemId; print ''; @@ -1225,6 +1228,9 @@ function printTree($nodes, $contactid, $systemId, $canEdit, $canDelete, $langs, if (!$hasConnection && $level > 0) { $nodeClass .= ' no-cable'; // durchgeschleift - kein eigenes Kabel } + if (!empty($node->decommissioned)) { + $nodeClass .= ' decommissioned'; + } if ($node->type_can_have_equipment) { $nodeClass .= ' node-equipment'; // Geräte-Container (Schaltschrank, Verteiler) } elseif ($node->type_can_have_children) { @@ -1260,6 +1266,14 @@ function printTree($nodes, $contactid, $systemId, $canEdit, $canDelete, $langs, } print ''; + // Ausgebaut-Badge mit Datum + if (!empty($node->decommissioned)) { + $decommDate = !empty($node->date_decommissioned) ? dol_print_date(strtotime($node->date_decommissioned), 'day') : ''; + $decommText = $langs->trans('Decommissioned'); + if ($decommDate) $decommText .= ' '.$decommDate; + print ' '.$decommText.''; + } + // Spacer to push badges to the right print ''; @@ -1302,6 +1316,9 @@ function printTree($nodes, $contactid, $systemId, $canEdit, $canDelete, $langs, print ''; print ''; + $decommLabel = $node->decommissioned ? $langs->trans('Recommission') : $langs->trans('Decommission'); + $decommIcon = $node->decommissioned ? 'fa-plug' : 'fa-power-off'; + print ''; } if ($canDelete) { print ''; @@ -1503,6 +1520,9 @@ function printTreeWithCableLines($nodes, $contactid, $systemId, $canEdit, $canDe if (!$hasConnection && $level > 0) { $nodeClass .= ' no-cable'; } + if (!empty($node->decommissioned)) { + $nodeClass .= ' decommissioned'; + } print '
'; @@ -1559,6 +1579,14 @@ function printTreeWithCableLines($nodes, $contactid, $systemId, $canEdit, $canDe } print ''; + // Ausgebaut-Badge mit Datum + if (!empty($node->decommissioned)) { + $decommDate = !empty($node->date_decommissioned) ? dol_print_date(strtotime($node->date_decommissioned), 'day') : ''; + $decommText = $langs->trans('Decommissioned'); + if ($decommDate) $decommText .= ' '.$decommDate; + print ' '.$decommText.''; + } + // Spacer to push badges to the right print ''; @@ -1598,6 +1626,9 @@ function printTreeWithCableLines($nodes, $contactid, $systemId, $canEdit, $canDe print ''; print ''; + $decommLabel = $node->decommissioned ? $langs->trans('Recommission') : $langs->trans('Decommission'); + $decommIcon = $node->decommissioned ? 'fa-plug' : 'fa-power-off'; + print ''; } if ($canDelete) { print '';