diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 9df54d1d64b..d5bd8e4405f 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -592,6 +592,18 @@ function Search2(keyCodeForEnter, moreorless) { search_start = $('#search_start_'+moreorless).val(); } + if (search_term == '') { + $("[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; + } + var search = false; var eventKeyCode = window.event.keyCode; if (keyCodeForEnter == '' || eventKeyCode == keyCodeForEnter) { @@ -613,6 +625,7 @@ function Search2(keyCodeForEnter, moreorless) { $.getJSON('/takepos/ajax/ajax.php?action=search&term=' + search_term + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) { for (i = 0; i < ; i++) { if (typeof (data[i]) == "undefined") { + $("#prowatermark" + i).html(""); $("#prodesc" + i).text(""); $("#probutton" + i).text(""); $("#probutton" + i).hide(); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3c0fb834f67..eec8ab7d363 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -558,7 +558,17 @@ 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'); + + 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; $CUSTOMER_DISPLAY_line2 = price($price_ttc);