*
* 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 ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] == "yes")
{
$deplacement = new Deplacement($db);
$deplacement->delete($id);
Header("Location: index.php");
}
if ($HTTP_POST_VARS["action"] == 'add' && $HTTP_POST_VARS["cancel"] <> 'Annuler')
{
$deplacement = new Deplacement($db);
$deplacement->date = mktime(12, 1 , 1,
$HTTP_POST_VARS["remonth"],
$HTTP_POST_VARS["reday"],
$HTTP_POST_VARS["reyear"]);
$deplacement->km = $HTTP_POST_VARS["km"];
$deplacement->socid = $HTTP_POST_VARS["socid"];
$deplacement->userid = $user->id; //$HTTP_POST_VARS["km"];
$id = $deplacement->create($user);
if ($id > 0)
{
Header ( "Location: fiche.php?id=$id");
}
else
{
print "Error";
}
}
if ($HTTP_POST_VARS["action"] == 'update' && $HTTP_POST_VARS["cancel"] <> 'Annuler')
{
$deplacement = new Deplacement($db);
$result = $deplacement->fetch($id);
$deplacement->date = mktime(12, 1 , 1,
$HTTP_POST_VARS["remonth"],
$HTTP_POST_VARS["reday"],
$HTTP_POST_VARS["reyear"]);
$deplacement->km = $HTTP_POST_VARS["km"];
$result = $deplacement->update($user);
if ($result > 0)
{
Header ( "Location: fiche.php?id=$id");
}
else
{
print "Error";
}
}
llxHeader();
/*
*
*
*/
$html = new Form($db);
if ($action == 'create')
{
print "
';
}
else
{
if ($id)
{
$deplacement = new Deplacement($db);
$result = $deplacement->fetch($id);
if ( $result )
{
/*
* Confirmation de la suppression de l'adhérent
*
*/
if ($action == 'delete')
{
print '\n";
}
if ($action == 'edit')
{
print_fiche_titre('Fiche déplacement : '.$product->ref, $mesg);
print "';
}
else
{
print_fiche_titre('Fiche déplacement : '.$product->ref, $mesg);
print '';
$soc = new Societe($db);
$soc->fetch($deplacement->socid);
print '| Personne | '.$user->fullname.' |
';
print '| Société visitée | '.$soc->nom_url.' |
';
print '| Date du déplacement | ';
print strftime("%A %d %B %Y",$deplacement->date);
print ' |
';
print '| Kilomètres | '.$deplacement->km.' |
';
print "
";
}
}
else
{
print "Error";
}
}
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print '
';
print '| - | ';
if ($action == 'create')
{
print '- | ';
}
else
{
print '[Editer] | ';
}
print '- | ';
print '- | ';
print '[Supprimer] | ';
print '
';
$db->close();
llxFooter("Dernière modification $Date$ révision $Revision$");
?>