FIX Autoadd product when barcode match
Show barcode value in tooltips
This commit is contained in:
parent
1212a63365
commit
ffc861d4e2
@ -85,10 +85,10 @@ elseif ($action == 'search' && $term != '') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT rowid, ref, label, tosell, tobuy FROM '.MAIN_DB_PREFIX.'product as p';
|
$sql = 'SELECT rowid, ref, label, tosell, tobuy, barcode, price FROM '.MAIN_DB_PREFIX.'product as p';
|
||||||
$sql .= ' WHERE entity IN ('.getEntity('product').')';
|
$sql .= ' WHERE entity IN ('.getEntity('product').')';
|
||||||
if ($filteroncategids) {
|
if ($filteroncategids) {
|
||||||
$sql.= ' AND rowid IN (SELECT DISTINCT fk_product FROM '.MAIN_DB_PREFIX.'categorie_product WHERE fk_categorie IN ('.$filteroncategids.'))';
|
$sql.= ' AND EXISTS (SELECT cp.fk_product FROM '.MAIN_DB_PREFIX.'categorie_product as cp WHERE cp.fk_product = p.rowid AND cp.fk_categorie IN ('.$filteroncategids.'))';
|
||||||
}
|
}
|
||||||
$sql .= ' AND tosell = 1';
|
$sql .= ' AND tosell = 1';
|
||||||
$sql .= natural_search(array('ref', 'label', 'barcode'), $term);
|
$sql .= natural_search(array('ref', 'label', 'barcode'), $term);
|
||||||
@ -96,8 +96,17 @@ elseif ($action == 'search' && $term != '') {
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$rows = array();
|
$rows = array();
|
||||||
while ($row = $db->fetch_object($resql)) {
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
$rows[] = $row;
|
$rows[] = array(
|
||||||
|
'rowid' => $obj->rowid,
|
||||||
|
'ref' => $obj->ref,
|
||||||
|
'label' => $obj->label,
|
||||||
|
'tosell' => $obj->tosell,
|
||||||
|
'tobuy' => $obj->tobuy,
|
||||||
|
'barcode' => $obj->barcode,
|
||||||
|
'price' => $obj->price
|
||||||
|
//'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
echo json_encode($rows);
|
echo json_encode($rows);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -286,7 +286,7 @@ div.paymentbordline
|
|||||||
.row1withhead{
|
.row1withhead{
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: calc(50% - 50px);
|
height: calc(45% - 50px);
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ div.paymentbordline
|
|||||||
.row2withhead{
|
.row2withhead{
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 50%;
|
height: 55%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.div1{
|
.div1{
|
||||||
@ -488,6 +488,20 @@ div#moreinfo, div#infowarehouse {
|
|||||||
padding: 0 8px 0 8px;
|
padding: 0 8px 0 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.productprice {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
right: 5px;
|
||||||
|
background: var(--colorbackhmenu1);
|
||||||
|
color: var(--colortextbackhmenu);
|
||||||
|
font-size: 2em;
|
||||||
|
padding: 5px;
|
||||||
|
border-radius: 2px;
|
||||||
|
opacity: 0.9;
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@media screen and (min-width: 892px) {
|
@media screen and (min-width: 892px) {
|
||||||
.actionbutton{
|
.actionbutton{
|
||||||
@ -561,7 +575,7 @@ div#moreinfo, div#infowarehouse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.row1withhead{
|
.row1withhead{
|
||||||
height: calc(50% - 100px);
|
height: calc(45% - 100px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,15 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place
|
|||||||
$newname = GETPOST('newname', 'alpha');
|
$newname = GETPOST('newname', 'alpha');
|
||||||
$mode = GETPOST('mode', 'alpha');
|
$mode = GETPOST('mode', 'alpha');
|
||||||
|
|
||||||
|
if (empty($user->rights->takepos->run)) {
|
||||||
|
access_forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
if ($action == "getTables")
|
if ($action == "getTables")
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor;
|
$sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor;
|
||||||
@ -81,6 +90,11 @@ if ($action == "add")
|
|||||||
$db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names
|
$db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
$title = 'TakePOS - Dolibarr '.DOL_VERSION;
|
$title = 'TakePOS - Dolibarr '.DOL_VERSION;
|
||||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
|
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
|
||||||
|
|||||||
@ -40,6 +40,10 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place
|
|||||||
$idline = GETPOST('idline', 'int');
|
$idline = GETPOST('idline', 'int');
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
|
if (empty($user->rights->takepos->run)) {
|
||||||
|
access_forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
|
|||||||
@ -263,6 +263,8 @@ function LoadProducts(position, issubcat) {
|
|||||||
if (currentcat==val.fk_parent) {
|
if (currentcat==val.fk_parent) {
|
||||||
$("#prodivdesc"+ishow).show();
|
$("#prodivdesc"+ishow).show();
|
||||||
$("#prodesc"+ishow).text(val.label);
|
$("#prodesc"+ishow).text(val.label);
|
||||||
|
$("#proprice"+ishow).attr("class", "hidden");
|
||||||
|
$("#proprice"+ishow).html("");
|
||||||
$("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid);
|
$("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid);
|
||||||
$("#prodiv"+ishow).data("rowid",val.rowid);
|
$("#prodiv"+ishow).data("rowid",val.rowid);
|
||||||
$("#prodiv"+ishow).data("iscat",1);
|
$("#prodiv"+ishow).data("iscat",1);
|
||||||
@ -281,6 +283,8 @@ function LoadProducts(position, issubcat) {
|
|||||||
if (typeof (data[idata]) == "undefined") {
|
if (typeof (data[idata]) == "undefined") {
|
||||||
$("#prodivdesc"+ishow).hide();
|
$("#prodivdesc"+ishow).hide();
|
||||||
$("#prodesc"+ishow).text("");
|
$("#prodesc"+ishow).text("");
|
||||||
|
$("#proprice"+ishow).attr("class", "hidden");
|
||||||
|
$("#proprice"+ishow).html("");
|
||||||
$("#proimg"+ishow).attr("title","");
|
$("#proimg"+ishow).attr("title","");
|
||||||
$("#proimg"+ishow).attr("src","genimg/empty.png");
|
$("#proimg"+ishow).attr("src","genimg/empty.png");
|
||||||
$("#prodiv"+ishow).data("rowid","");
|
$("#prodiv"+ishow).data("rowid","");
|
||||||
@ -289,9 +293,17 @@ function LoadProducts(position, issubcat) {
|
|||||||
ishow++; //Next product to show after print data product
|
ishow++; //Next product to show after print data product
|
||||||
}
|
}
|
||||||
else if ((data[idata]['status']) == "1") { // Only show products with status=1 (for sell)
|
else if ((data[idata]['status']) == "1") { // Only show products with status=1 (for sell)
|
||||||
var titlestring = '<?php echo dol_escape_js($langs->transnoentities('Ref').': '); ?>'+data[idata]['ref'];
|
<?php
|
||||||
|
$titlestring = "'".dol_escape_js($langs->transnoentities('Ref').': ')."' + data[idata]['ref']";
|
||||||
|
$titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[idata]['barcode']";
|
||||||
|
?>
|
||||||
|
var titlestring = <?php echo $titlestring; ?>;
|
||||||
$("#prodivdesc"+ishow).show();
|
$("#prodivdesc"+ishow).show();
|
||||||
$("#prodesc"+ishow).text(data[parseInt(idata)]['label']);
|
$("#prodesc"+ishow).text(data[parseInt(idata)]['label']);
|
||||||
|
if (data[parseInt(idata)]['price_formated']) {
|
||||||
|
$("#proprice"+ishow).attr("class", "productprice");
|
||||||
|
$("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']);
|
||||||
|
}
|
||||||
$("#proimg"+ishow).attr("title", titlestring);
|
$("#proimg"+ishow).attr("title", titlestring);
|
||||||
$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata]['id']);
|
$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata]['id']);
|
||||||
$("#prodiv"+ishow).data("rowid", data[idata]['id']);
|
$("#prodiv"+ishow).data("rowid", data[idata]['id']);
|
||||||
@ -337,6 +349,8 @@ function MoreProducts(moreorless) {
|
|||||||
if (typeof (data[idata]) == "undefined") {
|
if (typeof (data[idata]) == "undefined") {
|
||||||
$("#prodivdesc"+ishow).hide();
|
$("#prodivdesc"+ishow).hide();
|
||||||
$("#prodesc"+ishow).text("");
|
$("#prodesc"+ishow).text("");
|
||||||
|
$("#proprice"+ishow).attr("class", "");
|
||||||
|
$("#proprice"+ishow).html("");
|
||||||
$("#proimg"+ishow).attr("src","genimg/empty.png");
|
$("#proimg"+ishow).attr("src","genimg/empty.png");
|
||||||
$("#prodiv"+ishow).data("rowid","");
|
$("#prodiv"+ishow).data("rowid","");
|
||||||
ishow++; //Next product to show after print data product
|
ishow++; //Next product to show after print data product
|
||||||
@ -345,6 +359,10 @@ function MoreProducts(moreorless) {
|
|||||||
//Only show products with status=1 (for sell)
|
//Only show products with status=1 (for sell)
|
||||||
$("#prodivdesc"+ishow).show();
|
$("#prodivdesc"+ishow).show();
|
||||||
$("#prodesc"+ishow).text(data[parseInt(idata)]['label']);
|
$("#prodesc"+ishow).text(data[parseInt(idata)]['label']);
|
||||||
|
if (data[parseInt(idata)]['price_formated']) {
|
||||||
|
$("#proprice"+ishow).attr("class", "productprice");
|
||||||
|
$("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']);
|
||||||
|
}
|
||||||
$("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']);
|
$("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']);
|
||||||
$("#prodiv"+ishow).data("rowid",data[idata]['id']);
|
$("#prodiv"+ishow).data("rowid",data[idata]['id']);
|
||||||
$("#prodiv"+ishow).data("iscat",0);
|
$("#prodiv"+ishow).data("iscat",0);
|
||||||
@ -462,7 +480,7 @@ function New() {
|
|||||||
* return {void}
|
* return {void}
|
||||||
*/
|
*/
|
||||||
function Search2(keyCodeForEnter) {
|
function Search2(keyCodeForEnter) {
|
||||||
console.log("Search2 Call ajax search to replace products");
|
console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter);
|
||||||
|
|
||||||
var search = false;
|
var search = false;
|
||||||
var eventKeyCode = window.event.keyCode;
|
var eventKeyCode = window.event.keyCode;
|
||||||
@ -477,20 +495,37 @@ function Search2(keyCodeForEnter) {
|
|||||||
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
|
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
|
||||||
if (typeof (data[i]) == "undefined") {
|
if (typeof (data[i]) == "undefined") {
|
||||||
$("#prodesc" + i).text("");
|
$("#prodesc" + i).text("");
|
||||||
|
$("#proprice" + i).attr("class", "hidden");
|
||||||
|
$("#proprice" + i).html("");
|
||||||
$("#proimg" + i).attr("src", "genimg/empty.png");
|
$("#proimg" + i).attr("src", "genimg/empty.png");
|
||||||
$("#prodiv" + i).data("rowid", "");
|
$("#prodiv" + i).data("rowid", "");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var titlestring = '<?php echo dol_escape_js($langs->transnoentities('Ref').': '); ?>' + data[i]['ref'];
|
<?php
|
||||||
|
$titlestring = "'".dol_escape_js($langs->transnoentities('Ref').': ')."' + data[i]['ref']";
|
||||||
|
$titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[i]['barcode']";
|
||||||
|
?>
|
||||||
|
var titlestring = <?php echo $titlestring; ?>;
|
||||||
$("#prodesc" + i).text(data[i]['label']);
|
$("#prodesc" + i).text(data[i]['label']);
|
||||||
$("#prodivdesc" + i).show();
|
$("#prodivdesc" + i).show();
|
||||||
|
if (data[i]['price_formated']) {
|
||||||
|
$("#proprice" + i).attr("class", "productprice");
|
||||||
|
$("#proprice" + i).html(data[i]['price_formated']);
|
||||||
|
}
|
||||||
$("#proimg" + i).attr("title", titlestring);
|
$("#proimg" + i).attr("title", titlestring);
|
||||||
$("#proimg" + i).attr("src", "genimg/index.php?query=pro&id=" + data[i]['rowid']);
|
$("#proimg" + i).attr("src", "genimg/index.php?query=pro&id=" + data[i]['rowid']);
|
||||||
$("#prodiv" + i).data("rowid", data[i]['rowid']);
|
$("#prodiv" + i).data("rowid", data[i]['rowid']);
|
||||||
$("#prodiv" + i).data("iscat", 0);
|
$("#prodiv" + i).data("iscat", 0);
|
||||||
}
|
}
|
||||||
}).always(function (data) {
|
}).always(function (data) {
|
||||||
if ($('#search').val().length > 0 && data.length == 1) ClickProduct(0);
|
// If there is only 1 answer
|
||||||
|
if ($('#search').val().length > 0 && data.length == 1) {
|
||||||
|
console.log($('#search').val()+' - '+data[0]['barcode']);
|
||||||
|
if ($('#search').val() == data[0]['barcode']) {
|
||||||
|
console.log("There is only 1 answer with barcode matching the search, so we add the product in basket");
|
||||||
|
ClickProduct(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -924,15 +959,16 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
|
|||||||
<?php
|
<?php
|
||||||
if ($count == ($MAXPRODUCT - 2)) {
|
if ($count == ($MAXPRODUCT - 2)) {
|
||||||
//echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="proimg'.$count.'" />';
|
//echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="proimg'.$count.'" />';
|
||||||
echo '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em;"></span>';
|
print '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em;"></span>';
|
||||||
}
|
}
|
||||||
elseif ($count == ($MAXPRODUCT - 1)) {
|
elseif ($count == ($MAXPRODUCT - 1)) {
|
||||||
//echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="proimg'.$count.'" />';
|
//echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="proimg'.$count.'" />';
|
||||||
echo '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em;"></span>';
|
print '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em;"></span>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo '<img class="imgwrapper" height="100%" title="" id="proimg'.$count.'">';
|
print '<div class="" id="proprice'.$count.'"></div>';
|
||||||
|
print '<img class="imgwrapper" height="100%" title="" id="proimg'.$count.'">';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php if ($count != ($MAXPRODUCT - 2) && $count != ($MAXPRODUCT - 1)) { ?>
|
<?php if ($count != ($MAXPRODUCT - 2) && $count != ($MAXPRODUCT - 1)) { ?>
|
||||||
|
|||||||
@ -70,6 +70,11 @@ if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout ==
|
|||||||
<script type="text/javascript" src="js/jquery.colorbox-min.js"></script>';
|
<script type="text/javascript" src="js/jquery.colorbox-min.js"></script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($user->rights->takepos->run)) {
|
||||||
|
access_forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abort invoice creationg with a given error message
|
* Abort invoice creationg with a given error message
|
||||||
*
|
*
|
||||||
|
|||||||
@ -38,6 +38,10 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place
|
|||||||
|
|
||||||
$invoiceid = GETPOST('invoiceid', 'int');
|
$invoiceid = GETPOST('invoiceid', 'int');
|
||||||
|
|
||||||
|
if (empty($user->rights->takepos->run)) {
|
||||||
|
access_forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
|
|||||||
@ -48,6 +48,11 @@ if ($setterminal > 0)
|
|||||||
|
|
||||||
$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter"));
|
$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter"));
|
||||||
|
|
||||||
|
if (empty($user->rights->takepos->run)) {
|
||||||
|
access_forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -34,6 +34,10 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place
|
|||||||
|
|
||||||
$facid = GETPOST('facid', 'int');
|
$facid = GETPOST('facid', 'int');
|
||||||
|
|
||||||
|
if (empty($user->rights->takepos->run)) {
|
||||||
|
access_forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
|
|||||||
@ -38,6 +38,10 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place
|
|||||||
|
|
||||||
$invoiceid = GETPOST('invoiceid', 'int');
|
$invoiceid = GETPOST('invoiceid', 'int');
|
||||||
|
|
||||||
|
if (empty($user->rights->takepos->run)) {
|
||||||
|
access_forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
|
|||||||
@ -37,6 +37,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
|||||||
|
|
||||||
$invoiceid = GETPOST('facid', 'int');
|
$invoiceid = GETPOST('facid', 'int');
|
||||||
|
|
||||||
|
if (empty($user->rights->takepos->run)) {
|
||||||
|
access_forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,5 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
require '../main.inc.php';
|
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||||
|
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||||
|
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||||
|
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||||
|
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
|
||||||
|
if (empty($user->rights->takepos->run)) {
|
||||||
|
access_forbidden();
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET['status'])) {
|
if (isset($_GET['status'])) {
|
||||||
die(strtoupper($_SESSION['SMP_CURRENT_PAYMENT']));
|
die(strtoupper($_SESSION['SMP_CURRENT_PAYMENT']));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user