[ 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/ligne/ -> numdata.php (source)

   1  <?PHP
   2  /* Copyright (C) 2004 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: numdata.php,v 1.3 2005/01/30 01:32:28 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/ligne/numdata.php,v $
  20   *
  21   */
  22  
  23  /**            \file       htdocs/telephonie/ligne/numdata.php
  24              \ingroup    telephonie
  25              \brief      Num data
  26              \version    $Revision: 1.3 $
  27  */
  28  
  29  require ("./pre.inc.php");
  30  
  31  
  32  $page = $_GET["page"];
  33  $sortorder = $_GET["sortorder"];
  34  $sortfield = $_GET["sortfield"];
  35  
  36  if ($_POST["action"] == 'addnum')
  37  {
  38  
  39    if (strlen(trim($_POST["numero"])) > 0)
  40      {
  41        $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_numdata";
  42        $sql .= " (fk_groupe, numero,fk_user) VALUES ";
  43        $sql .= " (".$_POST["groupeid"].",'".$_POST["numero"]."',".$user->id.")";
  44        
  45        if ( $db->query($sql) )
  46      {
  47        //Header("Location: numdata.php?id=".$ligne->id);
  48        Header("Location: numdata.php?id=".$ligne->id);
  49      }
  50        else
  51      {
  52        print $db->error();
  53      }
  54      }
  55  }
  56  
  57  if ($_GET["action"] == 'delete')
  58  {
  59  
  60    if (strlen(trim($_GET["id"])) > 0)
  61      {
  62        $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_numdata";
  63        $sql .= " WHERE rowid = ".$_GET["id"];
  64        
  65        if ( $db->query($sql) )
  66      {
  67        Header("Location: numdata.php");
  68      }
  69        else
  70      {
  71        print $db->error();
  72      }
  73      }
  74  }
  75  
  76  llxHeader('','Telephonie - Ligne - Liste');
  77  /*
  78   * Sécurité accés client
  79   */
  80  if ($user->societe_id > 0) 
  81  {
  82    $action = '';
  83    $socidp = $user->societe_id;
  84  }
  85  
  86  
  87  /*
  88   * Recherche
  89   *
  90   *
  91   */
  92  
  93  if ($page == -1) { $page = 0 ; }
  94  
  95  $offset = $conf->liste_limit * $page ;
  96  $pageprev = $page - 1;
  97  $pagenext = $page + 1;
  98  
  99  /*
 100   * Mode Liste
 101   *
 102   *
 103   *
 104   */
 105  
 106  
 107  print_barre_liste("Numéros data", $page, "numdata.php", $urladd, $sortfield, $sortorder, '', $num);
 108  
 109  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
 110  print '<tr class="liste_titre">';
 111  print_liste_field_titre("Numéro","numdata.php","l.ligne");
 112  
 113  print_liste_field_titre("Client","numdata.php","s.nom");
 114  print '<td>&nbsp;</td>';
 115  
 116  print "</tr>\n";
 117  
 118  print '<tr class="liste_titre">';
 119  print '<form action="numdata.php" method="GET">';
 120  print '<td><input type="text" name="search_ligne" value="'. $_GET["search_ligne"].'" size="12"></td>';  print '<td><input type="text" name="search_client" value="'. $_GET["search_client"].'" size="20"></td>';
 121  
 122  print '<td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td>';
 123  
 124  print '</form>';
 125  print '</tr>';
 126  
 127  
 128  print '<tr class="liste_titre">';
 129  print '<form action="numdata.php" method="POST">';
 130  print '<input type="hidden" name="action" value="addnum"></td>';  
 131  print '<td><input type="text" name="numero" size="12" maxlength="12"></td>';  
 132  
 133  print '<td><select name="groupeid">';
 134  $sql = "SELECT distinct g.rowid , g.nom";
 135  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_groupeligne as g";
 136  
 137  if ( $db->query($sql) )
 138  {  
 139    $num = $db->num_rows();
 140    $i = 0;      
 141    while ($i < $num)
 142      {
 143        $row = $db->fetch_row($i);
 144        print '<option value="'.$row[0].'">'.$row[1];
 145        $i++;
 146      }
 147  }
 148  print '</select></td>';
 149  print '<td><input type="submit" value="Ajouter"></td>';
 150  
 151  print '</form>';
 152  print '</tr>';
 153  
 154  
 155  $sql = "SELECT g.nom, n.numero, n.rowid";
 156  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_groupeligne as g";
 157  $sql .= ",".MAIN_DB_PREFIX."telephonie_numdata as n";
 158  
 159  $sql .= " WHERE n.fk_groupe = g.rowid";
 160  
 161  if ($sortorder == "") {
 162    $sortorder="ASC";
 163  }
 164  if ($sortfield == "") {
 165    $sortfield="g.nom";
 166  }
 167  
 168  
 169  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
 170  
 171  $result = $db->query($sql);
 172  if ($result)
 173  {
 174    $num = $db->num_rows();
 175    $i = 0;
 176    
 177    $var=True;
 178  
 179    $ligne = new LigneTel($db);
 180  
 181    while ($i < min($num,$conf->liste_limit))
 182      {
 183        $obj = $db->fetch_object($i);    
 184        $var=!$var;
 185  
 186        print "<tr $bc[$var]><td>";
 187  
 188        print dolibarr_print_phone($obj->numero)."</td>\n";
 189        print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->socidp.'">'.$obj->nom.'</a></td>';
 190  
 191        print '<td align="center"><a href="'.DOL_URL_ROOT.'/telephonie/ligne/numdata.php?action=delete&amp;id='.$obj->rowid.'">';
 192        print img_delete();
 193        print '</a></td>';
 194  
 195        print "</tr>\n";
 196        $i++;
 197      }
 198  
 199    $db->free();
 200  }
 201  else 
 202  {
 203    print $db->error() . ' ' . $sql;
 204  }
 205  
 206    print "</table>";
 207  
 208  $db->close();
 209  
 210  llxFooter("<em>Derni&egrave;re modification $Date: 2005/01/30 01:32:28 $ r&eacute;vision $Revision: 1.3 $</em>");
 211  ?>


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