Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CustomerReceipt.php webERP v4.07.7
05-14-2012, 06:02 AM,
#1
CustomerReceipt.php webERP v4.07.7
Problem A


assumption:
You had setup bank accounts and you have 3 or more currencies with different exchange rates.
I will call the currencies c1 (default), c2 and c3

Steps:
1. Choose Bank Account.
2. Change Currency from c1 to c2.
3. The Receipt Exchange Rate textBox appears with the value of the exchange rate between the two currencies and till now this is OK.
4. change the currency again to c3.

Problem:
The displayed exchange rate in the ExRate textBox had not changed. This is not the expected. It should be updated to the new rate.

The problem area in the code:
Responsible code for showing the ExRate textBox is between lines 824 and 838.
This problem reason is lines 830-832:
if ($_SESSION['ReceiptBatch']->ExRate==1 AND isset($SuggestedExRate)){
$_SESSION['ReceiptBatch']->ExRate = $SuggestedExRate;
}

This is why if the exchange rate != 1 it will never be changed.

Solution:
What I did is deleting the if condition and use:
$_SESSION['ReceiptBatch']->ExRate = $SuggestedExRate;
without any check.

Inquiry:

This is working for me but you have the full picture of the code so kindly inform me if this would affect any other part of code.

Problem B


Line 836 where you are displaying a note message of the rate to the user is showing a warning because of:
locale_number_format($SuggestedExRateText,6)

Reason:
$SuggestedExRateText is string and locale_number_format expected the first parameter to be numeric. In fact you do not need to call the locale_number_format() at all because you had called it before between lines 825-829:
if (isset($SuggestedExRate)){
$SuggestedExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedExRate,4) . '</b>';
} else {
$SuggestedExRateText ='';
}

So just display the message directly without calling it again

Solution:
I changed it from:
locale_number_format($SuggestedExRateText,6)
To:
$SuggestedExRateText

and the warning message is disappear now.

Reply


Messages In This Thread
CustomerReceipt.php webERP v4.07.7 - by Ahmed.Fawzy - 05-14-2012, 06:02 AM
RE: CustomerReceipt.php webERP v4.07.7 - by phil - 05-14-2012, 06:51 AM
RE: CustomerReceipt.php webERP v4.07.7 - by phil - 05-14-2012, 06:17 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)