From 5c1fd271efebebf65bfd709b75bb79e84cd8cbe4 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 8 Apr 2011 17:21:42 +0000 Subject: [PATCH] Fix: hook functions with better name New: add hook in builddoc bloc --- htdocs/comm/propal.php | 2 +- htdocs/core/class/html.formfile.class.php | 21 ++++++++++++++++++- .../core/tpl/freeproductline_create.tpl.php | 2 +- htdocs/core/tpl/freeproductline_edit.tpl.php | 2 +- .../tpl/predefinedproductline_create.tpl.php | 2 +- .../tpl/predefinedproductline_edit.tpl.php | 2 +- 6 files changed, 25 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 02082dc40ca..f8e2bf4b496 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1598,7 +1598,7 @@ if ($id > 0 || ! empty($ref)) $var=true; - $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang); + $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang,$object->hooks); /* diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d74e92c288e..c5e689294e0 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -143,9 +143,10 @@ class FormFile * @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 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,$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'); @@ -358,6 +359,15 @@ class FormFile print ' '; } print ''; + + // Hook of thirdparty module + if (! empty($hooks) && is_array($hooks)) + { + foreach($hooks as $module) + { + $module->formBuilddocOptions(); + } + } // Button print ''; @@ -374,6 +384,15 @@ class FormFile print ''; print ''; + + // Hook of thirdparty module + if (! empty($hooks) && is_array($hooks)) + { + foreach($hooks as $module) + { + $module->formBuilddocOptions(); + } + } } // Get list of files diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index ce9b81cdece..4832836a62a 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -50,7 +50,7 @@ if (! empty($object->hooks)) { foreach($object->hooks as $module) { - $module->formAddProductOption($object); + $module->formCreateProductOptions($object); } } diff --git a/htdocs/core/tpl/freeproductline_edit.tpl.php b/htdocs/core/tpl/freeproductline_edit.tpl.php index 3247c21d6c9..b3052d42f21 100644 --- a/htdocs/core/tpl/freeproductline_edit.tpl.php +++ b/htdocs/core/tpl/freeproductline_edit.tpl.php @@ -42,7 +42,7 @@ hooks)) { foreach($this->hooks as $module) { - $module->formAddProductOption($this,$line->fk_parent_line); + $module->formEditProductOptions($this,$line->fk_parent_line); echo '
'; } } diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index bf54d561413..e83dd3309d2 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -62,7 +62,7 @@ if (! empty($object->hooks)) { foreach($object->hooks as $module) { - $module->formAddProductOption($object); + $module->formCreateProductOptions($object); } } diff --git a/htdocs/core/tpl/predefinedproductline_edit.tpl.php b/htdocs/core/tpl/predefinedproductline_edit.tpl.php index 509ac4a108d..58768013c97 100644 --- a/htdocs/core/tpl/predefinedproductline_edit.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_edit.tpl.php @@ -50,7 +50,7 @@ if (! empty($this->hooks)) { foreach($this->hooks as $module) { - $module->formAddProductOption($this,$line->fk_parent_line); + $module->formEditProductOptions($this,$line->fk_parent_line); echo '
'; } }