From f7a7ca4ff25b6d0d08b22b37bf6139c28d58593f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Sat, 18 Aug 2012 04:09:28 +0200 Subject: [PATCH] Fixed a bug where files were not being uploaded to a project's task Reported by Jose Antonio Garcia in dolibarr.es' forum http://www.dolibarr.es/index.php/foro/7-bugs-versiones-estables/1250-error-subir-archivo-en-una-tarea-de-un-proyecto --- htdocs/projet/tasks/document.php | 37 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index a60fab5b03a..45f19ccc95a 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -68,24 +68,6 @@ $projectstatic = new Project($db); * Actions */ -// Envoi fichier -if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) -{ - dol_add_file_process($upload_dir,0,1,'userfile'); -} - -// Delete -if ($action=='delete') -{ - $langs->load("other"); - $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - $ret=dol_delete_file($file); - if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); - else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); - Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); - exit; -} - // Retreive First Task ID of Project if withprojet is on to allow project prev next to work if (! empty($project_ref) && ! empty($withproject)) { @@ -120,6 +102,25 @@ if ($id > 0 || ! empty($ref)) dol_print_error($db); } } + +// Envoi fichier +if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) +{ + dol_add_file_process($upload_dir,0,1,'userfile'); +} + +// Delete +if ($action=='delete') +{ + $langs->load("other"); + $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + exit; +} + /* * View */