From: Charles McGarvey Date: Sun, 29 Dec 2019 21:28:18 +0000 (-0700) Subject: Version 0.007 X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fhomebank2ledger;a=commitdiff_plain;h=b980f9a0c4ed7902a2c57657d5971c13333f13ca Version 0.007 --- diff --git a/Changes b/Changes index d98cd36..60a9c79 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for App-HomeBank2Ledger. +0.007 2019-12-29 14:27:52-07:00 MST7MDT + * Fix problem when formatting non-fraction amounts. + 0.006 2019-09-02 20:02:53-06:00 MST7MDT * Add fatpack release. diff --git a/META.json b/META.json index 54f089d..2fb245e 100644 --- a/META.json +++ b/META.json @@ -85,31 +85,31 @@ "provides" : { "App::HomeBank2Ledger" : { "file" : "lib/App/HomeBank2Ledger.pm", - "version" : "0.006" + "version" : "0.007" }, "App::HomeBank2Ledger::Formatter" : { "file" : "lib/App/HomeBank2Ledger/Formatter.pm", - "version" : "0.006" + "version" : "0.007" }, "App::HomeBank2Ledger::Formatter::Beancount" : { "file" : "lib/App/HomeBank2Ledger/Formatter/Beancount.pm", - "version" : "0.006" + "version" : "0.007" }, "App::HomeBank2Ledger::Formatter::Ledger" : { "file" : "lib/App/HomeBank2Ledger/Formatter/Ledger.pm", - "version" : "0.006" + "version" : "0.007" }, "App::HomeBank2Ledger::Ledger" : { "file" : "lib/App/HomeBank2Ledger/Ledger.pm", - "version" : "0.006" + "version" : "0.007" }, "App::HomeBank2Ledger::Util" : { "file" : "lib/App/HomeBank2Ledger/Util.pm", - "version" : "0.006" + "version" : "0.007" }, "File::HomeBank" : { "file" : "lib/File/HomeBank.pm", - "version" : "0.006" + "version" : "0.007" } }, "release_status" : "stable", @@ -124,9 +124,9 @@ "web" : "https://github.com/chazmcgarvey/homebank2ledger" } }, - "version" : "0.006", + "version" : "0.007", "x_authority" : "cpan:CCM", "x_generated_by_perl" : "v5.28.0", - "x_serialization_backend" : "Cpanel::JSON::XS version 4.08" + "x_serialization_backend" : "Cpanel::JSON::XS version 4.15" } diff --git a/META.yml b/META.yml index 8cf88e7..516d8b0 100644 --- a/META.yml +++ b/META.yml @@ -27,25 +27,25 @@ no_index: provides: App::HomeBank2Ledger: file: lib/App/HomeBank2Ledger.pm - version: '0.006' + version: '0.007' App::HomeBank2Ledger::Formatter: file: lib/App/HomeBank2Ledger/Formatter.pm - version: '0.006' + version: '0.007' App::HomeBank2Ledger::Formatter::Beancount: file: lib/App/HomeBank2Ledger/Formatter/Beancount.pm - version: '0.006' + version: '0.007' App::HomeBank2Ledger::Formatter::Ledger: file: lib/App/HomeBank2Ledger/Formatter/Ledger.pm - version: '0.006' + version: '0.007' App::HomeBank2Ledger::Ledger: file: lib/App/HomeBank2Ledger/Ledger.pm - version: '0.006' + version: '0.007' App::HomeBank2Ledger::Util: file: lib/App/HomeBank2Ledger/Util.pm - version: '0.006' + version: '0.007' File::HomeBank: file: lib/File/HomeBank.pm - version: '0.006' + version: '0.007' requires: Carp: '0' Exporter: '0' @@ -65,7 +65,7 @@ resources: bugtracker: https://github.com/chazmcgarvey/homebank2ledger/issues homepage: https://github.com/chazmcgarvey/homebank2ledger repository: https://github.com/chazmcgarvey/homebank2ledger.git -version: '0.006' +version: '0.007' x_authority: cpan:CCM x_generated_by_perl: v5.28.0 x_serialization_backend: 'YAML::Tiny version 1.73' diff --git a/Makefile.PL b/Makefile.PL index b1cfb50..086544d 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -41,7 +41,7 @@ my %WriteMakefileArgs = ( "IPC::Open3" => 0, "Test::More" => 0 }, - "VERSION" => "0.006", + "VERSION" => "0.007", "test" => { "TESTS" => "t/*.t" } diff --git a/README b/README index 7f25f53..4e1f4cf 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ NAME VERSION - version 0.006 + version 0.007 SYNOPSIS diff --git a/bin/homebank2ledger b/bin/homebank2ledger index ce1c605..ee909bb 100644 --- a/bin/homebank2ledger +++ b/bin/homebank2ledger @@ -10,7 +10,7 @@ use strict; use App::HomeBank2Ledger; -our $VERSION = '0.006'; # VERSION +our $VERSION = '0.007'; # VERSION App::HomeBank2Ledger->main(@ARGV); @@ -26,7 +26,7 @@ homebank2ledger - A tool to convert HomeBank files to Ledger format =head1 VERSION -version 0.006 +version 0.007 =head1 SYNOPSIS diff --git a/lib/App/HomeBank2Ledger.pm b/lib/App/HomeBank2Ledger.pm index cc69d4e..57e32cb 100644 --- a/lib/App/HomeBank2Ledger.pm +++ b/lib/App/HomeBank2Ledger.pm @@ -11,7 +11,7 @@ use File::HomeBank; use Getopt::Long 2.38 qw(GetOptionsFromArray); use Pod::Usage; -our $VERSION = '0.006'; # VERSION +our $VERSION = '0.007'; # VERSION my %ACCOUNT_TYPES = ( # map HomeBank account types to Ledger accounts bank => 'Assets:Bank', @@ -446,7 +446,7 @@ App::HomeBank2Ledger - A tool to convert HomeBank files to Ledger format =head1 VERSION -version 0.006 +version 0.007 =head1 SYNOPSIS diff --git a/lib/App/HomeBank2Ledger/Formatter.pm b/lib/App/HomeBank2Ledger/Formatter.pm index cc18be5..53148a1 100644 --- a/lib/App/HomeBank2Ledger/Formatter.pm +++ b/lib/App/HomeBank2Ledger/Formatter.pm @@ -9,7 +9,7 @@ use Module::Load; use Module::Pluggable search_path => [__PACKAGE__], sub_name => 'available_formatters'; -our $VERSION = '0.006'; # VERSION +our $VERSION = '0.007'; # VERSION sub _croak { require Carp; Carp::croak(@_) } @@ -59,7 +59,7 @@ App::HomeBank2Ledger::Formatter - Abstract class for formatting a ledger =head1 VERSION -version 0.006 +version 0.007 =head1 SYNOPSIS diff --git a/lib/App/HomeBank2Ledger/Formatter/Beancount.pm b/lib/App/HomeBank2Ledger/Formatter/Beancount.pm index 7e3f785..85810b0 100644 --- a/lib/App/HomeBank2Ledger/Formatter/Beancount.pm +++ b/lib/App/HomeBank2Ledger/Formatter/Beancount.pm @@ -11,7 +11,7 @@ use Scalar::Util qw(looks_like_number); use parent 'App::HomeBank2Ledger::Formatter'; -our $VERSION = '0.006'; # VERSION +our $VERSION = '0.007'; # VERSION my %STATUS_SYMBOLS = ( cleared => '*', @@ -223,9 +223,13 @@ sub _format_amount { my $format = "\% .$commodity->{frac}f"; my ($whole, $fraction) = split(/\./, sprintf($format, $amount)); + $fraction ||= 0; # beancount doesn't support different notations - my $num = join('.', commify($whole), $fraction); + my $num = commify($whole); + if ($commodity->{frac}) { + $num .= ".$fraction"; + } $num = "$num $commodity->{iso}"; @@ -297,7 +301,7 @@ App::HomeBank2Ledger::Formatter::Beancount - Beancount formatter =head1 VERSION -version 0.006 +version 0.007 =head1 DESCRIPTION diff --git a/lib/App/HomeBank2Ledger/Formatter/Ledger.pm b/lib/App/HomeBank2Ledger/Formatter/Ledger.pm index ebfa456..6171fae 100644 --- a/lib/App/HomeBank2Ledger/Formatter/Ledger.pm +++ b/lib/App/HomeBank2Ledger/Formatter/Ledger.pm @@ -10,7 +10,7 @@ use App::HomeBank2Ledger::Util qw(commify rtrim); use parent 'App::HomeBank2Ledger::Formatter'; -our $VERSION = '0.006'; # VERSION +our $VERSION = '0.007'; # VERSION my %STATUS_SYMBOLS = ( cleared => '*', @@ -242,8 +242,12 @@ sub _format_amount { my $format = "\% .$commodity->{frac}f"; my ($whole, $fraction) = split(/\./, sprintf($format, $amount)); + $fraction ||= 0; - my $num = join($commodity->{dchar}, commify($whole, $commodity->{gchar}), $fraction); + my $num = commify($whole, $commodity->{gchar}); + if ($commodity->{frac}) { + $num .= $commodity->{dchar} . $fraction; + } my $symbol = $commodity->{symbol}; $symbol = $self->_quote_string($symbol) if $symbol =~ /[0-9\s]/; @@ -267,7 +271,7 @@ App::HomeBank2Ledger::Formatter::Ledger - Ledger formatter =head1 VERSION -version 0.006 +version 0.007 =head1 DESCRIPTION diff --git a/lib/App/HomeBank2Ledger/Ledger.pm b/lib/App/HomeBank2Ledger/Ledger.pm index 245e9b5..190a376 100644 --- a/lib/App/HomeBank2Ledger/Ledger.pm +++ b/lib/App/HomeBank2Ledger/Ledger.pm @@ -5,7 +5,7 @@ package App::HomeBank2Ledger::Ledger; use warnings; use strict; -our $VERSION = '0.006'; # VERSION +our $VERSION = '0.007'; # VERSION sub new { @@ -63,7 +63,7 @@ App::HomeBank2Ledger::Ledger - Ledger data representation =head1 VERSION -version 0.006 +version 0.007 =head1 SYNOPSIS diff --git a/lib/App/HomeBank2Ledger/Util.pm b/lib/App/HomeBank2Ledger/Util.pm index 3bf72b6..7096899 100644 --- a/lib/App/HomeBank2Ledger/Util.pm +++ b/lib/App/HomeBank2Ledger/Util.pm @@ -6,7 +6,7 @@ use strict; use Exporter qw(import); -our $VERSION = '0.006'; # VERSION +our $VERSION = '0.007'; # VERSION our @EXPORT_OK = qw(commify rtrim); @@ -42,7 +42,7 @@ App::HomeBank2Ledger::Util - Miscellaneous utility functions =head1 VERSION -version 0.006 +version 0.007 =head1 FUNCTIONS diff --git a/lib/File/HomeBank.pm b/lib/File/HomeBank.pm index e33b933..0e1c2bd 100644 --- a/lib/File/HomeBank.pm +++ b/lib/File/HomeBank.pm @@ -12,7 +12,7 @@ use Time::Piece; use XML::Entities; use XML::Parser::Lite; -our $VERSION = '0.006'; # VERSION +our $VERSION = '0.007'; # VERSION our @EXPORT_OK = qw(parse_string parse_file); @@ -418,8 +418,8 @@ sub parse_string { push @categories, \%attr; } elsif ($node eq 'ope') { # transaction - $attr{paymode} = $TRANSACTION_PAYMODES{$attr{paymode} || ''} || 'unknown'; - $attr{status} = $TRANSACTION_STATUSES{delete $attr{st}} || 'unknown'; + $attr{paymode} = $TRANSACTION_PAYMODES{$attr{paymode} || ''} || 'unknown'; + $attr{status} = $TRANSACTION_STATUSES{delete $attr{st} || ''} || 'unknown'; $attr{transfer_key} = delete $attr{kxfer} if $attr{kxfer}; $attr{split_amount} = delete $attr{samt} if $attr{samt}; @@ -491,7 +491,7 @@ File::HomeBank - Parse HomeBank files =head1 VERSION -version 0.006 +version 0.007 =head1 SYNOPSIS