[ 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/fourn/ -> contact.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2004 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: contact.php,v 1.18 2005/06/11 11:34:38 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/fourn/contact.php,v $
  21   *
  22   */
  23   
  24  /**
  25          \file       htdocs/fourn/contact.php
  26          \ingroup    fournisseur
  27          \brief      Liste des contacts fournisseurs
  28          \version    $Revision: 1.18 $
  29  */
  30  
  31  require ("./pre.inc.php");
  32  
  33  $langs->load("companies");
  34  
  35  llxHeader();
  36  
  37  /*
  38   * Sécurité accés client
  39   */
  40  if ($user->societe_id > 0) 
  41  {
  42    $action = '';
  43    $socid = $user->societe_id;
  44  }
  45  
  46  $page=$_GET["page"];
  47  $sortorder=$_GET["sortorder"];
  48  $sortfield=$_GET["sortfield"];
  49  
  50  if (! $sortorder) $sortorder="ASC";
  51  if (! $sortfield) $sortfield="p.name";
  52  if ($page == -1) { $page = 0 ; }
  53  $limit = $conf->liste_limit;
  54  $offset = $limit * $page ;
  55  
  56  
  57  /*
  58   * Mode liste
  59   *
  60   */
  61  
  62  $sql = "SELECT s.idp, s.nom, st.libelle as stcomm, p.idp as cidp, p.name, p.firstname, p.email, p.phone ";
  63  $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."socpeople as p, ".MAIN_DB_PREFIX."c_stcomm as st";
  64  $sql .= " WHERE s.fk_stcomm = st.id AND s.fournisseur = 1 AND s.idp = p.fk_soc";
  65  
  66  if (strlen($stcomm)) {
  67    $sql .= " AND s.fk_stcomm=$stcomm";
  68  }
  69  
  70  if (strlen($begin)) {
  71    $sql .= " AND p.name like '$begin%'";
  72  }
  73  
  74  if ($contactname) {
  75    $sql .= " AND p.name like '%".strtolower($contactname)."%'";
  76    $sortfield = "p.name";
  77    $sortorder = "ASC";
  78  }
  79  
  80  if ($socid) {
  81    $sql .= " AND s.idp = $socid";
  82  }
  83  
  84  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset);
  85  
  86  $result = $db->query($sql);
  87  if ($result) {
  88    $num = $db->num_rows($result);
  89    
  90    print_barre_liste($langs->trans("ListOfContacts")." (".$langs->trans("Suppliers").")",$page, "contact.php", "",$sortfield,$sortorder,"",$num);
  91      
  92    print '<table class="liste" width="100%">';
  93    print '<tr class="liste_titre">';
  94    print_liste_field_titre($langs->trans("Lastname"),"contact.php","p.name", $begin, "", "", $sortfield);
  95    print_liste_field_titre($langs->trans("Firstname"),"contact.php","p.firstname", $begin, "", "", $sortfield);
  96    print_liste_field_titre($langs->trans("Company"),"contact.php","s.nom", $begin, "", "", $sortfield);
  97    print '<td class="liste_titre">'.$langs->trans("Email").'</td>';
  98    print '<td class="liste_titre">'.$langs->trans("Phone").'</td>';
  99    print "</tr>\n";
 100    $var=True;
 101    $i = 0;
 102    while ($i < min($num,$limit))
 103      {
 104        $obj = $db->fetch_object($result);
 105      
 106        $var=!$var;
 107  
 108        print "<tr $bc[$var]>";
 109  
 110        print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'">'.img_object($langs->trans("ShowContact"),"contact").' '.$obj->name.'</a></td>';
 111        print '<td>'.$obj->firstname.'</td>';
 112        print '<td><a href="fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>';
 113        print '<td>'.$obj->email.'</td>';
 114        print '<td>'.$obj->phone.'</td>';
 115        
 116        print "</tr>\n";
 117        $i++;
 118      }
 119    print "</table>";
 120    $db->free($result);
 121  
 122  }
 123  else
 124  {
 125    dolibarr_print_error($db);
 126  }
 127  
 128  $db->close();
 129  
 130  llxFooter('$Date: 2005/06/11 11:34:38 $ - $Revision: 1.18 $');
 131  ?>


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