From 6d1818c6f0649e9b4b36bd7f68379ba6ffe7898c Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 17 Jan 2005 15:14:21 +0000 Subject: [PATCH] Ajout lecture des permissions --- htdocs/societe/lien.php | 206 ++++++++++++++++++++-------------------- 1 file changed, 105 insertions(+), 101 deletions(-) diff --git a/htdocs/societe/lien.php b/htdocs/societe/lien.php index 5951562eb83..f77c1e155ae 100644 --- a/htdocs/societe/lien.php +++ b/htdocs/societe/lien.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -28,7 +28,8 @@ */ require("./pre.inc.php"); -require("../contact.class.php"); + +$user->getrights(); $langs->load("companies"); $langs->load("customers"); @@ -57,7 +58,7 @@ if($_GET["socid"] && $_GET["select"]) } else { - Header("Location: lien.php?socid=".$soc->id); + Header("Location: lien.php?socid=".$_GET["socid"]); } } @@ -125,7 +126,7 @@ if($_GET["socid"]) $socm = new Societe($db); $socm->fetch($soc->parent); - print 'Maison mère'.$socm->nom_url.''; + print 'Maison mère'.$socm->nom_url.' ('.$socm->code_client.')
'.$socm->ville.''; } print ''; @@ -140,112 +141,115 @@ if($_GET["socid"]) } else { - $page=$_GET["page"]; - - if ($page == -1) { $page = 0 ; } - - $offset = $conf->liste_limit * $page ; - $pageprev = $page - 1; - $pagenext = $page + 1; - - /* - * Liste - * - */ - - $title=$langs->trans("CompanyList"); - - $sql = "SELECT s.idp, s.nom, s.ville, s.prefix_comm, s.client, s.fournisseur, te.libelle"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql .= " , ".MAIN_DB_PREFIX."c_typent as te"; - $sql .= " WHERE s.fk_typent = te.id"; - - if (strlen(trim($_GET["search_nom"]))) + if ($user->rights->societe->creer) { - $sql .= " AND s.nom LIKE '%".$_GET["search_nom"]."%'"; - } - - $sql .= " ORDER BY s.nom ASC " . $db->plimit($conf->liste_limit+1, $offset); - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows(); - $i = 0; + + $page=$_GET["page"]; - $params = "&socid=".$_GET["socid"]; + if ($page == -1) { $page = 0 ; } - print_barre_liste($title, $page, "lien.php",$params,$sortfield,$sortorder,'',$num); + $offset = $conf->liste_limit * $page ; + $pageprev = $page - 1; + $pagenext = $page + 1; - // Lignes des titres - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - // Lignes des champs de filtre - print ''; - print ''; - print ''; - print ''; - print "\n"; - print ''; + /* + * Liste + * + */ - $var=True; + $title=$langs->trans("CompanyList"); - while ($i < min($num,$conf->liste_limit)) + $sql = "SELECT s.idp, s.nom, s.ville, s.prefix_comm, s.client, s.fournisseur, te.libelle"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql .= " , ".MAIN_DB_PREFIX."c_typent as te"; + $sql .= " WHERE s.fk_typent = te.id"; + + if (strlen(trim($_GET["search_nom"]))) { - $obj = $db->fetch_object(); - $var=!$var; - print "\n"; - print "\n"; - print "\n"; - print ''; - - print ''."\n"; - $i++; + $sql .= " AND s.nom LIKE '%".$_GET["search_nom"]."%'"; } - print "
'.$langs->trans("Company").''.$langs->trans("Town").'Type'; - print ' 
'; - print ''; - print ''; - print ''; - print '
"; - print stripslashes($obj->nom)."".$obj->ville." ".$obj->libelle." '; - if ($obj->client==1) - { - print $langs->trans("Customer")."\n"; - } - elseif ($obj->client==2) - { - print $langs->trans("Prospect")."\n"; - } - else - { - print " "; - } - print ""; - if ($obj->fournisseur) - { - print $langs->trans("Supplier"); - } - else - { - print " "; - } - - print 'Sélectionner
"; - $db->free(); - } - else - { - dolibarr_print_error($db); - } - } - + $sql .= " ORDER BY s.nom ASC " . $db->plimit($conf->liste_limit+1, $offset); + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows(); + $i = 0; + + $params = "&socid=".$_GET["socid"]; + + print_barre_liste($title, $page, "lien.php",$params,$sortfield,$sortorder,'',$num); + + // Lignes des titres + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + // Lignes des champs de filtre + print ''; + print ''; + print ''; + print ''; + print "\n"; + print ''; + + $var=True; + + while ($i < min($num,$conf->liste_limit)) + { + $obj = $db->fetch_object(); + $var=!$var; + print "\n"; + print "\n"; + print "\n"; + print ''; + + print ''."\n"; + $i++; + } + + print "
'.$langs->trans("Company").''.$langs->trans("Town").'Type'; + print ' 
'; + print ''; + print ''; + print ''; + print '
"; + print stripslashes($obj->nom)."".$obj->ville." ".$obj->libelle." '; + if ($obj->client==1) + { + print $langs->trans("Customer")."\n"; + } + elseif ($obj->client==2) + { + print $langs->trans("Prospect")."\n"; + } + else + { + print " "; + } + print ""; + if ($obj->fournisseur) + { + print $langs->trans("Supplier"); + } + else + { + print " "; + } + + print 'Sélectionner
"; + $db->free(); + } + else + { + dolibarr_print_error($db); + } + } + } }