Use isModEnabled

This commit is contained in:
Alexandre SPANGARO 2022-08-29 11:22:04 +02:00
parent dcebffbd01
commit 20a4e52192

View File

@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
if (!empty($conf->project->enabled)) {
if (isModEnabled('project')) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
@ -52,7 +52,7 @@ $amount = price2num(GETPOST("amount", "alpha"));
$paymenttype = GETPOST("paymenttype", "aZ09");
$accountancy_code = GETPOST("accountancy_code", "alpha");
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
if (!empty($conf->accounting->enabled) && !empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
if (isModEnabled('accounting') && !empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
$subledger_account = GETPOST("subledger_account", "alpha") > 0 ? GETPOST("subledger_account", "alpha") : '';
} else {
$subledger_account = GETPOST("subledger_account", "alpha");
@ -139,7 +139,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$error++;
}
if (!empty($conf->banque->enabled) && !$object->accountid > 0) {
if (isModEnabled('banque') && !$object->accountid > 0) {
$langs->load('errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
$error++;
@ -149,7 +149,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
$error++;
}
if (!empty($conf->accounting->enabled) && !$object->accountancy_code) {
if (isModEnabled('accounting') && !$object->accountancy_code) {
$langs->load('errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
$error++;
@ -308,10 +308,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->banque->m
llxHeader("", $langs->trans("VariousPayment"));
$form = new Form($db);
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$formaccounting = new FormAccounting($db);
}
if (!empty($conf->project->enabled)) {
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
}
@ -409,7 +409,7 @@ if ($action == 'create') {
print '</td></tr>';
// Bank
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
print '<tr><td>';
print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).'</td><td>';
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
@ -424,7 +424,7 @@ if ($action == 'create') {
print '</tr>';
// Number
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
print '<tr><td><label for="num_payment">'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '</label></td>';
@ -444,7 +444,7 @@ if ($action == 'create') {
}
// Accountancy account
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
// TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("AccountAccounting").'</td>';
print '<td>';
@ -457,7 +457,7 @@ if ($action == 'create') {
}
// Subledger account
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
print '<tr><td>'.$langs->trans("SubledgerAccount").'</td>';
print '<td>';
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
@ -481,7 +481,7 @@ if ($action == 'create') {
print '</td></tr>';
// Project
if (!empty($conf->project->enabled)) {
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
// Associated project
@ -553,7 +553,7 @@ if ($id) {
$morehtmlref = '<div class="refidno">';
// Project
if (!empty($conf->project->enabled)) {
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= $langs->trans('Project').' ';
if ($user->rights->banque->modifier) {
@ -621,7 +621,7 @@ if ($id) {
print '<tr><td class="nowrap">';
print $langs->trans("AccountAccounting");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->accountancy_code, 1);
@ -638,7 +638,7 @@ if ($id) {
print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $user->rights->banque->modifier), 'string', '', 0);
print '</td></tr>';
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
if ($object->fk_account > 0) {
$bankline = new AccountLine($db);
$bankline->fetch($object->fk_bank);