Merge pull request #21588 from altairisfr/termname

NEW : TAKEPOS - setup terminal name
This commit is contained in:
Laurent Destailleur 2022-08-03 18:34:16 +02:00 committed by GitHub
commit 514b216864
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 15 deletions

View File

@ -56,7 +56,7 @@ function takepos_admin_prepare_head()
$numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS);
for ($i = 1; $i <= $numterminals; $i++) { for ($i = 1; $i <= $numterminals; $i++) {
$head[$h][0] = DOL_URL_ROOT.'/takepos/admin/terminal.php?terminal='.$i; $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/terminal.php?terminal='.$i;
$head[$h][1] = $langs->trans("Terminal")." ".$i; $head[$h][1] = getDolGlobalString('TAKEPOS_TERMINAL_NAME_'.$i, $langs->trans("TerminalName", $i));
$head[$h][2] = 'terminal'.$i; $head[$h][2] = 'terminal'.$i;
$h++; $h++;
} }

View File

@ -59,7 +59,7 @@ BillsCoinsPad=Coins and banknotes Pad
DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr
TakeposNeedsCategories=TakePOS needs at least one product categorie to work 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 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 CashDeskBankAccountFor=Default account to use for payments in
NoPaimementModesDefined=No paiment mode defined in TakePOS configuration NoPaimementModesDefined=No paiment mode defined in TakePOS configuration
TicketVatGrouped=Group VAT by rate in tickets|receipts TicketVatGrouped=Group VAT by rate in tickets|receipts
@ -118,7 +118,7 @@ ScanToOrder=Scan QR code to order
Appearance=Appearance Appearance=Appearance
HideCategoryImages=Hide Category Images HideCategoryImages=Hide Category Images
HideProductImages=Hide Product 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 DefineTablePlan=Define tables plan
GiftReceiptButton=Add a "Gift receipt" button GiftReceiptButton=Add a "Gift receipt" button
GiftReceipt=Gift receipt 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> 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 AlreadyPrinted=Already printed
HideCategories=Hide categories HideCategories=Hide categories
HideStockOnLine=Hide stock on line HideStockOnLine=Hide stock on line
ShowOnlyProductInStock=Show the products in stock ShowOnlyProductInStock=Show the products in stock
ShowCategoryDescription=Show category description ShowCategoryDescription=Show category description
ShowProductReference=Show reference of products 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
TerminalNameDesc=Terminal name

View File

@ -70,6 +70,8 @@ $terminaltouse = $terminal;
if (GETPOST('action', 'alpha') == 'set') { if (GETPOST('action', 'alpha') == 'set') {
$db->begin(); $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_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); $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 '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("TerminalNameDesc").'</td>';
print '<td>';
print '<input type="text" name="terminalname'.$terminal.'" value="'.getDolGlobalString("TAKEPOS_TERMINAL_NAME_".$terminal, $langs->trans("TerminalName", $terminal)).'" >';
print '</td></tr>';
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("CashDeskThirdPartyForSell").'</td>'; print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<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); 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);

View File

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