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

SF.net SVN: ledger-smb:[2551] branches/1.2/LedgerSMB/IR.pm



Revision: 2551
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2551&view=rev
Author:   einhverfr
Date:     2009-04-13 05:45:43 +0000 (Mon, 13 Apr 2009)

Log Message:
-----------
Fixing further issues with closed to issues

Modified Paths:
--------------
    branches/1.2/LedgerSMB/IR.pm

Modified: branches/1.2/LedgerSMB/IR.pm
===================================================================
--- branches/1.2/LedgerSMB/IR.pm	2009-04-13 05:03:26 UTC (rev 2550)
+++ branches/1.2/LedgerSMB/IR.pm	2009-04-13 05:45:43 UTC (rev 2551)
@@ -382,21 +382,19 @@
 				            invoice_id,
 				            transdate) 
 				     VALUES (?, ?, ?, ?,
-				            ?, (SELECT CASE WHEN ? <= value::date
-				                            THEN value::date +
+				            ?, coalesce((SELECT value::date +
 				                               '1 day'::interval
-				                            ELSE ?
-				                        END AS value 
+				                        AS value 
 				                  FROM defaults
 				                  WHERE setting_key = 'closedto'
-				))|;
+				), ?))|;
 
                         my $sth = $dbh->prepare($query);
                         $sth->execute(
                             $ref->{trans_id},   $ref->{inventory_accno_id},
                             $linetotal, 
                             $ref->{project_id}, $invoice_id,
-                            $ref->{transdate}, $ref->{transdate},
+                            $ref->{transdate},
                         ) || $form->dberror($query);
 
                         # add expense
@@ -406,20 +404,18 @@
 				            project_id, invoice_id,
 				            transdate) 
 				     VALUES (?, ?, ?, ?,
-				            ?, (SELECT CASE WHEN ? <= value::date
-				                            THEN value::date +
-				                               '1 day'::interval
-				                            ELSE ?
-				                        END AS value 
+				            ?, coalesce((SELECT value::date +
+				                       '1 day'::interval
+				                        AS value 
 				                  FROM defaults
 				                  WHERE setting_key = 'closedto'
-				))|;
+				), ?))|;
                         $sth = $dbh->prepare($query);
                         $sth->execute(
                             $ref->{trans_id},   $ref->{expense_accno_id},
                             $linetotal * -1,    
                             $ref->{project_id}, $invoice_id,
-                            $ref->{transdate}, $ref->{transdate},
+                            $ref->{transdate},
                         ) || $form->dberror($query);
                     }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.