[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

more is_zero problems in bin/aa.pl

continuing, I thought, to work on my 2011 expense reports,
I loaded an older semi-recurring transaction to intending to

(btw: handling recurring transactions for non-fixed amounts is a PITA
      for which I have a number of ideas.  For example, a long-distance
      or mobile phone bill)

I got:

 Can't call method "is_zero" on unblessed reference at /usr/share/perl5/Math/BigFloat.pm line 509., referer: https://marlin.sandelman.ca/ledgersmb/ap.pl
 Compilation failed in require at /home/ledgersmb/ledgersmb/ap.pl line 7., referer: https://marlin.sandelman.ca/ledgersmb/ap.pl
 Premature end of script headers: ap.pl, referer: https://marlin.sandelman.ca/ledgersmb/ap.pl

Some additional debugging of pointed me at bin/aa.pl, at:

    if ( $form->{id} ) {
        if ( $form->{taxincluded} ) {

            $amount =
              Tax::calculate_taxes( \@taxaccounts, $form, $form->{invtotal},
                1 );
            $tax = $form->round_amount( $amount, 2 );

        else {
            $tax =
                Tax::calculate_taxes( \@taxaccounts, $form, $netamount, 0 ) );
        foreach $item (@taxaccounts) {
            $tax{ $item->account } = $form->round_amount( $item->value, 2 );
            $form->{ "calctax_" . $item->account } = 1
              if $item->value
              ( $tax{ $item->account } == $form->{ "tax_" . $item->account } );

The call is in bcmp() and it appears that it's the == at the bottom.
As far as I can see, $tax is never gonna be a hash.  Above it is assigned the
result of ->round_amount().

I'm thinking that there must be a typo here that another hash is
desired.  But, this code has been like this forever.
It only gets invoked on previous transactions due to the if().

It only has to have an $item->value which is non-zero, otherwise the
if() statement gets short circuited.

My $item here is 2310, and it isn't a hash either or an object either.
@taxaccounts is perhaps also broken?

For, I have changed the code:

-    if ( $form->{id} ) {
+    if ( 0 && $form->{id} ) {

As I don't think that this code matters that much for viewing/copying.

ps: 1.3 has never calculated taxincluded properly for me.

p.p.s: I think that the transaction which I am trying to view was
       prepared by 1.2.26, as it's from 2010.

p.p.p.s: I could open tickets on SF.net for this, but since you guys
	 close them very quickly, and sf.net does not let me reopen
	 them, it seems a total waste of time.  And I am not happy with
	 sf.net sticking microsoft.net ads at the bottom of these messages.

]       He who is tired of Weird Al is tired of life!           |  firewalls  [
]   Michael Richardson, Sandelman Software Works, Ottawa, ON    |net architect[
] ..hidden.. http://www.sandelman.ottawa.on.ca/ |device driver[
   Kyoto Plus: watch the video <http://www.youtube.com/watch?v=kzx1ycLXQSE>
	               then sign the petition. 

Attachment: pgpADW0aHIa1N.pgp
Description: PGP signature