mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 10:53:39 +01:00
correct validation errors, if no file selected or file could not be attached
This commit is contained in:
parent
9310a2b0d8
commit
8cd67e0af7
@ -446,7 +446,7 @@ class link_widget
|
||||
* @param mixed &$value the extension returns here it's input, if there's any
|
||||
* @param mixed &$extension_data persistent storage between calls or pre- and post-process
|
||||
* @param boolean &$loop can be set to true to request a re-submision of the form/dialog
|
||||
* @param object &$tmpl the eTemplate the widget belongs too
|
||||
* @param etemplate &$tmpl the eTemplate the widget belongs too
|
||||
* @param mixed &value_in the posted values (already striped of magic-quotes)
|
||||
* @return boolean true if $value has valid content, on false no content will be returned!
|
||||
*/
|
||||
@ -527,6 +527,7 @@ class link_widget
|
||||
break;
|
||||
|
||||
case 'attach':
|
||||
$name = preg_replace('/^exec\[([^]]+)\](.*)$/','\\1\\2',$name); // remove exec prefix
|
||||
if (is_array($value['file']) && $value['to_app'] &&
|
||||
!empty($value['file']['tmp_name']) && $value['file']['tmp_name'] != 'none')
|
||||
{
|
||||
@ -543,8 +544,13 @@ class link_widget
|
||||
move_uploaded_file($value['file']['tmp_name'],$new_file);
|
||||
$value['file']['tmp_name'] = $new_file;
|
||||
}
|
||||
$link_id = egw_link::link($value['to_app'],$value['to_id'],
|
||||
egw_link::VFS_APPNAME,$value['file'],$value['remark']);
|
||||
if (!($link_id = egw_link::link($value['to_app'],$value['to_id'],
|
||||
egw_link::VFS_APPNAME,$value['file'],$value['remark'])))
|
||||
{
|
||||
etemplate::set_validation_error($name.'[file]',lang('Error copying uploaded file to vfs!'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$value['remark'] = '';
|
||||
|
||||
if (isset($value['primary']) && !$value['anz_links'] )
|
||||
@ -554,9 +560,10 @@ class link_widget
|
||||
unset($value['comment']);
|
||||
unset($value['file']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$value['msg'] = 'You need to select a file first!';
|
||||
etemplate::set_validation_error($name.'[file]',lang('You need to select a file first!'));
|
||||
}
|
||||
$extension_data = $value;
|
||||
$loop = True;
|
||||
|
Loading…
Reference in New Issue
Block a user