diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 7227556d5ac..e41334a30e0 100755 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -131,7 +131,7 @@ class HookManager // Define type of hook ('output', 'returnvalue' or 'addreplace'). 'addreplace' should be type for all hooks. 'output' and 'returnvalue' are deprecated. $hooktype='output'; if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win. - if (in_array($method,array('doActions','formObjectOptions','moveUploadedFile','pdf_writelinedesc','paymentsupplierinvoices','printSearchForm'))) $hooktype='addreplace'; + if (in_array($method,array('doActions','formObjectOptions','moveUploadedFile','pdf_writelinedesc','paymentsupplierinvoices','printSearchForm', 'formattachOptions', 'formBuilddocLineOptions'))) $hooktype='addreplace'; // Loop on each hook to qualify modules that declared context $modulealreadyexecuted=array(); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 9368864c7d0..84946405a93 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -64,7 +64,8 @@ class FormFile */ function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=true) { - global $conf,$langs; + global $conf,$langs, $hookmanager; + $hookmanager->initHooks(array('formfile')); if (! empty($conf->browser->phone)) return 0; @@ -76,22 +77,22 @@ class FormFile { $maxlength=$size; - print "\n\n\n"; + $out = "\n\n\n"; if (empty($title)) $title=$langs->trans("AttachANewFile"); if ($title != 'none') print_titre($title); - print '
'; - if (empty($sectionid)) print '