From 0b9ca65a69d399d2c9fc5eb533b743c0459968b2 Mon Sep 17 00:00:00 2001 From: data Date: Fri, 20 Feb 2026 12:19:34 +0100 Subject: [PATCH] Add category filter to contact_anlagen.php Contact tab was missing the category selection (Building/Structure vs Technical Element) that filters the available types. This caused electrical system types not to be selectable. Synced the create/edit form code from anlagen.php to contact_anlagen.php. Co-Authored-By: Claude Opus 4.5 --- core/modules/modKundenKarte.class.php | 2 +- tabs/contact_anlagen.php | 157 ++++++++++++++++++++++++-- 2 files changed, 146 insertions(+), 13 deletions(-) diff --git a/core/modules/modKundenKarte.class.php b/core/modules/modKundenKarte.class.php index b283733..29bbbdf 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 = '4.0.1'; + $this->version = '4.0.2'; // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; diff --git a/tabs/contact_anlagen.php b/tabs/contact_anlagen.php index 64b93d7..7dbe2d8 100755 --- a/tabs/contact_anlagen.php +++ b/tabs/contact_anlagen.php @@ -636,16 +636,80 @@ if (empty($customerSystems)) { print ''.$langs->trans('Label').''; print ''; - // Type - print ''.$langs->trans('Type').''; + // Kategorie (Gebäude/Standort vs Element/Gerät) + $currentCategory = ''; + if (($isEdit || $isCopy) && !empty($anlage->fk_anlage_type)) { + // Kategorie des aktuellen Typs ermitteln + foreach ($types as $t) { + if ($t->id == $anlage->fk_anlage_type) { + $currentCategory = ($t->system_code === 'GLOBAL') ? 'building' : 'element'; + break; + } + } + } + $postedCategory = GETPOST('element_category', 'alpha'); + if ($postedCategory) $currentCategory = $postedCategory; + + print ''.$langs->trans('Category').''; + print ''; + + // Type (gefiltert nach Kategorie) + print ''.$langs->trans('Type').''; print ''; if (empty($types)) { print '
'.$langs->trans('NoTypesDefinedForSystem').''; @@ -679,12 +743,18 @@ if (empty($customerSystems)) { print ''; - // JavaScript: Select2 mit Icons für Type und Parent + // JavaScript: Kategorie-Filter + Select2 mit Icons print '