FIX user odt

This commit is contained in:
arnaud 2017-03-03 12:01:58 +01:00
parent abeba95de9
commit cff9fa0e6b
2 changed files with 49 additions and 8 deletions

View File

@ -320,16 +320,29 @@ abstract class CommonDocGenerator
/**
* Define array with couple subtitution key => subtitution value
*
* @param Object $object Dolibarr Object
* @param Translate $outputlangs Language object for output
* @param boolean $recursive Want to fetch child array or child object
* @return array Array of substitution key->code
*/
function get_substitutionarray_each_var_object(&$object,$outputlangs,$recursive=true) {
foreach($object as $key => $value) {
if(!is_array($value) && !is_object($value)) {
$array_other['object_'.$key] = $value;
}
if(is_array($value) && $recursive){
foreach($value as $key2 => $val) {
$array_other[$key][$key2] = $this->get_substitutionarray_each_var_object($val,$outputlangs,false);
$array_other = array();
if(!empty($object)) {
foreach($object as $key => $value) {
if(!is_array($value) && !is_object($value)) {
$array_other['object_'.$key] = $value;
}
}
if(is_array($value) && $recursive){
if(!empty($value)) {
foreach($value as $key2 => $val) {
$array_other[$key][$key2] = $this->get_substitutionarray_each_var_object($val,$outputlangs,false);
}
}
}
}
}
return $array_other;
}

View File

@ -55,6 +55,34 @@ abstract class ModelePDFUser extends CommonDocGenerator
$type='user';
$liste=array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$liste=getListOfModels($db,$type,$maxfilenamelength);
return $liste;
}
}
/**
* Parent class to manage intervention document templates
*/
abstract class ModelePDFUserGroup extends CommonDocGenerator
{
var $error='';
/**
* Return list of active generation modules
*
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;
$type='usergroup';
$liste=array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$liste=getListOfModels($db,$type,$maxfilenamelength);
return $liste;