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:
+6
-6
@@ -2837,6 +2837,7 @@ function saveProduct(PDO $db): void {
|
||||
$input['default_quantity'] ?? 1, $input['notes'] ?? '',
|
||||
$barcode, $input['package_unit'] ?? '',
|
||||
$shoppingName, $nutriJson,
|
||||
$input['display_unit_key'] ?? null,
|
||||
];
|
||||
|
||||
try {
|
||||
@@ -2844,17 +2845,16 @@ function saveProduct(PDO $db): void {
|
||||
$stmt = $db->prepare("
|
||||
UPDATE products SET name=?, brand=?, category=?, subcategory=?, image_url=?, unit=?,
|
||||
default_quantity=?, notes=?, barcode=?, package_unit=?, shopping_name=?,
|
||||
nutriments_json=?,
|
||||
nutriments_json=?, display_unit_key=?,
|
||||
updated_at=CURRENT_TIMESTAMP WHERE id=?
|
||||
");
|
||||
$stmt->execute([...$params, $id]);
|
||||
echo json_encode(['success' => true, 'id' => $id, 'merged' => $merged]);
|
||||
return;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare("
|
||||
INSERT INTO products (name, brand, category, subcategory, image_url, unit, default_quantity, notes, barcode, package_unit, shopping_name, nutriments_json)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
INSERT INTO products (name, brand, category, subcategory, image_url, unit, default_quantity, notes, barcode, package_unit, shopping_name, nutriments_json, display_unit_key)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
");
|
||||
$stmt->execute($params);
|
||||
echo json_encode(['success' => true, 'id' => (int)$db->lastInsertId(), 'merged' => false]);
|
||||
@@ -2865,7 +2865,7 @@ function saveProduct(PDO $db): void {
|
||||
$stmt = $db->prepare("
|
||||
UPDATE products SET name=?, brand=?, category=?, subcategory=?, image_url=?, unit=?,
|
||||
default_quantity=?, notes=?, barcode=?, package_unit=?, shopping_name=?,
|
||||
nutriments_json=?,
|
||||
nutriments_json=?, display_unit_key=?,
|
||||
updated_at=CURRENT_TIMESTAMP WHERE id=?
|
||||
");
|
||||
$stmt->execute([...$params, $owner]);
|
||||
@@ -3104,7 +3104,7 @@ function listInventory(PDO $db): void {
|
||||
$location = $_GET['location'] ?? '';
|
||||
$query = "
|
||||
SELECT i.*, p.name, p.brand, p.category, p.subcategory, p.image_url, p.unit, p.barcode, p.default_quantity, p.package_unit,
|
||||
COALESCE(i.vacuum_sealed, 0) as vacuum_sealed, i.opened_at, p.shopping_name
|
||||
COALESCE(i.vacuum_sealed, 0) as vacuum_sealed, i.opened_at, p.shopping_name, p.display_unit_key
|
||||
FROM inventory i
|
||||
JOIN products p ON i.product_id = p.id
|
||||
WHERE i.quantity > 0
|
||||
|
||||
Reference in New Issue
Block a user