[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4253] branches/1.3
- Subject: SF.net SVN: ledger-smb:[4253] branches/1.3
- From: ..hidden..
- Date: Sun, 08 Jan 2012 11:25:37 +0000
Revision: 4253
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4253&view=rev
Author: ehuelsmann
Date: 2012-01-08 11:25:36 +0000 (Sun, 08 Jan 2012)
Log Message:
-----------
Fix: "Payment form uses today's rate for any other date, when one exists."
by looking up the rate again when the form gets submitted with a different
payment date than it was served.
Modified Paths:
--------------
branches/1.3/UI/payments/payment2.html
branches/1.3/scripts/payment.pl
Modified: branches/1.3/UI/payments/payment2.html
===================================================================
--- branches/1.3/UI/payments/payment2.html 2012-01-07 22:05:27 UTC (rev 4252)
+++ branches/1.3/UI/payments/payment2.html 2012-01-08 11:25:36 UTC (rev 4253)
@@ -99,7 +99,7 @@
</tr>
<tr id="date_row"><?lsmb # here goes an input where the date can be written, we can also use a java calendar :). We can use an ajax script to call the Exchange rate of the input date wich can be called with the onChange Method ?>
<th align="right" nowrap id="date_label_column"><?lsmb text('Date') ?></th>
- <td colspan="2" id="date_column"> <?lsmb INCLUDE input element_data=datepaid ?> </td>
+ <td colspan="2" id="date_column"> <?lsmb INCLUDE input element_data=datepaid ?><?lsmb datepaid.id='olddatepaid'; datepaid.name='olddatepaid'; datepaid.type='hidden'; INCLUDE input element_data=datepaid ?> </td>
</tr>
<tr id="source_row">
<?lsmb # here goes all the posible sources wich we can use -?>
Modified: branches/1.3/scripts/payment.pl
===================================================================
--- branches/1.3/scripts/payment.pl 2012-01-07 22:05:27 UTC (rev 4252)
+++ branches/1.3/scripts/payment.pl 2012-01-08 11:25:36 UTC (rev 4253)
@@ -886,26 +886,36 @@
my $default_currency_text = $currency_text ? '('.$default_currency.')' : '';
my @column_headers = ({text => $locale->text('Invoice')},
{text => $locale->text('Date')},
- {text => $locale->text('Total').$default_currency_text},
- {text => $locale->text('Paid').$default_currency_text},
- {text => $locale->text('Discount').$default_currency_text},
+ {text => $locale->text('Total ').$default_currency_text},
+ {text => $locale->text('Paid ').$default_currency_text},
+ {text => $locale->text('Discount ').$default_currency_text},
{text => $locale->text('Apply Disc')},
{text => $locale->text('Memo')},
- {text => $locale->text('Amount Due').$default_currency_text}
+ {text => $locale->text('Due ').$default_currency_text}
);
# WE NEED TO KNOW IF WE ARE USING A CURRENCY THAT NEEDS AN EXCHANGERATE
if ($default_currency ne $request->{curr} ) {
# FIRST WE PUSH THE OTHER COLUMN HEADERS WE NEED
- push @column_headers, {text => $locale->text('Exchange Rate')},
- {text => $locale->text('Amount Due').$currency_text};
+ push @column_headers, {text => $locale->text('FX Rate')},
+ {text => $locale->text('Due ').$currency_text};
# WE SET THEM IN THE RIGHT ORDER FOR THE TABLE INSIDE THE UI
@column_headers[7,8] = @column_headers[8,7];
- # DOES THE CURRENCY IN USE HAS AN EXCHANGE RATE?, IF SO
- # WE MUST SET THE VALUE, OTHERWISE THE UI WILL HANDLE IT
- $exchangerate = $request->{exrate} ?
- $request->{exrate} :
- $Payment->get_exchange_rate($request->{curr},
- $request->{datepaid} ? $request->{datepaid} : $Payment->{current_date});
+
+ # select the exchange rate for the currency at the payment date
+ # this has preference over what comes from the request, because the payment date
+ # may have changed since the last request and the currency rate in the request
+ # can be associated with the old payment date -- for example when a rate has been
+ # entered for the current date and the user selects a different date after opening
+ # the screen: today's rate would be used with no way for the user to override, if
+ # we would simply take the exrate from the request.
+ $exchangerate = $Payment->get_exchange_rate($request->{curr},
+ $request->{datepaid} ? $request->{datepaid}
+ : $Payment->{current_date});
+ $exchangerate = $request->{exrate}
+ if ((! $exchangerate) &&
+ $request->{datepaid} eq $request->{olddatepaid});
+
+
if ($exchangerate) {
@currency_options = {
name => 'exrate',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.