mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge pull request #20458 from Easya-Solutions/fix-takepos-barcode-rule-qty
FIX search bracode rule and avoid undefined quantity on search in tak…
This commit is contained in:
commit
8f5b68bf3a
|
|
@ -142,7 +142,7 @@ if ($action == 'getProducts') {
|
|||
}
|
||||
|
||||
if (isset($barcode_value_list['ref'])) {
|
||||
//search product from reference
|
||||
// search product from reference
|
||||
$sql = "SELECT rowid, ref, label, tosell, tobuy, barcode, price";
|
||||
$sql .= " FROM " . $db->prefix() . "product as p";
|
||||
$sql .= " WHERE entity IN (" . getEntity('product') . ")";
|
||||
|
|
@ -151,6 +151,7 @@ if ($action == 'getProducts') {
|
|||
$sql .= " AND EXISTS (SELECT cp.fk_product FROM " . $db->prefix() . "categorie_product as cp WHERE cp.fk_product = p.rowid AND cp.fk_categorie IN (".$db->sanitize($filteroncategids)."))";
|
||||
}
|
||||
$sql .= " AND tosell = 1";
|
||||
$sql .= " AND (barcode IS NULL OR barcode != '" . $db->escape($term) . "')";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql && $db->num_rows($resql) == 1) {
|
||||
|
|
@ -263,6 +264,7 @@ if ($action == 'getProducts') {
|
|||
'price' => $obj->price,
|
||||
'object' => 'product',
|
||||
'img' => $ig,
|
||||
'qty' => 1,
|
||||
//'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -620,7 +620,7 @@ function Search2(keyCodeForEnter) {
|
|||
ChangeThirdparty(data[0]['rowid']);
|
||||
}
|
||||
else if ('product' == data[0]['object']) {
|
||||
console.log("There is only 1 answer with barcode matching the search, so we add the product in basket");
|
||||
console.log("There is only 1 answer matching the search, so we add the product in basket, qty="+data[0]['qty']);
|
||||
ClickProduct(0, data[0]['qty']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user