Fix: Si on modifie des droits, on les recharge de suite

This commit is contained in:
Laurent Destailleur 2006-11-26 19:19:46 +00:00
parent b3175036a8
commit db98eac2bf
7 changed files with 1695 additions and 1647 deletions

View File

@ -231,7 +231,17 @@ if ($mil->fetch($_REQUEST["id"]) >= 0)
print $modulename; print $modulename;
print "</td>"; print "</td>";
*/ */
print '<td align="center">'.($obj->getNbOfRecipients()).'</td>'; $nbofrecipient=$obj->getNbOfRecipients();
print '<td align="center">';
if ($nbofrecipient >= 0)
{
print $nbofrecipient;
}
else
{
print $langs->trans("Error").' '.img_error($obj->error);
}
print '</td>';
print '<td align="center">'; print '<td align="center">';
$filter=$obj->formFilter(); $filter=$obj->formFilter();

View File

@ -1,23 +1,23 @@
<?php <?php
/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id$
* $Source$ * $Source$
*/ */
/** /**
\file htdocs/includes/menus/barre_left/eldy_backoffice.php \file htdocs/includes/menus/barre_left/eldy_backoffice.php
@ -343,7 +343,7 @@ class MenuLeft {
{ {
$langs->load("orders"); $langs->load("orders");
if ($conf->facture->enabled) $newmenu->add(DOL_URL_ROOT."/compta/commande/liste.php?leftmenu=orders&status=3&afacturer=1", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire); if ($conf->facture->enabled) $newmenu->add(DOL_URL_ROOT."/compta/commande/liste.php?leftmenu=orders&status=3&afacturer=1", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire);
// if ($leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire); // if ($leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire);
} }
// Dons // Dons
@ -435,7 +435,7 @@ class MenuLeft {
if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/resultat/index.php?leftmenu=ca","Résultat / Exercice",1,$user->rights->compta->resultat->lire||$user->rights->comptaexpert->comptarapport->lire); if ($leftmenu=="ca") $newmenu->add(DOL_URL_ROOT."/compta/resultat/index.php?leftmenu=ca","Résultat / Exercice",1,$user->rights->compta->resultat->lire||$user->rights->comptaexpert->comptarapport->lire);
if ($leftmenu=="ca") $newmenu->add_submenu(DOL_URL_ROOT."/compta/resultat/clientfourn.php?leftmenu=ca",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->comptaexpert->comptarapport->lire); if ($leftmenu=="ca") $newmenu->add_submenu(DOL_URL_ROOT."/compta/resultat/clientfourn.php?leftmenu=ca",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->comptaexpert->comptarapport->lire);
/* On verra ca avec module compabilité /* On verra ca avec module compabilit
if ($leftmenu=="ca") $newmenu->add_submenu(DOL_URL_ROOT."/compta/resultat/compteres.php?leftmenu=ca","Compte de résultat",2,$user->rights->compta->resultat->lire); if ($leftmenu=="ca") $newmenu->add_submenu(DOL_URL_ROOT."/compta/resultat/compteres.php?leftmenu=ca","Compte de résultat",2,$user->rights->compta->resultat->lire);
if ($leftmenu=="ca") $newmenu->add_submenu(DOL_URL_ROOT."/compta/resultat/bilan.php?leftmenu=ca","Bilan",2,$user->rights->compta->resultat->lire); if ($leftmenu=="ca") $newmenu->add_submenu(DOL_URL_ROOT."/compta/resultat/bilan.php?leftmenu=ca","Bilan",2,$user->rights->compta->resultat->lire);
*/ */
@ -631,8 +631,12 @@ class MenuLeft {
$newmenu->add(DOL_URL_ROOT."/adherents/index.php?leftmenu=accountancy&mainmenu=members",$langs->trans("Subscriptions"),0,$user->rights->adherent->cotisation->lire); $newmenu->add(DOL_URL_ROOT."/adherents/index.php?leftmenu=accountancy&mainmenu=members",$langs->trans("Subscriptions"),0,$user->rights->adherent->cotisation->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=-1,1&amp;leftmenu=accountancy&mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer); $newmenu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=-1,1&amp;leftmenu=accountancy&mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/adherents/cotisations.php?leftmenu=accountancy",$langs->trans("List"),1,$user->rights->adherent->cotisation->lire); $newmenu->add_submenu(DOL_URL_ROOT."/adherents/cotisations.php?leftmenu=accountancy",$langs->trans("List"),1,$user->rights->adherent->cotisation->lire);
if ($conf->banque->enabled)
{
$langs->load("banks"); $langs->load("banks");
$newmenu->add_submenu(DOL_URL_ROOT."/compta/bank/index.php?leftmenu=accountancy",$langs->trans("Banks"),0,$user->rights->adherent->lire); $newmenu->add_submenu(DOL_URL_ROOT."/compta/bank/index.php?leftmenu=accountancy",$langs->trans("Banks"),0,$user->rights->adherent->lire);
}
$newmenu->add(DOL_URL_ROOT."/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Exports"),0,$user->rights->adherent->export); $newmenu->add(DOL_URL_ROOT."/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Exports"),0,$user->rights->adherent->export);
if ($conf->export->enabled && $leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); if ($conf->export->enabled && $leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export);
@ -743,6 +747,6 @@ class MenuLeft {
} }
} }
?> ?>

