Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #15565 Enhanced behaviour to select product on customer/supplier order to be able to use barcode reader efficiently #15694

Closed
wants to merge 3 commits into from

Conversation

zuiko
Copy link
Contributor

@zuiko zuiko commented Dec 7, 2020

Fix #15565 Enhanced behaviour to select product on customer/supplier order to be able to use barcode reader efficiently

Correction made and validated on sources V12.0.3.
See also Pull Request #15704 which is the same correction reported on the current branch (with no conflicts).

When using a barcode reader in ajax list on customer/supplier order 2 conditions are necessary:

  1. The unique product found (it is allways unique, when exists, with a barcode reader) must be automatically selected,

  2. The ENTER (CR/LF) key must be ignored if sent by the barcode reader (it's very often the case), because this ENTER key comes too early and erase the previous automatic typing before the ajax selection could be done.

If the data (from the Products module):
Wait until you have pressed a key before loading the contents of the product drop-down list.
is set to YES (1 to 3 characters),
the performance will be excellent (instantaneous for a test with more than 10K products).
The performance will be not worst if this data would be set to NO.

I did not see any inconvenience and interferences with manual typing after these changes.

For the point

  1. in file /core/class/html.form.class.php the change consists on setting 1 instead of 0
    print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.’/product/ajax/products.php’, $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
    For the 2 instances customer order and supplier order.

  2. in file /core/lib/ajax.lib.php in function ajax_autocompleter the change consists on
    if (e.keyCode == 13) {return false;} /*disable "ENTER" key */
    on characters reading for this task.

I don't know if there is interference with other functions by deactivating the ENTER key in this treatment.
If this is the case, a parameter setting might be necessary...
Or a new parameter to ajax_autocompleter function to limit disabling ENTER only for product selection in customer or supplier order.

I ask your indulgence for this first Pull Request in Dolibarr ;-)

eldy and others added 3 commits December 6, 2020 19:03
generation.

Conflicts:
	htdocs/core/class/commondocgenerator.class.php
From PR Dolibarr#15565
At first suggested change by frederic34 on French Forum
In order to enhanced behaviour to select product on customer/supplier order to be able to use barcode reader efficiently,
a part of the job is that the product must be automatically selected if it is unique and it's allways searching product with barcode reader if this product exists.
I did not find any disadvantage in case of manual entry of the product reference.
To complete this enhencement, another change is necessary on /core/lib/ajax.lib.php in function ajax_autocompleter.
From PR Dolibarr#15565
In order to enhance behaviour to select product on customer/supplier order to be able to use barcode reader efficiently.
If /core/class/html.form.class.php has been changed in order to have the unique product automatically selected (by barcode reader),
we need to disable the ENTER (CR/LF) key eventually and most often sent by the barcode reader in order the selection not be erased by this too early ENTER (CR/LF).
Indeed, if not, the CR/LF is sent before the selection is effective.
@zuiko zuiko changed the title Patch 1 Fix #15565 Enhanced behaviour to select product on customer/supplier order to be able to use barcode reader efficiently Dec 7, 2020
eldy added a commit that referenced this pull request Dec 8, 2020
@eldy
Copy link
Member

eldy commented Dec 8, 2020

Check if commit 85bb3fa is enough.
Reopen and comment if not

@eldy eldy closed this Dec 8, 2020
@zuiko
Copy link
Contributor Author

zuiko commented Dec 8, 2020

Hi eldy, for me this code is not enought, continuing our previous conversation:
In fact with 0, the combo remains... I just tested it.
If you don't change the parameter 0 to 1 into ajax_autocompleter the input is slower if the product is unique (by hand as with a barcode reader). Indeed, the input line remains filled with the barcode and ajax displays below the product to be selected. You have to click with the mouse or tap the down arrow on the keyboard to replace the barcode with the product code.
If the parameter is at 1, as soon as the barcode is complete, it is replaced on the same line by the product code, no further action is necessary. The speed is better.
When you do a lot during the day this small difference in ergonomics can be felt.

but my users gave me this testimony: the value 1 for select is relevant for entering customer orders with a barcode reader, but it is less relevant for entering supplier orders (which are not usually entered by hand shower), because the combo gives verification information which then disappears.This is especially true for the purchase price, which is not pre-filled in the box (is this voluntary?).

So on my side, I would keep select = 1 for customer orders and select = 0 for supplier orders.

Fot the moment, I didn't found how to reopen a closed pull request but I try ;-)

Some screenshots:
select = 0
image

select=1
image

@zuiko zuiko deleted the patch-1 branch December 9, 2020 19:52
@zuiko
Copy link
Contributor Author

zuiko commented Dec 9, 2020

So I close here my branch and will renew some of my change soon...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhanced behaviour to select product on customer/supplier order to be able to use barcode reader efficiently
2 participants