prohibited negative recharge
This commit is contained in:
parent
f410d9e350
commit
df4b740472
5 changed files with 15 additions and 6 deletions
|
@ -45,12 +45,17 @@ postRechargeR uId = do
|
||||||
((res, _), _) <- runFormPost rechargeForm
|
((res, _), _) <- runFormPost rechargeForm
|
||||||
case res of
|
case res of
|
||||||
FormSuccess amount -> do
|
FormSuccess amount -> do
|
||||||
updateCashier amount ("Guthaben: " `T.append` (userIdent user))
|
case amount < 0 of
|
||||||
time <- liftIO getCurrentTime
|
False -> do
|
||||||
secs <- return $ R.read $ formatTime defaultTimeLocale "%s" time
|
updateCashier amount ("Guthaben: " `T.append` (userIdent user))
|
||||||
runDB $ update uId [UserBalance +=. amount, UserTimestamp =. secs]
|
time <- liftIO getCurrentTime
|
||||||
setMessageI MsgRecharged
|
secs <- return $ R.read $ formatTime defaultTimeLocale "%s" time
|
||||||
redirect $ HomeR
|
runDB $ update uId [UserBalance +=. amount, UserTimestamp =. secs]
|
||||||
|
setMessageI MsgRecharged
|
||||||
|
redirect $ HomeR
|
||||||
|
True -> do
|
||||||
|
setMessageI MsgNegativeRecharge
|
||||||
|
redirect $ RechargeR uId
|
||||||
_ -> do
|
_ -> do
|
||||||
setMessageI MsgRechargeError
|
setMessageI MsgRechargeError
|
||||||
redirect $ HomeR
|
redirect $ HomeR
|
||||||
|
|
|
@ -80,5 +80,6 @@ SelectFile: Vyber soubor
|
||||||
RestoreSuccess: Databáze znovu nahrána!
|
RestoreSuccess: Databáze znovu nahrána!
|
||||||
InventoryBackup: Stahnout zálohu
|
InventoryBackup: Stahnout zálohu
|
||||||
RestoreFromBackup: Nahrát záĺohu
|
RestoreFromBackup: Nahrát záĺohu
|
||||||
|
NegativeRecharge: Nelze nabít negativní obnos
|
||||||
Increment: ++
|
Increment: ++
|
||||||
Decrement: --
|
Decrement: --
|
||||||
|
|
|
@ -80,5 +80,6 @@ SelectFile: Datei auswählen
|
||||||
RestoreSuccess: Datenbankwiederherstellung erfolgreich!
|
RestoreSuccess: Datenbankwiederherstellung erfolgreich!
|
||||||
InventoryBackup: Inventarsicherung herunterladen
|
InventoryBackup: Inventarsicherung herunterladen
|
||||||
RestoreFromBackup: Inventar wiederherstellen
|
RestoreFromBackup: Inventar wiederherstellen
|
||||||
|
NegativeRecharge: Keine negativen Beträge aufladen
|
||||||
Increment: ++
|
Increment: ++
|
||||||
Decrement: --
|
Decrement: --
|
||||||
|
|
|
@ -80,5 +80,6 @@ SelectFile: Select file
|
||||||
RestoreSuccess: Database restored successfully!
|
RestoreSuccess: Database restored successfully!
|
||||||
InventoryBackup: Backup inventory
|
InventoryBackup: Backup inventory
|
||||||
RestoreFromBackup: Restore from backup
|
RestoreFromBackup: Restore from backup
|
||||||
|
NegativeRecharge: You can not recharge negative amounts
|
||||||
Increment: ++
|
Increment: ++
|
||||||
Decrement: --
|
Decrement: --
|
||||||
|
|
|
@ -80,5 +80,6 @@ SelectFile: wybierz plik
|
||||||
RestoreSuccess: baza danych pomyślnie przywrócona!
|
RestoreSuccess: baza danych pomyślnie przywrócona!
|
||||||
InventoryBackup: kopia zapasowa inwentarza
|
InventoryBackup: kopia zapasowa inwentarza
|
||||||
RestoreFromBackup: przywróć z kopii zapasowej
|
RestoreFromBackup: przywróć z kopii zapasowej
|
||||||
|
NegativeRecharge: You can not recharge negative amounts
|
||||||
Increment: ++
|
Increment: ++
|
||||||
Decrement: --
|
Decrement: --
|
||||||
|
|
Loading…
Reference in a new issue