WIP: Add formatter and some other stuff
This commit is contained in:
+7
-6
@@ -17,6 +17,7 @@
|
||||
|
||||
-include_lib("wx/include/wx.hrl").
|
||||
-include("$zx_include/zx_logger.hrl").
|
||||
-include("gd.hrl").
|
||||
|
||||
-record(s,
|
||||
{frame = none :: none | wx:wx_object(),
|
||||
@@ -232,7 +233,7 @@ done(#s{frame = Frame, caller = Caller,
|
||||
case clean_spend(TX) of
|
||||
{ok, CleanTX} ->
|
||||
|
||||
|
||||
end,
|
||||
Result =
|
||||
case wxTextCtrl:getValue(NameTx) of
|
||||
"" ->
|
||||
@@ -246,10 +247,12 @@ done(#s{frame = Frame, caller = Caller,
|
||||
ok = wxFrame:destroy(Frame),
|
||||
zxw_modal:done(Caller, Result).
|
||||
|
||||
clean_spend(TX) ->
|
||||
clean_spend(TX, []).
|
||||
|
||||
clean_spend(#spend_tx{recipient_id = ""}) ->
|
||||
ok;
|
||||
clean_spend( TX = #spend_tx{amount = S}) when is_list(S) ->
|
||||
clean_spend(TX = #spend_tx{recipient_id = ""}, Errors) ->
|
||||
clean_spend(TX#spend_tx{recipient_id = none}, [recipient_id | Errors]);
|
||||
clean_spend(TX = #spend_tx{amount = S}, Errors) when is_list(S) ->
|
||||
case string_to_price(S) of
|
||||
{ok, Amount} -> clean_spend(TX#spend_tx{amount = Amount});
|
||||
{error, _} -> ok
|
||||
@@ -270,5 +273,3 @@ clean_spend(TX) ->
|
||||
{ok, CleanTX}.
|
||||
|
||||
|
||||
is_int(S) ->
|
||||
lists:all(fun(C) -> $0 =< C andalso C =< $9 end, S).
|
||||
|
||||
Reference in New Issue
Block a user