From df88dc2f235aea1b178fb50461a8dfd93dd08c65 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Jul 2013 14:57:20 +0200 Subject: [PATCH] Use a better variable name --- htdocs/core/class/html.formfile.class.php | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c77606d75bc..9290c9873bf 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -156,7 +156,7 @@ class FormFile * Show the box with list of available documents for object * * @param string $modulepart propal, facture, facture_fourn, ... - * @param string $filename Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if $filedir is already complete) + * @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $filedir Directory to scan * @param string $urlsource Url of origin page (for return) * @param int $genallowed Generation is allowed (1/0 or array of formats) @@ -173,10 +173,10 @@ class FormFile * @param string $codelang Default language code to use on lang combo box if multilang is enabled * @return int <0 if KO, number of shown files if OK */ - function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='') + function show_documents($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='') { $this->numoffiles=0; - print $this->showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed,$modelselected,$allowgenifempty,$forcenomultilang,$iconPDF,$maxfilenamelength,$noform,$param,$title,$buttonlabel,$codelang); + print $this->showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed,$modelselected,$allowgenifempty,$forcenomultilang,$iconPDF,$maxfilenamelength,$noform,$param,$title,$buttonlabel,$codelang); return $this->numoffiles; } @@ -185,7 +185,7 @@ class FormFile * This also set the property $this->numoffiles * * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule_temp', ...) - * @param string $filename Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if $filedir is already complete) + * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $filedir Directory to scan * @param string $urlsource Url of origin page (for return) * @param int $genallowed Generation is allowed (1/0 or array list of templates) @@ -203,7 +203,7 @@ class FormFile * @param string $morepicto Add more HTML content into cell with picto * @return string Output string with HTML array of documents (might be empty string) */ - function showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='') + function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='') { global $langs,$conf,$hookmanager; global $bc; @@ -213,7 +213,7 @@ class FormFile // For backward compatibility if (! empty($iconPDF)) { - return $this->getDocumentsLink($modulepart, $filename, $filedir); + return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } $printer = ($user->rights->printipp->read && $conf->printipp->enabled)?true:false; $hookmanager->initHooks(array('formfile')); @@ -486,9 +486,9 @@ class FormFile // Define relative path for download link (depends on module) $relativepath=$file["name"]; // Cas general - if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture... + if ($modulesubdir) $relativepath=$modulesubdir."/".$file["name"]; // Cas propal, facture... // Autre cas - if ($modulepart == 'donation') { $relativepath = get_exdir($filename,2).$file["name"]; } + if ($modulepart == 'donation') { $relativepath = get_exdir($modulesubdir,2).$file["name"]; } if ($modulepart == 'export') { $relativepath = $file["name"]; } $out.= ""; @@ -571,11 +571,11 @@ class FormFile * Show only Document icon with link * * @param string $modulepart propal, facture, facture_fourn, ... - * @param string $filename Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if $filedir is already complete) + * @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $filedir Directory to scan * @return string Output string with HTML link of documents (might be empty string) */ - function getDocumentsLink($modulepart, $filename, $filedir) + function getDocumentsLink($modulepart, $modulesubdir, $filedir) { if (! function_exists('dol_dir_list')) { include DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -585,10 +585,10 @@ class FormFile $this->numoffiles=0; - $file_list=dol_dir_list($filedir, 'files', 0, $filename.'.pdf', '\.meta$|\.png$'); + $file_list=dol_dir_list($filedir, 'files', 0, $modulesubdir.'.pdf', '\.meta$|\.png$'); // For ajax treatment - $out.= '
'.img_picto('', 'refresh').'
'."\n"; + $out.= '
'.img_picto('', 'refresh').'
'."\n"; if (! empty($file_list)) { @@ -597,10 +597,10 @@ class FormFile { // Define relative path for download link (depends on module) $relativepath=$file["name"]; // Cas general - if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture... + if ($modulesubdir) $relativepath=$modulesubdir."/".$file["name"]; // Cas propal, facture... // Autre cas if ($modulepart == 'donation') { - $relativepath = get_exdir($filename,2).$file["name"]; + $relativepath = get_exdir($modulesubdir,2).$file["name"]; } if ($modulepart == 'export') { $relativepath = $file["name"];