* Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2019 Andreu Bisquerra Gaya * * 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/terminal.php * \ingroup takepos * \brief Setup page for TakePos module */ 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."/core/lib/takepos.lib.php"; // Security check if (!$user->admin) accessforbidden(); $langs->loadLangs(array("admin", "cashdesk", "commercial")); /* * Actions */ if (GETPOST('action', 'alpha') == 'set') { $db->begin(); $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_RECEIPT_NAME", GETPOST('TAKEPOS_RECEIPT_NAME', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); 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'); } } elseif (GETPOST('action', 'alpha') == 'setmethod') { dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity); } /* * 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, 'receipt', 'TakePOS', -1, 'cash-register'); print '
'; print ''; print ''; print load_fiche_titre($langs->trans("PrintMethod"), '', ''); print ''; print ''; print ''; print "\n"; // Browser method print '\n"; // Receipt printer module if ($conf->global->MAIN_FEATURES_LEVEL >= 1) { print '\n"; } // TakePOS Connector print '\n"; print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").'
'; print $langs->trans('Browser'); print ''; print $langs->trans('BrowserMethodDescription'); print ''; if ($conf->global->TAKEPOS_PRINT_METHOD == "browser") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print "
'; print $langs->trans('DolibarrReceiptPrinter'); print ''; print $langs->trans('ReceiptPrinterMethodDescription'); print '
'; print ''.$langs->trans("Setup").''; print '
'; if ($conf->receiptprinter->enabled) { if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } } else { print ''; print $langs->trans("ModuleReceiptPrinterMustBeEnabled"); print ''; } print "
'; print "TakePOS Connector"; print ''; print $langs->trans('TakeposConnectorMethodDescription'); print ''; if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print "
'; print load_fiche_titre($langs->trans("Setup"), '', ''); print ''; print ''; print ''; print "\n"; if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { print ''; } if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; foreach ($substitutionarray as $key => $val) $htmltext .= $key.'
'; $htmltext .= '
'; print '\n"; print '\n"; print ''; // Customer information print '\n"; } // Auto print tickets print '\n"; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; print $langs->trans("URL")." / ".$langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; print ''; print ''; print '
'; print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices")." - ".$langs->trans("Header"), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; print '
'; $variablename = 'TAKEPOS_HEADER'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); } print "
'; print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices")." - ".$langs->trans("Footer"), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; print '
'; $variablename = 'TAKEPOS_FOOTER'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); } print "
'; print ''; print '
'; print $langs->trans('PrintCustomerOnReceipts'); print ''; print $form->selectyesno("TAKEPOS_SHOW_CUSTOMER", $conf->global->TAKEPOS_SHOW_CUSTOMER, 1); print "
'; print $langs->trans("AutoPrintTickets"); print ''; print $form->selectyesno("TAKEPOS_AUTO_PRINT_TICKETS", $conf->global->TAKEPOS_AUTO_PRINT_TICKETS, 1); print "
'; print '
'; print '
'; print "
\n"; print '
'; llxFooter(); $db->close();