* Copyright (C) 2004-2005 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/lien.php \ingroup societe \brief Page des societes \version $Revision$ */ require("./pre.inc.php"); $user->getrights(); $langs->load("companies"); $langs->load("customers"); $langs->load("suppliers"); $langs->load("banks"); /* * 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=".$_GET["socid"]); } } llxHeader(); if($_GET["socid"]) { $soc = new Societe($db); $soc->id = $_GET["socid"]; $soc->fetch($_GET["socid"]); $h=0; $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$soc->id; $head[$h][1] = $langs->trans("Company"); $h++; $head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$soc->id; $head[$h][1] = $langs->trans("BankAccount")." $account->number"; $h++; $head[$h][0] = 'lien.php?socid='.$soc->id; $head[$h][1] = $langs->trans("Links"); $hselected=$h; $h++; $head[$h][0] = 'commerciaux.php?socid='.$soc->id; $head[$h][1] = $langs->trans("SalesRepresentative"); $h++; dolibarr_fiche_head($head, $hselected, $soc->nom); /* * Fiche société en mode visu */ print ''; print ''; print ''; print ""; print ""; print ""; print ""; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
'.$langs->trans('Name').''.$soc->nom.'
'; print $langs->trans('CustomerCode').''; print $soc->code_client; if ($soc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); print ''.$langs->trans('Prefix').''.$soc->prefix_comm.'
".$langs->trans('Address')."".nl2br($soc->adresse)."
".$langs->trans('Zip')."".$soc->cp."".$langs->trans('Town')."".$soc->ville."
".$langs->trans('Country')."".$soc->pays."
'.$langs->trans('Phone').''.dolibarr_print_phone($soc->tel).''.$langs->trans('Fax').''.dolibarr_print_phone($soc->fax).'
'.$langs->trans('Web').''; if ($soc->url) { print 'http://'.$soc->url.''; } print '
'.$langs->transcountry('ProfId1',$soc->pays_code).''.$soc->siren.' '.$langs->transcountry('ProfId2',$soc->pays_code).''.$soc->siret.'
'.$langs->transcountry('ProfId3',$soc->pays_code).''.$soc->ape.' 
'.$langs->trans("Capital").''.$soc->capital.' '.$conf->monnaie.'
'.$langs->trans("ParentCompany").''; if ($soc->parent) { $socm = new Societe($db); $socm->fetch($soc->parent); print ''.img_object($langs->trans("ShowCompany"),'company').' '.$socm->nom.''.($socm->code_client?"(".$socm->code_client.")":"").' - '.$socm->ville; } print '
'; print "
\n"; if ($_GET["select"] > 0) { $socm = new Societe($db); $socm->id = $_GET["select"]; $socm->fetch($_GET["select"]); } else { if ($user->rights->societe->creer) { $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 ''.$langs->trans("Select").'
"; $db->free(); } else { dolibarr_print_error($db); } } } } $db->close(); llxFooter('$Date$ - $Revision$'); ?>