diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index de9fb91a6f3..cb8dace1734 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -2,6 +2,7 @@ /* Copyright (c) 2008-2013 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (c) 2010 Juanjo Menent + * Copyright (c) 2013 Charles-Fr BENKE * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -732,8 +733,16 @@ class FormFile print ''; + //print '&file='.urlencode($relativepath.$file['name']).'">'; + if ($file['level1name'] <> $object->id) + $filepath=urlencode($object->id.'/'.$file['level1name'].'/'.$file['name']); + else + $filepath=urlencode($object->id.'/'.$file['name']); + print '&file='.$filepath.'">'; + print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' '; + if ($file['level1name'] <> $object->id) + print $file['level1name'].'/'; print dol_trunc($file['name'],$maxlength,'middle'); print ''; print "\n"; @@ -753,7 +762,14 @@ class FormFile // ($param must start with &) print ''; if ($useinecm) print ''.img_view().'   '; - if ($permtodelete) print ''.img_delete().''; + if ($permtodelete) + { + if ($file['level1name'] <> $object->id) + $filepath=urlencode($file['level1name'].'/'.$file['name']); + else + $filepath=urlencode($file['name']); + print ''.img_delete().''; + } else print ' '; print ""; print "\n";