* Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2022 Alexandre Spangaro * * 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 */ // Load Dolibarr environment 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")); $res = 0; /* * Actions */ if (GETPOST('action', 'alpha') == 'set') { $db->begin(); dol_syslog("admin/bar"); $suplement_category = GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'); if ($suplement_category < 0) { $suplement_category = 0; } $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", $suplement_category, 'chaine', 0, '', $conf->entity); if ($res <= 0) { $error++; } if (!$error) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } } if (getDolGlobalInt('TAKEPOS_ORDER_NOTES') == 1) { $extrafields = new ExtraFields($db); $extrafields->addExtraField('order_notes', 'Order notes', 'varchar', 0, 255, 'facturedet', 0, 0, '', '', 0, '', 0, 1); } /* * View */ $form = new Form($db); $formproduct = new FormProduct($db); $arrayofjs = array(); $arrayofcss = array("/takepos/css/colorbox.css"); llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, $arrayofjs, $arrayofcss, '', 'mod-takepos page-admin_bar'); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); $head = takepos_admin_prepare_head(); print dol_get_fiche_head($head, 'bar', 'TakePOS', -1, 'cash-register'); // Mode print '
'; print ''; print ''; ?> '; print $langs->trans("EnableBarOrRestaurantFeatures"); print ajax_constantonoff("TAKEPOS_BAR_RESTAURANT", array(), $conf->entity, 0, 0, 1, 0); print ''; print '
'; if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) { print '
'; print ' '.$langs->trans("DefineTablePlan").'
'; print '

'; print '
'; print ''; print ''; print ''; print "\n"; print ''; print ''; if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) { print ''; print ''; } /*else { print ''; print ''; print ''; print ''; }*/ print ''; print ''; if (getDolGlobalInt('TAKEPOS_SUPPLEMENTS')) { print ''; print '\n"; } print ''; print ''; print ''; print ''; // Experimental minimal interface print ''; print ''; print '
'.$langs->trans("Parameters").'
'; print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; print ''; print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); print '
'; print $langs->trans("OrderNotes"); print ''; print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); print '
'; print $langs->trans("OrderPrinters"); print ''; print ''.$langs->trans("NotAvailableWithBrowserPrinter").''; print '
'; print $langs->trans("OrderNotes"); print ''; print ''.$langs->trans("NotAvailableWithBrowserPrinter").''; 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 img_picto('', 'category', 'class="pictofixedwidth"'); print $form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalString('TAKEPOS_SUPPLEMENTS_CATEGORY'), 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); print "
'; print 'QR - '.$langs->trans("CustomerMenu"); print ''; print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0); print '
'; print 'QR - '.$langs->trans("AutoOrder"); print ''; print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0); print '
'; print $langs->trans("BasicPhoneLayout"); print ' - '.$langs->trans("Experimental").''; 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, 0, 0, '_warning'); print '
'; print '
'; print '
'; print $form->buttonsSaveCancel("Save", ''); } if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) { if (getDolGlobalInt('TAKEPOS_QR_MENU')) { $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 print '
'; print '
'; print ''; print ''; print ''; print "\n"; print ''; print ''; print '
'.$langs->trans("URL").' - '.$langs->trans("CustomerMenu").''.$langs->trans("QR").'
'; print ''.$urlwithroot.'/takepos/public/menu.php'; print ''; print ''; print '
'; print '
'; } if (getDolGlobalInt('TAKEPOS_AUTO_ORDER')) { print '
'; 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 WHERE entity IN (".getEntity('takepos').")"; $resql = $db->query($sql); $rows = array(); while ($row = $db->fetch_array($resql)) { print ''; print ''; print ''; } print '
'.$langs->trans("Table").''.$langs->trans("URL").' - '.$langs->trans("AutoOrder").''.$langs->trans("QR").'
'; print $langs->trans("Table")." ".$row['label']; print ''; print ''.$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid']).''; print ''; print ''; print '
'; print '
'; } } print "
\n"; print '
'; llxFooter(); $db->close();