[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/societe/ -> lien.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   *
  19   * $Id: lien.php,v 1.12 2005/11/11 16:37:54 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/societe/lien.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/societe/lien.php
  25          \ingroup    societe
  26          \brief      Page des societes
  27          \version    $Revision: 1.12 $
  28  */
  29   
  30  require ("./pre.inc.php");
  31  
  32  $user->getrights();
  33  
  34  $langs->load("companies");
  35  $langs->load("customers");
  36  $langs->load("suppliers");
  37  $langs->load("banks");
  38  
  39  // Sécurité accés client
  40  if ($user->societe_id > 0) 
  41  {
  42    $action = '';
  43    $socid = $user->societe_id;
  44  }
  45  
  46  
  47  /*
  48   * Actions
  49   */
  50  
  51  // Positionne companie parente
  52  if($_GET["socid"] && $_GET["select"])
  53  {
  54    if ($user->rights->societe->creer)
  55      {
  56        $soc = new Societe($db);
  57        $soc->id = $_GET["socid"];
  58        $soc->fetch($_GET["socid"]);
  59        $soc->set_parent($_GET["select"]);
  60  
  61        Header("Location: lien.php?socid=".$soc->id);
  62        exit;
  63      }
  64    else
  65      {
  66        Header("Location: lien.php?socid=".$_GET["socid"]);
  67        exit;
  68      }
  69  }
  70  
  71  // Supprime companie parente
  72  if($_GET["socid"] && $_GET["delsocid"])
  73  {
  74    if ($user->rights->societe->creer)
  75      {
  76        $soc = new Societe($db);
  77        $soc->id = $_GET["socid"];
  78        $soc->fetch($_GET["socid"]);
  79        $soc->remove_parent($_GET["delsocid"]);
  80  
  81        Header("Location: lien.php?socid=".$soc->id);
  82        exit;
  83      }
  84    else
  85      {
  86        Header("Location: lien.php?socid=".$_GET["socid"]);
  87        exit;
  88      }
  89  }
  90  
  91  
  92  
  93  
  94  llxHeader();
  95  
  96  if($_GET["socid"])
  97  {
  98      
  99      $soc = new Societe($db);
 100      $soc->id = $_GET["socid"];
 101      $soc->fetch($_GET["socid"]);
 102      
 103      $h=0;
 104      
 105      $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$soc->id;
 106      $head[$h][1] = $langs->trans("Company");
 107      $h++;
 108      
 109      $head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$soc->id;
 110      $head[$h][1] = $langs->trans("BankAccount")." $account->number";
 111      $h++;
 112      
 113      $head[$h][0] = 'lien.php?socid='.$soc->id;
 114      $head[$h][1] = $langs->trans("Links");
 115      $hselected=$h;
 116      $h++;
 117      
 118      $head[$h][0] = 'commerciaux.php?socid='.$soc->id;
 119      $head[$h][1] = $langs->trans("SalesRepresentative");
 120      $h++;
 121          
 122      
 123      dolibarr_fiche_head($head, $hselected, $soc->nom);
 124      
 125      /*
 126       * Fiche société en mode visu
 127       */
 128      
 129      print '<table class="border" width="100%">';
 130      print '<tr><td width="20%">'.$langs->trans('Name').'</td><td colspan="3">'.$soc->nom.'</td></tr>';
 131      
 132      print '<tr><td>';
 133      print $langs->trans('CustomerCode').'</td><td width="20%">';
 134      print $soc->code_client;
 135      if ($soc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode");
 136      print '</td><td>'.$langs->trans('Prefix').'</td><td>'.$soc->prefix_comm.'</td></tr>';
 137  
 138      print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($soc->adresse)."</td></tr>";
 139      
 140      print "<tr><td>".$langs->trans('Zip')."</td><td>".$soc->cp."</td>";
 141      print "<td>".$langs->trans('Town')."</td><td>".$soc->ville."</td></tr>";
 142      
 143      print "<tr><td>".$langs->trans('Country')."</td><td colspan=\"3\">".$soc->pays."</td></tr>";
 144      
 145      print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dolibarr_print_phone($soc->tel).'</td>';
 146      print '<td>'.$langs->trans('Fax').'</td><td>'.dolibarr_print_phone($soc->fax).'</td></tr>';
 147      
 148      print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">';
 149      if ($soc->url) { print '<a href="http://'.$soc->url.'">http://'.$soc->url.'</a>'; }
 150      print '</td></tr>';
 151      
 152      print '<tr><td>'.$langs->transcountry('ProfId1',$soc->pays_code).'</td><td><a target="_blank" href="http://www.societe.com/cgi-bin/recherche?rncs='.$soc->siren.'">'.$soc->siren.'</a>&nbsp;</td>';
 153      
 154      print '<td>'.$langs->transcountry('ProfId2',$soc->pays_code).'</td><td>'.$soc->siret.'</td></tr>';
 155      
 156      print '<tr><td>'.$langs->transcountry('ProfId3',$soc->pays_code).'</td><td>'.$soc->ape.'</td><td colspan="2">&nbsp;</td></tr>';
 157      print '<tr><td>'.$langs->trans("Capital").'</td><td colspan="3">'.$soc->capital.' '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
 158      
 159      // Société mère
 160      print '<tr><td>'.$langs->trans("ParentCompany").'</td><td colspan="3">';
 161      if ($soc->parent)
 162      {
 163          $socm = new Societe($db);
 164          $socm->fetch($soc->parent);
 165          print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$socm->id.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$socm->nom.'</a>'.($socm->code_client?"(".$socm->code_client.")":"");
 166          print ($socm->ville?' - '.$socm->ville:'');
 167          print '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?socid='.$_GET["socid"].'&amp;delsocid='.$socm->id.'">';
 168          print img_delete();
 169          print '</a><br>';
 170      }
 171      else
 172      {
 173          print $langs->trans("NoParentCompany");
 174      }
 175      print '</td></tr>';
 176          
 177      print '</table>';
 178      print "</div>\n";
 179      
 180      
 181      if ($_GET["select"] > 0)
 182      {
 183          $socm = new Societe($db);
 184          $socm->id = $_GET["select"];
 185          $socm->fetch($_GET["select"]);
 186      }
 187      else
 188      {
 189          if ($user->rights->societe->creer)
 190          {
 191      
 192              $page=$_GET["page"];
 193      
 194              if ($page == -1) { $page = 0 ; }
 195      
 196              $offset = $conf->liste_limit * $page ;
 197              $pageprev = $page - 1;
 198              $pagenext = $page + 1;
 199      
 200              /*
 201              * Liste
 202              *
 203              */
 204      
 205              $title=$langs->trans("CompanyList");
 206      
 207              $sql = "SELECT s.idp, s.nom, s.ville, s.prefix_comm, s.client, s.fournisseur, te.libelle";
 208              $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
 209              $sql .= " , ".MAIN_DB_PREFIX."c_typent as te";
 210              $sql .= "  WHERE s.fk_typent = te.id";
 211      
 212              if (strlen(trim($_GET["search_nom"])))
 213              {
 214                  $sql .= " AND s.nom LIKE '%".$_GET["search_nom"]."%'";
 215              }
 216      
 217              $sql .= " ORDER BY s.nom ASC " . $db->plimit($conf->liste_limit+1, $offset);
 218      
 219              $result = $db->query($sql);
 220              if ($result)
 221              {
 222                  $num = $db->num_rows();
 223                  $i = 0;
 224      
 225                  $params = "&amp;socid=".$_GET["socid"];
 226      
 227                  print_barre_liste($title, $page, "lien.php",$params,$sortfield,$sortorder,'',$num);
 228      
 229                  // Lignes des titres
 230                  print '<table class="noborder" width="100%">';
 231                  print '<tr class="liste_titre">';
 232                  print '<td>'.$langs->trans("Company").'</td>';
 233                  print '<td>'.$langs->trans("Town").'</td>';
 234                  print '<td>Type<td>';
 235                  print '<td colspan="2" align="center">&nbsp;</td>';
 236                  print "</tr>\n";
 237      
 238                  // Lignes des champs de filtre
 239                  print '<form action="lien.php" method="GET" >';
 240                  print '<input type="hidden" name="socid" value="'.$_GET["socid"].'">';
 241                  print '<tr class="liste_titre">';
 242                  print '<td valign="right">';
 243                  print '<input type="text" name="search_nom" value="'.$_GET["search_nom"].'">';
 244                  print '</td><td colspan="5" align="right">';
 245                  print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
 246                  print '</td>';
 247                  print "</tr>\n";
 248                  print '</form>';
 249      
 250                  $var=True;
 251      
 252                  while ($i < min($num,$conf->liste_limit))
 253                  {
 254                      $obj = $db->fetch_object();
 255                      $var=!$var;
 256                      print "<tr $bc[$var]><td>";
 257                      print stripslashes($obj->nom)."</td>\n";
 258                      print "<td>".$obj->ville."&nbsp;</td>\n";
 259                      print "<td>".$obj->libelle."&nbsp;</td>\n";
 260                      print '<td align="center">';
 261                      if ($obj->client==1)
 262                      {
 263                          print $langs->trans("Customer")."\n";
 264                      }
 265                      elseif ($obj->client==2)
 266                      {
 267                          print $langs->trans("Prospect")."\n";
 268                      }
 269                      else
 270                      {
 271                          print "&nbsp;";
 272                      }
 273                      print "</td><td align=\"center\">";
 274                      if ($obj->fournisseur)
 275                      {
 276                          print $langs->trans("Supplier");
 277                      }
 278                      else
 279                      {
 280                          print "&nbsp;";
 281                      }
 282      
 283                      print '</td>';
 284                      // Lien Sélectionner
 285                      print '<td align="center"><a href="lien.php?socid='.$_GET["socid"].'&amp;select='.$obj->idp.'">'.$langs->trans("Select").'</a>';
 286                      print '</td>';
 287      
 288                      print '</tr>'."\n";
 289                      $i++;
 290                  }
 291      
 292                  print "</table>";
 293                  print '<br>';
 294                  $db->free();
 295              }
 296              else
 297              {
 298                  dolibarr_print_error($db);
 299              }
 300          }
 301      }
 302  }
 303  
 304  
 305  $db->close();
 306  
 307  llxFooter('$Date: 2005/11/11 16:37:54 $ - $Revision: 1.12 $');
 308  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics