Revision history for App-HomeBank2Ledger.
+0.008 2020-05-02 13:06:06-06:00 MST7MDT
+ * Add file_version method to File::HomeBank.
+ * Fix matching internal transfers for files generated by HomeBank 5.4.
+
0.007 2019-12-29 14:27:52-07:00 MST7MDT
* Fix problem when formatting non-fraction amounts.
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.014.
Changes
LICENSE
MANIFEST
"Charles McGarvey <chazmcgarvey@brokenzipper.com>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010",
+ "generated_by" : "Dist::Zilla version 6.014, CPAN::Meta::Converter version 2.150010",
"license" : [
"mit"
],
"provides" : {
"App::HomeBank2Ledger" : {
"file" : "lib/App/HomeBank2Ledger.pm",
- "version" : "0.007"
+ "version" : "0.008"
},
"App::HomeBank2Ledger::Formatter" : {
"file" : "lib/App/HomeBank2Ledger/Formatter.pm",
- "version" : "0.007"
+ "version" : "0.008"
},
"App::HomeBank2Ledger::Formatter::Beancount" : {
"file" : "lib/App/HomeBank2Ledger/Formatter/Beancount.pm",
- "version" : "0.007"
+ "version" : "0.008"
},
"App::HomeBank2Ledger::Formatter::Ledger" : {
"file" : "lib/App/HomeBank2Ledger/Formatter/Ledger.pm",
- "version" : "0.007"
+ "version" : "0.008"
},
"App::HomeBank2Ledger::Ledger" : {
"file" : "lib/App/HomeBank2Ledger/Ledger.pm",
- "version" : "0.007"
+ "version" : "0.008"
},
"App::HomeBank2Ledger::Util" : {
"file" : "lib/App/HomeBank2Ledger/Util.pm",
- "version" : "0.007"
+ "version" : "0.008"
},
"File::HomeBank" : {
"file" : "lib/File/HomeBank.pm",
- "version" : "0.007"
+ "version" : "0.008"
}
},
"release_status" : "stable",
"web" : "https://github.com/chazmcgarvey/homebank2ledger"
}
},
- "version" : "0.007",
+ "version" : "0.008",
"x_authority" : "cpan:CCM",
"x_generated_by_perl" : "v5.28.0",
- "x_serialization_backend" : "Cpanel::JSON::XS version 4.15"
+ "x_serialization_backend" : "Cpanel::JSON::XS version 4.15",
+ "x_spdx_expression" : "MIT"
}
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
-generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010'
+generated_by: 'Dist::Zilla version 6.014, CPAN::Meta::Converter version 2.150010'
license: mit
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
provides:
App::HomeBank2Ledger:
file: lib/App/HomeBank2Ledger.pm
- version: '0.007'
+ version: '0.008'
App::HomeBank2Ledger::Formatter:
file: lib/App/HomeBank2Ledger/Formatter.pm
- version: '0.007'
+ version: '0.008'
App::HomeBank2Ledger::Formatter::Beancount:
file: lib/App/HomeBank2Ledger/Formatter/Beancount.pm
- version: '0.007'
+ version: '0.008'
App::HomeBank2Ledger::Formatter::Ledger:
file: lib/App/HomeBank2Ledger/Formatter/Ledger.pm
- version: '0.007'
+ version: '0.008'
App::HomeBank2Ledger::Ledger:
file: lib/App/HomeBank2Ledger/Ledger.pm
- version: '0.007'
+ version: '0.008'
App::HomeBank2Ledger::Util:
file: lib/App/HomeBank2Ledger/Util.pm
- version: '0.007'
+ version: '0.008'
File::HomeBank:
file: lib/File/HomeBank.pm
- version: '0.007'
+ version: '0.008'
requires:
Carp: '0'
Exporter: '0'
bugtracker: https://github.com/chazmcgarvey/homebank2ledger/issues
homepage: https://github.com/chazmcgarvey/homebank2ledger
repository: https://github.com/chazmcgarvey/homebank2ledger.git
-version: '0.007'
+version: '0.008'
x_authority: cpan:CCM
x_generated_by_perl: v5.28.0
x_serialization_backend: 'YAML::Tiny version 1.73'
+x_spdx_expression: MIT
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012.
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.014.
use strict;
use warnings;
"IPC::Open3" => 0,
"Test::More" => 0
},
- "VERSION" => "0.007",
+ "VERSION" => "0.008",
"test" => {
"TESTS" => "t/*.t"
}
VERSION
- version 0.007
+ version 0.008
SYNOPSIS
use App::HomeBank2Ledger;
-our $VERSION = '0.007'; # VERSION
+our $VERSION = '0.008'; # VERSION
App::HomeBank2Ledger->main(@ARGV);
=head1 VERSION
-version 0.007
+version 0.008
=head1 SYNOPSIS
use Getopt::Long 2.38 qw(GetOptionsFromArray);
use Pod::Usage;
-our $VERSION = '0.007'; # VERSION
+our $VERSION = '0.008'; # VERSION
my %ACCOUNT_TYPES = ( # map HomeBank account types to Ledger accounts
bank => 'Assets:Bank',
my $account = $homebank->find_account_by_key($transaction->{account});
my $amount = $transaction->{amount};
my $status = $STATUS_SYMBOLS{$transaction->{status} || ''} || '';
- my $paymode = $transaction->{paymode} || ''; # internaltransfer
my $memo = $transaction->{wording} || '';
my $payee = $homebank->find_payee_by_key($transaction->{payee});
my $tags = _split_tags($transaction->{tags});
tags => $tags,
};
- if ($paymode eq 'internaltransfer') {
+ if ($transaction->{dst_account}) { # is an internal transfer
my $paired_transaction = $homebank->find_transaction_transfer_pair($transaction);
my $dst_account = $homebank->find_account_by_key($transaction->{dst_account});
=head1 VERSION
-version 0.007
+version 0.008
=head1 SYNOPSIS
use Module::Pluggable search_path => [__PACKAGE__],
sub_name => 'available_formatters';
-our $VERSION = '0.007'; # VERSION
+our $VERSION = '0.008'; # VERSION
sub _croak { require Carp; Carp::croak(@_) }
=head1 VERSION
-version 0.007
+version 0.008
=head1 SYNOPSIS
use parent 'App::HomeBank2Ledger::Formatter';
-our $VERSION = '0.007'; # VERSION
+our $VERSION = '0.008'; # VERSION
my %STATUS_SYMBOLS = (
cleared => '*',
=head1 VERSION
-version 0.007
+version 0.008
=head1 DESCRIPTION
use parent 'App::HomeBank2Ledger::Formatter';
-our $VERSION = '0.007'; # VERSION
+our $VERSION = '0.008'; # VERSION
my %STATUS_SYMBOLS = (
cleared => '*',
=head1 VERSION
-version 0.007
+version 0.008
=head1 DESCRIPTION
use warnings;
use strict;
-our $VERSION = '0.007'; # VERSION
+our $VERSION = '0.008'; # VERSION
sub new {
=head1 VERSION
-version 0.007
+version 0.008
=head1 SYNOPSIS
use Exporter qw(import);
-our $VERSION = '0.007'; # VERSION
+our $VERSION = '0.008'; # VERSION
our @EXPORT_OK = qw(commify rtrim);
=head1 VERSION
-version 0.007
+version 0.008
=head1 FUNCTIONS
use XML::Entities;
use XML::Parser::Lite;
-our $VERSION = '0.007'; # VERSION
+our $VERSION = '0.008'; # VERSION
our @EXPORT_OK = qw(parse_string parse_file);
}
+sub file_version {
+ shift->{homebank}{version};
+}
+
+
sub title {
shift->{properties}{title};
}
my $self = shift;
my $transaction = shift;
- return if $transaction->{paymode} ne 'internaltransfer';
+ return if !$transaction->{dst_account};
my $transfer_key = $transaction->{transfer_key};
my @candidates;
for my $t (@{$self->transactions}) {
- next if $t->{paymode} ne 'internaltransfer';
+ next if !$t->{dst_account};
next if $t->{account} != $transaction->{dst_account};
next if $t->{dst_account} != $transaction->{account};
next if $t->{amount} != -$transaction->{amount};
# sort the candidates so we can pick the nearest one by date
my @ordered_candidates =
- map { $_->[1] }
+ map { $_->[1] }
sort { $a->[0] <=> $b->[0] }
- map { [abs($transaction_day - _ymd_to_julian($_->{date})), $_] } @candidates;
+ map { [abs($transaction_day - _ymd_to_julian($_->{date})), $_] } @candidates;
if (my $winner = $ordered_candidates[0]) {
my $key1 = $transfer_key || '[no key]';
sub parse_string {
my $str = shift or die _usage(q{parse_string($str)});
+ my %homebank;
my %properties;
my @accounts;
my @payees;
$attr{$key} = _decode_xml_entities($attr{$key});
}
- if ($node eq 'properties') {
+ if ($node eq 'homebank') {
+ $attr{version} = delete $attr{v} if $attr{v};
+ %homebank = %attr;
+ }
+ elsif ($node eq 'properties') {
$attr{currency} = delete $attr{curr} if $attr{curr};
%properties = %attr;
}
$xml_parser->parse($str);
return {
+ homebank => \%homebank,
properties => \%properties,
accounts => \@accounts,
payees => \@payees,
=head1 VERSION
-version 0.007
+version 0.008
=head1 SYNOPSIS
Construct a L<File::HomeBank>.
+=head2 file_version
+
+ $version = $homebank->file_version;
+
+Get the file format version.
+
=head2 title
$title = $homebank->title;
$account = $homebank->find_account_by_key($key);
-Find a account with the given key.
+Find an account with the given key.
=head2 find_currency_by_key