diff --git a/services/nginx/app/routes/productsRoute.php b/services/nginx/app/routes/productsRoute.php index e824e7bc..07774f20 100644 --- a/services/nginx/app/routes/productsRoute.php +++ b/services/nginx/app/routes/productsRoute.php @@ -330,7 +330,7 @@ class productsRoute } ); } - if ($restrictCustomerBookingProducts) { + if ($restrictCustomerBookingProducts && !$productId) { $products = $this->filterProductsVisibleOnBookingForm($products); } // Return all products, with the department pricing and customer discounts applied diff --git a/services/nginx/app/tests/Api/OrderBookingsCreateApiTest.php b/services/nginx/app/tests/Api/OrderBookingsCreateApiTest.php index a741073e..3adaefcb 100644 --- a/services/nginx/app/tests/Api/OrderBookingsCreateApiTest.php +++ b/services/nginx/app/tests/Api/OrderBookingsCreateApiTest.php @@ -39,9 +39,7 @@ function order_booking_create_department(string $name): array function order_booking_create_department_price(int $departmentId, int $productId, int $price): void { - global $db; - - $statement = $db->prepare( + $statement = api_test_runtime()->db()->prepare( 'INSERT INTO `product_department_prices` (`department_id`, `product_id`, `price`) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE `price` = VALUES(`price`)' diff --git a/services/nginx/app/tests/Api/VehiclesApiTest.php b/services/nginx/app/tests/Api/VehiclesApiTest.php index 6ffe312e..a1e130ec 100644 --- a/services/nginx/app/tests/Api/VehiclesApiTest.php +++ b/services/nginx/app/tests/Api/VehiclesApiTest.php @@ -425,10 +425,12 @@ it('edits and deletes only matching customer vehicles through the user-scoped su ], $session['headers']); $deleted = api_client()->delete( '/superuser/users/' . $targetUser['id'] . '/vehicles?id=' . $deletableVehicle['id'], + null, $session['headers'] ); $foreignDelete = api_client()->delete( '/superuser/users/' . $targetUser['id'] . '/vehicles?id=' . $otherVehicle['id'], + null, $session['headers'] ); diff --git a/services/nginx/app/tests/Support/Api/ApiResponse.php b/services/nginx/app/tests/Support/Api/ApiResponse.php index 979dd0d4..a3c0826f 100644 --- a/services/nginx/app/tests/Support/Api/ApiResponse.php +++ b/services/nginx/app/tests/Support/Api/ApiResponse.php @@ -48,6 +48,11 @@ final class ApiResponse return $this; } + public function assertError(): self + { + return $this->assertSuccess(false); + } + public function assertMessage(string $expectedMessage): self { $this->assertEnvelope();