[ 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/distributeurs/ -> pre.inc.php (source)

   1  <?PHP
   2  /* Copyright (C) 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: pre.inc.php,v 1.10 2005/09/14 13:59:07 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/distributeurs/pre.inc.php,v $
  20   *
  21   */
  22  require ("../../main.inc.php");
  23  
  24  $user->getrights('telephonie');
  25  $user->distributeur_id = 0;
  26  require DOL_DOCUMENT_ROOT.'/telephonie/distributeurtel.class.php';
  27  require DOL_DOCUMENT_ROOT.'/telephonie/telephonie.commercial.class.php';
  28  
  29  $sql = "SELECT fk_distributeur";
  30  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux";
  31  $sql .= " WHERE fk_user=".$user->id;
  32  
  33  $resql = $db->query($sql);
  34  if ($resql)
  35  {
  36    $row = $db->fetch_row($resql);
  37    $user->distributeur_id = $row[0];
  38  }
  39  
  40  $sql = "SELECT fk_distributeur";
  41  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur_responsable";
  42  $sql .= " WHERE fk_user=".$user->id;
  43  
  44  $resql = $db->query($sql);
  45  if ($resql)
  46  {
  47    $row = $db->fetch_row($resql);
  48    $user->responsable_distributeur_id = $row[0];
  49  }
  50  
  51  function llxHeader($head = "", $title="") {
  52    global $user, $conf, $db;
  53  
  54    /*
  55     *
  56     *
  57     */
  58    top_menu($head, $title);
  59  
  60    $menu = new Menu();
  61  
  62    $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie");
  63  
  64    $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients");
  65  
  66    $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats");
  67  
  68    $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes");
  69  
  70    if ($user->rights->telephonie->ligne_commander)
  71      $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes");
  72  
  73    if ($user->rights->telephonie->facture->lire)
  74      $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures");
  75  
  76    if ($user->rights->telephonie->stats->lire)
  77      {
  78        $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques");
  79        $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/distributeurs/", "Distributeurs");
  80      }
  81  
  82    $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs");
  83  
  84    $menu->add(DOL_URL_ROOT."/telephonie/distributeurs/", "Distributeurs");
  85  
  86  
  87    $sql = "SELECT d.nom, d.rowid";
  88    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d";
  89  
  90    if ($user->distributeur_id)
  91      {
  92        $sql .= " WHERE d.rowid = ".$user->distributeur_id;
  93      }
  94  
  95    $sql .= " ORDER BY d.nom ASC";
  96    
  97    $resql = $db->query($sql);
  98    
  99    if ($resql)
 100      {
 101        $num = $db->num_rows();
 102        $i = 0;
 103        $total = 0;
 104        
 105        while ($i < $num)
 106      {
 107        $row = $db->fetch_row($resql);
 108  
 109        $texte = $row[0];
 110  
 111        if (strlen($texte) > 15)
 112          {
 113            $texte = substr($texte,0,12)."...";
 114          }
 115        
 116        $menu->add_submenu(DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$row[1], $texte);
 117  
 118        $i++;
 119      }
 120      }
 121  
 122    if ($user->rights->telephonie->fournisseur->lire)
 123      $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/index.php", "Fournisseurs");
 124  
 125    if ($user->rights->telephonie->service->lire)
 126      $menu->add(DOL_URL_ROOT."/telephonie/service/", "Services");
 127  
 128    if ($user->rights->telephonie->ca->lire)
 129      $menu->add(DOL_URL_ROOT."/telephonie/ca/", "Chiffre d'affaire");
 130  
 131    left_menu($menu->liste);
 132  }
 133  
 134  ?>


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