NEW change thirdparty with barcode scan in takepos
This commit is contained in:
parent
6293f76692
commit
a963d6c0fc
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Andreu Bisquerra <jove@bisquerra.com>
|
/* Copyright (C) 2001-2004 Andreu Bisquerra <jove@bisquerra.com>
|
||||||
|
/* Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -68,6 +69,24 @@ if ($action == 'getProducts') {
|
|||||||
echo 'Failed to load category with id='.$category;
|
echo 'Failed to load category with id='.$category;
|
||||||
}
|
}
|
||||||
} elseif ($action == 'search' && $term != '') {
|
} elseif ($action == 'search' && $term != '') {
|
||||||
|
// Change thirdparty with barcode
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
|
|
||||||
|
$thirdparty = new Societe($db);
|
||||||
|
$result = $thirdparty->fetch('', '', '', $term);
|
||||||
|
|
||||||
|
if( $result && $thirdparty->id > 0) {
|
||||||
|
$rows = array();
|
||||||
|
$rows[] = array(
|
||||||
|
'rowid' => $thirdparty->id,
|
||||||
|
'name' => $thirdparty->name,
|
||||||
|
'barcode' => $thirdparty->barcode,
|
||||||
|
'object' => 'thirdparty'
|
||||||
|
);
|
||||||
|
echo json_encode($rows);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Define $filteroncategids, the filter on category ID if there is a Root category defined.
|
// Define $filteroncategids, the filter on category ID if there is a Root category defined.
|
||||||
$filteroncategids = '';
|
$filteroncategids = '';
|
||||||
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) { // A root category is defined, we must filter on products inside this category tree
|
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) { // A root category is defined, we must filter on products inside this category tree
|
||||||
@ -101,7 +120,8 @@ if ($action == 'getProducts') {
|
|||||||
'tosell' => $obj->tosell,
|
'tosell' => $obj->tosell,
|
||||||
'tobuy' => $obj->tobuy,
|
'tobuy' => $obj->tobuy,
|
||||||
'barcode' => $obj->barcode,
|
'barcode' => $obj->barcode,
|
||||||
'price' => $obj->price
|
'price' => $obj->price,
|
||||||
|
'object' => 'product'
|
||||||
//'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency)
|
//'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user