diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index e3fd4da9dd147f7e86f5c21724ab7cdcb2b2038e..c42a8d7079bd4e5b77e9d6c182adc9e5cf46d9be 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 b2dfd751726aa32b04b1fb5dee79e89b0fb54d92..43dc38ea4bb491b1d84f694c26242d9833305dfd 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 '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; @@ -169,16 +166,19 @@ if ($action == 'create') { print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '"></center'; print '</form>'; -} else if ($id) { +} +else if ($id) +{ $rowid = $id; $account = $accounting->fetch($rowid); if ($account > 0) { dol_htmloutput_mesg($mesg); - $head = account_prepare_head($accounting); + $head = accounting_prepare_head($accounting); - if ($action == 'update') { + if ($action == 'update') + { // WYSIWYG Editor $htmlacc = new FormVentilation($db); @@ -224,7 +224,9 @@ if ($action == 'create') { print '</form>'; print '</div>'; - } else { + } + else + { $linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>'; dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); @@ -268,8 +270,8 @@ if ($action == 'create') { print '</div>'; /* - * Barre d'actions - */ + * Barre d'actions + */ print '<div class="tabsAction">'; @@ -287,7 +289,9 @@ if ($action == 'create') { print '</div>'; } - } else { + } + else + { dol_print_error($db); } } diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 2b042720b6038ee7f19e71439a3354e6c4f0d476..fd18473260cf5fdfb251a716eb29cbb0ed6d5f2f 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 83fb8820f08ddc48378f48c440db55f8b32b7b08..9abd2899af456b34d58919b929336faa3b0c27f1 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 '</td></tr>'; } +$var = ! $var; print "<tr " . $bc[$var] . ">"; print '<td width="80%">' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . '</td>'; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { @@ -277,6 +269,7 @@ if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { } print '</tr>'; +$var = ! $var; print "<tr " . $bc[$var] . ">"; print '<td width="80%">' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . '</td>'; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { diff --git a/htdocs/accountancy/admin/journaux.php b/htdocs/accountancy/admin/journaux.php index 139b8b37ae87a00ff78d321de68f573ec395c9f3..753ea60a5cebf28df7da0ec43f6697f183a4cd86 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 4c54e609caff6366094237865f15a982545df8b1..27d3affa56c2eeeb594abbdeaaa17abb4351e2fb 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 a38d78f584095dacdb2fb627285edbf88da8454f..51980293df4b18c65f9aed1c58c91bce9635d380 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); }