From e9a3d69e46f9e6fd7b49925602f19f8a06e39478 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 12 Feb 2014 10:26:34 +0000 Subject: [PATCH] Fix calendar ignore conflict when the conflict is not from resources --- calendar/inc/class.calendar_uiforms.inc.php | 41 ++++++++++----------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index cdbba7ad92..de857895f1 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -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);