mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-25 03:08:51 +02:00
Show a meaningful flash warning if trying to add/withdraw an amount of 0 instead of throwing an exception
Fixes issue #448
This commit is contained in:
parent
b5721dcfd0
commit
ea9cc6723f
2 changed files with 51 additions and 39 deletions
|
@ -414,6 +414,12 @@ class PartController extends AbstractController
|
|||
throw new \LogicException("The timestamp must not be in the future!");
|
||||
}
|
||||
|
||||
//Ensure that the amount is not null or negative
|
||||
if ($amount <= 0) {
|
||||
$this->addFlash('warning', 'part.withdraw.zero_amount');
|
||||
goto err;
|
||||
}
|
||||
|
||||
try {
|
||||
switch ($action) {
|
||||
case "withdraw":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue