Completed
Push — 16.1 ( 5b5c6b...4aa71a )
by Nathan
17:56
created
infolog/inc/class.infolog_ui.inc.php 1 patch
Spacing   +352 added lines, -356 removed lines patch added patch discarded remove patch
@@ -55,32 +55,32 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @var string
57 57
 	 */
58
-	var $duration_format = ',';	// comma is necessary!
58
+	var $duration_format = ','; // comma is necessary!
59 59
 
60 60
 	var $icons = array(
61 61
 		'type' => array(
62
-			'task'      => 'task.gif',      'task_alt'      => 'Task',
63
-			'phone'     => 'phone.gif',     'phone_alt'     => 'Phonecall',
64
-			'note'      => 'note.gif',      'note_alt'      => 'Note',
65
-			'confirm'   => 'confirm.gif',   'confirm_alt'   => 'Confirmation',
66
-			'reject'    => 'reject.gif',    'reject_alt'    => 'Reject',
67
-			'email'     => 'email.gif',     'email_alt'     => 'Email' ),
62
+			'task'      => 'task.gif', 'task_alt'      => 'Task',
63
+			'phone'     => 'phone.gif', 'phone_alt'     => 'Phonecall',
64
+			'note'      => 'note.gif', 'note_alt'      => 'Note',
65
+			'confirm'   => 'confirm.gif', 'confirm_alt'   => 'Confirmation',
66
+			'reject'    => 'reject.gif', 'reject_alt'    => 'Reject',
67
+			'email'     => 'email.gif', 'email_alt'     => 'Email' ),
68 68
 		'action' => array(
69
-			'new'       => 'new.gif',       'new_alt'       => 'Add Sub',
70
-			'view'      => 'view.gif',      'view_alt'      => 'View Subs',
71
-			'parent'    => 'parent.gif',    'parent_alt'    => 'View other Subs',
72
-			'edit'      => 'edit.gif',      'edit_alt'      => 'Edit',
73
-			'addfile'   => 'addfile.gif',   'addfile_alt'   => 'Add a file',
74
-			'delete'    => 'delete.gif',    'delete_alt'    => 'Delete',
75
-			'close'     => 'done.gif',      'close_alt'     => 'Close' ,
76
-			'close_all' => 'done_all.gif',  'close_all_alt' => 'Close' ),
69
+			'new'       => 'new.gif', 'new_alt'       => 'Add Sub',
70
+			'view'      => 'view.gif', 'view_alt'      => 'View Subs',
71
+			'parent'    => 'parent.gif', 'parent_alt'    => 'View other Subs',
72
+			'edit'      => 'edit.gif', 'edit_alt'      => 'Edit',
73
+			'addfile'   => 'addfile.gif', 'addfile_alt'   => 'Add a file',
74
+			'delete'    => 'delete.gif', 'delete_alt'    => 'Delete',
75
+			'close'     => 'done.gif', 'close_alt'     => 'Close',
76
+			'close_all' => 'done_all.gif', 'close_all_alt' => 'Close' ),
77 77
 		'status' => array(
78
-			'billed'    => 'billed.gif',    'billed_alt'    => 'billed',
79
-			'done'      => 'done.gif',      'done_alt'      => 'done',
78
+			'billed'    => 'billed.gif', 'billed_alt'    => 'billed',
79
+			'done'      => 'done.gif', 'done_alt'      => 'done',
80 80
 			'will-call' => 'will-call.gif', 'will-call_alt' => 'will-call',
81
-			'call'      => 'call.gif',      'call_alt'      => 'call',
82
-			'ongoing'   => 'ongoing.gif',   'ongoing_alt'   => 'ongoing',
83
-			'offer'     => 'offer.gif',     'offer_alt'     => 'offer' )
81
+			'call'      => 'call.gif', 'call_alt'      => 'call',
82
+			'ongoing'   => 'ongoing.gif', 'ongoing_alt'   => 'ongoing',
83
+			'offer'     => 'offer.gif', 'offer_alt'     => 'offer' )
84 84
 	);
85 85
 	var $filters;
86 86
 	var $messages = array(
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') Api\Translation::add_app('infolog');
101 101
 
102 102
 		// Make sure Global category is infolog - on first load, it may not be
103
-		if($GLOBALS['egw_info']['flags']['currentapp'] == 'infolog' && !$GLOBALS['egw']->categories->app_name)
103
+		if ($GLOBALS['egw_info']['flags']['currentapp'] == 'infolog' && !$GLOBALS['egw']->categories->app_name)
104 104
 		{
105 105
 			$GLOBALS['egw']->categories = new Api\Categories();
106 106
 		}
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 
112 112
 		$this->user = $GLOBALS['egw_info']['user']['account_id'];
113 113
 
114
-		$this->prefs =& $GLOBALS['egw_info']['user']['preferences']['infolog'];
114
+		$this->prefs = & $GLOBALS['egw_info']['user']['preferences']['infolog'];
115 115
 
116 116
 		// read the duration format from project-manager
117 117
 		if ($GLOBALS['egw_info']['apps']['projectmanager'])
118 118
 		{
119 119
 			$pm_config = Api\Config::read('projectmanager');
120
-			$this->duration_format = str_replace(',','',implode('', (array)$pm_config['duration_units']));
120
+			$this->duration_format = str_replace(',', '', implode('', (array)$pm_config['duration_units']));
121 121
 			//error_log(__METHOD__."() ".__LINE__." duration_format=$this->duration_format, duration_unit=".array2string($pm_config['duration_units']));
122 122
 			$this->hours_per_workday = $pm_config['hours_per_workday'];
123 123
 			unset($pm_config);
124 124
 		}
125
-		$this->filters =& $this->bo->filters;
125
+		$this->filters = & $this->bo->filters;
126 126
 		/* these are just for testing of the notifications
127 127
 		for($i = -1; $i <= 3; ++$i)
128 128
 		{
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 			$this->filters['responsible-open-date'.date('Y-m-d',time()+$i*24*60*60)] = "responsible starting in $i day(s)";
142 142
 		}
143 143
 		*/
144
-		$GLOBALS['infolog_ui'] =& $this;	// make ourself availible for ExecMethod of get_rows function
144
+		$GLOBALS['infolog_ui'] = & $this; // make ourself availible for ExecMethod of get_rows function
145 145
 	}
146 146
 
147 147
 	/**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @param int $details
156 156
 	 * @return array
157 157
 	 */
158
-	function get_info($info,&$readonlys,$action='',$action_id='',$show_links=false,$details = 1)
158
+	function get_info($info, &$readonlys, $action = '', $action_id = '', $show_links = false, $details = 1)
159 159
 	{
160 160
 		if (!is_array($info))
161 161
 		{
@@ -165,19 +165,19 @@  discard block
 block discarded – undo
165 165
 		$done = $info['info_status'] == 'done' || $info['info_status'] == 'billed' || $info['info_status'] == 'cancelled'; //cancelled is regarded as a completed status as well in bo
166 166
 		// regard an infolog as done/billed/cancelled if its percentage is 100% when there is to status like the above for that type
167 167
 		if (!$done && !isset($this->bo->status[$info['info_type']]['done']) && !isset($this->bo->status[$info['info_type']]['billed']) &&
168
-			!isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent']==100) $done = true ;
169
-		$info['sub_class'] = $this->bo->enums['priority'][$info['info_priority']] . ($done ? '_done' : '');
168
+			!isset($this->bo->status[$info['info_type']]['cancelled']) && (int)$info['info_percent'] == 100) $done = true;
169
+		$info['sub_class'] = $this->bo->enums['priority'][$info['info_priority']].($done ? '_done' : '');
170 170
 		if (!$done && $info['info_enddate'] < $this->bo->user_time_now)
171 171
 		{
172 172
 			$info['end_class'] = 'infolog_overdue';
173 173
 		}
174 174
 		if (!isset($info['info_anz_subs'])) $info['info_anz_subs'] = $this->bo->anzSubs($id);
175
-		$this->bo->link_id2from($info,$action,$action_id);	// unset from for $action:$action_id
176
-		$info['info_percent'] = (int) $info['info_percent'].'%';
177
-		$editrights = $this->bo->check_access($info,Acl::EDIT);
175
+		$this->bo->link_id2from($info, $action, $action_id); // unset from for $action:$action_id
176
+		$info['info_percent'] = (int)$info['info_percent'].'%';
177
+		$editrights = $this->bo->check_access($info, Acl::EDIT);
178 178
 		$isresposible = $this->bo->is_responsible($info);
179 179
 		if ((!($editrights || // edit rights or more then standard responsible rights
180
-			$isresposible && array_diff($this->bo->responsible_edit,array('info_status','info_percent','info_datecompleted')))))
180
+			$isresposible && array_diff($this->bo->responsible_edit, array('info_status', 'info_percent', 'info_datecompleted')))))
181 181
 		{
182 182
 			$info['class'] .= 'rowNoEdit ';
183 183
 		}
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 		{
197 197
 			$info['class'] .= 'rowNoCloseAll ';
198 198
 		}
199
-		if (!$this->bo->check_access($info,Acl::DELETE))
199
+		if (!$this->bo->check_access($info, Acl::DELETE))
200 200
 		{
201 201
 			$info['class'] .= 'rowNoDelete ';
202 202
 		}
203
-		if (!$this->bo->check_access($info,Acl::ADD))
203
+		if (!$this->bo->check_access($info, Acl::ADD))
204 204
 		{
205 205
 			$info['class'] .= 'rowNoSubs ';
206 206
 		}
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		if (!$show_links) $show_links = $this->prefs['show_links'];
213 213
 		if (($show_links != 'none' && $show_links != 'no_describtion' ||
214 214
 			 $this->prefs['show_times'] || isset($GLOBALS['egw_info']['user']['apps']['timesheet'])) &&
215
-			(isset($info['links']) || ($info['links'] = Link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true,true))))
215
+			(isset($info['links']) || ($info['links'] = Link::get_links('infolog', $info['info_id'], '', 'link_lastmod DESC', true, true))))
216 216
 		{
217 217
 			$timesheets = array();
218 218
 			foreach ($info['links'] as $link)
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 				$link_mod = Api\DateTime::server2user($link['lastmod']);
222 222
 				if ($info['row_mod'] < $link_mod) $info['row_mod'] = $link_mod;
223 223
 
224
-				if ($link['deleted']) continue;	// skip deleted links, but incl. them in row_mod!
224
+				if ($link['deleted']) continue; // skip deleted links, but incl. them in row_mod!
225 225
 
226 226
 				if ($show_links != 'none' && $show_links != 'no_describtion' &&
227 227
 					$link['link_id'] != $info['info_link_id'] &&
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 			}
239 239
 			if ($this->prefs['show_times'] && isset($GLOBALS['egw_info']['user']['apps']['timesheet']) && $timesheets)
240 240
 			{
241
-				$sum = ExecMethod('timesheet.timesheet_bo.sum',$timesheets);
241
+				$sum = ExecMethod('timesheet.timesheet_bo.sum', $timesheets);
242 242
 				$info['info_sum_timesheets'] = $sum['duration'];
243 243
 				// incl. max timesheet modification in row_mod
244 244
 				if ($info['row_mod'] < $sum['max_modified']) $info['row_mod'] = $sum['max_modified'];
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 			}
257 257
 			$readonlys["edit_percent[$id]"] = true;
258 258
 		}
