Make sure customfields get their set_row_value() method called. Fixes customfield dates were not sent in correct format

This commit is contained in:
nathan 2022-05-02 17:06:33 -06:00
parent b0a57a05fd
commit ae73511958

View File

@ -369,13 +369,43 @@ class Customfields extends Transformer
if (is_array($options))
{
Select::fix_encoded_options($options);
self::$request->sel_options[self::$prefix.$fname] = $options;
self::$request->sel_options[self::$prefix . $fname] = $options;
}
break;
}
return $widget;
}
/**
* Perform any needed data manipulation on each row
* before sending it to client.
*
* This is used by Nextmatch on each row to do any needed
* adjustments. Used here to make sure sub-widgets get their set_row_value method called
*
* @param string $cname
* @param array $expand
* @param array $data Row data
*/
public function set_row_value($cname, array $expand, array &$data)
{
$form_name = self::form_name($cname, $this->id, $expand);
$value =& $this->get_array($data, $form_name, true);
$customfields = Api\Storage\Customfields::get($this->attrs['app']);
foreach($customfields as $field_name => $field)
{
if(array_key_exists(self::$prefix . $field_name, $value))
{
$widget = $this->_widget($field_name, $field);
if(method_exists($widget, 'set_row_value'))
{
$widget->set_row_value('', $expand, $data[$form_name]);
}
}
}
}
/**
* Validate input
*