From a2b973f9f7e31d305e715ea786cf0fd0b23ac564 Mon Sep 17 00:00:00 2001 From: "jove@bisquerra.com" Date: Sun, 22 Mar 2020 14:50:09 +0100 Subject: [PATCH 1/2] NEW: Multiple sales in TakePOS --- htdocs/societe/list.php | 4 ++-- htdocs/takepos/floors.php | 2 +- htdocs/takepos/freezone.php | 2 +- htdocs/takepos/index.php | 6 ++++-- htdocs/takepos/invoice.php | 23 +++++++++++++++++++++-- htdocs/takepos/pay.php | 2 +- htdocs/takepos/phone.php | 2 +- htdocs/takepos/receipt.php | 2 +- htdocs/takepos/reduction.php | 2 +- 9 files changed, 33 insertions(+), 12 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 04ad577bff9..63641f27625 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -228,7 +228,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); if ($action == "change") // Change customer for TakePOS { $idcustomer = GETPOST('idcustomer', 'int'); - $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant + $place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant // Check if draft invoice already exists, if not create it $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")"; @@ -1031,7 +1031,7 @@ while ($i < min($num, $limit)) print ' 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant + $place = (GETPOST('place', 'alpha') > 0 ? GETPOST('place', 'alpha') : 0); // $place is id of table for Bar or Restaurant print ' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.'&place='.$place.'\'"'; } print '>'; diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 260813dd3b6..ac74a8d2203 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -42,7 +42,7 @@ $action = GETPOST('action', 'alpha'); $left = GETPOST('left', 'alpha'); $top = GETPOST('top', 'alpha'); -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant $newname = GETPOST('newname', 'alpha'); $mode = GETPOST('mode', 'alpha'); diff --git a/htdocs/takepos/freezone.php b/htdocs/takepos/freezone.php index 1d4e0dfc7be..ee9b61581e2 100644 --- a/htdocs/takepos/freezone.php +++ b/htdocs/takepos/freezone.php @@ -40,7 +40,7 @@ global $mysoc; $langs->loadLangs(array("bills", "cashdesk")); -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'alpha') > 0 ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant $idline = GETPOST('idline', 'int'); $action = GETPOST('action', 'alpha'); diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 9615f90d539..03f90e7bd96 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant +$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Bar or Restaurant or multiple sales $action = GETPOST('action', 'alpha'); $setterminal = GETPOST('setterminal', 'int'); @@ -732,7 +732,9 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { echo ' - '.dol_print_date(dol_now(), "day").''; ?> -
+
+ +
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 683b74edc4b..d295333af57 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -44,7 +44,7 @@ $langs->loadLangs(array("companies", "commercial", "bills", "cashdesk", "stocks" $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $idproduct = GETPOST('idproduct', 'int'); -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant +$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Bar or Restaurant $placeid = 0; // $placeid is ID of invoice if (empty($user->rights->takepos->run)) { @@ -713,9 +713,28 @@ $( document ).ready(function() { } ?> - $("a#customer").html(''); + $("#customerandsales").html(''); query($sql); + if ($resql) { + while ($obj = $db->fetch_object($resql)) { + echo '$("#customerandsales").append(\''; + if ($placeid==$obj->rowid) echo ""; + echo 'ref)); + echo $num_sale; + if (str_replace("-","",$num_sale)>$max_sale) $max_sale=str_replace("-","",$num_sale); + echo '\\\'">'.date('H:i', strtotime($obj->datec)); + if ($placeid==$obj->rowid) echo ""; + echo '\');'; + } + echo '$("#customerandsales").append(\'\');'; + } + $s = ''; $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index f79e310f36b..a3bac766aaf 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -34,7 +34,7 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant $invoiceid = GETPOST('invoiceid', 'int'); diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index c32561d3f52..424282d27cf 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant $action = GETPOST('action', 'alpha'); $setterminal = GETPOST('setterminal', 'int'); diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 31390c347bd..50010cf1712 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -30,7 +30,7 @@ include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $langs->loadLangs(array("main", "cashdesk", "companies")); -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant $facid = GETPOST('facid', 'int'); diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php index 7ad3e88d2b5..f4a83a09c52 100644 --- a/htdocs/takepos/reduction.php +++ b/htdocs/takepos/reduction.php @@ -34,7 +34,7 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant $invoiceid = GETPOST('invoiceid', 'int'); From 40e5e7a46bdd0bd1336e26e91fd70047b3c67816 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 22 Mar 2020 15:24:32 +0100 Subject: [PATCH 2/2] Travis fixes --- htdocs/takepos/invoice.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index d295333af57..501984d9460 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -723,18 +723,18 @@ $( document ).ready(function() { echo '$("#customerandsales").append(\''; if ($placeid==$obj->rowid) echo ""; echo 'ref)); + $num_sale=str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref)); echo $num_sale; - if (str_replace("-","",$num_sale)>$max_sale) $max_sale=str_replace("-","",$num_sale); + if (str_replace("-", "", $num_sale)>$max_sale) $max_sale=str_replace("-", "", $num_sale); echo '\\\'">'.date('H:i', strtotime($obj->datec)); if ($placeid==$obj->rowid) echo ""; echo '\');'; } - echo '$("#customerandsales").append(\'\');'; + echo '$("#customerandsales").append(\'\');'; } - + $s = ''; $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];