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) function conflicts($event,$conflicts,$preserv)
{ {
$etpl = CreateObject('etemplate.etemplate_new','calendar.conflicts'); $etpl = CreateObject('etemplate.etemplate_new','calendar.conflicts');
$allConflicts = array();
foreach($conflicts as $k => $conflict) foreach($conflicts as $k => $conflict)
{ {
@ -1795,6 +1796,7 @@ class calendar_uiforms extends calendar_ui
'icon_recur' => $conflict['recur_type'] != MCAL_RECUR_NONE ? 'recur' : '', 'icon_recur' => $conflict['recur_type'] != MCAL_RECUR_NONE ? 'recur' : '',
'text_recur' => $conflict['recur_type'] != MCAL_RECUR_NONE ? lang('Recurring event') : ' ', 'text_recur' => $conflict['recur_type'] != MCAL_RECUR_NONE ? lang('Recurring event') : ' ',
); );
$allConflicts += array_intersect_key($conflict['participants'],$event['participants']);
} }
$content = $event + array( $content = $event + array(
'conflicts' => array_values($conflicts), // conflicts have id-start as key 'conflicts' => array_values($conflicts), // conflicts have id-start as key
@ -1802,7 +1804,10 @@ class calendar_uiforms extends calendar_ui
$GLOBALS['egw_info']['flags']['app_header'] = lang('calendar') . ' - ' . lang('Scheduling conflict'); $GLOBALS['egw_info']['flags']['app_header'] = lang('calendar') . ' - ' . lang('Scheduling conflict');
$resources_config = config::read('resources'); $resources_config = config::read('resources');
$readonlys = array(); $readonlys = array();
if($event['participant_types']['r'] && $resources_config) // resources Allow ignore conflicts
foreach (array_keys($allConflicts) as $pId)
{
if(substr($pId,0,1) == 'r' && $resources_config ) // resources Allow ignore conflicts
{ {
switch ($resources_config['ignoreconflicts']) switch ($resources_config['ignoreconflicts'])
@ -1814,19 +1819,13 @@ class calendar_uiforms extends calendar_ui
$readonlys['button[ignore]'] = false; $readonlys['button[ignore]'] = false;
break; break;
default: default:
foreach ($event['participants'] as $pIds => $val) if (!$this->bo->check_status_perms($pId, $event))
{
if ($val != 'ACHAIR')
{
if (!$this->bo->check_status_perms($pIds, $event))
{ {
$readonlys['button[ignore]'] = true; $readonlys['button[ignore]'] = true;
break; break;
} }
} }
} }
}
} }
$etpl->exec('calendar.calendar_uiforms.process_edit',$content,array(),$readonlys,array_merge($event,$preserv),$preserv['no_popup'] ? 0 : 2); $etpl->exec('calendar.calendar_uiforms.process_edit',$content,array(),$readonlys,array_merge($event,$preserv),$preserv['no_popup'] ? 0 : 2);
} }