Nouveau fichier

This commit is contained in:
Rodolphe Quiedeville 2005-03-23 15:40:31 +00:00
parent 1f414d385b
commit 145236024d
14 changed files with 1195 additions and 0 deletions

View File

@ -0,0 +1,724 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 = '';
$dt = time();
$h = strftime("%H",$dt);
$m = strftime("%M",$dt);
$s = strftime("%S",$dt);
if ($_POST["action"] == 'add')
{
$ligne = new LigneAdsl($db);
$ligne->numero = $_POST["numero"];
$ligne->client = $_POST["client"];
$ligne->client_install = $_POST["client_install"];
$ligne->client_facture = $_POST["client_facture"];
$ligne->fournisseur = $_POST["fournisseur"];
$ligne->commercial = $_POST["commercial"];
$ligne->type = $_POST["type"];
$ligne->note = $_POST["note"];
if ( $ligne->create($user) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
else
{
$_GET["action"] = 'create_line';
$_GET["client"] = $_POST["client"];
}
}
if ($_GET["action"] == 'delete' && $user->rights->telephonie->adsl->creer)
{
$ligne = new LigneAdsl($db);
if ( $ligne->delete($_GET["id"]) == 0)
{
Header("Location: liste.php");
}
}
if ($_GET["action"] == 'ordertech')
{
$ligne = new LigneAdsl($db);
$ligne->fetch_by_id($_GET["id"]);
if ( $ligne->set_statut($user, 1) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'cancelordertech')
{
$ligne = new LigneAdsl($db);
$ligne->fetch_by_id($_GET["id"]);
if ( $ligne->set_statut($user, -1) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'refuse')
{
$ligne = new LigneAdsl($db);
$ligne->fetch_by_id($_GET["id"]);
$datea = $db->idate(mktime($h, $m , $s,
$_POST["remonth"],
$_POST["reday"],
$_POST["reyear"]));
if ( $ligne->set_statut($user, 7, $datea, $_POST["commentaire"]) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'resilier')
{
$ligne = new LigneAdsl($db);
$ligne->fetch_by_id($_GET["id"]);
if ( $ligne->set_statut($user, 4) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'annuleresilier')
{
$ligne = new LigneAdsl($db);
$ligne->fetch_by_id($_GET["id"]);
if ( $ligne->set_statut($user, 3) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'commandefourn' && $user->rights->telephonie->adsl->commander)
{
$ligne = new LigneAdsl($db);
$ligne->fetch_by_id($_GET["id"]);
$datea = $db->idate(mktime($h, $m , $s,
$_POST["remonth"],
$_POST["reday"],
$_POST["reyear"]));
if ( $ligne->set_statut($user, 2, $datea, $_POST["commentaire"]) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'activefourn' && $user->rights->telephonie->adsl->gerer)
{
$ligne = new LigneAdsl($db);
$ligne->fetch_by_id($_GET["id"]);
$datea = $db->idate(mktime($h, $m , $s,
$_POST["remonth"],
$_POST["reday"],
$_POST["reyear"]));
$ligne->update_info($_POST["ip"], $_POST["login"], $_POST["password"]);
if ( $ligne->set_statut($user, 3, $datea, $_POST["commentaire"]) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'livraison' && $user->rights->telephonie->adsl->gerer)
{
$ligne = new LigneAdsl($db);
$ligne->fetch_by_id($_GET["id"]);
$datea = $db->idate(mktime($h, $m , $s,
$_POST["remonth"],
$_POST["reday"],
$_POST["reyear"]));
if ( $ligne->set_statut($user, 4, $datea, $_POST["commentaire"]) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'acommander')
{
$ligne = new LigneAdsl($db);
$ligne->fetch_by_id($_GET["id"]);
if ( $ligne->set_statut($user, 1, '', $_POST["commentaire"]) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
$ligne = new LigneAdsl($db);
$ligne->id = $_GET["id"];
$ligne->numero = $_POST["numero"];
$ligne->client_comm = $_POST["client_comm"];
$ligne->client = $_POST["client"];
$ligne->client_facture = $_POST["client_facture"];
$ligne->fournisseur = $_POST["fournisseur"];
$ligne->commercial = $_POST["commercial"];
$ligne->concurrent = $_POST["concurrent"];
$ligne->remise = $_POST["remise"];
$ligne->note = $_POST["note"];
if ( $ligne->update($user) )
{
$action = '';
$mesg = 'Fiche mise à jour';
}
else
{
$action = 're-edit';
$mesg = 'Fiche non mise à jour !' . "<br>" . $entrepot->mesg_error;
}
}
llxHeader("","","Fiche Liaison");
if ($cancel == $langs->trans("Cancel"))
{
$action = '';
}
/*
* Création en 2 étape
*
*/
if ($_GET["action"] == 'create')
{
$form = new Form($db);
print_titre("Nouvelle liaison ADSL");
if (is_object($ligne))
{
// La création a échouée
print $ligne->error_message;
}
else
{
$ligne = new LigneAdsl($db);
}
print '<form action="fiche.php" method="GET">';
print '<input type="hidden" name="action" value="create_line">';
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="20%">Client</td><td >';
$ff = array();
$sql = "SELECT idp, nom, ville FROM ".MAIN_DB_PREFIX."societe WHERE client=1 ORDER BY nom ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
$ff[$row[0]] = stripslashes($row[1]) . " (".$row[2].")";
$i++;
}
}
$db->free();
}
$form->select_array("client",$ff,$ligne->client_comm);
print '</td></tr>';
print '<tr><td>&nbsp;</td><td><input type="submit" value="Créer"></td></tr>'."\n";
print '</table>'."\n";
print '</form>';
}
elseif ($_GET["action"] == 'create_line' && $_GET["client"] > 0)
{
$form = new Form($db);
print_titre("Nouvelle liaison ADSL");
if (is_object($ligne))
{
// La création a échouée
print '<div class="errormessage">'.$ligne->error_message.'</div>';
}
else
{
$ligne = new LigneAdsl($db);
$ligne->client_install_id = $_GET["client"];
$ligne->client_facture_id = $_GET["client"];
}
$socc = new Societe($db);
if ( $socc->fetch($_GET["client"]) == 1)
{
if (strlen($socc->code_client) == 0)
{
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="20%">Client</td><td >';
print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$socc->id.'">'.$socc->nom.'</a>';
print '</td></tr>';
print '<tr><td width="20%">Code client</td><td >';
print $socc->code_client;
print '</td></tr>';
print '</table><br /><br />';
print 'Impossible de créer une ligne pour cette société, vous devez au préalablement lui affecter un code client.';
}
elseif (strlen($socc->code_client) > 0 && $socc->check_codeclient() <> 0)
{
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="20%">Client</td><td >';
print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$socc->id.'">'.$socc->nom.'</a>';
print '</td></tr>';
print '<tr><td width="20%">Code client</td><td >';
print $socc->code_client;
print '</td></tr>';
print '</table><br /><br />';
print 'Le code client de cette société est incorrect, vous devez lui affecter un code client correct.';
}
else
{
print "<form action=\"fiche.php\" method=\"post\">\n";
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="client" value="'.$socc->id.'">'."\n";
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="20%">Client</td><td >';
print $socc->nom;
print '</td></tr>';
print '<tr><td width="20%">Code client</td><td >';
print $socc->code_client;
print '</td></tr>';
print '<tr><td width="20%">Numéro de la ligne téléphonique</td><td><input name="numero" size="12" value="'.$ligne->numero.'"></td></tr>';
print '<tr><td width="20%">Client (Agence/Filiale)</td><td >';
$ff = array();
$sql = "SELECT idp, nom, ville FROM ".MAIN_DB_PREFIX."societe WHERE client=1 ORDER BY nom ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row();
$ff[$row[0]] = stripslashes($row[1]) . " (".$row[2].")";
$i++;
}
}
$db->free();
}
$form->select_array("client_install",$ff,$ligne->client_install_id);
print " (Correspond à l'adresse d'installation)</td></tr>";
print '<tr><td width="20%">Client à facturer</td><td >';
$ff = array();
$sql = "SELECT idp, nom, ville FROM ".MAIN_DB_PREFIX."societe WHERE client=1 ORDER BY nom ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row();
$ff[$row[0]] = stripslashes($row[1]) . " (".$row[2].")";
$i++;
}
}
$db->free();
}
$form->select_array("client_facture",$ff,$ligne->client_facture_id);
print '</td></tr>';
/*
* Type
*/
print '<tr><td width="20%">Débit de la ligne</td><td >';
$ff = array();
$sql = "SELECT rowid, intitule FROM ".MAIN_DB_PREFIX."telephonie_adsl_type WHERE commande_active = 1 ORDER BY intitule ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row();
$ff[$row[0]] = $row[1];
$i++;
}
}
$db->free();
}
$form->select_array("type",$ff,$ligne->type);
print '</td></tr>';
/*
* Fournisseur
*/
print '<tr><td width="20%">Fournisseur</td><td >';
$ff = array();
$sql = "SELECT f.idp, f.nom FROM ".MAIN_DB_PREFIX."societe as f";
$sql .= " , ".MAIN_DB_PREFIX."telephonie_adsl_fournisseur as fa";
$sql .= " WHERE fa.commande_active = 1 AND fa.fk_soc = f.idp ORDER BY f.nom ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row();
$ff[$row[0]] = stripslashes($row[1]);
$i++;
}
}
$db->free();
}
else
{
print $db->error();
}
$form->select_array("fournisseur",$ff,$ligne->fournisseur);
print '</td></tr>';
/*
* Commercial
*/
print '<tr><td width="20%">Commercial</td><td >';
$ff = array();
$sql = "SELECT rowid, name, firstname FROM ".MAIN_DB_PREFIX."user ORDER BY name ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
$ff[$row[0]] = stripslashes($row[1]) . " " . stripslashes($row[2]);
$i++;
}
}
$db->free();
}
$form->select_array("commercial",$ff,$ligne->commercial);
print '</td></tr>';
print '<tr><td width="20%" valign="top">Note</td><td>'."\n";
print '<textarea name="note" rows="4" cols="50">'."\n";
print stripslashes($ligne->note);
print '</textarea></td></tr>'."\n";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Créer"></td></tr>'."\n";
print '</table>'."\n";
print '</form>';
}
}
else
{
print "Erreur";
}
}
else
{
if ($_GET["id"] or $_GET["numero"])
{
if ($_GET["action"] <> 're-edit')
{
$ligne = new LigneAdsl($db);
if ($_GET["id"])
{
$result = $ligne->fetch_by_id($_GET["id"]);
}
if ($_GET["numero"])
{
$result = $ligne->fetch($_GET["numero"]);
}
}
if ( $result )
{
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{
$h=0;
$head[$h][0] = DOL_URL_ROOT."/telephonie/adsl/fiche.php?id=".$ligne->id;
$head[$h][1] = $langs->trans("Liaison ADSL");
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/adsl/history.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Historique');
$h++;
dolibarr_fiche_head($head, $hselected, 'Liaison ADSL : '.$ligne->numero);
print_fiche_titre('Fiche Liaison ADSL', $mesg);
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
$client = new Societe($db, $ligne->client_id);
$client->fetch($ligne->client_id);
print '<tr><td width="20%">Client</td><td>';
print '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$client->id.'">';
print $client->nom.'</a></td><td>'.$client->code_client;
print '</td></tr>';
print '<tr><td width="20%">Numéro</td><td>'.dolibarr_print_phone($ligne->numero).'</td>';
print '<td>&nbsp;</td></tr>';
print '<tr><td width="20%">Débit de la liaison</td><td colspan="2">'.$ligne->type.'</td></tr>';
$client_install = new Societe($db, $ligne->client_install_id);
$client_install->fetch($ligne->client_install_id);
print '<tr><td width="20%">Client (Agence/Filiale)</td><td colspan="2">';
print $client_install->nom.'<br />';
print $client_install->cp . " " .$client_install->ville;
print '</td></tr>';
$client_facture = new Societe($db);
$client_facture->fetch($ligne->client_facture_id);
print '<tr><td width="20%">Client Facturé</td><td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid=';
print $client_facture->id.'">';
print $client_facture->nom.'</a><br />';
print $client_facture->cp . " " .$client_facture->ville;
print '</td><td>';
if ($ligne->mode_paiement == 'pre')
{
print 'RIB : '.$client_facture->display_rib();
}
else
{
print 'Paiement par virement';
}
print '</td></tr>';
$commercial = new User($db, $ligne->commercial_id);
$commercial->fetch();
print '<tr><td width="20%">Commercial</td>';
print '<td colspan="2">'.$commercial->fullname.'</td></tr>';
if ( $user->rights->telephonie->adsl->gerer)
{
print '<tr><td width="20%">IP</td><td colspan="2">'.$ligne->ip.'</td></tr>';
print '<tr><td width="20%">Login</td><td colspan="2">'.$ligne->login.'</td></tr>';
print '<tr><td width="20%">Password</td><td colspan="2">'.$ligne->password.'</td></tr>';
}
print '<tr><td width="20%">Statut</td><td colspan="2">';
print '<img src="./statut'.$ligne->statut.'.png">&nbsp;';
print $ligne->statuts[$ligne->statut];
print '</td></tr>';
print "</table>";
}
print '</div>';
}
}
else
{
print "Error";
}
}
if ( $user->rights->telephonie->adsl->commander && $ligne->statut == 1)
{
/**
*
*/
$form = new Form($db);
print '<table class="noborder" cellpadding="2" cellspacing="0" width="100%"><tr><td>';
print '<form action="fiche.php?id='.$ligne->id.'&amp;action=commandefourn" method="POST">';
print '<table class="noborder" cellpadding="2" cellspacing="0">';
print '<tr class="liste_titre"><td colspan="2">Commande chez le fournisseur</td><td>';
print '<tr><td>Date de la commande</td><td>';
print $form->select_date();
print '</td>';
print '<td colspan="2"><input type="submit" name="Commander"></td></tr>';
print '<tr><td colspan="3">Commentaire <input size="30" type="text" name="commentaire"></td></tr>';
print '</table>';
print '</form></td><td>';
print '&nbsp;</td></tr></table>';
}
if ( $user->rights->telephonie->adsl->gerer && $ligne->statut == 2)
{
/**
*
*/
$form = new Form($db);
print '<table class="noborder" cellpadding="2" cellspacing="0" width="100%"><tr><td>';
print '<form action="fiche.php?id='.$ligne->id.'&amp;action=activefourn" method="POST">';
print '<table class="noborder" cellpadding="2" cellspacing="0">';
print '<tr class="liste_titre"><td colspan="2">Activée chez le fournisseur</td><td>';
print "<tr><td>Date de l'activation</td><td>";
print $form->select_date();
print '</td></tr>';
print '<tr><td>Commentaire</td><td><input size="30" type="text" name="commentaire"></td></tr>';
print '<tr><td>Adresse IP affectée</td><td><input size="30" type="text" name="ip"></td></tr>';
print '<tr><td>Login</td><td><input size="30" type="text" name="login"></td></tr>';
print '<tr><td>Password</td><td><input size="30" type="text" name="password"></td></tr>';
print '<tr><td colspan="2"><input type="submit" name="Commander"></td></tr>';
print '</table>';
print '</form></td><td>';
print '&nbsp;</td></tr></table>';
}
if ( $user->rights->telephonie->adsl->gerer && $ligne->statut == 3)
{
/**
*
*/
$form = new Form($db);
print '<table class="noborder" cellpadding="2" cellspacing="0" width="100%"><tr><td>';
print '<form action="fiche.php?id='.$ligne->id.'&amp;action=livraison" method="POST">';
print '<table class="noborder" cellpadding="2" cellspacing="0">';
print '<tr class="liste_titre"><td colspan="2">Livrée au client</td><td>';
print "<tr><td>Date de la livraison client</td><td>";
print $form->select_date();
print '</td>';
print '<td colspan="2"><input type="submit" name="Commander"></td></tr>';
print '<tr><td colspan="3">Commentaire <input size="30" type="text" name="commentaire"></td></tr>';
print '</table>';
print '</form></td><td>';
print '&nbsp;</td></tr></table>';
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print "\n<br>\n<div class=\"tabsAction\">\n";
if ($_GET["action"] == '')
{
if ( $user->rights->telephonie->adsl->requete && $ligne->statut == -1)
{
print "<a class=\"tabAction\" href=\"fiche.php?action=ordertech&amp;id=$ligne->id\">".$langs->trans("Commander")."</a>";
}
if ( $user->rights->telephonie->adsl->requete && $ligne->statut == 1)
{
print "<a class=\"tabAction\" href=\"fiche.php?action=cancelordertech&amp;id=$ligne->id\">".$langs->trans("Annuler la commande")."</a>";
}
if ( $user->rights->telephonie->adsl->creer && $ligne->statut == -1)
{
print "<a class=\"tabAction\" href=\"fiche.php?action=delete&amp;id=$ligne->id\">".$langs->trans("Delete")."</a>";
}
}
print "</div>";
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,137 @@
<?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 = '';
llxHeader("","","Historique Liaison ADSL");
/*
* Affichage
*
*/
if ($_GET["id"])
{
if ($_GET["action"] <> 're-edit')
{
$ligne = new LigneADSL($db);
$result = $ligne->fetch_by_id($_GET["id"]);
}
if ( $result )
{
$h=0;
$head[$h][0] = DOL_URL_ROOT."/telephonie/adsl/fiche.php?id=".$ligne->id;
$head[$h][1] = $langs->trans("Liaison ADSL");
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/adsl/history.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Historique');
$hselected = $h;
$h++;
dolibarr_fiche_head($head, $hselected, 'Liaison ADSL : '.$ligne->numero);
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="20%">Numéro</td><td>'.dolibarr_print_phone($ligne->numero).'</td></tr>';
$client = new Societe($db, $ligne->client_id);
$client->fetch($ligne->client_id);
print '<tr><td width="20%">Client</td><td>'.$client->nom.'</td></tr>';
print '<tr><td width="20%">Statut</td><td>';
print '<img src="./statut'.$ligne->statut.'.png">&nbsp;';
print $ligne->statuts[$ligne->statut];
print '</td></tr>';
/* Contacts */
$sql = "SELECT ".$db->pdate("l.tms").", l.statut, l.fk_user, u.name, u.firstname, l.comment";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne_statut as l";
$sql .= ",".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.rowid = l.fk_user AND l.fk_ligne = ".$ligne->id;
$sql .= " ORDER BY l.tms DESC ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<tr><td valign="top" width="20%">'.strftime("%a %d %B %Y %H:%M:%S",$row[0]).'</td>';
print '<td><img src="./statut'.$row[1].'.png">&nbsp;';
print $ligne->statuts[$row[1]];
if ($row[5])
{
print '<br />'.$row[5];
}
print '</td><td colspan="2">'.$row[4] . " " . $row[3] . "</td></tr>";
$i++;
}
}
$db->free();
}
else
{
print $sql;
}
/* Fin Contacts */
print "</table>";
}
/*
*
*
*
*/
}
else
{
print "Error";
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,121 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="30%" valign="top">';
print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/adsl/liste.php">';
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>Recherche ligne</td>';
print "</tr>\n";
print "<tr $bc[1]>";
print '<td>Numéro <input name="search_ligne" size="12"></td></tr>';
print '</table>';
print '<br />';
$sql = "SELECT distinct statut, count(*) as cc";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne as l";
$sql .= " GROUP BY statut";
if ($db->query($sql))
{
$num = $db->num_rows();
$i = 0;
$ligne = new LigneAdsl($db);
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>Liaisons Statuts</td><td valign="center">Nb</td>';
print "<td>&nbsp;</td></tr>\n";
$var=True;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object();
$values[$obj->statut] = $obj->cc;
$i++;
}
foreach ($ligne->statuts as $key => $statut)
{
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".$statut."</td>\n";
print "<td>".$values[$key]."</td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/telephonie/adsl/liste.php?statut='.$key.'"><img border="0" src="./statut'.$key.'.png"></a></td>';
print "</tr>\n";
}
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
print '<br />';
/*
*
*
*/
print '</td><td width="70%" valign="top">';
print '</td></tr>';
print '</table>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,165 @@
<?PHP
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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 la.rowid, fk_client, s.nom as nom, la.numero_ligne, la.statut, t.intitule";
$sql .= " , s.idp";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne as la";
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " , ".MAIN_DB_PREFIX."telephonie_adsl_type as t";
$sql .= " WHERE la.fk_client = s.idp";
$sql .= " AND t.rowid = la.fk_type";
if ($_GET["search_ligne"])
{
$sel =urldecode($_GET["search_ligne"]);
$sel = ereg_replace("\.","",$sel);
$sel = ereg_replace(" ","",$sel);
$sql .= " AND la.numero_ligne LIKE '%".$sel."%'";
}
if ($_GET["search_client"])
{
$sel =urldecode($_GET["search_client"]);
$sql .= " AND s.nom LIKE '%".$sel."%'";
}
if (strlen($_GET["statut"]))
{
$sql .= " AND la.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= "&amp;statut=".$_GET["statut"];
print_barre_liste("Liaisons ADSL", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Ligne","liste.php","l.ligne");
print_liste_field_titre("Client","liste.php","s.nom");
print '<td>Type</td>';
print '<td align="center">Statut</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="liste.php" method="GET">';
print '<td><input type="text" name="search_ligne" value="'. $_GET["search_ligne"].'" size="10"></td>';
print '<td><input type="text" name="search_client" value="'. $_GET["search_client"].'" size="10"></td>';
print '<td>&nbsp;</td>';
print '<td><input type="submit" value="Chercher"></td>';
print '</form>';
print '</tr>';
$var=True;
$ligne = new LigneAdsl($db);
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($i);
$var=!$var;
print "<tr $bc[$var]><td>";
print '<img src="./statut'.$obj->statut.'.png">&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/telephonie/adsl/fiche.php?id='.$obj->rowid.'">';
print img_file();
print '</a>&nbsp;';
print '<a href="fiche.php?id='.$obj->rowid.'">'.dolibarr_print_phone($obj->numero_ligne)."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("Fiche Compta"),"bill")."</a> ";
print '&nbsp;<a href="'.DOL_URL_ROOT.'/telephonie/comm/fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
print '<td>'.$obj->intitule.'</td>';
print '<td align="center">'.$ligne->statuts[$obj->statut]."</td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,48 @@
<?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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/adsl/ligneadsl.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/adsl/index.php", "ADSL");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/adsl/liste.php", "Liste");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/adsl/fiche.php?action=create", "Nouvelle liaison");
$menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie");
left_menu($menu->liste);
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B