Merge pull request #7611 from hregis/6.0_bug2

Fix: if module is not activated, functionality of module is deactivated!
This commit is contained in:
Laurent Destailleur 2017-10-11 11:42:57 +02:00 committed by GitHub
commit cfce9f7171
4 changed files with 71 additions and 67 deletions

View File

@ -193,12 +193,11 @@ class Subscription extends CommonObject
*/ */
function delete($user) function delete($user)
{ {
$accountline=new AccountLine($this->db);
// It subscription is linked to a bank transaction, we get it // It subscription is linked to a bank transaction, we get it
if ($this->fk_bank > 0) if ($this->fk_bank > 0)
{ {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline=new AccountLine($this->db);
$result=$accountline->fetch($this->fk_bank); $result=$accountline->fetch($this->fk_bank);
} }

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -31,10 +31,10 @@ 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';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
$langs->load("companies"); $langs->load("companies");
$langs->load("bills"); $langs->load("bills");
@ -819,7 +819,6 @@ if ($rowid > 0)
if ($result) if ($result)
{ {
$subscriptionstatic=new Subscription($db); $subscriptionstatic=new Subscription($db);
$accountstatic=new Account($db);
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
@ -838,6 +837,8 @@ if ($rowid > 0)
} }
print "</tr>\n"; print "</tr>\n";
$accountstatic=new Account($db);
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
@ -859,10 +860,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);

View File

@ -25,7 +25,9 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.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/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; if (! empty($conf->banque->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
}
$langs->load("companies"); $langs->load("companies");
$langs->load("bills"); $langs->load("bills");
@ -346,7 +348,6 @@ if ($rowid && $action != 'edit')
} }
} }
print "</table>\n"; print "</table>\n";
print '</div>'; print '</div>';

View File

@ -307,7 +307,7 @@ if ($result)
// Banque // Banque
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
if ($obj->fk_account) if ($obj->fk_account > 0)
{ {
$accountstatic->id=$obj->fk_account; $accountstatic->id=$obj->fk_account;
$accountstatic->fetch($obj->fk_account); $accountstatic->fetch($obj->fk_account);