diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php
index e3fd4da9dd1..c42a8d7079b 100644
--- a/htdocs/accountancy/admin/account.php
+++ b/htdocs/accountancy/admin/account.php
@@ -22,21 +22,12 @@
* \brief List accounting account
*/
-// Dolibarr environment
-$res = @include ("../main.inc.php");
-if (! $res && file_exists("../main.inc.php"))
- $res = @include ("../main.inc.php");
-if (! $res && file_exists("../../main.inc.php"))
- $res = @include ("../../main.inc.php");
-if (! $res && file_exists("../../../main.inc.php"))
- $res = @include ("../../../main.inc.php");
-if (! $res)
- die("Include of main fails");
+require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
-dol_include_once("/accountancy/class/accountingaccount.class.php");
-dol_include_once("/accountancy/class/html.formventilation.class.php");
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
// Langs
$langs->load("compta");
diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php
index b2dfd751726..43dc38ea4bb 100644
--- a/htdocs/accountancy/admin/card.php
+++ b/htdocs/accountancy/admin/card.php
@@ -22,20 +22,12 @@
* \ingroup Accounting Expert
* \brief Card accounting account
*/
-$res = @include ("../main.inc.php");
-if (! $res && file_exists("../main.inc.php"))
- $res = @include ("../main.inc.php");
-if (! $res && file_exists("../../main.inc.php"))
- $res = @include ("../../main.inc.php");
-if (! $res && file_exists("../../../main.inc.php"))
- $res = @include ("../../../main.inc.php");
-if (! $res)
- die("Include of main fails");
+require '../../main.inc.php';
- // Class
+// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
-dol_include_once("/accountancy/class/accountingaccount.class.php");
-dol_include_once("/accountancy/class/html.formventilation.class.php");
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
// Langs
$langs->load("bills");
@@ -53,7 +45,8 @@ if (!$user->admin)
$accounting = new AccountingAccount($db);
// Action
-if ($action == 'add') {
+if ($action == 'add')
+{
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
@@ -82,7 +75,9 @@ if ($action == 'add') {
}
}
Header("Location: account.php");
-} elseif ($action == 'edit') {
+}
+else if ($action == 'edit')
+{
if (! GETPOST('cancel', 'alpha')) {
$result = $accounting->fetch($id);
@@ -111,8 +106,9 @@ if ($action == 'add') {
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit();
}
-} else if ($action == 'delete') {
-
+}
+else if ($action == 'delete')
+{
$result = $accounting->fetch($id);
if (! empty($accounting->id)) {
@@ -137,7 +133,8 @@ llxheader('', $langs->trans('AccountAccounting'));
$form = new Form($db);
$htmlacc = new FormVentilation($db);
-if ($action == 'create') {
+if ($action == 'create')
+{
print_fiche_titre($langs->trans('NewAccount'));
print '
';
print '';
- } else {
+ }
+ else
+ {
$linkback = '' . $langs->trans("BackToChartofaccounts") . '';
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
@@ -268,8 +270,8 @@ if ($action == 'create') {
print '';
/*
- * Barre d'actions
- */
+ * Barre d'actions
+ */
print '';
@@ -287,7 +289,9 @@ if ($action == 'create') {
print '
';
}
- } else {
+ }
+ else
+ {
dol_print_error($db);
}
}
diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php
index 2b042720b60..fd18473260c 100644
--- a/htdocs/accountancy/admin/export.php
+++ b/htdocs/accountancy/admin/export.php
@@ -97,7 +97,7 @@ $form = new Form($db);
print_fiche_titre($langs->trans('ConfigAccountingExpert'));
-$head = admin_account_prepare_head(null);
+$head = admin_accounting_prepare_head(null);
dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron');
diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php
index 83fb8820f08..9abd2899af4 100644
--- a/htdocs/accountancy/admin/index.php
+++ b/htdocs/accountancy/admin/index.php
@@ -26,19 +26,10 @@
* \brief Setup page to configure accounting expert module
*/
-// Dolibarr environment
-$res = @include ("../main.inc.php");
-if (! $res && file_exists("../main.inc.php"))
- $res = @include ("../main.inc.php");
-if (! $res && file_exists("../../main.inc.php"))
- $res = @include ("../../main.inc.php");
-if (! $res && file_exists("../../../main.inc.php"))
- $res = @include ("../../../main.inc.php");
-if (! $res)
- die("Include of main fails");
+require '../../main.inc.php';
// Class
-dol_include_once("/core/lib/admin.lib.php");
+require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$langs->load("compta");
@@ -157,7 +148,7 @@ $form = new Form($db);
print_fiche_titre($langs->trans('ConfigAccountingExpert'));
-$head = admin_account_prepare_head($accounting);
+$head = admin_accounting_prepare_head($accounting);
dol_fiche_head($head, 'general', $langs->trans("Configuration"), 0, 'cron');
@@ -264,6 +255,7 @@ foreach ($list as $key)
print '';
}
+$var = ! $var;
print "";
print '| ' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . ' | ';
if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
@@ -277,6 +269,7 @@ if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
}
print '
';
+$var = ! $var;
print "";
print '| ' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . ' | ';
if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
diff --git a/htdocs/accountancy/admin/journaux.php b/htdocs/accountancy/admin/journaux.php
index 139b8b37ae8..753ea60a5ce 100644
--- a/htdocs/accountancy/admin/journaux.php
+++ b/htdocs/accountancy/admin/journaux.php
@@ -91,7 +91,7 @@ $form = new Form($db);
print_fiche_titre($langs->trans('ConfigAccountingExpert'));
-$head = admin_account_prepare_head(null);
+$head = admin_accounting_prepare_head(null);
dol_fiche_head($head, 'journal', $langs->trans("Configuration"), 0, 'cron');
diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php
index 4c54e609caf..27d3affa56c 100644
--- a/htdocs/accountancy/class/accountingaccount.class.php
+++ b/htdocs/accountancy/class/accountingaccount.class.php
@@ -43,11 +43,12 @@ class AccountingAccount
var $active;
/**
- * \brief Constructeur de la classe
- * \param DB handler acces base de donnees
- * \param id id compte (0 par defaut)
- */
- function __construct($db, $rowid = '') {
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ */
+ function __construct($db, $rowid = '')
+ {
$this->db = $db;
if ($rowid != '')
@@ -57,7 +58,8 @@ class AccountingAccount
/**
* \brief Load record in memory
*/
- function fetch($rowid = null, $account_number = null) {
+ function fetch($rowid = null, $account_number = null)
+ {
if ($rowid || $account_number) {
$sql = "SELECT * FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE ";
if ($rowid) {
@@ -96,7 +98,8 @@ class AccountingAccount
* \brief insert line in accountingaccount
* \param user utilisateur qui effectue l'insertion
*/
- function create($user, $notrigger = 0) {
+ function create($user, $notrigger = 0)
+ {
global $conf, $langs;
$error = 0;
@@ -195,7 +198,8 @@ class AccountingAccount
* @param User $user update
* @return int if KO, >0 if OK
*/
- function update($user) {
+ function update($user)
+ {
global $langs;
$this->db->begin();
@@ -230,7 +234,8 @@ class AccountingAccount
* @param User $user update
* @return int if KO, >0 if OK
*/
- function checkUsage() {
+ function checkUsage()
+ {
global $langs;
$sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet";
@@ -259,11 +264,12 @@ class AccountingAccount
/**
* Delete object in database
*
- * @param User $user that deletes
- * @param int $notrigger triggers after, 1=disable triggers
- * @return int <0 if KO, >0 if OK
- */
- function delete($user, $notrigger = 0) {
+ * @param User $user User object of making delete
+ * @param int $notrigger 1=Disable all triggers
+ * @return int
+ */
+ function delete($user, $notrigger = 0)
+ {
global $conf, $langs;
$error = 0;
@@ -281,7 +287,7 @@ class AccountingAccount
// // Call triggers
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
// $interface=new Interfaces($this->db);
- // $result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
+ // $result=$interface->run_triggers('ACCOUNTANCY_ACOUNT_DELETE',$this,$user,$langs,$conf);
// if ($result < 0) { $error++; $this->errors=$interface->errors; }
// // End call triggers
}
@@ -322,7 +328,8 @@ class AccountingAccount
* @param int $id of record
* @return void
*/
- function info($id) {
+ function info($id)
+ {
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as a';
$sql .= ' WHERE a.rowid = ' . $id;
@@ -359,7 +366,8 @@ class AccountingAccount
* @param User $user update
* @return int if KO, >0 if OK
*/
- function account_desactivate($id) {
+ function account_desactivate($id)
+ {
global $langs;
$result = $this->checkUsage();
@@ -393,7 +401,8 @@ class AccountingAccount
* @param User $user update
* @return int if KO, >0 if OK
*/
- function account_activate($id) {
+ function account_activate($id)
+ {
global $langs;
$this->db->begin();
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index a38d78f5840..51980293df4 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -501,7 +501,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto,1);
$newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"),1);
$newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1);
- $newmenu->add("/accountancy/admin/account.php?mainmenu=home", $langs->trans("Chartofaccounts"),1);
$newmenu->add("/admin/fiscalyear.php?mainmenu=home", $langs->trans("Fiscalyear"),1);
if (! in_array($langs->defaultlang,array('en_US','en_GB','en_NZ','en_AU','fr_FR','fr_BE','es_ES','ca_ES')))
{
@@ -515,6 +514,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
$newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
$newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("Dictionary"),1);
+ if (! empty($conf->accounting->enabled)) $newmenu->add("/accountancy/admin/account.php?mainmenu=home", $langs->trans("Chartofaccounts"),1);
$newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
}