View File

@ -1,23 +1,23 @@
<?php <?php
/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id$
* $Source$ * $Source$
*/ */
/** /**
\file htdocs/includes/menus/barre_left/eldy_frontoffice.php \file htdocs/includes/menus/barre_left/eldy_frontoffice.php
@ -165,7 +165,7 @@ class MenuLeft {
$langs->load("companies"); $langs->load("companies");
// Prospects // Prospects
/* /*
$newmenu->add(DOL_URL_ROOT."/comm/prospect/index.php?leftmenu=prospects", $langs->trans("Prospects"), 0, $user->rights->societe->lire); $newmenu->add(DOL_URL_ROOT."/comm/prospect/index.php?leftmenu=prospects", $langs->trans("Prospects"), 0, $user->rights->societe->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/soc.php?leftmenu=prospects&action=create&amp;type=p", $langs->trans("MenuNewProspect"), 1, $user->rights->societe->creer); $newmenu->add_submenu(DOL_URL_ROOT."/soc.php?leftmenu=prospects&action=create&amp;type=p", $langs->trans("MenuNewProspect"), 1, $user->rights->societe->creer);
@ -178,29 +178,29 @@ class MenuLeft {
if ($leftmenu=="prospects") $newmenu->add_submenu(DOL_URL_ROOT."/comm/prospect/prospects.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); if ($leftmenu=="prospects") $newmenu->add_submenu(DOL_URL_ROOT."/comm/prospect/prospects.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/comm/contact.php?leftmenu=prospects&amp;type=p", $langs->trans("Contacts"), 1, $user->rights->societe->lire); $newmenu->add_submenu(DOL_URL_ROOT."/comm/contact.php?leftmenu=prospects&amp;type=p", $langs->trans("Contacts"), 1, $user->rights->societe->lire);
*/ */
// Clients // Clients
/* /*
$newmenu->add(DOL_URL_ROOT."/comm/index.php?leftmenu=customers", $langs->trans("Customers"), 0, $user->rights->societe->lire); $newmenu->add(DOL_URL_ROOT."/comm/index.php?leftmenu=customers", $langs->trans("Customers"), 0, $user->rights->societe->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/soc.php?leftmenu=customers&amp;action=create&amp;type=c", $langs->trans("MenuNewCustomer"), 1, $user->rights->societe->creer); $newmenu->add_submenu(DOL_URL_ROOT."/soc.php?leftmenu=customers&amp;action=create&amp;type=c", $langs->trans("MenuNewCustomer"), 1, $user->rights->societe->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/comm/clients.php?leftmenu=customers", $langs->trans("List"), 1, $user->rights->societe->lire); $newmenu->add_submenu(DOL_URL_ROOT."/comm/clients.php?leftmenu=customers", $langs->trans("List"), 1, $user->rights->societe->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/comm/contact.php?leftmenu=customers&amp;type=c", $langs->trans("Contacts"), 1, $user->rights->societe->lire); $newmenu->add_submenu(DOL_URL_ROOT."/comm/contact.php?leftmenu=customers&amp;type=c", $langs->trans("Contacts"), 1, $user->rights->societe->lire);
*/ */
// Contacts // Contacts
/* /*
$newmenu->add(DOL_URL_ROOT."/contact/index.php?leftmenu=contacts", $langs->trans("Contacts"), 0, $user->rights->societe->lire); $newmenu->add(DOL_URL_ROOT."/contact/index.php?leftmenu=contacts", $langs->trans("Contacts"), 0, $user->rights->societe->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/contact/fiche.php?leftmenu=contacts&amp;action=create", $langs->trans("NewContact"), 1, $user->rights->societe->creer); $newmenu->add_submenu(DOL_URL_ROOT."/contact/fiche.php?leftmenu=contacts&amp;action=create", $langs->trans("NewContact"), 1, $user->rights->societe->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/contact/index.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->lire); $newmenu->add_submenu(DOL_URL_ROOT."/contact/index.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->lire);
*/ */
// Actions // Actions
/* /*
$newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions", $langs->trans("Actions"), 0, $user->rights->societe->lire); $newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions", $langs->trans("Actions"), 0, $user->rights->societe->lire);
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=actions", $langs->trans("NewAction"), 1, $user->rights->societe->lire); if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=actions", $langs->trans("NewAction"), 1, $user->rights->societe->lire);
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&amp;status=todo", $langs->trans("MenuToDoActions"), 1, $user->rights->societe->lire); if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&amp;status=todo", $langs->trans("MenuToDoActions"), 1, $user->rights->societe->lire);
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&amp;time=today", $langs->trans("Today"), 1, $user->rights->societe->lire); if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&amp;time=today", $langs->trans("Today"), 1, $user->rights->societe->lire);
if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=actions", $langs->trans("Reportings"), 1, $user->rights->societe->lire); if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=actions", $langs->trans("Reportings"), 1, $user->rights->societe->lire);
*/ */
// Propal // Propal
if ($conf->propal->enabled) if ($conf->propal->enabled)
{ {
@ -353,14 +353,14 @@ class MenuLeft {
} }
// Commandes // Commandes
/* /*
if ($conf->commande->enabled ) if ($conf->commande->enabled )
{ {
$langs->load("orders"); $langs->load("orders");
if ($conf->facture->enabled) $newmenu->add(DOL_URL_ROOT."/compta/commande/liste.php?leftmenu=orders&status=3", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire); if ($conf->facture->enabled) $newmenu->add(DOL_URL_ROOT."/compta/commande/liste.php?leftmenu=orders&status=3", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire);
// if ($leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire); // if ($leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire);
} }
*/ */
// Dons // Dons
if ($conf->don->enabled) if ($conf->don->enabled)
@ -380,26 +380,26 @@ class MenuLeft {
} }
// Charges sociales // Charges sociales
/* /*
if ($conf->tax->enabled) if ($conf->tax->enabled)
{ {
$newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=charges&mainmenu=accountancy",$langs->trans("Charges"), 0, $user->rights->tax->charges->lire); $newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=charges&mainmenu=accountancy",$langs->trans("Charges"), 0, $user->rights->tax->charges->lire);
if ($leftmenu=="charges") $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/index.php",$langs->trans("SocialContributions"), 1, $user->rights->tax->charges->creer); if ($leftmenu=="charges") $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/index.php",$langs->trans("SocialContributions"), 1, $user->rights->tax->charges->creer);
} }
*/ */
// Charges tva // Charges tva
/* /*
if (($conf->compta->enabled || $conf->comptaexpert->enabled) && $conf->compta->tva && $user->societe_id == 0) if (($conf->compta->enabled || $conf->comptaexpert->enabled) && $conf->compta->tva && $user->societe_id == 0)
{ {
$newmenu->add(DOL_URL_ROOT."/compta/tva/index.php?leftmenu=vat&mainmenu=accountancy",$langs->trans("VAT"),0,$user->rights->tax->charges->lire); $newmenu->add(DOL_URL_ROOT."/compta/tva/index.php?leftmenu=vat&mainmenu=accountancy",$langs->trans("VAT"),0,$user->rights->tax->charges->lire);
if ($leftmenu=="vat") $newmenu->add_submenu(DOL_URL_ROOT."/compta/tva/fiche.php?action=create",$langs->trans("NewPayment"),1,$user->rights->tax->charges->creer); if ($leftmenu=="vat") $newmenu->add_submenu(DOL_URL_ROOT."/compta/tva/fiche.php?action=create",$langs->trans("NewPayment"),1,$user->rights->tax->charges->creer);
if ($leftmenu=="vat") $newmenu->add_submenu(DOL_URL_ROOT."/compta/tva/reglement.php",$langs->trans("Payments"),1,$user->rights->tax->charges->lire); if ($leftmenu=="vat") $newmenu->add_submenu(DOL_URL_ROOT."/compta/tva/reglement.php",$langs->trans("Payments"),1,$user->rights->tax->charges->lire);
} }
*/ */
// Compta simple // Compta simple
/* /*
if ($conf->compta->enabled) if ($conf->compta->enabled)
{ {
$newmenu->add(DOL_URL_ROOT."/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Ventilation"),0,$user->rights->compta->ventilation->lire); $newmenu->add(DOL_URL_ROOT."/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Ventilation"),0,$user->rights->compta->ventilation->lire);
@ -419,7 +419,7 @@ class MenuLeft {
} }
*/ */
// Prélèvements // Prélèvements
if ($conf->prelevement->enabled) if ($conf->prelevement->enabled)
{ {
@ -444,15 +444,15 @@ class MenuLeft {
} }
// Bank-Caisse // Bank-Caisse
/* /*
if ($conf->banque->enabled) if ($conf->banque->enabled)
{ {
$langs->load("banks"); $langs->load("banks");
$newmenu->add(DOL_URL_ROOT."/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("Bank"),0,$user->rights->banque->lire); $newmenu->add(DOL_URL_ROOT."/compta/bank/index.php?leftmenu=bank&mainmenu=bank",$langs->trans("Bank"),0,$user->rights->banque->lire);
} }
*/ */
// Rapports // Rapports
/* /*
if ($conf->compta->enabled || $conf->comptaexpert->enabled) if ($conf->compta->enabled || $conf->comptaexpert->enabled)
{ {
// Bilan, résultats // Bilan, résultats
@ -465,7 +465,7 @@ class MenuLeft {
if ($leftmenu=="ca") $newmenu->add_submenu(DOL_URL_ROOT."/compta/stats/casoc.php?leftmenu=ca",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->comptaexpert->comptarapport->lire); if ($leftmenu=="ca") $newmenu->add_submenu(DOL_URL_ROOT."/compta/stats/casoc.php?leftmenu=ca",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire||$user->rights->comptaexpert->comptarapport->lire);
if ($leftmenu=="ca") $newmenu->add_submenu(DOL_URL_ROOT."/compta/stats/cabyuser.php?leftmenu=ca",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire||$user->rights->comptaexpert->comptarapport->lire); if ($leftmenu=="ca") $newmenu->add_submenu(DOL_URL_ROOT."/compta/stats/cabyuser.php?leftmenu=ca",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire||$user->rights->comptaexpert->comptarapport->lire);
} }
*/ */
} }
@ -600,11 +600,11 @@ class MenuLeft {
{ {
$langs->load("admin"); $langs->load("admin");
$langs->load("mails"); $langs->load("mails");
/* /*
$newmenu->add(DOL_URL_ROOT."/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire); $newmenu->add(DOL_URL_ROOT."/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/comm/mailing/fiche.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer); $newmenu->add_submenu(DOL_URL_ROOT."/comm/mailing/fiche.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/comm/mailing/liste.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire); $newmenu->add_submenu(DOL_URL_ROOT."/comm/mailing/liste.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire);
*/ */
} }
if ($conf->bookmark->enabled) if ($conf->bookmark->enabled)
@ -617,9 +617,9 @@ class MenuLeft {
if ($conf->export->enabled) if ($conf->export->enabled)
{ {
// $langs->load("exports"); // $langs->load("exports");
// $newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Exports"),0,1); // $newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Exports"),0,1);
// $newmenu->add_submenu(DOL_URL_ROOT."/exports/export.php?leftmenu=export",$langs->trans("NewExport"),1,1); // $newmenu->add_submenu(DOL_URL_ROOT."/exports/export.php?leftmenu=export",$langs->trans("NewExport"),1,1);
} }
} }
@ -646,8 +646,12 @@ class MenuLeft {
$newmenu->add(DOL_URL_ROOT."/adherents/index.php?leftmenu=accountancy&mainmenu=members",$langs->trans("Subscriptions"),0,$user->rights->adherent->cotisation->lire); $newmenu->add(DOL_URL_ROOT."/adherents/index.php?leftmenu=accountancy&mainmenu=members",$langs->trans("Subscriptions"),0,$user->rights->adherent->cotisation->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=-1,1&amp;leftmenu=accountancy&mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer); $newmenu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=-1,1&amp;leftmenu=accountancy&mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/adherents/cotisations.php?leftmenu=accountancy",$langs->trans("List"),1,$user->rights->adherent->cotisation->lire); $newmenu->add_submenu(DOL_URL_ROOT."/adherents/cotisations.php?leftmenu=accountancy",$langs->trans("List"),1,$user->rights->adherent->cotisation->lire);
if ($conf->banque->enabled)
{
$langs->load("banks"); $langs->load("banks");
$newmenu->add_submenu(DOL_URL_ROOT."/compta/bank/index.php?leftmenu=accountancy",$langs->trans("Banks"),0,$user->rights->adherent->lire); $newmenu->add_submenu(DOL_URL_ROOT."/compta/bank/index.php?leftmenu=accountancy",$langs->trans("Banks"),0,$user->rights->adherent->lire);
}
$newmenu->add(DOL_URL_ROOT."/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Export"),0,$user->rights->adherent->export); $newmenu->add(DOL_URL_ROOT."/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Export"),0,$user->rights->adherent->export);
if ($conf->export->enabled && $leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); if ($conf->export->enabled && $leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export);
@ -739,6 +743,6 @@ class MenuLeft {
} }
} }
?> ?>

