diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index f719b11f301..df73248b071 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -33,6 +33,8 @@ class FormFile { var $db; var $error; + + var $numoffiles; /** @@ -42,6 +44,8 @@ class FormFile function FormFile($DB) { $this->db = $DB; + + $this->numoffiles=0; return 1; } @@ -124,7 +128,6 @@ class FormFile return 1; } - /** * Show the box with list of available documents for object * @param modulepart propal, facture, facture_fourn, ... @@ -147,11 +150,40 @@ class FormFile * @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='',$hooks='') + { + print $this->showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed,$modelselected,$allowgenifempty,$forcenomultilang,$iconPDF,$maxfilenamelength,$noform,$param,$title,$buttonlabel,$codelang,$hooks); + } + + /** + * Show the box with list of available documents for object + * @param modulepart propal, facture, facture_fourn, ... + * @param filename Sub dir to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if filedir already complete) + * @param filedir Dir to scan + * @param urlsource Url of origin page (for return) + * @param genallowed Generation is allowed (1/0 or array of formats) + * @param delallowed Remove is allowed (1/0) + * @param modelselected Model to preselect by default + * @param allowgenifempty Show warning if no model activated + * @param forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) + * @param iconPDF Show only PDF icon with link (1/0) + * @param maxfilenamelength Max length for filename shown + * @param noform Do not output html form tags + * @param param More param on http links + * @param title Title to show on top of form + * @param buttonlabel Label on submit button + * @param codelang Default language code to use on lang combo box if multilang is enabled + * @param hooks Object hook of external modules + * @return int <0 if KO, number of shown files if OK + */ + function showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$hooks='') { // filedir = conf->...dir_ouput."/".get_exdir(id) include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); global $langs,$bc,$conf; + + $out=''; + $var=true; if ($iconPDF == 1) @@ -167,7 +199,7 @@ class FormFile $showempty=0; $i=0; - print "\n".''."\n"; + $out.= "\n".''."\n"; //print 'filedir='.$filedir; // Affiche en-tete tableau @@ -349,69 +381,69 @@ class FormFile $buttonlabeltoshow=$buttonlabel; if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate'); - if (empty($noform)) print '