NEW : continue hidden extrafield feature
This commit is contained in:
parent
66ea799eb7
commit
c7a9f26ee5
@ -63,7 +63,7 @@ class ExtraFields
|
||||
var $errno;
|
||||
|
||||
var $attribute_hidden;
|
||||
|
||||
|
||||
public static $type2label=array(
|
||||
'varchar'=>'String',
|
||||
'text'=>'TextLong',
|
||||
@ -665,6 +665,7 @@ class ExtraFields
|
||||
$param=$this->attribute_param[$key];
|
||||
$perms=$this->attribute_perms[$key];
|
||||
$list=$this->attribute_list[$key];
|
||||
$hidden=$this->attribute_hidden[$key];
|
||||
|
||||
if (empty($showsize))
|
||||
{
|
||||
@ -686,7 +687,7 @@ class ExtraFields
|
||||
if ($showsize > 48) $showsize=48;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (in_array($type,array('date','datetime')))
|
||||
{
|
||||
$tmp=explode(',',$size);
|
||||
@ -823,7 +824,7 @@ class ExtraFields
|
||||
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
|
||||
$InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]);
|
||||
}
|
||||
|
||||
|
||||
// current object id can be use into filter
|
||||
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) {
|
||||
$InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]);
|
||||
@ -841,14 +842,14 @@ class ExtraFields
|
||||
$sqlwhere.= ' WHERE '.$InfoFieldList[4];
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$sqlwhere.= ' WHERE 1=1';
|
||||
}
|
||||
// Some tables may have field, some other not. For the moment we disable it.
|
||||
if (in_array($InfoFieldList[0],array('tablewithentity')))
|
||||
if (in_array($InfoFieldList[0],array('tablewithentity')))
|
||||
{
|
||||
$sqlwhere.= ' AND entity = '.$conf->entity;
|
||||
$sqlwhere.= ' AND entity = '.$conf->entity;
|
||||
}
|
||||
$sql.=$sqlwhere;
|
||||
//print $sql;
|
||||
@ -1007,19 +1008,19 @@ class ExtraFields
|
||||
$sql = 'SELECT ' . $keyList;
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
|
||||
if (! empty($InfoFieldList[4])) {
|
||||
|
||||
|
||||
// can use SELECT request
|
||||
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
|
||||
$InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]);
|
||||
}
|
||||
|
||||
|
||||
// current object id can be use into filter
|
||||
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) {
|
||||
$InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]);
|
||||
} else {
|
||||
$InfoFieldList[4]=str_replace('$ID$','0',$InfoFieldList[4]);
|
||||
}
|
||||
|
||||
|
||||
// We have to join on extrafield table
|
||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
|
||||
@ -1031,13 +1032,13 @@ class ExtraFields
|
||||
$sqlwhere .= ' WHERE 1=1';
|
||||
}
|
||||
// Some tables may have field, some other not. For the moment we disable it.
|
||||
if (in_array($InfoFieldList[0], array ('tablewithentity')))
|
||||
if (in_array($InfoFieldList[0], array ('tablewithentity')))
|
||||
{
|
||||
$sqlwhere .= ' AND entity = ' . $conf->entity;
|
||||
}
|
||||
// $sql.=preg_replace('/^ AND /','',$sqlwhere);
|
||||
// print $sql;
|
||||
|
||||
|
||||
$sql .= $sqlwhere;
|
||||
dol_syslog(get_class($this) . '::showInputField type=chkbxlst',LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -1143,6 +1144,9 @@ class ExtraFields
|
||||
$out.='Error bad setup of extrafield';
|
||||
}
|
||||
}
|
||||
if (!empty($hidden)) {
|
||||
$out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>';
|
||||
}
|
||||
/* Add comments
|
||||
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
||||
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
|
||||
@ -1171,6 +1175,7 @@ class ExtraFields
|
||||
$params=$this->attribute_param[$key];
|
||||
$perms=$this->attribute_perms[$key];
|
||||
$list=$this->attribute_list[$key];
|
||||
$hidden=$this->attribute_hidden[$key];
|
||||
|
||||
$showsize=0;
|
||||
if ($type == 'date')
|
||||
@ -1402,10 +1407,14 @@ class ExtraFields
|
||||
$showsize=round($size);
|
||||
if ($showsize > 48) $showsize=48;
|
||||
}
|
||||
|
||||
|
||||
//print $type.'-'.$size;
|
||||
$out=$value;
|
||||
|
||||
|
||||
if (!empty($hidden)) {
|
||||
$out='';
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -1422,7 +1431,7 @@ class ExtraFields
|
||||
$type=$this->attribute_type[$key];
|
||||
|
||||
$align='';
|
||||
|
||||
|
||||
if ($type == 'date')
|
||||
{
|
||||
$align="center";
|
||||
@ -1451,10 +1460,10 @@ class ExtraFields
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
|
||||
|
||||
return $align;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return HTML string to print separator extrafield
|
||||
*
|
||||
@ -1534,7 +1543,7 @@ class ExtraFields
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return array_options array for object by extrafields value (using for data send by forms)
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user