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

SF.net SVN: ledger-smb:[4228] branches/1.3



Revision: 4228
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4228&view=rev
Author:   einhverfr
Date:     2011-12-18 05:04:29 +0000 (Sun, 18 Dec 2011)
Log Message:
-----------
Correcting fx_gain and loss handling for single payment workflow

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/sql/modules/Payment.sql

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2011-12-17 18:29:54 UTC (rev 4227)
+++ branches/1.3/Changelog	2011-12-18 05:04:29 UTC (rev 4228)
@@ -9,6 +9,7 @@
 * Customer/Vendor Search now shows records without credit accounts (Herman V)
 * Better error handling contrib modules not found (Chris T)
 * pos.conf.pl no longer overwritten on upgrade (Chris T)
+* Fixed multi-currency single payment handling (Erik H / Chris T)
 
 Changelog for 1.3.9
 * More logging enhancements (Herman V)

Modified: branches/1.3/sql/modules/Payment.sql
===================================================================
--- branches/1.3/sql/modules/Payment.sql	2011-12-17 18:29:54 UTC (rev 4227)
+++ branches/1.3/sql/modules/Payment.sql	2011-12-18 05:04:29 UTC (rev 4228)
@@ -696,24 +696,28 @@
        IF (tmp_amount < 0) THEN
           IF (in_account_class  = 1) THEN
            INSERT INTO acc_trans (chart_id, amount, trans_id, transdate, approved, source)
-            VALUES (CAST((select value from defaults where setting_key like 'fxloss_accno_id') AS INT),
+            VALUES ((select id from account JOIN defaults ON accno = value
+                     WHERE setting_key = 'FX_loss'),
                     tmp_amount, in_transaction_id[out_count], in_datepaid, coalesce(in_approved, true),
                     in_source[out_count]);
            ELSE
             INSERT INTO acc_trans (chart_id, amount, trans_id, transdate, approved, source)
-            VALUES (CAST((select value from defaults where setting_key like 'fxgain_accno_id') AS INT),
+            VALUES ((select id from account JOIN defaults ON accno = value
+                     WHERE setting_key = 'FX_gain'),
                     tmp_amount, in_transaction_id[out_count], in_datepaid, coalesce(in_approved, true),
                     in_source[out_count]);
           END IF;
         ELSIF (tmp_amount > 0) THEN
           IF (in_account_class  = 1) THEN
             INSERT INTO acc_trans (chart_id, amount, trans_id, transdate, approved, source)
-            VALUES (CAST((select value from defaults where setting_key like 'fxgain_accno_id') AS INT),
+            VALUES ((select id from account JOIN defaults ON accno = value
+                     WHERE setting_key = 'FX_gain'),
                     tmp_amount, in_transaction_id[out_count], in_datepaid, coalesce(in_approved, true),
                     in_source[out_count]);
            ELSE
             INSERT INTO acc_trans (chart_id, amount, trans_id, transdate, approved, source)
-            VALUES (CAST((select value from defaults where setting_key like 'fxloss_accno_id') AS INT),
+            VALUES ((select id from account JOIN defaults ON accno = value
+                     WHERE setting_key = 'FX_loss'),
                     tmp_amount, in_transaction_id[out_count], in_datepaid, coalesce(in_approved, true),
                     in_source[out_count]);
           END IF; 

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