[ 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/telephonie/client/ -> contacts.php (source)

   1  <?PHP
   2  /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: contacts.php,v 1.1 2005/10/11 11:51:38 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/client/contacts.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  
  25  $page = $_GET["page"];
  26  $sortorder = $_GET["sortorder"];
  27  $sortfield = $_GET["sortfield"];
  28  
  29  llxHeader('','Telephonie - Clients - Contacts');
  30  /*
  31   * Sécurité accés client
  32   */
  33  if ($user->societe_id > 0) 
  34  {
  35    $action = '';
  36    $socidp = $user->societe_id;
  37  }
  38  
  39  if ($sortorder == "") {
  40    $sortorder="ASC";
  41  }
  42  if ($sortfield == "") {
  43    $sortfield="s.nom";
  44  }
  45  
  46  /*
  47   * Recherche
  48   *
  49   *
  50   */
  51  
  52  if ($page == -1) { $page = 0 ; }
  53  
  54  $offset = $conf->liste_limit * $page ;
  55  $pageprev = $page - 1;
  56  $pagenext = $page + 1;
  57  /*
  58   * Mode Liste
  59   *
  60   */
  61  $sql = "SELECT distinct cont.email, cont.idp, cont.name, cont.firstname, s.nom, s.idp as socidp";
  62  $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
  63  
  64  $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp";
  65  $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_contact_facture as cf";
  66  $sql .= ",".MAIN_DB_PREFIX."socpeople as cont";
  67  
  68  $sql .= " WHERE cont.fk_soc = s.idp ";
  69  $sql .= " AND cf.fk_contact = cont.idp";
  70  
  71  $sql .= " AND s.idp = sp.fk_soc";
  72  $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1";
  73  
  74  if ($_GET["search_client"])
  75  {
  76    $sel = urldecode($_GET["search_client"]);
  77    $sql .= " AND s.nom LIKE '%".$sel."%'";
  78  }
  79  
  80  if ($_GET["search_email"])
  81  {
  82    $sel = urldecode($_GET["search_email"]);
  83    $sql .= " AND cont.email LIKE '%".$sel."%'";
  84  }
  85  
  86  //$sql .= " GROUP BY s.idp";
  87  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
  88  
  89  $result = $db->query($sql);
  90  if ($result)
  91  {
  92    $num = $db->num_rows();
  93    $i = 0;
  94    
  95    $urladd= "&amp;statut=".$_GET["statut"];
  96  
  97    print_barre_liste("Clients", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num);
  98  
  99    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
 100    print '<tr class="liste_titre">';
 101    print_liste_field_titre("Client","contacts.php","s.nom","","",' width="50%"');
 102    print '<td width="25%">Prénom Nom</td>';
 103  
 104    print_liste_field_titre("Email","contacts.php","cont.email","","",' width="50%"');
 105    print "</tr>\n";
 106  
 107    print '<tr class="liste_titre">';
 108    print '<form action="contacts.php" method="GET">';
 109    print '<td><input type="text" name="search_client" value="'. $_GET["search_client"].'" size="12"></td>';  
 110    print '<td>&nbsp;</td>';
 111    print '<td><input type="text" name="search_email" value="'. $_GET["search_email"].'" size="12">';  
 112    print '&nbsp;<input type="submit" class="button" value="'.$langs->trans("Search").'"></td>';
 113  
 114    print '</form>';
 115    print '</tr>';
 116  
 117  
 118    $var=True;
 119  
 120    $ligne = new LigneTel($db);
 121  
 122    while ($i < min($num,$conf->liste_limit))
 123      {
 124        $obj = $db->fetch_object($i);    
 125        $var=!$var;
 126  
 127        print "<tr $bc[$var]><td>";
 128  
 129        print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">';
 130        print img_file();      
 131        print '</a>&nbsp;';
 132        print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.$obj->nom.'</a></td>';
 133        print '<td>'.$obj->firstname.' '.$obj->name."</td>\n";
 134  
 135        print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->idp.'">';
 136        print $obj->email."</a></td>\n";
 137  
 138        print "</tr>\n";
 139        $i++;
 140      }
 141    print "</table>";
 142    $db->free();
 143  }
 144  else 
 145  {
 146    print $db->error() . ' ' . $sql;
 147  }
 148  
 149  $db->close();
 150  
 151  llxFooter("<em>Derni&egrave;re modification $Date: 2005/10/11 11:51:38 $ r&eacute;vision $Revision: 1.1 $</em>");
 152  ?>


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