Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sales orders - simplified customer search
11-21-2013, 09:34 PM
Post: #1
Sales orders - simplified customer search
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 =
array_values(preg_grep("/^SubmitCustomerSelection.*/",$post_keys));
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"];
}
}
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)