Fix search hook in takepos
This commit is contained in:
parent
b8764c4804
commit
536f888ba2
@ -103,7 +103,7 @@ if ($action == 'getProducts') {
|
|||||||
'rowid' => $thirdparty->id,
|
'rowid' => $thirdparty->id,
|
||||||
'name' => $thirdparty->name,
|
'name' => $thirdparty->name,
|
||||||
'barcode' => $thirdparty->barcode,
|
'barcode' => $thirdparty->barcode,
|
||||||
'object' => 'thirdparty'
|
'object' => 'thirdparty'
|
||||||
);
|
);
|
||||||
echo json_encode($rows);
|
echo json_encode($rows);
|
||||||
exit;
|
exit;
|
||||||
@ -267,6 +267,7 @@ if ($action == 'getProducts') {
|
|||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
$objProd = new Product($db);
|
$objProd = new Product($db);
|
||||||
$objProd->fetch($obj->rowid);
|
$objProd->fetch($obj->rowid);
|
||||||
@ -303,17 +304,23 @@ if ($action == 'getProducts') {
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$parameters['row'] = $row;
|
$parameters['row'] = $row;
|
||||||
$parameters['obj'] = $obj;
|
$parameters['obj'] = $obj;
|
||||||
|
|
||||||
$reshook = $hookmanager->executeHooks('completeAjaxReturnArray', $parameters);
|
$reshook = $hookmanager->executeHooks('completeAjaxReturnArray', $parameters);
|
||||||
if ($reshook > 0) {
|
if ($reshook > 0) {
|
||||||
// replace
|
// replace
|
||||||
$row = $hookmanager->resArray;
|
if (count($hookmanager->resArray)) {
|
||||||
|
$row = $hookmanager->resArray;
|
||||||
|
} else {
|
||||||
|
$row = array();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// add
|
// add
|
||||||
$rows[] = $hookmanager->resArray;
|
if (count($hookmanager->resArray)) {
|
||||||
|
$rows[] = $hookmanager->resArray;
|
||||||
|
}
|
||||||
|
$rows[] = $row;
|
||||||
}
|
}
|
||||||
$rows[] = $row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode($rows);
|
echo json_encode($rows);
|
||||||
} else {
|
} else {
|
||||||
echo 'Failed to search product : '.$db->lasterror();
|
echo 'Failed to search product : '.$db->lasterror();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user