From 2f557fc09b164fbdfb9616c1eb82ed70235ba6e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Fri, 30 Sep 2016 17:03:09 +0200 Subject: [PATCH] Several fix on module accountancy expert --- htdocs/accountancy/admin/account.php | 2 +- htdocs/accountancy/admin/card.php | 2 +- htdocs/accountancy/admin/fiscalyear.php | 24 +++++++++----- htdocs/accountancy/admin/fiscalyear_card.php | 33 ++++++++++++-------- htdocs/accountancy/admin/fiscalyear_info.php | 7 +++-- 5 files changed, 42 insertions(+), 26 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 2f7228eb9d4..63f99184884 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -19,7 +19,7 @@ /** * \file htdocs/accountancy/admin/account.php - * \ingroup Advanced accountancy + * \ingroup Advanced accountancy * \brief List accounting account */ require '../../main.inc.php'; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 057e2f0484c..6ce8bb5fad0 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -19,7 +19,7 @@ /** * \file htdocs/accountancy/admin/card.php - * \ingroup Advanced accountancy + * \ingroup Advanced accountancy * \brief Card of accounting account */ require '../../main.inc.php'; diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index f9fb603e483..5b767208987 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -16,12 +16,12 @@ */ /** - * \file htdocs/accountancy/admin/fiscalyear.php - * \ingroup fiscal year - * \brief Setup page to configure fiscal year + * \file htdocs/accountancy/admin/fiscalyear.php + * \ingroup Advanced accountancy + * \brief Setup page to configure fiscal year */ -require '../../main.inc.php'; +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php'; @@ -45,9 +45,9 @@ $langs->load("compta"); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->fiscalyear) - accessforbidden(); - +if (! $user->rights->mouvements->lire) // If we can read accounting records, we shoul be able to see fiscal year. + accessforbidden(); + $error = 0; // List of status @@ -65,6 +65,7 @@ $errors = array (); $object = new Fiscalyear($db); + /* * Actions */ @@ -146,7 +147,14 @@ dol_fiche_end(); // Buttons print '<div class="tabsAction">'; -print '<a class="butAction" href="fiscalyear_card.php?action=create">' . $langs->trans("NewFiscalYear") . '</a>'; +if (! empty($user->rights->accounting->fiscalyear)) +{ + print '<a class="butAction" href="fiscalyear_card.php?action=create">' . $langs->trans("NewFiscalYear") . '</a>'; +} +else +{ + print '<a class="butActionRefused" href="#">' . $langs->trans("NewFiscalYear") . '</a>'; +} print '</div>'; llxFooter(); diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index ec0f19d9d07..7c5c6d08c73 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -16,8 +16,9 @@ */ /** - * \file htdocs/accountancy/admin/fiscalyear_card.php - * \brief Page to show a fiscal year + * \file htdocs/accountancy/admin/fiscalyear_card.php + * \ingroup Advanced accountancy + * \brief Page to show a fiscal year */ require '../../main.inc.php'; @@ -30,7 +31,7 @@ $langs->load("compta"); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->fiscalyear) +if (empty($user->rights->accounting->fiscalyear)) accessforbidden(); $error = 0; @@ -138,9 +139,12 @@ else if ($action == 'update') { } } + + /* * View */ + $title = $langs->trans("Fiscalyear") . " - " . $langs->trans("Card"); $helpurl = ""; llxHeader("",$title,$helpurl); @@ -291,16 +295,19 @@ if ($action == 'create') dol_fiche_end(); - /* - * Barre d'actions - */ - print '<div class="tabsAction">'; - - print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&id=' . $id . '">' . $langs->trans('Modify') . '</a>'; - - print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>'; - - print '</div>'; + if (! empty($user->rights->accounting->fiscalyear)) + { + /* + * Barre d'actions + */ + print '<div class="tabsAction">'; + + print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&id=' . $id . '">' . $langs->trans('Modify') . '</a>'; + + print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>'; + + print '</div>'; + } } } else { dol_print_error($db); diff --git a/htdocs/accountancy/admin/fiscalyear_info.php b/htdocs/accountancy/admin/fiscalyear_info.php index 612e4d7f759..3596d73d751 100644 --- a/htdocs/accountancy/admin/fiscalyear_info.php +++ b/htdocs/accountancy/admin/fiscalyear_info.php @@ -16,11 +16,12 @@ */ /** - * \file htdocs/accountancy/admin/fiscalyear_card.php - * \brief Page to show info of a fiscal year + * \file htdocs/accountancy/admin/fiscalyear_info.php + * \ingroup Advanced accountancy + * \brief Page to show info of a fiscal year */ -require '../../main.inc.php'; +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php'; -- GitLab