This commit is contained in:
Rodolphe Quiedeville 2002-06-24 09:24:47 +00:00
parent 507f48779f
commit 89ae353ccc
5 changed files with 46 additions and 16 deletions

View File

@ -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 '<tr><td>PDF</td><td><a href="'.$conf->fichinter->outputurl.'/'.$fichinter->ref.'/'.$fichinter->ref.'.pdf">'.$fichinter->ref.'.pdf</a></td></tr>';
print '<tr><td>PDF</td><td><a href="'.$conf->fichinter->outputurl.'/'.$fichinter->ref.'/'.$fichinter->ref.'.pdf">'.$fichinter->ref.'.pdf</a></td>';
print '<td align="right">'.filesize($file). ' bytes</td>';
print '<td>'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
print '</tr>';
}
$file = $conf->fichinter->outputdir . "/$fichinter->ref/$fichinter->ref.ps";
if (file_exists($file)) {
print '<tr><td>PS</td><td><a href="'.$conf->fichinter->outputurl.'/'.$fichinter->ref.'/'.$fichinter->ref.'.ps">'.$fichinter->ref.'.ps</a></td></tr>';
print '<tr><td>PS</td><td><a href="'.$conf->fichinter->outputurl.'/'.$fichinter->ref.'/'.$fichinter->ref.'.ps">'.$fichinter->ref.'.ps</a></td>';
print '<td align="right">'.filesize($file).' bytes</td>';
print '<td>'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
print '</tr>';
}
$file = $conf->fichinter->outputdir . "/$fichinter->ref/$fichinter->ref.tex";
if (file_exists($file)) {
print '<tr><td>tex</td><td><a href="'.$conf->fichinter->outputurl.'/'.$fichinter->ref.'/'.$fichinter->ref.'.tex">'.$fichinter->ref.'.tex</a>';
print '&nbsp;[<a href="texview.php3?fichinter_ref='.$fichinter->ref.'">view</a>]';
print '</td></tr>';
print '</td>';
print '<td align="right">'.filesize($file).' bytes</td>';
print '<td>'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
print '</tr>';
}

View File

@ -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() . '<b><br>'.$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;
}
}
/*
*

View File

@ -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");
}
#
#

View File

@ -34,13 +34,13 @@ llxHeader();
<table width="100%" cellspacing="3">
<tr>
<td width="50%" class="dash">
<td width="50%" class="dash" valign="top">
<a href="/comm/">Commercial</a>
<ul>
<li><a href="/comm/propal.php3">Propositions commerciales</a>
</ul>
</td>
<td width="50%" class="dash">
<td width="50%" class="dash" valign="top">
<a href="/compta">Compta</a>
<ul>
<li><a href="/compta/resultat/">Résultat</A>

View File

@ -90,7 +90,7 @@ function top_menu($head) {
print '<a class="menu" href="'.$conf->webcal->url.'">Calendrier</a>';
};
print '&nbsp;</TD>';
print '<TD width="15%" class="menu" align="center">-</TD>';
print '<TD width="15%" class="menu" align="center">'.strftime("%H:%M",time()).'</TD>';
print '<TD width="10%" class="menu" align="center">'.$user->code.'</td>';
print '</TR>';