On remplace tous les mkdir par la fonction create_exdir

This commit is contained in:
Laurent Destailleur 2006-09-05 23:25:48 +00:00
parent 0d66247612
commit 7b789189b6
6 changed files with 30 additions and 53 deletions

View File

@ -243,7 +243,7 @@ while (($file = readdir($handle))!==false)
// Info // Info
$htmltooltip=''; $htmltooltip='';
$nextval=$module->getNextValue(); $nextval=$module->getNextValue($mysoc,'');
if ($nextval != $langs->trans("NotAvailable")) if ($nextval != $langs->trans("NotAvailable"))
{ {
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval; $htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;

View File

@ -74,20 +74,7 @@ Class methode_expedition
if ($propale->fetch($id)) if ($propale->fetch($id))
{ {
if (defined("PROPALE_OUTPUTDIR"))
{
$dir = PROPALE_OUTPUTDIR . "/" . $propale->ref ;
umask(0);
if (! file_exists($dir))
{
mkdir($dir, 0755);
}
}
else
{
print "PROPALE_OUTPUTDIR non définit !";
}
$file = $dir . "/" . $propale->ref . ".pdf"; $file = $dir . "/" . $propale->ref . ".pdf";
if (file_exists($dir)) if (file_exists($dir))
@ -104,14 +91,9 @@ Class methode_expedition
$this->_pagehead($pdf, $propale); $this->_pagehead($pdf, $propale);
/*
*/
$tab_top = 100; $tab_top = 100;
$tab_height = 150; $tab_height = 150;
/*
*
*/
$pdf->SetFillColor(220,220,220); $pdf->SetFillColor(220,220,220);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);

View File

@ -209,33 +209,28 @@ function facture_pdf_create($db, $id, $message='', $modele='', $outputlangs='')
*/ */
function facture_meta_create($db, $facid, $message="") function facture_meta_create($db, $facid, $message="")
{ {
global $langs,$conf; global $langs,$conf;
$fac = new Facture($db,"",$facid); $fac = new Facture($db,"",$facid);
$fac->fetch($facid); $fac->fetch($facid);
$fac->fetch_client(); $fac->fetch_client();
if ($conf->facture->dir_output) if ($conf->facture->dir_output)
{
$facref = sanitize_string($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref ;
$file = $dir . "/" . $facref . ".meta";
if (! file_exists($dir))
{
umask(0);
if (! mkdir($dir, 0755))
{
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
return 0;
}
}
if (file_exists($dir))
{ {
$nblignes = sizeof($fac->lignes); $facref = sanitize_string($fac->ref);
$client = $fac->client->nom . " " . $fac->client->adresse . " " . $fac->client->cp . " " . $fac->client->ville; $dir = $conf->facture->dir_output . "/" . $facref ;
$meta = "REFERENCE=\"" . $fac->ref . "\" $file = $dir . "/" . $facref . ".meta";
if (! is_dir($dir))
{
create_exdir($dir);
}
if (is_dir($dir))
{
$nblignes = sizeof($fac->lignes);
$client = $fac->client->nom . " " . $fac->client->adresse . " " . $fac->client->cp . " " . $fac->client->ville;
$meta = "REFERENCE=\"" . $fac->ref . "\"
DATE=\"" . strftime("%d/%m/%Y",$fac->date) . "\" DATE=\"" . strftime("%d/%m/%Y",$fac->date) . "\"
NB_ITEMS=\"" . $nblignes . "\" NB_ITEMS=\"" . $nblignes . "\"
CLIENT=\"" . $client . "\" CLIENT=\"" . $client . "\"

View File

@ -85,7 +85,7 @@ function info()
$prefix='FA'; $prefix='FA';
$current_month = date("n"); $current_month = date("n");
if ($facture->date) if (is_object($facture) && $facture->date)
{ {
$create_month = strftime("%m",$facture->date); $create_month = strftime("%m",$facture->date);
} }

View File

@ -85,7 +85,7 @@ function info()
$prefix='FA'; $prefix='FA';
$current_month = date("n"); $current_month = date("n");
if ($facture->date) if (is_object($facture) && $facture->date)
{ {
$create_month = strftime("%m",$facture->date); $create_month = strftime("%m",$facture->date);
} }

View File

@ -171,7 +171,7 @@ if ($_POST["action"] == "set")
// Répertoire des documents // Répertoire des documents
if (! is_dir($main_data_dir)) if (! is_dir($main_data_dir))
{ {
@mkdir($main_data_dir, 0755); create_exdir($main_data_dir);
} }
if (! is_dir($main_data_dir)) if (! is_dir($main_data_dir))
@ -201,14 +201,14 @@ if ($_POST["action"] == "set")
{ {
if (is_dir($dir[$i])) if (is_dir($dir[$i]))
{ {
dolibarr_syslog ("Le dossier '".$dir[$i]."' existe"); dolibarr_syslog ("Directory '".$dir[$i]."' exists");
} }
else else
{ {
if (! @mkdir($dir[$i], 0755)) if (create_exdir($dir[$i]) < 0)
{ {
print "<tr><td>"; print "<tr><td>";
print "Impossible de créer : ".$dir[$i]; print "Failed to create directory: ".$dir[$i];
print '</td><td>'; print '</td><td>';
print $langs->trans("Error"); print $langs->trans("Error");
print "</td></tr>"; print "</td></tr>";
@ -216,7 +216,7 @@ if ($_POST["action"] == "set")
} }
else else
{ {
dolibarr_syslog ("Le dossier '".$dir[$i]."' a ete cree"); dolibarr_syslog("Directory '".$dir[$i]."' created");
} }
} }
} }