prohibited negative recharge

This commit is contained in:
nek0 2015-04-13 14:49:14 +02:00
parent f410d9e350
commit df4b740472
5 changed files with 15 additions and 6 deletions

View File

@ -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

View File

@ -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: --

View File

@ -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: --

View File

@ -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: --

View File

@ -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: --