From 7ebda11ad05f76735288c4c7ce353738b77a2571 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Oct 2022 22:08:26 +0200 Subject: [PATCH] Fix search in TakePOS --- htdocs/langs/en_US/errors.lang | 1 + htdocs/takepos/admin/terminal.php | 2 +- htdocs/takepos/index.php | 17 +++++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 8c5e7562b8b..afcbe76e828 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -14,6 +14,7 @@ ErrorLoginAlreadyExists=Login %s already exists. ErrorGroupAlreadyExists=Group %s already exists. ErrorEmailAlreadyExists=Email %s already exists. ErrorRecordNotFound=Record not found. +ErrorRecordNotFoundShort=Not found ErrorFailToCopyFile=Failed to copy file '%s' into '%s'. ErrorFailToCopyDir=Failed to copy directory '%s' into '%s'. ErrorFailToRenameFile=Failed to rename file '%s' into '%s'. diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 4645f5d9cf2..b2d2b87ced0 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -363,7 +363,7 @@ $htmltext .= ''; print '
'; print load_fiche_titre($langs->trans('FreeLegalTextOnInvoices'), '', ''); -print '
'; +print '
'; print ''; print ''; print ''; diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index b567ff5fee9..2dda7872743 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -585,7 +585,9 @@ function New() { * return {void} */ function Search2(keyCodeForEnter, moreorless) { - console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter); + var eventKeyCode = window.event.keyCode; + + console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter+", eventKeyCode="+eventKeyCode); var search_term = $('#search').val(); var search_start = 0; @@ -608,20 +610,19 @@ function Search2(keyCodeForEnter, moreorless) { } var search = false; - var eventKeyCode = window.event.keyCode; - if (keyCodeForEnter == '' || eventKeyCode == keyCodeForEnter) { + if (keyCodeForEnter != '' || eventKeyCode == keyCodeForEnter) { search = true; } if (search === true) { - - // temporization time to give time to type + // if a timer has been already started (search2_timer is a global js variable), we cancel it now + // we click onto another key, we will restart another timer just after if (search2_timer) { clearTimeout(search2_timer); } + // temporization time to give time to type search2_timer = setTimeout(function(){ - pageproducts = 0; jQuery(".wrapper2 .catwatermark").hide(); var nbsearchresults = 0; @@ -693,8 +694,8 @@ function Search2(keyCodeForEnter, moreorless) { if (data.length == 0) { $('#search').val('load('errors'); - echo dol_escape_js($langs->trans("ErrorRecordNotFound")); - ?>'); + echo dol_escape_js($langs->transnoentitiesnoconv("ErrorRecordNotFoundShort")); + ?> ('+search_term+')'); $('#search').select(); } else ClearSearch();
'.$langs->trans("Parameters").''.$langs->trans('Value').'