diff --git a/hledger-web/Hledger/Web/Handler/AddR.hs b/hledger-web/Hledger/Web/Handler/AddR.hs index 3e9c15ba74b..d5c53307f19 100644 --- a/hledger-web/Hledger/Web/Handler/AddR.hs +++ b/hledger-web/Hledger/Web/Handler/AddR.hs @@ -7,14 +7,20 @@ module Hledger.Web.Handler.AddR ( getAddR , postAddR + , putAddR ) where +import Data.Aeson.Types (Result(..)) import qualified Data.Text as T +import Network.HTTP.Types.Status (status400) import Text.Blaze.Html (preEscapedToHtml) +import Yesod import Hledger -import Hledger.Cli.Commands.Add (appendToJournalFileOrStdout) +import Hledger.Cli.Commands.Add (appendToJournalFileOrStdout, journalAddTransaction) import Hledger.Web.Import +import Hledger.Web.Json () +import Hledger.Web.WebOptions (WebOpts(..)) import Hledger.Web.Widget.AddForm (addForm) getAddR :: Handler () @@ -31,6 +37,7 @@ postAddR = do let t = txnTieKnot res' -- XXX(?) move into balanceTransaction liftIO $ ensureJournalFileExists (journalFilePath j) + -- XXX why not journalAddTransaction ? liftIO $ appendToJournalFileOrStdout (journalFilePath j) (showTransaction t) setMessage "Transaction added." redirect JournalR @@ -46,3 +53,17 @@ postAddR = do