From 6b7dee0c5b5f2445cb2d12224050838fe0e3faa9 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 21 Apr 2010 19:02:55 +0000 Subject: [PATCH] Apply global categories when creating a timesheet from an event. --- calendar/inc/class.calendar_uilist.inc.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/calendar/inc/class.calendar_uilist.inc.php b/calendar/inc/class.calendar_uilist.inc.php index aeaf46e4c4..cb3899eed5 100644 --- a/calendar/inc/class.calendar_uilist.inc.php +++ b/calendar/inc/class.calendar_uilist.inc.php @@ -494,6 +494,21 @@ class calendar_uilist extends calendar_ui 'cat_id' => null, 'pl_id' => null ); + + // Add global categories + $categories = explode(',',$event['category']); + $global_categories = array(); + foreach($categories as $cat_id) + { + if($GLOBALS['egw']->categories->is_global($cat_id)) + { + $global_categories[] = $cat_id; + } + } + if(count($global_categories)) + { + $timesheet['cat_id'] = implode(',', $global_categories); + } $timesheet_bo->data = array(); $err = $timesheet_bo->save($timesheet); if(!$err) {