diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index f02b33c5dc7..849e0772a94 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -243,7 +243,7 @@ while (($file = readdir($handle))!==false) // Info $htmltooltip=''; - $nextval=$module->getNextValue(); + $nextval=$module->getNextValue($mysoc,''); if ($nextval != $langs->trans("NotAvailable")) { $htmltooltip=''.$langs->trans("NextValue").': '.$nextval; diff --git a/htdocs/expedition/mods/methode_expedition.modules.php b/htdocs/expedition/mods/methode_expedition.modules.php index b063c2fdc67..8baaea11207 100644 --- a/htdocs/expedition/mods/methode_expedition.modules.php +++ b/htdocs/expedition/mods/methode_expedition.modules.php @@ -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); diff --git a/htdocs/includes/modules/facture/modules_facture.php b/htdocs/includes/modules/facture/modules_facture.php index cd431f80a06..61600b10f52 100644 --- a/htdocs/includes/modules/facture/modules_facture.php +++ b/htdocs/includes/modules/facture/modules_facture.php @@ -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 . "\" diff --git a/htdocs/includes/modules/facture/orion/orion.modules.php b/htdocs/includes/modules/facture/orion/orion.modules.php index 56f728f13e1..a7ed314a1bf 100644 --- a/htdocs/includes/modules/facture/orion/orion.modules.php +++ b/htdocs/includes/modules/facture/orion/orion.modules.php @@ -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); } diff --git a/htdocs/includes/modules/facture/titan/titan.modules.php b/htdocs/includes/modules/facture/titan/titan.modules.php index d9a86f8b37f..ff48287a27d 100644 --- a/htdocs/includes/modules/facture/titan/titan.modules.php +++ b/htdocs/includes/modules/facture/titan/titan.modules.php @@ -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); } diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 6d255cd48f6..5028452f427 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -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 "