From be830d31be52bd95e7fcf7b430775b7ccfb839d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Feb 2024 17:05:52 +0100 Subject: [PATCH] Debug v19 selection of ticket printer per terminal --- htdocs/admin/receiptprinter.php | 4 ++-- htdocs/takepos/admin/appearance.php | 2 -- htdocs/takepos/admin/bar.php | 3 --- htdocs/takepos/admin/setup.php | 4 ++-- htdocs/takepos/index.php | 6 ++++-- htdocs/takepos/invoice.php | 13 ++++++++----- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 85ef7aeb067..be4eae14f81 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -391,11 +391,11 @@ if ($mode == 'config' && $user->admin) { print img_picto($langs->trans("Delete"), 'delete', 'class="paddingright"'); print ''; // test icon - print ''; + print ''; print img_picto($langs->trans("TestPrinterDesc"), 'printer', 'class="paddingright paddingleft"').'TXT'; print ''; // test icon - print ''; + print ''; print img_picto($langs->trans("TestPrinterDesc2"), 'printer', 'class="paddingright paddingleft"').'IMG'; print ''; print ''; diff --git a/htdocs/takepos/admin/appearance.php b/htdocs/takepos/admin/appearance.php index 3f58d23146b..2871f0ecf1e 100644 --- a/htdocs/takepos/admin/appearance.php +++ b/htdocs/takepos/admin/appearance.php @@ -63,8 +63,6 @@ if (GETPOST('action', 'alpha') == 'set') { $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); } diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 0c8f41fb237..4c822640e6a 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -126,13 +126,11 @@ if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) { print ''.$langs->trans("Parameters").''.$langs->trans("Value").''; print "\n"; - //if (getDolGlobalString('TAKEPOS_PRINT_METHOD') != "browser") { // Why this ? print ''; print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; print ''; print ''; print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); - //print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); print ''; if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) { @@ -141,7 +139,6 @@ if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) { print ''; print ''; print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); - //print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); print ''; } /*else { diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index c9890212a9b..6d7ba9a06d4 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -281,7 +281,7 @@ if (isModEnabled("service")) { print ''; print $form->textwithpicto($langs->trans("RootCategoryForProductsToSell"), $langs->trans("RootCategoryForProductsToSellDesc")); print ''; -print img_object('', 'category', 'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID'), 'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0, 0, 'widthcentpercentminusx'); +print img_object('', 'category', 'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID'), 'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0, 0, 'maxwidth500 widthcentpercentminusx'); print ajax_combobox('TAKEPOS_ROOT_CATEGORY_ID'); print "\n"; @@ -361,7 +361,7 @@ if (is_array($formmail->lines_model)) { } //var_dump($arraydefaultmessage); //var_dump($arrayofmessagename); -print $form->selectarray('TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename, $conf->global->TAKEPOS_EMAIL_TEMPLATE_INVOICE, 'None', 1, 0, '', 0, 0, 0, '', '', 1); +print $form->selectarray('TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename, getDolGlobalString('TAKEPOS_EMAIL_TEMPLATE_INVOICE'), 'None', 1, 0, '', 0, 0, 0, '', 'maxwidth500 widthcentpercentminusx', 1); print "\n"; // Control cash box at opening pos diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index f1b049cf3d4..993b3595863 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -96,6 +96,8 @@ if ($conf->browser->layout == 'phone') { $MAXCATEG = (!getDolGlobalString('TAKEPOS_NB_MAXCATEG') ? $maxcategbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXCATEG); $MAXPRODUCT = (!getDolGlobalString('TAKEPOS_NB_MAXPRODUCT') ? $maxproductbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXPRODUCT); +$term = empty($_SESSION['takeposterminal']) ? 1: $_SESSION['takeposterminal']; + /* $constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]; $soc = new Societe($db); @@ -1324,7 +1326,7 @@ if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) { } else { $menus[$r++] = array('title'=>'
'.$langs->trans("Receipt").'
', 'action'=>'TakeposPrinting(placeid);'); } - } elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { + } elseif ((isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { $menus[$r++] = array('title'=>'
'.$langs->trans("Receipt").'
', 'action'=>'DolibarrTakeposPrinting(placeid);'); } else { $menus[$r++] = array('title'=>'
'.$langs->trans("Receipt").'
', 'action'=>'Print(placeid);'); @@ -1341,7 +1343,7 @@ if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) { if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { $menus[$r++] = array('title'=>'
'.$langs->trans("DOL_OPEN_DRAWER").'
', 'action'=>'OpenDrawer();'); } -if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { +if (getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0 || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { $menus[$r++] = array( 'title' => '
'.$langs->trans("DOL_OPEN_DRAWER").'
', 'action' => 'DolibarrOpenDrawer();', diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index fa260428341..2531a2d25cc 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -156,6 +156,8 @@ if (isModEnabled('multicurrency') && !empty($_SESSION["takeposcustomercurrency"] } } +$term = empty($_SESSION["takeposterminal"]) ? 1 : $_SESSION["takeposterminal"]; + /* * Actions @@ -925,7 +927,7 @@ if (empty($reshook)) { if ($action == "order" && $placeid != 0 && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter" || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { + if ((isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter" || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php'; $printer = new dolReceiptPrinter($db); } @@ -970,7 +972,7 @@ if (empty($reshook)) { $order_receipt_printer1 .= ''; } } - if ((getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter" || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") && $linestoprint > 0) { + if (((isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter" || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") && $linestoprint > 0) { $invoice->fetch($placeid); //Reload object before send to printer $printer->orderprinter = 1; echo "