diff --git a/htdocs/telephonie/client/index.php b/htdocs/telephonie/client/index.php
new file mode 100644
index 00000000000..b3603e36cb8
--- /dev/null
+++ b/htdocs/telephonie/client/index.php
@@ -0,0 +1,175 @@
+
+ *
+ * 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");
+
+$page = $_GET["page"];
+$sortorder = $_GET["sortorder"];
+
+if (!$user->rights->telephonie->lire)
+ accessforbidden();
+
+llxHeader('','Telephonie - Ligne');
+
+/*
+ * Sécurité accés client
+ */
+if ($user->societe_id > 0)
+{
+ $action = '';
+ $socidp = $user->societe_id;
+}
+
+/*
+ * Mode Liste
+ *
+ *
+ *
+ */
+
+print '
';
+
+print '
';
+
+print '
';
+
+
+
+print '
';
+
+
+/*
+ * Liste
+ *
+ */
+
+$sql = "SELECT s.idp as socidp, s.nom, count(l.ligne) as ligne";
+$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
+
+$sql .= " WHERE l.fk_client_comm = s.idp ";
+
+if ($_GET["search_client"])
+{
+ $sel = urldecode($_GET["search_client"]);
+ $sql .= " AND s.nom LIKE '%".$sel."%'";
+}
+
+$sql .= " GROUP BY s.idp";
+
+$sql .= " ORDER BY s.datec DESC LIMIT 15";
+
+$result = $db->query($sql);
+if ($result)
+{
+ $num = $db->num_rows();
+ $i = 0;
+
+ print '
';
+
+
+
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/telephonie/client/liste.php b/htdocs/telephonie/client/liste.php
new file mode 100644
index 00000000000..a02078ff9ce
--- /dev/null
+++ b/htdocs/telephonie/client/liste.php
@@ -0,0 +1,145 @@
+
+ *
+ * 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");
+
+
+$page = $_GET["page"];
+$sortorder = $_GET["sortorder"];
+$sortfield = $_GET["sortfield"];
+
+llxHeader('','Telephonie - Ligne - Liste');
+/*
+ * Sécurité accés client
+ */
+if ($user->societe_id > 0)
+{
+ $action = '';
+ $socidp = $user->societe_id;
+}
+
+if ($sortorder == "") {
+ $sortorder="ASC";
+}
+if ($sortfield == "") {
+ $sortfield="s.nom";
+}
+
+/*
+ * Recherche
+ *
+ *
+ */
+
+if ($page == -1) { $page = 0 ; }
+
+$offset = $conf->liste_limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+/*
+ * Mode Liste
+ *
+ *
+ *
+ */
+
+
+
+$sql = "SELECT s.idp as socidp, s.nom, count(l.ligne) as ligne, cs.ca";
+$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
+
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."telephonie_client_stats as cs ON s.idp=cs.fk_client_comm";
+
+$sql .= " WHERE l.fk_client_comm = s.idp ";
+
+if ($_GET["search_client"])
+{
+ $sel = urldecode($_GET["search_client"]);
+ $sql .= " AND s.nom LIKE '%".$sel."%'";
+}
+
+$sql .= " GROUP BY s.idp";
+
+$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
+
+$result = $db->query($sql);
+if ($result)
+{
+ $num = $db->num_rows();
+ $i = 0;
+
+ $urladd= "&statut=".$_GET["statut"];
+
+ print_barre_liste("Clients", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num);
+
+ print '
";
+ $db->free();
+}
+else
+{
+ print $db->error() . ' ' . $sql;
+}
+
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/telephonie/client/pre.inc.php b/htdocs/telephonie/client/pre.inc.php
new file mode 100644
index 00000000000..3cd845857e4
--- /dev/null
+++ b/htdocs/telephonie/client/pre.inc.php
@@ -0,0 +1,63 @@
+
+ *
+ * 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("../../main.inc.php");
+require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php");
+
+$user->getrights('telephonie');
+
+function llxHeader($head = "", $title="") {
+ global $user, $conf;
+
+ /*
+ *
+ *
+ */
+ top_menu($head, $title);
+
+ $menu = new Menu();
+
+ $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/client/liste.php", "Liste");
+
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/client/rapports", "Rapports");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs");
+
+ left_menu($menu->liste);
+}
+
+?>
diff --git a/htdocs/telephonie/facture/index.php b/htdocs/telephonie/facture/index.php
new file mode 100644
index 00000000000..3a694edf7f8
--- /dev/null
+++ b/htdocs/telephonie/facture/index.php
@@ -0,0 +1,129 @@
+
+ *
+ * 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");
+
+$page = $_GET["page"];
+$sortorder = $_GET["sortorder"];
+
+if (!$user->rights->telephonie->lire)
+ accessforbidden();
+
+llxHeader('','Telephonie');
+
+/*
+ * Sécurité accés client
+ */
+if ($user->societe_id > 0)
+{
+ $action = '';
+ $socidp = $user->societe_id;
+}
+
+/*
+ * Mode Liste
+ *
+ *
+ *
+ */
+
+print '
';
+
+print '
';
+
+print '
';
+
+print '';
+
+print '
';
+
+
+print '
';
+/*
+ *
+ *
+ */
+
+$sql = "SELECT date_format(f.datef,'%Y%m'),sum(f.total_ttc)";
+$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as tf";
+$sql .= " , ".MAIN_DB_PREFIX."facture as f";
+
+$sql .= " WHERE tf.fk_facture = f.rowid";
+$sql .= " GROUP BY date_format(f.datef,'%Y%m')";
+
+if ($db->query($sql))
+{
+ $num = $db->num_rows();
+ $i = 0;
+ $ligne = new LigneTel($db);
+
+ print '
';
+
+
+
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/telephonie/facture/pre.inc.php b/htdocs/telephonie/facture/pre.inc.php
new file mode 100644
index 00000000000..6a52f0cc74b
--- /dev/null
+++ b/htdocs/telephonie/facture/pre.inc.php
@@ -0,0 +1,66 @@
+
+ *
+ * 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("../../main.inc.php");
+require DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php";
+require DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php";
+
+$user->getrights('telephonie');
+
+function llxHeader($head = "", $title="") {
+ global $user, $conf;
+
+ /*
+ *
+ *
+ */
+ top_menu($head, $title);
+
+ $menu = new Menu();
+
+ $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commande");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/facture/index.php", "Factures");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/liste.php", "Liste");
+ // $menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/xls.php", "Excel");
+ //$menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/stat.php", "Statistiques");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/check.php", "Verif");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/stats.php", "Stats");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/statca/", "Chiffre d'affaire");
+
+ left_menu($menu->liste);
+}
+
+?>
diff --git a/htdocs/telephonie/fournisseurs.php b/htdocs/telephonie/fournisseurs.php
new file mode 100644
index 00000000000..789f6583440
--- /dev/null
+++ b/htdocs/telephonie/fournisseurs.php
@@ -0,0 +1,108 @@
+
+ *
+ * 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");
+
+$user->getrights('telephonie');
+
+
+
+$page = $_GET["page"];
+$sortorder = $_GET["sortorder"];
+
+llxHeader();
+
+if (!$user->rights->telephonie->lire)
+ accessforbidden();
+
+/*
+ * Sécurité accés client
+ */
+if ($user->societe_id > 0)
+{
+ $action = '';
+ $socidp = $user->societe_id;
+}
+
+if ($sortorder == "") {
+ $sortorder="ASC";
+}
+if ($sortfield == "") {
+ $sortfield="f.nom";
+}
+
+if ($page == -1) { $page = 0 ; }
+
+$offset = $conf->liste_limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+/*
+ * Mode Liste
+ *
+ *
+ *
+ */
+
+$sql = "SELECT f.nom, f.email_commande";
+$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
+
+$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
+
+$result = $db->query($sql);
+if ($result)
+{
+ $num = $db->num_rows();
+ $i = 0;
+
+ print_barre_liste("Fournisseurs", $page, "fournisseurs.php", "", $sortfield, $sortorder, '', $num);
+
+ print '
";
+
+
+
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/telephonie/ligne/index.php b/htdocs/telephonie/ligne/index.php
new file mode 100644
index 00000000000..a0ef39bda9f
--- /dev/null
+++ b/htdocs/telephonie/ligne/index.php
@@ -0,0 +1,201 @@
+
+ *
+ * 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");
+
+$page = $_GET["page"];
+$sortorder = $_GET["sortorder"];
+
+if (!$user->rights->telephonie->lire)
+ accessforbidden();
+
+llxHeader('','Telephonie - Ligne');
+
+/*
+ * Sécurité accés client
+ */
+if ($user->societe_id > 0)
+{
+ $action = '';
+ $socidp = $user->societe_id;
+}
+
+/*
+ * Mode Liste
+ *
+ *
+ *
+ */
+
+print '
';
+
+print '
';
+
+print '
';
+
+
+
+print '
';
+
+print '
';
+print '
';
+print '';
+
+print '
';
+
+
+print '
';
+
+
+
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/telephonie/ligne/liste.php b/htdocs/telephonie/ligne/liste.php
new file mode 100644
index 00000000000..3580dfb7355
--- /dev/null
+++ b/htdocs/telephonie/ligne/liste.php
@@ -0,0 +1,179 @@
+
+ *
+ * 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");
+
+$page = $_GET["page"];
+$sortorder = $_GET["sortorder"];
+$sortfield = $_GET["sortfield"];
+
+llxHeader('','Telephonie - Ligne - Liste');
+/*
+ * Sécurité accés client
+ */
+if ($user->societe_id > 0)
+{
+ $action = '';
+ $socidp = $user->societe_id;
+}
+
+if ($sortorder == "") {
+ $sortorder="ASC";
+}
+if ($sortfield == "") {
+ $sortfield="l.statut";
+}
+
+/*
+ * Recherche
+ *
+ *
+ */
+
+if ($page == -1) { $page = 0 ; }
+
+$offset = $conf->liste_limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+/*
+ * Mode Liste
+ *
+ *
+ *
+ */
+
+$sql = "SELECT s.idp as socidp, sf.idp as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise";
+$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
+$sql .= " , ".MAIN_DB_PREFIX."societe as sf";
+$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
+$sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid";
+$sql .= " AND l.fk_soc_facture = sf.idp";
+
+if ($_GET["search_ligne"])
+{
+ $sel =urldecode($_GET["search_ligne"]);
+ $sel = ereg_replace("\.","",$sel);
+ $sel = ereg_replace(" ","",$sel);
+ $sql .= " AND l.ligne LIKE '%".$sel."%'";
+}
+
+if ($_GET["search_client"])
+{
+ $sel =urldecode($_GET["search_client"]);
+ $sql .= " AND s.nom LIKE '%".$sel."%'";
+}
+
+if ($_GET["search_client_facture"])
+{
+ $sel =urldecode($_GET["search_client_facture"]);
+ $sql .= " AND sf.nom LIKE '%".$sel."%'";
+}
+
+if (strlen($_GET["statut"]))
+{
+ $sql .= " AND l.statut = ".$_GET["statut"];
+}
+
+$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
+
+$result = $db->query($sql);
+if ($result)
+{
+ $num = $db->num_rows();
+ $i = 0;
+
+ $urladd= "&statut=".$_GET["statut"];
+
+ print_barre_liste("Lignes", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num);
+ print"\n\n";
+ print '
";
+ $db->free();
+}
+else
+{
+ print $db->error() . ' ' . $sql;
+}
+
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/telephonie/ligne/listecommande.php b/htdocs/telephonie/ligne/listecommande.php
new file mode 100644
index 00000000000..155552fc140
--- /dev/null
+++ b/htdocs/telephonie/ligne/listecommande.php
@@ -0,0 +1,159 @@
+
+ *
+ * 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");
+
+
+$page = $_GET["page"];
+$sortorder = $_GET["sortorder"];
+$sortfield = $_GET["sortfield"];
+
+llxHeader('','Telephonie - Ligne - Liste');
+/*
+ * Sécurité accés client
+ */
+if ($user->societe_id > 0)
+{
+ $action = '';
+ $socidp = $user->societe_id;
+}
+
+if ($sortorder == "") {
+ $sortorder="ASC";
+}
+if ($sortfield == "") {
+ $sortfield="l.date_commande";
+}
+
+/*
+ * Recherche
+ *
+ *
+ */
+
+if ($page == -1) { $page = 0 ; }
+
+$offset = $conf->liste_limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+/*
+ * Mode Liste
+ *
+ *
+ *
+ */
+
+$sql = "SELECT s.idp as socidp, l.date_commande, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise";
+$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
+$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
+$sql .= " WHERE l.statut = 2 AND l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid";
+
+if ($_GET["search_ligne"])
+{
+ $sel =urldecode($_GET["search_ligne"]);
+ $sel = ereg_replace("\.","",$sel);
+ $sel = ereg_replace(" ","",$sel);
+ $sql .= " AND l.ligne LIKE '%".$sel."%'";
+}
+
+if ($_GET["search_client"])
+{
+ $sel =urldecode($_GET["search_client"]);
+ $sql .= " AND s.nom LIKE '%".$sel."%'";
+}
+
+$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
+
+$result = $db->query($sql);
+if ($result)
+{
+ $num = $db->num_rows();
+ $i = 0;
+
+ print_barre_liste("Lignes", $page, "listecommande.php", "", $sortfield, $sortorder, '', $num);
+
+ print '
";
+ $db->free();
+}
+else
+{
+ print $db->error() . ' ' . $sql;
+}
+
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/telephonie/ligne/pre.inc.php b/htdocs/telephonie/ligne/pre.inc.php
new file mode 100644
index 00000000000..25aea825175
--- /dev/null
+++ b/htdocs/telephonie/ligne/pre.inc.php
@@ -0,0 +1,68 @@
+
+ *
+ * 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("../../main.inc.php");
+require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php");
+
+$user->getrights('telephonie');
+
+function llxHeader($head = "", $title="") {
+ global $user, $conf;
+
+ /*
+ *
+ *
+ */
+ top_menu($head, $title);
+
+ $menu = new Menu();
+
+ $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/liste.php", "Liste");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/fiche.php?action=create", "Nouvelle ligne");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/listecommande.php", "En commande");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/communications.php", "Communications");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/groupe.php", "Groupes");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/numdata.php", "Numéros data");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/statca/", "Chiffre d'affaire");
+
+ left_menu($menu->liste);
+}
+
+?>
diff --git a/htdocs/telephonie/tarifs/index.php b/htdocs/telephonie/tarifs/index.php
new file mode 100644
index 00000000000..67d6b369d0f
--- /dev/null
+++ b/htdocs/telephonie/tarifs/index.php
@@ -0,0 +1,153 @@
+
+ *
+ * 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");
+
+
+$page = $_GET["page"];
+$sortorder = $_GET["sortorder"];
+$sortfield = $_GET["sortfield"];
+
+llxHeader();
+
+if ($_GET["type"] == '')
+{
+ $_GET["type"] = 'achat';
+}
+
+/*
+ * Sécurité accés client
+ */
+if ($user->societe_id > 0)
+{
+ $action = '';
+ $socidp = $user->societe_id;
+}
+
+if ($sortorder == "")
+{
+ $sortorder="ASC";
+}
+if ($sortfield == "")
+{
+ $sortfield="libelle";
+}
+
+/*
+ * Recherche
+ *
+ *
+ */
+if ($mode == 'search') {
+ if ($mode-search == 'soc') {
+ $sql = "SELECT s.idp FROM ".MAIN_DB_PREFIX."societe as s ";
+ $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'";
+ }
+
+ if ( $db->query($sql) ) {
+ if ( $db->num_rows() == 1) {
+ $obj = $db->fetch_object(0);
+ $socid = $obj->idp;
+ }
+ $db->free();
+ }
+}
+
+if ($page == -1) { $page = 0 ; }
+
+$offset = $conf->liste_limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+/*
+ * Mode Liste
+ *
+ *
+ *
+ */
+
+$sql = "SELECT distinct(t.libelle) as libelle, temporel ,t.fixe";
+$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_vente as t";
+$sql .= " WHERE 1=1";
+
+if ($_GET["search_libelle"])
+{
+ $sqlc .=" AND t.libelle LIKE '%".$_GET["search_libelle"]."%'";
+}
+
+$sql = $sql . $sqlc . " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
+
+
+
+$result = $db->query($sql);
+if ($result)
+{
+ $num = $db->num_rows();
+ $i = 0;
+
+ print_barre_liste("Tarifs à la vente", $page, "index.php", "&type=".$_GET["type"], $sortfield, $sortorder, '', $num);
+
+ print '
";
+ $db->free();
+}
+else
+{
+ print $db->error() . ' ' . $sql;
+}
+
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/telephonie/tarifs/pre.inc.php b/htdocs/telephonie/tarifs/pre.inc.php
new file mode 100644
index 00000000000..3b6873fc183
--- /dev/null
+++ b/htdocs/telephonie/tarifs/pre.inc.php
@@ -0,0 +1,68 @@
+
+ *
+ * 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("../../main.inc.php");
+
+$user->getrights('telephonie');
+
+function llxHeader($head = "", $title="") {
+ global $user, $conf;
+
+ /*
+ *
+ *
+ */
+ top_menu($head, $title);
+
+ $menu = new Menu();
+
+ $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/tarifs/achat.php", "Achat");
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/tarifs/prefix.php", "Prefix");
+
+ /*
+ $menu->add_submenu(DOL_URL_ROOT."/telephonie/tarifs/liste.php?type=achat", "Achat");
+
+
+*/
+
+ $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques");
+
+ $menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs");
+
+
+ left_menu($menu->liste);
+}
+
+?>