From 29d26b6e89dda4b1d7648a445c54c25ea3ac5b72 Mon Sep 17 00:00:00 2001 From: patrick Delcroix Date: Tue, 22 May 2018 22:16:25 +0200 Subject: [PATCH] New: support sellist in modulebuilder --- htdocs/core/class/commonobject.class.php | 27 ++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 750ddd8337c..c90c5c43283 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4981,7 +4981,9 @@ abstract class CommonObject $out=''; $type=''; $param['options']=array(); - $keyprefix = $keyprefix.'options_'; // Because we work on extrafields + $size =$this->fields[$key]['size']; + $keyprefix = $keyprefix.'options_'; + // Because we work on extrafields if(preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)){ $param['options']=array($reg[1].':'.$reg[2]=>'N'); $type ='link'; @@ -4992,6 +4994,19 @@ abstract class CommonObject $param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4]=>'N'); $type ='sellist'; + }else if(preg_match('/varchar\((\d+)\)/', $val['type'],reg)){ + + $param['options']=array(); + $type ='varchar'; + $size=$reg[1]; + }else if(preg_match('/varchar/', $val['type'])){ + + $param['options']=array(); + $type ='varchar'; + }else if(is_array($this->fields[$key]['arrayofkeyval'])){ + + $param['options']=$this->fields[$key]['arrayofkeyval']; + $type ='select'; }else { $param['options']=array(); $type =$this->fields[$key]['type']; @@ -5002,12 +5017,12 @@ abstract class CommonObject //$elementtype=$this->fields[$key]['elementtype']; // Seems not used $default=$this->fields[$key]['default']; $computed=$this->fields[$key]['computed']; - //$unique=$this->fields[$key]['unique']; + $unique=$this->fields[$key]['unique']; $required=$this->fields[$key]['required']; - //$langfile=$this->fields[$key]['label']; - //$list=$this->fields[$key]['arrayofkeyval']; - $hidden=!$this->fields[$key]['visible']; + $langfile=$this->fields[$key]['langfile']; + $list=$this->fields[$key]['list']; + $hidden=abs($this->fields[$key]['visible'])!=1?1:0; if ($computed) { @@ -5141,7 +5156,7 @@ abstract class CommonObject } $out.='