diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index d983f0298ce..049c2308a22 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2009 Laurent Destailleur + * Copyright (C) 2022 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,7 +54,7 @@ function takepos_admin_prepare_head() $head[$h][2] = 'bar'; $h++; - $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); + $numterminals = max(1, getDolGlobalInt('TAKEPOS_NUM_TERMINALS', 1)); 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; diff --git a/htdocs/takepos/admin/other.php b/htdocs/takepos/admin/other.php index 64088473c69..6200fce8768 100644 --- a/htdocs/takepos/admin/other.php +++ b/htdocs/takepos/admin/other.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/takepos/admin/setup.php + * \file htdocs/takepos/admin/other.php * \ingroup takepos * \brief Setup page for TakePos module */ diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 47a23262b3b..7cc5da97f64 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -20,7 +20,7 @@ */ /** - * \file htdocs/takepos/admin/terminal.php + * \file htdocs/takepos/admin/receipt.php * \ingroup takepos * \brief Setup page for TakePos module */ @@ -67,7 +67,7 @@ if (GETPOST('action', 'alpha') == 'set') { } elseif (GETPOST('action', 'alpha') == 'setmethod') { dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity); // TakePOS connector require ReceiptPrinter module - if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && !$conf->receiptprinter->enabled) { + if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && !isModEnabled('receiptprinter')) { activateModule("modReceiptPrinter"); } } @@ -117,14 +117,14 @@ print ''; print $langs->trans('DolibarrReceiptPrinter'); print ''; print $langs->trans('ReceiptPrinterMethodDescription'); -if ($conf->receiptprinter->enabled) { +if (isModEnabled('receiptprinter')) { if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { print '
'; print img_picto('', 'printer', 'class="paddingright"').''.$langs->trans("Setup").''; } } print ''; -if ($conf->receiptprinter->enabled) { +if (isModEnabled('receiptprinter')) { if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index cfa4e281e06..df71ea4f358 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -83,7 +83,7 @@ if ($action == 'set') { $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_AFFILIATE", GETPOST('TAKEPOS_SUMUP_AFFILIATE', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_APPID", GETPOST('TAKEPOS_SUMUP_APPID', 'alpha'), 'chaine', 0, '', $conf->entity); } - if (!empty($conf->barcode->enabled)) { + if (isModEnabled('barcode')) { $res = dolibarr_set_const($db, 'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT', GETPOST('TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT', 'alpha'), 'chaine', 0, '', $conf->entity); } @@ -264,7 +264,7 @@ print '\n"; // Services -if (!empty($conf->service->enabled)) { +if (isModEnabled('service')) { print ''; print $langs->trans("CashdeskShowServices"); print ''; @@ -389,7 +389,7 @@ print ajax_constantonoff("TAKEPOS_SHOW_HT", array(), $conf->entity, 0, 0, 1, 0); print "\n"; // Barcode rule to insert product -if (!empty($conf->barcode->enabled)) { +if (isModEnabled('barcode')) { print ''; print $form->textwithpicto($langs->trans("TakeposBarcodeRuleToInsertProduct"), $langs->trans("TakeposBarcodeRuleToInsertProductDesc")); print ''; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 5a3bc212f05..122e8894095 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -150,7 +150,7 @@ print $form->select_company(getDolGlobalInt('CASHDESK_ID_THIRDPARTY'.$terminalto print ''; $atleastonefound = 0; -if (!empty($conf->banque->enabled)) { +if (isModEnabled('banque')) { print ''.$langs->trans("CashDeskBankAccountForSell").''; print ''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); @@ -203,10 +203,10 @@ if (!empty($conf->banque->enabled)) { } } -if (!empty($conf->stock->enabled)) { +if (isModEnabled('stock')) { print ''.$langs->trans("CashDeskDoNotDecreaseStock").''; // Force warehouse (this is not a default value) print ''; - if (empty($conf->productbatch->enabled) || getDolGlobalInt('CASHDESK_FORCE_DECREASE_STOCK')) { + if (!isModEnabled('productbatch') || getDolGlobalInt('CASHDESK_FORCE_DECREASE_STOCK')) { print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK'.$terminal, getDolGlobalInt('CASHDESK_NO_DECREASE_STOCK'.$terminal), 1); } else { if (getDolGlobalInt('CASHDESK_NO_DECREASE_STOCK'.$terminal)) { @@ -231,7 +231,7 @@ if (!empty($conf->stock->enabled)) { } print ''; - if (!empty($conf->productbatch->enabled) && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK) && !$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) { + if (isModEnabled('productbatch') && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK) && !$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) { print ''.$langs->trans('CashDeskForceDecreaseStockLabel').''; print ''; print ''.$langs->trans('CashDeskForceDecreaseStockDesc').''; @@ -404,7 +404,7 @@ print ''; print ''; print ''; -if ($atleastonefound == 0 && !empty($conf->banque->enabled)) { +if ($atleastonefound == 0 && isModEnabled('banque')) { print info_admin($langs->trans("AtLeastOneDefaultBankAccountMandatory"), 0, 0, 'error'); } diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 9f7483319b3..6f84fccb9c8 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -123,7 +123,7 @@ if ($action == 'getProducts') { } $barcode_rules = getDolGlobalString('TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT'); - if (!empty($conf->barcode->enabled) && !empty($barcode_rules)) { + if (isModEnabled('barcode') && !empty($barcode_rules)) { $barcode_rules_list = array(); // get barcode rules diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index ee6a6c85d80..16ac171b2ef 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -967,7 +967,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { ?> multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { print ''; print ''.$langs->trans("Currency").''; print ''; @@ -981,7 +981,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
stock->enabled)) { + if (isModEnabled('stock')) { ?>
@@ -1031,7 +1031,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { -multicurrency->enabled)) { ?> +