From b32fda3369aec1062b44e525eec7278904cf04eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Aug 2004 16:59:28 +0000 Subject: [PATCH] Fix: register_globals=off --- htdocs/fichinter/fiche.php | 119 +++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 64 deletions(-) diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index a400a50c2f1..b99f92e9140 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1,5 +1,6 @@ + * Copyright (C) 2004 Laurent Destailleur * * 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 @@ -32,9 +33,9 @@ if ($user->societe_id > 0) $socidp = $user->societe_id; } -if ($socidp) +if ($_GET["socidp"]) { - $sql = "SELECT s.nom, s.idp, s.prefix_comm FROM ".MAIN_DB_PREFIX."societe as s WHERE s.idp = $socidp;"; + $sql = "SELECT s.nom, s.idp, s.prefix_comm FROM ".MAIN_DB_PREFIX."societe as s WHERE s.idp = ".$_GET["socidp"]; $result = $db->query($sql); if ($result) @@ -45,69 +46,77 @@ if ($socidp) } $db->free(); } + else { + dolibarr_print_error($db); + } } llxHeader(); + + /* * Traitements des actions * * */ -if ($action == 'valid') +if ($_GET["action"] == 'valid') { $fichinter = new Fichinter($db); - $fichinter->id = $id; + $fichinter->id = $_GET["id"]; $fichinter->valid($user->id, $conf->fichinter->outputdir); } -if ($action == 'add') +if ($_POST["action"] == 'add') { $fichinter = new Fichinter($db); - $fichinter->date = $db->idate(mktime(12, 1 , 1, $pmonth, $pday, $pyear)); - $fichinter->socidp = $socidp; - $fichinter->duree = $duree; - $fichinter->projet_id = $projetidp; + $fichinter->date = $db->idate(mktime(12, 1 , 1, $_POST["pmonth"], $_POST["pday"], $_POST["pyear"])); + $fichinter->socidp = $_POST["socidp"]; + $fichinter->duree = $_POST["duree"]; + $fichinter->projet_id = $_POST["projetidp"]; $fichinter->author = $user->id; - $fichinter->note = $note; - $fichinter->ref = $ref; + $fichinter->note = $_POST["note"]; + $fichinter->ref = $_POST["ref"]; $id = $fichinter->create(); + $_GET["id"]=$id; // Force raffraichissement sur fiche venant d'etre créée } -if ($action == 'update') +if ($_POST["action"] == 'update') { $fichinter = new Fichinter($db); - $fichinter->date = $db->idate(mktime(12, 1 , 1, $remonth, $reday, $reyear)); - $fichinter->socidp = $socidp; - $fichinter->duree = $duree; - $fichinter->projet_id = $projetidp; + $fichinter->date = $db->idate(mktime(12, 1 , 1, $_POST["remonth"], $_POST["reday"], $_POST["reyear"])); + $fichinter->socidp = $_POST["socidp"]; + $fichinter->duree = $_POST["duree"]; + $fichinter->projet_id = $_POST["projetidp"]; $fichinter->author = $user->id; - $fichinter->note = $note; - $fichinter->ref = $ref; + $fichinter->note = $_POST["note"]; + $fichinter->ref = $_POST["ref"]; - $fichinter->update($id); + $fichinter->update($_POST["id"]); } + /* * * Generation du pdf * */ -if ($action == 'generate' && $id) +if ($_GET["action"] == 'generate' && $_GET["id"]) { - fichinter_pdf_create($db, $id); + fichinter_pdf_create($db, $_GET["id"]); $mesg = "PDF généré"; } + /* * * Mode creation * Creation d'une nouvelle fiche d'intervention * */ -if ($action == 'create') +if ($_GET["action"] == 'create') { print_titre("Création d'une fiche d'intervention"); @@ -130,7 +139,7 @@ if ($action == 'create') $fix = new Fichinter($db); $numpr = $fix->get_new_num($objsoc->prefix_comm); - print "
"; + print ""; $strmonth[1] = "Janvier"; $strmonth[2] = "Février"; @@ -149,6 +158,7 @@ if ($action == 'create') $syear = date("Y", time()); print ''; + print ''; print ""; print "'; print "
Société".$objsoc->nom."
Date"; @@ -171,7 +181,7 @@ if ($action == 'create') for ($month = $smonth ; $month < $smonth + 12 ; $month++) { if ($month == $cmonth) { - print "
"; - /* - * - */ - print '
'; + + /* + * Barre d'actions + * + */ + print '
'; + print '
'; if ($user->societe_id == 0) { if ($fichinter->statut == 0) { - print '
'; + print ''.$langs->trans("Edit").''; } - else - { - print ''; - } - - print ''; - + $file = FICHEINTER_OUTPUTDIR . "/$fichinter->ref/$fichinter->ref.pdf"; - if ($fichinter->statut == 0 or !file_exists($file)) { - print ''; + print ''.$langs->trans("BuildPDF").''; } - else - { - print ''; - } - - print ''; if ($fichinter->statut == 0) { - print ''; - } - else - { - print ''; + print ''.$langs->trans("Valid").''; } } - else - { - print ''; - print ''; - print ''; - print ''; - print ''; - } - - print '
Mettre à jour--Génération du pdf--Valider------
'; + print ''; + + print '
'; print '
'; print_titre("Documents générés");