diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 733524e53c0..bdb43dd41d3 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -33,7 +33,7 @@ class Subscription extends CommonObject public $element='subscription'; public $table_element='subscription'; public $picto='payment'; - + var $datec; // Date creation var $datem; // Date modification var $dateh; // Subscription start date (date subscription) @@ -193,12 +193,11 @@ class Subscription extends CommonObject */ function delete($user) { - $accountline=new AccountLine($this->db); - // It subscription is linked to a bank transaction, we get it if ($this->fk_bank > 0) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + $accountline=new AccountLine($this->db); $result=$accountline->fetch($this->fk_bank); } @@ -288,7 +287,7 @@ class Subscription extends CommonObject { return ''; } - + /** * Renvoi le libelle d'un statut donne * @@ -301,7 +300,7 @@ class Subscription extends CommonObject $langs->load("members"); return ''; } - + /** * Load information of the subscription object * diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 9bb4565d6c9..36f8968587a 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -1,8 +1,8 @@ +/* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012-2017 Regis Houssin * Copyright (C) 2015-2016 Alexandre Spangaro * * 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_type.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 . '/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("bills"); @@ -819,7 +819,6 @@ if ($rowid > 0) if ($result) { $subscriptionstatic=new Subscription($db); - $accountstatic=new Account($db); $num = $db->num_rows($result); $i = 0; @@ -838,6 +837,8 @@ if ($rowid > 0) } print "\n"; + $accountstatic=new Account($db); + while ($i < $num) { $objp = $db->fetch_object($result); @@ -849,20 +850,23 @@ if ($rowid > 0) print ''.dol_print_date($db->jdate($objp->dateh),'day')."\n"; print ''.dol_print_date($db->jdate($objp->datef),'day')."\n"; print ''.price($objp->subscription).''; - if (! empty($conf->banque->enabled)) - { - print ''; - if ($objp->bid) - { - $accountstatic->label=$objp->label; - $accountstatic->id=$objp->baid; - $accountstatic->number=$objp->number; - $accountstatic->account_number=$objp->account_number; + if (! empty($conf->banque->enabled)) + { + print ''; + if ($objp->bid) + { + $accountstatic->label=$objp->label; + $accountstatic->id=$objp->baid; + $accountstatic->number=$objp->number; + $accountstatic->account_number=$objp->account_number; - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($objp->fk_accountancy_journal); + if (! empty($conf->accounting->enabled)) + { + $accountingjournal = new AccountingJournal($db); + $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; print $accountstatic->getNomUrl(1); @@ -1093,12 +1097,12 @@ if ($rowid > 0) print ')'; } if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0); - if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) - { - $prodtmp=new Product($db); - $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); - print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product - } + if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) + { + $prodtmp=new Product($db); + $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); + print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product + } print '
'; } // Add invoice with payments @@ -1118,12 +1122,12 @@ if ($rowid > 0) print ')'; } if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0); - if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) - { - $prodtmp=new Product($db); - $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); - print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product - } + if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) + { + $prodtmp=new Product($db); + $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); + print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product + } print '
'; } print ''; diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 3faa45d7d84..3c368c05c9a 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -25,7 +25,9 @@ require '../../main.inc.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/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("bills"); @@ -231,20 +233,20 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') if (! empty($conf->banque->enabled)) { if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) - { - print ''.$langs->trans("BankTransactionLine").''; + { + print ''.$langs->trans("BankTransactionLine").''; if ($object->fk_bank) { - $bankline=new AccountLine($db); - $result=$bankline->fetch($object->fk_bank); + $bankline=new AccountLine($db); + $result=$bankline->fetch($object->fk_bank); print $bankline->getNomUrl(1,0,'showall'); } else { print $langs->trans("NoneF"); } - print ''; - } + print ''; + } } print ''; @@ -326,27 +328,26 @@ if ($rowid && $action != 'edit') // Amount print ''.$langs->trans("Label").''.$object->note.''; - // Bank line + // Bank line if (! empty($conf->banque->enabled)) { if ($conf->global->ADHERENT_BANK_USE || $object->fk_bank) - { - print ''.$langs->trans("BankTransactionLine").''; + { + print ''.$langs->trans("BankTransactionLine").''; if ($object->fk_bank) { - $bankline=new AccountLine($db); - $result=$bankline->fetch($object->fk_bank); - print $bankline->getNomUrl(1,0,'showall'); + $bankline=new AccountLine($db); + $result=$bankline->fetch($object->fk_bank); + print $bankline->getNomUrl(1,0,'showall'); } else { print $langs->trans("NoneF"); } - print ''; - } + print ''; + } } - print "\n"; print ''; diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 1fee5ac545c..e831a4449ab 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -304,22 +304,22 @@ if ($result) print dol_trunc($obj->note,32); print ''; - // Banque - if (! empty($conf->banque->enabled)) - { - if ($obj->fk_account) - { - $accountstatic->id=$obj->fk_account; - $accountstatic->fetch($obj->fk_account); - //$accountstatic->label=$obj->label; - print ''.$accountstatic->getNomUrl(1).''; - } - else - { - print ""; - print "\n"; - } - } + // Banque + if (! empty($conf->banque->enabled)) + { + if ($obj->fk_account > 0) + { + $accountstatic->id=$obj->fk_account; + $accountstatic->fetch($obj->fk_account); + //$accountstatic->label=$obj->label; + print ''.$accountstatic->getNomUrl(1).''; + } + else + { + print ""; + print "\n"; + } + } // Date start print ''.dol_print_date($db->jdate($obj->dateadh),'day')."\n";