*
* 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 = '';
if ($_POST["action"] == 'add')
{
$service = new TelephonieService($db);
$service->ref = $_POST["ref"];
$service->libelle = $_POST["libelle"];
$service->libelle_facture = $_POST["libelle_facture"];
$service->montant = $_POST["montant"];
if ( $service->create($user) == 0)
{
Header("Location: fiche.php?id=".$service->id);
}
else
{
$_GET["action"] = 'create';
}
}
if ($_GET["action"] == 'active')
{
$service = new LigneTel($db);
$service->fetch_by_id($_GET["id"]);
$datea = $db->idate(mktime($h, $m , $s,
$_POST["remonth"],
$_POST["reday"],
$_POST["reyear"]));
if ( $service->set_statut($user, 3, $datea) == 0)
{
Header("Location: fiche.php?id=".$service->id);
}
}
if ($_POST["action"] == 'update')
{
$service = new TelephonieService($db);
$service->id = $_GET["id"];
$service->ref = $_POST["ref"];
$service->libelle = $_POST["libelle"];
$service->libelle_facture = $_POST["libelle_facture"];
$service->montant = $_POST["montant"];
if ( $service->update($user) == 0)
{
$action = '';
$mesg = 'Fiche mise à jour';
}
else
{
$action = 're-edit';
$mesg = 'Fiche non mise à jour !' . "
" . $entrepot->mesg_error;
}
}
llxHeader("","","Fiche Service");
if ($cancel == $langs->trans("Cancel"))
{
$action = '';
}
/*
* Création
*
*/
if ($_GET["action"] == 'create')
{
$form = new Form($db);
print_titre("Nouveau service");
print '
| Libellé | '.$service->libelle.' |
| Libellé Facture | '.$service->libelle_facture.' |
| Montant HT | '.dolibarr_print_phone($service->montant).' |
| Statut | '.$service->statuts[$service->statut].' |