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


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