restricting payout to available funds

This commit is contained in:
nek0 2017-10-19 17:11:33 +02:00
parent 851595911d
commit 7a2720f57e
2 changed files with 11 additions and 5 deletions

View file

@ -37,10 +37,16 @@ postPayoutR = do
$ renderBootstrap3 BootstrapBasicForm payoutForm
case res of
FormSuccess payment -> do
balance <- getCashierBalance
if balance >= payment
then
msg <- renderMessage' $ MsgPayout $ paymentDesc payment
updateCashier (- (paymentAmount payment)) msg
setMessageI MsgPaidOut
redirect HomeR
else
setMessageI MsgNotEnoughFunds
redirect HomeR
_ -> do
setMessageI MsgNotPaidOut
redirect JournalR

View file

@ -1,5 +1,5 @@
name: yammat
version: 0.0.7
version: 0.0.8
cabal-version: >= 1.8
build-type: Simple
license: AGPL-3