From 89ae353ccc220b20f7fa94cda6d06ef3a579b891 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 24 Jun 2002 09:24:47 +0000 Subject: [PATCH] . --- htdocs/fichinter/fiche.php3 | 24 ++++++++++++++-------- htdocs/fichinter/fichinter.class.php3 | 29 ++++++++++++++++++++++++--- htdocs/fichinter/tex-fichinter.pl | 3 +-- htdocs/index.php3 | 4 ++-- htdocs/main.inc.php3 | 2 +- 5 files changed, 46 insertions(+), 16 deletions(-) diff --git a/htdocs/fichinter/fiche.php3 b/htdocs/fichinter/fiche.php3 index acd23f5ac9f..2106451b8e6 100644 --- a/htdocs/fichinter/fiche.php3 +++ b/htdocs/fichinter/fiche.php3 @@ -21,7 +21,6 @@ */ require("./pre.inc.php3"); - require("./fichinter.class.php3"); $db = new Db(); @@ -47,7 +46,8 @@ llxHeader(); if ($action == 'valid') { $fichinter = new Fichinter($db); $fichinter->id = $id; - $fichinter->valid($user->id); + $fichinter->valid($user->id, $conf->fichinter->outputdir); + } if ($action == 'add') { @@ -67,6 +67,7 @@ if ($action == 'add') { $id = $fichinter->create(); } + if ($action == 'update') { $fichinter = new Fichinter($db); @@ -114,7 +115,7 @@ if ($action == 'generate') { /* * * Mode creation - * Creation d'une nouvelle propale + * Creation d'une nouvelle fiche d'intervention * */ if ($action == 'create') { @@ -380,20 +381,27 @@ if ($id) { $file = $conf->fichinter->outputdir . "/$fichinter->ref/$fichinter->ref.pdf"; if (file_exists($file)) { - print 'PDF'.$fichinter->ref.'.pdf'; + print 'PDF'.$fichinter->ref.'.pdf'; + print ''.filesize($file). ' bytes'; + print ''.strftime("%d %b %Y %H:%M:%S",filemtime($file)).''; + print ''; } $file = $conf->fichinter->outputdir . "/$fichinter->ref/$fichinter->ref.ps"; if (file_exists($file)) { - print 'PS'.$fichinter->ref.'.ps'; + print 'PS'.$fichinter->ref.'.ps'; + print ''.filesize($file).' bytes'; + print ''.strftime("%d %b %Y %H:%M:%S",filemtime($file)).''; + print ''; } $file = $conf->fichinter->outputdir . "/$fichinter->ref/$fichinter->ref.tex"; if (file_exists($file)) { print 'tex'.$fichinter->ref.'.tex'; - print ' [view]'; - - print ''; + print ''; + print ''.filesize($file).' bytes'; + print ''.strftime("%d %b %Y %H:%M:%S",filemtime($file)).''; + print ''; } diff --git a/htdocs/fichinter/fichinter.class.php3 b/htdocs/fichinter/fichinter.class.php3 index 69131c68f34..b6d35fede6a 100644 --- a/htdocs/fichinter/fichinter.class.php3 +++ b/htdocs/fichinter/fichinter.class.php3 @@ -52,15 +52,16 @@ class Fichinter { /* * Insertion dans la base */ + if (!strlen($this->duree)) { $this->duree = 0; } + $sql = "INSERT INTO llx_fichinter (fk_soc, datei, datec, ref, fk_user_author, note, duree) "; $sql .= " VALUES ($this->socidp, $this->date, now(), '$this->ref', $this->author, '$this->note', $this->duree)"; $sqlok = 0; if (! $this->db->query($sql) ) { - print $this->db->error() . '
'.$sql; } - return 1; + return $this->db->last_insert_id(); } /* * @@ -114,15 +115,37 @@ class Fichinter { * * */ - Function valid($userid) { + Function valid($userid, $outputdir) { + + $this->fetch($this->id); + $sql = "UPDATE llx_fichinter SET fk_statut = 1, date_valid=now(), fk_user_valid=$userid"; $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; if ($this->db->query($sql) ) { + + /* + * Set generates files readonly + * + */ + $file = $outputdir . "/$this->ref/$this->ref.tex"; + print $file; + if (is_writeable($file)) { + chmod($file, 0444); + } + $file = $outputdir . "/$this->ref/$this->ref.ps"; + if (is_writeable($file)) { + chmod($file, 0444); + } + $file = $outputdir . "/$this->ref/$this->ref.pdf"; + if (is_writeable($file)) { + chmod($file, 0444); + } return 1; } else { print $this->db->error() . ' in ' . $sql; } + } /* * diff --git a/htdocs/fichinter/tex-fichinter.pl b/htdocs/fichinter/tex-fichinter.pl index e287503d5ad..18774222f05 100755 --- a/htdocs/fichinter/tex-fichinter.pl +++ b/htdocs/fichinter/tex-fichinter.pl @@ -199,8 +199,7 @@ $dbh->disconnect if $dbh; # # if (-r "$outputdir/$numfiche.tex" ) { - - system("cd $outputdir/ ; recode -d iso8859-1..ltex < $numfiche.tex > recode-$numfiche.tex"); + system("cd $outputdir/ ; recode -q -d iso8859-1..ltex < $numfiche.tex > recode-$numfiche.tex"); } # # diff --git a/htdocs/index.php3 b/htdocs/index.php3 index f984114a635..7acde7b825e 100644 --- a/htdocs/index.php3 +++ b/htdocs/index.php3 @@ -34,13 +34,13 @@ llxHeader(); - - '; - print ''; + print ''; print ''; print '';
+ Commercial + Compta
  • Résultat diff --git a/htdocs/main.inc.php3 b/htdocs/main.inc.php3 index a425f5150ae..88a3e8133a7 100644 --- a/htdocs/main.inc.php3 +++ b/htdocs/main.inc.php3 @@ -90,7 +90,7 @@ function top_menu($head) { print 'Calendrier'; }; print '