Fix calendar ignore conflict when the conflict is not from resources

This commit is contained in:
Hadi Nategh 2014-02-12 10:26:34 +00:00
parent 384756ff71
commit e9a3d69e46

View File

@ -1780,6 +1780,7 @@ class calendar_uiforms extends calendar_ui
function conflicts($event,$conflicts,$preserv)
{
$etpl = CreateObject('etemplate.etemplate_new','calendar.conflicts');
$allConflicts = array();
foreach($conflicts as $k => $conflict)
{
@ -1795,6 +1796,7 @@ class calendar_uiforms extends calendar_ui
'icon_recur' => $conflict['recur_type'] != MCAL_RECUR_NONE ? 'recur' : '',
'text_recur' => $conflict['recur_type'] != MCAL_RECUR_NONE ? lang('Recurring event') : ' ',
);
$allConflicts += array_intersect_key($conflict['participants'],$event['participants']);
}
$content = $event + array(
'conflicts' => array_values($conflicts), // conflicts have id-start as key
@ -1802,30 +1804,27 @@ class calendar_uiforms extends calendar_ui
$GLOBALS['egw_info']['flags']['app_header'] = lang('calendar') . ' - ' . lang('Scheduling conflict');
$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,array(),$readonlys,array_merge($event,$preserv),$preserv['no_popup'] ? 0 : 2);