[ 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/tarifs/ -> prefix.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: prefix.php,v 1.1 2005/05/12 11:36:28 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/tarifs/prefix.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();
  30  
  31  if ($_GET["type"] == '')
  32  {
  33   $_GET["type"] = 'achat'; 
  34  }
  35  
  36  /*
  37   * Sécurité accés client
  38   */
  39  if ($user->societe_id > 0) 
  40  {
  41    $action = '';
  42    $socidp = $user->societe_id;
  43  }
  44  
  45  if ($sortorder == "") {
  46    $sortorder="ASC";
  47  }
  48  if ($sortfield == "") {
  49    $sortfield="prefix, libelle, fournisseur";
  50  }
  51  
  52  /*
  53   * Recherche
  54   *
  55   *
  56   */
  57  
  58  if ($page == -1) { $page = 0 ; }
  59  
  60  $offset = $conf->liste_limit * $page ;
  61  $pageprev = $page - 1;
  62  $pagenext = $page + 1;
  63  
  64  
  65  
  66  /*
  67   * Mode Liste
  68   *
  69   *
  70   *
  71   */
  72  
  73  
  74  $sql = "SELECT t.libelle as tarif, p.prefix"; 
  75  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif as t";
  76  $sql .= "," . MAIN_DB_PREFIX."telephonie_prefix as p";
  77  
  78  $sql .= " WHERE p.fk_tarif = t.rowid";
  79  
  80  if ($_GET["search_tarif"])
  81  {
  82    $sql .=" AND t.libelle LIKE '%".$_GET["search_tarif"]."%'";
  83  }
  84  
  85  if ($_GET["search_prefix"])
  86  {
  87    $sql .=" AND p.prefix LIKE '%".$_GET["search_prefix"]."%'";
  88  }
  89  
  90  $sql .= " ORDER BY t.libelle ASC " . $db->plimit($conf->liste_limit+1, $offset);
  91  
  92  
  93  $result = $db->query($sql);
  94  if ($result)
  95  {
  96    $num = $db->num_rows();
  97    $i = 0;
  98    
  99    print_barre_liste("Prefix", $page, "prefix.php", "&type=".$_GET["type"], $sortfield, $sortorder, '', $num);
 100  
 101    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
 102    print '<tr class="liste_titre">';
 103  
 104    print_liste_field_titre("Tarif","prefix.php","f.nom");
 105  
 106    print_liste_field_titre("Prefix","prefix.php","libelle", "&type=".$_GET["type"]);
 107    print '<td>&nbsp;</td>';
 108  
 109    print "</tr>\n";
 110  
 111    print '<tr class="liste_titre">';
 112    print '<form action="prefix.php" method="GET">';
 113    print '<input type="hidden" name="type" value="'.$_GET["type"].'">';
 114    print '<td><input type="text" name="search_tarif" size="20" value="'.$_GET["search_tarif"].'"></td>';
 115    print '<td><input type="text" name="search_prefix" size="8" value="'.$_GET["search_prefix"].'"></td>';
 116  
 117    print '<td><input type="submit"></td>';
 118    print '</form>';
 119    print '</tr>';
 120  
 121    $var=True;
 122  
 123    while ($i < min($num,$conf->liste_limit))
 124      {
 125        $obj = $db->fetch_object($i);    
 126        $var=!$var;
 127  
 128        print "<tr $bc[$var]>";
 129  
 130        print "<td>".$obj->tarif."</td>\n";
 131        print "<td>".$obj->prefix."</td>\n";
 132        print '<td>&nbsp;</td>'; 
 133        print "</tr>\n";
 134        $i++;
 135      }
 136    print "</table>";
 137    $db->free();
 138  }
 139  else 
 140  {
 141    print $db->error() . ' ' . $sql;
 142  }
 143  
 144  $db->close();
 145  
 146  llxFooter("<em>Derni&egrave;re modification $Date: 2005/05/12 11:36:28 $ r&eacute;vision $Revision: 1.1 $</em>");
 147  ?>


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