Fix: if module is not activated, functionality of module is deactivated!

This commit is contained in:
Regis Houssin 2017-10-10 07:37:39 +02:00
parent dce71d6e7d
commit 913a5d1df2

View File

@ -31,10 +31,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // TODO a lot of dependency on the bank module, but no test if this module is not activated!
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
}
if (! empty($conf->accounting->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
}
$langs->load("companies"); $langs->load("companies");
$langs->load("bills"); $langs->load("bills");
@ -859,10 +863,13 @@ if ($rowid > 0)
$accountstatic->number=$objp->number; $accountstatic->number=$objp->number;
$accountstatic->account_number=$objp->account_number; $accountstatic->account_number=$objp->account_number;
if (! empty($conf->accounting->enabled))
{
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->fk_accountancy_journal); $accountingjournal->fetch($objp->fk_accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1); $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
}
$accountstatic->ref=$objp->ref; $accountstatic->ref=$objp->ref;
print $accountstatic->getNomUrl(1); print $accountstatic->getNomUrl(1);