Modif pour meilleur indpendance systeme compta

This commit is contained in:
Laurent Destailleur 2006-05-20 10:10:41 +00:00
parent 1f5cdce88b
commit 07649a8594
13 changed files with 253 additions and 48 deletions

View File

@ -0,0 +1,171 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 '<br>';
print '<table class="noborder" width="100%">';
// Cas du paramètre COMPTA_MODE
print '<form action="compta.php" method="post">';
print '<input type="hidden" name="action" value="setcomptamode">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('OptionMode').'</td><td>'.$langs->trans('Description').'</td>';
print '<td><input class="button" type="submit" value="'.$langs->trans('Modify').'"></td>';
print "</tr>\n";
print '<tr '.$bc[false].'><td width="200"><input type="radio" name="compta_mode" value="RECETTES-DEPENSES"'.($compta_mode != 'CREANCES-DETTES' ? ' checked' : '').'> '.$langs->trans('OptionModeTrue').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionModeTrueDesc'))."</td></tr>\n";
print '<tr '.$bc[true].'><td width="200"><input type="radio" name="compta_mode" value="CREANCES-DETTES"'.($compta_mode == 'CREANCES-DETTES' ? ' checked' : '').'> '.$langs->trans('OptionModeVirtual').'</td>';
print '<td colspan="2">'.$langs->trans('OptionModeVirtualDesc')."</td></tr>\n";
print '</form>';
print "</table>\n";
print "<br>\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 '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans('OtherOptions').'</td>';
print "</tr>\n";
}
while ($i < $num)
{
$obj = $db->fetch_object($result);
$var=!$var;
print '<form action="compta.php" method="POST">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="hidden" name="constname" value="'.$obj->name.'">';
print '<tr '.$bc[$var].' class="value">';
print '<td>'.stripslashes(nl2br($obj->note))."</td>\n";
print '<td>';
if ($obj->type == 'yesno')
{
$form->selectyesnonum('constvalue',$obj->value);
}
elseif ($obj->type == 'texte')
{
print '<textarea name="constvalue" cols="35" rows="5" wrap="soft">';
print $obj->value;
print "</textarea>\n";
}
else
{
print '<input type="text" size="30" name="constvalue" value="'.stripslashes($obj->value).'">';
}
print '</td><td>';
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"> &nbsp; ';
print "</td></tr>\n";
print '</form>';
$i++;
}
if ($num)
{
print "</table>\n";
}
}
*/
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -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 '</td><td valign="top" width="70%" class="notopnoleftnoright">';
/*
* 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";

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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();

View File

@ -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)

View File

@ -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 '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/compta/index.php?mainmenu=accountancy"'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Accountancy")."/".$langs->trans("Treasury").'</a></td>';
}
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/compta/index.php?mainmenu=accountancy"'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("MenuFinancial").'</a></td>';
// }
}
// Entrée projets

View File

@ -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();

View File

@ -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';
*/
}

View File

@ -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();

View File

@ -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";

View File

@ -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

View File

@ -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

View File

@ -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)
{

View File

@ -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;
rename table llx_accountingsystem_det to llx_accountingaccount;