Completed
Push — 16.1 ( a61395...f8fa80 )
by Nathan
17:04
created
timesheet/inc/class.timesheet_ui.inc.php 1 patch
Braces   +177 added lines, -45 removed lines patch added patch discarded remove patch
@@ -63,7 +63,10 @@  discard block
 block discarded – undo
63 63
 		$etpl = new Etemplate('timesheet.edit');
64 64
 		if (!is_array($content))
65 65
 		{
66
-			if ($_GET['msg']) $msg = strip_tags($_GET['msg']);
66
+			if ($_GET['msg'])
67
+			{
68
+				$msg = strip_tags($_GET['msg']);
69
+			}
67 70
 
68 71
 			if ($view || (int)$_GET['ts_id'])
69 72
 			{
@@ -130,23 +133,32 @@  discard block
 block discarded – undo
130 133
 				$content['ts_description'] = $content['ts_description_short'];
131 134
 			}
132 135
 			// we only need 2 out of 3 values from start-, end-time or duration (the date in ts_start is always required!)
133
-			if (isset($content['start_time']))		// start-time specified
136
+			if (isset($content['start_time']))
137
+			{
138
+				// start-time specified
134 139
 			{
135 140
 				//$content['ts_start'] += $content['start_time'];
136 141
 				$start = new Api\DateTime($content['ts_start']);
142
+			}
137 143
 				$start_time = explode(':',$content['start_time']);
138 144
 				$start->setTime($start_time[0],$start_time[1]);
139 145
 				$content['ts_start'] = $start->format('ts');
140 146
 			}
141
-			if (isset($content['end_time']))		// end-time specified
147
+			if (isset($content['end_time']))
148
+			{
149
+				// end-time specified
142 150
 			{
143 151
 				$end = new Api\DateTime($content['ts_start']);
152
+			}
144 153
 				$end_time = explode(':',$content['end_time']);
145 154
 				$end->setTime($end_time[0],$end_time[1]);
146 155
 			}
147
-			if ($end && $start)	// start- & end-time --> calculate the duration
156
+			if ($end && $start)
157
+			{
158
+				// start- & end-time --> calculate the duration
148 159
 			{
149 160
 				$content['ts_duration'] = ($end->format('ts') - $start->format('ts')) / 60;
161
+			}
150 162
 				// check if negative duration is caused by wrap over midnight
151 163
 				if ($content['ts_duration'] < 0 && $content['ts_duration'] > -24*60)
152 164
 				{
@@ -154,12 +166,18 @@  discard block
 block discarded – undo
154 166
 				}
155 167
 				//echo "<p>end_time=$content[end_time], start_time=$content[start_time] --> duration=$content[ts_duration]</p>\n";
156 168
 			}
157
-			elseif ($content['ts_duration'] && $end)	// no start, calculate from end and duration
169
+			elseif ($content['ts_duration'] && $end)
170
+			{
171
+				// no start, calculate from end and duration
158 172
 			{
159 173
 				$content['ts_start'] = $end->format('ts') - 60*$content['ts_duration'];
174
+			}
160 175
 				//echo "<p>end_time=$content[end_time], duration=$content[ts_duration] --> ts_start=$content[ts_start]=".Api\DateTime::to($content['ts_start'])."</p>\n";
161 176
 			}
162
-			if ($content['ts_duration'] > 0) unset($content['end_time']);
177
+			if ($content['ts_duration'] > 0)
178
+			{
179
+				unset($content['end_time']);
180
+			}
163 181
 			// now we only deal with start (date+time) and duration
164 182
 			list($button) = @each($content['button']);
165 183
 			$view = $content['view'];
@@ -173,7 +191,10 @@  discard block
 block discarded – undo
173 191
 			switch($button)
174 192
 			{
175 193
 				case 'edit':
176
-					if ($this->check_acl(Acl::EDIT) && !$only_admin_edit) $view = false;
194
+					if ($this->check_acl(Acl::EDIT) && !$only_admin_edit)
195
+					{
196
+						$view = false;
197
+					}
177 198
 					break;
178 199
 
179 200
 				case 'undelete':
@@ -187,12 +208,15 @@  discard block
 block discarded – undo
187 208
 				case 'save':
188 209
 				case 'save_new':
189 210
 				case 'apply':
190
-					if ((!$this->data['ts_quantity'] || $this->ts_viewtype == 'short') && $this->data['ts_duration'])	// set the quantity (in h) from the duration (in min)
211
+					if ((!$this->data['ts_quantity'] || $this->ts_viewtype == 'short') && $this->data['ts_duration'])
212
+					{
213
+						// set the quantity (in h) from the duration (in min)
191 214
 					{
192 215
 						// We need to keep the actual value of ts_quantity when we are storing it, as it is used in price calculation
193 216
 						// and rounding it causes miscalculation on prices
194 217
 						$this->data['ts_quantity'] = $this->data['ts_duration'] / 60.0;
195 218
 					}
219
+					}
196 220
 					if (!$this->data['ts_quantity'])
197 221
 					{
198 222
 						$etpl->set_validation_error('ts_quantity',lang('Field must not be empty !!!'));
@@ -226,7 +250,11 @@  discard block
 block discarded – undo
226 250
 							unset($content['ts_project_blur']);
227 251
 						}
228 252
 					}
229
-					if ($etpl->validation_errors()) break;	// the user need to fix the error, before we can save the entry
253
+					if ($etpl->validation_errors())
254
+					{
255
+						break;
256
+					}
257
+					// the user need to fix the error, before we can save the entry
230 258
 
231 259
 					// account for changed project --> remove old one from links and add new one
232 260
 					if ((int) $this->data['pm_id'] != (int) $this->data['old_pm_id'])
@@ -270,14 +298,20 @@  discard block
 block discarded – undo
270 298
 						}
