From 71d5191ff7c8b38e4bcc869a561a4e8125090710 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 12 Sep 2012 10:46:35 +0200 Subject: [PATCH] Fix: duplicate parameters --- htdocs/core/class/html.formfile.class.php | 6 ++++-- htdocs/core/lib/files.lib.php | 4 ++-- htdocs/product/document.php | 3 +-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index e08dc1cd9c8..db2cdb8cfcb 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -551,7 +551,7 @@ class FormFile * @param string $url Full url to use for click links ('' = autodetect) * @return int <0 if KO, nb of files shown if OK */ - function list_of_documents($filearray,$object,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='') + function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='') { global $user, $conf, $langs; global $bc, $hookmanager; @@ -588,6 +588,8 @@ class FormFile } else { + $param = (isset($object->id)?'&id='.$object->id:'').$param; + // Show list of existing files if (empty($useinecm)) print_titre($title?$title:$langs->trans("AttachedFiles")); if (empty($url)) $url=$_SERVER["PHP_SELF"]; @@ -642,7 +644,7 @@ class FormFile // Delete or view link print ''; if ($useinecm) print ''.img_view().'   '; - if ($permtodelete) print ''.img_delete().''; + if ($permtodelete) print ''.img_delete().''; else print ' '; print ""; print "\n"; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 89846ffc248..5f415707bb4 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -716,7 +716,7 @@ function dolMoveUploadedFile($src_file, $dest_file, $allowoverwrite, $notrigger= { if (file_exists($file_name_osencoded)) { - dol_syslog("Files.lib::dol_move_uploaded_file File ".$file_name." already exists. Return 'ErrorFileAlreadyExists'", LOG_WARNING); + dol_syslog("Files.lib::dol_move_uploaded_file File ".$dest_file." already exists. Return 'ErrorFileAlreadyExists'", LOG_WARNING); return 'ErrorFileAlreadyExists'; } } @@ -726,7 +726,7 @@ function dolMoveUploadedFile($src_file, $dest_file, $allowoverwrite, $notrigger= if ($return) { if (! empty($conf->global->MAIN_UMASK)) @chmod($file_name_osencoded, octdec($conf->global->MAIN_UMASK)); - dol_syslog("Files.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG); + dol_syslog("Files.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$dest_file." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG); if (! $notrigger) { diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 012133f4eaa..7ee96daf980 100755 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -151,8 +151,7 @@ if ($object->id) // List of document - $param='&id='.$object->id; - $formfile->list_of_documents($filearray,$object,'produit',$param); + $formfile->list_of_documents($filearray,$object,'produit'); } else