asdasd
All checks were successful
Deploy / deploy (push) Successful in 53s

This commit is contained in:
2026-08-17 00:49:49 +02:00
parent f7a6b34a97
commit c2eaa5c186
8 changed files with 86 additions and 37 deletions

View File

@@ -183,6 +183,7 @@ final class AccountPages
$allowedSections = ['profile', 'children', 'events', 'places', 'community', 'settings'];
if ($canManageSystemSettings) {
$allowedSections[] = 'system';
$allowedSections[] = 'categories';
}
if ($canManageProfileLevels) {
$allowedSections[] = 'profile-levels';
@@ -328,9 +329,13 @@ final class AccountPages
if (!$canManageSystemSettings || !$listingCatalog) {
throw new \RuntimeException('Keine Berechtigung für die Kategorien-Verwaltung.');
}
$targetCategorySlug = $listingCatalog->resolveExistingCategorySlug((string)($_POST['target_category_input'] ?? ''));
if ($targetCategorySlug === null) {
throw new \RuntimeException('Bitte wähle eine vorhandene Zielkategorie aus den Vorschlägen.');
}
$listingCatalog->mergeCategories(
(string)($_POST['source_category_slug'] ?? ''),
(string)($_POST['target_category_slug'] ?? '')
$targetCategorySlug
);
$info = 'Kategorie zusammengeführt.';
} elseif ($action === 'child_add' || $action === 'child_update') {
@@ -852,7 +857,10 @@ final class AccountPages
$restoreEventDraftActive = $section === 'events' && ((string)($_GET['restore_event_draft'] ?? '')) === '1' && self::hasStoredEventDraft();
$restoredEventDraft = $restoreEventDraftActive ? self::getStoredEventDraft() : null;
$listingCategories = $listingCatalog ? $listingCatalog->listCategories(['general', 'place', 'food', 'event', 'family']) : [];
$categoryReviewItems = $listingCatalog && $canManageSystemSettings ? $listingCatalog->listCategoryReviewItems() : [];
$categoryReviewItems = $listingCatalog && $canManageSystemSettings ? array_values(array_filter(
$listingCatalog->listCategoryReviewItems(),
static fn(array $item): bool => !empty($item['needs_review'])
)) : [];
$placeSuggestions = $listingCatalog ? $listingCatalog->listPlaceSuggestions(60) : [];
$eventLocationOptions = $listingCatalog ? $listingCatalog->listEventLocationOptions(120) : [];
$stmt = $pdo?->prepare(

View File

@@ -368,6 +368,29 @@ final class ListingCatalog
}
}
public function resolveExistingCategorySlug(string $input): ?string
{
$this->ensureSchema();
$input = trim($input);
if ($input === '') {
return null;
}
$stmt = $this->pdo->prepare(
'SELECT slug
FROM listing_categories
WHERE slug = :slug OR LOWER(title) = LOWER(:title)
ORDER BY sort_order ASC, id ASC
LIMIT 1'
);
$stmt->execute([
'slug' => $input,
'title' => $input,
]);
$slug = $stmt->fetchColumn();
return $slug !== false ? (string)$slug : null;
}
public function listPublishedDirectoryEntries(): array
{
$this->ensureSchema();