On remplace tous les mkdir par la fonction create_exdir
This commit is contained in:
parent
0d66247612
commit
7b789189b6
@ -243,7 +243,7 @@ while (($file = readdir($handle))!==false)
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$nextval=$module->getNextValue();
|
||||
$nextval=$module->getNextValue($mysoc,'');
|
||||
if ($nextval != $langs->trans("NotAvailable"))
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
|
||||
@ -74,20 +74,7 @@ Class methode_expedition
|
||||
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";
|
||||
|
||||
if (file_exists($dir))
|
||||
@ -104,14 +91,9 @@ Class methode_expedition
|
||||
|
||||
$this->_pagehead($pdf, $propale);
|
||||
|
||||
/*
|
||||
*/
|
||||
$tab_top = 100;
|
||||
$tab_height = 150;
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$pdf->SetFillColor(220,220,220);
|
||||
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
@ -209,33 +209,28 @@ function facture_pdf_create($db, $id, $message='', $modele='', $outputlangs='')
|
||||
*/
|
||||
function facture_meta_create($db, $facid, $message="")
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $langs,$conf;
|
||||
|
||||
$fac = new Facture($db,"",$facid);
|
||||
$fac->fetch($facid);
|
||||
$fac->fetch_client();
|
||||
|
||||
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))
|
||||
$fac = new Facture($db,"",$facid);
|
||||
$fac->fetch($facid);
|
||||
$fac->fetch_client();
|
||||
|
||||
if ($conf->facture->dir_output)
|
||||
{
|
||||
$nblignes = sizeof($fac->lignes);
|
||||
$client = $fac->client->nom . " " . $fac->client->adresse . " " . $fac->client->cp . " " . $fac->client->ville;
|
||||
$meta = "REFERENCE=\"" . $fac->ref . "\"
|
||||
$facref = sanitize_string($fac->ref);
|
||||
$dir = $conf->facture->dir_output . "/" . $facref ;
|
||||
$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) . "\"
|
||||
NB_ITEMS=\"" . $nblignes . "\"
|
||||
CLIENT=\"" . $client . "\"
|
||||
|
||||
@ -85,7 +85,7 @@ function info()
|
||||
$prefix='FA';
|
||||
$current_month = date("n");
|
||||
|
||||
if ($facture->date)
|
||||
if (is_object($facture) && $facture->date)
|
||||
{
|
||||
$create_month = strftime("%m",$facture->date);
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ function info()
|
||||
$prefix='FA';
|
||||
$current_month = date("n");
|
||||
|
||||
if ($facture->date)
|
||||
if (is_object($facture) && $facture->date)
|
||||
{
|
||||
$create_month = strftime("%m",$facture->date);
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ if ($_POST["action"] == "set")
|
||||
// Répertoire des documents
|
||||
if (! is_dir($main_data_dir))
|
||||
{
|
||||
@mkdir($main_data_dir, 0755);
|
||||
create_exdir($main_data_dir);
|
||||
}
|
||||
|
||||
if (! is_dir($main_data_dir))
|
||||
@ -201,14 +201,14 @@ if ($_POST["action"] == "set")
|
||||
{
|
||||
if (is_dir($dir[$i]))
|
||||
{
|
||||
dolibarr_syslog ("Le dossier '".$dir[$i]."' existe");
|
||||
dolibarr_syslog ("Directory '".$dir[$i]."' exists");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! @mkdir($dir[$i], 0755))
|
||||
if (create_exdir($dir[$i]) < 0)
|
||||
{
|
||||
print "<tr><td>";
|
||||
print "Impossible de créer : ".$dir[$i];
|
||||
print "Failed to create directory: ".$dir[$i];
|
||||
print '</td><td>';
|
||||
print $langs->trans("Error");
|
||||
print "</td></tr>";
|
||||
@ -216,7 +216,7 @@ if ($_POST["action"] == "set")
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog ("Le dossier '".$dir[$i]."' a ete cree");
|
||||
dolibarr_syslog("Directory '".$dir[$i]."' created");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user