From 35420967fc0ee6b6bd600e3234f6a27cafc836e0 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 17 Jan 2005 12:48:23 +0000 Subject: [PATCH] Nouveau fichier --- htdocs/societe/lien.php | 255 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 255 insertions(+) create mode 100644 htdocs/societe/lien.php diff --git a/htdocs/societe/lien.php b/htdocs/societe/lien.php new file mode 100644 index 00000000000..5951562eb83 --- /dev/null +++ b/htdocs/societe/lien.php @@ -0,0 +1,255 @@ + + * Copyright (C) 2004 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/societe.php + \ingroup societe + \brief Page des societes + \version $Revision$ +*/ + +require("./pre.inc.php"); +require("../contact.class.php"); + +$langs->load("companies"); +$langs->load("customers"); +$langs->load("suppliers"); + +/* + * Sécurité accés client + */ + +if ($user->societe_id > 0) +{ + $action = ''; + $socid = $user->societe_id; +} + +if($_GET["socid"] && $_GET["select"]) +{ + if ($user->rights->societe->creer) + { + $soc = new Societe($db); + $soc->id = $_GET["socid"]; + $soc->fetch($_GET["socid"]); + $soc->set_parent($_GET["select"]); + + Header("Location: lien.php?socid=".$soc->id); + } + else + { + Header("Location: lien.php?socid=".$soc->id); + } +} + + +llxHeader(); + +if($_GET["socid"]) +{ + + $soc = new Societe($db); + $soc->id = $_GET["socid"]; + $soc->fetch($_GET["socid"]); + + + $head[0][0] = DOL_URL_ROOT.'/soc.php?socid='.$soc->id; + $head[0][1] = $langs->trans("Company"); + $h = 1; + + $head[$h][0] = 'lien.php?socid='.$soc->id; + $head[$h][1] = 'Lien'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Note"); + $h++; + + + + dolibarr_fiche_head($head, 1, $soc->nom); + + /* + * Fiche société en mode visu + */ + + print ''; + print ''; + + print ""; + + print ''; + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + print ''; + + if ($soc->parent > 0) + { + $socm = new Societe($db); + $socm->fetch($soc->parent); + + print ''; + } + + print '
'.$langs->trans('Name').''.$soc->nom.''.$langs->trans('Prefix').''.$soc->prefix_comm.'
".$langs->trans('Address')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
'.$langs->trans('Phone').''.dolibarr_print_phone($soc->tel).''.$langs->trans('Fax').''.dolibarr_print_phone($soc->fax).'
'; + print $langs->trans('Code client').''; + print $soc->code_client; + if ($soc->check_codeclient() <> 0) + { + print "Code incorrect"; + } + print '
'.$langs->trans('Web').''; + if ($soc->url) { print 'http://'.$soc->url.''; } + print '
'.$langs->trans('ProfIdSiren').''.$soc->siren.' '.$langs->trans('ProfIdSiret').''.$soc->siret.'
'.$langs->trans('ProfIdApe').''.$soc->ape.'Capital'.$soc->capital.' '.$conf->monnaie.'
Maison mère'.$socm->nom_url.'
'; + print "
\n"; + + + if ($_GET["select"] > 0) + { + $socm = new Societe($db); + $socm->id = $_GET["select"]; + $socm->fetch($_GET["select"]); + } + 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"]))) + { + $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; + + $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); + } + } + +} + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?>