]> Dogcows Code - chaz/homebank2ledger/commitdiff
Version 0.007
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Sun, 29 Dec 2019 21:28:18 +0000 (14:28 -0700)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Sun, 29 Dec 2019 21:28:18 +0000 (14:28 -0700)
13 files changed:
Changes
META.json
META.yml
Makefile.PL
README
bin/homebank2ledger
lib/App/HomeBank2Ledger.pm
lib/App/HomeBank2Ledger/Formatter.pm
lib/App/HomeBank2Ledger/Formatter/Beancount.pm
lib/App/HomeBank2Ledger/Formatter/Ledger.pm
lib/App/HomeBank2Ledger/Ledger.pm
lib/App/HomeBank2Ledger/Util.pm
lib/File/HomeBank.pm

diff --git a/Changes b/Changes
index d98cd365080f28d3d584db3672b1fb03c6ffafff..60a9c795a1da67c40457dd3d673f0025088bf3fc 100644 (file)
--- 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.
 
index 54f089dabefea69fa7d942595e32ef4f784598d2..2fb245e972d0ec203dfc9f19a576e669043fb3c0 100644 (file)
--- a/META.json
+++ b/META.json
    "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",
          "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"
 }
 
index 8cf88e757bcb936325252fc2b8300c284db7b67b..516d8b0fd16b0459e0eeaba1c25efc99f70ed0cc 100644 (file)
--- 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'
index b1cfb50cd8fd700679c9d5ac047c9e4cc1d584fb..086544d9c9929f1d4108b238235758c2dd953bc1 100644 (file)
@@ -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 7f25f535e94c214e62a353885e7f627bea7f7085..4e1f4cf1246bf597aa38f8b1a36d99bcf5b2cf96 100644 (file)
--- a/README
+++ b/README
@@ -4,7 +4,7 @@ NAME
 
 VERSION
 
-    version 0.006
+    version 0.007
 
 SYNOPSIS
 
index ce1c6057e038387413ec7ae5aafe5f390192d926..ee909bb908081375d6b0a3f333306616565cc7be 100644 (file)
@@ -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
 
index cc69d4e4b20444f83829e808e83d061104030cc9..57e32cbd432f1835813070d76f004b8e80e23316 100644 (file)
@@ -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
 
index cc18be56999d11c8d279705724bd7ca42b98bbdb..53148a1b4e439e8f6df019a4bc0f7075e44094d5 100644 (file)
@@ -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
 
index 7e3f7852bba326f7213d7c592c4fe47938f6c659..85810b03b231e59b40fe654a3407c4a9d50ddf46 100644 (file)
@@ -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
 
index ebfa45628a02bb782c723a0a22bf30bb43a036d7..6171faeeb5b4f2b6efc3e6990d35ce390fe8c2bd 100644 (file)
@@ -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
 
index 245e9b5ea697bf245c8b76c41004e68e89621446..190a376dc6273611cc45300e3e07cea688f96c69 100644 (file)
@@ -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
 
index 3bf72b6eaed79914e0bc6bf7b91595703a9a5636..70968991fcd0e9720ebb7bce58fecc5a2c283a6c 100644 (file)
@@ -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
 
index e33b9335731e7a568636b8c773eb162e2c9d8f6a..0e1c2bd04ddb03948e5ff691af0b6d3482a3e574 100644 (file)
@@ -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
 
This page took 0.03783 seconds and 4 git commands to generate.