From 0d2b4faee257a3b5c602083847287c6e61be2df7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Oct 2025 00:45:59 +0200 Subject: [PATCH] Prepare code for LNE --- htdocs/langs/en_US/cashdesk.lang | 2 +- htdocs/takepos/admin/terminal.php | 21 ++++++++++++++------- htdocs/takepos/index.php | 4 ++-- htdocs/takepos/receipt.php | 22 +++++++++++++++++++++- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 93d48d3516b..8f896caaf66 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -112,7 +112,7 @@ CashReport=Cash report MainPrinterToUse=Main printer to use MainPrinterToUseMore=leave empty to use the browser printer system OrderPrinterToUse=Order printer to use -MainTemplateToUse=Main template to use +MainTemplateToUse=Main receipt template to use MainTemplateToUseMore=when not using browser printing system OrderTemplateToUse=Order template to use BarRestaurant=Bar Restaurant diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 73219d9a0a5..245349eb870 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -435,9 +435,13 @@ if (getDolGlobalString('TAKEPOS_ADDON') == "terminal") { // Options when using a special printer in TakePOS $customprinterallowed = true; +$orderprinterallowed = (getDolGlobalString('TAKEPOS_BAR_RESTAURANT') && getDolGlobalInt('TAKEPOS_ORDER_PRINTERS')); +$customprinttemplateallowed = true; $arrayOfCountryWithPrintingOnBrowserMandatory = array('FR'); if (in_array($mysoc->country_code, $arrayOfCountryWithPrintingOnBrowserMandatory) && isModEnabled('blockedlog')) { - $customprinterallowed = false; + //$customprinterallowed = false; // Custom printer are allowed but information in template are mandatory + $customprinttemplateallowed = false; + //$orderprinterallowed = false; } if (isModEnabled('receiptprinter')) { @@ -461,7 +465,7 @@ if (isModEnabled('receiptprinter')) { } print ''; - if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT') && getDolGlobalInt('TAKEPOS_ORDER_PRINTERS')) { + if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT') && getDolGlobalInt('TAKEPOS_ORDER_PRINTERS') && $orderprinterallowed) { print ''.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 1'; print ''; print $form->selectarray('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal), 1); @@ -488,18 +492,21 @@ if (isModEnabled('receiptprinter') || getDolGlobalString('TAKEPOS_PRINT_METHOD') } print ''.$langs->trans("MainTemplateToUse"); print ' ('.$langs->trans("MainTemplateToUseMore").')'; - print ' ('.$langs->trans("SetupReceiptTemplate").')'; + if ($customprinttemplateallowed) { + print ' ('.$langs->trans("SetupReceiptTemplate").')'; + } print ''; - if (!$customprinterallowed) { + if (!$customprinttemplateallowed) { print ''.$langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name')).''; } else { - print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, getDolGlobalInt('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal), 1); + print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, getDolGlobalInt('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal), 1, 0, 0, '', 0, 0, 0, '', 'minwidth150'); } print ''; - if (getDolGlobalInt('TAKEPOS_ORDER_PRINTERS')) { + + if (getDolGlobalInt('TAKEPOS_ORDER_PRINTERS') && $orderprinterallowed) { print ''.$langs->trans("OrderTemplateToUse").''; print ''; - print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal, $templates, getDolGlobalInt('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal), 1); + print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal, $templates, getDolGlobalInt('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal), 1, 0, 0, '', 0, 0, 0, '', 'minwidth150'); print ''; } } diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index caa7b7ac577..8efb241f649 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -962,7 +962,7 @@ function Edit(number) { function TakeposPrintingOrder(){ - console.log("TakeposPrintingOrder"); + console.log("TakeposPrintingOrder output invoice to print order"); $("#poslines").load("invoice.php?action=order&token=&place="+place, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); @@ -1411,7 +1411,7 @@ if (!getDolGlobalString('TAKEPOS_NO_SPLIT_SALE')) { $menus[$r++] = array('title' => '
'.$langs->trans("SplitSale").'
', 'action' => 'Split();'); } -// BAR RESTAURANT specific menu +// BAR RESTAURANT specific menu "Print on Order printer" if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) { if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) { $menus[$r++] = array('title' => '
'.$langs->trans("Order").'', 'action' => 'TakeposPrintingOrder();'); diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index a78403852cb..e1315508aea 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -175,6 +175,24 @@ if (getDolGlobalString('TAKEPOS_HEADER') || getDolGlobalString($constFreeText)) } ?>

+ +status == Facture::STATUS_DRAFT) { + $canprintifnotvalidate = true; + $arrayOfCountryWithPrintingOnBrowserMandatory = array('FR'); + if (in_array($mysoc->country_code, $arrayOfCountryWithPrintingOnBrowserMandatory) && isModEnabled('blockedlog')) { + //$customprinterallowed = false; // Custom printer are allowed but information in template are mandatory + $canprintifnotvalidate = false; + //$orderprinterallowed = false; + } + + if (!$canprintifnotvalidate) { + print "Error: Printing ticket is not allowed when invoice is not validated/paid."; + exit; + } +} +?> +

trans('Date')." ".dol_print_date($object->date, 'day').'
'; @@ -182,6 +200,8 @@ if (getDolGlobalString('TAKEPOS_RECEIPT_NAME')) { print getDolGlobalString('TAKEPOS_RECEIPT_NAME') . " "; } if ($object->status == Facture::STATUS_DRAFT) { + // Printing ticket is not allowed if invoice not yet validate. + // This may happen if a feature to validate invoice and print it before paying is implemented. print str_replace(")", "", str_replace("-", " ".$langs->trans('Place')." ", str_replace("(PROV-POS", $langs->trans("Terminal")." ", $object->ref))); } else { print $object->ref; @@ -197,7 +217,7 @@ if (getDolGlobalString('TAKEPOS_SHOW_CUSTOMER')) { print "
".$langs->trans("Customer").': '.$soc->name; } } -if (getDolGlobalString('TAKEPOS_SHOW_DATE_OF_PRINING')) { +if (!getDolGlobalString('TAKEPOS_HIDE_DATE_OF_PRINTING')) { print "
".$langs->trans("DateOfPrinting").': '.dol_print_date(dol_now(), 'dayhour', 'tzuserrel').'
'; } ?>