From f87b891838ba6359bd08f9344353afb211d5aba1 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sun, 22 Dec 2002 20:03:35 +0000 Subject: [PATCH] *** empty log message *** --- htdocs/fichinter/fiche.php3 | 505 ++++++++++++++++++------------------ 1 file changed, 247 insertions(+), 258 deletions(-) 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 "

"; + + $strmonth[1] = "Janvier"; + $strmonth[2] = "Février"; + $strmonth[3] = "Mars"; + $strmonth[4] = "Avril"; + $strmonth[5] = "Mai"; + $strmonth[6] = "Juin"; + $strmonth[7] = "Juillet"; + $strmonth[8] = "Août"; + $strmonth[9] = "Septembre"; + $strmonth[10] = "Octobre"; + $strmonth[11] = "Novembre"; + $strmonth[12] = "Décembre"; + + $smonth = 1; + $syear = date("Y", time()); + print ''; + + print ""; + + print ""; - - print ""; - - print "\n"; - print "\n"; - - /* - * - * Projet associé - * - */ - print ''; - - - print ''; - print "'; - - print ''; - print "
Société".$objsoc->nom."
Date"; + $cday = date("d", time()); + print ""; + $cmonth = date("n", time()); + print ""; - print ""; - - $strmonth[1] = "Janvier"; - $strmonth[2] = "Février"; - $strmonth[3] = "Mars"; - $strmonth[4] = "Avril"; - $strmonth[5] = "Mai"; - $strmonth[6] = "Juin"; - $strmonth[7] = "Juillet"; - $strmonth[8] = "Août"; - $strmonth[9] = "Septembre"; - $strmonth[10] = "Octobre"; - $strmonth[11] = "Novembre"; - $strmonth[12] = "Décembre"; + print "'; - - print ""; - - print ""; + + print ""; + + print "\n"; + print "\n"; + + /* + * + * Projet associé + * + */ + print ''; + + + print ''; + print "'; + + print ''; + print "
Société".$objsoc->nom."
Date"; - $cday = date("d", time()); - print "
Numéro
Durée (en jours)
Projet'; + if ($numprojet==0) { + print 'Cette société n\'a pas de projet. '; + print 'Créer un projet'; } + print '
Commentaires"; + print '
'; + print ""; + print '
"; + + print ""; + + print "
"; } - print ""; - $cmonth = date("n", time()); - print ""; - - print "
Numéro
Durée (en jours)
Projet'; - if ($numprojet==0) { - print 'Cette société n\'a pas de projet. '; - print 'Créer un projet'; - } - print '
Commentaires"; - print '
'; - print ""; - print '
"; - - 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 "
"; - $strmonth[1] = "Janvier"; - $strmonth[2] = "Février"; - $strmonth[3] = "Mars"; - $strmonth[4] = "Avril"; - $strmonth[5] = "Mai"; - $strmonth[6] = "Juin"; - $strmonth[7] = "Juillet"; - $strmonth[8] = "Août"; - $strmonth[9] = "Septembre"; - $strmonth[10] = "Octobre"; - $strmonth[11] = "Novembre"; - $strmonth[12] = "Décembre"; - - $smonth = 1; - $syear = date("Y", time()); print ''; print ""; print ""; @@ -309,28 +304,17 @@ if ($action == 'edit') { * Projet associé * */ - print ''; @@ -358,7 +342,8 @@ if ($action == 'edit') { * */ -if ($id) { +if ($id) +{ $fichinter = new Fichinter($db); $fichinter->fetch($id); @@ -372,27 +357,29 @@ if ($id) { print ''; print ''; print ''; - print "'; - print ''; + print ''; $file = $conf->fichinter->outputdir . "/$fichinter->ref/$fichinter->ref.pdf"; - if (file_exists($file)) { + if (file_exists($file)) + { - print ''; - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; + print ''; + } $file = $conf->fichinter->outputdir . "/$fichinter->ref/$fichinter->ref.ps"; - if (file_exists($file)) { - print ''; - print ''; - print ''; - print ''; - } + if (file_exists($file)) + { + print ''; + print ''; + print ''; + print ''; + } $file = $conf->fichinter->outputdir . "/$fichinter->ref/$fichinter->ref.tex"; if (file_exists($file)) { @@ -412,31 +399,29 @@ if ($id) { print '
Date"; - $cday = date("d", time()); - print ""; - $cmonth = date("n", time()); - print ""; - - print "
Projet
Projet'; + + $sel = new Form($db); + $sel->select_array("projetidp",$listeprj,$fichinter->projet_id); + + if (sizeof($listeprj) == 0) + { + print 'Cette société n\'a pas de projet. '; + print 'Créer un projet'; } - $db->free(); - } else { - print $db->error(); - } - print ''; - if ($numprojet==0) { - print 'Cette société n\'a pas de projet. '; - print 'Créer un projet'; - } print '
Durée'.$fichinter->duree.'
Projet 
Commentaires"; + print ''; print nl2br($fichinter->note); print '
Documentsliste...
Documentsliste...
PDF'.$fichinter->ref.'.pdf'.filesize($file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
PDF'.$fichinter->ref.'.pdf'.filesize($file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
PS'.$fichinter->ref.'.ps'.filesize($file).' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
PS'.$fichinter->ref.'.ps'.filesize($file).' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
'; - if ($fichinter->statut == 0) { - - - print ''; - print ''; - - print ''; - print ''; - - print ''; - - } else { - print ''; - print ''; - print ''; - print ''; - print ''; - } + if ($fichinter->statut == 0) + { + print ''; + print ''; + + print ''; + print ''; + + print ''; + + } + else + { + print ''; + print ''; + print ''; + print ''; + print ''; + } + print '
Mettre à jour-Génération du pdf-Valider-----Mettre à jour-Génération du pdf-Valider-----
'; - - - - - + } /* @@ -444,12 +429,13 @@ if ($id) { * Liste des fiches * */ -$sql = "SELECT s.nom,s.idp, f.ref,".$db->pdate("f.datei")." as dp, f.rowid as fichid, f.fk_statut"; +$sql = "SELECT s.nom,s.idp, f.ref,".$db->pdate("f.datei")." as dp, f.rowid as fichid, f.fk_statut, fk_projet"; $sql .= " FROM societe as s, llx_fichinter as f "; $sql .= " WHERE f.fk_soc = s.idp "; $sql .= " ORDER BY f.datei DESC ;"; -if ( $db->query($sql) ) { +if ( $db->query($sql) ) +{ $num = $db->num_rows(); $i = 0; print "

"; @@ -460,25 +446,28 @@ if ( $db->query($sql) ) { print ""; print "\n"; $var=True; - while ($i < $num) { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - - print ''; - - print "\n"; - - $i++; - } - + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + + print ''; + + print "\n"; + + $i++; + } + print "
Statut 
fichid\">$objp->refidp\">$objp->nom".strftime("%d %B %Y",$objp->dp)."$objp->fk_statut[Fiche Inter]
fichid\">$objp->refidp\">$objp->nom".strftime("%d %B %Y",$objp->dp)."$objp->fk_statut[Fiche Inter]
"; $db->free(); -} else { +} +else +{ print $db->error(); print "

$sql"; }