]> Dogcows Code - chaz/homebank2ledger/commitdiff
Version 0.010 dist
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Sun, 30 Jan 2022 03:55:37 +0000 (20:55 -0700)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Sun, 30 Jan 2022 03:55:37 +0000 (20:55 -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 f6a4c11503d8f594e16196da6ed5230d5124551f..e02e7303c9248ef12e9e87636fa1cbc685f739e7 100644 (file)
--- 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.
index a7845802cdc5eaa0e4d671d94e8750e657a1e615..45bf08dbbac5935c30c3ca5f41dcb78907fdf4c2 100644 (file)
--- a/META.json
+++ b/META.json
    "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",
          "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",
index e29ada59314466330b77f865943776c72f7b067c..e85798d5e658f1afd2a5607d9821d8f64c65a007 100644 (file)
--- 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'
index 97b7b12208e1d149a88e75239dbd48b8cf4b3035..aaf72b932e86ce8ed9dc5323fe2c4e84e51baf1d 100644 (file)
@@ -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 26491733889a1f61498eba80dc6903e0b7782ab7..97794a6acb756cb90e4e99d0a6b7091120b95220 100644 (file)
--- a/README
+++ b/README
@@ -4,7 +4,7 @@ NAME
 
 VERSION
 
-    version 0.009
+    version 0.010
 
 SYNOPSIS
 
index 2bfd51aaec1bf0282c390188081ae180ff18d754..4da092ac91a6de3d2f78ee8d055d38c867f4904f 100644 (file)
@@ -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
 
index 5a22d6234eb35b277adc5cf7df29d6a2b2bbf2e8..3a6e62f2127b02306f30e7689f9ade88e0fe3903 100644 (file)
@@ -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
 
index fb2059b99bce791b4bb36dcbca295b697a226626..fc6b0e5e055df3ce76ee9d996eee36097cc3fefe 100644 (file)
@@ -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
 
index 8cdcb1c8c4cccfa3fdca9ef4ae19db2480097eac..48b48b94eb3dc3d64bf2ddd751701bc6dec978c4 100644 (file)
@@ -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
 
index 7385165ba73be40a2975b195395c973378054338..1588bc07904a6a49e0c5bbd8b2660252d0a07318 100644 (file)
@@ -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
 
index f3aadf32ee5f429c2eaf1c9709441eb89eecbc26..69af8a6da29444f0590528caf7c9d7fd3fcaecd7 100644 (file)
@@ -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
 
index 28622282b4c9ad715fc9bf8838358a94a9ef0aca..274ecfb9faa6dba4b201d3459908a5b1a75814d5 100644 (file)
@@ -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
 
index 70278c04e455e5312dca48b0d14a94fca3cfffa9..c89d13ad3e06278469427e092de68bff460a5b8e 100644 (file)
@@ -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
 
This page took 0.044456 seconds and 4 git commands to generate.