Browse Source

Several fix on module accountancy expert

Laurent Destailleur 8 years ago
parent
commit
2f557fc09b

+ 1 - 1
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';

+ 1 - 1
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';

+ 16 - 8
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();

+ 20 - 13
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);

+ 4 - 3
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';