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

SF.net SVN: ledger-smb:[3240] trunk/LedgerSMB/OE.pm



Revision: 3240
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3240&view=rev
Author:   ehuelsmann
Date:     2011-06-13 20:26:17 +0000 (Mon, 13 Jun 2011)

Log Message:
-----------
Fix bug 3315712: Order consolidation should not be allowed
to affect more than one credit account at a time.


 * LedgerSMB/OE.pm
   (consolidate_orders): Check affected credit accounts.

Modified Paths:
--------------
    trunk/LedgerSMB/OE.pm

Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm	2011-06-13 17:36:52 UTC (rev 3239)
+++ trunk/LedgerSMB/OE.pm	2011-06-13 20:26:17 UTC (rev 3240)
@@ -2481,6 +2481,7 @@
     my $query = qq|SELECT * FROM oe WHERE id = ?|;
     my $sth = $dbh->prepare($query) || $form->dberror($query);
 
+    my $credit_account;
     for ( $i = 1 ; $i <= $form->{rowcount} ; $i++ ) {
 
         # retrieve order
@@ -2488,6 +2489,13 @@
             $sth->execute( $form->{"ndx_$i"} );
 
             $ref = $sth->fetchrow_hashref(NAME_lc);
+
+	    $form->error( "Can't consolidate orders from different accounts" )
+		if (defined( $credit_account )
+     		    && ($credit_account != $ref->{entity_credit_account}));
+	    $credit_account = $ref->{entity_credit_account};
+	    print STDERR "ca: $credit_account\n";
+
             $ref->{ndx} = $i;
             $oe{oe}{ $ref->{curr} }{ $ref->{id} } = $ref;
 


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