Browse Source

NEW : TAKEPOS - setup terminal name

Christophe Battarel 2 years ago
parent
commit
fd6838776f

+ 1 - 1
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++;
 	}

+ 7 - 5
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 <b>%s</b> 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.<br>If empty (default value), application will use the full barcode scanned to find the product.<br><br>If defined, syntax must be:<br><b>ref:NB+qu:NB+qd:NB+other:NB</b><br>where NB is the number of characters to use to extract data from the scanned barcode with: <ul><li><b>ref</b> : product reference</li><li><b>qu</b> : quantity to set when inserting item (units)<l/i><li><b>qd</b> : quantity to set when inserting item (decimals)</li><li><b>other</b> : others characters</li></ul>
 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
+UsePriceHT=Use price excl. taxes and not price incl. taxes
+TerminalName=Terminal %s
+TerminaNameDesc=Terminal name

+ 7 - 0
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 '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
 print "</tr>\n";
 
+print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("TerminalNameDesc").'</td>';
+print '<td>';
+print '<input type="text" name="terminalname'.$terminal.'" value="'.(! empty($conf->global->{"TAKEPOS_TERMINAL_NAME_".$terminal}) ? $conf->global->{"TAKEPOS_TERMINAL_NAME_".$terminal} : $langs->trans("TerminalName", $terminal)).'" >';
+print '</td></tr>';
+
 print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
 print '<td>';
 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);

+ 4 - 9
htdocs/takepos/index.php

@@ -955,14 +955,9 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
 				<a class="topnav-terminalhour" onclick="ModalBox('ModalTerminal');">
 				<span class="fa fa-cash-register"></span>
 				<span class="hideonsmartphone">
-				<?php echo $langs->trans("Terminal"); ?>
+				<?php echo (! empty($conf->global->{"TAKEPOS_TERMINAL_NAME_".$_SESSION["takeposterminal"]}) ? $conf->global->{"TAKEPOS_TERMINAL_NAME_".$_SESSION["takeposterminal"]} : $langs->trans("TerminalName", $_SESSION["takeposterminal"])); ?>
 				</span>
-				<?php echo " ";
-				if ($_SESSION["takeposterminal"] == "") {
-					echo "1";
-				} else {
-					echo $_SESSION["takeposterminal"];
-				}
+				<?php
 				echo '<span class="hideonsmartphone"> - '.dol_print_date(dol_now(), "day").'</span>';
 				?>
 				</a>
@@ -1019,11 +1014,11 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
 		<h3><?php print $langs->trans("TerminalSelect"); ?></h3>
 	</div>
 	<div class="modal-body">
-		<button type="button" class="block" onclick="location.href='index.php?setterminal=1'"><?php print $langs->trans("Terminal"); ?> 1</button>
+		<button type="button" class="block" onclick="location.href='index.php?setterminal=1'"><?php print (! empty($conf->global->TAKEPOS_TERMINAL_NAME_1) ? $conf->global->TAKEPOS_TERMINAL_NAME_1 : $langs->trans("TerminalName", 1)); ?></button>
 		<?php
 		$nbloop = getDolGlobalInt('TAKEPOS_NUM_TERMINALS');
 		for ($i = 2; $i <= $nbloop; $i++) {
-			print '<button type="button" class="block" onclick="location.href=\'index.php?setterminal='.$i.'\'">'.$langs->trans("Terminal").' '.$i.'</button>';
+			print '<button type="button" class="block" onclick="location.href=\'index.php?setterminal='.$i.'\'">'.(! empty($conf->global->{"TAKEPOS_TERMINAL_NAME_".$i}) ? $conf->global->{"TAKEPOS_TERMINAL_NAME_".$i} : $langs->trans("TerminalName", $i)).'</button>';
 		}
 		?>
 	</div>