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

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



Revision: 4287
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4287&view=rev
Author:   einhverfr
Date:     2012-02-07 01:45:43 +0000 (Tue, 07 Feb 2012)
Log Message:
-----------
Fixed bulk payment handling with different currencies and exchange rates

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/UI/payments/payments_detail.html
    branches/1.3/bin/is.pl
    branches/1.3/sql/modules/Payment.sql

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2012-02-03 08:12:51 UTC (rev 4286)
+++ branches/1.3/Changelog	2012-02-07 01:45:43 UTC (rev 4287)
@@ -15,6 +15,7 @@
 * Removed unnecessary shebang lines in scripts/* files (Robert C)
 * Fixed GL recurring transaction not posting (Chris T)
 * Improved error handling when extensions/contrib scripts not found (Chris T)
+* Fixed multicurrency handling in bulk payment interface (Chris T and Erik H)
 
 Changelog for 1.3.10
 * Fixes for permissions for exchangerate table (Erik H)

Modified: branches/1.3/UI/payments/payments_detail.html
===================================================================
--- branches/1.3/UI/payments/payments_detail.html	2012-02-03 08:12:51 UTC (rev 4286)
+++ branches/1.3/UI/payments/payments_detail.html	2012-02-07 01:45:43 UTC (rev 4287)
@@ -152,8 +152,8 @@
 		label = text('Exchange Rate') #'
 		type = 'text'
 		class = "numeric"
-		name = 'exchange_rate'
-		value = exchange_rate
+		name = 'exchangerate'
+		value = exchangerate
 		size = 20
 	}  ?>
 	</div>

Modified: branches/1.3/bin/is.pl
===================================================================
--- branches/1.3/bin/is.pl	2012-02-03 08:12:51 UTC (rev 4286)
+++ branches/1.3/bin/is.pl	2012-02-07 01:45:43 UTC (rev 4287)
@@ -373,7 +373,7 @@
             $exchangerate .=
                 qq|<th align=right>|
               . $locale->text('Exchange Rate')
-              . qq|</th><td><input name="exchangerate size="10" value="$form->{exchangerate}"></td>|;
+              . qq|</th><td><input name="exchangerate" size="10" value="$form->{exchangerate}"></td>|;
         }
     }
     $exchangerate .= qq|

Modified: branches/1.3/sql/modules/Payment.sql
===================================================================
--- branches/1.3/sql/modules/Payment.sql	2012-02-03 08:12:51 UTC (rev 4286)
+++ branches/1.3/sql/modules/Payment.sql	2012-02-07 01:45:43 UTC (rev 4287)
@@ -484,6 +484,9 @@
         ELSE 
                 t_exchangerate := in_exchangerate;
         END IF;
+        IF t_exchangerate IS NULL THEN
+            RAISE EXCEPTION 'No exchangerate provided and not default currency';
+        END IF;
 
         CREATE TEMPORARY TABLE bulk_payments_in
            (id int, amount numeric, fxrate numeric, gain_loss_accno int);
@@ -540,7 +543,7 @@
         INSERT INTO acc_trans
              (trans_id, chart_id, amount, approved,
               voucher_id, transdate, source)
-           SELECT id, t_cash_id, amount * t_cash_sign * fxrate,
+           SELECT id, t_cash_id, amount * t_cash_sign * t_exchangerate,
                   CASE WHEN t_voucher_id IS NULL THEN true
                        ELSE false END,
                   t_voucher_id, in_payment_date, in_source
@@ -569,7 +572,6 @@
              FROM bulk_payments_in
             WHERE amount <> 0 AND gain_loss_accno IS NOT NULL;
 
-
         DROP TABLE bulk_payments_in;
         perform unlock_all();
         return out_count;

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