From fd6838776f539b9c15d9965405ddf1e4d9fd118b Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 27 Jul 2022 11:09:02 +0200 Subject: [PATCH 1/4] NEW : TAKEPOS - setup terminal name --- htdocs/core/lib/takepos.lib.php | 2 +- htdocs/langs/en_US/cashdesk.lang | 12 +++++++----- htdocs/takepos/admin/terminal.php | 7 +++++++ htdocs/takepos/index.php | 13 ++++--------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index d983f0298ce..66ea16a6123 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -56,7 +56,7 @@ function takepos_admin_prepare_head() $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); for ($i = 1; $i <= $numterminals; $i++) { $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/terminal.php?terminal='.$i; - $head[$h][1] = $langs->trans("Terminal")." ".$i; + $head[$h][1] = (! empty($conf->global->{"TAKEPOS_TERMINAL_NAME_".$i}) ? $conf->global->{"TAKEPOS_TERMINAL_NAME_".$i} : $langs->trans("TerminalName", $i)); $head[$h][2] = 'terminal'.$i; $h++; } diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 07b91316771..a3e7ee1f55a 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -59,7 +59,7 @@ BillsCoinsPad=Coins and banknotes Pad DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr TakeposNeedsCategories=TakePOS needs at least one product categorie to work TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category %s to work -OrderNotes=Can add some notes to each ordered items +OrderNotes=Can add some notes to each ordered items CashDeskBankAccountFor=Default account to use for payments in NoPaimementModesDefined=No paiment mode defined in TakePOS configuration TicketVatGrouped=Group VAT by rate in tickets|receipts @@ -118,7 +118,7 @@ ScanToOrder=Scan QR code to order Appearance=Appearance HideCategoryImages=Hide Category Images HideProductImages=Hide Product Images -NumberOfLinesToShow=Number of lines of images to show +NumberOfLinesToShow=Number of lines of images to show DefineTablePlan=Define tables plan GiftReceiptButton=Add a "Gift receipt" button GiftReceipt=Gift receipt @@ -138,8 +138,10 @@ TakeposBarcodeRuleToInsertProduct=Barcode rule to insert product TakeposBarcodeRuleToInsertProductDesc=Rule to extract the product reference + a quantity from a scanned barcode.
If empty (default value), application will use the full barcode scanned to find the product.

If defined, syntax must be:
ref:NB+qu:NB+qd:NB+other:NB
where NB is the number of characters to use to extract data from the scanned barcode with: AlreadyPrinted=Already printed HideCategories=Hide categories -HideStockOnLine=Hide stock on line -ShowOnlyProductInStock=Show the products in stock +HideStockOnLine=Hide stock on line +ShowOnlyProductInStock=Show the products in stock ShowCategoryDescription=Show category description ShowProductReference=Show reference of products -UsePriceHT=Use price excl. taxes and not price incl. taxes \ No newline at end of file +UsePriceHT=Use price excl. taxes and not price incl. taxes +TerminalName=Terminal %s +TerminaNameDesc=Terminal name diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 64ce74b6022..29bc7fa5712 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -70,6 +70,8 @@ $terminaltouse = $terminal; if (GETPOST('action', 'alpha') == 'set') { $db->begin(); + $res = dolibarr_set_const($db, "TAKEPOS_TERMINAL_NAME_".$terminaltouse, (!empty(GETPOST('terminalname'.$terminaltouse, 'restricthtml')) ? GETPOST('terminalname'.$terminaltouse, 'restricthtml') : $langs->trans("TerminalName", $terminaltouse)), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY".$terminaltouse, (GETPOST('socid', 'int') > 0 ? GETPOST('socid', 'int') : ''), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); @@ -148,6 +150,11 @@ print ''; print ''.$langs->trans("Parameters").''.$langs->trans("Value").''; print "\n"; +print ''.$langs->trans("TerminalNameDesc").''; +print ''; +print 'global->{"TAKEPOS_TERMINAL_NAME_".$terminal} : $langs->trans("TerminalName", $terminal)).'" >'; +print ''; + print ''.$langs->trans("CashDeskThirdPartyForSell").''; print ''; print $form->select_company($conf->global->{'CASHDESK_ID_THIRDPARTY'.$terminaltouse}, 'socid', '(s.client IN (1, 3) AND s.status = 1)', 1, 0, 0, array(), 0); diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index ee6a6c85d80..8cbdd7adb13 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -955,14 +955,9 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { - trans("Terminal"); ?> + global->{"TAKEPOS_TERMINAL_NAME_".$_SESSION["takeposterminal"]}) ? $conf->global->{"TAKEPOS_TERMINAL_NAME_".$_SESSION["takeposterminal"]} : $langs->trans("TerminalName", $_SESSION["takeposterminal"])); ?> - - '.dol_print_date(dol_now(), "day").''; ?> @@ -1019,11 +1014,11 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {

trans("TerminalSelect"); ?>

From daa106113d892aac498d5efa130ebe8b93502042 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 27 Jul 2022 11:11:26 +0200 Subject: [PATCH 2/4] fix translation string --- htdocs/langs/en_US/cashdesk.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index a3e7ee1f55a..9cde66460d3 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -144,4 +144,4 @@ ShowCategoryDescription=Show category description ShowProductReference=Show reference of products UsePriceHT=Use price excl. taxes and not price incl. taxes TerminalName=Terminal %s -TerminaNameDesc=Terminal name +TerminalNameDesc=Terminal name From 0fe441bc2a9f7ecad8cad7d7403041f86a4b1439 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 28 Jul 2022 17:29:09 +0200 Subject: [PATCH 3/4] use getDolGlobal... --- htdocs/core/lib/takepos.lib.php | 2 +- htdocs/takepos/admin/terminal.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index 66ea16a6123..c2468c98169 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -56,7 +56,7 @@ function takepos_admin_prepare_head() $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); for ($i = 1; $i <= $numterminals; $i++) { $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/terminal.php?terminal='.$i; - $head[$h][1] = (! empty($conf->global->{"TAKEPOS_TERMINAL_NAME_".$i}) ? $conf->global->{"TAKEPOS_TERMINAL_NAME_".$i} : $langs->trans("TerminalName", $i)); + $head[$h][1] = getDolGlobalString('TAKEPOS_TERMINAL_NAME_'.$i, $langs->trans("TerminalName", $i)); $head[$h][2] = 'terminal'.$i; $h++; } diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 29bc7fa5712..0bfe4ebd080 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -152,7 +152,7 @@ print "\n"; print ''.$langs->trans("TerminalNameDesc").''; print ''; -print 'global->{"TAKEPOS_TERMINAL_NAME_".$terminal} : $langs->trans("TerminalName", $terminal)).'" >'; +print 'trans("TerminalName", $terminal)).'" >'; print ''; print ''.$langs->trans("CashDeskThirdPartyForSell").''; From 4b3fdcc9f60fb92e0f3f4722ec5408bf06203753 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 28 Jul 2022 17:36:58 +0200 Subject: [PATCH 4/4] use getDolGlobal... --- htdocs/takepos/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8cbdd7adb13..e9717e7c992 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -955,7 +955,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { - global->{"TAKEPOS_TERMINAL_NAME_".$_SESSION["takeposterminal"]}) ? $conf->global->{"TAKEPOS_TERMINAL_NAME_".$_SESSION["takeposterminal"]} : $langs->trans("TerminalName", $_SESSION["takeposterminal"])); ?> + trans("TerminalName", $_SESSION["takeposterminal"])); ?> - '.dol_print_date(dol_now(), "day").''; @@ -1014,11 +1014,11 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {

trans("TerminalSelect"); ?>