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

Re: Internal Server Error saving Purchase Transaction





On Mon, Jul 23, 2012 at 6:34 AM, Nick Prater <..hidden..> wrote:
I'm using ledgersmb 1.3.20, with Math::BigInt 1.997.

This results in an Internal Server Error page when I try to save a
Purchase Transaction.

The apache error log reports:
[Fri Jul 20 08:43:32 2012] [error] [client 127.0.0.1] Can't call method
"is_zero" on an undefined value at /usr/share/perl5/Math/BigInt.pm line
1197., referer: http://localhost/ledgersmb/ap.pl

In a thread on ledger-smb-users, Chris Travers said:

> The problem occurs when a number isn't properly initialized and parsed or
> formatted.  If we initialize to zero during the format process this has
> some side effects, so we have to do this in the bin/ files.  I believe we
> changed this in 1.4 so that uninitialized numbers are set as 0 for old
> code but it required a fair bit of other logic to prevent other problems
> from occurring.
>
> If you are on the -devel list I can post what I have done to track these
> sorts of problems down.  Otherwise I can reply privately (I try to keep
> this list somewhat free of discussion of the internals of the software).

Chris, I am now subscribed to -devel and would love to know more about
what you have done to track down these problems!

Link to original -users thread:
http://permalink.gmane.org/gmane.comp.finance.ledger.smb.user/6302

Ni Nick;

The way I have been troubleshooting it has not been the most sophisticated but then the code from SL doesn't admit of very sophisticated debugging. 

The main thing I have done is something like:  $form->error('Breakpoint: " . __LINE__ . ":" . __FILE__); or printing the same to STDERR.  Then it is usually reasonable to figure out what section of code is involved.

If this is an AP transaction chances are you are looking at aa.pl's post().

Chances are lines which $form->format_amount() or $form->parse_amount() are the problems.

Best Wishes,
Chris Travers