From add4528e6cf1aa143083e5b6d317de0402ca001e Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 28 Aug 2014 06:48:22 +0200 Subject: [PATCH] Update perms --- htdocs/accountancy/admin/account.php | 2 +- htdocs/accountancy/admin/card.php | 4 +- htdocs/accountancy/bookkeeping/card.php | 6 +-- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/journal/bankjournal.php | 2 +- htdocs/accountancy/journal/cashjournal.php | 2 +- htdocs/accountancy/journal/index.php | 2 +- .../accountancy/journal/purchasesjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- htdocs/core/modules/modAccounting.class.php | 53 +++++++++++++------ 12 files changed, 51 insertions(+), 30 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index d8a26ca1ec5..5aba91751e4 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -194,7 +194,7 @@ if ($result) { print ''; print ''; - if ($user->rights->accountingex->admin) { + if ($user->admin) { print ''; print img_edit(); print ' '; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 68cdaf704a4..b2dfd751726 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -273,13 +273,13 @@ if ($action == 'create') { print '
'; - if ($user->rights->accountingex->admin) { + if ($user->admin) { print '' . $langs->trans('Modify') . ''; } else { print '' . $langs->trans('Modify') . ''; } - if ($user->rights->accountingex->admin) { + if ($user->admin) { print '' . $langs->trans('Delete') . ''; } else { print '' . $langs->trans('Delete') . ''; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index f6a9f347dc0..ffb88af7658 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -44,7 +44,7 @@ $langs->load("accounting"); $id = GETPOST('id', 'int'); if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accountingex->access) +if (! $user->rights->accounting->access) accessforbidden(); $action = GETPOST('action'); @@ -320,7 +320,7 @@ if ($action == 'create') { print '' . $line->sens . ''; print ''; - if ($user->rights->accountingex->access) { + if ($user->rights->accounting->access) { print ''; } print ''; @@ -335,7 +335,7 @@ if ($action == 'create') { print '' . $line->sens . ''; print ''; - if ($user->rights->accoutingex->access) { + if ($user->rights->accouting->access) { print ''; print img_edit(); print ' '; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 8c3a590b4b5..798d70e85ff 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -52,7 +52,7 @@ $account_parent = GETPOST('account_parent'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accountancy->access) +if (! $user->rights->accounting->access) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 6444c8d5fbe..01a925cdeac 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -74,7 +74,7 @@ $action = GETPOST('action'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accountingex->access) +if (! $user->rights->accounting->access) accessforbidden(); /* diff --git a/htdocs/accountancy/journal/cashjournal.php b/htdocs/accountancy/journal/cashjournal.php index 0abd1c95cd3..72a9e79140e 100644 --- a/htdocs/accountancy/journal/cashjournal.php +++ b/htdocs/accountancy/journal/cashjournal.php @@ -71,7 +71,7 @@ $date_endyear = GETPOST('date_endyear'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accountingex->access) +if (! $user->rights->accounting->access) accessforbidden(); $action = GETPOST('action'); diff --git a/htdocs/accountancy/journal/index.php b/htdocs/accountancy/journal/index.php index 254c98a9fb8..74d85467212 100644 --- a/htdocs/accountancy/journal/index.php +++ b/htdocs/accountancy/journal/index.php @@ -45,7 +45,7 @@ $langs->load("accountancy"); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accountingex->access) +if (! $user->rights->accounting->access) accessforbidden(); llxHeader('', 'Journaux', ''); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 83f4fcbf88e..daf3b4d0532 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -64,7 +64,7 @@ $date_endyear = GETPOST('date_endyear'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accountingex->access) +if (! $user->rights->accounting->access) accessforbidden(); $action = GETPOST('action'); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index fc7b57509ac..40b4377e7af 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -65,7 +65,7 @@ $date_endyear = GETPOST('date_endyear'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accountingex->access) +if (! $user->rights->accounting->access) accessforbidden(); $action = GETPOST('action'); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 1273ff8660c..4283b088d15 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -53,7 +53,7 @@ $langs->load("accountancy"); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accountingex->access) +if (! $user->rights->accounting->access) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index de6914b1fdc..3f990eb0dfd 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -54,7 +54,7 @@ $mesCasesCochees = GETPOST('mesCasesCochees', 'array'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accountingex->access) +if (! $user->rights->accounting->access) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 49d137a014f..ae525ccaa75 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -54,7 +54,7 @@ class modAccounting extends DolibarrModules $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); $this->special = 0; - $this->picto = 'accountingex@accountingex'; + $this->picto = 'accounting'; // Defined if the directory /mymodule/inc/triggers/ contains triggers or not // $this->triggers = 1; @@ -65,7 +65,7 @@ class modAccounting extends DolibarrModules ); // Config pages - $this->config_page_url = array('index.php@accounting'); + $this->config_page_url = array('index.php@accountancy'); // Dependencies $this->depends = array ("modFacture","modBanque","modTax"); // List of modules id that must be enabled if this module is enabled @@ -77,10 +77,10 @@ class modAccounting extends DolibarrModules ); // Minimum version of PHP required by module $this->need_dolibarr_version = array ( 3, - 4 + 6 ); // Minimum version of Dolibarr required by module $this->langfiles = array ( - "accountingex@accountingex" + "accountancy" ); // Constants @@ -182,11 +182,7 @@ class modAccounting extends DolibarrModules $this->tabs = array(); // Css - $this->module_parts = array ( - 'css' => array ( - '/accountingex/css/accountingex.css.php' - ) - ); + $this->module_parts = array (); // Boxes $this->boxes = array (); @@ -197,12 +193,37 @@ class modAccounting extends DolibarrModules $this->rights = array (); // Permission array used by this module $r = 0; - $this->rights[$r][0] = 150001; // Permission id (must not be already used) - $this->rights[$r][1] = 'Acces_module'; // Permission label - $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'access'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $r ++; + $this->rights[$r][0] = 50401; + $this->rights[$r][1] = 'Access_accountancy'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'access'; + $this->rights[$r][5] = ''; + $r++; + + $this->rights[$r][0] = 50411; + $this->rights[$r][1] = 'Lire les mouvements comptables'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvements'; + $this->rights[$r][5] = 'lire'; + $r++; + + $this->rights[$r][0] = 50412; + $this->rights[$r][1] = 'Creer/modifier/annuler les mouvements comptables'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvements'; + $this->rights[$r][5] = 'creer'; + $r++; + + $this->rights[$r][0] = 50420; + $this->rights[$r][1] = 'Lire CA, bilans, resultats, journaux, grands livres'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'comptarapport'; + $this->rights[$r][5] = 'lire'; + $r++; // Main menu entries $this->menus = array (); @@ -218,7 +239,7 @@ class modAccounting extends DolibarrModules 'langs' => 'accountingex@accountingex', 'position' => 100, 'perms' => '$user->rights->accountingex->access', - 'enabled' => '$conf->accountingexpert->enabled', + 'enabled' => '$conf->accounting->enabled', 'target' => '', 'user' => 0 );