webERP Forum

Full Version: Sales orders - simplified customer search
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Having been bothered by spurious "Unable to identify the selected customer" messages which can occur after particular combinations of repeated searches, failed searches, resets or multiple results, I have looked at completely eliminating the "JustSelectedACustomer" hidden field and associated POST parameter, which is tricky to control. I seem to have stumbled on a solution which enables me to get rid of that field and also slightly simplifies the method of identifying which customer out of a multiple search result was clicked on. This needs thorough testing, but I thought it worth mentioning, as similar logic applies elsewhere in WebERP. My code block for identifying the clicked-on customer code now looks like this :

$post_keys = (array_keys($_POST));
$customer_index_array =
if (isset($customer_index_array)) {
$customer_index_string = $customer_index_array[0];
if (preg_match("/.*?(\d+)$/",$customer_index_string,$matches)) {
$customer_index = $matches[1];
$SelectedCustomer = $_POST["SelectedCustomer$customer_index"];
$SelectedBranch = $_POST["SelectedBranch$customer_index"];