View File

@ -81,6 +81,7 @@ class MailingTargets
} }
else else
{ {
$this->error=$this->db->error();
return -1; return -1;
} }
} }

View File

@ -59,7 +59,7 @@ function ldap_prepare_head()
$h++; $h++;
} }
if ($conf->global->LDAP_CONTACT_ACTIVE) if ($conf->societe->enabled && $conf->global->LDAP_CONTACT_ACTIVE)
{ {
$head[$h][0] = DOL_URL_ROOT."/admin/ldap_contacts.php"; $head[$h][0] = DOL_URL_ROOT."/admin/ldap_contacts.php";
$head[$h][1] = $langs->trans("LDAPContactsSynchro"); $head[$h][1] = $langs->trans("LDAPContactsSynchro");
@ -67,7 +67,7 @@ function ldap_prepare_head()
$h++; $h++;
} }
if ($conf->global->LDAP_MEMBER_ACTIVE) if ($conf->adherent->enabled && $conf->global->LDAP_MEMBER_ACTIVE)
{ {
$head[$h][0] = DOL_URL_ROOT."/admin/ldap_members.php"; $head[$h][0] = DOL_URL_ROOT."/admin/ldap_members.php";
$head[$h][1] = $langs->trans("LDAPMembersSynchro"); $head[$h][1] = $langs->trans("LDAPMembersSynchro");

View File

@ -277,18 +277,20 @@ class User
if ($perms) $whereforadd.=" OR (module='$module' AND perms='lire' AND subperms IS NULL)"; if ($perms) $whereforadd.=" OR (module='$module' AND perms='lire' AND subperms IS NULL)";
} }
else { else {
// On a pas demandé un droit en particulier mais une liste de droits
// sur la base d'un nom de module de de perms
// Where pour la liste des droits à ajouter // Where pour la liste des droits à ajouter
if ($allmodule) $whereforadd="module='$allmodule'"; if ($allmodule) $whereforadd="module='$allmodule'";
if ($allperms) $whereforadd=" AND perms='$allperms'"; if ($allperms) $whereforadd=" AND perms='$allperms'";
} }
// Ajout des droits de la liste whereforadd // Ajout des droits trouvés grace au critere whereforadd
if ($whereforadd) if ($whereforadd)
{ {
//print "$module-$perms-$subperms"; //print "$module-$perms-$subperms";
$sql = "SELECT id"; $sql = "SELECT id";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def";
$sql.= " WHERE $whereforadd"; $sql.= " WHERE ".$whereforadd;
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
@ -369,12 +371,13 @@ class User
if ($perms=='lire') $wherefordel.=" OR (module='$module')"; if ($perms=='lire') $wherefordel.=" OR (module='$module')";
} }
else { else {
// On a demandé suppression d'un droit sur la base d'un nom de module ou perms
// Where pour la liste des droits à supprimer // Where pour la liste des droits à supprimer
if ($allmodule) $wherefordel="module='$allmodule'"; if ($allmodule) $wherefordel="module='$allmodule'";
if ($allperms) $wherefordel=" AND perms='$allperms'"; if ($allperms) $wherefordel=" AND perms='$allperms'";
} }
// Suppression des droits de la liste wherefordel // Suppression des droits selon critere defini dans wherefordel
if ($wherefordel) if ($wherefordel)
{ {
//print "$module-$perms-$subperms"; //print "$module-$perms-$subperms";
@ -416,6 +419,17 @@ class User
} }
/**
* \brief Vide la tableau des droits de l'utilisateur
*/
function clearrights()
{
$this->rights='';
$this->all_permissions_are_loaded=false;
}
/** /**
* \brief Charge dans l'objet user, la liste des permissions auxquelles l'utilisateur a droit * \brief Charge dans l'objet user, la liste des permissions auxquelles l'utilisateur a droit
* \param module nom du module dont il faut récupérer les droits ('' par defaut signifie tous les droits) * \param module nom du module dont il faut récupérer les droits ('' par defaut signifie tous les droits)
@ -435,6 +449,7 @@ class User
$sql .= " FROM ".MAIN_DB_PREFIX."user_rights as ur, ".MAIN_DB_PREFIX."rights_def as r"; $sql .= " FROM ".MAIN_DB_PREFIX."user_rights as ur, ".MAIN_DB_PREFIX."rights_def as r";
$sql .= " WHERE r.id = ur.fk_id AND ur.fk_user= ".$this->id." AND r.perms IS NOT NULL"; $sql .= " WHERE r.id = ur.fk_id AND ur.fk_user= ".$this->id." AND r.perms IS NOT NULL";
dolibarr_syslog('User.class::getrights this->id='.$this->id.' module='.$module);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {

View File

@ -33,11 +33,13 @@ require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php");
$langs->load("users"); $langs->load("users");
$form = new Form($db); $form = new Form($db);
$module=isset($_GET["module"])?$_GET["module"]:$_POST["module"]; $module=isset($_GET["module"])?$_GET["module"]:$_POST["module"];
if (! isset($_GET["id"])) access_forbidden();
// Defini si peux modifier utilisateurs et permisssions // Defini si peux modifier utilisateurs et permisssions
$caneditperms=($user->admin || $user->rights->user->user->creer); $caneditperms=($user->admin || $user->rights->user->user->creer);
@ -50,16 +52,31 @@ if ($_GET["action"] == 'addrights' && $caneditperms)
{ {
$edituser = new User($db,$_GET["id"]); $edituser = new User($db,$_GET["id"]);
$edituser->addrights($_GET["rights"],$module); $edituser->addrights($_GET["rights"],$module);
// Si on a touché à ces propres droits, on recharge
if ($_GET["id"] == $user->id)
{
$user->clearrights();
$user->getrights();
}
} }
if ($_GET["action"] == 'delrights' && $caneditperms) if ($_GET["action"] == 'delrights' && $caneditperms)
{ {
$edituser = new User($db,$_GET["id"]); $edituser = new User($db,$_GET["id"]);
$edituser->delrights($_GET["rights"],$module); $edituser->delrights($_GET["rights"],$module);
// Si on a touché à ces propres droits, on recharge
if ($_GET["id"] == $user->id)
{
$user->clearrights();
$user->getrights();
}
} }
llxHeader('',$langs->trans("Permissions")); llxHeader('',$langs->trans("Permissions"));
@ -69,28 +86,26 @@ llxHeader('',$langs->trans("Permissions"));
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($_GET["id"]) $fuser = new User($db, $_GET["id"]);
{ $fuser->fetch();
$fuser = new User($db, $_GET["id"]); $fuser->getrights();
$fuser->fetch();
$fuser->getrights();
/* /*
* Affichage onglets * Affichage onglets
*/ */
$head = user_prepare_head($fuser); $head = user_prepare_head($fuser);
dolibarr_fiche_head($head, 'rights', $langs->trans("User").": ".$fuser->fullname); dolibarr_fiche_head($head, 'rights', $langs->trans("User").": ".$fuser->fullname);
$db->begin(); $db->begin();
// Charge les modules soumis a permissions // Charge les modules soumis a permissions
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/"; $dir = DOL_DOCUMENT_ROOT . "/includes/modules/";
$handle=opendir($dir); $handle=opendir($dir);
$modules = array(); $modules = array();
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php') if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php')
{ {
$modName = substr($file, 0, strlen($file) - 10); $modName = substr($file, 0, strlen($file) - 10);
@ -108,21 +123,21 @@ if ($_GET["id"])
} }
} }
} }
} }
$db->commit(); $db->commit();
// Lecture des droits utilisateurs // Lecture des droits utilisateurs
$permsuser = array(); $permsuser = array();
$sql = "SELECT r.id, r.libelle, r.module"; $sql = "SELECT r.id, r.libelle, r.module";
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r,"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r,";
$sql .= " ".MAIN_DB_PREFIX."user_rights as ur"; $sql .= " ".MAIN_DB_PREFIX."user_rights as ur";
$sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id; $sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id;
$result=$db->query($sql); $result=$db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
@ -132,24 +147,24 @@ if ($_GET["id"])
$i++; $i++;
} }
$db->free($result); $db->free($result);
} }
else else
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
// Lecture des droits groupes // Lecture des droits groupes
$permsgroup = array(); $permsgroup = array();
$sql = "SELECT r.id, r.libelle, r.module"; $sql = "SELECT r.id, r.libelle, r.module";
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r,"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r,";
$sql .= " ".MAIN_DB_PREFIX."usergroup_rights as gr,"; $sql .= " ".MAIN_DB_PREFIX."usergroup_rights as gr,";
$sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu"; $sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu";
$sql .= " WHERE gr.fk_id = r.id AND gr.fk_usergroup = gu.fk_usergroup AND gu.fk_user = ".$fuser->id; $sql .= " WHERE gr.fk_id = r.id AND gr.fk_usergroup = gu.fk_usergroup AND gu.fk_user = ".$fuser->id;
$result=$db->query($sql); $result=$db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
@ -159,33 +174,33 @@ if ($_GET["id"])
$i++; $i++;
} }
$db->free($result); $db->free($result);
} }
else else
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
/* /*
* Ecran ajout/suppression permission * Ecran ajout/suppression permission
*/ */
print '<table width="100%" class="noborder">'; print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>'; print '<td>'.$langs->trans("Module").'</td>';
if ($caneditperms) print '<td width="24">&nbsp</td>'; if ($caneditperms) print '<td width="24">&nbsp</td>';
print '<td align="center" width="24">&nbsp;</td>'; print '<td align="center" width="24">&nbsp;</td>';
print '<td>'.$langs->trans("Permissions").'</td>'; print '<td>'.$langs->trans("Permissions").'</td>';
print '</tr>'; print '</tr>';
$sql ="SELECT r.id, r.libelle, r.module"; $sql ="SELECT r.id, r.libelle, r.module";
$sql.=" FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql.=" FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql.=" WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql.=" WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
$sql.=" ORDER BY r.module, r.id"; $sql.=" ORDER BY r.module, r.id";
$result=$db->query($sql); $result=$db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
$var = True; $var = True;
@ -279,9 +294,8 @@ if ($_GET["id"])
$i++; $i++;
} }
}
print '</table>';
} }
print '</table>';
$db->close(); $db->close();