This commit is contained in:
@@ -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.';
|
||||
|
||||
Reference in New Issue
Block a user