259
-		elseif($readonlys["edit_percent[$id]"])	// show percent, but button is switched off
259
+		elseif ($readonlys["edit_percent[$id]"])	// show percent, but button is switched off
260 260
 		{
261 261
 			$info['info_percent2'] = $info['info_percent'];
262 262
 		}
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	protected static function filter(array $query)
278 278
 	{
279 279
 		$filter = $query['filter'] ? 'filter' : ($query['cat_id'] ? 'cat_id' : null);
280
-		foreach((array)$query['col_filter'] as $name => $value)
280
+		foreach ((array)$query['col_filter'] as $name => $value)
281 281
 		{
282 282
 			if ((string)$value !== '')
283 283
 			{
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @param array &$readonlys
298 298
 	 * @return int
299 299
 	 */
300
-	function get_rows(&$query,&$rows,&$readonlys)
300
+	function get_rows(&$query, &$rows, &$readonlys)
301 301
 	{
302 302
 		//error_log(__METHOD__."() query[csv_export]=".array2string($query['csv_export']).", query[filter]=".array2string($query['filter']).", query[col_filter]=".array2string(array_diff($query['col_filter'],array('',0))).' '.function_backtrace());
303 303
 		if (!$query['csv_export'])
@@ -314,20 +314,20 @@  discard block
 block discarded – undo
314 314
 			}
315 315
 			//error_log(__METHOD__."() prefs[listNoSubs]=".array2string($this->prefs['listNoSubs'])." --> parent_id=$parent_id");
316 316
 			unset($query['col_filter']['parent_id']);
317
-			if(!$query['action'])
317
+			if (!$query['action'])
318 318
 			{
319 319
 				Api\Cache::setSession('infolog', $query['session_for'].'session_data',
320
-					array_diff_key ($query, array_flip(array('rows','actions','action_links','placeholder_actions'))));
320
+					array_diff_key($query, array_flip(array('rows', 'actions', 'action_links', 'placeholder_actions'))));
321 321
 			}
322 322
 			$query['actions'] = $this->get_actions($query);
323 323
 			$query['row_id'] = 'info_id';
324 324
 			$query['row_modified'] = 'row_mod';
325 325
 			$query['parent_id'] = 'info_id_parent';
326 326
 			$query['is_parent'] = 'info_anz_subs';
327
-			$query['action_var'] = 'multi_action';	// as 'action' is already used in infolog
327
+			$query['action_var'] = 'multi_action'; // as 'action' is already used in infolog
328 328
 		}
329 329
 		// nextmatch opened an infolog containing children --> do not filter them, always show all children
330
-		elseif($query['csv_export'] === 'children')
330
+		elseif ($query['csv_export'] === 'children')
331 331
 		{
332 332
 			$query['filter'] = $query['search'] = $query['cat_id'] = '';
333 333
 			$query['col_filter'] = array('info_id_parent' => $query['col_filter']['info_id_parent']);
@@ -347,17 +347,17 @@  discard block
 block discarded – undo
347 347
 			$links['linked'] = array();
348 348
 			unset($query['col_filter']['linked']);
349 349
 		}
350
-		if($query['action'] && in_array($query['action'], array_keys($GLOBALS['egw_info']['apps'])) && $query['action_id'])
350
+		if ($query['action'] && in_array($query['action'], array_keys($GLOBALS['egw_info']['apps'])) && $query['action_id'])
351 351
 		{
352 352
 			$link_filters['action'] = array('app'=>$query['action'], 'id' => $query['action_id']);
353 353
 			$links['action'] = array();
354 354
 		}
355
-		foreach($link_filters as $key => $link)
355
+		foreach ($link_filters as $key => $link)
356 356
 		{
357
-			if(!is_array($link))
357
+			if (!is_array($link))
358 358
 			{
359 359
 				// Legacy string style
360
-				list($app,$id) = explode(':',$link);
360
+				list($app, $id) = explode(':', $link);
361 361
 			}
362 362
 			else
363 363
 			{
@@ -365,25 +365,25 @@  discard block
 block discarded – undo
365 365
 				$app = $link['app'];
366 366
 				$id = $link['id'];
367 367
 			}
368
-			if(!is_array($id)) $id = explode(',',$id);
369
-			if (!($linked = Link::get_links_multiple($app,$id,true,'infolog','',$query['col_filter']['info_status'] == 'deleted')))
368
+			if (!is_array($id)) $id = explode(',', $id);
369
+			if (!($linked = Link::get_links_multiple($app, $id, true, 'infolog', '', $query['col_filter']['info_status'] == 'deleted')))
370 370
 			{
371
-				$rows = array();	// no infologs linked to selected link --> no rows to return
371
+				$rows = array(); // no infologs linked to selected link --> no rows to return
372 372
 				return 0;
373 373
 			}
374 374
 
375 375
 
376
-			foreach($linked as $infos)
376
+			foreach ($linked as $infos)
377 377
 			{
378
-				$links[$key] = array_merge($links[$key],$infos);
378
+				$links[$key] = array_merge($links[$key], $infos);
379 379
 			}
380 380
 			$links[$key] = array_unique($links[$key]);
381
-			if($key == 'linked')
381
+			if ($key == 'linked')
382 382
 			{
383 383
 				$linked = array('app' => $app, 'id' => $id, 'title' => (count($id) == 1 ? Link::title($app, $id) : lang('multiple')));
384 384
 			}
385 385
 		}
386
-		if(count($links))
386
+		if (count($links))
387 387
 		{
388 388
 			$query['col_filter']['info_id'] = count($links) > 1 ? call_user_func_array('array_intersect', $links) : $links[$key];
389 389
 		}
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 		$old_template = $query['template'];
393 393
 
394 394
 		// Reset custom, type-specific template if type was cleared (without changing it for home)
395
-		if(!$query['template'] || stripos($query['template'], 'infolog.index.rows') === 0)
395
+		if (!$query['template'] || stripos($query['template'], 'infolog.index.rows') === 0)
396 396
 		{
397 397
 			$query['template'] = 'infolog.index.rows';
398 398
 		}
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
 			if ($tpl->read('infolog.index.rows.'.$query['col_filter']['info_type']))
404 404
 			{
405 405
 				$query['template'] = $tpl->name;
406
-				$query['custom_fields'] = true;	// read the custom fields too
406
+				$query['custom_fields'] = true; // read the custom fields too
407 407
 			}
408 408
 			// If status is not valid for selected type, clear status filter
409
-			if($query['col_filter']['info_status'] && $query['col_filter']['info_status'] != 'deleted' &&
409
+			if ($query['col_filter']['info_status'] && $query['col_filter']['info_status'] != 'deleted' &&
410 410
 				!in_array($query['col_filter']['info_status'], array_keys($this->bo->status[$query['col_filter']['info_type']])))
411 411
 			{
412 412
 				$query['col_filter']['info_status'] = '';
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 			}
415 415
 		}
416 416
 		// Framework\Template change forces the UI to do a full update first, no point in getting rows right now
417
-		if($old_template && $old_template != $query['template']) return 0;
417
+		if ($old_template && $old_template != $query['template']) return 0;
418 418
 
419 419
 		// do we need to read the custom fields, depends on the column is enabled and customfields exist, prefs are filter specific
420 420
 		// so we have to check that as well
@@ -427,14 +427,14 @@  discard block
 block discarded – undo
427 427
 
428 428
 		if (!$query['selectcols'] && $columselection)
429 429
 		{
430
-			$columselection = is_array($columselection) ? $columselection : explode(',',$columselection);
430
+			$columselection = is_array($columselection) ? $columselection : explode(',', $columselection);
431 431
 		}
432 432
 		else
433 433
 		{
434
-			$columselection = $query['selectcols'] ? (is_array($query['selectcols']) ? $query['selectcols'] : explode(',',$query['selectcols'])) : array();
434
+			$columselection = $query['selectcols'] ? (is_array($query['selectcols']) ? $query['selectcols'] : explode(',', $query['selectcols'])) : array();
435 435
 		}
436 436
 		// do we need to query the cf's
437
-		$query['custom_fields'] = $this->bo->customfields && (!$columselection || in_array('customfields',$columselection));
437
+		$query['custom_fields'] = $this->bo->customfields && (!$columselection || in_array('customfields', $columselection));
438 438
 
439 439
 		$infos = $this->bo->search($query);
440 440
 		$query['col_filter'] = $orginal_colfilter;
@@ -452,12 +452,12 @@  discard block
 block discarded – undo
452 452
 			$query['default_cols'] = '!cat_id,info_datemodified,info_used_time_info_planned_time,info_used_time_info_planned_time_info_replanned_time,info_id';
453 453
 		}
454 454
 		// set old show_times pref, that get_info calculates the cumulated time of the timesheets (we only check used&planned to work for both time cols)
455
-		$this->prefs['show_times'] = strpos($this->prefs[$query['columnselection_pref']],'info_used_time_info_planned_time') !== false;
455
+		$this->prefs['show_times'] = strpos($this->prefs[$query['columnselection_pref']], 'info_used_time_info_planned_time') !== false;
456 456
 
457 457
 		// query all links and sub counts in one go
458 458
 		if ($infos && (!$query['csv_export'] || !is_array($query['csv_export'])))
459 459
 		{
460
-			$links = Link::get_links_multiple('infolog',array_keys($infos),true,'','link_lastmod DESC',true);	// true=incl. deleted
460
+			$links = Link::get_links_multiple('infolog', array_keys($infos), true, '', 'link_lastmod DESC', true); // true=incl. deleted
461 461
 			$anzSubs = $this->bo->anzSubs(array_keys($infos));
462 462
 		}
463 463
 		$rows = array();
@@ -468,27 +468,27 @@  discard block
 block discarded – undo
468 468
 			$parents = $query['action'] == 'sp' && $query['action_id'] ? (array)$query['action_id'] : array();
469 469
 			if (count($parents) == 1 && is_array($query['action_id']))
470 470
 			{
471
-				$query['action_id'] = array_shift($query['action_id']);	// display single parent as app_header
471
+				$query['action_id'] = array_shift($query['action_id']); // display single parent as app_header
472 472
 			}
473 473
 		}
474 474
 
475 475
 		$parent_first = count($parents) == 1;
476 476
 		$parent_index = 0;
477 477
 		// et2 nextmatch listens to total, and only displays that many rows, so add parent in or we'll lose the last row
478
-		if($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) $query['total']++;
478
+		if ($parent_first || $query['action'] == 'sp' && is_array($query['action_id'])) $query['total']++;
479 479
 
480 480
 		// Check to see if we need to remove description
