]> Dogcows Code - chaz/homebank2ledger/blobdiff - lib/App/HomeBank2Ledger.pm
fix bug making --version, --help flags unusable
[chaz/homebank2ledger] / lib / App / HomeBank2Ledger.pm
index 52f426783dbbc815757b1f661953ebcd7df421a8..e152a7ef8b5818a48b38518f71c1f12dbe322aa4 100644 (file)
@@ -11,13 +11,6 @@ This module is part of the L<homebank2ledger> script.
 
 =cut
 
-# TODO - add posting memo
-# TODO - transaction description ("narration" in beancount)
-# TODO - payees
-# TODO - budget/scheduled
-# TODO - consolidate tags on transaction
-# TODO - consolidate payees on transaction
-
 use warnings FATAL => 'all';    # temp fatal all
 use strict;
 
@@ -73,6 +66,10 @@ sub main {
     if ($opts->{manual}) {
         pod2usage(-exitval => 0, -verbose => 2);
     }
+    if (!$opts->{input}) {
+        print STDERR "Input file is required.\n";
+        exit(1);
+    }
 
     my $homebank = File::HomeBank->new(file => $opts->{input});
 
@@ -198,7 +195,7 @@ sub convert_homebank_to_ledger {
     }
 
     if ($has_initial_balance) {
-        # transactions are sorted, so the first transaction is the earliest
+        # transactions are sorted, so the first transaction is the oldest
         my $first_date = $opts->{opening_date} || $transactions->[0]{date};
         if ($first_date !~ /^\d{4}-\d{2}-\d{2}$/) {
             die "Opening date must be in the form YYYY-MM-DD.\n";
@@ -313,7 +310,7 @@ sub convert_homebank_to_ledger {
                 commodity   => $commodities{$account->{currency}},
                 amount      => -$transaction->{amount},
                 payee       => $payee->{name},
-                memo        => '',  # TODO
+                memo        => $memo,
                 status      => $status,
                 tags        => $tags,
             };
@@ -328,7 +325,8 @@ sub convert_homebank_to_ledger {
 
         $ledger->add_transactions({
             date        => $transaction->{date},
-            payee       => 'Payee TODO',
+            payee       => $payee->{name},
+            memo        => $memo,
             postings    => \@postings,
         });
     }
@@ -406,10 +404,6 @@ sub parse_args {
     ) or pod2usage(-exitval => 1, -verbose => 99, -sections => [qw(SYNOPSIS OPTIONS)]);
 
     $opts{input} = shift @args if !$opts{input};
-    if (!$opts{input}) {
-        print STDERR "Input file is required.\n";
-        exit(1);
-    }
 
     return \%opts;
 }
This page took 0.01743 seconds and 4 git commands to generate.