From b2795a1a3e3ac9907eb5c1dece99f7fcc2cb167f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2011 22:37:40 +0000 Subject: [PATCH] First change to allow an external module to provide its doc generation module. --- htdocs/core/class/html.formfile.class.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index e219788553a..675c1a0ee1d 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -175,7 +175,7 @@ class FormFile { $modellist=array(); $cgvlist=array(); - + if ($modulepart == 'company') { $showempty=1; @@ -324,8 +324,23 @@ class FormFile } else { - dol_print_error($this->db,'Bad value for modulepart'); - return -1; + // Generic feature, for external modules + $file=dol_buildpath('/includes/modules/'.$modulepart.'/modules_'.$modulepart.'.php',0); + if (file_exists($file)) + { + $res=include_once($file); + } + $class='Modele'.ucfirst($modulepart); + if (class_exists($class)) + { + $model=new $class(); + $modellist=$model->liste_modeles($this->db); + } + else + { + dol_print_error($this->db,'Bad value for modulepart'); + return -1; + } } $headershown=1; @@ -349,7 +364,7 @@ class FormFile print ''; print $langs->trans('Model').' '; print $html->selectarray('model',$modellist,$modelselected,$showempty,0,0); - if (sizeof($cgvlist) > 0) + if (sizeof($cgvlist) > 0) { print $html->selectarray('cgv',$cgvlist,"-1",1,0,1); }