Fix calendar ignore conflict when the conflict is not from resources

This commit is contained in:
Hadi Nategh 2014-02-12 13:06:31 +00:00
parent 506f232723
commit ed5ff6fd1a

View File

@ -1853,7 +1853,7 @@ class calendar_uiforms extends calendar_ui
function conflicts($event,$conflicts,$preserv)
{
$etpl = CreateObject('etemplate.etemplate','calendar.conflicts');
$allConflicts = array();
foreach($conflicts as $k => $conflict)
{
$is_readable = $this->bo->check_perms(EGW_ACL_READ,$conflict);
@ -1863,11 +1863,13 @@ class calendar_uiforms extends calendar_ui
'tooltip_participants' => $is_readable ? implode(', ',$this->bo->participants($conflict)) : '',
'time' => $this->bo->long_date($conflict['start'],$conflict['end'],true),
'conflicting_participants' => implode(",\n",$this->bo->participants(array(
'participants' => array_intersect_key($conflict['participants'],$event['participants']),
'participants' => array_intersect_key((array)$conflict['participants'],$event['participants']),
),true,true)), // show group invitations too
'icon_recur' => $conflict['recur_type'] != MCAL_RECUR_NONE ? 'recur' : '',
'text_recur' => $conflict['recur_type'] != MCAL_RECUR_NONE ? lang('Recurring event') : ' ',
);
$allConflicts += array_intersect_key((array)$conflict['participants'],$event['participants']);
}
$content = $event + array(
'conflicts' => array_values($conflicts), // conflicts have id-start as key
@ -1876,30 +1878,26 @@ class calendar_uiforms extends calendar_ui
$resources_config = config::read('resources');
$readonlys = array();
if($event['participant_types']['r'] && $resources_config) // resources Allow ignore conflicts
foreach (array_keys($allConflicts) as $pId)
{
switch ($resources_config['ignoreconflicts'])
if(substr($pId,0,1) == 'r' && $resources_config ) // resources Allow ignore conflicts
{
case 'no':
$readonlys['button[ignore]'] = true;
break;
case 'allusers':
$readonlys['button[ignore]'] = false;
break;
default:
foreach ($event['participants'] as $pIds => $val)
{
if ($val != 'ACHAIR')
{
if (!$this->bo->check_status_perms($pIds, $event))
{
$readonlys['button[ignore]'] = true;
break;
}
}
}
switch ($resources_config['ignoreconflicts'])
{
case 'no':
$readonlys['button[ignore]'] = true;
break;
case 'allusers':
$readonlys['button[ignore]'] = false;
break;
default:
if (!$this->bo->check_status_perms($pId, $event))
{
$readonlys['button[ignore]'] = true;
break;
}
}
}
}
$etpl->exec('calendar.calendar_uiforms.process_edit',$content,false,$readonlys,array_merge($event,$preserv),$preserv['no_popup'] ? 0 : 2);