Prepare code for LNE

This commit is contained in:
Laurent Destailleur
2025-10-20 00:45:59 +02:00
parent 2a155bff70
commit 0d2b4faee2
4 changed files with 38 additions and 11 deletions

View File

@@ -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

View File

@@ -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 '</td></tr>';
if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT') && getDolGlobalInt('TAKEPOS_ORDER_PRINTERS')) {
if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT') && getDolGlobalInt('TAKEPOS_ORDER_PRINTERS') && $orderprinterallowed) {
print '<tr class="oddeven"><td>'.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 1</td>';
print '<td>';
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 '<tr class="oddeven"><td>'.$langs->trans("MainTemplateToUse");
print ' <span class="opacitymedium">('.$langs->trans("MainTemplateToUseMore").')</span>';
print ' (<a href="'.DOL_URL_ROOT.'/admin/receiptprinter.php?mode=template">'.$langs->trans("SetupReceiptTemplate").'</a>)</td>';
if ($customprinttemplateallowed) {
print ' (<a href="'.DOL_URL_ROOT.'/admin/receiptprinter.php?mode=template">'.$langs->trans("SetupReceiptTemplate").'</a>)</td>';
}
print '<td>';
if (!$customprinterallowed) {
if (!$customprinttemplateallowed) {
print '<span class="opacitymedium">'.$langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name')).'</span>';
} 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 '</td></tr>';
if (getDolGlobalInt('TAKEPOS_ORDER_PRINTERS')) {
if (getDolGlobalInt('TAKEPOS_ORDER_PRINTERS') && $orderprinterallowed) {
print '<tr class="oddeven"><td>'.$langs->trans("OrderTemplateToUse").'</td>';
print '<td>';
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 '</td></tr>';
}
}

View File

@@ -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=<?php echo newToken();?>&place="+place, function() {
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
});
@@ -1411,7 +1411,7 @@ if (!getDolGlobalString('TAKEPOS_NO_SPLIT_SALE')) {
$menus[$r++] = array('title' => '<span class="fas fa-cut paddingrightonly"></span><div class="trunc">'.$langs->trans("SplitSale").'</div>', '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' => '<span class="fa fa-blender-phone paddingrightonly"></span><div class="trunc">'.$langs->trans("Order").'</span>', 'action' => 'TakeposPrintingOrder();');

View File

@@ -175,6 +175,24 @@ if (getDolGlobalString('TAKEPOS_HEADER') || getDolGlobalString($constFreeText))
}
?>
</p>
<?php
if ($object->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;
}
}
?>
<p class="right">
<?php
print $langs->trans('Date')." ".dol_print_date($object->date, 'day').'<br>';
@@ -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 "<br>".$langs->trans("Customer").': '.$soc->name;
}
}
if (getDolGlobalString('TAKEPOS_SHOW_DATE_OF_PRINING')) {
if (!getDolGlobalString('TAKEPOS_HIDE_DATE_OF_PRINTING')) {
print "<br>".$langs->trans("DateOfPrinting").': '.dol_print_date(dol_now(), 'dayhour', 'tzuserrel').'<br>';
}
?>