Actualiser api/index.php
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
Security Scan (Trivy) / Trivy — Docker image scan (push) Has been cancelled
Security Scan (Trivy) / Trivy — Filesystem scan (push) Has been cancelled
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
Security Scan (Trivy) / Trivy — Docker image scan (push) Has been cancelled
Security Scan (Trivy) / Trivy — Filesystem scan (push) Has been cancelled
This commit is contained in:
+1
-10
@@ -2702,16 +2702,7 @@ function saveProduct(PDO $db): void {
|
|||||||
$shoppingName = array_key_exists('shopping_name', $input) && $input['shopping_name'] !== null && $input['shopping_name'] !== ''
|
$shoppingName = array_key_exists('shopping_name', $input) && $input['shopping_name'] !== null && $input['shopping_name'] !== ''
|
||||||
? $input['shopping_name']
|
? $input['shopping_name']
|
||||||
: computeShoppingName($input['name'], $input['category'] ?? '', $input['brand'] ?? '');
|
: computeShoppingName($input['name'], $input['category'] ?? '', $input['brand'] ?? '');
|
||||||
// Sous-catégorie : toujours optionnelle, sauf obligatoire pour les boissons
|
|
||||||
$category = $input['category'] ?? '';
|
|
||||||
$subcategory = trim($input['subcategory'] ?? '');
|
|
||||||
$validSubcategories = ['vin', 'biere', 'spiritueux', 'soda', 'jus', 'eau', 'autre'];
|
|
||||||
if ($category === 'bevande' && ($subcategory === '' || !in_array($subcategory, $validSubcategories, true))) {
|
|
||||||
http_response_code(400);
|
|
||||||
echo json_encode(['error' => 'subcategory_required', 'message' => 'Sous-catégorie requise pour les boissons']);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ($subcategory === '') $subcategory = null;
|
|
||||||
// Sous-catégorie obligatoire uniquement pour les boissons
|
// Sous-catégorie obligatoire uniquement pour les boissons
|
||||||
$category = $input['category'] ?? '';
|
$category = $input['category'] ?? '';
|
||||||
$subcategory = trim($input['subcategory'] ?? '');
|
$subcategory = trim($input['subcategory'] ?? '');
|
||||||
|
|||||||
Reference in New Issue
Block a user