Fix: hook functions with better name

New: add hook in builddoc bloc
This commit is contained in:
Regis Houssin 2011-04-08 17:21:42 +00:00
parent dfa5d2332a
commit 5c1fd271ef
6 changed files with 25 additions and 6 deletions

View File

@ -1598,7 +1598,7 @@ if ($id > 0 || ! empty($ref))
$var=true; $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);
/* /*

View File

@ -143,9 +143,10 @@ class FormFile
* @param title Title to show on top of form * @param title Title to show on top of form
* @param buttonlabel Label on submit button * @param buttonlabel Label on submit button
* @param codelang Default language code to use on lang combo box if multilang is enabled * @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 * @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) // filedir = conf->...dir_ouput."/".get_exdir(id)
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
@ -359,6 +360,15 @@ class FormFile
} }
print '</td>'; print '</td>';
// Hook of thirdparty module
if (! empty($hooks) && is_array($hooks))
{
foreach($hooks as $module)
{
$module->formBuilddocOptions();
}
}
// Button // Button
print '<td align="center" colspan="'.($delallowed?'2':'1').'">'; print '<td align="center" colspan="'.($delallowed?'2':'1').'">';
print '<input class="button" '; print '<input class="button" ';
@ -374,6 +384,15 @@ class FormFile
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Hook of thirdparty module
if (! empty($hooks) && is_array($hooks))
{
foreach($hooks as $module)
{
$module->formBuilddocOptions();
}
}
} }
// Get list of files // Get list of files

View File

@ -50,7 +50,7 @@
if (! empty($object->hooks)) { if (! empty($object->hooks)) {
foreach($object->hooks as $module) { foreach($object->hooks as $module) {
$module->formAddProductOption($object); $module->formCreateProductOptions($object);
} }
} }

View File

@ -42,7 +42,7 @@
<?php <?php
if (! empty($this->hooks)) { if (! empty($this->hooks)) {
foreach($this->hooks as $module) { foreach($this->hooks as $module) {
$module->formAddProductOption($this,$line->fk_parent_line); $module->formEditProductOptions($this,$line->fk_parent_line);
echo '<br>'; echo '<br>';
} }
} }

View File

@ -62,7 +62,7 @@
if (! empty($object->hooks)) { if (! empty($object->hooks)) {
foreach($object->hooks as $module) { foreach($object->hooks as $module) {
$module->formAddProductOption($object); $module->formCreateProductOptions($object);
} }
} }

View File

@ -50,7 +50,7 @@
if (! empty($this->hooks)) { if (! empty($this->hooks)) {
foreach($this->hooks as $module) { foreach($this->hooks as $module) {
$module->formAddProductOption($this,$line->fk_parent_line); $module->formEditProductOptions($this,$line->fk_parent_line);
echo '<br>'; echo '<br>';
} }
} }