271 299
 					}
272 300
 					Framework::refresh_opener($msg, 'timesheet', $this->data['ts_id'], $content['ts_id'] ? 'edit' : 'add');
273
-					if ($button == 'apply') break;
301
+					if ($button == 'apply')
302
+					{
303
+						break;
304
+					}
274 305
 					if ($button == 'save_new')
275 306
 					{
276 307
 						$msg .= ', '.lang('creating new entry');		// giving some feedback to the user
277 308
 
278
-						if (!is_array($content['link_to']['to_id']))	// set links again, so new entry gets the same links as the existing one
309
+						if (!is_array($content['link_to']['to_id']))
310
+						{
311
+							// set links again, so new entry gets the same links as the existing one
279 312
 						{
280 313
 							$content['link_to']['to_id'] = 0;
314
+						}
281 315
 							foreach(Link::get_links(TIMESHEET_APP,$this->data['ts_id'],'!'.Link::VFS_APPNAME) as $link)
282 316
 							{
283 317
 								Link::link(TIMESHEET_APP,$content['link_to']['to_id'],$link['app'],$link['id'],$link['remark']);
@@ -345,12 +379,15 @@  discard block
 block discarded – undo
345 379
 			foreach(is_array($_REQUEST['link_app']) ? $_REQUEST['link_app'] : array($_REQUEST['link_app']) as $n => $link_app)
346 380
 			{
347 381
 				$link_id = $link_ids[$n];
348
-				if (preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id))	// gard against XSS
382
+				if (preg_match('/^[a-z_0-9-]+:[:a-z_0-9-]+$/i',$link_app.':'.$link_id))
383
+				{
384
+					// gard against XSS
349 385
 				{
350 386
 					switch ($link_app)
351 387
 					{
352 388
 						case 'projectmanager':
353 389
 							$links[] = $link_id;
390
+				}
354 391
 							// fall-through;
355 392
 						default:
356 393
 							if(!$n)
@@ -362,8 +399,14 @@  discard block
 block discarded – undo
362 399
 								{
363 400
 									foreach((array)$set['link_app'] as $i => $l_app)
364 401
 									{
365
-										if (($l_id=$set['link_id'][$i])) Link::link(TIMESHEET_APP,$content['link_to']['to_id'],$l_app,$l_id);
366
-										if ($l_app == 'projectmanager') $links[] = $l_id;
402
+										if (($l_id=$set['link_id'][$i]))
403
+										{
404
+											Link::link(TIMESHEET_APP,$content['link_to']['to_id'],$l_app,$l_id);
405
+										}
406
+										if ($l_app == 'projectmanager')
407
+										{
408
+											$links[] = $l_id;
409
+										}
367 410
 									}
368 411
 									unset($set['link_app']);
369 412
 									unset($set['link_id']);
@@ -464,8 +507,16 @@  discard block
 block discarded – undo
464 507
 				$etpl->setElementAttribute('pm_id','blur',$content['ts_project']);
465 508
 			}
466 509
 		}
467
-		if (!$this->customfields) $readonlys['tabs']['customfields'] = true;	// suppress tab if there are not customfields
468
-		if (!$this->data['ts_id']) $readonlys['tabs']['history']    = true;   //suppress history for the first loading without ID
510
+		if (!$this->customfields)
511
+		{
512
+			$readonlys['tabs']['customfields'] = true;
513
+		}
514
+		// suppress tab if there are not customfields
515
+		if (!$this->data['ts_id'])
516
+		{
517
+			$readonlys['tabs']['history']    = true;
518
+		}
519
+		//suppress history for the first loading without ID
469 520
 
470 521
 		return $etpl->exec(TIMESHEET_APP.'.timesheet_ui.edit',$content,$sel_options,$readonlys,$preserv,2);
471 522
 	}
@@ -478,7 +529,10 @@  discard block
 block discarded – undo
478 529
 	 */
479 530
 	function datetime2time($datetime)
480 531
 	{
481
-		if (!$datetime) return 0;
532
+		if (!$datetime)
533
+		{
534
+			return 0;
535
+		}
482 536
 
483 537
 		return $datetime - mktime(0,0,0,date('m',$datetime),date('d',$datetime),date('Y',$datetime));
484 538
 	}
@@ -524,7 +578,10 @@  discard block
 block discarded – undo
524 578
 			}
525 579
 			// show week-sums, if we are week-aligned (show full weeks)?
526 580
 			$week_start_day = $GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts'];
527
-			if (!$week_start_day) $week_start_day = 'Sunday';
581
+			if (!$week_start_day)
582
+			{
583
+				$week_start_day = 'Sunday';
584
+			}
528 585
 			switch($week_start_day)
529 586
 			{
530 587
 				case 'Sunday': $week_end_day = 'Saturday'; break;
@@ -545,7 +602,10 @@  discard block
 block discarded – undo
545 602
 			}
546 603
 		}
547 604
 		//echo "<p align=right>show_sums=".print_r($this->show_sums,true)."</p>\n";
548
-		if (!$id_only && !$query_in['csv_export']) Api\Cache::setSession(TIMESHEET_APP, 'index', $query_in);
605
+		if (!$id_only && !$query_in['csv_export'])
606
+		{
607
+			Api\Cache::setSession(TIMESHEET_APP, 'index', $query_in);
608
+		}
549 609
 
550 610
 		// Refresh actions (undelete needs this)
551 611
 		$query_in['actions'] = $this->get_actions($query_in);
@@ -553,8 +613,14 @@  discard block
 block discarded – undo
553 613
 		$query = $query_in;	// keep the original query
554 614
 		$query['enddate'] = $end_date;
555 615
 
556
-		if($this->ts_viewtype == 'short') $query_in['options-selectcols'] = array('ts_quantity'=>false,'ts_unitprice'=>false,'ts_total'=>false);
557
-		if ($query['no_status']) $query_in['options-selectcols']['ts_status'] = false;
616
+		if($this->ts_viewtype == 'short')
617
+		{
618
+			$query_in['options-selectcols'] = array('ts_quantity'=>false,'ts_unitprice'=>false,'ts_total'=>false);
619
+		}
620
+		if ($query['no_status'])
621
+		{
622
+			$query_in['options-selectcols']['ts_status'] = false;
623
+		}
558 624
 
559 625
 		//_debug_array($query['col_filter']);
560 626
 		//echo "PM Integration:".$this->pm_integration.'<br>';
@@ -567,8 +633,14 @@  discard block
 block discarded – undo
567 633
 		{
568 634
 			//$query['col_filter']['ts_id'] = Link::get_links('projectmanager',$query['col_filter']['pm_id'],'timesheet');
569 635
 			$query['col_filter']['ts_id'] = $this->get_ts_links($query['col_filter']['pm_id']);
570
-			if (empty($query['col_filter']['ts_id'])) $query['col_filter']['ts_id'] = -1;
571
-			if (!$query['col_filter']['ts_id']) $query['col_filter']['ts_id'] = 0;
636
+			if (empty($query['col_filter']['ts_id']))
637
+			{
638
+				$query['col_filter']['ts_id'] = -1;
639
+			}
640
+			if (!$query['col_filter']['ts_id'])
641
+			{
642
+				$query['col_filter']['ts_id'] = 0;
643
+			}
572 644
 		}
573 645
 		if ((string)$query['col_filter']['pm_id'] != '' && (string)$query['col_filter']['pm_id'] == '0')
574 646
 		{
@@ -640,10 +712,13 @@  discard block
 block discarded – undo
640 712
 			$cats = $GLOBALS['egw']->categories->return_all_children((int)$query['cat_id']);
641 713
 			$query['col_filter']['cat_id'] = count($cats) > 1 ? $cats : $query['cat_id'];
642 714
 		}
643
-		elseif ((string)$query['cat_id'] == '0')	// no category
715
+		elseif ((string)$query['cat_id'] == '0')
716
+		{
717
+			// no category
644 718
 		{
645 719
 			$query['col_filter']['cat_id'] = null;
646 720
 		}
721
+		}
647 722
 		else	// all cats --> no filter
648 723
 		{
649 724
 			unset($query['col_filter']['cat_id']);
@@ -654,7 +729,10 @@  discard block
 block discarded – undo
654 729
 			$GLOBALS['egw_info']['flags']['app_header'] .= ': '.Api\Accounts::username($query['col_filter']['ts_owner']);
655 730
 			#if ($GLOBALS['egw']->accounts->get_type($query['col_filter']['ts_owner']) == 'g') $GLOBALS['egw_info']['flags']['app_header'] .= ' '. lang("and its members");
656 731
 			#_debug_array($GLOBALS['egw']->accounts->members($query['col_filter']['ts_owner'],true));
657
-			if ($query['col_filter']['ts_owner']<0) $query['col_filter']['ts_owner'] = array_merge(array($query['col_filter']['ts_owner']),$GLOBALS['egw']->accounts->members($query['col_filter']['ts_owner'],true));
732
+			if ($query['col_filter']['ts_owner']<0)
733
+			{
734
+				$query['col_filter']['ts_owner'] = array_merge(array($query['col_filter']['ts_owner']),$GLOBALS['egw']->accounts->members($query['col_filter']['ts_owner'],true));
735
+			}
658 736
 		}
659 737
 		else
660 738
 		{
@@ -667,10 +745,13 @@  discard block
 block discarded – undo
667 745
 			// generate a meaningful app-header / report title
668 746
 			if ($this->show_sums['month'])
669 747
 			{
670
-				if ((int)$start[1] == 1 && (int) $end[1] == 12)		// whole year(s)
748
+				if ((int)$start[1] == 1 && (int) $end[1] == 12)
749
+				{
750
+					// whole year(s)
671 751
 				{
672 752
 					$GLOBALS['egw_info']['flags']['app_header'] .= ': ' . $start[0] . ($start[0] != $end[0] ? ' - '.$end[0] : '');
673 753
 				}
754
+				}
674 755
 				else
675 756
 				{
676 757
 					$GLOBALS['egw_info']['flags']['app_header'] .= ': ' . lang(date('F',$query['startdate']+12*60*60)) . ' ' . $start[0];
@@ -712,7 +793,10 @@  discard block
 block discarded – undo
712 793
 		$ids = array();
713 794
 		foreach($rows as &$row)
714 795
 		{
715
-			if ($row['ts_id'] > 0) $ids[] = $row['ts_id'];
796
+			if ($row['ts_id'] > 0)
797
+			{
798
+				$ids[] = $row['ts_id'];
799
+			}
716 800
 		}
717 801
 		if ($id_only)
718 802
 		{
@@ -742,12 +826,19 @@  discard block
 block discarded – undo
742 826
 		$have_cats = false;
743 827
 		foreach($rows as &$row)
744 828
 		{
745
-			if ($row['cat_id']) $have_cats = true;
829
+			if ($row['cat_id'])
830
+			{
831
+				$have_cats = true;
832
+			}
746 833
 
747 834
 			$row['class'] = 'row';
748
-			if ($row['ts_id'] <= 0)	// sums
835
+			if ($row['ts_id'] <= 0)
749 836
 			{
750
-				if ($query['sort'] == 'ASC') $row['ts_start'] -= 7200;	// fix for DSL change
837
+				// sums
838
+			{
839
+				if ($query['sort'] == 'ASC') $row['ts_start'] -= 7200;
840
+			}
841
+			// fix for DSL change
751 842
 
752 843
 				// Remove fake modified date, it breaks nextmatch checks
753 844
 				unset($row['ts_modified']);
@@ -775,7 +866,10 @@  discard block
 block discarded – undo
775 866
 						break;
776 867
 				}
777 868
 				$row['ts_start'] = $row['ts_unitprice'] = '';
778
-				if (!$this->quantity_sum) $row['ts_quantity'] = '';
869
+				if (!$this->quantity_sum)
870
+				{
871
+					$row['ts_quantity'] = '';
872
+				}
779 873
 				$row['class'] = 'th rowNoEdit rowNoDelete rowNoUndelete';
780 874
 				$row['titleClass'] = 'timesheet_titleSum';
781 875
 				continue;
@@ -817,11 +911,17 @@  discard block
 block discarded – undo
817 911
 				}
818 912
 			}
819 913
 
820
-			if(!$row['titleClass']) $row['titleClass'] = 'timesheet_titleDetails';
914
+			if(!$row['titleClass'])
915
+			{
916
+				$row['titleClass'] = 'timesheet_titleDetails';
917
+			}
821 918
 
822 919
 		}
823 920
 		$rows['no_cat_id'] = (!$have_cats || $query['cat_id']);
824
-		if ($query['col_filter']['ts_owner']) $rows['ownerClass'] = 'noPrint';
921
+		if ($query['col_filter']['ts_owner'])
922
+		{
923
+			$rows['ownerClass'] = 'noPrint';
924
+		}
825 925
 		$rows['no_owner_col'] = $query['no_owner_col'];
826 926
 		if(is_string($query['selectcols']))
827 927
 		{
@@ -839,13 +939,23 @@  discard block
 block discarded – undo
839 939
 		if (!$rows['ts_viewtype'])
840 940
 		{
841 941
 			#_debug_array($query['selectcols']);
842
-			if(!is_array($query['selectcols'])){
942
+			if(!is_array($query['selectcols']))
943
+			{
843 944
 				$query['selectcols'] = explode(',',$query['selectcols']);
844 945
 			}
845 946
 			#ts_quantity,ts_unitprice,ts_total
846
-			if ($query['selectcols'] && in_array('ts_quantity_quantity',$query['selectcols'])===false) $rows['no_ts_quantity'] = 1;
847
-			if ($query['selectcols'] && in_array('ts_unitprice', $query['selectcols'])===false) $rows['no_ts_unitprice'] = 1;
848
-			if ($query['selectcols'] && in_array('ts_total_price',$query['selectcols'])===false) $rows['no_ts_total'] = 1;
947
+			if ($query['selectcols'] && in_array('ts_quantity_quantity',$query['selectcols'])===false)
948
+			{
949
+				$rows['no_ts_quantity'] = 1;
950
+			}
951
+			if ($query['selectcols'] && in_array('ts_unitprice', $query['selectcols'])===false)
952
+			{
953
+				$rows['no_ts_unitprice'] = 1;
954
+			}
955
+			if ($query['selectcols'] && in_array('ts_total_price',$query['selectcols'])===false)
956
+			{
957
+				$rows['no_ts_total'] = 1;
958
+			}
849 959
 		}
850 960
 		$rows['no_ts_status'] = in_array('ts_status', $query['selectcols']) === false && !$this->config_data['history'] ||
851 961
 			$query['no_status'];
@@ -868,7 +978,10 @@  discard block
 block discarded – undo
868 978
 	{
869 979
 		$etpl = new Etemplate('timesheet.index');
870 980
 
871
-		if ($_GET['msg']) $msg = $_GET['msg'];
981
+		if ($_GET['msg'])
982
+		{
983
+			$msg = $_GET['msg'];
984
+		}
872 985
 		if ($content['nm']['rows']['delete'])
873 986
 		{
874 987
 			list($ts_id) = each($content['nm']['rows']['delete']);
@@ -881,9 +994,12 @@  discard block
 block discarded – undo
881 994
 				$msg = lang('Error deleting the entry!!!');
882 995
 			}
883 996
 		}
884
-		if (is_array($content) && isset($content['nm']['rows']['document']))  // handle insert in default document button like an action
997
+		if (is_array($content) && isset($content['nm']['rows']['document']))
998
+		{
999
+			// handle insert in default document button like an action
885 1000
 		{
886 1001
 			list($id) = @each($content['nm']['rows']['document']);
1002
+		}
887 1003
 			$content['nm']['action'] = 'document';
888 1004
 			$content['nm']['selected'] = array($id);
889 1005
 		}
@@ -957,7 +1073,10 @@  discard block
 block discarded – undo
957 1073
 		}
958 1074
 		$read_grants = $this->grant_list(Acl::READ);
959 1075
 		$content['nm']['no_owner_col'] = count($read_grants) == 1;
960
-		if ($GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows']) $content['nm']['selectcols'] = $GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows'];
1076
+		if ($GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows'])
1077
+		{
1078
+			$content['nm']['selectcols'] = $GLOBALS['egw_info']['user']['preferences']['timesheet']['nextmatch-timesheet.index.rows'];
1079
+		}
961 1080
 		$sel_options = array(
962 1081
 			'ts_owner'   => $read_grants,
963 1082
 			'pm_id'      => array(lang('No project')),
@@ -974,7 +1093,10 @@  discard block
 block discarded – undo
974 1093
 		if ($this->pm_integration != 'full')
975 1094
 		{
976 1095
 			$projects =& $this->query_list('ts_project');
977
-			if (!is_array($projects)) $projects = array();
1096
+			if (!is_array($projects))
1097
+			{
1098
+				$projects = array();
1099
+			}
978 1100
 			$sel_options['ts_project'] = $projects + array(lang('No project'));
979 1101
 		}
980 1102
 
@@ -1192,7 +1314,8 @@  discard block
 block discarded – undo
1192 1314
 			case 'cat':
1193 1315
 				$cat_name = Api\Categories::id2name($settings);
1194 1316
 				$action_msg = lang('changed category to %1', $cat_name);
1195
-				foreach((array)$checked as $n => $id) {
1317
+				foreach((array)$checked as $n => $id)
1318
+				{
1196 1319
 					if (($entry = $this->read($id)) &&
1197 1320
 						($entry['cat_id'] = $settings) &&
1198 1321
 						$this->save($entry) == 0)
@@ -1207,7 +1330,10 @@  discard block
 block discarded – undo
1207 1330
 				break;
1208 1331
 
1209 1332
 			case 'document':
1210
-				if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['timesheet']['default_document'];
1333
+				if (!$settings)
1334
+				{
1335
+					$settings = $GLOBALS['egw_info']['user']['preferences']['timesheet']['default_document'];
1336
+				}
1211 1337
 				$document_merge = new timesheet_merge();
1212 1338
 				$msg = $document_merge->download($settings, $checked, '', $GLOBALS['egw_info']['user']['preferences']['timesheet']['document_dir']);
1213 1339
 				$failed = count($checked);
@@ -1259,7 +1385,10 @@  discard block
 block discarded – undo
1259 1385
 						$this->load_statuses();
1260 1386
 						$msg .= lang('Status updated.');
1261 1387
 					}
1262
-					if ($button == 'apply') break;
1388
+					if ($button == 'apply')
1389
+					{
1390
+						break;
1391
+					}
1263 1392
 					// fall-through
1264 1393
 				case 'cancel':
1265 1394
 					$GLOBALS['egw']->redirect_link('/admin/index.php', null, 'admin');
@@ -1337,7 +1466,10 @@  discard block
 block discarded – undo
1337 1466
 		$this->data['ts_owner'] = !(int)$this->data['ts_owner'] || !$this->check_acl(Acl::ADD,NULL,$this->data['ts_owner']) ? $this->user : $this->data['ts_owner'];
1338 1467
 
1339 1468
 		// Copy links
1340
-		if(!is_array($this->data['link_to'])) $this->data['link_to'] = array();
1469
+		if(!is_array($this->data['link_to']))
1470
+		{
1471
+			$this->data['link_to'] = array();
1472
+		}
1341 1473
 		$this->data['link_to']['to_app'] = 'timesheet';
1342 1474
 		$this->data['link_to']['to_id'] = 0;
1343 1475
 
Please login to merge, or discard this patch.