Add Einrichtung and Fachbereich as permission/filter types (knowledgecenter + tasks)

- Create knowledgecenter_category_einricht, _fachbereich, knowledgecenter_post_einricht,
  knowledgecenter_post_fachbereich tables; extend task_target_rule with main_einricht_id
  and main_bereich_id columns
- Middleware: load main_einricht_id/main_bereich_id from main_contact_department,
  expose $allowedEinrichts/$allowedFachbereiche globals (same pattern as existing 3 types)
- Ajax: add update_category/post_einrichts/fachbereiche functions, extend
  update_category_links() and search filter query
- Views: add einricht/fachbereich LEFT JOINs and WHERE filters in all 5 query sites
  (categories_posts_listform, category_posts_widget, post_announcement_listform,
  post_cardform userHasAccessForPost, Ajax search)
- post_cardform_settings: add Einrichtungen/Fachbereiche tagify pickers with save/load
- Tasks: add listEinrichts/listFachbereiche to repo+service, add UI selects in task_form,
  extend target-rule normalization and upsert builder, extend AssignmentResolverService
  scope loading and matchesAnyRule to include einricht/fachbereich matching

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 11:03:53 +02:00
parent 8fa061afac
commit eb3aa75615
13 changed files with 477 additions and 82 deletions

View File

@@ -196,6 +196,8 @@ function task_cert_normalize_target_selection(array $targetRules, array $targetO
'mandant_ids' => [],
'department_ids' => [],
'role_ids' => [],
'einricht_ids' => [],
'fachbereich_ids' => [],
'override_include_contact_ids' => [],
'override_exclude_contact_ids' => [],
'override_include_reason' => '',
@@ -206,6 +208,8 @@ function task_cert_normalize_target_selection(array $targetRules, array $targetO
$mandantId = (int) ($rule['main_mandant_id'] ?? 0);
$departmentId = (int) ($rule['main_department_id'] ?? 0);
$roleId = (int) ($rule['main_role_id'] ?? 0);
$einrichtId = (int) ($rule['main_einricht_id'] ?? 0);
$fachbereichId = (int) ($rule['main_bereich_id'] ?? 0);
if ($mandantId > 0) {
$selection['mandant_ids'][] = $mandantId;
@@ -218,6 +222,14 @@ function task_cert_normalize_target_selection(array $targetRules, array $targetO
if ($roleId > 0) {
$selection['role_ids'][] = $roleId;
}
if ($einrichtId > 0) {
$selection['einricht_ids'][] = $einrichtId;
}
if ($fachbereichId > 0) {
$selection['fachbereich_ids'][] = $fachbereichId;
}
}
foreach ($targetOverrides as $override) {
@@ -246,6 +258,8 @@ function task_cert_normalize_target_selection(array $targetRules, array $targetO
'mandant_ids',
'department_ids',
'role_ids',
'einricht_ids',
'fachbereich_ids',
'override_include_contact_ids',
'override_exclude_contact_ids',
];