From 5cb114df610024dc3de0b95452535e51bc6537cb Mon Sep 17 00:00:00 2001 From: melina Date: Wed, 20 Apr 2022 17:46:16 +0200 Subject: [PATCH 1/3] fix empty search --- htdocs/takepos/index.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index b23907b64f1..0bfdbc84b29 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -557,6 +557,18 @@ function New() { * return {void} */ function Search2(keyCodeForEnter) { + if ($('#search').val() == '') { + $("[id^=prowatermark]").html(""); + $("[id^=prodesc]").text(""); + $("[id^=probutton]").text(""); + $("[id^=probutton]").hide(); + $("[id^=proprice]").attr("class", "hidden"); + $("[id^=proprice]").html(""); + $("[id^=proimg]").attr("src", "genimg/empty.png"); + $("[id^=prodiv]").data("rowid", ""); + return; + } + console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter); var search = false; @@ -579,6 +591,7 @@ function Search2(keyCodeForEnter) { $.getJSON('/takepos/ajax/ajax.php?action=search&term=' + $('#search').val(), function (data) { for (i = 0; i < ; i++) { if (typeof (data[i]) == "undefined") { + $("#prowatermark" + i).html(""); $("#prodesc" + i).text(""); $("#probutton" + i).text(""); $("#probutton" + i).hide(); From 7747489259853e3fc9a992564ba384fab1e23f81 Mon Sep 17 00:00:00 2001 From: melina Date: Fri, 6 May 2022 15:49:44 +0200 Subject: [PATCH 2/3] add hook for takepos addline --- htdocs/takepos/invoice.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3a55d82b8ad..61fa267f588 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -558,7 +558,15 @@ if (empty($reshook)) { } if ($idoflineadded <= 0) { $invoice->fetch_thirdparty(); - $idoflineadded = $invoice->addline($prod->description, $price, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, (!empty($parent_line)) ? $parent_line : '', null, '', '', 0, 100, '', null, 0); + $array_options = array(); + + // complete line by hook + $parameters = array('prod' => $prod); + $reshook=$hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + $idoflineadded = $invoice->addline($prod->description, $price, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, (!empty($parent_line)) ? $parent_line : '', null, '', '', $array_options, 100, '', null, 0); + if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) { $CUSTOMER_DISPLAY_line1 = $prod->label; $CUSTOMER_DISPLAY_line2 = price($price_ttc); From 0ac89a5eae62e45940fb021beaa9e2e2099ee5f5 Mon Sep 17 00:00:00 2001 From: melina Date: Mon, 9 May 2022 08:23:26 +0200 Subject: [PATCH 3/3] test reshook --- htdocs/takepos/invoice.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 61fa267f588..1574b3c21c6 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -565,7 +565,9 @@ if (empty($reshook)) { $reshook=$hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - $idoflineadded = $invoice->addline($prod->description, $price, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, (!empty($parent_line)) ? $parent_line : '', null, '', '', $array_options, 100, '', null, 0); + if (empty($reshook)) { + $idoflineadded = $invoice->addline($prod->description, $price, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, (!empty($parent_line)) ? $parent_line : '', null, '', '', $array_options, 100, '', null, 0); + } if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) { $CUSTOMER_DISPLAY_line1 = $prod->label;