mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 17:14:44 +01:00
* API/customfields: fix for Stylite Ticket#2629 ->Mandatory custom field not saved<- fix for customfields (if mandatory) where not saved on first attempt, after failed formvalidation.
This commit is contained in:
parent
d50d0f3d0a
commit
ed9f079fda
@ -531,15 +531,19 @@ class link_widget
|
|||||||
switch($extension_data['type'])
|
switch($extension_data['type'])
|
||||||
{
|
{
|
||||||
case 'link-entry':
|
case 'link-entry':
|
||||||
|
//error_log(__METHOD__.__LINE__.array2string(array('data'=>$value,'value in'=>$value_in,'extension_data'=>$extension_data,'source'=>function_backtrace())));
|
||||||
if (!$value_in['id'] && $extension_data['needed'])
|
if (!$value_in['id'] && $extension_data['needed'])
|
||||||
{
|
{
|
||||||
$tmpl->set_validation_error($name,lang('Field must not be empty !!!'),'');
|
$tmpl->set_validation_error($name,lang('Field must not be empty !!!'),'');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (is_array($extension_data['default']))
|
// beware: default may be something like Array([link_type] => [query] => [id] => ) so take care for id, in case it is empty AND needed
|
||||||
|
if (is_array($extension_data['default']) && !empty($extension_data['default']))
|
||||||
{
|
{
|
||||||
$value = $extension_data['default'];
|
$value = $extension_data['default'];
|
||||||
$value['current'] = $extension_data['app'] ? $value_in['id'] : $value_in['app'].':'.$value_in['id'];
|
$value['current'] = $extension_data['app'] ? $value_in['id'] : $value_in['app'].':'.$value_in['id'];
|
||||||
|
// we take care for id, in case it is empty AND needed
|
||||||
|
if(empty($value['id']) && $extension_data['needed']) $value['id'] = $value['current'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user