* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ * */ require("./pre.inc.php"); $mesg_erreur = ""; $page = $_GET["page"]; $sortorder = $_GET["sortorder"]; $sortfield = $_GET["sortfield"]; if ($user->rights->telephonie->ligne_commander) { if ($_GET["action"] == "create" && $_GET["fournid"] > 0) { $fourn = new FournisseurTelephonie($db); $result = $fourn->fetch($_GET["fournid"]); if ($result == 0) { $result = $fourn->CreateCommande($user); } } } llxHeader("","Telephonie - Ligne - Commande"); print $mesg_erreur; /* * Sécurité accés client */ if ($user->societe_id > 0) { $action = ''; $socid = $user->societe_id; } /* * Mode Liste * * * */ $sql = "SELECT count(l.ligne), f.rowid, f.nom, f.commande_bloque"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= ",".MAIN_DB_PREFIX."telephonie_fournisseur as f"; $sql .= ",".MAIN_DB_PREFIX."societe as sf"; $sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid "; $sql .= " AND l.statut IN (1,4,8) "; $sql .= " AND l.fk_soc_facture = sf.rowid"; $sql .= " GROUP BY f.rowid, f.nom ASC"; $result = $db->query($sql); if ($result) { $num = $db->num_rows(); $i = 0; print_barre_liste("Commande", $page, "liste.php", "", $sortfield, $sortorder, '', $num); print ''; print ''; print ''; print "\n"; $var=True; $ligne = new LigneTel($db); while ($i < $num) { $row = $db->fetch_row(); $var=!$var; $fournisseur = new FournisseurTelephonie($db); $fournisseur->fetch($row[1]); print ""; print ''; print '\n"; print '\n"; $i++; } print "
FournisseurNb Lignes Email envoyé à
'.$row[2].''.$row[0]."'; if ($row[3] == 1) { print "Les commandes sont bloquées"; } else { print 'Créer la commande'; } print "\n"; print $fournisseur->email_commande; print "

"; $db->free(); } else { print $db->error() . ' ' . $sql; } /* * * */ $sql = "SELECT sf.rowid as sfidp, sf.nom as sfnom, s.rowid as socid, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; $sql .= " , ".MAIN_DB_PREFIX."societe as sf"; $sql .= " WHERE l.fk_soc = s.rowid AND l.fk_fournisseur = f.rowid"; $sql .= " AND l.statut IN (1,4,8) "; $sql .= " AND l.fk_soc_facture = sf.rowid"; $sql .= " ORDER BY s.nom ASC "; if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; print ''; print ''; print "\n"; $var=True; $ligne = new LigneTel($db); while ($i < $num) { $obj = $db->fetch_object($i); $var=!$var; $socf = new Societe($db); $socf->fetch($obj->sfidp); print ""; print '\n"; print '\n"; print ''; print ''; print ''; print "\n"; print "\n"; $i++; } print "
Ligne'; print 'StatutClient'; print 'Client FacturéRib OKFournisseur
'.dolibarr_print_phone($obj->ligne)."'.$ligne->statuts[$obj->statut]."'.$obj->nom.''.$obj->sfnom.''.$socf->verif_rib().'".$obj->fournisseur."
"; $db->free(); } else { print $db->error() . ' ' . $sql; } $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>