Skip to content

Commit

Permalink
Merge pull request #32128 from altairisfr/dirgenpdf
Browse files Browse the repository at this point in the history
FIX output dir for generated modules
  • Loading branch information
eldy authored Jan 13, 2025
2 parents 0097d75 + a1a102b commit 700efa5
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,23 +263,25 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
*/

//if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva;
$dir_output = getMultidirOutput($object, $object->module);
if (!empty($dir_output)) {
$dir_output .= '/' . $object->element;

if (getMultidirOutput($object)) {
$object->fetch_thirdparty();

$dir = null;
// Definition of $dir and $file
if ($object->specimen) {
$dir = getMultidirOutput($object);
$dir = $dir_output;
$file = $dir."/SPECIMEN.pdf";
} else {
$objectref = dol_sanitizeFileName($object->ref);
$dir = getMultidirOutput($object)."/".$objectref;
$dir = $dir_output."/".$objectref;
$file = $dir."/".$objectref.".pdf";
}
if ($dir === null) {
return 0;
}
// if ($dir === null) {
// return 0;
// }
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
Expand Down Expand Up @@ -837,7 +839,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
* Return list of active generation models
*
* @param DoliDB $db Database handler
* @param int<0,max> $maxfilenamelength Max length of value to show
Expand Down

0 comments on commit 700efa5

Please sign in to comment.