481
-		foreach($infos as $id => $info)
481
+		foreach ($infos as $id => $info)
482 482
 		{
483
-			if (!(strpos($info['info_addr'],',')===false) && strpos($info['info_addr'],', ')===false) $info['info_addr'] = str_replace(',',', ',$info['info_addr']);
483
+			if (!(strpos($info['info_addr'], ',') === false) && strpos($info['info_addr'], ', ') === false) $info['info_addr'] = str_replace(',', ', ', $info['info_addr']);
484 484
 			if (!$query['csv_export'] || !is_array($query['csv_export']))
485 485
 			{
486
-				$info['links'] =& $links[$id];
486
+				$info['links'] = & $links[$id];
487 487
 				$info['info_anz_subs'] = (int)$anzSubs[$id];
488
-				$info = $this->get_info($info,$readonlys,null,null,false,$details);
488
+				$info = $this->get_info($info, $readonlys, null, null, false, $details);
489 489
 			}
490 490
 			// for subs view ('sp') add parent(s) in front of subs once(!)
491
-			if ( $parent_first && ($main = $this->bo->read($query['action_id'])) ||
491
+			if ($parent_first && ($main = $this->bo->read($query['action_id'])) ||
492 492
 				$parents && ($parent_index = array_search($info['info_id_parent'], $parents)) !== false &&
493 493
 				($main = $this->bo->read($info['info_id_parent'])))
494 494
 			{
@@ -498,11 +498,11 @@  discard block
 block discarded – undo
498 498
 				// as read() always read them all, while search() only reads the selected ones
499 499
 				if ($query['custom_fields'])
500 500
 				{
501
-					foreach($columselection as $col)
501
+					foreach ($columselection as $col)
502 502
 					{
503 503
 						if ($col[0] == '#')
504 504
 						{
505
-							foreach(array_keys($main) as $n)
505
+							foreach (array_keys($main) as $n)
506 506
 							{
507 507
 								if ($n[0] == '#' && !in_array($n, $columselection)) unset($main[$n]);
508 508
 							}
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 					}
512 512
 				}
513 513
 				$parent_first = false;
514
-				if($query['start'] == 0)
514
+				if ($query['start'] == 0)
515 515
 				{
516 516
 					array_splice($rows, $id, 0, array($main));
517 517
 					unset($parents[$parent_index]);
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		if ($query['cat_id']) $rows['no_cat_id'] = true;
525 525
 		if ($query['no_actions']) $rows['no_actions'] = true;
526 526
 		$rows['no_timesheet'] = !isset($GLOBALS['egw_info']['user']['apps']['timesheet']);
527
-		if($clear_status_filter)
527
+		if ($clear_status_filter)
528 528
 		{
529 529
 			$rows['info_status'] = '';
530 530
 		}
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 				$headers[] = lang($this->filters[$query['filter']]);
556 556
 			}
557 557
 			if ($query['action'] && ($title = $query['action_title'] || is_array($query['action_id']) ?
558
-				$query['action_title'] : Link::title($query['action']=='sp'?'infolog':$query['action'],$query['action_id'])))
558
+				$query['action_title'] : Link::title($query['action'] == 'sp' ? 'infolog' : $query['action'], $query['action_id'])))
559 559
 			{
560 560
 				$headers[] = $title;
561 561
 			}
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 			$GLOBALS['egw_info']['flags']['app_header'] = implode(': ', $headers);
567 567
 		}
568 568
 
569
-		if (isset($linked)) $query['col_filter']['linked'] = $linked;  // add linked back to the colfilter
569
+		if (isset($linked)) $query['col_filter']['linked'] = $linked; // add linked back to the colfilter
570 570
 
571 571
 		return $query['total'];
572 572
 	}
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 		{
586 586
 			if ($info['info_cat']) $set['cat_id'] = $info['info_cat'];
587 587
 
588
-			foreach(Link::get_links('infolog',$info['info_id'],'','link_lastmod DESC',true) as $link)
588
+			foreach (Link::get_links('infolog', $info['info_id'], '', 'link_lastmod DESC', true) as $link)
589 589
 			{
590 590
 				if ($link['app'] != 'timesheet' && $link['app'] != Link::VFS_APPNAME)
591 591
 				{
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 		{
611 611
 			return $data;
612 612
 		}
613
-		$event = array_merge($data,array(
613
+		$event = array_merge($data, array(
614 614
 			'category'	=> $GLOBALS['egw']->categories->check_list(Acl::READ, $infolog['info_cat']),
615 615
 			'priority'	=> $infolog['info_priority'] + 1,
616 616
 			'public'	=> $infolog['info_access'] != 'private',
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 			'end'		=> $infolog['info_enddate'] ? $infolog['info_enddate'] : $infolog['info_datecompleted']
622 622
 		));
623 623
 		unset($event['entry_id']);
624
-		if (!$event['end']) $event['end'] = $event['start'] + (int) $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength']*60;
624
+		if (!$event['end']) $event['end'] = $event['start'] + (int)$GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength'] * 60;
625 625
 
626 626
 		// Match Api\Categories by name
627 627
 		$event['category'] = $GLOBALS['egw']->categories->name2id(Api\Categories::id2name($infolog['info_cat']));
@@ -630,38 +630,38 @@  discard block
 block discarded – undo
630 630
 		$event['owner'] = $user = $GLOBALS['egw_info']['user']['account_id'];
631 631
 
632 632
 		// add/modify participants according to prefs
633
-		$prefs = explode(',',$this->prefs['calendar_set'] ? $this->prefs['calendar_set'] : 'responsible,contact,user');
633
+		$prefs = explode(',', $this->prefs['calendar_set'] ? $this->prefs['calendar_set'] : 'responsible,contact,user');
634 634
 
635 635
 		// if no default participants (selected calendars) --> remove all
636
-		if (!in_array('selected',$prefs))
636
+		if (!in_array('selected', $prefs))
637 637
 		{
638 638
 			$event['participants'] = $event['participant_types'] = array();
639 639
 		}
640 640
 		// Add responsible as participant
641
-		if (in_array('responsible',$prefs))
641
+		if (in_array('responsible', $prefs))
642 642
 		{
643
-			foreach($infolog['info_responsible'] as $responsible)
643
+			foreach ($infolog['info_responsible'] as $responsible)
644 644
 			{
645 645
 				$event['participants'][$responsible] = $event['participant_types']['u'][$responsible] =
646
-					calendar_so::combine_status($user==$responsible?'A':'U');
646
+					calendar_so::combine_status($user == $responsible ? 'A' : 'U');
647 647
 			}
648 648
 		}
649 649
 		// Add linked contact as participant
650
-		if (in_array('contact',$prefs) && $infolog['info_link']['app'] == 'addressbook')
650
+		if (in_array('contact', $prefs) && $infolog['info_link']['app'] == 'addressbook')
651 651
 		{
652
-			$event['participants'][calendar_so::combine_user('c',$infolog['info_link']['id'])] =
652
+			$event['participants'][calendar_so::combine_user('c', $infolog['info_link']['id'])] =
653 653
 				$event['participant_types']['c'][$infolog['info_link']['id']] = calendar_so::combine_status('U');
654 654
 		}
655
-		if (in_array('owner',$prefs))
655
+		if (in_array('owner', $prefs))
656 656
 		{
657 657
 			$event['participants'][$infolog['info_owner']] = $event['participant_types']['u'][$infolog['info_owner']] =
658
-				calendar_so::combine_status('A',1,'CHAIR');
658
+				calendar_so::combine_status('A', 1, 'CHAIR');
659 659
 		}
660 660
 		// Add current user, if set or no other participants, which is not allowed
661
-		if (in_array('user',$prefs))
661
+		if (in_array('user', $prefs))
662 662
 		{
663 663
 			$event['participants'][$user] = $event['participant_types']['u'][$user] =
664
-				calendar_so::combine_status('A',1,'CHAIR');
664
+				calendar_so::combine_status('A', 1, 'CHAIR');
665 665
 		}
666 666
 
667 667
 		// Add infolog link to calendar entry
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 		$event['link_id'][]  = $infolog['info_link']['id'];
670 670
 
671 671
 		// Copy infolog's links
672
-		foreach(Link::get_links('infolog',$infolog['info_id'],'','link_lastmod DESC',true) as $link)
672
+		foreach (Link::get_links('infolog', $infolog['info_id'], '', 'link_lastmod DESC', true) as $link)
673 673
 		{
674 674
 			if ($link['app'] != Link::VFS_APPNAME)
675 675
 			{
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 			}
679 679
 		}
680 680
 		// Copy same custom fields
681
-		foreach(array_keys(Api\Storage\Customfields::get('calendar')) as $name)
681
+		foreach (array_keys(Api\Storage\Customfields::get('calendar')) as $name)
682 682
 		{
683 683
 			if ($this->bo->customfields[$name]) $event['#'.$name] = $infolog['#'.$name];
684 684
 		}
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 	public function cal_to_include($args)
700 700
 	{
701 701
 		$nm = Api\Cache::getSession('infolog', 'session_data');
702
-		if($nm)
702
+		if ($nm)
703 703
 		{
704 704
 			$args['order'] = $nm['order'];
705 705
 			$args['sort'] = $nm['sort'];
@@ -719,9 +719,9 @@  discard block
 block discarded – undo
719 719
 	 * @param string $own_referer='' this is our own referer
720 720
 	 * @param string $action_title='' app_header for the action, if '' we try the link-title
721 721
 	 */
722
-	function index($values = null,$action='',$action_id='',$called_as=0,$extra_app_header=False,$return_html=False,$own_referer='',$action_title='')
722
+	function index($values = null, $action = '', $action_id = '', $called_as = 0, $extra_app_header = False, $return_html = False, $own_referer = '', $action_title = '')
723 723
 	{
724
-		unset($extra_app_header);	// not used, but dont want to change signature
724
+		unset($extra_app_header); // not used, but dont want to change signature
725 725
 		if (is_array($values))
726 726
 		{
727 727
 			$called_as = $values['called_as'];
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 		elseif ($own_referer === '')
731 731
 		{
732 732
 			$own_referer = Api\Header\Referer::get();
733
-			if (strpos($own_referer,'menuaction=infolog.infolog_ui.edit') !== false)
733
+			if (strpos($own_referer, 'menuaction=infolog.infolog_ui.edit') !== false)
734 734
 			{
735 735
 				$own_referer = Api\Cache::getSession('infolog', 'own_session');
736 736
 			}
@@ -741,11 +741,11 @@  discard block
 block discarded – undo
741 741
 		}
742 742
 
743 743
 		// Handle legacy buttons like actions
744
-		if(is_array($values))
744
+		if (is_array($values))
745 745
 		{
746
-			foreach(array('document', 'view', 'delete') as $button)
746
+			foreach (array('document', 'view', 'delete') as $button)
747 747
 			{
748
-				if(isset($values['nm']['rows'][$button]))
748
+				if (isset($values['nm']['rows'][$button]))
749 749
 				{
750 750
 					list($id) = @each($values['nm']['rows'][$button]);
751 751
 					$values['nm']['multi_action'] = $button;
@@ -765,27 +765,27 @@  discard block
 block discarded – undo
765 765
 				// Some processing to add values in for links and cats
766 766
 				$multi_action = $values['nm']['multi_action'];
767 767
 				// Action has an additional action - add / delete, etc.  Buttons named <multi-action>_action[action_name]
768
-				if(in_array($multi_action, array('link', 'responsible', 'startdate', 'enddate')))
768
+				if (in_array($multi_action, array('link', 'responsible', 'startdate', 'enddate')))
769 769
 				{
770 770
 					// eTemplate ignores the _popup namespace, but et2 doesn't
771
-					if($values[$multi_action.'_popup'])
771
+					if ($values[$multi_action.'_popup'])
772 772
 					{
773
-						$popup =& $values[$multi_action.'_popup'];
773
+						$popup = & $values[$multi_action.'_popup'];
774 774
 					}
775 775
 					else
776 776
 					{
777
-						$popup =& $values;
777
+						$popup = & $values;
778 778
 					}
779
-					$values['nm']['multi_action'] .= '_' . key($popup[$multi_action . '_action']);
780
-					if($multi_action == 'link')
779
+					$values['nm']['multi_action'] .= '_'.key($popup[$multi_action.'_action']);
780
+					if ($multi_action == 'link')
781 781
 					{
782
-						$popup[$multi_action] = $popup['link']['app'] . ':'.$popup['link']['id'];
782
+						$popup[$multi_action] = $popup['link']['app'].':'.$popup['link']['id'];
783 783
 					}
784
-					else if(is_array($popup[$multi_action]))
784
+					else if (is_array($popup[$multi_action]))
785 785
 					{
786
-						$popup[$multi_action] = implode(',',$popup[$multi_action]);
786
+						$popup[$multi_action] = implode(',', $popup[$multi_action]);
787 787
 					}
788
-					$values['nm']['multi_action'] .= '_' . $popup[$multi_action];
788
+					$values['nm']['multi_action'] .= '_'.$popup[$multi_action];
789 789
 					unset($values[$multi_action.'_popup']);
790 790
 					unset($values[$multi_action]);
791 791
 				}
@@ -793,18 +793,18 @@  discard block
 block discarded – undo
793 793
 				if ($this->action($values['nm']['multi_action'], $values['nm']['selected'], $values['nm']['select_all'],
794 794
 					$success, $failed, $action_msg, $values['nm'], $msg, $values['nm']['checkboxes']['no_notifications']))
795 795
 				{
796
-					$msg .= lang('%1 entries %2',$success,$action_msg);
796
+					$msg .= lang('%1 entries %2', $success, $action_msg);
797 797
 					Framework::message($msg);
798 798
 				}
799
-				elseif(is_null($msg))
799
+				elseif (is_null($msg))
800 800
 				{
801
-					$msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
802
-					Framework::message($msg,'error');
801
+					$msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed);
802
+					Framework::message($msg, 'error');
803 803
 				}
804
-				elseif($msg)
804
+				elseif ($msg)
805 805
 				{
806
-					$msg .= "\n".lang('%1 entries %2, %3 failed.',$success,$action_msg,$failed);
807
-					Framework::message($msg,'error');
806
+					$msg .= "\n".lang('%1 entries %2, %3 failed.', $success, $action_msg, $failed);
807
+					Framework::message($msg, 'error');
808 808
 				}
809 809
 				unset($values['nm']['multi_action']);
810 810
 				unset($values['nm']['select_all']);
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 				$action_id = 0;
828 828
 				$action_title = '';
829 829
 			}
830
-			if($_GET['ajax'] === 'true')
830
+			if ($_GET['ajax'] === 'true')
831 831
 			{
832 832
 				$nm['action'] = '';
833 833
 				$nm['action_id'] = 0;
@@ -843,8 +843,7 @@  discard block
 block discarded – undo
843 843
 
844 844
 			if (isset($_GET['filter']) && $_GET['filter'] != 'default' || !isset($values['nm']['filter']) && !$this->called_by)
845 845
 			{
846
-				$values['nm']['filter'] = $_GET['filter'] && $_GET['filter'] != 'default' ? $_GET['filter'] :
847
-					$this->prefs['defaultFilter'];
846
+				$values['nm']['filter'] = $_GET['filter'] && $_GET['filter'] != 'default' ? $_GET['filter'] : $this->prefs['defaultFilter'];
848 847
 			}
849 848
 			if (!isset($values['nm']['order']) || !$values['nm']['order'])
850 849
 			{
@@ -858,21 +857,21 @@  discard block
 block discarded – undo
858 857
 			$action_title = $values['action_title'] = $action ? $action_title : $nm['action_title'];
859 858
 			$action = $values['action'] = $action ? $action : $nm['action'];
860 859
 		}
861
-		if($_GET['search']) $values['nm']['search'] = $_GET['search'];
860
+		if ($_GET['search']) $values['nm']['search'] = $_GET['search'];
862 861
 
863 862
 		if ($values['nm']['add'])
864 863
 		{
865 864
 			$values['add'] = $values['nm']['add'];
866 865
 			unset($values['nm']['add']);
867 866
 		}
868
-		unset($values['nm']['rows']['checked']);	// not longer used, but hides button actions
867
+		unset($values['nm']['rows']['checked']); // not longer used, but hides button actions
869 868
 
870 869
 		if ($values['add'] || $values['cancel'] || isset($values['main']))
871 870
 		{
872 871
 			if ($values['add'])
873 872
 			{
874 873
 				list($type) = each($values['add']);
875
-				return $this->edit(0,$action,$action_id,$type,$called_as);
874
+				return $this->edit(0, $action, $action_id, $type, $called_as);
876 875
 			}
877 876
 			elseif ($values['cancel'] && $own_referer)
878 877
 			{
@@ -884,14 +883,14 @@  discard block
 block discarded – undo
884 883
 			}
885 884
 			else
886 885
 			{
887
-				list($do,$do2) = each($values['main']);
886
+				list($do, $do2) = each($values['main']);
888 887
 				list($do_id) = @each($do2);
889
-				switch((string)$do)
888
+				switch ((string)$do)
890 889
 				{
891 890
 					case 'close':
892
-						$closesingle=true;
891
+						$closesingle = true;
893 892
 					case 'close_all':
894
-						$this->close($do_id,$called_as,$closesingle);
893
+						$this->close($do_id, $called_as, $closesingle);
895 894
 						break;
896 895
 					case 'view':
897 896
 						$value = array();
@@ -929,7 +928,7 @@  discard block
 block discarded – undo
929 928
 		$this->tmpl->read('infolog.index');
930 929
 		$values['nm']['options-filter'] = $this->filters;
931 930
 		$values['nm']['get_rows'] = 'infolog.infolog_ui.get_rows';
932
-		$values['nm']['options-filter2'] = (in_array($this->prefs['show_links'],array('all','no_describtion')) ? array() : array(
931
+		$values['nm']['options-filter2'] = (in_array($this->prefs['show_links'], array('all', 'no_describtion')) ? array() : array(
933 932
 			''               => 'default',
934 933
 		)) + array(
935 934
 			'no_describtion' => 'no details',
@@ -950,34 +949,34 @@  discard block
 block discarded – undo
950 949
 		else
951 950
 		{
952 951
 			// Allow saving parent ID into favorites
953
-			$values['nm']['favorites'] = array('action','action_id');
952
+			$values['nm']['favorites'] = array('action', 'action_id');
954 953
 		}
955 954
 
956 955
 		// Allow add actions even when there's no rows
957 956
 		$values['nm']['placeholder_actions'] = array('new');
958 957
 
959
-		if(!isset($values['nm']['filter2'])) $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref'];
958
+		if (!isset($values['nm']['filter2'])) $values['nm']['filter2'] = $this->prefs['nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows').'-details-pref'];
960 959
 
961 960
 		// disable columns for main entry as set in the pref for details or no details
962 961
 		$values['nm']['columnselection_pref'] = 'nextmatch-'.($action ? 'infolog.'.$action : 'infolog.index.rows')
963
-			.($values['nm']['filter2']=='all' ? '-details' : '');
962
+			.($values['nm']['filter2'] == 'all' ? '-details' : '');
964 963
 		if ($action == 'sp')
965 964
 		{
966 965
 			$pref = $values['nm']['columnselection_pref'];
967
-			foreach(array('info_used_time_info_planned_time_info_replanned_time','info_datemodified','info_owner_info_responsible','customfields') as $name)
966
+			foreach (array('info_used_time_info_planned_time_info_replanned_time', 'info_datemodified', 'info_owner_info_responsible', 'customfields') as $name)
968 967
 			{
969
-				$values['main']['no_'.$name] = strpos($this->prefs[$pref],$name) === false;
968
+				$values['main']['no_'.$name] = strpos($this->prefs[$pref], $name) === false;
970 969
 			}
971 970
 			if (!$values['main']['no_customfields'])
972 971
 			{
973 972
 				// set the column-header of the main table for the customfields.
974
-				foreach(array_keys($this->bo->customfields) as $lname)
973
+				foreach (array_keys($this->bo->customfields) as $lname)
975 974
 				{
976
-					$values['main']['customfields'].=$lname."\n";
975
+					$values['main']['customfields'] .= $lname."\n";
977 976
 				}
978 977
 			}
979 978
 		}
980
-		if ($values['nm']['filter']=='bydate')
979
+		if ($values['nm']['filter'] == 'bydate')
981 980
 		{
982 981
 			foreach (array_keys($values['nm']['col_filter']) as $colfk)
983 982
 			{
@@ -1010,7 +1009,7 @@  discard block
 block discarded – undo
1010 1009
 		{
1011 1010
 			$values['css'] .= '<style type="text/css">@media screen { .infoDes {  '.
1012 1011
 				' max-height: '.
1013
-				(($this->prefs['limit_des_lines'] ? $this->prefs['limit_des_lines'] : 5) * 1.35).	// dono why em is not real lines
1012
+				(($this->prefs['limit_des_lines'] ? $this->prefs['limit_des_lines'] : 5) * 1.35).// dono why em is not real lines
1014 1013
 				'em; overflow: auto; }}</style>';
1015 1014
 		}
1016 1015
 
@@ -1022,13 +1021,13 @@  discard block
 block discarded – undo
1022 1021
 
1023 1022
 		// remove group-types user has not any rights to as filter
1024 1023
 		// does not take implicit rights as delegated into account, so they will not be available as filters
1025
-		foreach($this->bo->group_owners as $type => $group)
1024
+		foreach ($this->bo->group_owners as $type => $group)
1026 1025
 		{
1027 1026
 			if (!isset($this->bo->grants[$group])) unset($sel_options['info_type'][$type]);
1028 1027
 		}
1029 1028
 
1030 1029
 
1031
-		return $this->tmpl->exec('infolog.infolog_ui.index',$values,$sel_options,$readonlys,$persist,$return_html ? -1 : 0);
1030
+		return $this->tmpl->exec('infolog.infolog_ui.index', $values, $sel_options, $readonlys, $persist, $return_html ? -1 : 0);
1032 1031
 	}
1033 1032
 
1034 1033
 	/**
@@ -1043,9 +1042,9 @@  discard block
 block discarded – undo
1043 1042
 		if ($this->bo->group_owners)
1044 1043
 		{
1045 1044
 			// remove types owned by groups the user has no edit grant
1046
-			foreach($this->bo->group_owners as $type => $group)
1045
+			foreach ($this->bo->group_owners as $type => $group)
1047 1046
 			{
1048
-				if (!($this->bo->grants[$group] & Acl::EDIT))
1047
+				if (!($this->bo->grants[$group]&Acl::EDIT))
1049 1048
 				{
1050 1049
 					unset($types[$type]);
1051 1050
 				}
@@ -1062,7 +1061,7 @@  discard block
 block discarded – undo
1062 1061
 	 */
1063 1062
 	private function get_actions(array $query)
1064 1063
 	{
1065
-		for($i = 0; $i <= 100; $i += 10)
1064
+		for ($i = 0; $i <= 100; $i += 10)
1066 1065
 		{
1067 1066
 			$percent[$i] = $i.'%';
1068 1067
 		}
@@ -1071,9 +1070,9 @@  discard block
 block discarded – undo
1071 1070
 		$types_add = array();
1072 1071
 		// Do not add deleted type to add or change menus
1073 1072
 		unset($types['delete']);
1074
-		foreach($types as $type => &$data)
1073
+		foreach ($types as $type => &$data)
1075 1074
 		{
1076
-			$image_exists = Api\Image::find('infolog',$type);
1075
+			$image_exists = Api\Image::find('infolog', $type);
1077 1076
 			$data = array(
1078 1077
 				'caption' => $data,
1079 1078
 				'icon' => $image_exists ? $type : 'infolog/navbar',
@@ -1085,9 +1084,9 @@  discard block
 block discarded – undo
1085 1084
 
1086 1085
 		$icons = null;
1087 1086
 		$statis = $this->bo->get_status($query['col_filter']['info_type'], $icons);
1088
-		foreach($statis as $type => &$data)
1087
+		foreach ($statis as $type => &$data)
1089 1088
 		{
1090
-			$image_exists = Api\Image::find('infolog',$icons[$type]);
1089
+			$image_exists = Api\Image::find('infolog', $icons[$type]);
1091 1090
 			$data = array(
1092 1091
 				'caption' => $data,
1093 1092
 				'icon' => $image_exists ? $icons[$type] : 'infolog/status',
@@ -1099,10 +1098,10 @@  discard block
 block discarded – undo
1099 1098
 				'caption' => 'Open',
1100 1099
 				'default' => true,
1101 1100
 				'allowOnMultiple' => false,
1102
-				'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.infolog.viewEntry':'',
1101
+				'onExecute' => Api\Header\UserAgent::mobile() ? 'javaScript:app.infolog.viewEntry' : '',
1103 1102
 				'url' => 'menuaction=infolog.infolog_ui.edit&info_id=$id',
1104 1103
 				'popup' => Link::get_registry('infolog', 'add_popup'),
1105
-				'group' => $group=1,
1104
+				'group' => $group = 1,
1106 1105
 				'mobileViewTemplate' => 'view?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/infolog/templates/mobile/view.xet'))
1107 1106
 			),
1108 1107
 			'parent' => array(
@@ -1176,7 +1175,7 @@  discard block
 block discarded – undo
1176 1175
 						'icon' => 'completed',
1177 1176
 					),
1178 1177
 					'cat' =>  Etemplate\Widget\Nextmatch::category_action(
1179
-						'infolog',$group,'Change category','cat_'
1178
+						'infolog', $group, 'Change category', 'cat_'
1180 1179
 					),
1181 1180
 					'startdate' => array(
1182 1181
 						'caption' => 'Start date',
@@ -1224,7 +1223,7 @@  discard block
 block discarded – undo
1224 1223
 				'onExecute' => 'javaScript:app.infolog.infolog_menu_print'
1225 1224
 			)
1226 1225
 		);
1227
-		++$group;	// integration with other apps
1226
+		++$group; // integration with other apps
1228 1227
 		if ($GLOBALS['egw_info']['user']['apps']['filemanager'])
1229 1228
 		{
1230 1229
 			$actions['filemanager'] = array(
@@ -1242,7 +1241,7 @@  discard block
 block discarded – undo
1242 1241
 				'caption' => 'Schedule appointment',
1243 1242
 				'group' => $group,
1244 1243
 				'url' => 'menuaction=calendar.calendar_uiforms.edit&'.
1245
-					Link::get_registry('calendar', 'add_app') . '[]=infolog&'.Link::get_registry('calendar','add_id').'[]=$id',
1244
+					Link::get_registry('calendar', 'add_app').'[]=infolog&'.Link::get_registry('calendar', 'add_id').'[]=$id',
1246 1245
 				'allowOnMultiple' => false,
1247 1246
 				'popup' => Link::get_registry('calendar', 'add_popup'),
1248 1247
 			);
@@ -1280,7 +1279,7 @@  discard block
 block discarded – undo
1280 1279
 				'hint' => 'Convert to a ticket',
1281 1280
 				'group' => $group,
1282 1281
 				'url' => 'menuaction=tracker.tracker_ui.edit&'.
1283
-					Link::get_registry('tracker', 'add_app') . '[]=infolog&'.Link::get_registry('tracker','add_id').'[]=$id',
1282
+					Link::get_registry('tracker', 'add_app').'[]=infolog&'.Link::get_registry('tracker', 'add_id').'[]=$id',
1284 1283
 				'allowOnMultiple' => false,
1285 1284
 				'popup' => Link::get_registry('tracker', 'add_popup'),
1286 1285
 			);
@@ -1293,7 +1292,7 @@  discard block
 block discarded – undo
1293 1292
 		$actions['ical'] = array(
1294 1293
 			'icon' => 'ical',
1295 1294
 			'caption' => 'Export iCal',
1296
-			'postSubmit' => true,	// download needs post submit to work
1295
+			'postSubmit' => true, // download needs post submit to work
1297 1296
 			'group' => $group,
1298 1297
 			'allowOnMultiple' => true,
1299 1298
 			'hideOnMobile' => true
@@ -1346,14 +1345,14 @@  discard block
 block discarded – undo
1346 1345
 		$success = $failed = 0;
1347 1346
 		if ($use_all)
1348 1347
 		{
1349
-			@set_time_limit(0);                     // switch off the execution time limit, as it's for big selections to small
1350
-			$query['num_rows'] = -1;        // all
1348
+			@set_time_limit(0); // switch off the execution time limit, as it's for big selections to small
1349
+			$query['num_rows'] = -1; // all
1351 1350
 			$result = $readonlys = null;
1352
-			$this->get_rows($query,$result,$readonlys);
1351
+			$this->get_rows($query, $result, $readonlys);
1353 1352
 			$checked = array();
1354
-			foreach($result as $key => $info)
1353
+			foreach ($result as $key => $info)
1355 1354
 			{
1356
-				if(is_numeric($key))
1355
+				if (is_numeric($key))
1357 1356
 				{
1358 1357
 					$checked[] = $info['info_id'];
1359 1358
 				}
@@ -1364,29 +1363,29 @@  discard block
 block discarded – undo
1364 1363
 		list($action, $settings) = explode('_', $_action, 2);
1365 1364
 
1366 1365
 		// Actions that can handle a list of IDs
1367
-		switch($action)
1366
+		switch ($action)
1368 1367
 		{
1369 1368
 			case 'link':
1370 1369
 				list($add_remove, $link) = explode('_', $settings, 2);
1371
-				list($app, $link_id) = explode(strpos($link,':') !== false ? ':' : ',', $link);
1372
-				if(!$link_id)
1370
+				list($app, $link_id) = explode(strpos($link, ':') !== false ? ':' : ',', $link);
1371
+				if (!$link_id)
1373 1372
 				{
1374 1373
 					$action_msg = 'linked';
1375 1374
 					$msg = lang('You need to select an entry for linking.');
1376 1375
 					break;
1377 1376
 				}
1378 1377
 				$title = Link::title($app, $link_id);
1379
-				foreach($checked as $id)
1378
+				foreach ($checked as $id)
1380 1379
 				{
1381
-					if(!$this->bo->check_access($id, Acl::EDIT))
1380
+					if (!$this->bo->check_access($id, Acl::EDIT))
1382 1381
 					{
1383 1382
 						$failed++;
1384 1383
 						continue;
1385 1384
 					}
1386
-					if($add_remove == 'add')
1385
+					if ($add_remove == 'add')
1387 1386
 					{
1388 1387
 						$action_msg = lang('linked to %1', $title);
1389
-						if(Link::link('infolog', $id, $app, $link_id))
1388
+						if (Link::link('infolog', $id, $app, $link_id))
1390 1389
 						{
1391 1390
 							$success++;
1392 1391
 						}
@@ -1413,20 +1412,20 @@  discard block
 block discarded – undo
1413 1412
 			case 'ical':
1414 1413
 				// infolog_ical lets horde be auto-loaded, so it must go first
1415 1414
 				$boical = new infolog_ical();
1416
-				Api\Header\Content::type('todo.ics','text/calendar');
1415
+				Api\Header\Content::type('todo.ics', 'text/calendar');
1417 1416
 				echo $boical->exportvCalendar($checked);
1418 1417
 				exit();
1419 1418
 
1420 1419
 		}
1421 1420
 
1422 1421
 		// Actions that need to loop
1423
-		foreach($checked as $id)
1422
+		foreach ($checked as $id)
1424 1423
 		{
1425
-			if(!$entry = $this->bo->read($id))
1424
+			if (!$entry = $this->bo->read($id))
1426 1425
 			{
1427 1426
 				continue;
1428 1427
 			}
1429
-			switch($action)
1428
+			switch ($action)
1430 1429
 			{
1431 1430
 				case 'close':
1432 1431
 					$action_msg = lang('closed');
@@ -1436,8 +1435,8 @@  discard block
 block discarded – undo
1436 1435
 
1437 1436
 				case 'delete':
1438 1437
 					$action_msg = $settings == 'sub' ? lang(' (and children) deleted') : lang('deleted');
1439
-					$result = $this->bo->delete($id, $settings=='sub', false, $skip_notifications);
1440
-					if($result == true)
1438
+					$result = $this->bo->delete($id, $settings == 'sub', false, $skip_notifications);
1439
+					if ($result == true)
1441 1440
 					{
1442 1441
 						$success++;
1443 1442
 					}
@@ -1450,14 +1449,14 @@  discard block
 block discarded – undo
1450 1449
 				case 'type':
1451 1450
 					$action_msg = lang('changed type');
1452 1451
 					// Dont allow to change the type, if user has no delete rights from the group-owner
1453
-					if ($id && !($this->bo->grants[$entry['info_owner']] & Acl::DELETE))
1452
+					if ($id && !($this->bo->grants[$entry['info_owner']]&Acl::DELETE))
1454 1453
 					{
1455 1454
 						$failed++;
1456 1455
 						break;
1457 1456
 					}
1458 1457
 					$entry['info_type'] = $settings;
1459 1458
 					try {
1460
-						$this->bo->write($entry, true,true,true,$skip_notifications,true); // Throw exceptions
1459
+						$this->bo->write($entry, true, true, true, $skip_notifications, true); // Throw exceptions
1461 1460
 					}
1462 1461
 					catch (Api\Exception\WrongUserinput $e)
1463 1462
 					{
@@ -1472,11 +1471,11 @@  discard block
 block discarded – undo
1472 1471
 					$action_msg = lang('changed completion to %1%', $settings);
1473 1472
 					$entry['info_percent'] = $settings;
1474 1473
 					// Done and not-started entries will get changed right back if we don't change the status too
1475
-					if(in_array($entry['info_status'],array('not-started','done','billed','cancelled','archive')))
1474
+					if (in_array($entry['info_status'], array('not-started', 'done', 'billed', 'cancelled', 'archive')))
1476 1475
 					{
1477 1476
 						$entry['info_status'] = 'ongoing';
1478 1477
 					}
1479
-					if($entry['info_percent'] == 0)
1478
+					if ($entry['info_percent'] == 0)
1480 1479
 					{
1481 1480
 						$entry['info_status'] = 'not-started';
1482 1481
 					}
@@ -1484,7 +1483,7 @@  discard block
 block discarded – undo
1484 1483
 					{
1485 1484
 						$entry['info_status'] = 'done';
1486 1485
 					}
1487
-					if($this->bo->write($entry, true,true,true,$skip_notifications))
1486
+					if ($this->bo->write($entry, true, true, true, $skip_notifications))
1488 1487
 					{
1489 1488
 						$success++;
1490 1489
 					}
@@ -1496,24 +1495,23 @@  discard block
 block discarded – undo
1496 1495
 
1497 1496
 				case 'undelete':	// set it to valid status != 'deleted' for that type
1498 1497
 					$settings = isset($this->bo->status[$entry['info_type']]['done']) ?
1499
-						$this->bo->status[$entry['info_type']]['done'] :
1500
-						$this->bo->status['defaults'][$entry['info_type']];
1498
+						$this->bo->status[$entry['info_type']]['done'] : $this->bo->status['defaults'][$entry['info_type']];
1501 1499
 					// fall-through
1502 1500
 				case 'status':
1503
-					if(isset($this->bo->status[$entry['info_type']][$settings]))
1501
+					if (isset($this->bo->status[$entry['info_type']][$settings]))
1504 1502
 					{
1505 1503
 						$action_msg = lang('changed status to %1', lang($this->bo->status[$entry['info_type']][$settings]));
1506
-						if(!in_array($settings,array('done','billed','cancelled','archive')) && $entry['info_percent'] == 100)
1504
+						if (!in_array($settings, array('done', 'billed', 'cancelled', 'archive')) && $entry['info_percent'] == 100)
1507 1505
 						{
1508 1506
 							// Done entries will get changed right back if we don't change the completion too
1509 1507
 							$entry['info_percent'] = 10;
1510 1508
 						}
1511
-						if(in_array($settings, array('not-started')) && $entry['info_percent'] > 0)
1509
+						if (in_array($settings, array('not-started')) && $entry['info_percent'] > 0)
1512 1510
 						{
1513 1511
 							$entry['info_percent'] = 0;
1514 1512
 						}
1515 1513
 						$entry['info_status'] = $settings;
1516
-						if($this->bo->write($entry, true,true,true,$skip_notifications))
1514
+						if ($this->bo->write($entry, true, true, true, $skip_notifications))
1517 1515
 						{
1518 1516
 							$success++;
1519 1517
 						}
@@ -1526,7 +1524,7 @@  discard block
 block discarded – undo
1526 1524
 					break;
1527 1525
 
1528 1526
 				case 'cat':
1529
-					if($settings)
1527
+					if ($settings)
1530 1528
 					{
1531 1529
 						$cat_name = Api\Categories::id2name($settings);
1532 1530
 						$action_msg = lang('changed category to %1', $cat_name);
@@ -1536,7 +1534,7 @@  discard block
 block discarded – undo
1536 1534
 						$action_msg = lang('removed category');
1537 1535
 					}
1538 1536
 					$entry['info_cat'] = $settings;
1539
-					if($this->bo->write($entry, true,true,true,$skip_notifications))
1537
+					if ($this->bo->write($entry, true, true, true, $skip_notifications))
1540 1538
 					{
1541 1539
 						$success++;
1542 1540
 					}
@@ -1548,15 +1546,15 @@  discard block
 block discarded – undo
1548 1546
 
1549 1547
 				case 'responsible':
1550 1548
 					list($add_remove, $user_str) = explode('_', $settings, 2);
1551
-					$action_msg = ($add_remove == 'ok' ? lang('changed') : ($add_remove == 'add' ? lang('added') : lang('removed'))) . ' ';
1549
+					$action_msg = ($add_remove == 'ok' ? lang('changed') : ($add_remove == 'add' ? lang('added') : lang('removed'))).' ';
1552 1550
 					$names = array();
1553 1551
 					$users = explode(',', $user_str);
1554
-					foreach($users as $account_id)
1552
+					foreach ($users as $account_id)
1555 1553
 					{
1556 1554
 						$names[] = Api\Accounts::username($account_id);
1557 1555
 					}
1558 1556
 					$action_msg .= implode(', ', $names);
1559
-					if($add_remove == 'ok')
1557
+					if ($add_remove == 'ok')
1560 1558
 					{
1561 1559
 						$entry['info_responsible'] = (array)$users;
1562 1560
 					}
@@ -1565,7 +1563,7 @@  discard block
 block discarded – undo
1565 1563
 						$function = $add_remove == 'add' ? 'array_merge' : 'array_diff';
1566 1564
 						$entry['info_responsible'] = array_unique($function($entry['info_responsible'], (array)$users));
1567 1565
 					}
1568
-					if($this->bo->write($entry, true,true,true,$skip_notifications))
1566
+					if ($this->bo->write($entry, true, true, true, $skip_notifications))
1569 1567
 					{
1570 1568
 						$success++;
1571 1569
 					}
@@ -1580,7 +1578,7 @@  discard block
 block discarded – undo
1580 1578
 					list($ok, $date) = explode('_', $settings, 2);
1581 1579
 					$entry[$field] = $date ? Api\DateTime::to($date, 'ts') : null;
1582 1580
 					$action_msg = lang('changed');
1583
-					if($this->bo->write($entry, true,true,true,$skip_notifications))
1581
+					if ($this->bo->write($entry, true, true, true, $skip_notifications))
1584 1582
 					{
1585 1583
 						$success++;
1586 1584
 					}
@@ -1601,10 +1599,10 @@  discard block
 block discarded – undo
1601 1599
 	 * @param string $_referer=''
1602 1600
 	 * @param boolean $closesingle=false
1603 1601
 	 */
1604
-	function close($values=0,$_referer='',$closesingle=false,$skip_notification = false)
1602
+	function close($values = 0, $_referer = '', $closesingle = false, $skip_notification = false)
1605 1603
 	{
1606 1604
 		//echo "<p>".__METHOD__."($values,$referer,$closeall)</p>\n";
1607
-		$info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id']));
1605
+		$info_id = (int)(is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id']));
1608 1606
 		$referer = is_array($values) ? $values['referer'] : $_referer;
1609 1607
 
1610 1608
 		if ($info_id)
@@ -1614,11 +1612,11 @@  discard block
 block discarded – undo
1614 1612
 			$status = $info['info_status'];
1615 1613
 			// closed stati assumed array('done','billed','cancelled')
1616 1614
 			if (isset($this->bo->status[$info['info_type']]['done'])) {
1617
-				$status ='done';
1615
+				$status = 'done';
1618 1616
 			} elseif (isset($this->bo->status[$info['info_type']]['billed'])) {
1619
-				$status ='billed';
1617
+				$status = 'billed';
1620 1618
 			} elseif (isset($this->bo->status[$info['info_type']]['cancelled'])) {
1621
-				$status ='cancelled';
1619
+				$status = 'cancelled';
1622 1620
 			}
1623 1621
 			#_debug_array($status);
1624 1622
 			$values = array(
@@ -1628,15 +1626,15 @@  discard block
 block discarded – undo
1628 1626
 				'info_percent'=> 100,
1629 1627
 				'info_datecompleted' => $this->bo->now_su,
1630 1628
 			);
1631
-			$this->bo->write($values, true,true,true,$skip_notification);
1629
+			$this->bo->write($values, true, true, true, $skip_notification);
1632 1630
 
1633
-			$query = array('action'=>'sp','action_id'=>$info_id);
1631
+			$query = array('action'=>'sp', 'action_id'=>$info_id);
1634 1632
 			if (!$closesingle) {
1635
-				foreach((array)$this->bo->search($query) as $info)
1633
+				foreach ((array)$this->bo->search($query) as $info)
1636 1634
 				{
1637 1635
 					if ($info['info_id_parent'] == $info_id)	// search also returns linked entries!
1638 1636
 					{
1639
-						$this->close($info['info_id'],$referer,$closesingle,$skip_notification);	// we call ourselfs recursive to process subs from subs too
1637
+						$this->close($info['info_id'], $referer, $closesingle, $skip_notification); // we call ourselfs recursive to process subs from subs too
1640 1638
 					}
1641 1639
 				}
1642 1640
 			}
@@ -1652,9 +1650,9 @@  discard block
 block discarded – undo
1652 1650
 	 * @param string $called_by
1653 1651
 	 * @param boolean $skip_notification Do not send notification of deletion
1654 1652
 	 */
1655
-	function delete($values=0,$_referer='',$called_by='',$skip_notification=False)
1653
+	function delete($values = 0, $_referer = '', $called_by = '', $skip_notification = False)
1656 1654
 	{
1657
-		$info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id']));
1655
+		$info_id = (int)(is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id']));
1658 1656
 		$referer = is_array($values) ? $values['referer'] : $_referer;
1659 1657
 
1660 1658
 		if (!is_array($values) && $info_id > 0 && !$this->bo->anzSubs($info_id))	// entries without subs get confirmed by javascript
@@ -1665,9 +1663,9 @@  discard block
 block discarded – undo
1665 1663
 
1666 1664
 		if (is_array($values) || $info_id <= 0)
1667 1665
 		{
1668
-			if (($values['delete'] || $values['delete_subs']) && $info_id > 0 && $this->bo->check_access($info_id,Acl::DELETE))
1666
+			if (($values['delete'] || $values['delete_subs']) && $info_id > 0 && $this->bo->check_access($info_id, Acl::DELETE))
1669 1667
 			{
1670
-				$deleted = $this->bo->delete($info_id,$values['delete_subs'],$values['info_id_parent'], $skip_notification);
1668
+				$deleted = $this->bo->delete($info_id, $values['delete_subs'], $values['info_id_parent'], $skip_notification);
1671 1669
 			}
1672 1670
 			if ($called_by)		// direct call from the same request
1673 1671
 			{
@@ -1677,7 +1675,7 @@  discard block
 block discarded – undo
1677 1675
 			{
1678 1676
 				$this->edit(array(
1679 1677
 					'info_id' => $info_id,
1680
-					'button'  => array('deleted' => true),	// not delete!
1678
+					'button'  => array('deleted' => true), // not delete!
1681 1679
 					'referer' => $referer,
1682 1680
 					'msg'     => $deleted ? lang('Infolog entry deleted') : '',
1683 1681
 				));
@@ -1685,7 +1683,7 @@  discard block
 block discarded – undo
1685 1683
 			return $referer ? $this->tmpl->location($referer) : $this->index();
1686 1684
 		}
1687 1685
 		$readonlys = $values = array();
1688
-		$values['main'][1] = $this->get_info($info_id,$readonlys['main']);
1686
+		$values['main'][1] = $this->get_info($info_id, $readonlys['main']);
1689 1687
 
1690 1688
 		$this->tmpl->read('infolog.delete');
1691 1689
 
@@ -1706,7 +1704,7 @@  discard block
 block discarded – undo
1706 1704
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Delete');
1707 1705
 		$GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologDelete');
1708 1706
 
1709
-		$this->tmpl->exec('infolog.infolog_ui.delete',$values,array(),$readonlys,$persist,$called_by == 'edit' ? 2 : 0);
1707
+		$this->tmpl->exec('infolog.infolog_ui.delete', $values, array(), $readonlys, $persist, $called_by == 'edit' ? 2 : 0);
1710 1708
 	}
1711 1709
 
1712 1710
 	/**
@@ -1718,81 +1716,81 @@  discard block
 block discarded – undo
1718 1716
 	 * @param string $type Type of log-entry: note,todo,task
1719 1717
 	 * @param string $referer array with param/get-vars of the refering page
1720 1718
 	 */
1721
-	function edit($content = null,$action = '',$action_id=0,$type='',$referer='')
1719
+	function edit($content = null, $action = '', $action_id = 0, $type = '', $referer = '')
1722 1720
 	{
1723 1721
 		if (($submit = is_array($content)))
1724 1722
 		{
1725 1723
 			//echo "infolog_ui::edit: content="; _debug_array($content);
1726 1724
 			$info_id   = $content['info_id'];
1727
-			$action    = $content['action'];    unset($content['action']);
1725
+			$action    = $content['action']; unset($content['action']);
1728 1726
 			$action_id = $content['action_id']; unset($content['action_id']);
1729
-			$referer   = $content['referer'];   unset($content['referer']);
1730
-			$no_popup  = $content['no_popup'];  unset($content['no_popup']);
1727
+			$referer   = $content['referer']; unset($content['referer']);
1728
+			$no_popup  = $content['no_popup']; unset($content['no_popup']);
1731 1729
 
1732 1730
 			list($button) = @each($content['button']);
1733
-			if (!$button && $action) $button = $action;	// action selectbox
1731
+			if (!$button && $action) $button = $action; // action selectbox
1734 1732
 			//info_cc expects an comma separated string
1735 1733
 			//error_log(__METHOD__.__LINE__.array2string($content));
1736 1734
 			if (empty($content['info_cc'])) $content['info_cc'] = "";
1737 1735
 			if (is_array($content['info_cc']))
1738 1736
 			{
1739
-				foreach($content['info_cc'] as $i => $value)
1737
+				foreach ($content['info_cc'] as $i => $value)
1740 1738
 				{
1741 1739
 					//imap_rfc822 should not be used, but it works reliable here, until we have some regex solution or use horde stuff
1742 1740
 					$addresses = imap_rfc822_parse_adrlist($value, '');
1743 1741
 					//error_log(__METHOD__.__LINE__.$value.'->'.array2string($addresses[0]));
1744
-					$content['info_cc'][$i]=$addresses[0]->host ? $addresses[0]->mailbox.'@'.$addresses[0]->host : $addresses[0]->mailbox;
1742
+					$content['info_cc'][$i] = $addresses[0]->host ? $addresses[0]->mailbox.'@'.$addresses[0]->host : $addresses[0]->mailbox;
1745 1743
 				}
1746
-				if (!empty($content['info_cc'])) $content['info_cc'] = implode(',',$content['info_cc']);
1744
+				if (!empty($content['info_cc'])) $content['info_cc'] = implode(',', $content['info_cc']);
1747 1745
 			}
1748 1746
 			unset($content['button']);
1749 1747
 			if ($button)
1750 1748
 			{
1751 1749
 				// Copy or schedule Infolog
1752
-				if (in_array($button,array('copy','schedule','ical','tracker')))
1750
+				if (in_array($button, array('copy', 'schedule', 'ical', 'tracker')))
1753 1751
 				{
1754 1752
 					$action = $button;
1755
-					if (!$info_id || $this->bo->check_access($info_id,Acl::EDIT))
1753
+					if (!$info_id || $this->bo->check_access($info_id, Acl::EDIT))
1756 1754
 					{
1757
-						$button = 'apply';	// need to store infolog first
1755
+						$button = 'apply'; // need to store infolog first
1758 1756
 					}
1759 1757
 				}
1760 1758
 				//Validate the enddate must be grather than startdate
1761 1759
 				if (!empty($content['info_enddate']) && !empty($content['info_startdate']))
1762 1760
 				{
1763
-					$duration_date = $content['info_enddate']-$content['info_startdate'];
1761
+					$duration_date = $content['info_enddate'] - $content['info_startdate'];
1764 1762
 					if ($duration_date < 0)
1765 1763
 					{
1766 1764
 						$this->tmpl->set_validation_error('info_startdate', lang('Startdate must be before Enddate!!!'));
1767
-						$button = $action = '';	// stop save or apply
1765
+						$button = $action = ''; // stop save or apply
1768 1766
 					}
1769 1767
 				}
1770 1768
 				//echo "<p>infolog_ui::edit(info_id=$info_id) '$button' button pressed, content="; _debug_array($content);
1771 1769
 				if (($button == 'save' || $button == 'apply') && isset($content['info_subject']) && empty($content['info_subject']))
1772 1770
 				{
1773
-					$this->tmpl->set_validation_error('info_subject',lang('Field must not be empty !!!'));
1774
-					$button = $action = '';	// stop save or apply
1771
+					$this->tmpl->set_validation_error('info_subject', lang('Field must not be empty !!!'));
1772
+					$button = $action = ''; // stop save or apply
1775 1773
 				}
1776 1774
 				if (($button == 'save' || $button == 'apply') && $info_id)
1777 1775
 				{
1778 1776
 					$old = $this->bo->read($info_id);
1779
-					if (!($edit_acl = $this->bo->check_access($info_id,Acl::EDIT)))
1777
+					if (!($edit_acl = $this->bo->check_access($info_id, Acl::EDIT)))
1780 1778
 					{
1781 1779
 						$status_only = $this->bo->is_responsible($old);
1782
-						$undelete = $this->bo->check_access($old,infolog_bo::ACL_UNDELETE);
1780
+						$undelete = $this->bo->check_access($old, infolog_bo::ACL_UNDELETE);
1783 1781
 					}
1784 1782
 				}
1785 1783
 				if (($button == 'save' || $button == 'apply') && (!$info_id || $edit_acl || $status_only || $undelete))
1786 1784
 				{
1787
-					$operation = $info_id ?  'edit' : 'add';
1785
+					$operation = $info_id ? 'edit' : 'add';
1788 1786
 
1789 1787
 					if (is_array($content['link_to']['to_id']) && count($content['link_to']['to_id']))
1790 1788
 					{
1791
-						$content['info_link_id'] = 0;	// as field has to be int
1789
+						$content['info_link_id'] = 0; // as field has to be int
1792 1790
 					}
1793 1791
 					if (is_array($content['info_contact']) && $content['info_contact']['id'])
1794 1792
 					{
1795
-						$content['info_contact'] = $content['info_contact']['app'] . ':' . $content['info_contact']['id'];
1793
+						$content['info_contact'] = $content['info_contact']['app'].':'.$content['info_contact']['id'];
1796 1794
 					}
1797 1795
 					else
1798 1796
 					{
@@ -1801,39 +1799,38 @@  discard block
 block discarded – undo
1801 1799
 					$active_tab = $content['tabs'];
1802 1800
 					if (!($info_id = $this->bo->write($content, true, true, true, $content['no_notifications'])))
1803 1801
 					{
1804
-						$content['msg'] = $info_id !== 0 || !$content['info_id'] ? lang('Error: saving the entry') :
1805
-							lang('Error: the entry has been updated since you opened it for editing!').'<br />'.
1806
-							lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.','<a href="'.
1807
-								htmlspecialchars(Egw::link('/index.php',array(
1802
+						$content['msg'] = $info_id !== 0 || !$content['info_id'] ? lang('Error: saving the entry') : lang('Error: the entry has been updated since you opened it for editing!').'<br />'.
1803
+							lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.', '<a href="'.
1804
+								htmlspecialchars(Egw::link('/index.php', array(
1808 1805
 									'menuaction' => 'infolog.infolog_ui.edit',
1809 1806
 									'info_id'    => $content['info_id'],
1810 1807
 									'no_popup'   => $no_popup,
1811 1808
 									'referer'    => $referer,
1812
-								))).'">','</a>');
1813
-						$button = $action = '';	// not exiting edit
1809
+								))).'">', '</a>');
1810
+						$button = $action = ''; // not exiting edit
1814 1811
 						$info_id = $content['info_id'];
1815 1812
 					}
1816 1813
 					else
1817 1814
 					{
1818
-						$GLOBALS['egw']->preferences->add('infolog','preferred_type',$content['info_type']);
1819
-						$GLOBALS['egw']->preferences->save_repository(false,'user',false);
1815
+						$GLOBALS['egw']->preferences->add('infolog', 'preferred_type', $content['info_type']);
1816
+						$GLOBALS['egw']->preferences->save_repository(false, 'user', false);
1820 1817
 						$content['msg'] = lang('InfoLog entry saved');
1821
-						Framework::refresh_opener($content['msg'],'infolog',$info_id,$operation);
1818
+						Framework::refresh_opener($content['msg'], 'infolog', $info_id, $operation);
1822 1819
 					}
1823 1820
 					$content['tabs'] = $active_tab;
1824 1821
 					//try to keep the project manager link if the intenstion is only to remove contact
1825 1822
 					if ($old['info_link']['app'] == 'projectmanager' && $old['info_link']['id'] = $content['pm_id'])
1826 1823
 					{
1827
-						Link::link('infolog',$content['link_to']['to_id'],'projectmanager',$content['pm_id']);
1824
+						Link::link('infolog', $content['link_to']['to_id'], 'projectmanager', $content['pm_id']);
1828 1825
 					}
1829
-					if ((int) $content['pm_id'] != (int) $content['old_pm_id'])
1826
+					if ((int)$content['pm_id'] != (int)$content['old_pm_id'])
1830 1827
 					{
1831 1828
 						//echo "<p>pm_id changed: $content[old_pm_id] -> $content[pm_id]</p>\n";
1832 1829
 						// update links accordingly, if selected project changed
1833 1830
 						if ($content['pm_id'])
1834 1831
 						{
1835 1832
 							//echo "<p>this->link->link('infolog',{$content['link_to']['to_id']},'projectmanager',{$content['pm_id']});</p>";
1836
-							Link::link('infolog',$info_id,'projectmanager',$content['pm_id']);
1833
+							Link::link('infolog', $info_id, 'projectmanager', $content['pm_id']);
1837 1834
 							// making the project the selected link, if no other link selected
1838 1835
 							if (!$info_link_id || $info_link_id == 'projectmanager:'.$content['old_pm_id'])
1839 1836
 							{
@@ -1843,18 +1840,18 @@  discard block
 block discarded – undo
1843 1840
 						if ($content['old_pm_id'])
1844 1841
 						{
1845 1842
 							//echo "<p>this->link->unlink2(0,infolog,{$content['link_to']['to_id']},0,'projectmanager',{$content['old_pm_id']});</p>\n";
1846
-							Link::unlink2(0,infolog,$content['link_to']['to_id'],0,'projectmanager',$content['old_pm_id']);
1843
+							Link::unlink2(0, infolog, $content['link_to']['to_id'], 0, 'projectmanager', $content['old_pm_id']);
1847 1844
 						}
1848 1845
 						$content['old_pm_id'] = $content['pm_id'];
1849 1846
 					}
1850 1847
 					$content['link_to']['to_app'] = 'infolog';
1851 1848
 					$content['link_to']['to_id'] = $info_id;
1852 1849
 
1853
-					if ($info_link_id && strpos($info_link_id,':') !== false)	// updating info_link_id if necessary
1850
+					if ($info_link_id && strpos($info_link_id, ':') !== false)	// updating info_link_id if necessary
1854 1851
 					{
1855
-						list($app,$id) = explode(':',$info_link_id);
1856
-						$link = Link::get_link('infolog',$info_id,$app,$id);
1857
-						if ((int) $content['info_link_id'] != (int) $link['link_id'])
1852
+						list($app, $id) = explode(':', $info_link_id);
1853
+						$link = Link::get_link('infolog', $info_id, $app, $id);
1854
+						if ((int)$content['info_link_id'] != (int)$link['link_id'])
1858 1855
 						{
1859 1856
 							$content['info_link_id'] = $link['link_id'];
1860 1857
 
@@ -1866,7 +1863,7 @@  discard block
 block discarded – undo
1866 1863
 								'info_owner'   => $content['info_owner'],
1867 1864
 							);
1868 1865
 							//echo "<p>updating info_link_id: ".print_r($to_write,true)."</p>\n";
1869
-							$this->bo->write($to_write,False,true,true,true);	// last true = no notifications, as no real change
1866
+							$this->bo->write($to_write, False, true, true, true); // last true = no notifications, as no real change
1870 1867
 
1871 1868
 							// Do not override info_contact if is already filled with contact
1872 1869
 							if ($content['info_contact'])
@@ -1876,7 +1873,7 @@  discard block
 block discarded – undo
1876 1873
 							}
1877 1874
 
1878 1875
 							// we need eg. the new modification date, for further updates
1879
-							$content = array_merge($content,$to_write);
1876
+							$content = array_merge($content, $to_write);
1880 1877
 						}
1881 1878
 					}
1882 1879
 				}
@@ -1887,33 +1884,33 @@  discard block
 block discarded – undo
1887 1884
 						'action' => $action,
1888 1885
 						'action_id' => $action_id
1889 1886
 					);
1890
-					if (!($content['msg'] = $this->delete($info_id,$referer,'edit'))) return;	// checks ACL first
1887
+					if (!($content['msg'] = $this->delete($info_id, $referer, 'edit'))) return; // checks ACL first
1891 1888
 
1892
-					Framework::refresh_opener($content['msg'],'infolog',$info_id,'delete');
1889
+					Framework::refresh_opener($content['msg'], 'infolog', $info_id, 'delete');
1893 1890
 				}
1894 1891
 				// called again after delete confirmation dialog
1895
-				elseif ($button == 'deleted'  && $content['msg'])
1892
+				elseif ($button == 'deleted' && $content['msg'])
1896 1893
 				{
1897
-					Framework::refresh_opener($content['msg'],'infolog',$info_id,'delete');
1894
+					Framework::refresh_opener($content['msg'], 'infolog', $info_id, 'delete');
1898 1895
 				}
1899 1896
 				if ($button == 'save' || $button == 'cancel' || $button == 'delete' || $button == 'deleted')
1900 1897
 				{
1901 1898
 					if ($no_popup)
1902 1899
 					{
1903
-						Egw::redirect_link($referer,array('msg' => $content['msg']));
1900
+						Egw::redirect_link($referer, array('msg' => $content['msg']));
1904 1901
 					}
1905 1902
 					Framework::window_close();
1906 1903
 				}
1907 1904
 			}
1908 1905
 			// on a type-change, set the status to the default status of that type, if the actual status is not supported by the new type
1909
-			if (!array_key_exists($content['info_status'],$this->bo->status[$content['info_type']]))
1906
+			if (!array_key_exists($content['info_status'], $this->bo->status[$content['info_type']]))
1910 1907
 			{
1911 1908
 				$content['info_status'] = $this->bo->status['defaults'][$content['info_type']];
1912 1909
 				// Make sure we don't end up with invalid status / percent combinations
1913 1910
 				if ($content['info_status'] != 'done')
1914 1911
 				{
1915 1912
 					$content['info_datecompleted'] = '';
1916
-					if((int)$content['info_percent'] === 100)
1913
+					if ((int)$content['info_percent'] === 100)
1917 1914
 					{
1918 1915
 						$content['info_percent'] = 10;
1919 1916
 					}
@@ -1922,7 +1919,7 @@  discard block
 block discarded – undo
1922 1919
 				{
1923 1920
 					$content['info_percent'] = 100;
1924 1921
 				}
1925
-				if($content['info_status'] != 'not-started' && (int)$content['info_percent'] == 0)
1922
+				if ($content['info_status'] != 'not-started' && (int)$content['info_percent'] == 0)
1926 1923
 				{
1927 1924
 					$content['info_percent'] = 10;
1928 1925
 				}
@@ -1931,25 +1928,24 @@  discard block
 block discarded – undo
1931 1928
 		else	// new call via GET
1932 1929
 		{
1933 1930
 			//echo "<p>infolog_ui::edit: info_id=$info_id,  action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n";
1934
-			$action    = $action    ? $action    : $_REQUEST['action'];
1931
+			$action    = $action ? $action : $_REQUEST['action'];
1935 1932
 			$action_id = $action_id ? $action_id : $_REQUEST['action_id'];
1936
-			$info_id   = $content   ? $content   : $_REQUEST['info_id'];
1937
-			$type      = $type      ? $type      : $_REQUEST['type'];
1938
-			$referer   = $referer !== '' ? $referer : ($_GET['referer'] ? $_GET['referer'] :
1939
-				Api\Header\Referer::get('/index.php?menuaction=infolog.infolog_ui.index'));
1940
-			if (strpos($referer, 'msg=') !== false) $referer = preg_replace('/([&?]{1})msg=[^&]+&?/','\\1',$referer);	// remove previou/old msg from referer
1933
+			$info_id   = $content ? $content : $_REQUEST['info_id'];
1934
+			$type      = $type ? $type : $_REQUEST['type'];
1935
+			$referer   = $referer !== '' ? $referer : ($_GET['referer'] ? $_GET['referer'] : Api\Header\Referer::get('/index.php?menuaction=infolog.infolog_ui.index'));
1936
+			if (strpos($referer, 'msg=') !== false) $referer = preg_replace('/([&?]{1})msg=[^&]+&?/', '\\1', $referer); // remove previou/old msg from referer
1941 1937
 			$no_popup  = $_GET['no_popup'];
1942
-			$print = (int) $_REQUEST['print'];
1938
+			$print = (int)$_REQUEST['print'];
1943 1939
 			//echo "<p>infolog_ui::edit: info_id=$info_id,  action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n";
1944 1940
 
1945
-			if (($content = $this->bo->read( $info_id || $action != 'sp' ? $info_id : $action_id )) === false)
1941
+			if (($content = $this->bo->read($info_id || $action != 'sp' ? $info_id : $action_id)) === false)
1946 1942
 			{
1947 1943
 				Framework::window_close(lang('Permission denied!'));
1948 1944
 			}
1949
-			if (!(strpos($content['info_addr'],',')===false) && strpos($content['info_addr'],', ')===false) $content['info_addr'] = str_replace(',',', ',$content['info_addr']);
1950
-			foreach(array('info_subject', 'info_des') as $key)
1945
+			if (!(strpos($content['info_addr'], ',') === false) && strpos($content['info_addr'], ', ') === false) $content['info_addr'] = str_replace(',', ', ', $content['info_addr']);
1946
+			foreach (array('info_subject', 'info_des') as $key)
1951 1947
 			{
1952
-				if(!isset($content[$key]) || strlen($content[$key]) < 75)
1948
+				if (!isset($content[$key]) || strlen($content[$key]) < 75)
1953 1949
 				{
1954 1950
 					continue;
1955 1951
 				}
@@ -1957,66 +1953,66 @@  discard block
 block discarded – undo
1957 1953
 				$clarray = array();
1958 1954
 				foreach ($contlines as &$line)
1959 1955
 				{
1960
-					if(strlen($line) < 75)
1956
+					if (strlen($line) < 75)
1961 1957
 					{
1962 1958
 						$clarray[] = $line;
1963 1959
 						continue;
1964 1960
 					}
1965 1961
 					$cont = explode(' ', $line);
1966 1962
 					$ckarray = array();
1967
-					foreach($cont as &$word)
1963
+					foreach ($cont as &$word)
1968 1964
 					{
1969 1965
 						// set blank behind all , and . if words are too long, apply wordwrap afterwards to make sure we get
1970
-						if (strlen($word)>75)
1966
+						if (strlen($word) > 75)
1971 1967
 						{
1972 1968
 							$buff = Api\Html::activate_links($word);
1973 1969
 							if (strlen($buff) == strlen($word)) // no links -> try to break overlong words
1974 1970
 							{
1975
-								if (!(strpos($word,',')===false) && strpos($word,', ')===false) $word = str_replace(',',', ',$word);
1976
-								if (!(strpos($word,'.')===false) && strpos($word,'. ')===false) $word = str_replace('.','. ',$word);
1971
+								if (!(strpos($word, ',') === false) && strpos($word, ', ') === false) $word = str_replace(',', ', ', $word);
1972
+								if (!(strpos($word, '.') === false) && strpos($word, '. ') === false) $word = str_replace('.', '. ', $word);
1977 1973
 								$word = wordwrap($word, 75, ' ', true);
1978 1974
 							}
1979 1975
 						}
1980
-						$ckarray[] =$word;
1976
+						$ckarray[] = $word;
1981 1977
 					}
1982
-					$line = join(' ',$ckarray);
1978
+					$line = join(' ', $ckarray);
1983 1979
 					unset($ckarray);
1984 1980
 					$clarray[] = $line;
1985 1981
 				}
1986
-				$content[$key] = join("\n",$clarray);
1982
+				$content[$key] = join("\n", $clarray);
1987 1983
 				unset($clarray);
1988 1984
 			}
1989 1985
 			if (is_numeric($_REQUEST['cat_id']))
1990 1986
 			{
1991
-				$content['info_cat'] = (int) $_REQUEST['cat_id'];
1987
+				$content['info_cat'] = (int)$_REQUEST['cat_id'];
1992 1988
 			}
1993 1989
 			if (!$content)
1994 1990
 			{
1995 1991
 				$content['info_cat'] = $this->prefs['cat_add_default'];
1996 1992
 			}
1997
-			if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']);	// dont allow HTML!
1993
+			if ($_GET['msg']) $content['msg'] = strip_tags($_GET['msg']); // dont allow HTML!
1998 1994
 
1999
-			switch($this->prefs['set_start'])
1995
+			switch ($this->prefs['set_start'])
2000 1996
 			{
2001
-				case 'date': default: $set_startdate = mktime(0,0,0,date('m',$this->bo->user_time_now),date('d',$this->bo->user_time_now),date('Y',$this->bo->user_time_now)); break;
1997
+				case 'date': default: $set_startdate = mktime(0, 0, 0, date('m', $this->bo->user_time_now), date('d', $this->bo->user_time_now), date('Y', $this->bo->user_time_now)); break;
2002 1998
 				case 'datetime':      $set_startdate = $this->bo->user_time_now; break;
2003 1999
 				case 'empty':         $set_startdate = 0; break;
2004 2000
 			}
2005 2001
 			if ((int)$content['info_link_id'] > 0 && !Link::get_link($content['info_link_id']))
2006 2002
 			{
2007
-				$content['info_link_id'] = 0;	// link has been deleted
2003
+				$content['info_link_id'] = 0; // link has been deleted
2008 2004
 				if (!$content['info_custom_link']) $content['info_from'] = '';
2009 2005
 			}
2010 2006
 			if (!$info_id && $action_id && $action == 'sp')    // new SubProject
2011 2007
 			{
2012
-				if (!$this->bo->check_access($action_id,Acl::ADD))
2008
+				if (!$this->bo->check_access($action_id, Acl::ADD))
2013 2009
 				{
2014
-					return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id);
2010
+					return $referer ? $this->tmpl->location($referer) : $this->index(0, $action, $action_id);
2015 2011
 				}
2016 2012
 			}
2017 2013
 			else
2018 2014
 			{
2019
-				$undelete = $this->bo->check_access($info_id,infolog_bo::ACL_UNDELETE);
2015
+				$undelete = $this->bo->check_access($info_id, infolog_bo::ACL_UNDELETE);
2020 2016
 			}
2021 2017
 			$content['links'] = $content['link_to'] = array(
2022 2018
 				'to_id' => $info_id,
@@ -2024,12 +2020,12 @@  discard block
 block discarded – undo
2024 2020
 			);
2025 2021
 		}
2026 2022
 		// new call via GET or some actions handled here, as they can happen both ways ($_GET[action] or button/action in GUI)
2027
-		if (!$submit || in_array($action,array('sp','copy','schedule','ical','to_tracker')))
2023
+		if (!$submit || in_array($action, array('sp', 'copy', 'schedule', 'ical', 'to_tracker')))
2028 2024
 		{
2029 2025
 			switch ($action)
2030 2026
 			{
2031 2027
 				case 'schedule':
2032
-					Egw::redirect_link('/index.php',array(
2028
+					Egw::redirect_link('/index.php', array(
2033 2029
 						'menuaction' => 'calendar.calendar_uiforms.edit',
2034 2030
 						'link_app' => 'infolog',
2035 2031
 						'link_id' => $info_id,
@@ -2037,7 +2033,7 @@  discard block
 block discarded – undo
2037 2033
 					break;
2038 2034
 				case 'ical':
2039 2035
 					$boical = new infolog_ical();
2040
-					$result = $boical->exportVTODO($content,'2.0','PUBLISH',false);
2036
+					$result = $boical->exportVTODO($content, '2.0', 'PUBLISH', false);
2041 2037
 					Api\Header\Content::type('todo.ics', 'text/calendar');
2042 2038
 					echo $result;
2043 2039
 					exit();
@@ -2048,23 +2044,23 @@  discard block
 block discarded – undo
2048 2044
 					if ($action == 'sp')	// for sub-entries use type or category, like for new entries
2049 2045
 					{
2050 2046
 						if ($type) $content['info_type'] = $type;
2051
-						if (is_numeric($_REQUEST['cat_id'])) $content['info_cat'] = (int) $_REQUEST['cat_id'];
2047
+						if (is_numeric($_REQUEST['cat_id'])) $content['info_cat'] = (int)$_REQUEST['cat_id'];
2052 2048
 					}
2053
-					unset($action);	// it get stored in $content and will cause an other copy after [apply]
2049
+					unset($action); // it get stored in $content and will cause an other copy after [apply]
2054 2050
 					break;
2055 2051
 				case 'to_tracker':
2056
-					Egw::redirect_link('/index.php',array(
2052
+					Egw::redirect_link('/index.php', array(
2057 2053
 						'menuaction' => 'tracker.tracker_ui.edit',
2058 2054
 						Link::get_registry('tracker', 'add_app').'[]' => 'infolog',
2059
-						Link::get_registry('tracker','add_id').'[]' => $info_id,
2055
+						Link::get_registry('tracker', 'add_id').'[]' => $info_id,
2060 2056
 					));
2061 2057
 					break;
2062 2058
 				case 'projectmanager':
2063 2059
 					$pm_links = array($action_id);
2064 2060
 				default:	// to allow other apps to participate
2065 2061
 					$content['info_subject'] = Link::title($action, $id);
2066
-					$action_ids = explode(',',$action_id);
2067
-					if(count($action_ids) == 1)
2062
+					$action_ids = explode(',', $action_id);
2063
+					if (count($action_ids) == 1)
2068 2064
 					{
2069 2065
 						$content['info_contact'] = $action.':'.$action_id;
2070 2066
 					}
@@ -2073,11 +2069,11 @@  discard block
 block discarded – undo
2073 2069
 						Link::link('infolog', $content['link_to']['to_id'], $action, $id);
2074 2070
 
2075 2071
 						// calling "infolog_set" hook for first, in case app wants to set some more values
2076
-						if (!$n && ($set = Api\Hooks::single(array('location'=>'infolog_set','id'=>$action_id),$action)))
2072
+						if (!$n && ($set = Api\Hooks::single(array('location'=>'infolog_set', 'id'=>$action_id), $action)))
2077 2073
 						{
2078
-							foreach((array)$set['link_app'] as $i => $l_app)
2074
+							foreach ((array)$set['link_app'] as $i => $l_app)
2079 2075
 							{
2080
-								if (($l_id=$set['link_id'][$i])) Link::link('infolog',$content['link_to']['to_id'],$l_app,$l_id);
2076
+								if (($l_id = $set['link_id'][$i])) Link::link('infolog', $content['link_to']['to_id'], $l_app, $l_id);
2081 2077
 							}
2082 2078
 							unset($set['link_app']);
2083 2079
 							unset($set['link_id']);
@@ -2091,12 +2087,12 @@  discard block
 block discarded – undo
2091 2087
 					{
2092 2088
 						if (!isset($pm_links))
2093 2089
 						{
2094
-							$pm_links = Link::get_links('infolog',$info_id,'projectmanager');
2090
+							$pm_links = Link::get_links('infolog', $info_id, 'projectmanager');
2095 2091
 						}
2096
-						break;	// normal edit
2092
+						break; // normal edit
2097 2093
 					}
2098 2094
 				case 'new':		// new entry, set some defaults, if not set by infolog_set hook
2099
-					if (empty($content['info_startdate'])) $content['info_startdate'] = (int) $_GET['startdate'] ? (int) $_GET['startdate'] : $set_startdate;
2095
+					if (empty($content['info_startdate'])) $content['info_startdate'] = (int)$_GET['startdate'] ? (int)$_GET['startdate'] : $set_startdate;
2100 2096
 					if (empty($content['info_priority'])) $content['info_priority'] = 1; // normal
2101 2097
 					$content['info_owner'] = $this->user;
2102 2098
 					if ($type != '' && empty($content['info_type']))
@@ -2121,9 +2117,9 @@  discard block
 block discarded – undo
2121 2117
 		if ($this->bo->group_owners)
2122 2118
 		{
2123 2119
 			// remove types owned by groups the user has no edit grant (current type is made readonly)
2124
-			foreach($this->bo->group_owners as $type => $group)
2120
+			foreach ($this->bo->group_owners as $type => $group)
2125 2121
 			{
2126
-				if (!($this->bo->grants[$group] & Acl::EDIT))
2122
+				if (!($this->bo->grants[$group]&Acl::EDIT))
2127 2123
 				{
2128 2124
 					if ($type == $content['info_type'])
2129 2125
 					{
@@ -2141,7 +2137,7 @@  discard block
 block discarded – undo
2141 2137
 			{
2142 2138
 				$content['info_owner'] = $this->bo->group_owners[$content['info_type']];
2143 2139
 				// Dont allow to change the type, if user has no delete rights from the group-owner
2144
-				if ($info_id && !($this->bo->grants[$content['info_owner']] & Acl::DELETE))
2140
+				if ($info_id && !($this->bo->grants[$content['info_owner']]&Acl::DELETE))
2145 2141
 				{
2146 2142
 					//echo "<p>setting type to r/o as user has no delete rights from group #$group</p>\n";
2147 2143
 					$readonlys['info_type'] = true;
@@ -2149,7 +2145,7 @@  discard block
 block discarded – undo
2149 2145
 				// disable info_access for group-owners
2150 2146
 				$readonlys['info_access'] = true;
2151 2147
 			}
2152
-			elseif($GLOBALS['egw']->accounts->get_type($content['info_owner']) == 'g')
2148
+			elseif ($GLOBALS['egw']->accounts->get_type($content['info_owner']) == 'g')
2153 2149
 			{
2154 2150
 				$content['info_owner'] = $this->user;
2155 2151
 			}
@@ -2161,19 +2157,19 @@  discard block
 block discarded – undo
2161 2157
 		unset($preserv['links']); unset($preserv['link_to']);
2162 2158
 
2163 2159
 		// for no edit rights or implizit edit of responsible user make all fields readonly, but status and percent
2164
-		if ($info_id && !$this->bo->check_access($info_id,Acl::EDIT) && !$undelete)
2160
+		if ($info_id && !$this->bo->check_access($info_id, Acl::EDIT) && !$undelete)
2165 2161
 		{
2166
-			$readonlys['__ALL__'] = true;	// make all fields not explicitly set readonly
2162
+			$readonlys['__ALL__'] = true; // make all fields not explicitly set readonly
2167 2163
 			if ($this->bo->is_responsible($content))
2168 2164
 			{
2169
-				foreach($this->bo->responsible_edit as $name)
2165
+				foreach ($this->bo->responsible_edit as $name)
2170 2166
 				{
2171 2167
 					$readonlys[$name] = false;
2172 2168
 				}
2173 2169
 				$readonlys['timestamp'] = $readonlys['info_des'];
2174 2170
 				$readonlys['button[edit]'] = $readonlys['button[save]'] = $readonlys['button[apply]'] = $readonlys['no_notifications'] = false;
2175 2171
 			}
2176
-			$readonlys['action'] = $readonlys['button[cancel]'] = false;	// always allowed
2172
+			$readonlys['action'] = $readonlys['button[cancel]'] = false; // always allowed
2177 2173
 		}
2178 2174
 		elseif (!$info_id)
2179 2175
 		{
@@ -2186,16 +2182,16 @@  discard block
 block discarded – undo
2186 2182
 			$this->tmpl->setElementAttribute('button[save]', 'label', 'Un-Delete');
2187 2183
 		}
2188 2184
 
2189
-		if (!($readonlys['button[delete]'] = !$info_id || !$this->bo->check_access($info_id,Acl::DELETE)))
2185
+		if (!($readonlys['button[delete]'] = !$info_id || !$this->bo->check_access($info_id, Acl::DELETE)))
2190 2186
 		{
2191
-			$content['info_anz_subs'] = $this->bo->anzSubs($info_id);	// to determine js confirmation of delete or not
2187
+			$content['info_anz_subs'] = $this->bo->anzSubs($info_id); // to determine js confirmation of delete or not
2192 2188
 		}
2193 2189
 		$GLOBALS['egw_info']['flags']['app_header'] = lang($this->messages[$info_id ? 'edit' : ($action == 'sp' ? 'add_sub' : 'add')]);
2194 2190
 
2195 2191
 		// use a typ-specific template (infolog.edit.xyz), if one exists, otherwise fall back to the generic one
2196 2192
 		if (!$this->tmpl->read('infolog.edit.'.$content['info_type']))
2197 2193
 		{
2198
-			$this->tmpl->read($print ? 'infolog.edit.print':'infolog.edit');
2194
+			$this->tmpl->read($print ? 'infolog.edit.print' : 'infolog.edit');
2199 2195
 		}
2200 2196
 		if ($this->bo->has_customfields($content['info_type']))
2201 2197
 		{
@@ -2207,14 +2203,14 @@  discard block
 block discarded – undo
2207 2203
 		}
2208 2204
 		if (!isset($GLOBALS['egw_info']['user']['apps']['projectmanager']))
2209 2205
 		{
2210
-			$readonlys['tabs']['project'] = true;	// disable the project tab
2206
+			$readonlys['tabs']['project'] = true; // disable the project tab
2211 2207
 		}
2212 2208
 
2213 2209
 		$content['duration_format'] = $this->duration_format;
2214 2210
 		$content['hours_per_workday'] = $this->hours_per_workday;
2215 2211
 		if ($this->prefs['show_id']) $content['info_number'] = $info_id;
2216 2212
 
2217
-		$content['info_anz_subs'] = (int)$content['info_anz_subs'];	// gives javascript error if empty!
2213
+		$content['info_anz_subs'] = (int)$content['info_anz_subs']; // gives javascript error if empty!
2218 2214
 
2219 2215
 		$old_pm_id = is_array($pm_links) ? array_shift($pm_links) : $content['old_pm_id'];
2220 2216
 		if (!isset($content['pm_id']) && $old_pm_id) $content['pm_id'] = $old_pm_id;
@@ -2232,7 +2228,7 @@  discard block
 block discarded – undo
2232 2228
 					'Pr' => $this->bo->enums['priority'],
2233 2229
 					'Ow' => 'select-account',
2234 2230
 					//'Ac',	//	info_access: private||public
2235
-					'St' => $this->bo->status[$content['info_type']]+array('deleted' => 'deleted'),
2231
+					'St' => $this->bo->status[$content['info_type']] + array('deleted' => 'deleted'),
2236 2232
 					'Pe' => 'select-percent',
2237 2233
 					'Co' => 'date-time',
2238 2234
 					'st' => 'date-time',
@@ -2249,7 +2245,7 @@  discard block
 block discarded – undo
2249 2245
 			);
2250 2246
 			$history_stati = array();
2251 2247
 			$tracking = new infolog_tracking($this);
2252
-			foreach($tracking->field2history as $field => $history)
2248
+			foreach ($tracking->field2history as $field => $history)
2253 2249
 			{
2254 2250
 				$history_stati[$history] = $tracking->field2label[$field];
2255 2251
 			}
@@ -2290,15 +2286,15 @@  discard block
 block discarded – undo
2290 2286
 		//$content['info_des'] = substr($content['info_des'],0,1793);
2291 2287
 		//echo "<p>infolog_ui.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content);
2292 2288
 		//$content['info_cc'] is expected (by the widget) to be an array of emailaddresses, but is stored as comma separated string
2293
-		if (!empty($content['info_cc'])&&!is_array($content['info_cc']))$content['info_cc'] = explode(',',$content['info_cc']);
2294
-		$this->tmpl->exec('infolog.infolog_ui.edit',$content,$sel_options,$readonlys,$preserv+array(	// preserved values
2289
+		if (!empty($content['info_cc']) && !is_array($content['info_cc']))$content['info_cc'] = explode(',', $content['info_cc']);
2290
+		$this->tmpl->exec('infolog.infolog_ui.edit', $content, $sel_options, $readonlys, $preserv + array(	// preserved values
2295 2291
 			'info_id'       => $info_id,
2296 2292
 			'action'        => $action,
2297 2293
 			'action_id'     => $action_id,
2298 2294
 			'referer'       => $referer,
2299 2295
 			'no_popup'      => $no_popup,
2300 2296
 			'old_pm_id'     => $old_pm_id,
2301
-		),$no_popup ? 0 : 2);
2297
+		), $no_popup ? 0 : 2);
2302 2298
 	}
2303 2299
 
2304 2300
 	/**
@@ -2309,16 +2305,16 @@  discard block
 block discarded – undo
2309 2305
 	 * @param array &$content
2310 2306
 	 * @param boolean $create_sub true: create a sub-entry instead of a copy, default false to create a copy
2311 2307
 	 */
2312
-	private function create_copy(array &$content, $create_sub=false)
2308
+	private function create_copy(array &$content, $create_sub = false)
2313 2309
 	{
2314
-		$info_id = $content['info_id'];	// it will be unset by exclude-fields
2310
+		$info_id = $content['info_id']; // it will be unset by exclude-fields
2315 2311
 
2316 2312
 		// empty fields configured to be excluded (also contains id, uid, ...)
2317 2313
 		$exclude_fields = $create_sub ? $this->bo->sub_excludefields : $this->bo->copy_excludefields;
2318 2314
 		foreach ($exclude_fields as $field)
2319 2315
 		{
2320 2316
 			unset($content[$field]);
2321
-			if ($field == 'info_from') unset($content['info_link_id']);	// both together is called contact in UI
2317
+			if ($field == 'info_from') unset($content['info_link_id']); // both together is called contact in UI
2322 2318
 		}
2323 2319
 		if ($create_sub)
2324 2320
 		{
@@ -2327,9 +2323,9 @@  discard block
 block discarded – undo
2327 2323
 		// no startdate or startdate in the past --> set startdate from pref
2328 2324
 		if (!isset($content['info_startdate']) || $content['info_startdate'] < $this->bo->user_time_now)
2329 2325
 		{
2330
-			switch($this->prefs['set_start'])
2326
+			switch ($this->prefs['set_start'])
2331 2327
 			{
2332
-				case 'date': default: $set_startdate = mktime(0,0,0,date('m',$this->bo->user_time_now),date('d',$this->bo->user_time_now),date('Y',$this->bo->user_time_now)); break;
2328
+				case 'date': default: $set_startdate = mktime(0, 0, 0, date('m', $this->bo->user_time_now), date('d', $this->bo->user_time_now), date('Y', $this->bo->user_time_now)); break;
2333 2329
 				case 'datetime':      $set_startdate = $this->bo->user_time_now; break;
2334 2330
 				case 'empty':         $set_startdate = 0; break;
2335 2331
 			}
@@ -2348,17 +2344,17 @@  discard block
 block discarded – undo
2348 2344
 		// get a consistent status, percent and date-completed
2349 2345
 		if (!isset($content['info_status'])) $content['info_status'] = $this->bo->status['defaults'][$content['info_type']];
2350 2346
 		if (!isset($content['info_percent'])) $content['info_percent'] = $content['info_status'] == 'done' ? '100%' : '0%';
2351
-		$content['info_datecompleted'] =$content['info_status'] == 'done' ? $this->bo->user_time_now : 0;
2347
+		$content['info_datecompleted'] = $content['info_status'] == 'done' ? $this->bo->user_time_now : 0;
2352 2348
 
2353 2349
 		if (!isset($content['info_cat'])) $content['info_cat'] = $this->prefs['cat_add_default'];
2354 2350
 
2355
-		if(!is_array($content['link_to'])) $content['link_to'] = array();
2351
+		if (!is_array($content['link_to'])) $content['link_to'] = array();
2356 2352
 		$content['link_to']['to_app'] = 'infolog';
2357 2353
 		$content['link_to']['to_id'] = 0;
2358 2354
 		// Get links to be copied, if not excluded
2359
-		if (!in_array('link_to',$exclude_fields) || !in_array('attachments',$exclude_fields))
2355
+		if (!in_array('link_to', $exclude_fields) || !in_array('attachments', $exclude_fields))
2360 2356
 		{
2361
-			foreach(Link::get_links($content['link_to']['to_app'], $info_id) as $link)
2357
+			foreach (Link::get_links($content['link_to']['to_app'], $info_id) as $link)
2362 2358
 			{
2363 2359
 				if ($link['app'] != Link::VFS_APPNAME && !in_array('link_to', $exclude_fields))
2364 2360
 				{
@@ -2382,19 +2378,19 @@  discard block
 block discarded – undo
2382 2378
 			if (!isset($content['info_contact']) || empty($content['info_contact']) || $content['info_contact'] === 'copy:')
2383 2379
 			{
2384 2380
 				$linkinfos = Link::get_link($info_link_id);
2385
-				$content['info_contact'] = $linkinfos['link_app1']=='infolog'? $linkinfos['link_app2'].':'.$linkinfos['link_id2']:$linkinfos['link_app1'].':'.$linkinfos['link_id1'];
2386
-				if (stripos($content['info_contact'],'projectmanager')!==false) $content['pm_id'] = $linkinfos['link_app1']=='projectmanager'? $linkinfos['link_id1']:$linkinfos['link_id2'];
2381
+				$content['info_contact'] = $linkinfos['link_app1'] == 'infolog' ? $linkinfos['link_app2'].':'.$linkinfos['link_id2'] : $linkinfos['link_app1'].':'.$linkinfos['link_id1'];
2382
+				if (stripos($content['info_contact'], 'projectmanager') !== false) $content['pm_id'] = $linkinfos['link_app1'] == 'projectmanager' ? $linkinfos['link_id1'] : $linkinfos['link_id2'];
2387 2383
 			}
2388 2384
 			unset($content['info_link_id']);
2389 2385
 		}
2390
-		$content['info_owner'] = !(int)$this->owner || !$this->bo->check_perms(Acl::ADD,0,$this->owner) ? $this->user : $this->owner;
2386
+		$content['info_owner'] = !(int)$this->owner || !$this->bo->check_perms(Acl::ADD, 0, $this->owner) ? $this->user : $this->owner;
2391 2387
 
2392 2388
 		if (!empty($content['info_subject']))
2393 2389
 		{
2394 2390
 			if ($create_sub)
2395 2391
 			{
2396 2392
 				$config = Api\Config::read('infolog');
2397
-				$prefix = lang(empty($config['sub_prefix']) ? 'Re:': $config['sub_prefix']);
2393
+				$prefix = lang(empty($config['sub_prefix']) ? 'Re:' : $config['sub_prefix']);
2398 2394
 			}
2399 2395
 			else
2400 2396
 			{
@@ -2404,11 +2400,11 @@  discard block
 block discarded – undo
2404 2400
 		}
2405 2401
 		if (!$create_sub)
2406 2402
 		{
2407
-			$content['msg'] .= ($content['msg']?"\n":'').lang('%1 copied - the copy can now be edited', lang(Link::get_registry('infolog','entry')));
2403
+			$content['msg'] .= ($content['msg'] ? "\n" : '').lang('%1 copied - the copy can now be edited', lang(Link::get_registry('infolog', 'entry')));
2408 2404
 		}
2409 2405
 	}
2410 2406
 
2411
-	function icon($cat,$id,$status='')
2407
+	function icon($cat, $id, $status = '')
2412 2408
 	{
2413 2409
 		if (!$status || !($icon = $this->icons[$cat][$id.'_'.$status]))
2414 2410
 		{
@@ -2425,7 +2421,7 @@  discard block
 block discarded – undo
2425 2421
 				$alt = $id;
2426 2422
 			}
2427 2423
 		}
2428
-		return $icon ? Api\Html::image('infolog',$icon,lang($alt),'border=0') : lang($alt);
2424
+		return $icon ? Api\Html::image('infolog', $icon, lang($alt), 'border=0') : lang($alt);
2429 2425
 	}
2430 2426
 
2431 2427
 	/**
@@ -2475,27 +2471,27 @@  discard block
 block discarded – undo
2475 2471
 			'info_cc' => 'CC',
2476 2472
 		);
2477 2473
 		// add customfields to field list
2478
-		foreach(Api\Storage\Customfields::get('infolog') as $name => $data)
2474
+		foreach (Api\Storage\Customfields::get('infolog') as $name => $data)
2479 2475
 		{
2480 2476
 			$excludefields['#'.$name] = $data['label'];
2481 2477
 		}
2482 2478
 		$sub_excludefields = $excludefields;
2483
-		unset($sub_excludefields['info_id_parent']);	// always set to parent!
2479
+		unset($sub_excludefields['info_id_parent']); // always set to parent!
2484 2480
 
2485 2481
 		$config = Api\Config::read('infolog');
2486 2482
 
2487
-		if($content)
2483
+		if ($content)
2488 2484
 		{
2489 2485
 			// Save
2490 2486
 			$button = key($content['button']);
2491
-			if($button == 'save' || $button == 'apply')
2487
+			if ($button == 'save' || $button == 'apply')
2492 2488
 			{
2493
-				$this->bo->responsible_edit = array('info_status','info_percent','info_datecompleted');
2489
+				$this->bo->responsible_edit = array('info_status', 'info_percent', 'info_datecompleted');
2494 2490
 
2495 2491
 				if ($content['responsible_edit'])
2496 2492
 				{
2497
-					$extra = array_intersect($content['responsible_edit'],array_keys($fields));
2498
-					$this->bo->responsible_edit = array_unique(array_merge($this->bo->responsible_edit,$extra));
2493
+					$extra = array_intersect($content['responsible_edit'], array_keys($fields));
2494
+					$this->bo->responsible_edit = array_unique(array_merge($this->bo->responsible_edit, $extra));
2499 2495
 				}
2500 2496
 				Api\Config::save_value('copy_excludefields', $content['copy_excludefields'] ? $content['copy_excludefields'] : null, 'infolog');
2501 2497
 				Api\Config::save_value('sub_excludefields', $content['sub_excludefields'] ? $content['sub_excludefields'] : array('*NONE*'), 'infolog');
@@ -2506,12 +2502,12 @@  discard block
 block discarded – undo
2506 2502
 				Api\Config::save_value('sub_prefix', $content['sub_prefix'], 'infolog');
2507 2503
 
2508 2504
 				// Notifications
2509
-				$notifications =& $config[infolog_tracking::CUSTOM_NOTIFICATION];
2505
+				$notifications = & $config[infolog_tracking::CUSTOM_NOTIFICATION];
2510 2506
 				$notifications[$content['notification_type']] = $content['notification'];
2511
-				Api\Config::save_value(infolog_tracking::CUSTOM_NOTIFICATION, $notifications,'infolog');
2507
+				Api\Config::save_value(infolog_tracking::CUSTOM_NOTIFICATION, $notifications, 'infolog');
2512 2508
 			}
2513 2509
 
2514
-			if($button == 'save' || $button == 'cancel')
2510
+			if ($button == 'save' || $button == 'cancel')
2515 2511
 			{
2516 2512
 				Egw::redirect_link('/index.php', array(
2517 2513
 					'menuaction' => 'admin.admin_ui.index',
@@ -2534,7 +2530,7 @@  discard block
 block discarded – undo
2534 2530
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Site configuration');
2535 2531
 
2536 2532
 		// Load selected custom notification
2537
-		if(!$content['notification_type'])
2533
+		if (!$content['notification_type'])
2538 2534
 		{
2539 2535
 			$content['notification_type'] = '~global~';
2540 2536
 		}
@@ -2558,7 +2554,7 @@  discard block
 block discarded – undo
2558 2554
 		);
2559 2555
 		$preserve['notification_old_type'] = $content['notification_type'];
2560 2556
 		$this->tmpl->read('infolog.config');
2561
-		$this->tmpl->exec('infolog.infolog_ui.admin',$content,$sel_options,array(),$preserve);
2557
+		$this->tmpl->exec('infolog.infolog_ui.admin', $content, $sel_options, array(), $preserve);
2562 2558
 	}
2563 2559
 
2564 2560
 	/**
@@ -2567,13 +2563,13 @@  discard block
 block discarded – undo
2567 2563
 	 * @param array $mailContent = null content of mail
2568 2564
 	 * @return  array
2569 2565
 	 */
2570
-	function mail_import(array $mailContent=null)
2566
+	function mail_import(array $mailContent = null)
2571 2567
 	{
2572 2568
 		// It would get called from compose as a popup with egw_data
2573 2569
 		if (!is_array($mailContent) && ($_GET['egw_data']))
2574 2570
 		{
2575 2571
 			// get the mail raw data
2576
-			Link::get_data ($_GET['egw_data']);
2572
+			Link::get_data($_GET['egw_data']);
2577 2573
 			return false;
2578 2574
 		}
2579 2575
 
@@ -2604,7 +2600,7 @@  discard block
 block discarded – undo
2604 2600
 	function hook_view($args)
2605 2601
 	{
2606 2602
 		// Load JS for infolog actions
2607
-		Framework::includeJS('.','app','infolog');
2603
+		Framework::includeJS('.', 'app', 'infolog');
2608 2604
 
2609 2605
 		switch ($args['location'])
2610 2606
 		{
@@ -2632,7 +2628,7 @@  discard block
 block discarded – undo
2632 2628
 		{
2633 2629
 			return False;
2634 2630
 		}
2635
-		$this->called_by = $app;	// for read/save_sessiondata, to have different sessions for the hooks
2631
+		$this->called_by = $app; // for read/save_sessiondata, to have different sessions for the hooks
2636 2632
 
2637 2633
 		// Set to calling app, so actions wind up in the correct place client side
2638 2634
 		$GLOBALS['egw_info']['flags']['currentapp'] = $app;
@@ -2640,11 +2636,11 @@  discard block
 block discarded – undo
2640 2636
 		Api\Translation::add_app('infolog');
2641 2637
 
2642 2638
 		// Still want infolog Api\Categories though
2643
-		$GLOBALS['egw']->categories = new Api\Categories('','infolog');
2644
-		$this->index(null,$app,$args[$view_id],array(
2639
+		$GLOBALS['egw']->categories = new Api\Categories('', 'infolog');
2640
+		$this->index(null, $app, $args[$view_id], array(
2645 2641
 			'menuaction' => $view,
2646 2642
 			isset($view_id2) ? $view_id2 : $view_id => $args[$view_id]
2647
-		),True);
2643
+		), True);
2648 2644
 	}
2649 2645
 
2650 2646
 	/**
@@ -2653,26 +2649,26 @@  discard block
 block discarded – undo
2653 2649
 	 * @param string $type infolog type to include only the matching custom fields if set
2654 2650
 	 * @return array
2655 2651
 	 */
2656
-	function csv_export_fields($type=null)
2652
+	function csv_export_fields($type = null)
2657 2653
 	{
2658 2654
 		$fields = array(
2659 2655
 			'info_type'          => lang('Type'),
2660 2656
 			'info_from'          => lang('Contact'),
2661 2657
 			'info_addr'          => lang('Phone/Email'),
2662 2658
 //			'info_link_id'       => lang('primary link'),
2663
-			'info_cat'           => array('label' => lang('Category'),'type' => 'select-cat'),
2659
+			'info_cat'           => array('label' => lang('Category'), 'type' => 'select-cat'),
2664 2660
 			'info_priority'      => lang('Priority'),
2665
-			'info_owner'         => array('label' => lang('Owner'),'type' => 'select-account'),
2661
+			'info_owner'         => array('label' => lang('Owner'), 'type' => 'select-account'),
2666 2662
 			'info_access'        => lang('Access'),
2667 2663
 			'info_status'        => lang('Status'),
2668 2664
 			'info_percent'       => lang('Completed'),
2669 2665
 			'info_datecompleted' => lang('Date completed'),
2670 2666
 			'info_datemodified'  => lang('Last modified'),
2671
-			'info_modifier'      => array('label' => lang('Modifier'),'type' => 'select-account'),
2667
+			'info_modifier'      => array('label' => lang('Modifier'), 'type' => 'select-account'),
2672 2668
 			'info_location'      => lang('Location'),
2673 2669
 			'info_startdate'     => lang('Startdate'),
2674 2670
 			'info_enddate'       => lang('Enddate'),
2675
-			'info_responsible'   => array('label' => lang('Responsible'),'type' => 'select-account'),
2671
+			'info_responsible'   => array('label' => lang('Responsible'), 'type' => 'select-account'),
2676 2672
 			'info_subject'       => lang('Subject'),
2677 2673
 			'info_des'           => lang('Description'),
2678 2674
 			'info_id'            => lang('Id'),
@@ -2682,13 +2678,13 @@  discard block
 block discarded – undo
2682 2678
 			'pl_id'              => lang('pricelist'),
2683 2679
 			'info_price'         => lang('price'),
2684 2680
 		);
2685
-		foreach($this->bo->timestamps as $name)
2681
+		foreach ($this->bo->timestamps as $name)
2686 2682
 		{
2687
-			$fields[$name] = array('label' => $fields[$name],'type' => 'date-time');
2683
+			$fields[$name] = array('label' => $fields[$name], 'type' => 'date-time');
2688 2684
 		}
2689
-		foreach($this->bo->customfields as $name => $data)
2685
+		foreach ($this->bo->customfields as $name => $data)
2690 2686
 		{
2691
-			if ($data['type2'] && $type && !in_array($type,explode(',',$data['type2']))) continue;
2687
+			if ($data['type2'] && $type && !in_array($type, explode(',', $data['type2']))) continue;
2692 2688
 
2693 2689
 			$fields['#'.$name] = array(
2694 2690
 				'label' => $data['label'],
Please login to merge, or discard this patch.