Use isModEnabled

This commit is contained in:
Alexandre SPANGARO 2022-08-29 11:23:50 +02:00
parent 6fd2bbe46c
commit 4075397f7a

View File

@ -54,7 +54,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
if (!empty($conf->commande->enabled)) { if (!empty($conf->commande->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.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.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
} }
@ -63,7 +63,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
if (!empty($conf->variants->enabled)) { if (!empty($conf->variants->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
} }
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
} }
@ -2874,7 +2874,7 @@ $formmargin = new FormMargin($db);
$soc = new Societe($db); $soc = new Societe($db);
$paymentstatic = new Paiement($db); $paymentstatic = new Paiement($db);
$bankaccountstatic = new Account($db); $bankaccountstatic = new Account($db);
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
} }
@ -3650,7 +3650,7 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account
if (!empty($conf->banque->enabled)) { if (isModEnabled('banque')) {
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
print img_picto('', 'bank_account', 'class="pictofixedwidth"'); print img_picto('', 'bank_account', 'class="pictofixedwidth"');
print $form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); print $form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
@ -3658,7 +3658,7 @@ if ($action == 'create') {
} }
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load('projects'); $langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
@ -4284,7 +4284,7 @@ if ($action == 'create') {
$morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)'; $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
} }
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($usercancreate) { if ($usercancreate) {
@ -4550,7 +4550,7 @@ if ($action == 'create') {
} }
// Bank Account // Bank Account
if (!empty($conf->banque->enabled)) { if (isModEnabled('banque')) {
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">'; print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
print $langs->trans('BankAccount'); print $langs->trans('BankAccount');
@ -4803,10 +4803,10 @@ if ($action == 'create') {
$nbrows = 8; $nbrows = 8;
$nbcols = 3; $nbcols = 3;
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$nbrows++; $nbrows++;
} }
if (!empty($conf->banque->enabled)) { if (isModEnabled('banque')) {
$nbrows++; $nbrows++;
$nbcols++; $nbcols++;
} }
@ -4835,7 +4835,7 @@ if ($action == 'create') {
print '<td>'.$langs->trans('ListOfSituationInvoices').'</td>'; print '<td>'.$langs->trans('ListOfSituationInvoices').'</td>';
print '<td></td>'; print '<td></td>';
print '<td class="center">'.$langs->trans('Situation').'</td>'; print '<td class="center">'.$langs->trans('Situation').'</td>';
if (!empty($conf->banque->enabled)) { if (isModEnabled('banque')) {
print '<td class="right"></td>'; print '<td class="right"></td>';
} }
print '<td class="right">'.$langs->trans('AmountHT').'</td>'; print '<td class="right">'.$langs->trans('AmountHT').'</td>';
@ -4859,7 +4859,7 @@ if ($action == 'create') {
print '<td>'.$prev_invoice->getNomUrl(1).'</td>'; print '<td>'.$prev_invoice->getNomUrl(1).'</td>';
print '<td></td>'; print '<td></td>';
print '<td align="center" >'.(($prev_invoice->type == Facture::TYPE_CREDIT_NOTE) ? $langs->trans('situationInvoiceShortcode_AS') : $langs->trans('situationInvoiceShortcode_S')).$prev_invoice->situation_counter.'</td>'; print '<td align="center" >'.(($prev_invoice->type == Facture::TYPE_CREDIT_NOTE) ? $langs->trans('situationInvoiceShortcode_AS') : $langs->trans('situationInvoiceShortcode_S')).$prev_invoice->situation_counter.'</td>';
if (!empty($conf->banque->enabled)) { if (isModEnabled('banque')) {
print '<td class="right"></td>'; print '<td class="right"></td>';
} }
print '<td class="right"><span class="amount">'.price($prev_invoice->total_ht).'</span></td>'; print '<td class="right"><span class="amount">'.price($prev_invoice->total_ht).'</span></td>';
@ -4879,7 +4879,7 @@ if ($action == 'create') {
print '<td>'.$object->getNomUrl(1).'</td>'; print '<td>'.$object->getNomUrl(1).'</td>';
print '<td></td>'; print '<td></td>';
print '<td class="center">'.(($object->type == Facture::TYPE_CREDIT_NOTE) ? $langs->trans('situationInvoiceShortcode_AS') : $langs->trans('situationInvoiceShortcode_S')).$object->situation_counter.'</td>'; print '<td class="center">'.(($object->type == Facture::TYPE_CREDIT_NOTE) ? $langs->trans('situationInvoiceShortcode_AS') : $langs->trans('situationInvoiceShortcode_S')).$object->situation_counter.'</td>';
if (!empty($conf->banque->enabled)) { if (isModEnabled('banque')) {
print '<td class="right"></td>'; print '<td class="right"></td>';
} }
print '<td class="right"><span class="amount">'.price($object->total_ht).'</span></td>'; print '<td class="right"><span class="amount">'.price($object->total_ht).'</span></td>';
@ -4902,7 +4902,7 @@ if ($action == 'create') {
$i++; $i++;
} }
print '</td>'; print '</td>';
if (!empty($conf->banque->enabled)) { if (isModEnabled('banque')) {
print '<td></td>'; print '<td></td>';
} }
print '<td class="right"><b>'.price($total_global_ht).'</b></td>'; print '<td class="right"><b>'.price($total_global_ht).'</b></td>';
@ -4934,7 +4934,7 @@ if ($action == 'create') {
print '<td>'.$next_invoice->getNomUrl(1).'</td>'; print '<td>'.$next_invoice->getNomUrl(1).'</td>';
print '<td></td>'; print '<td></td>';
print '<td class="center">'.(($next_invoice->type == Facture::TYPE_CREDIT_NOTE) ? $langs->trans('situationInvoiceShortcode_AS') : $langs->trans('situationInvoiceShortcode_S')).$next_invoice->situation_counter.'</td>'; print '<td class="center">'.(($next_invoice->type == Facture::TYPE_CREDIT_NOTE) ? $langs->trans('situationInvoiceShortcode_AS') : $langs->trans('situationInvoiceShortcode_S')).$next_invoice->situation_counter.'</td>';
if (!empty($conf->banque->enabled)) { if (isModEnabled('banque')) {
print '<td class="right"></td>'; print '<td class="right"></td>';
} }
print '<td class="right"><span class="amount">'.price($next_invoice->total_ht).'</span></td>'; print '<td class="right"><span class="amount">'.price($next_invoice->total_ht).'</span></td>';
@ -4948,7 +4948,7 @@ if ($action == 'create') {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td colspan="3" class="right"></td>'; print '<td colspan="3" class="right"></td>';
if (!empty($conf->banque->enabled)) { if (isModEnabled('banque')) {
print '<td class="right"></td>'; print '<td class="right"></td>';
} }
print '<td class="right"><b>'.price($total_global_ht).'</b></td>'; print '<td class="right"><b>'.price($total_global_ht).'</b></td>';
@ -4975,7 +4975,7 @@ if ($action == 'create') {
print '<td class="liste_titre">'.($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).'</td>'; print '<td class="liste_titre">'.($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).'</td>';
print '<td class="liste_titre"><span class="hideonsmartphone">'.$langs->trans('Date').'</span></td>'; print '<td class="liste_titre"><span class="hideonsmartphone">'.$langs->trans('Date').'</span></td>';
print '<td class="liste_titre"><span class="hideonsmartphone">'.$langs->trans('Type').'</span></td>'; print '<td class="liste_titre"><span class="hideonsmartphone">'.$langs->trans('Type').'</span></td>';
if (!empty($conf->banque->enabled)) { if (isModEnabled('banque')) {
print '<td class="liste_titre"><span class="hideonsmartphone">'.$langs->trans('BankAccount').'</span></td>'; print '<td class="liste_titre"><span class="hideonsmartphone">'.$langs->trans('BankAccount').'</span></td>';
} }
print '<td class="liste_titre right">'.$langs->trans('Amount').'</td>'; print '<td class="liste_titre right">'.$langs->trans('Amount').'</td>';
@ -5024,14 +5024,14 @@ if ($action == 'create') {
print '</td>'; print '</td>';
$label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label; $label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label;
print '<td>'.$label.' '.$objp->num_payment.'</td>'; print '<td>'.$label.' '.$objp->num_payment.'</td>';
if (!empty($conf->banque->enabled)) { if (isModEnabled('banque')) {
$bankaccountstatic->id = $objp->baid; $bankaccountstatic->id = $objp->baid;
$bankaccountstatic->ref = $objp->baref; $bankaccountstatic->ref = $objp->baref;
$bankaccountstatic->label = $objp->baref; $bankaccountstatic->label = $objp->baref;
$bankaccountstatic->number = $objp->banumber; $bankaccountstatic->number = $objp->banumber;
$bankaccountstatic->currency_code = $objp->bacurrency_code; $bankaccountstatic->currency_code = $objp->bacurrency_code;
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$bankaccountstatic->account_number = $objp->account_number; $bankaccountstatic->account_number = $objp->account_number;
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);