From: Charles McGarvey Date: Sun, 30 Jan 2022 03:55:37 +0000 (-0700) Subject: Version 0.010 X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=5de4bfe99b744735e3958e04619b27459313acc5;p=chaz%2Fhomebank2ledger Version 0.010 --- diff --git a/Changes b/Changes index f6a4c11..e02e730 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,9 @@ Revision history for App-HomeBank2Ledger. +0.010 2022-01-29 20:55:19-07:00 America/Denver + * Set code from the transaction info if transaction type is check. + * Fix formatter error for symbols that have special characters. + 0.009 2022-01-15 16:40:58-07:00 America/Denver * Use posting dates for internal transfers where the transactions have different dates. diff --git a/META.json b/META.json index a784580..45bf08d 100644 --- a/META.json +++ b/META.json @@ -85,31 +85,31 @@ "provides" : { "App::HomeBank2Ledger" : { "file" : "lib/App/HomeBank2Ledger.pm", - "version" : "0.009" + "version" : "0.010" }, "App::HomeBank2Ledger::Formatter" : { "file" : "lib/App/HomeBank2Ledger/Formatter.pm", - "version" : "0.009" + "version" : "0.010" }, "App::HomeBank2Ledger::Formatter::Beancount" : { "file" : "lib/App/HomeBank2Ledger/Formatter/Beancount.pm", - "version" : "0.009" + "version" : "0.010" }, "App::HomeBank2Ledger::Formatter::Ledger" : { "file" : "lib/App/HomeBank2Ledger/Formatter/Ledger.pm", - "version" : "0.009" + "version" : "0.010" }, "App::HomeBank2Ledger::Ledger" : { "file" : "lib/App/HomeBank2Ledger/Ledger.pm", - "version" : "0.009" + "version" : "0.010" }, "App::HomeBank2Ledger::Util" : { "file" : "lib/App/HomeBank2Ledger/Util.pm", - "version" : "0.009" + "version" : "0.010" }, "File::HomeBank" : { "file" : "lib/File/HomeBank.pm", - "version" : "0.009" + "version" : "0.010" } }, "release_status" : "stable", @@ -124,7 +124,7 @@ "web" : "https://github.com/chazmcgarvey/homebank2ledger" } }, - "version" : "0.009", + "version" : "0.010", "x_authority" : "cpan:CCM", "x_generated_by_perl" : "v5.28.0", "x_serialization_backend" : "Cpanel::JSON::XS version 4.25", diff --git a/META.yml b/META.yml index e29ada5..e85798d 100644 --- a/META.yml +++ b/META.yml @@ -27,25 +27,25 @@ no_index: provides: App::HomeBank2Ledger: file: lib/App/HomeBank2Ledger.pm - version: '0.009' + version: '0.010' App::HomeBank2Ledger::Formatter: file: lib/App/HomeBank2Ledger/Formatter.pm - version: '0.009' + version: '0.010' App::HomeBank2Ledger::Formatter::Beancount: file: lib/App/HomeBank2Ledger/Formatter/Beancount.pm - version: '0.009' + version: '0.010' App::HomeBank2Ledger::Formatter::Ledger: file: lib/App/HomeBank2Ledger/Formatter/Ledger.pm - version: '0.009' + version: '0.010' App::HomeBank2Ledger::Ledger: file: lib/App/HomeBank2Ledger/Ledger.pm - version: '0.009' + version: '0.010' App::HomeBank2Ledger::Util: file: lib/App/HomeBank2Ledger/Util.pm - version: '0.009' + version: '0.010' File::HomeBank: file: lib/File/HomeBank.pm - version: '0.009' + version: '0.010' 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.009' +version: '0.010' 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 97b7b12..aaf72b9 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -41,7 +41,7 @@ my %WriteMakefileArgs = ( "IPC::Open3" => 0, "Test::More" => 0 }, - "VERSION" => "0.009", + "VERSION" => "0.010", "test" => { "TESTS" => "t/*.t" } diff --git a/README b/README index 2649173..97794a6 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ NAME VERSION - version 0.009 + version 0.010 SYNOPSIS diff --git a/bin/homebank2ledger b/bin/homebank2ledger index 2bfd51a..4da092a 100644 --- a/bin/homebank2ledger +++ b/bin/homebank2ledger @@ -10,7 +10,7 @@ use strict; use App::HomeBank2Ledger; -our $VERSION = '0.009'; # VERSION +our $VERSION = '0.010'; # VERSION App::HomeBank2Ledger->main(@ARGV); @@ -26,7 +26,7 @@ homebank2ledger - A tool to convert HomeBank files to Ledger format =head1 VERSION -version 0.009 +version 0.010 =head1 SYNOPSIS diff --git a/lib/App/HomeBank2Ledger.pm b/lib/App/HomeBank2Ledger.pm index 5a22d62..3a6e62f 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.009'; # VERSION +our $VERSION = '0.010'; # VERSION my %ACCOUNT_TYPES = ( # map HomeBank account types to Ledger accounts bank => 'Assets:Bank', @@ -265,6 +265,8 @@ sub convert_homebank_to_ledger { my $payee = $homebank->find_payee_by_key($transaction->{payee}); my $tags = _split_tags($transaction->{tags}); my $date = $transaction->{date}; + my $code = $transaction->{paymode} =~ /^(?:check|epayment)$/ ? $transaction->{info} + : undef; my @postings; @@ -362,6 +364,7 @@ sub convert_homebank_to_ledger { $ledger->add_transactions({ date => $date, payee => $payee->{name}, + code => $code, memo => $memo, postings => \@postings, }); @@ -449,7 +452,7 @@ App::HomeBank2Ledger - A tool to convert HomeBank files to Ledger format =head1 VERSION -version 0.009 +version 0.010 =head1 SYNOPSIS diff --git a/lib/App/HomeBank2Ledger/Formatter.pm b/lib/App/HomeBank2Ledger/Formatter.pm index fb2059b..fc6b0e5 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.009'; # VERSION +our $VERSION = '0.010'; # VERSION sub _croak { require Carp; Carp::croak(@_) } @@ -59,7 +59,7 @@ App::HomeBank2Ledger::Formatter - Abstract class for formatting a ledger =head1 VERSION -version 0.009 +version 0.010 =head1 SYNOPSIS diff --git a/lib/App/HomeBank2Ledger/Formatter/Beancount.pm b/lib/App/HomeBank2Ledger/Formatter/Beancount.pm index 8cdcb1c..48b48b9 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.009'; # VERSION +our $VERSION = '0.010'; # VERSION my %STATUS_SYMBOLS = ( cleared => '*', @@ -302,7 +302,7 @@ App::HomeBank2Ledger::Formatter::Beancount - Beancount formatter =head1 VERSION -version 0.009 +version 0.010 =head1 DESCRIPTION diff --git a/lib/App/HomeBank2Ledger/Formatter/Ledger.pm b/lib/App/HomeBank2Ledger/Formatter/Ledger.pm index 7385165..1588bc0 100644 --- a/lib/App/HomeBank2Ledger/Formatter/Ledger.pm +++ b/lib/App/HomeBank2Ledger/Formatter/Ledger.pm @@ -10,12 +10,13 @@ use App::HomeBank2Ledger::Util qw(commify rtrim); use parent 'App::HomeBank2Ledger::Formatter'; -our $VERSION = '0.009'; # VERSION +our $VERSION = '0.010'; # VERSION my %STATUS_SYMBOLS = ( cleared => '*', pending => '!', ); +my $SYMBOL = qr![^\s\d.,;:?\!\-+*/^&|=\<\>\[\]\(\)\{\}\@]+!; sub _croak { require Carp; Carp::croak(@_) } @@ -266,6 +267,13 @@ sub _quote_string { return "\"$str\""; } +sub _format_symbol { + my $self = shift; + my $str = shift; + return $self->_quote_string($str) if $str !~ /^${SYMBOL}$/; + return $str; +} + sub _format_amount { my $self = shift; my $amount = shift; @@ -280,9 +288,7 @@ sub _format_amount { $num .= $commodity->{dchar} . $fraction; } - my $symbol = $commodity->{symbol}; - $symbol = $self->_quote_string($symbol) if $symbol =~ /[0-9\s]/; - + my $symbol = $self->_format_symbol($commodity->{symbol}); $num = $commodity->{syprf} ? "$symbol $num" : "$num $symbol"; return $num; @@ -302,7 +308,7 @@ App::HomeBank2Ledger::Formatter::Ledger - Ledger formatter =head1 VERSION -version 0.009 +version 0.010 =head1 DESCRIPTION diff --git a/lib/App/HomeBank2Ledger/Ledger.pm b/lib/App/HomeBank2Ledger/Ledger.pm index f3aadf3..69af8a6 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.009'; # VERSION +our $VERSION = '0.010'; # VERSION sub new { @@ -63,7 +63,7 @@ App::HomeBank2Ledger::Ledger - Ledger data representation =head1 VERSION -version 0.009 +version 0.010 =head1 SYNOPSIS diff --git a/lib/App/HomeBank2Ledger/Util.pm b/lib/App/HomeBank2Ledger/Util.pm index 2862228..274ecfb 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.009'; # VERSION +our $VERSION = '0.010'; # VERSION our @EXPORT_OK = qw(commify rtrim); @@ -42,7 +42,7 @@ App::HomeBank2Ledger::Util - Miscellaneous utility functions =head1 VERSION -version 0.009 +version 0.010 =head1 FUNCTIONS diff --git a/lib/File/HomeBank.pm b/lib/File/HomeBank.pm index 70278c0..c89d13a 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.009'; # VERSION +our $VERSION = '0.010'; # VERSION our @EXPORT_OK = qw(parse_string parse_file); @@ -502,7 +502,7 @@ File::HomeBank - Parse HomeBank files =head1 VERSION -version 0.009 +version 0.010 =head1 SYNOPSIS