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