Skip to content

Commit

Permalink
Evarisk#1091 [Code] fix: file can't be downloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-kilyan committed Oct 24, 2024
1 parent 18b639b commit ee6bfb7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions core/modules/modSaturne.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ public function init($options = ''): int
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

dolibarr_set_const($this->db, 'MAIN_UMASK', '0664', 'chaine', 0, 0, 'global', 1);

return $this->_init($sql, $options);
}

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/en_US/saturne.lang
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ CheckDocumentationToEnablePDFGeneration = Please refer to the documentation for
PDFGenerationTooltip = Appuyez sur ce bouton pour générer le document ODT en PDF
PDFGeneration = Generating the PDF document
NoData = N/A
FileCouldNotBeDownloadConf = The file could not be downloaded cause of a permission issue



Expand Down
2 changes: 1 addition & 1 deletion langs/fr_FR/saturne.lang
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +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 ee6bfb7

Please sign in to comment.