[ 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/commande/ -> liste.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: liste.php,v 1.6 2005/11/07 09:05:39 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/ligne/commande/liste.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  if (!$user->rights->telephonie->ligne_commander)
  25    accessforbidden();
  26  
  27  $page = $_GET["page"];
  28  $sortorder = $_GET["sortorder"];
  29  $sortfield = $_GET["sortfield"];
  30  
  31  if ($_GET["action"] == "commande" && $user->rights->telephonie->ligne_commander)
  32  {
  33    $ltel = new LigneTel($db);
  34    $ltel->fetch_by_id($_GET["lid"]);
  35  
  36    if ($_GET["statut"] == 1)
  37      {
  38        $ltel->set_a_commander($user);
  39      }
  40  
  41    if ($_GET["statut"] == -1)
  42      {
  43        $ltel->set_en_attente($user);
  44      }
  45  
  46    Header("Location: liste.php");
  47  }
  48  
  49  
  50  llxHeader("","Telephonie - Ligne - Commande");
  51  
  52  /*
  53   * Sécurité accés client
  54   */
  55  if ($user->societe_id > 0) 
  56  {
  57    $action = '';
  58    $socidp = $user->societe_id;
  59  }
  60  
  61  if ($sortorder == "") {
  62    $sortorder="DESC";
  63  }
  64  if ($sortfield == "") {
  65    $sortfield="l.statut";
  66  }
  67  
  68  if ($page == -1) { $page = 0 ; }
  69  
  70  $offset = $conf->liste_limit * $page ;
  71  $pageprev = $page - 1;
  72  $pagenext = $page + 1;
  73  
  74  /*
  75   * Mode Liste
  76   *
  77   *
  78   *
  79   */
  80  
  81  $sql = "SELECT sf.idp as sfidp, sf.nom as sfnom, s.idp as socidp, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, f.rowid as fournid, l.mode_paiement";
  82  $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
  83  $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
  84  $sql .= ",".MAIN_DB_PREFIX."telephonie_fournisseur as f";
  85  $sql .= ",".MAIN_DB_PREFIX."societe as sf";
  86  $sql .= " WHERE l.fk_soc = s.idp ";
  87  $sql .= " AND l.fk_fournisseur = f.rowid ";
  88  $sql .= " AND l.statut IN (-1,1,4) ";
  89  $sql .= " AND l.techno = 'presel'";
  90  $sql .= " AND l.fk_soc_facture = sf.idp";
  91  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
  92  
  93  $result = $db->query($sql);
  94  if ($result)
  95  {
  96    $num = $db->num_rows();
  97    $i = 0;
  98    
  99    print_barre_liste("Commande", $page, "liste.php", "", $sortfield, $sortorder, '', $num);
 100  
 101    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
 102    print '<tr class="liste_titre">';
 103    print_liste_field_titre("Ligne","liste.php","l.ligne");
 104    print '<td align="center">Statut</td>';
 105    print_liste_field_titre("Client","liste.php","s.nom");
 106    print '<td>Client Facturé</td><td align="center">Rib OK</td><td>Fournisseur</td>';
 107    print "</tr>\n";
 108  
 109    $var=True;
 110  
 111    $ligne = new LigneTel($db);
 112  
 113    while ($i < min($num,$conf->liste_limit))
 114      {
 115        $obj = $db->fetch_object($i);    
 116        $var=!$var;
 117  
 118        $fourntels = array();
 119  
 120        if (!array_key_exists($obj->fournid, $fourntels)) 
 121      {
 122        $ft = new FournisseurTelephonie($db, $obj->fournid);
 123        $ft->fetch($obj->fournid);
 124        $fourntels[$obj->fournid] = $ft;
 125      }
 126  
 127  
 128        $socf = new Societe($db);
 129        $socf->fetch($obj->sfidp);
 130  
 131        print "<tr $bc[$var]>";
 132        print '<td><img src="../graph'.$obj->statut.'.png">';
 133        print '&nbsp;<a href="../fiche.php?id='.$obj->rowid.'">';
 134  
 135        if (strlen($obj->ligne) <> 10)
 136      {
 137        print "Erreur";
 138        $ok_commande = 0;
 139      }
 140        else
 141      {
 142        print dolibarr_print_phone($obj->ligne);
 143        $ok_commande = 1;
 144      }
 145  
 146      print "</a></td>\n";
 147  
 148        $ftx = $fourntels[$obj->fournid];
 149  
 150        if ($ok_commande && $ftx->commande_enable && $user->rights->telephonie->ligne_commander && ($obj->statut == 1 or $obj->statut == -1) && ( $socf->verif_rib() or $obj->mode_paiement == 'vir'))
 151      {
 152        $nst = ($obj->statut * -1);
 153        print '<td align="center"><a href="liste.php?lid='.$obj->rowid.'&amp;action=commande&amp;statut='.$nst.'">';
 154        print img_edit();
 155        print '</a>&nbsp;<a href="liste.php?lid='.$obj->rowid.'&amp;action=commande&amp;statut='.$nst.'">';
 156        print $ligne->statuts[$obj->statut];
 157        print "</a></td>\n";
 158      }
 159        else
 160      {
 161        print '<td align="center">'.$ligne->statuts[$obj->statut]."</td>\n";
 162      }
 163  
 164        print '<td><a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.stripslashes($obj->nom).'</a></td>';
 165        print '<td>'.stripslashes($obj->sfnom).'</td>';
 166  
 167        print '<td align="center">'.$yesno[$socf->verif_rib()].'</a></td>';
 168        print "<td>".$obj->fournisseur."</td>\n";
 169        print "</tr>\n";
 170        $i++;
 171      }
 172    print "</table>";
 173    $db->free();
 174  }
 175  else 
 176  {
 177    print $db->error() . ' ' . $sql;
 178  }
 179  
 180  $db->close();
 181  
 182  llxFooter("<em>Derni&egrave;re modification $Date: 2005/11/07 09:05:39 $ r&eacute;vision $Revision: 1.6 $</em>");
 183  ?>


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