From: Roy W P. <arc...@mt...> - 2008-04-18 14:12:04
|
> On Thu, Apr 17, 2008 at 11:45 AM, Roy W Pennington <arc...@mt...> wrote: > ... > > I get this error when "posting as new" invoices... > > > > DBD::Pg::db do failed: ERROR: syntax error at or near ")" > > LINE 4: '04-03-2008', NULL, ) > > ^ at SL/IS.pm line 854. > > The above line is obviously in error -- the last parameter (before the > closing parenthesis) is missing. Can you post the code snippet around > SL/IS.pm, line 854? That would certainly help. > Yup that last parameter is missing. Here's the code. --------------------------- # add lineitems + tax $amount = 0; $grossamount = 0; $fxgrossamount = 0; for (@{ $form->{acc_trans}{lineitems} }) { $amount += $_->{amount}; $grossamount += $_->{grossamount}; $fxgrossamount += $_->{fxgrossamount}; } $invnetamount = $amount; $amount = 0; for (split / /, $form->{taxaccounts}) { $amount += $form->{acc_trans}{$form->{id}}{$_}{amount} = $form->round_amount($form->{acc_trans}{$form->{id}}{$_}{amount}, 2) } $invamount = $invnetamount + $amount; $diff = 0; if ($form->{taxincluded}) { $diff = $form->round_amount($grossamount - $invamount, 2); $invamount += $diff; } $fxdiff = $form->round_amount($fxdiff,2); $invnetamount += $fxdiff; $invamount += $fxdiff; if ($form->round_amount($form->{paid} - $fxgrossamount,2) == 0) { $form->{paid} = $invamount; } else { $form->{paid} = $form->round_amount($form->{paid} * $form->{exchangerate}, 2); } foreach $ref (sort { $b->{amount} <=> $a->{amount} } @ { $form->{acc_trans}{lineitems} }) { $amount = $ref->{amount} + $diff + $fxdiff; $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, invoice_id) VALUES ($form->{id}, $ref->{chart_id}, $amount, '$form->{transdate}', $ref->{project_id}, $ref->{invoice_id})|; $dbh->do($query) || $form->dberror($query); $diff = 0; $fxdiff = 0; } $form->{receivables} = $invamount * -1; delete $form->{acc_trans}{lineitems}; ------------------------ But the fact is the code hasn't been changed.... it worked fine until i upgraded my distro and newer versions of DBI, DBD-pg, and perl were installed. Either: 1) the newer perl/dbi/dbd-pg packages (or code) is broken 2) something has changed in rgeards to the DBI/DBD implementation has changed and the old SL code is not compatible. 3) ?? If I roll back the version of perl, perl-DBI, and DBD-pg to the version packaged with Mandriva 2008, the SQL-ledger works fine.. but then most of the perl based gui in mandriva 2008.1 is broken. judging from the previous threads... this is a issue that others have had: http://abacus.sql-ledger.com/userforum/forum_entry.php?id=941 http://abacus.sql-ledger.com/userforum/forum_entry.php?id=910 http://abacus.sql-ledger.com/userforum/forum_entry.php?id=888 Due to the fact that "arblake" had the problem with a different version of perl (from what i have running) and I get the same problem with multiple versions of Postgresql.... I suspect it's DBD-pg or DBI. Regards, Roy |