diff --git a/htdocs/admin/comptaexpert.php b/htdocs/admin/comptaexpert.php new file mode 100644 index 00000000000..78ab29da4cd --- /dev/null +++ b/htdocs/admin/comptaexpert.php @@ -0,0 +1,171 @@ + + * Copyright (C) 2004-2006 Laurent Destailleur + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/admin/comptaexpert.php + \ingroup comptaexpert + \brief Page de configuration du module comptabilité expert + \version $Revision$ +*/ + +require('./pre.inc.php'); + +$langs->load('admin'); +$langs->load('compta'); + +if (!$user->admin) + accessforbidden(); + + +llxHeader(); + + +$compta_mode = defined('COMPTA_MODE')?COMPTA_MODE:'RECETTES-DEPENSES'; + +if ($_POST['action'] == 'setcomptamode') +{ + $compta_mode = $_POST['compta_mode']; + if (! dolibarr_set_const($db, 'COMPTA_MODE', $compta_mode)) { print $db->error(); } +} + + +$form = new Form($db); +$typeconst=array('yesno','texte','chaine'); + + +if ($_POST['action'] == 'update' || $_POST['action'] == 'add') +{ + if (! dolibarr_set_const($db, $_POST['constname'], $_POST['constvalue'], $typeconst[$_POST['consttype']], 0, isset($_POST['constnote']) ? $_POST['constnote'] : '')); + { + print $db->error(); + } +} + + +if ($_GET['action'] == 'delete') +{ + if (! dolibarr_del_const($db, $_GET['constname'])); + { + print $db->error(); + } +} + +/* + * Affichage page + */ + +$html=new Form($db); +print_titre($langs->trans('ComptaSetup')); + + +print '
'; + +print ''; + +// Cas du paramètre COMPTA_MODE +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; +print ''; +print '\n"; +print ''; +print '\n"; +print ''; + +print "
'.$langs->trans('OptionMode').''.$langs->trans('Description').'
'.$langs->trans('OptionModeTrue').''.nl2br($langs->trans('OptionModeTrueDesc'))."
'.$langs->trans('OptionModeVirtual').''.$langs->trans('OptionModeVirtualDesc')."
\n"; + +print "
\n"; + +// Cas des autres paramètres COMPTA_* +/* +$sql ="SELECT rowid, name, value, type, note"; +$sql.=" FROM llx_const"; +$sql.=" WHERE name like 'COMPTA_%' and name not in ('COMPTA_MODE')"; +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $i = 0; + $var=true; + + if ($num) + { + print ''; + print ''; + print ''; + print "\n"; + } + + while ($i < $num) + { + $obj = $db->fetch_object($result); + $var=!$var; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print '\n"; + + print '\n"; + + print ''; + + $i++; + } + + if ($num) + { + print "
'.$langs->trans('OtherOptions').'
'.stripslashes(nl2br($obj->note))."'; + if ($obj->type == 'yesno') + { + $form->selectyesnonum('constvalue',$obj->value); + } + elseif ($obj->type == 'texte') + { + print '\n"; + } + else + { + print ''; + } + print ''; + print '   '; + print "
\n"; + } +} +*/ + + +$db->close(); + + +llxFooter('$Date$ - $Revision$'); + +?> diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index fb7f73ceebd..4644b344298 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -32,11 +32,16 @@ require("./pre.inc.php"); $user->getrights(); // On a besoin des permissions sur plusieurs modules -if (!$user->rights->compta->general->lire) - accessforbidden(); +// L'espace compta/tréso doit toujours etre actif car c'est un espace partagé +// par de nombreux modules (banque, facture, commande à facturer, etc...) indépendemment +// de l'utilisation de la compta ou non. C'est au sein de cet espace que chaque sous fonction +// est protégé par le droit qui va bien du module concerné. +//if (!$user->rights->compta->general->lire) +// accessforbidden(); $langs->load("compta"); $langs->load("bills"); +if ($conf->commande->enabled) $langs->load("orders"); // Sécurité accés client $socidp=''; @@ -259,7 +264,7 @@ print ''; /* * Commandes à facturer */ -if ($conf->commande->enabled && $user->rights->commande->lire) +if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->commande->lire) { $langs->load("orders"); @@ -430,8 +435,8 @@ if ($resql) /* * Factures a payer */ -if ($conf->facture->enabled) { - +if ($conf->facture->enabled && $user->rights->facture->lire) +{ if ($user->societe_id == 0) { $sql = "SELECT ff.rowid, ff.facnumber, ff.libelle, ff.total_ht, ff.total_ttc, s.nom, s.idp"; diff --git a/htdocs/compta/ventilation/liste.php b/htdocs/compta/ventilation/liste.php index 7eb13a0180b..b848955352c 100644 --- a/htdocs/compta/ventilation/liste.php +++ b/htdocs/compta/ventilation/liste.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Éric Seigne - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,15 +19,14 @@ * * $Id$ * $Source$ - * */ -/*! - \file htdocs/compta/ventilation/liste.php - \ingroup compta - \brief Page de ventilation des lignes de facture - \version $Revision$ +/** + \file htdocs/compta/ventilation/liste.php + \ingroup compta + \brief Page de ventilation des lignes de facture + \version $Revision$ */ require("./pre.inc.php"); @@ -38,9 +37,8 @@ $langs->load("bills"); if (!$user->rights->facture->lire) accessforbidden(); if (!$user->rights->compta->ventilation->creer) accessforbidden(); -/* - * Sécurité accés client - */ + +// Sécurité accés client if ($user->societe_id > 0) accessforbidden(); diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php index da8bb46cd1c..3f20c82aca8 100644 --- a/htdocs/includes/menus/barre_left/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php @@ -367,15 +367,20 @@ class MenuLeft { if ($leftmenu=="vat") $newmenu->add_submenu(DOL_URL_ROOT."/compta/tva/reglement.php",$langs->trans("Payments"),1,$user->rights->compta->charges->lire); } - if ($conf->compta->enabled || $conf->comptaexpert->enabled) + // Compta simple + if ($conf->compta->enabled) { - //$newmenu->add(DOL_URL_ROOT."/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Ventilations")); - //if ($leftmenu=="ventil") $newmenu->add_submenu(DOL_URL_ROOT."/compta/ventilation/liste.php",$langs->trans("A ventiler"),1); - //if ($leftmenu=="ventil") $newmenu->add_submenu(DOL_URL_ROOT."/compta/ventilation/lignes.php",$langs->trans("Ventilées"),1); - //if ($user->rights->compta->ventilation->param) { - // if ($leftmenu=="ventil") $newmenu->add_submenu(DOL_URL_ROOT."/compta/param/",$langs->trans("Param"),1); - //} + $newmenu->add(DOL_URL_ROOT."/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Ventilation"),0,$user->rights->compta->ventilation->lire); + if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/ventilation/liste.php",$langs->trans("A ventiler"),1,$user->rights->compta->ventilation->lire); + if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/ventilation/lignes.php",$langs->trans("Ventilées"),1,$user->rights->compta->ventilation->lire); + if ($leftmenu=="ventil") $newmenu->add(DOL_URL_ROOT."/compta/param/",$langs->trans("Setup"),1,$user->rights->compta->ventilation->parametrer); } + + // Compta expert + if ($conf->comptaexpert->enabled) + { + + } // Prélèvements if ($conf->prelevement->enabled) diff --git a/htdocs/includes/menus/barre_top/default.php b/htdocs/includes/menus/barre_top/default.php index f3df3c22d49..5f28d0d61c1 100644 --- a/htdocs/includes/menus/barre_top/default.php +++ b/htdocs/includes/menus/barre_top/default.php @@ -143,11 +143,11 @@ class MenuTop { } - // Entrée compta + // Entrée compta/tréso (sert pour banque, tva, entités à facturer...) if ($conf->compta->enabled || $conf->comptaexpert->enabled || $conf->banque->enabled || $conf->caisse->enabled) { - if ($user->rights->compta->general->lire || $user->rights->comptaexpert->general->lire) - { +// if ($user->rights->compta->general->lire || $user->rights->comptaexpert->general->lire) +// { $langs->load("compta"); $class=""; @@ -164,8 +164,8 @@ class MenuTop { $class = 'class="tmenu"'; } - print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("Accountancy")."/".$langs->trans("Treasury").''; - } + print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("MenuFinancial").''; +// } } // Entrée projets diff --git a/htdocs/includes/modules/modBanque.class.php b/htdocs/includes/modules/modBanque.class.php index 9d210178d6a..044ea3c8c82 100644 --- a/htdocs/includes/modules/modBanque.class.php +++ b/htdocs/includes/modules/modBanque.class.php @@ -64,8 +64,10 @@ class modBanque extends DolibarrModules // Dépendances $this->depends = array(); - $this->requiredby = array(); - + $this->requiredby = array("modComptabilite","modComptabiliteExpert"); + $this->conflictwith = array(); + $this->langfiles = array("banks"); + // Constantes $this->const = array(); diff --git a/htdocs/includes/modules/modComptabilite.class.php b/htdocs/includes/modules/modComptabilite.class.php index eebe23d7cc2..fa65a83ecae 100644 --- a/htdocs/includes/modules/modComptabilite.class.php +++ b/htdocs/includes/modules/modComptabilite.class.php @@ -67,9 +67,10 @@ class modComptabilite extends DolibarrModules $this->config_page_url = "compta.php"; // Dépendances - $this->depends = array(); - $this->requiredby = array("modFacture"); + $this->depends = array("modFacture","modBanque"); + $this->requiredby = array(); $this->conflictwith = array("modComptabiliteExpert"); + $this->langfiles = array("compta"); // Constantes $this->const = array(); @@ -131,12 +132,26 @@ class modComptabilite extends DolibarrModules $r++; $this->rights[$r][0] = 97; - $this->rights[$r][1] = 'Ventiler les lignes de facture'; + $this->rights[$r][1] = 'Lire les ventilations de factures'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 1; + $this->rights[$r][4] = 'ventilation'; + $this->rights[$r][5] = 'lire'; + + $r++; + $this->rights[$r][0] = 98; + $this->rights[$r][1] = 'Ventiler les lignes de factures'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'ventilation'; $this->rights[$r][5] = 'creer'; + /* + Ce n'est pas un module en particulier qui doit conditionner l'accès à un espace + partagé par plusieurs module. C'est au sein de l'espace compta/tréso que chaque zone + est protégée par le droit adéquat. + Sinon on bloque aussi utilisation du module banque, tva, des commandes à facturer, + ou d'un autre module de compta. $r++; $this->rights[$r][0] = 98; $this->rights[$r][1] = "Accès à l'espace compta/tréso"; @@ -144,6 +159,7 @@ class modComptabilite extends DolibarrModules $this->rights[$r][3] = 0; $this->rights[$r][4] = 'general'; $this->rights[$r][5] = 'lire'; + */ } diff --git a/htdocs/includes/modules/modComptabiliteExpert.class.php b/htdocs/includes/modules/modComptabiliteExpert.class.php index 178a822c37b..c16689a382c 100644 --- a/htdocs/includes/modules/modComptabiliteExpert.class.php +++ b/htdocs/includes/modules/modComptabiliteExpert.class.php @@ -69,10 +69,11 @@ class modComptabiliteExpert extends DolibarrModules $this->config_page_url = "comptaexpert.php"; // Dépendances - $this->depends = array(); - $this->requiredby = array("modFacture"); + $this->depends = array("modFacture","modBanque"); + $this->requiredby = array(); $this->conflictwith = array("modComptabilite"); - + $this->langfiles = array("compta"); + // Constantes $this->const = array(); diff --git a/htdocs/includes/modules/modFacture.class.php b/htdocs/includes/modules/modFacture.class.php index 876d3f92fc7..fdafdd6a753 100644 --- a/htdocs/includes/modules/modFacture.class.php +++ b/htdocs/includes/modules/modFacture.class.php @@ -69,9 +69,10 @@ class modFacture extends DolibarrModules $this->dirs = array(); // Dépendances - $this->depends = array("modSociete","modComptabilite"); - $this->requiredby = array(); - $this->langfiles = array("bills","companies"); + $this->depends = array("modSociete"); + $this->requiredby = array("modComptabilite","modComptabiliteExpert"); + $this->conflictwith = array(); + $this->langfiles = array("bills","companies"); // Config pages $this->config_page_url = "facture.php"; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index ee3196912c1..a8036090d7e 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -76,7 +76,7 @@ Module1Desc=Companies and contacts' management Module2Name=Commercial Module2Desc=Commercial management Module10Name=Accountancy -Module10Desc=Simple accountancy management +Module10Desc=Simple accountancy management (invoice and payment dispatching) Module20Name=Proposals Module20Desc=Commercial proposals' management Module22Name=Emailings @@ -120,7 +120,7 @@ Module85Desc=Management of bank or cash accounts Module86Name=OSCommerce Module86Desc=Add interface with OSCommerce Module130Name=Accountancy expert -Module130Desc=Accountancy management for experts +Module130Desc=Accountancy management for experts (double parties) Module200Name=LDAP Module200Desc=LDAP annuary synchronisation Module210Name=PostNuke @@ -181,7 +181,8 @@ Permission92=Create/modify charges and vat Permission93=Delete charges and vat Permission95=Read reports Permission96=Setup dispatching -Permission97=Dispatch invoice's lines +Permission97=Read invoice accountancy dispatching +Permission98=Dispatch invoice's accountancy lines Permission101=Read sendings Permission102=Create/modify sendings Permission104=Validate sendings diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index f7e77a846ad..ff3a22f1ed0 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -76,7 +76,7 @@ Module1Desc=Gestion des soci Module2Name=Commercial Module2Desc=Gestion commerciale Module10Name=Comptabilité -Module10Desc=Gestion simple de la comptabilité et trésorerie +Module10Desc=Gestion simple de la comptabilité (ventilation de factures et paiements) Module20Name=Propositions commerciales Module20Desc=Gestion des devis/propositions commerciales Module22Name=Mailings @@ -181,7 +181,8 @@ Permission92=Cr Permission93=Supprimer les charges et la TVA Permission95=Consulter CA, bilans et résultats Permission96=Paramétrer la ventilation -Permission97=Ventiler les lignes de factures +Permission97=Lire les lignes de factures +Permission98=Ventiler les lignes de factures Permission101=Consulter les expéditions Permission102=Créer/modifier les expéditions Permission104=Valider les expéditions diff --git a/htdocs/pre.inc.php b/htdocs/pre.inc.php index e1b920dd2f9..dd63140c76c 100644 --- a/htdocs/pre.inc.php +++ b/htdocs/pre.inc.php @@ -71,16 +71,20 @@ function llxHeader($head = "") { } } - if (($conf->compta->enabled || $conf->comptaexpert->enabled) && $user->rights->general->lire) - { +// L'espace compta/tréso doit toujours etre actif car c'est un espace partagé +// par de nombreux modules (banque, facture, commande à facturer, etc...) indépendemment +// de l'utilisation de la compta ou non. C'est au sein de cet espace que chaque sous fonction +// est protégé par le droit qui va bien du module concerné. +// if ($conf->compta->enabled || $conf->comptaexpert->enabled) +// { $langs->load("compta"); - $menu->add(DOL_URL_ROOT."/compta/index.php", $langs->trans("Accountancy")); + $menu->add(DOL_URL_ROOT."/compta/index.php", $langs->trans("MenuFinancial")); if ($user->rights->facture->lire) { $langs->load("bills"); $menu->add_submenu(DOL_URL_ROOT."/compta/facture.php", $langs->trans("Bills")); } - } +// } if ($conf->fichinter->enabled && $user->rights->ficheinter->lire) { diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql index 7ced6ac6e91..f62f3a5baee 100644 --- a/mysql/migration/2.0.0-2.1.0.sql +++ b/mysql/migration/2.0.0-2.1.0.sql @@ -233,4 +233,4 @@ insert into llx_c_pays (rowid,code,libelle) values (30, 'SG', 'Singapoure'); alter table llx_bank_account add column ref varchar(12) NOT NULL; -rename table llx_accountingsystem_det to llx_accountingaccount; \ No newline at end of file +rename table llx_accountingsystem_det to llx_accountingaccount;