* Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2019 Andreu Bisquerra Gaya * Copyright (C) 2021 Nicolas ZABOURI * 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/receipt.php * \ingroup takepos * \brief Setup page for TakePos module */ // 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."/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', 'restricthtml'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'restricthtml'), '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_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT', GETPOST('TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT', 'alphanohtml'), '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); // TakePOS connector require ReceiptPrinter module if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector" && !isModEnabled('receiptprinter')) { activateModule("modReceiptPrinter"); } } /* * View */ $form = new Form($db); $formproduct = new FormProduct($db); llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, '', '', '', 'mod-takepos page-admin_receipt'); $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, 'receipt', 'TakePOS', -1, 'cash-register'); print '
'; print ''; print ''; print load_fiche_titre($langs->trans("Receipt"), '', ''); print '
'; print ''; print ''; print ''; print "\n"; // VAT Grouped on ticket print '\n"; if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "browser" || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { $substitutionarray = pdf_getSubstitutionArray($langs, array('ticket', 'member', 'candidate'), null, 2, array('company', 'user', 'object', 'system')); $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"; // Print payment method print '\n"; } // Show price without vat print '\n"; if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector" && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { print '\n"; } if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector" && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { print '\n"; } // Print without details print '\n"; if (getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS')) { print '\n"; } // Auto print tickets print '\n"; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; print $langs->trans('TicketVatGrouped'); print ''; print ajax_constantonoff("TAKEPOS_TICKET_VAT_GROUPPED", array(), $conf->entity, 0, 0, 1, 0); print "
'; print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices")." - ".$langs->trans("Header"), $htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; print '
'; $variablename = 'TAKEPOS_HEADER'; if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { print ''; } else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, getDolGlobalString($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 (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { print ''; } else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes'); print $doleditor->Create(); } print "
'; print ''; print '
'; print $langs->trans('PrintCustomerOnReceipts'); print ''; print ajax_constantonoff("TAKEPOS_SHOW_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0); print "
'; print $langs->trans('PrintPaymentMethodOnReceipts'); print ''; print ajax_constantonoff("TAKEPOS_PRINT_PAYMENT_METHOD", array(), $conf->entity, 0, 0, 1, 0); print "
'; print $langs->trans('ShowPriceHTOnReceipt'); print ''; print ajax_constantonoff("TAKEPOS_SHOW_HT_RECEIPT", array(), $conf->entity, 0, 0, 1, 0); print "
'; print $langs->trans('WeighingScale'); print ''; print ajax_constantonoff("TAKEPOS_WEIGHING_SCALE", array(), $conf->entity, 0, 0, 1, 0); print "
'; print $langs->trans('CustomerDisplay'); print ''; print ajax_constantonoff("TAKEPOS_CUSTOMER_DISPLAY", array(), $conf->entity, 0, 0, 1, 0); print "
'; print $langs->trans('PrintWithoutDetailsButton'); print ''; print ajax_constantonoff('TAKEPOS_PRINT_WITHOUT_DETAILS', array(), $conf->entity, 0, 0, 1, 0); print "
'; print $langs->trans('PrintWithoutDetailsLabelDefault'); print ''; print ''; print "
'; print $langs->trans("AutoPrintTickets"); print ''; print ajax_constantonoff("TAKEPOS_AUTO_PRINT_TICKETS", array(), $conf->entity, 0, 0, 1, 0); print "
'; print '
'; print $form->buttonsSaveCancel("Save", ''); print "
\n"; print '
'; print load_fiche_titre($langs->trans("Preview"), '', ''); print '
'; print '
'; print ''; print '
'; print '
'; print '
'; llxFooter(); $db->close();