Skip to content

Commit

Permalink
Evarisk#1091 [Core] fix: file can't be download after copy when conf …
Browse files Browse the repository at this point in the history
…is 0660
  • Loading branch information
evarisk-kilyan committed Sep 27, 2024
1 parent 41d227b commit 7fb7f78
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions core/modules/modSaturne.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ public function __construct($db)
'user' => 0,
];
}

$conf->global->MAIN_UMASK = '0664';
}

/**
Expand Down
12 changes: 10 additions & 2 deletions core/modules/saturne/modules_saturne.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,17 @@ public function info(Translate $langs): string
$info .= '<input type="hidden" class="template-path" value="' . $path . '">';
$info .= '- ' . $file['name'];
if (!$this->custom_info) {
$info .= ' <a class="wpeo-button button-blue download-template" style="padding: 1px 2px;">' . img_picto('', 'download') . '</a>';
if (getDolGlobalString('MAIN_UMASK') == '0664') {
$info .= ' <a class="wpeo-button button-blue download-template" style="padding: 1px 2px;">' . img_picto('', 'download') . '</a>';
} else {
$info .= ' <a class="wpeo-button button-grey classfortooltip" style="padding: 1px 2px;" title="' . $langs->transnoentities('FileCouldNotBeDownloadConf') . '">' . img_picto('', 'download') . '</a>';
}
} else {
$info .= ' <a class="wpeo-button button-blue" style="padding: 1px 2px;" href="' . DOL_URL_ROOT . '/document.php?modulepart=ecm&attachment=1&entity=' . $conf->entity . '&file=' . $this->module . '/' . dol_strtolower($this->document_type) . '/' . $file['name'] . '">' . img_picto('', 'fontawesome_fa-download_fas_#ffffff') . '</a>';
if (getDolGlobalString('MAIN_UMASK') == '0664') {
$info .= ' <a class="wpeo-button button-blue" style="padding: 1px 2px;" href="' . DOL_URL_ROOT . '/document.php?modulepart=ecm&attachment=1&entity=' . $conf->entity . '&file=' . $this->module . '/' . dol_strtolower($this->document_type) . '/' . $file['name'] . '">' . img_picto('', 'fontawesome_fa-download_fas_#ffffff') . '</a>';
} else {
$info .= ' <a class="wpeo-button button-grey classfortooltip" style="padding: 1px 2px;" title="' . $langs->transnoentities('FileCouldNotBeDownloadConf') . '">' . img_picto('', 'fontawesome_fa-download_fas_#ffffff') . '</a>';
}
$info .= ' <a class="wpeo-button button-red" style="padding: 1px 2px;" href="' . $_SERVER['PHP_SELF'] . '?module_name=' . $this->module . '&modulepart=ecm&keyforuploaddir='. $confName . '&action=deletefile&token=' . newToken() . '&file=' . urlencode(basename($file['name'])) . '&type=' . $this->document_type . '">' . img_picto('', 'fontawesome_fa-trash_fas_#ffffff') . '</a>';
}
$info .= '<br>';
Expand Down
1 change: 1 addition & 0 deletions langs/fr_FR/saturne.lang
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ CheckDocumentationToEnablePDFGeneration = Veuillez vous référer à la document
PDFGenerationTooltip = Appuyez sur ce bouton pour générer le document ODT en PDF
PDFGeneration = Génération du document PDF
NoData = N/A
FileCouldNotBeDownloadConf = Le fichier ne peux pas être téléchargé a cause d'un problème de permission



Expand Down

0 comments on commit 7fb7f78

Please sign in to comment.