FIX Autosearch on takepos was broken

This commit is contained in:
Laurent Destailleur 2022-11-06 22:47:56 +01:00
parent 3abbda269b
commit f038cca39e
2 changed files with 7 additions and 4 deletions

View File

@ -581,8 +581,9 @@ function New() {
/**
* Search products
*
* @param {int} keyCodeForEnter Key code for "enter"
* return {void}
* @param string keyCodeForEnter Key code for "enter" or '' if not
* @param int moreorless ??
* return void
*/
function Search2(keyCodeForEnter, moreorless) {
var eventKeyCode = window.event.keyCode;
@ -597,6 +598,8 @@ function Search2(keyCodeForEnter, moreorless) {
search_start = $('#search_start_'+moreorless).val();
}
console.log("search_term="+search_term);
if (search_term == '') {
$("[id^=prowatermark]").html("");
$("[id^=prodesc]").text("");
@ -610,7 +613,7 @@ function Search2(keyCodeForEnter, moreorless) {
}
var search = false;
if (keyCodeForEnter != '' || eventKeyCode == keyCodeForEnter) {
if (keyCodeForEnter == '' || eventKeyCode == keyCodeForEnter) {
search = true;
}

View File

@ -1655,7 +1655,7 @@ if (($action == "valid" || $action == "history") && $invoice->type != Facture::T
if ($action == "search") {
print '<center>
<input type="text" id="search" class="input-search-takepos" name="search" onkeyup="Search2();" style="width: 80%; font-size: 150%;" placeholder="'.dol_escape_htmltag($langs->trans('Search')).'">
<input type="text" id="search" class="input-search-takepos" name="search" onkeyup="Search2(\'\', null);" style="width: 80%; font-size: 150%;" placeholder="'.dol_escape_htmltag($langs->trans('Search')).'">
</center>';
}