diff --git a/htdocs/fichinter/fiche.php3 b/htdocs/fichinter/fiche.php3 index 3ec6fc51026..aba31f96a9e 100644 --- a/htdocs/fichinter/fiche.php3 +++ b/htdocs/fichinter/fiche.php3 @@ -34,19 +34,20 @@ if ($user->societe_id > 0) $socidp = $user->societe_id; } - -$sql = "SELECT s.nom, s.idp, s.prefix_comm FROM societe as s WHERE s.idp = $socidp;"; - -$result = $db->query($sql); -if ($result) +if ($socidp) { - if ( $db->num_rows() ) - { - $objsoc = $db->fetch_object(0); - } - $db->free(); -} + $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); + } + $db->free(); + } +} llxHeader(); /* @@ -68,15 +69,11 @@ if ($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->author = $user->id; $fichinter->note = $note; - $fichinter->ref = $ref; $id = $fichinter->create(); @@ -87,15 +84,11 @@ if ($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->author = $user->id; $fichinter->note = $note; - $fichinter->ref = $ref; $fichinter->update($id); @@ -109,10 +102,7 @@ if ($action == 'generate') { if ($id) { - - //$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 .= " ; ./tex-fichinter.pl --fichinter=".$id ; @@ -122,7 +112,6 @@ if ($action == 'generate') $output = system($command); print $output; - print "
command : $command
";
}
@@ -139,13 +128,10 @@ if ($action == 'generate')
*/
if ($action == 'create')
{
-
print_titre("Création d'une fiche d'intervention");
-
if ( $objsoc->prefix_comm )
{
-
$numpr = "FI-" . $objsoc->prefix_comm . "-" . strftime("%y%m%d", time());
$sql = "SELECT count(*) FROM llx_propal WHERE ref like '$numpr%'";
@@ -158,6 +144,9 @@ if ($action == 'create')
$numpr .= "." . ($num + 1);
}
}
+
+ $fix = new Fichinter($db);
+ $numpr = $fix->get_new_num($objsoc->prefix_comm);
print "";
+ print '';
+ print '';
print "
";
}
@@ -458,62 +445,7 @@ 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, fk_projet";
-$sql .= " FROM societe as s, llx_fichinter as f ";
-$sql .= " WHERE f.fk_soc = s.idp ";
-if ($socidp)
-{
- $sql .= " AND s.idp = $socidp";
-}
-if ($fichinter > 0)
-{
- $sql .= " AND s.idp = $fichinter->societe_id";
-}
-$sql .= " ORDER BY f.datei DESC ;";
-
-if ( $db->query($sql) )
-{
- $num = $db->num_rows();
- $i = 0;
- print "
| Num | "; - print "Société | "; - print "Date | "; - print "Statut | "; - print " |
| fichid\">$objp->ref | \n"; - print "idp\">$objp->nom | \n"; - print "".strftime("%d %B %Y",$objp->dp)." | \n"; - print "$objp->fk_statut | \n"; - - print '[Fiche Inter] | '; - - print "
$sql"; -} $db->close(); llxFooter(); ?>