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
05-14-2012, 06:51 AM,
#2
RE: CustomerReceipt.php webERP v4.07.7
Thanks for submitting the solutions with the problems!! I will apply these later on - will need to consider the ramifications of removing the check of ExRate==1 as you suggest. A little while ago since I wrote this code!!
Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Reply
05-14-2012, 07:30 AM,
#3
RE: CustomerReceipt.php webERP v4.07.7
hi phil,

Is it wrong to do this ?
I thought it is better to report the bug&fix rather than reporting the bugs only.

If this is not the right place to do that please tell me what should I do ?
Reply
05-14-2012, 11:15 AM,
#4
RE: CustomerReceipt.php webERP v4.07.7
Hi, all:

We cannot remove the statement:
if ($_SESSION['ReceiptBatch']->ExRate==1 AND isset($SuggestedExRate)){

Otherwise, the user cannot input the ExRate themselves. The same problem happened in Payments.php before. I'll provide a solution for this bug later.

Best regards!

Exson
Reply
05-14-2012, 06:17 PM,
#5
RE: CustomerReceipt.php webERP v4.07.7
Hi Ahmed,

Of course it is really great that you submit potential solutions with the problem! Much better to have some analysis to help identify the cause. Thankyou.

Exson is right though we do need to be able to input the exchange rate manually and this circumvents this.
Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Reply
05-14-2012, 07:31 PM,
#6
RE: CustomerReceipt.php webERP v4.07.7
Dear all:

I've fixed it in the new version 4.07.9.

Best regards!

Exson
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)