From 70c08d6b50d1947dea16ab203abffbdb141220f6 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 23 Aug 2022 05:46:59 +0200 Subject: [PATCH] Basic amount fix --- app/Http/Controllers/Budget/BudgetLimitController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php index 6a0b92ec68..34c1de175c 100644 --- a/app/Http/Controllers/Budget/BudgetLimitController.php +++ b/app/Http/Controllers/Budget/BudgetLimitController.php @@ -206,6 +206,14 @@ class BudgetLimitController extends Controller $amount = '0'; } + // sanity check on amount: + if ((float) $amount === 0.0) { + $amount = '1'; + } + if ((int) $amount > 65536) { + $amount = '65536'; + } + $limit = $this->blRepository->update($budgetLimit, ['amount' => $amount]); $array = $limit->toArray();