diff --git a/htdocs/fichinter/fiche.php3 b/htdocs/fichinter/fiche.php3 index 2106451b8e6..056a1931198 100644 --- a/htdocs/fichinter/fiche.php3 +++ b/htdocs/fichinter/fiche.php3 @@ -1,8 +1,5 @@ - * - * $Id$ - * $Source$ * * 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 @@ -18,20 +15,26 @@ * 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.php3"); require("./fichinter.class.php3"); +require("../project.class.php3"); $db = new Db(); + $sql = "SELECT s.nom, s.idp, s.prefix_comm FROM societe as s WHERE s.idp = $socidp;"; $result = $db->query($sql); -if ($result) { - if ( $db->num_rows() ) { - $objsoc = $db->fetch_object(0); - } +if ($result) +{ + if ( $db->num_rows() ) + { + $objsoc = $db->fetch_object(0); + } $db->free(); } @@ -43,14 +46,16 @@ llxHeader(); * */ -if ($action == 'valid') { +if ($action == 'valid') +{ $fichinter = new Fichinter($db); $fichinter->id = $id; $fichinter->valid($user->id, $conf->fichinter->outputdir); } -if ($action == 'add') { +if ($action == 'add') +{ $fichinter = new Fichinter($db); $fichinter->date = $db->idate(mktime(12, 1 , 1, $pmonth, $pday, $pyear)); @@ -58,7 +63,7 @@ if ($action == 'add') { $fichinter->socidp = $socidp; $fichinter->duree = $duree; - $fichinter->projetidp = $projetidp; + $fichinter->projet_id = $projetidp; $fichinter->author = $user->id; $fichinter->note = $note; @@ -68,15 +73,16 @@ if ($action == 'add') { $id = $fichinter->create(); } -if ($action == 'update') { +if ($action == 'update') +{ $fichinter = new Fichinter($db); - $fichinter->date = $db->idate(mktime(12, 1 , 1, $pmonth, $pday, $pyear)); + $fichinter->date = $db->idate(mktime(12, 1 , 1, $remonth, $reday, $reyear)); $fichinter->socidp = $socidp; $fichinter->duree = $duree; - $fichinter->projetidp = $projetidp; + $fichinter->projet_id = $projetidp; $fichinter->author = $user->id; $fichinter->note = $note; @@ -90,27 +96,31 @@ if ($action == 'update') { * Generation * */ -if ($action == 'generate') { - if ($id) { +if ($action == 'generate') +{ + if ($id) + { - //$DBI = "dbi:mysql:dbname=lolixdev:host=espy:user=rodo"; + //$DBI = "dbi:mysql:dbname=lolixdev:host=espy:user=rodo"; - $command = 'export LC_TIME=fr_FR ; export DBI_DSN="dbi:'.$conf->db->type.':dbname='.$conf->db->name.':host='.$conf->db->host.'"'; + $command = 'export LC_TIME=fr_FR ; export DBI_DSN="dbi:'.$conf->db->type.':dbname='.$conf->db->name.':host='.$conf->db->host.'"'; - $command .= " ; ./tex-fichinter.pl --fichinter=".$id ; - $command .= " --pdf --ps -vv --html"; - $command .= " --output=" .$conf->fichinter->outputdir; - $command .= " --templates=" .$conf->fichinter->templatesdir; + $command .= " ; ./tex-fichinter.pl --fichinter=".$id ; + $command .= " --pdf --ps -vv --html"; + $command .= " --output=" .$conf->fichinter->outputdir; + $command .= " --templates=" .$conf->fichinter->templatesdir; + + $output = system($command); + print $output; - $output = system($command); - print $output; - - print "
command : $command
";
-
- } else {
- print $db->error();
- }
+ print "
command : $command
";
+
+ }
+ else
+ {
+ print $db->error();
+ }
}
/*
*
@@ -118,125 +128,139 @@ if ($action == 'generate') {
* Creation d'une nouvelle fiche d'intervention
*
*/
-if ($action == 'create') {
+if ($action == 'create')
+{
print_titre("Création d'une fiche d'intervention");
- if ( $objsoc->prefix_comm ) {
+ if ( $objsoc->prefix_comm )
+ {
- $numpr = "FI-" . $objsoc->prefix_comm . "-" . strftime("%y%m%d", time());
-
- $sql = "SELECT count(*) FROM llx_propal WHERE ref like '$numpr%'";
-
- if ( $db->query($sql) ) {
- $num = $db->result(0, 0);
- $db->free();
- if ($num > 0) {
- $numpr .= "." . ($num + 1);
+ $numpr = "FI-" . $objsoc->prefix_comm . "-" . strftime("%y%m%d", time());
+
+ $sql = "SELECT count(*) FROM llx_propal WHERE ref like '$numpr%'";
+
+ if ( $db->query($sql) )
+ {
+ $num = $db->result(0, 0);
+ $db->free();
+ if ($num > 0) {
+ $numpr .= "." . ($num + 1);
+ }
+ }
+
+ print "";
-
- print "
";
- } else {
- print "Vous devez d'abord associer un prefixe commercial a cette societe" ;
- }
}
/*
*
@@ -244,59 +268,30 @@ if ($action == 'create') {
* Mise a jour de la fiche d'intervention
*
*/
-if ($action == 'edit') {
+if ($action == 'edit')
+{
$fichinter = new Fichinter($db);
$fichinter->fetch($id);
+ /*
+ * Initialisation de la liste des projets
+ */
+ $prj = new Project($db);
+ $listeprj = $prj->liste_array($fichinter->societe_id);
+
+
print_titre("Mettre à jour Fiche d'intervention");
-
print "';
print "
";
print "";
@@ -309,28 +304,17 @@ if ($action == 'edit') {
* Projet associé
*
*/
- print 'Date ";
- $cday = date("d", time());
- print "";
- $cmonth = date("n", time());
- print "";
-
- print " Projet