Fix: Utilisation du wrapper scuris pour tous

This commit is contained in:
Laurent Destailleur 2004-12-31 18:12:29 +00:00
parent 717d8df17a
commit 163711871a
6 changed files with 53 additions and 40 deletions

View File

@ -314,7 +314,7 @@ class FactureRec
*/
$forbidden_chars=array("/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
$facref = str_replace($forbidden_chars,"_",$this->ref);
$filepdf = FAC_OUTPUTDIR . "/" . $facref . "/" . $facref . ".pdf";
$filepdf = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
$mesg = "La facture ".$this->ref." a été validée.\n";

View File

@ -21,6 +21,11 @@
* $Source$
*
*/
/**
\todo Ce fichier ne semble plus utilisé. A virer ?
*/
require("./pre.inc.php");
$user->getrights('facture');
@ -122,9 +127,9 @@ if ($_GET["propalid"])
$color1 = "#e0e0e0";
print '<table class="border" cellspacing="0" cellpadding="2" width="100%">';
print '<table class="border" width="100%">';
print '<tr><td>Société</td><td colspan="2"><a href="fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2"><a href="fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
print "<td valign=\"top\" width=\"50%\" rowspan=\"9\">Note :<br>". nl2br($obj->note)."</td></tr>";
//
@ -134,7 +139,7 @@ if ($_GET["propalid"])
{
$projet = new Project($db);
$projet->fetch($obj->fk_projet);
print '<tr><td>Projet</td><td colspan="1">';
print '<tr><td>'.$langs->trans("Project").'</td><td colspan="1">';
print '<a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$projet->id.'">';
print $projet->title.'</a></td></tr>';
}
@ -143,7 +148,7 @@ if ($_GET["propalid"])
*
*/
print "<tr><td bgcolor=\"$color1\">Montant HT</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\">".price($obj->price + $obj->remise)." euros</td></tr>";
print "<tr><td bgcolor=\"$color1\">".$langs->trans("AmountHT")."</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\">".price($obj->price + $obj->remise)." euros</td></tr>";
/*
*
*/
@ -156,7 +161,7 @@ if ($_GET["propalid"])
$totalht = $propal->price ;
print "<tr><td bgcolor=\"$color1\">Total HT</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\"><b>".price($totalht)."</b> euros</td></tr>";
print "<tr><td bgcolor=\"$color1\">".$langs->trans("TotalHT")."</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\"><b>".price($totalht)."</b> euros</td></tr>";
/*
*
*/
@ -167,10 +172,12 @@ if ($_GET["propalid"])
/*
*
*/
print "<tr><td>PDF</a></td>";
$file = PROPALE_OUTPUTDIR. "/$obj->ref/$obj->ref.pdf";
print "<tr><td>".$langs->trans("Propal")." PDF</a></td>";
$file = $conf->propal->dir_output. "/$obj->ref/$obj->ref.pdf";
$relativepath = "$obj->ref/$obj->ref.pdf";
if (file_exists($file)) {
print '<td colspan="2"><a href="'.PROPALE_OUTPUT_URL.'/'.$obj->ref.'/'.$obj->ref.'.pdf">'.$obj->ref.'.pdf</a></td></tr>';
print '<td colspan="2"><a href="'.DOL_URL_ROOT.'/document.php?type=propal&file='.urlencode($relativepath).'">'.$obj->ref.'.pdf</a></td></tr>';
}
print '</tr>';
/*
@ -223,7 +230,7 @@ if ($_GET["propalid"])
{
print_titre("Facture associée");
}
print '<table class="border" width="100%" cellspacing="0" cellpadding="3">';
print '<table class="border" width="100%">';
print "<tr>";
print '<td>'.$langs->trans("Ref").'</td>';
print '<td>'.$langs->trans("Date").'</td>';
@ -305,7 +312,7 @@ if ($_GET["propalid"])
*/
if ($obj->statut <> 4 && $user->societe_id == 0)
{
print '<p><table id="actions" width="100%" cellspacing="4" cellpadding="4"><tr>';
print '<br><table id="actions" width="100%"><tr>';
if ($obj->statut == 2 && $user->rights->facture->creer)
{
@ -345,7 +352,7 @@ if ($_GET["propalid"])
*/
print_titre("Produits");
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="3">';
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Ref")."</td><td>Produit</td>";
print '<td align="right">'.$langs->trans("Price").'</td><td align="center">Remise</td><td align="center">Qté.</td></tr>';

View File

@ -484,16 +484,19 @@ else
* Documents générés
*
*/
$file = FAC_OUTPUTDIR . "/" . $commande->ref . "/" . $commande->ref . ".pdf";
$file = $conf->commande->dir_output . "/" . $commande->ref . "/" . $commande->ref . ".pdf";
$relativepath = $commande->ref . "/" . $commande->ref . ".pdf";
$var=true;
if (file_exists($file))
{
print "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
print_titre("Documents");
print '<table width="100%" cellspacing="0" class="border" cellpadding="3">';
print '<table width="100%" class="border">';
print "<tr $bc[0]><td>Commande PDF</td>";
print '<td><a href="'.FAC_OUTPUT_URL."/".$commande->ref."/".$commande->ref.'.pdf">'.$commande->ref.'.pdf</a></td>';
print "<tr $bc[$true]><td>".$langs->trans("Order")." PDF</td>";
print '<td><a href="'.DOL_URL_ROOT.'/document.php?modulepart=commande&file='.urlencode($relativepath).'">'.$commande->ref.'.pdf</a></td>';
print '<td align="right">'.filesize($file). ' bytes</td>';
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
print '</tr>';
@ -515,8 +518,8 @@ else
if ($num)
{
$i = 0; $total = 0;
print '<table border="1" cellspacing="0" cellpadding="4" width="100%">';
print "<tr $bc[$var]><td>Date</td><td>Action</td></tr>\n";
print '<table class="border" width="100%">';
print "<tr $bc[$var]><td>".$langs->trans("Date")."</td><td>".$langs->trans("Action")."</td></tr>\n";
$var=True;
while ($i < $num)
@ -524,8 +527,8 @@ else
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".strftime("%d %B %Y",$objp->da)."</TD>\n";
print '<td>'.stripslashes($objp->note).'</TD>';
print "<td>".strftime("%d %B %Y",$objp->da)."</td>\n";
print '<td>'.stripslashes($objp->note).'</td>';
print "</tr>";
$i++;
}
@ -534,7 +537,7 @@ else
}
else
{
print $db->error();
dolibarr_print_error($db);
}
/*

View File

@ -157,7 +157,7 @@ if ($_GET["action"] == 'create')
$smonth = 1;
$syear = date("Y", time());
print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
print '<table class="border" width="100%">';
print '<input type="hidden" name="socidp" value='.$_GET["socidp"].'>';
print "<tr><td>Société</td><td><b>".$objsoc->nom."</td></tr>";
@ -169,7 +169,7 @@ if ($_GET["action"] == 'create')
{
if ($day == $cday)
{
print "<option value=\"$day\" SELECTED>$day";
print "<option value=\"$day\" selected>$day";
}
else
{
@ -371,7 +371,7 @@ if ($_GET["id"])
print '<a class="tabAction" href="fiche.php?id='.$_GET["id"].'&action=edit">'.$langs->trans("Edit").'</a>';
}
$file = FICHEINTER_OUTPUTDIR . "/$fichinter->ref/$fichinter->ref.pdf";
$file = $conf->ficheinter->dir_output . "/$fichinter->ref/$fichinter->ref.pdf";
if ($fichinter->statut == 0 or !file_exists($file))
{
print '<a class="tabAction" href="fiche.php?id='.$_GET["id"].'&action=generate">'.$langs->trans("BuildPDF").'</a>';
@ -389,13 +389,17 @@ if ($_GET["id"])
print '<table width="50%" cellspacing="2"><tr><td width="50%" valign="top">';
print_titre("Documents générés");
print '<table width="100%" cellspacing="0" class="border" cellpadding="3">';
print '<table width="100%" class="border">';
$file = FICHEINTER_OUTPUTDIR . "/$fichinter->ref/$fichinter->ref.pdf";
$file = $conf->ficheinter->dir_output . "/$fichinter->ref/$fichinter->ref.pdf";
$relativepath="$fichinter->ref/$fichinter->ref.pdf";
$var=true;
if (file_exists($file))
{
print "<tr $bc[0]><td>Ficheinter PDF</a></td>";
print '<td><a href="'.FICHEINTER_OUTPUT_URL.'/'.$fichinter->ref.'/'.$fichinter->ref.'.pdf">'.$fichinter->ref.'.pdf</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/document.php?modulepart=ficheinter&file='.urlencode($relativepath).'">'.$fichinter->ref.'.pdf</a></td>';
print '<td align="right">'.filesize($file). ' bytes</td>';
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td></tr>';
}

View File

@ -616,7 +616,7 @@ if ($id > 0)
}
else
{
print $db->error();
dolibarr_print_error($db);
}
print "&nbsp;</td></tr></table>";
@ -624,15 +624,18 @@ if ($id > 0)
* Documents générés
*
*/
$file = FAC_OUTPUTDIR . "/" . $commande->ref . "/" . $commande->ref . ".pdf";
$file = $conf->commande->dir_output . "/" . $commande->ref . "/" . $commande->ref . ".pdf";
$relativepath=$commande->ref . "/" . $commande->ref . ".pdf";
$var=true;
if (file_exists($file))
{
print_titre("Documents");
print '<table width="100%" class="border">';
print "<tr $bc[0]><td>Commande PDF</td>";
print '<td><a href="'.FAC_OUTPUT_URL."/".$commande->ref."/".$commande->ref.'.pdf">'.$commande->ref.'.pdf</a></td>';
print "<tr $bc[$var]><td>".$langs->trans("Order")." PDF</td>";
print '<td><a href="'.DOL_URL_ROOT.'/document.php?modulepart=commande&file='.urlencode($relativepath).'">'.$commande->ref.'.pdf</a></td>';
print '<td align="right">'.filesize($file). ' bytes</td>';
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
print '</tr>';

View File

@ -54,18 +54,14 @@ class pdf_soleil extends ModelePDFFicheinter
$fich = new Fichinter($this->db,"",$id);
if ($fich->fetch($id))
{
if (defined("FICHEINTER_OUTPUTDIR"))
{
$dir = FICHEINTER_OUTPUTDIR . "/" . $fich->ref . "/" ;
$file = $dir . $fich->ref . ".pdf";
$dir = $conf->ficheinter->dir_output . "/" . $fich->ref . "/" ;
$file = $dir . $fich->ref . ".pdf";
if (! file_exists($dir))
if (! file_exists($dir))
{
umask(0);
mkdir($dir, 0755);
}
}
if (file_exists($dir))
{