2
0
forked from Wavyzz/dolibarr

Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0

This commit is contained in:
Laurent Destailleur (aka Eldy)
2025-01-30 12:58:03 +01:00
15 changed files with 101 additions and 43 deletions

View File

@@ -65,7 +65,10 @@ if ($reshook < 0) {
}
if ($id > 0 || $ref) {
$object->fetch($id, $ref);
$ret = $object->fetch($id, $ref);
if ($ret > 0) {
$projectstatic->fetch($object->fk_project);
}
}
// Security check
@@ -204,14 +207,14 @@ if ($action == 'remove_file' && $user->hasRight('projet', 'creer')) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$langs->load("other");
$upload_dir = $conf->project->dir_output;
$upload_dir = $conf->project->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
$file = $upload_dir.'/'.dol_sanitizeFileName(GETPOST('file'));
$ret = dol_delete_file($file);
if ($ret) {
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
}
}
@@ -222,7 +225,6 @@ if ($action == 'remove_file' && $user->hasRight('projet', 'creer')) {
$form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
$result = $projectstatic->fetch($object->fk_project);
$title = $object->ref;
if (!empty($withproject)) {
@@ -692,7 +694,7 @@ if ($id > 0 || !empty($ref)) {
/*
* Generated documents
*/
$filename = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
$filename = '';
$filedir = $conf->project->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = ($user->rights->projet->lire);