webERP Forum

Full Version: CustomerBranches.php webERP v4.07.7
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
According to the manual:
Quote:Branch codes (and other codes) cannot contain spaces, commas, & or - .

I would suggest to add a check in line 49 so it looks like this:

PHP Code:
if (ContainsIllegalCharacters($_POST['BranchCode']) OR mb_strstr($_POST['BranchCode'],' ') OR mb_strstr($_POST['BranchCode'],'-')) { 

Hi, Ahmed´╝Ü

Thank you for your report. I'm wondering if this check is too strict?

Best regards!

Exson
Hi Exsonqu_Qu,

Quote:I'm wondering if this check is too strict?

yes, I agree this seems too strict for me too. But changing this needs huge effort because inside the code sometimes you are:
1. retrieving the customer and the branch from the DB
2. concatenating them using "-" as separator.
3. in another place in the code you explode them again using the separator which is "-".
This makes the branch name to be the same as the customer name.
This happens in Contracts.php

Concatenating in line 668:
PHP Code:
$SelectedCustomer $myrow['debtorno'] . '-' $myrow['branchcode']; 

exploding in line 695:
PHP Code:
    $CustomerBranchArray explode('-',$SelectedCustomer);
    
$_SESSION['Contract'.$identifier]->DebtorNo  trim($CustomerBranchArray[0]);
    
$_SESSION['Contract'.$identifier]->BranchCode trim($CustomerBranchArray[1]); 

And I do not know if this occurs elsewhere. This is why avoiding the "-" in branch name is the easiest way.

Best regards,
Ahmed
Hi, Ahmed,

Thank you very much. I've commit your fix to SVN.

Best regards!

Exson
We need to change contracts on the same basis as we changed SelectOrderItems - we decided to avoid this method of parsing the debtorno and branchcode into their components. Had forgotten about Contracts.php I think.