From f8b6625bcb2839ac86557ac4caa22323e42927bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Jan 2008 20:23:51 +0000 Subject: [PATCH] Fix: Corrections de quelques bugs --- htdocs/categories/categorie.php | 42 +++---- htdocs/comm/prospect/fiche.php | 104 +++++++++--------- htdocs/compta/facture.php | 4 +- htdocs/facture.class.php | 13 ++- htdocs/html.form.class.php | 2 + .../includes/modules/modFournisseur.class.php | 10 +- htdocs/includes/modules/modSociete.class.php | 12 +- htdocs/langs/en_US/admin.lang | 3 + htdocs/langs/fr_FR/admin.lang | 3 + htdocs/lib/functions.inc.php | 2 +- htdocs/societe.php | 48 ++++---- htdocs/user/perms.php | 6 +- 12 files changed, 136 insertions(+), 113 deletions(-) diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 2b369424e09..c75e08c2bbe 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -275,28 +275,26 @@ function formCategory($db,$object,$type,$typeid) } // Formulaire ajout dans une categorie - if ($user->rights->societe->creer) + print '
'; + print_fiche_titre($title); + print '
'; + print ''; + print ''; + print ''; + if ($user->rights->categorie->creer) { - print '
'; - print_fiche_titre($title); - print ''; - print ''; - print '
'; + print $langs->trans("ClassifyInCategory").' '; + print $html->select_all_categories($typeid).'
'; - print ''; - if ($user->rights->categorie->creer) - { - print ''; - } - print ''; - print '
'; - print $langs->trans("ClassifyInCategory").' '; - print $html->select_all_categories($typeid).' '; - print ''.$langs->trans("NewCat").''; - print '
'; - print '
'; - print '
'; + print ''; + print ''.$langs->trans("NewCat").''; + print ''; } + print ''; + print ''; + print ''; + print '
'; + $c = new Categorie($db); $cats = $c->containing($object->id,$type,$typeid); @@ -346,7 +344,11 @@ function formCategory($db,$object,$type,$typeid) } else { - print $langs->trans("CompanyHasNoCategory")."
"; + if ($typeid == 0) $title=$langs->trans("ProductHasNoCategory"); + if ($typeid == 1) $title=$langs->trans("CompanyHasNoCategory"); + if ($typeid == 2) $title=$langs->trans("CompanyHasNoCategory"); + print $title; + print "
"; } } diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index 9c0d7620f49..72799f95e39 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004-2007 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 @@ -15,16 +15,13 @@ * 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/comm/prospect/fiche.php \ingroup prospect \brief Page de la fiche prospect - \version $Revision$ + \version $Id$ */ require_once("./pre.inc.php"); @@ -146,61 +143,64 @@ if ($socid > 0) $tableaushown=0; - $propal_static=new Propal($db); - /* * Dernieres propales * */ - print ''; - $sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.fk_statut, p.price, p.ref, p.remise, "; - $sql.= " ".$db->pdate("p.datep")." as dp, ".$db->pdate("p.fin_validite")." as datelimite,"; - $sql.= " c.label as statut, c.id as statutid"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; - $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; - $sql.= " AND s.rowid = ".$societe->id; - $sql.= " ORDER BY p.datep DESC"; + if ($conf->propal->enabled) + { + $propal_static=new Propal($db); - $resql=$db->query($sql); - if ($resql) - { - $var=true; - $i = 0; - $num = $db->num_rows($resql); - if ($num > 0) - { - $tableaushown=1; - print ''; - print ''; - print ''; - } + print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')
'; + $sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.fk_statut, p.price, p.ref, p.remise, "; + $sql.= " ".$db->pdate("p.datep")." as dp, ".$db->pdate("p.fin_validite")." as datelimite,"; + $sql.= " c.label as statut, c.id as statutid"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; + $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; + $sql.= " AND s.rowid = ".$societe->id; + $sql.= " ORDER BY p.datep DESC"; - while ($i < $num && $i < $MAXLIST) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - $db->free(); - } - else - { - dolibarr_print_error($db); - } + $resql=$db->query($sql); + if ($resql) + { + $var=true; + $i = 0; + $num = $db->num_rows($resql); + if ($num > 0) + { + $tableaushown=1; + print ''; + print ''; + print ''; + } - print "
propalid\">"; - print img_object($langs->trans("ShowPropal"),"propal"); - print " $objp->ref\n"; - if ( ($objp->dp < time() - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1 ) - { - print " ".img_warning(); - } - print "".dolibarr_print_date($objp->dp,"day")."".price($objp->price)."".$propal_static->LibStatut($objp->fk_statut,5)."
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')
"; + while ($i < $num && $i < $MAXLIST) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ""; + print "propalid\">"; + print img_object($langs->trans("ShowPropal"),"propal"); + print " $objp->ref\n"; + if ( ($objp->dp < time() - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1 ) + { + print " ".img_warning(); + } + print "".dolibarr_print_date($objp->dp,"day")."\n"; + print "".price($objp->price)."\n"; + print "".$propal_static->LibStatut($objp->fk_statut,5)."\n"; + $i++; + } + $db->free(); + } + else + { + dolibarr_print_error($db); + } + print ""; + } + print ""; print "\n\n"; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 9489e4c1357..c3eb713dd68 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -19,15 +19,13 @@ * 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$ */ /** \file htdocs/compta/facture.php \ingroup facture \brief Page de création d'une facture - \version $Revision$ + \version $Id$ */ require('./pre.inc.php'); diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 139cb2b8989..1d101e6ddc7 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -2918,11 +2918,14 @@ class FactureLigne { global $langs; - // Nettoyage parametres + dolibarr_syslog("FactureLigne::Insert rang=".$this->rang, LOG_DEBUG); + + // Clean parameters + $this->desc=trim($this->desc); if (! $this->subprice) $this->subprice=0; if (! $this->price) $this->price=0; - dolibarr_syslog("FactureLigne::Insert rang=".$this->rang, LOG_DEBUG); + $this->db->begin(); $rangtouse=$this->rang; @@ -3060,7 +3063,11 @@ class FactureLigne */ function update() { - $this->db->begin(); + // Clean parameters + $this->desc=trim($this->desc); + + + $this->db->begin(); // Mise a jour ligne en base $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET"; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 72c139fdd1f..dd4f9f36af8 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -85,6 +85,8 @@ class Form // Sanitize tooltip $htmltext=ereg_replace("'","\'",$htmltext); $htmltext=ereg_replace("'","\'",$htmltext); + $htmltext=ereg_replace("\r","",$htmltext); + $htmltext=ereg_replace("\n","
",$htmltext); if ($conf->use_javascript_ajax && $tooltipon == 4) { diff --git a/htdocs/includes/modules/modFournisseur.class.php b/htdocs/includes/modules/modFournisseur.class.php index 9870c4570a3..e74088e8225 100644 --- a/htdocs/includes/modules/modFournisseur.class.php +++ b/htdocs/includes/modules/modFournisseur.class.php @@ -117,7 +117,7 @@ class modFournisseur extends DolibarrModules $r++; $this->rights[$r][0] = 1183; - $this->rights[$r][1] = 'Cr�er une commande fournisseur'; + $this->rights[$r][1] = 'Creer une commande fournisseur'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'commande'; @@ -149,7 +149,7 @@ class modFournisseur extends DolibarrModules $r++; $this->rights[$r][0] = 1187; - $this->rights[$r][1] = 'R�ceptionner les commandes fournisseur'; + $this->rights[$r][1] = 'Receptionner les commandes fournisseur'; $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'commande'; @@ -157,7 +157,7 @@ class modFournisseur extends DolibarrModules $r++; $this->rights[$r][0] = 1188; - $this->rights[$r][1] = 'Clot�rer les commandes fournisseur'; + $this->rights[$r][1] = 'Cloturer les commandes fournisseur'; $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'commande'; @@ -181,7 +181,7 @@ class modFournisseur extends DolibarrModules $r++; $this->rights[$r][0] = 1232; - $this->rights[$r][1] = 'Cr�er une facture fournisseur'; + $this->rights[$r][1] = 'Creer une facture fournisseur'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'facture'; @@ -205,7 +205,7 @@ class modFournisseur extends DolibarrModules $r++; $this->rights[$r][0] = 1236; - $this->rights[$r][1] = 'Exporter les factures fournisseurs, attributs et r�glements'; + $this->rights[$r][1] = 'Exporter les factures fournisseurs, attributs et reglements'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'facture'; diff --git a/htdocs/includes/modules/modSociete.class.php b/htdocs/includes/modules/modSociete.class.php index e9269ab231c..b083c8e7fc4 100644 --- a/htdocs/includes/modules/modSociete.class.php +++ b/htdocs/includes/modules/modSociete.class.php @@ -80,14 +80,14 @@ class modSociete extends DolibarrModules $this->const[$r][0] = "SOCIETE_FISCAL_MONTH_START"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "0"; - $this->const[$r][3] = "Mettre le num�ro du mois du d�but d\'ann�e fiscale, ex: 9 pour septembre"; + $this->const[$r][3] = "Mettre le numero du mois du debut d\'annee fiscale, ex: 9 pour septembre"; $this->const[$r][4] = 1; $r++; $this->const[$r][0] = "MAIN_SEARCHFORM_SOCIETE"; $this->const[$r][1] = "yesno"; $this->const[$r][2] = "1"; - $this->const[$r][3] = "Affichage formulaire de recherche des Soci�t�s dans la barre de gauche"; + $this->const[$r][3] = "Affichage formulaire de recherche des Societes dans la barre de gauche"; $this->const[$r][4] = 0; $r++; @@ -115,21 +115,21 @@ class modSociete extends DolibarrModules $r++; $this->rights[$r][0] = 122; // id de la permission - $this->rights[$r][1] = 'Cr�er modifier les societes'; // libelle de la permission + $this->rights[$r][1] = 'Creer modifier les societes'; // libelle de la permission $this->rights[$r][2] = 'w'; // type de la permission (d�pr�ci� � ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut $this->rights[$r][4] = 'creer'; $r++; $this->rights[$r][0] = 125; // id de la permission - $this->rights[$r][1] = 'Supprimer les soci�t�s'; // libelle de la permission + $this->rights[$r][1] = 'Supprimer les societes'; // libelle de la permission $this->rights[$r][2] = 'd'; // type de la permission (d�pr�ci� � ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut $this->rights[$r][4] = 'supprimer'; $r++; $this->rights[$r][0] = 126; // id de la permission - $this->rights[$r][1] = 'Exporter les soci�t�s'; // libelle de la permission + $this->rights[$r][1] = 'Exporter les societes'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (d�pr�ci� � ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut $this->rights[$r][4] = 'export'; @@ -144,7 +144,7 @@ class modSociete extends DolibarrModules $r++; $this->rights[$r][0] = 282; // id de la permission - $this->rights[$r][1] = 'Cr�er modifier les contacts'; // libelle de la permission + $this->rights[$r][1] = 'Creer modifier les contacts'; // libelle de la permission $this->rights[$r][2] = 'w'; // type de la permission (d�pr�ci� � ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par d�faut $this->rights[$r][4] = 'contact'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 583959c0ec4..aca7df54f92 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -9,6 +9,7 @@ HTMLCharset=Charset for HTML pages DBStoringCharset=Database charset to store data DBSortingCharset=Database charset to sort data WarningModuleNotActive=Module %s must be enabled +WarningOnlyPermissionOfActivatedModules=Only permissions related to activated modules are shown here. You can activate other modules on Setup - Module page. DolibarrSetup=Dolibarr setup DolibarrUser=Dolibarr user InternalUser=Internal user @@ -305,6 +306,7 @@ Permission116=Transfers between acounts Permission121=Read companies Permission122=Create/modify companies Permission125=Delete companies +Permission126=Export companies Permission151=Read standing orders Permission152=Setup standing orders Permission153=Read standing orders receipts @@ -346,6 +348,7 @@ Permission262=Read all companies (Internal users only. Externals are always limi Permission281=Read contacts Permission282=Create/modify contacts Permission283=Delete contacts +Permission286=Export contacts Permission300=Read bar codes Permission301=Create/modify bar codes Permission302=Delete bar codes diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 921f99f61f4..d16840c0744 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -9,6 +9,7 @@ HTMLCharset=Charset des pages HTML DBStoringCharset=Charset base pour stockage données DBSortingCharset=Charset base pour tri données WarningModuleNotActive=Module %s non actif +WarningOnlyPermissionOfActivatedModules=Attention, seuls les permissions en rapport avec les modules activés sont affichées ici. Vous pouvez activer les autres modules sur la page Configuration - Modules DolibarrSetup=Installation de Dolibarr DolibarrUser=Utilisateur Dolibarr InternalUser=Utilisateur interne @@ -304,6 +305,7 @@ Permission116=Saisir virements entre comptes Permission121=Consulter les sociétés Permission122=Créer/modifier les sociétés Permission125=Supprimer les sociétés +Permission126=Exporter les societes Permission151=Consulter les prélèvements Permission152=Configurer les prélèvements Permission153=Consulter les bons de prélèvements @@ -345,6 +347,7 @@ Permission262=Consulter toutes les soci Permission281=Consulter les contacts Permission282=Créer/modifier les contacts Permission283=Supprimer les contacts +Permission286=Exporter les contacts Permission300=Consulter les codes barres Permission301=Créer/modifier les codes barres Permission302=Supprimer les codes barres diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 56e8cfdcf75..994004f362e 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -1346,7 +1346,7 @@ function info_admin($texte,$infoonimgalt=0) \brief Vérifie les droits de l'utilisateur \param user Utilisateur courant \param module Module a vérifier - \param objectid ID du document + \param objectid ID de l'element (optionnel) \param dbtable Table de la base correspondant au module (optionnel) \param list Défini si la page sert de liste et donc ne fonctionne pas avec un id */ diff --git a/htdocs/societe.php b/htdocs/societe.php index 7370904f24a..159c46e8c5d 100644 --- a/htdocs/societe.php +++ b/htdocs/societe.php @@ -16,19 +16,16 @@ * 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$ */ /** \file htdocs/societe.php \ingroup societe \brief Page des societes - \version $Revision$ + \version $Id$ */ require_once("./pre.inc.php"); - include_once(DOL_DOCUMENT_ROOT."/contact.class.php"); $langs->load("companies"); @@ -36,11 +33,13 @@ $langs->load("customers"); $langs->load("suppliers"); // Sécurité d'accès client et commerciaux +if (! $user->rights->societe->lire && ! $user->rights->fournisseur->lire) accessforbidden(); + $socid = restrictedArea($user, 'societe','','',1); //print 'socid '.$socid; + $search_nom=isset($_GET["search_nom"])?$_GET["search_nom"]:$_POST["search_nom"]; $search_ville=isset($_GET["search_ville"])?$_GET["search_ville"]:$_POST["search_ville"]; - $socname=isset($_GET["socname"])?$_GET["socname"]:$_POST["socname"]; $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; @@ -80,7 +79,11 @@ if ($mode == 'search') $sql.= " OR s.url like '%".addslashes($socname)."%'"; $sql.= ")"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - + if (! $user->rights->societe->lire || ! $user->rights->fournisseur->lire) + { + if (! $user->rights->fournisseur->lire) $sql.=" AND s.fourn != 1"; + } + $result=$db->query($sql); if ($result) { @@ -112,12 +115,16 @@ if (isset($_POST["button_removefilter_x"])) $search_ville=""; } +if ($socname) +{ + $search_nom=$socname; +} + // Affiche la confirmation de suppression d'un tiers if ($_GET['delsoc']) print '
'.$langs->trans("CompanyDeleted",$_GET['delsoc']).'

'; /* * Mode Liste - * */ /* REM: Regle sur droits "Voir tous les clients" @@ -138,22 +145,21 @@ if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PR $sql.= " WHERE s.fk_stcomm = st.id"; if ($socid) { - $sql .= " AND s.rowid = ".$socid; + $sql .= " AND s.rowid = ".$socid; } - -if ($socname) +if (strlen($stcomm)) { - $search_nom=$socname; + $sql .= " AND s.fk_stcomm=".$stcomm; } -if (strlen($stcomm)) { - $sql .= " AND s.fk_stcomm=".$stcomm; -} - -if (!$user->rights->commercial->client->voir && !$socid) //restriction +if (! $user->rights->commercial->client->voir && ! $socid) //restriction { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; } +if (! $user->rights->societe->lire || ! $user->rights->fournisseur->lire) +{ + if (! $user->rights->fournisseur->lire) $sql.=" AND s.fournisseur != 1"; +} if ($search_nom) { @@ -165,12 +171,14 @@ if ($search_nom) $sql.= ")"; } -if ($search_ville) { - $sql .= " AND s.ville LIKE '%".addslashes($search_ville)."%'"; +if ($search_ville) +{ + $sql .= " AND s.ville LIKE '%".addslashes($search_ville)."%'"; } -if ($_POST["search_siren"]) { - $sql .= " AND s.siren LIKE '%".$_POST["search_siren"]."%'"; +if ($_POST["search_siren"]) +{ + $sql .= " AND s.siren LIKE '%".$_POST["search_siren"]."%'"; } $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 71196d4430b..4aa4cad90c6 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -17,20 +17,19 @@ * 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$ */ /** \file htdocs/user/perms.php \brief Onglet user et permissions de la fiche utilisateur - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php"); $langs->load("users"); +$langs->load("admin"); $form = new Form($db); @@ -206,6 +205,7 @@ print "\n"; print '
'; +print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules")); print ''; print '';