+ *
+ * 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);
+
+ 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, 'receipt', 'TakePOS', -1);
+print '
';
+
+
+// Mode
+print '\n";
+
+print '
';
+
+llxFooter();
+$db->close();
diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php
index 23e6eb05c48..5d7d2057ca1 100644
--- a/htdocs/takepos/admin/setup.php
+++ b/htdocs/takepos/admin/setup.php
@@ -75,11 +75,10 @@ if (GETPOST('action', 'alpha') == 'set')
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', '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_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_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity);
+ $res = dolibarr_set_const($db, "TAKEPOS_CUSTOM_RECEIPT", GETPOST('TAKEPOS_CUSTOM_RECEIPT', 'int'), 'int', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity);
if ($conf->global->TAKEPOS_ORDER_NOTES==1)
@@ -232,6 +231,13 @@ print '';
print $form->selectyesno("TAKEPOS_DIRECT_PAYMENT", $conf->global->TAKEPOS_DIRECT_PAYMENT, 1);
print " | \n";
+// Custom Receipt
+print '| ';
+print $langs->trans('CustomReceipt');
+print ' | ';
+print $form->selectyesno("TAKEPOS_CUSTOM RECEIPT", $conf->global->TAKEPOS_CUSTOM_RECEIPT, 1);
+print " |
\n";
+
// Email template for send invoice
print '| ';
print $langs->trans('EmailTemplate');
@@ -256,44 +262,6 @@ if (is_array($formmail->lines_model))
print $form->selectarray('TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename, $conf->global->TAKEPOS_EMAIL_TEMPLATE_INVOICE, 'None', 1, 0, '', 0, 0, 0, '', '', 1);
print " |
\n";
-$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 '';
-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 " |
\n";
-
-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 " |
\n";
-
print '';
print '
';
diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php
index 5905592607c..35e3bd7f836 100644
--- a/htdocs/takepos/receipt.php
+++ b/htdocs/takepos/receipt.php
@@ -28,7 +28,7 @@
require '../main.inc.php'; // Load $user and permissions
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
-$langs->loadLangs(array("main", "cashdesk"));
+$langs->loadLangs(array("main", "cashdesk", "companies"));
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
@@ -54,6 +54,14 @@ if ($place > 0)
$object=new Facture($db);
$object->fetch($facid);
+// Call to external receipt modules if exist
+$hookmanager->initHooks(array('takeposfrontend'), $facid);
+$reshook=$hookmanager->executeHooks('TakeposReceipt', $parameters, $object);
+if (!empty($hookmanager->resPrint)) {
+ print $hookmanager->resPrint;
+ exit;
+}
+
// IMPORTANT: This file is sended to 'Takepos Printing' application. Keep basic file. No external files as css, js... If you need images use absolute path.
?>
@@ -77,19 +85,34 @@ $object->fetch($facid);
global->TAKEPOS_HEADER))
+if ($conf->global->TAKEPOS_CUSTOM_RECEIPT)
{
- $newfreetext=make_substitutions($conf->global->TAKEPOS_HEADER, $substitutionarray);
- echo $newfreetext;
+ $substitutionarray=getCommonSubstitutionArray($langs);
+ if (! empty($conf->global->TAKEPOS_HEADER))
+ {
+ $newfreetext=make_substitutions($conf->global->TAKEPOS_HEADER, $substitutionarray);
+ echo $newfreetext;
+ }
}
?>
trans('Date')." ".dol_print_date($object->date, 'day').'
';
-if ($mysoc->country_code == 'ES') print "Factura simplificada ";
+if ($conf->global->TAKEPOS_CUSTOM_RECEIPT) print $conf->global->TAKEPOS_RECEIPT_NAME." ";
print $object->ref;
+if ($conf->global->TAKEPOS_CUSTOM_RECEIPT && $conf->global->TAKEPOS_SHOW_CUSTOMER)
+{
+ $soc = new Societe($db);
+ $soc->fetch($invoice->socid);
+ if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]})
+ {
+ $soc = new Societe($db);
+ if ($invoice->socid > 0) $soc->fetch($invoice->socid);
+ else $soc->fetch($conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]});
+ print "
".$langs->trans("Customer").': '.$soc->name;
+ }
+}
?>
@@ -160,11 +183,13 @@ print $object->ref;
global->TAKEPOS_FOOTER))
+if ($conf->global->TAKEPOS_CUSTOM_RECEIPT)
{
- $newfreetext=make_substitutions($conf->global->TAKEPOS_FOOTER, $substitutionarray);
- echo $newfreetext;
+ $substitutionarray=getCommonSubstitutionArray($langs);
+ if (! empty($conf->global->TAKEPOS_FOOTER)){
+ $newfreetext=make_substitutions($conf->global->TAKEPOS_FOOTER, $substitutionarray);
+ echo $newfreetext;
+ }
}
?>
diff --git a/test/phpunit/CoreTest.php b/test/phpunit/CoreTest.php
index 4720df9014c..eb6e90dc41a 100644
--- a/test/phpunit/CoreTest.php
+++ b/test/phpunit/CoreTest.php
@@ -374,7 +374,7 @@ class CoreTest extends PHPUnit\Framework\TestCase
$result=testSqlAndScriptInject($test, 0);
$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject eee');
- $test="
"; // Is locked by some brwoser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer.
+ $test="
"; // Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer.
$test="
"; // Same
$test='';