Merge pull request #21909 from aspangaro/16p1
TakePos - Use isModEnabled
This commit is contained in:
commit
eca5fc6504
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* 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;
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/takepos/admin/setup.php
|
||||
* \file htdocs/takepos/admin/other.php
|
||||
* \ingroup takepos
|
||||
* \brief Setup page for TakePos module
|
||||
*/
|
||||
|
||||
@ -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 '<tr class="oddeven"><td>';
|
||||
print $langs->trans('DolibarrReceiptPrinter');
|
||||
print '<td>';
|
||||
print $langs->trans('ReceiptPrinterMethodDescription');
|
||||
if ($conf->receiptprinter->enabled) {
|
||||
if (isModEnabled('receiptprinter')) {
|
||||
if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") {
|
||||
print '<br>';
|
||||
print img_picto('', 'printer', 'class="paddingright"').'<a href="'.DOL_URL_ROOT.'/admin/receiptprinter.php">'.$langs->trans("Setup").'</a>';
|
||||
}
|
||||
}
|
||||
print '</td><td class="right">';
|
||||
if ($conf->receiptprinter->enabled) {
|
||||
if (isModEnabled('receiptprinter')) {
|
||||
if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
|
||||
@ -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 '<input type="number" name="TAKEPOS_NUM_TERMINALS" min="1" value="' . (emp
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Services
|
||||
if (!empty($conf->service->enabled)) {
|
||||
if (isModEnabled('service')) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("CashdeskShowServices");
|
||||
print '<td colspan="2">';
|
||||
@ -389,7 +389,7 @@ print ajax_constantonoff("TAKEPOS_SHOW_HT", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Barcode rule to insert product
|
||||
if (!empty($conf->barcode->enabled)) {
|
||||
if (isModEnabled('barcode')) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("TakeposBarcodeRuleToInsertProduct"), $langs->trans("TakeposBarcodeRuleToInsertProductDesc"));
|
||||
print '<td colspan="2">';
|
||||
|
||||
@ -150,7 +150,7 @@ print $form->select_company(getDolGlobalInt('CASHDESK_ID_THIRDPARTY'.$terminalto
|
||||
print '</td></tr>';
|
||||
|
||||
$atleastonefound = 0;
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
if (isModEnabled('banque')) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForSell").'</td>';
|
||||
print '<td>';
|
||||
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 '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value)
|
||||
print '<td>';
|
||||
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 '</td></tr>';
|
||||
|
||||
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 '<tr class="oddeven"><td>'.$langs->trans('CashDeskForceDecreaseStockLabel').'</td>';
|
||||
print '<td>';
|
||||
print '<span class="opacitymedium">'.$langs->trans('CashDeskForceDecreaseStockDesc').'</span>';
|
||||
@ -404,7 +404,7 @@ print '</td></tr>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
if ($atleastonefound == 0 && !empty($conf->banque->enabled)) {
|
||||
if ($atleastonefound == 0 && isModEnabled('banque')) {
|
||||
print info_admin($langs->trans("AtLeastOneDefaultBankAccountMandatory"), 0, 0, 'error');
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -967,7 +967,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
|
||||
?>
|
||||
</a>
|
||||
<?php
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (isModEnabled('multicurrency')) {
|
||||
print '<a class="valignmiddle tdoverflowmax100" id="multicurrency" onclick="ModalBox(\'ModalCurrency\');" title=""><span class="fas fa-coins paddingrightonly"></span>';
|
||||
print '<span class="hideonsmartphone">'.$langs->trans("Currency").'</span>';
|
||||
print '</a>';
|
||||
@ -981,7 +981,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
|
||||
<!-- More info about customer -->
|
||||
<div class="inline-block valignmiddle tdoverflowmax150onsmartphone" id="moreinfo"></div>
|
||||
<?php
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
?>
|
||||
<!-- More info about warehouse -->
|
||||
<div class="inline-block valignmiddle tdoverflowmax150onsmartphone" id="infowarehouse"></div>
|
||||
@ -1031,7 +1031,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
|
||||
</div>
|
||||
|
||||
<!-- Modal multicurrency box -->
|
||||
<?php if (!empty($conf->multicurrency->enabled)) { ?>
|
||||
<?php if (isModEnabled('multicurrency')) { ?>
|
||||
<div id="ModalCurrency" class="modal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -1137,7 +1137,7 @@ if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($paiementsModes) && !empty($conf->banque->enabled)) {
|
||||
if (empty($paiementsModes) && isModEnabled('banque')) {
|
||||
$langs->load('errors');
|
||||
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors');
|
||||
setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors');
|
||||
|
||||
@ -171,7 +171,7 @@ if ($invoice->socid > 0) {
|
||||
}
|
||||
|
||||
// Change the currency of invoice if it was modified
|
||||
if (!empty($conf->multicurrency->enabled) && !empty($_SESSION["takeposcustomercurrency"])) {
|
||||
if (isModEnabled('multicurrency') && !empty($_SESSION["takeposcustomercurrency"])) {
|
||||
if ($invoice->multicurrency_code != $_SESSION["takeposcustomercurrency"]) {
|
||||
$invoice->setMulticurrencyCode($_SESSION["takeposcustomercurrency"]);
|
||||
}
|
||||
@ -205,7 +205,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($bankaccount <= 0 && $pay != "delayed" && !empty($conf->banque->enabled)) {
|
||||
if ($bankaccount <= 0 && $pay != "delayed" && isModEnabled('banque')) {
|
||||
$errormsg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount"));
|
||||
$error++;
|
||||
}
|
||||
@ -261,14 +261,14 @@ if (empty($reshook)) {
|
||||
$error++;
|
||||
dol_syslog('Sale without lines');
|
||||
dol_htmloutput_errors($langs->trans("NoLinesToBill", "TakePos"), null, 1);
|
||||
} elseif (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") {
|
||||
} elseif (isModEnabled('stock') && $conf->global->$constantforkey != "1") {
|
||||
$savconst = $conf->global->STOCK_CALCULATE_ON_BILL;
|
||||
$conf->global->STOCK_CALCULATE_ON_BILL = 1;
|
||||
|
||||
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
|
||||
dol_syslog("Validate invoice with stock change into warehouse defined into constant ".$constantforkey." = ".$conf->global->$constantforkey);
|
||||
$batch_rule = 0;
|
||||
if (!empty($conf->productbatch->enabled) && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
|
||||
if (isModEnabled('productbatch') && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
|
||||
$batch_rule = Productbatch::BATCH_RULE_SELLBY_EATBY_DATES_FIRST;
|
||||
}
|
||||
@ -457,13 +457,13 @@ if (empty($reshook)) {
|
||||
$creditnote->update_price(1);
|
||||
|
||||
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
|
||||
if (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") {
|
||||
if (isModEnabled('stock') && $conf->global->$constantforkey != "1") {
|
||||
$savconst = $conf->global->STOCK_CALCULATE_ON_BILL;
|
||||
$conf->global->STOCK_CALCULATE_ON_BILL = 1;
|
||||
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
|
||||
dol_syslog("Validate invoice with stock change into warehouse defined into constant ".$constantforkey." = ".$conf->global->$constantforkey);
|
||||
$batch_rule = 0;
|
||||
if (!empty($conf->productbatch->enabled) && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
|
||||
if (isModEnabled('productbatch') && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
|
||||
$batch_rule = Productbatch::BATCH_RULE_SELLBY_EATBY_DATES_FIRST;
|
||||
}
|
||||
@ -1163,7 +1163,7 @@ $( document ).ready(function() {
|
||||
|
||||
$idwarehouse = 0;
|
||||
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
if (getDolGlobalString("$constantforkey") != "1") {
|
||||
$constantforkey = 'CASHDESK_ID_WAREHOUSE'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
|
||||
$idwarehouse = getDolGlobalString($constantforkey);
|
||||
@ -1199,7 +1199,7 @@ $( document ).ready(function() {
|
||||
|
||||
// Module Adherent
|
||||
$s = '';
|
||||
if (!empty($conf->adherent->enabled) && $invoice->socid > 0 && $invoice->socid != $conf->global->$constforcompanyid) {
|
||||
if (isModEnabled('adherent') && $invoice->socid > 0 && $invoice->socid != $conf->global->$constforcompanyid) {
|
||||
$s = '<span class="small">';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$langs->load("members");
|
||||
@ -1320,7 +1320,7 @@ if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) {
|
||||
// In phone version only show when it is invoice page
|
||||
if (empty($mobilepage) || $mobilepage == "invoice") {
|
||||
print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">' . price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency) . '</span>';
|
||||
if (!empty($conf->multicurrency->enabled) && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
//Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency
|
||||
include_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php';
|
||||
$multicurrency = new MultiCurrency($db);
|
||||
@ -1336,7 +1336,7 @@ if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) {
|
||||
// In phone version only show when it is invoice page
|
||||
if (empty($mobilepage) || $mobilepage == "invoice") {
|
||||
print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">'.price($invoice->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</span>';
|
||||
if (!empty($conf->multicurrency->enabled) && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
if (isModEnabled('multicurrency') && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
//Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency
|
||||
include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
|
||||
$multicurrency = new MultiCurrency($db);
|
||||
@ -1568,7 +1568,7 @@ if ($placeid > 0) {
|
||||
|
||||
$htmlforlines .= '<td class="right">'.vatrate($line->remise_percent, true).'</td>';
|
||||
$htmlforlines .= '<td class="right">';
|
||||
if (!empty($conf->stock->enabled) && !empty($user->rights->stock->mouvement->lire)) {
|
||||
if (isModEnabled('stock') && !empty($user->rights->stock->mouvement->lire)) {
|
||||
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
|
||||
if (!empty($conf->global->$constantforkey) && $line->fk_product > 0 && empty($conf->global->TAKEPOS_HIDE_STOCK_ON_LINE)) {
|
||||
$sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp";
|
||||
@ -1605,7 +1605,7 @@ if ($placeid > 0) {
|
||||
if (getDolGlobalString('TAKEPOS_SHOW_HT')) {
|
||||
$htmlforlines .= '<td class="right classfortooltip" title="'.$moreinfo.'">';
|
||||
$htmlforlines .= price($line->total_ht, 1, '', 1, -1, -1, $conf->currency);
|
||||
if (!empty($conf->multicurrency->enabled) && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
if (isModEnabled('multicurrency') && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
//Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency
|
||||
include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
|
||||
$multicurrency = new MultiCurrency($db);
|
||||
@ -1616,7 +1616,7 @@ if ($placeid > 0) {
|
||||
}
|
||||
$htmlforlines .= '<td class="right classfortooltip" title="'.$moreinfo.'">';
|
||||
$htmlforlines .= price($line->total_ttc, 1, '', 1, -1, -1, $conf->currency);
|
||||
if (!empty($conf->multicurrency->enabled) && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
if (isModEnabled('multicurrency') && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
//Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency
|
||||
include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
|
||||
$multicurrency = new MultiCurrency($db);
|
||||
|
||||
@ -111,7 +111,7 @@ if ($resql) {
|
||||
$arrayOfValidBankAccount[$conf->global->$accountname] = $conf->global->$accountname;
|
||||
$arrayOfValidPaymentModes[] = $obj;
|
||||
}
|
||||
if (empty($conf->banque->enabled)) {
|
||||
if (!isModEnabled('banque')) {
|
||||
if ($paycode == 'CASH' || $paycode == 'CB') $arrayOfValidPaymentModes[] = $obj;
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ if ($conf->global->TAKEPOS_SHOW_CUSTOMER) {
|
||||
} ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
if (!empty($conf->multicurrency->enabled) && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
//Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency
|
||||
include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
|
||||
$multicurrency = new MultiCurrency($db);
|
||||
@ -288,7 +288,7 @@ if ($conf->global->TAKEPOS_PRINT_PAYMENT_METHOD) {
|
||||
echo $langs->transnoentitiesnoconv("PaymentTypeShort".$row->code);
|
||||
echo '</td>';
|
||||
echo '<td class="right">';
|
||||
$amount_payment = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount;
|
||||
$amount_payment = (isModEnabled('multicurrency') && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount;
|
||||
if ($row->code == "LIQ") {
|
||||
$amount_payment = $amount_payment + $row->pos_change; // Show amount with excess received if is cash payment
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user