27 if (!defined(
'NOREQUIRESOC')) define(
'NOREQUIRESOC',
'1');
28 if (!defined(
'NOCSRFCHECK')) define(
'NOCSRFCHECK',
'1');
29 if (!defined(
'NOTOKENRENEWAL')) define(
'NOTOKENRENEWAL',
'1');
30 if (!defined(
'NOREQUIREMENU')) define(
'NOREQUIREMENU',
'1');
31 if (!defined(
'NOREQUIREHTML')) define(
'NOREQUIREHTML',
'1');
32 if (!defined(
'NOREQUIREAJAX')) define(
'NOREQUIREAJAX',
'1');
35 require
'../main.inc.php';
36 require_once DOL_DOCUMENT_ROOT.
'/cashdesk/include/environnement.php';
40 $search =
GETPOST(
"code",
"alpha");
45 $sql =
"SELECT p.rowid, p.ref, p.label, p.tva_tx";
46 if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .=
", ps.reel";
47 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p";
48 if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot).
"'";
49 $sql .=
" WHERE p.entity IN (".getEntity(
'product').
")";
50 $sql .=
" AND p.tosell = 1";
51 $sql .=
" AND p.fk_product_type = 0";
53 if (!empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE))
55 $sql .=
" AND (p.ref LIKE '".$db->escape($search).
"%' OR p.label LIKE '".$db->escape($search).
"%'";
56 if (!empty($conf->barcode->enabled)) $sql .=
" OR p.barcode LIKE '".$db->escape($search).
"%'";
59 $sql .=
" AND (p.ref LIKE '%".$db->escape($search).
"%' OR p.label LIKE '%".$db->escape($search).
"%'";
60 if (!empty($conf->barcode->enabled)) $sql .=
" OR p.barcode LIKE '%".$db->escape($search).
"%'";
63 $sql .=
" ORDER BY label";
65 dol_syslog(
"facturation_dhtml.php", LOG_DEBUG);
66 $result = $db->query($sql);
70 if ($nbr = $db->num_rows($result))
72 $resultat =
'<ul class="dhtml_bloc">';
74 $ret = array(); $i = 0;
75 while ($tab = $db->fetch_array($result))
77 foreach ($tab as $cle => $valeur)
79 $ret[$i][$cle] = $valeur;
85 $tab_size = count($tab);
86 for ($i = 0; $i < $tab_size; $i++)
89 <li class="dhtml_defaut" title="'.$tab[$i][
'ref'].
'"
90 onMouseOver="javascript: this.className = \'dhtml_selection\';"
91 onMouseOut="javascript: this.className = \'dhtml_defaut\';"
92 >'.$tab[$i][
'ref'].
' - '.$tab[$i][
'label'].
'</li>
100 $langs->load(
"cashdesk");
102 print '<ul class="dhtml_bloc">';
103 print '<li class="dhtml_defaut">'.$langs->trans(
"NoResults").
'</li>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
print
Draft customers invoices.