FIX #10183 using backport of fix done in 9.0

This commit is contained in:
Laurent Destailleur 2018-12-13 20:45:51 +01:00
parent 4a61c1b6ed
commit 7a3ab13196

View File

@ -1910,24 +1910,36 @@ class ExtraFields
/**
* return array_options array of data of extrafields value of object sent by a search form
*
* @param array $extralabels $array of extrafields (@deprecated)
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @return array|int array_options set or 0 if no value
* @param array|string $extrafieldsobjectkey array of extrafields (old usage) or value of object->table_element (new usage)
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @return array|int array_options set or 0 if no value
*/
function getOptionalsFromPost($extralabels,$keyprefix='',$keysuffix='')
function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix='', $keysuffix='')
{
global $_POST;
if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label'];
if (is_string($extrafieldsobjectkey) && is_array($this->attributes[$extrafieldsobjectkey]['label']))
{
$extralabels = $this->attributes[$extrafieldsobjectkey]['label'];
}
else
{
$extralabels = $extrafieldsobjectkey;
}
$array_options = array();
if (is_array($extralabels))
{
$array_options = array();
// Get extra fields
foreach ($extralabels as $key => $value)
{
$key_type = $this->attributes[$object->table_element]['type'][$key];
$key_type = '';
if (is_string($extrafieldsobjectkey))
{
$key_type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
}
if (in_array($key_type,array('date','datetime')))
{
@ -1956,8 +1968,7 @@ class ExtraFields
return $array_options;
}
else {
return 0;
}
return 0;
}
}