restricting payout to available funds
This commit is contained in:
parent
851595911d
commit
7a2720f57e
2 changed files with 11 additions and 5 deletions
|
@ -37,10 +37,16 @@ postPayoutR = do
|
|||
$ renderBootstrap3 BootstrapBasicForm payoutForm
|
||||
case res of
|
||||
FormSuccess payment -> do
|
||||
msg <- renderMessage' $ MsgPayout $ paymentDesc payment
|
||||
updateCashier (- (paymentAmount payment)) msg
|
||||
setMessageI MsgPaidOut
|
||||
redirect HomeR
|
||||
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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: yammat
|
||||
version: 0.0.7
|
||||
version: 0.0.8
|
||||
cabal-version: >= 1.8
|
||||
build-type: Simple
|
||||
license: AGPL-3
|
||||
|
|
Loading…
Reference in a new issue