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

This commit is contained in:
2026-08-19 20:33:08 +02:00
parent 39dfc97ae6
commit 5401e89a2b
5 changed files with 37 additions and 10 deletions

View File

@@ -333,12 +333,22 @@ final class AccountPages
if (!$canManageCategories || !$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.');
$currentCategorySlug = trim((string)($_POST['current_category_slug'] ?? ''));
$otherCategorySlug = $listingCatalog->resolveExistingCategorySlug((string)($_POST['other_category_input'] ?? ''));
if ($currentCategorySlug === '') {
throw new \RuntimeException('Bitte wähle eine Ausgangskategorie aus.');
}
if ($otherCategorySlug === null) {
throw new \RuntimeException('Bitte wähle eine vorhandene zweite Kategorie aus den Vorschlägen.');
}
if ($currentCategorySlug === $otherCategorySlug) {
throw new \RuntimeException('Bitte wähle zwei unterschiedliche Kategorien aus.');
}
$keepChoice = (string)($_POST['keep_category_choice'] ?? 'current');
$targetCategorySlug = $keepChoice === 'other' ? $otherCategorySlug : $currentCategorySlug;
$sourceCategorySlug = $keepChoice === 'other' ? $currentCategorySlug : $otherCategorySlug;
$listingCatalog->mergeCategories(
(string)($_POST['source_category_slug'] ?? ''),
$sourceCategorySlug,
$targetCategorySlug
);
$info = 'Kategorie zusammengeführt.';