Fix avoid error 500 when searching product with no criteria

This commit is contained in:
Laurent Destailleur 2019-03-27 15:55:18 +01:00
parent 11e4411400
commit e064a954d2
3 changed files with 6 additions and 7 deletions

View File

@ -48,12 +48,11 @@ if ($action=="getProducts") {
$prods = $object->getObjectsInCateg("product");
echo json_encode($prods);
}
elseif ($action=="search") {
elseif ($action=="search" && $term != '') {
$sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product';
$sql .= ' WHERE entity IN ('.getEntity('product').')';
$sql .= ' AND tosell = 1';
$sql .= natural_search(array('label','barcode'), $term);
$sql.= ' WHERE entity IN ('.getEntity('product').')';
$sql.= ' AND tosell = 1';
$sql.= natural_search(array('label','barcode'), $term);
$resql = $db->query($sql);
$rows = array();
while ($row = $db->fetch_array($resql)) {

View File

@ -60,7 +60,7 @@ if ($action=="freezone") echo '<input type="text" id="number" name="number" styl
if ($action=="addnote") echo '<input type="hidden" id="number" name="number" value="'.$idline.'">';
?>
<input type="hidden" name="place" value="<?php echo $place;?>">
<input type="button" style="width:15%;font-size: 200%;" value="OK" onclick="Save();">
<input type="button" class="button" style="width:15%; font-size: 200%;" value="OK" onclick="Save();">
</center>
</body>

View File

@ -26,7 +26,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
$_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS
//$_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS
require '../main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';