diff --git a/htdocs/telephonie/ligne/history.php b/htdocs/telephonie/ligne/history.php index 437b8252f86..f76a27ed6de 100644 --- a/htdocs/telephonie/ligne/history.php +++ b/htdocs/telephonie/ligne/history.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2005 Rodolphe Quiedeville * * 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 @@ -22,120 +22,9 @@ require("./pre.inc.php"); - $mesg = ''; - -if ($_POST["action"] == 'add') -{ - $ligne = new LigneTel($db); - - $ligne->numero = $_POST["numero"]; - $ligne->client = $_POST["client"]; - $ligne->client_facture = $_POST["client_facture"]; - $ligne->fournisseur = $_POST["fournisseur"]; - $ligne->commercial = $_POST["commercial"]; - $ligne->remise = $_POST["remise"]; - $ligne->note = $_POST["note"]; - - - if ( $ligne->create($user) ) - { - Header("Location: fiche.php?id=".$ligne->id); - } - -} - -if ($_POST["action"] == 'addcontact') -{ - $ligne = new LigneTel($db); - $ligne->id = $_GET["id"]; - - if ( $ligne->add_contact($_POST["contact_id"]) ) - { - Header("Location: fiche.php?id=".$ligne->id); - } - -} - - -if ($_GET["action"] == 'delcontact') -{ - $ligne = new LigneTel($db); - $ligne->id = $_GET["id"]; - - if ( $ligne->del_contact($_GET["contact_id"]) ) - { - Header("Location: fiche.php?id=".$ligne->id); - } - -} - -if ($_GET["action"] == 'active') -{ - $ligne = new LigneTel($db); - $ligne->id = $_GET["id"]; - - if ( $ligne->set_statut($user, 3) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } - -} - -if ($_GET["action"] == 'resilier') -{ - $ligne = new LigneTel($db); - $ligne->id = $_GET["id"]; - - if ( $ligne->set_statut($user, 4) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - -if ($_GET["action"] == 'annuleresilier') -{ - $ligne = new LigneTel($db); - $ligne->id = $_GET["id"]; - - if ( $ligne->set_statut($user, 3) == 0) - { - Header("Location: fiche.php?id=".$ligne->id); - } -} - - - - -if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) -{ - $ligne = new LigneTel($db); - $ligne->id = $_GET["id"]; - - $ligne->numero = $_POST["numero"]; - $ligne->client = $_POST["client"]; - $ligne->client_facture = $_POST["client_facture"]; - $ligne->fournisseur = $_POST["fournisseur"]; - $ligne->commercial = $_POST["commercial"]; - $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 !' . "
" . $entrepot->mesg_error; - } -} - - -llxHeader("","","Fiche Ligne"); +llxHeader("","","Historique Ligne"); if ($cancel == $langs->trans("Cancel")) { @@ -145,125 +34,7 @@ if ($cancel == $langs->trans("Cancel")) * Affichage * */ -/* - * Création - * - */ -if ($_GET["action"] == 'create') -{ - $ligne = new LigneTel($db); - print "
\n"; - print ''; - print ''."\n"; - print_titre("Nouvelle ligne"); - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - - print ''; - - print '"; - - print ''; - print '
Numéro
Client'; - print '
Client à facturer'; - print '
Fournisseur'; - print '
Commercial'; - print '
Remise %
Note'; - print '
 
'; - print '
'; -} -else -{ if ($_GET["id"] or $_GET["numero"]) { if ($_GET["action"] <> 're-edit') @@ -288,6 +59,10 @@ else $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id; $head[$h][1] = $langs->trans("Ligne"); $h++; + + $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id; + $head[$h][1] = $langs->trans('Factures'); + $h++; $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id; $head[$h][1] = $langs->trans('Infos'); @@ -302,32 +77,40 @@ else $head[$h][1] = $langs->trans('Conso'); $h++; + $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id; + $head[$h][1] = $langs->trans('Stats'); + $h++; + dolibarr_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero); print_fiche_titre('Fiche Ligne', $mesg); print ''; - print ''; - print ''; + print ''; $client = new Societe($db, $ligne->client_id); $client->fetch($ligne->client_id); - print ''; + $client_comm = new Societe($db, $ligne->client_comm_id); + $client_comm->fetch($ligne->client_comm_id); - $client_facture = new Societe($db); - $client_facture->fetch($ligne->client_facture_id); + print ''; - print ''; - - - print ''; - /* Contacts */ + print ''; + print ''; + print ''; + print ''; + print ''; + + /* historique */ $sql = "SELECT ".$db->pdate("l.tms").", l.statut, l.fk_user, u.name, u.firstname, l.comment"; $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut as l"; @@ -353,7 +136,7 @@ else print '
'.$row[5]; } - print '"; + print '"; $i++; } } @@ -364,44 +147,65 @@ else print $sql; } - /* Fin Contacts */ - - if ($_GET["action"] <> 'edit' && 0) - { - print ''; - } - print "
Numéro'.dolibarr_print_phone($ligne->numero).'Facturée : '.$ligne->facturable.' 
Numéro'.dolibarr_print_phone($ligne->numero).'
Client'.$client->nom.'
Client'; + print ''; + print $client_comm->nom.'
Client Facturé'.$client_facture->nom.'
Statut'; + print '
Statut actuel'; print ' '; print $ligne->statuts[$ligne->statut]; print '
DateStatutRapporteur
'.$row[4] . " " . $row[3] . "
'.$row[4] . " " . $row[3] . "
Point de rentabilité'; - - - print ''; - - print '
"; } } + /* + * + */ + print '
'; + print_titre("Retours Fournisseurs"); + $sql = "SELECT "; + $sql .= " cli,mode,situation,date_mise_service,date_resiliation,motif_resiliation,commentaire,fichier, traite "; + + $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande_retour"; + $sql .= " WHERE cli = ".$ligne->numero; + $sql .= " ORDER BY rowid DESC " . $db->plimit($conf->liste_limit+1, $offset); + + if ($db->query($sql)) + { + $num = $db->num_rows(); + $i = 0; + + print ''; + print ''; + print ''; + print "\n"; + $var=True; + + while ($i < $num) + { + $obj = $db->fetch_object(); + $var=!$var; + + print ""; + print '\n"; + print '\n"; + print '\n"; + print '\n"; + print '\n"; + print "\n"; - - - + $i++; + } + print "
ModeResultatDateCommentaireFichier
'.$obj->mode."'.$obj->situation."'.$obj->date_mise_service."'.$obj->commentaire."'.$obj->fichier."
"; + $db->free(); + } + else + { + print $db->error() . ' ' . $sql; + } /* * * * */ - } else { print "Error"; } -} - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ $db->close();