diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index 8a883ceef91..729952916ad 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -42,6 +42,14 @@ function takepos_prepare_head() $head[$h][1] = $langs->trans("Receipt"); $head[$h][2] = 'receipt'; $h++; + + if ($conf->global->TAKEPOS_BAR_RESTAURANT) + { + $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/bar.php'; + $head[$h][1] = $langs->trans("BarRestaurant"); + $head[$h][2] = 'bar'; + $h++; + } $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); for ($i = 1; $i <= $numterminals; $i++) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index f2bc989b953..b22a7b83166 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -105,4 +105,6 @@ CashReport=Cash report MainPrinterToUse=Main printer to use OrderPrinterToUse=Order printer to use MainTemplateToUse=Main template to use -OrderTemplateToUse=Order template to use \ No newline at end of file +OrderTemplateToUse=Order template to use +BarRestaurant=Bar Restaurant +AutoOrder=Customer auto order \ No newline at end of file diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php new file mode 100644 index 00000000000..16fccf85147 --- /dev/null +++ b/htdocs/takepos/admin/bar.php @@ -0,0 +1,178 @@ + + * Copyright (C) 2011-2017 Juanjo Menent + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/takepos/admin/bar.php + * \ingroup takepos + * \brief Setup page for TakePos module - Bar Restaurant features + */ + +require '../../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php"; + +// Security check +if (!$user->admin) accessforbidden(); + +$langs->loadLangs(array("admin", "cashdesk", "printing")); + +global $db; + +/* + * Actions + */ + +if (GETPOST('action', 'alpha') == 'set') +{ + $db->begin(); + + dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); + + if (!$res > 0) $error++; + + if (!$error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + + +/* + * View + */ + +$form = new Form($db); +$formproduct = new FormProduct($db); + +llxHeader('', $langs->trans("CashDeskSetup")); + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); +$head = takepos_prepare_head(); +dol_fiche_head($head, 'bar', 'TakePOS', -1); +print '
'; + + +// Mode +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; +print ''; +print "\n"; + +if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") { + print ''; + + print ''; +} + +print ''; + +print ''; + +if ($conf->global->TAKEPOS_SUPPLEMENTS) +{ + print '\n"; +} + +print ''; + + +print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; + print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; + print ''; + print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); + //print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); + print '
'; + print $langs->trans("OrderNotes"); + print ''; + print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); + //print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); + print '
'; +print $langs->trans("BasicPhoneLayout"); +print ''; +//print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); +print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0); +print '
'; +print $langs->trans("ProductSupplements"); +print ''; +//print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1); +print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0); +print '
'; + print $langs->trans("SupplementCategory"); + print ''; + print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); + print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); + print "
'; +print $langs->trans("AutoOrder"); +print ''; +print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0); +print '
'; + +if ($conf->global->TAKEPOS_AUTO_ORDER) +{ + print '
'; + print ''; + print ''; + print ''; + print "\n"; + + //global $dolibarr_main_url_root; + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables"; + $resql = $db->query($sql); + $rows = array(); + while ($row = $db->fetch_array($resql)) { + print ''; + } + + print '
'.$langs->trans("Table").''.$langs->trans("URL").''.$langs->trans("QR").'
'; + print $langs->trans("Table")." ".$row['label']; + print ''; + print "".$urlwithroot."/takepos/auto_order.php?key=".dol_encode($row['rowid']).""; + print ''; + print ""; + print '
'; +} + +print '
'; + +print '
'; + +print '
'; + +print "
\n"; + +print '
'; + +llxFooter(); +$db->close(); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 3e12fdce5c9..59fe85e66ef 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -434,19 +434,6 @@ print "\n"; //print $form->selectarray('TAKEPOS_ADDON', $array, (empty($conf->global->TAKEPOS_ADDON) ? '0' : $conf->global->TAKEPOS_ADDON), 0); //print "\n"; -print ''; -print ''; - -print '
'; - -// Bar Restaurant mode -print '
'; -print ''; - -print ''; -print ''; -print "\n"; - print ''; @@ -455,48 +442,6 @@ print ajax_constantonoff("TAKEPOS_BAR_RESTAURANT", array(), $conf->entity, 0, 0, //print $form->selectyesno("TAKEPOS_BAR_RESTAURANT", $conf->global->TAKEPOS_BAR_RESTAURANT, 1); print "\n"; -if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") { - print ''; - - print ''; -} - -if ($conf->global->TAKEPOS_BAR_RESTAURANT) -{ - print ''; - - print ''; - - if ($conf->global->TAKEPOS_SUPPLEMENTS) - { - print '\n"; - } -} print '
'.$langs->trans("Other").''.$langs->trans("Value").'
'; print $langs->trans("EnableBarOrRestaurantFeatures"); print '
'; - print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; - print ''; - print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); - //print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); - print '
'; - print $langs->trans("OrderNotes"); - print ''; - print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); - //print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); - print '
'; - print $langs->trans("BasicPhoneLayout"); - print ''; - //print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); - print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0); - print '
'; - print $langs->trans("ProductSupplements"); - print ''; - //print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1); - print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0); - print '
'; - print $langs->trans("SupplementCategory"); - print ''; - print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); - print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); - print "
'; print '
'; diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index f3b5ba15716..d1f59325c1f 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -142,4 +142,10 @@ elseif ($action == 'search' && $term != '') { } echo json_encode($object); +} elseif ($action == 'thecheck') { + $place = GETPOST('place', 'alpha'); + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php'; + $printer = new dolReceiptPrinter($db); + $printer->sendToPrinter($object, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$term}, $conf->global->{'TAKEPOS_PRINTER_TO_USE'.$term}); } diff --git a/htdocs/takepos/auto_order.php b/htdocs/takepos/auto_order.php new file mode 100644 index 00000000000..5305b4da81f --- /dev/null +++ b/htdocs/takepos/auto_order.php @@ -0,0 +1,29 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/takepos/auto_order.php + * \ingroup takepos + * \brief Public orders for customers + */ + +if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) +if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip + +$_SESSION["basiclayout"] = 1; +$_SESSION["publicterminal"] = true; // Is a public customer +require 'phone.php'; diff --git a/htdocs/takepos/genimg/qr.php b/htdocs/takepos/genimg/qr.php new file mode 100644 index 00000000000..23b033f3da5 --- /dev/null +++ b/htdocs/takepos/genimg/qr.php @@ -0,0 +1,33 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) +if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +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'; // Load $user and permissions +require '../../core/modules/barcode/doc/tcpdfbarcode.modules.php'; + +$key = GETPOST('key'); + +$module = new modtcpdfbarcode($db); +$result = $module->buildBarCode("http://www.takepos.com", 'QRCODE', 'Y'); \ No newline at end of file diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index fa5ca2f83be..f59a3b5c97d 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -47,13 +47,16 @@ $idproduct = GETPOST('idproduct', 'int'); $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant $placeid = 0; // $placeid is ID of invoice -if (empty($user->rights->takepos->run)) { +if ($_SESSION["publicterminal"]) { + $_SESSION["takeposterminal"] = 1; // Use Terminal 1 for public customers +} +else if (empty($user->rights->takepos->run)) { accessforbidden(); } -if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') +if (($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') || $_SESSION["publicterminal"]) { // DIRECT LINK TO THIS PAGE FROM MOBILE AND NO TERMINAL SELECTED if ($_SESSION["takeposterminal"] == "") diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index b2526ef885e..224cf3dd1c3 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -37,7 +37,12 @@ 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', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant +if ($_SESSION["publicterminal"]){ + // Decode place if is a order from customer phone + $key = GETPOST('key'); + $place=dol_decode($key); +} +else $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant $action = GETPOST('action', 'alpha'); $setterminal = GETPOST('setterminal', 'int'); @@ -48,7 +53,10 @@ if ($setterminal > 0) $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter")); -if (empty($user->rights->takepos->run)) { +if ($_SESSION["publicterminal"]) { + $_SESSION["takeposterminal"] = 1; // Use Terminal 1 for public customers +} +else if (empty($user->rights->takepos->run)) { accessforbidden(); } @@ -167,6 +175,14 @@ function Exit(){ window.location.href='../user/logout.php'; } +function CheckPlease(){ + console.log("Request the check to the waiter"); + $.ajax({ + type: "GET", + url: "", + }); +} + @@ -175,10 +191,13 @@ if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] ?>
- - - - + '.strtoupper(substr($langs->trans('Floors'), 0, 3)).''; + print ''; + print ''; + print ''; + if ($_SESSION["publicterminal"]) print ''; + ?>