mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-20 18:08:02 +02:00
Infolog: When creating an event from an infolog, don't send an invalid category ID. Fixes validation error when saving the event.
This commit is contained in:
parent
558d6a5d0c
commit
c0f29e406f
@ -669,21 +669,33 @@ class infolog_ui
|
|||||||
{
|
{
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
$event = array_merge($data,array(
|
$event = array_merge($data, array(
|
||||||
'category' => $GLOBALS['egw']->categories->check_list(Acl::READ, $infolog['info_cat']),
|
'category' => $GLOBALS['egw']->categories->check_list(Acl::READ, $infolog['info_cat']),
|
||||||
'priority' => $infolog['info_priority'] + 1,
|
'priority' => $infolog['info_priority'] + 1,
|
||||||
'public' => $infolog['info_access'] != 'private',
|
'public' => $infolog['info_access'] != 'private',
|
||||||
'title' => $infolog['info_subject'],
|
'title' => $infolog['info_subject'],
|
||||||
'description' => $infolog['info_des'],
|
'description' => $infolog['info_des'],
|
||||||
'location' => $infolog['info_location'],
|
'location' => $infolog['info_location'],
|
||||||
'start' => $infolog['info_startdate'],
|
'start' => $infolog['info_startdate'],
|
||||||
'end' => $infolog['info_enddate'] ? $infolog['info_enddate'] : $infolog['info_datecompleted']
|
'end' => $infolog['info_enddate'] ? $infolog['info_enddate'] : $infolog['info_datecompleted']
|
||||||
));
|
));
|
||||||
unset($event['entry_id']);
|
unset($event['entry_id']);
|
||||||
if (!$event['end']) $event['end'] = $event['start'] + (int) $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength']*60;
|
if(!$event['end'])
|
||||||
|
{
|
||||||
|
$event['end'] = $event['start'] + (int)$GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength'] * 60;
|
||||||
|
}
|
||||||
|
|
||||||
// Match Api\Categories by name
|
// Match Api\Categories by name
|
||||||
$event['category'] = $GLOBALS['egw']->categories->name2id(Api\Categories::id2name($infolog['info_cat']));
|
if($infolog['info_cat'])
|
||||||
|
{
|
||||||
|
$event['category'] = $GLOBALS['egw']->categories->name2id(Api\Categories::id2name($infolog['info_cat']));
|
||||||
|
}
|
||||||
|
if(!$event['category'] || $event['category'] === '0')
|
||||||
|
{
|
||||||
|
// No matching category found, don't send an invalid category
|
||||||
|
unset($event['category']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// make current user the owner of the new event, not the selected calendar, if current user has rights for it
|
// make current user the owner of the new event, not the selected calendar, if current user has rights for it
|
||||||
$event['owner'] = $user = $GLOBALS['egw_info']['user']['account_id'];
|
$event['owner'] = $user = $GLOBALS['egw_info']['user']['account_id'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user