Passed
Push — scrutinizer-code-quality ( 09f5a1...c4c5fb )
by Adam
56:05 queued 14:08
created
include/generic/SugarWidgets/SugarWidgetFielddatetimecombo.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 class SugarWidgetFieldDateTimecombo extends SugarWidgetFieldDateTime {
45 45
 	var $reporter;
46
-	var $assigned_user=null;
46
+	var $assigned_user = null;
47 47
 
48 48
     function __construct(&$layout_manager) {
49 49
         parent::__construct($layout_manager);
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
     /**
54 54
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
55 55
      */
56
-    function SugarWidgetFieldDateTimecombo(&$layout_manager){
56
+    function SugarWidgetFieldDateTimecombo(&$layout_manager) {
57 57
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
58
-        if(isset($GLOBALS['log'])) {
58
+        if (isset($GLOBALS['log'])) {
59 59
             $GLOBALS['log']->deprecated($deprecatedMessage);
60 60
         }
61 61
         else {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	//If there is requirement, we can modify report.js::addFilterInputDatetimesBetween and this function
69 69
 	function queryFilterBetween_Datetimes(& $layout_def) {
70 70
 		global $timedate;
71
-		if($this->getAssignedUser()) {
71
+		if ($this->getAssignedUser()) {
72 72
 			$begin = $timedate->handle_offset($layout_def['input_name0'], $timedate->get_db_date_time_format(), false, $this->assigned_user);
73 73
 			$end = $timedate->handle_offset($layout_def['input_name2'], $timedate->get_db_date_time_format(), false, $this->assigned_user);
74 74
 		}
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -57,8 +59,7 @@  discard block
 block discarded – undo
57 59
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
58 60
         if(isset($GLOBALS['log'])) {
59 61
             $GLOBALS['log']->deprecated($deprecatedMessage);
60
-        }
61
-        else {
62
+        } else {
62 63
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
63 64
         }
64 65
         self::__construct($layout_manager);
@@ -71,8 +72,7 @@  discard block
 block discarded – undo
71 72
 		if($this->getAssignedUser()) {
72 73
 			$begin = $timedate->handle_offset($layout_def['input_name0'], $timedate->get_db_date_time_format(), false, $this->assigned_user);
73 74
 			$end = $timedate->handle_offset($layout_def['input_name2'], $timedate->get_db_date_time_format(), false, $this->assigned_user);
74
-		}
75
-		else {
75
+		} else {
76 76
 			$begin = $layout_def['input_name0'];
77 77
 			$end = $layout_def['input_name1'];
78 78
 		}
Please login to merge, or discard this patch.
include/generic/SugarWidgets/SugarWidgetFielddatetime.php 3 patches
Indentation   +282 added lines, -282 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 
44 44
 class SugarWidgetFieldDateTime extends SugarWidgetReportField
45 45
 {
46
-	var $reporter;
47
-	var $assigned_user=null;
46
+    var $reporter;
47
+    var $assigned_user=null;
48 48
 
49 49
     function __construct($layout_manager)
50 50
     {
@@ -66,31 +66,31 @@  discard block
 block discarded – undo
66 66
     }
67 67
 
68 68
 
69
-	// get the reporter attribute
69
+    // get the reporter attribute
70 70
     // deprecated, now called in the constructor
71 71
     /**
72 72
      * @deprecated
73 73
      */
74
-	function getReporter() {
75
-	}
74
+    function getReporter() {
75
+    }
76 76
 
77
-	// get the assigned user of the report
78
-	function getAssignedUser()
79
-	{
80
-		$json_obj = getJSONobj();
77
+    // get the assigned user of the report
78
+    function getAssignedUser()
79
+    {
80
+        $json_obj = getJSONobj();
81 81
 
82
-		$report_def_str = $json_obj->decode($this->reporter->report_def_str);
82
+        $report_def_str = $json_obj->decode($this->reporter->report_def_str);
83 83
 
84
-		if(empty($report_def_str['assigned_user_id'])) return null;
84
+        if(empty($report_def_str['assigned_user_id'])) return null;
85 85
 
86
-		$this->assigned_user = new User();
87
-		$this->assigned_user->retrieve($report_def_str['assigned_user_id']);
88
-		return $this->assigned_user;
89
-	}
86
+        $this->assigned_user = new User();
87
+        $this->assigned_user->retrieve($report_def_str['assigned_user_id']);
88
+        return $this->assigned_user;
89
+    }
90 90
 
91
-	function queryFilterOn($layout_def)
92
-	{
93
-		global $timedate;
91
+    function queryFilterOn($layout_def)
92
+    {
93
+        global $timedate;
94 94
         $begin = $layout_def['input_name0'];
95 95
         $hasTime = $this->hasTime($begin);
96 96
         $date = $timedate->fromString($begin);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             '=',
109 109
             "datetime"
110 110
         );
111
-	}
111
+    }
112 112
 
113 113
     /**
114 114
      * expandDate
@@ -123,61 +123,61 @@  discard block
 block discarded – undo
123 123
      * @param bool $end Boolean value indicating whether or not this is for an end time period or not
124 124
      * @return $date TimeDate object with time value applied
125 125
      */
126
-	protected function expandDate($date, $end = false)
127
-	{
128
-	    global $timedate;
129
-	    if($this->hasTime($date)) {
130
-	        return $date;
131
-	    }
126
+    protected function expandDate($date, $end = false)
127
+    {
128
+        global $timedate;
129
+        if($this->hasTime($date)) {
130
+            return $date;
131
+        }
132 132
 
133 133
         //C.L. Bug 48616 - If the $date is set to the Today macro, then adjust accordingly
134 134
         if(strtolower($date) == 'today')
135 135
         {
136
-           $startEnd = $timedate->getDayStartEndGMT($timedate->getNow(true));
137
-           return $end ? $startEnd['end'] : $startEnd['start'];
136
+            $startEnd = $timedate->getDayStartEndGMT($timedate->getNow(true));
137
+            return $end ? $startEnd['end'] : $startEnd['start'];
138 138
         }
139 139
 
140 140
         $parsed = $timedate->fromDbDate($date);
141 141
         $date = $timedate->tzUser(new SugarDateTime());
142 142
         $date->setDate($parsed->year, $parsed->month, $parsed->day);
143 143
 
144
-	    if($end) {
145
-	        return $date->setTime(23, 59, 59);
146
-	    } else {
147
-	        return $date->setTime(0, 0, 0);
148
-	    }
149
-	}
144
+        if($end) {
145
+            return $date->setTime(23, 59, 59);
146
+        } else {
147
+            return $date->setTime(0, 0, 0);
148
+        }
149
+    }
150 150
 
151
-	function queryFilterBefore($layout_def)
152
-	{
151
+    function queryFilterBefore($layout_def)
152
+    {
153 153
         $begin = $this->expandDate($layout_def['input_name0']);
154 154
         return $this->queryDateOp($this->_get_column_select($layout_def), $begin, '<', "datetime");
155
-	}
155
+    }
156 156
 
157
-	function queryFilterAfter($layout_def)
158
-	{
157
+    function queryFilterAfter($layout_def)
158
+    {
159 159
         $begin = $this->expandDate($layout_def['input_name0'], true);
160 160
         return $this->queryDateOp($this->_get_column_select($layout_def), $begin, '>', "datetime");
161
-	}
161
+    }
162 162
 
163
-	function queryFilterBetween_Dates($layout_def)
164
-	{
163
+    function queryFilterBetween_Dates($layout_def)
164
+    {
165 165
         $begin = $this->expandDate($layout_def['input_name0']);
166
-     	$end = $this->expandDate($layout_def['input_name1'], true);
166
+            $end = $this->expandDate($layout_def['input_name1'], true);
167 167
         $column = $this->_get_column_select($layout_def);
168
-	    return "(".$this->queryDateOp($column, $begin, ">=", "datetime")." AND ".
168
+        return "(".$this->queryDateOp($column, $begin, ">=", "datetime")." AND ".
169 169
             $this->queryDateOp($column, $end, "<=", "datetime").")\n";
170
-	}
170
+    }
171 171
 
172
-	function queryFilterNot_Equals_str($layout_def)
173
-	{
174
-		global $timedate;
172
+    function queryFilterNot_Equals_str($layout_def)
173
+    {
174
+        global $timedate;
175 175
 
176 176
         $column = $this->_get_column_select($layout_def);
177 177
         $begin = $layout_def['input_name0'];
178 178
         $hasTime = $this->hasTime($begin);
179 179
         if(!$hasTime){
180
-     	    $end = $this->expandDate($begin, true);
180
+                $end = $this->expandDate($begin, true);
181 181
             $begin = $this->expandDate($begin);
182 182
             $cond = $this->queryDateOp($column, $begin, "<", "datetime")." OR ".
183 183
                 $this->queryDateOp($column, $end, ">", "datetime");
@@ -185,45 +185,45 @@  discard block
 block discarded – undo
185 185
             $cond =  $this->queryDateOp($column, $begin, "!=", "datetime");
186 186
         }
187 187
         return "($column IS NULL OR $cond)";
188
-	}
188
+    }
189 189
 
190 190
     /**
191 191
      * Get assigned or logged in user's current date and time value.
192 192
      * @param boolean $timestamp Format of return value, if set to true, return unix like timestamp , else a formatted date.
193 193
      */
194
-	function get_users_current_date_time($timestamp=false)
195
-	{
196
-	 	global $current_user;
194
+    function get_users_current_date_time($timestamp=false)
195
+    {
196
+            global $current_user;
197 197
         global $timedate;
198 198
 
199 199
         $begin = TimeDate::getInstance()->nowDb();
200 200
         //kbrill bug #13884
201
-       	//$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user);
202
-		$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
201
+            //$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user);
202
+        $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
203 203
 
204 204
         if (!$timestamp) {
205
-        	return $begin;
205
+            return $begin;
206 206
         } else {
207
-        	$begin_parts = explode(' ', $begin);
208
-        	$date_parts=explode('-', $begin_parts[0]);
209
-        	$time_parts=explode(':', $begin_parts[1]);
210
-        	$curr_timestamp=mktime($time_parts[0],$time_parts[1],0,$date_parts[1], $date_parts[2],$date_parts[0]);
211
-        	return $curr_timestamp;
212
-        }
213
-
214
-	}
215
-	/**
216
-	 * Get specified date and time for a particalur day, in current user's timezone.
217
-	 * @param int $days Adjust date by this number of days, negative values are valid.
218
-	 * @param time string falg for desired time value, start: minimum time, end: maximum time, default: current time
219
-	 */
220
-	function get_db_date($days,$time) {
207
+            $begin_parts = explode(' ', $begin);
208
+            $date_parts=explode('-', $begin_parts[0]);
209
+            $time_parts=explode(':', $begin_parts[1]);
210
+            $curr_timestamp=mktime($time_parts[0],$time_parts[1],0,$date_parts[1], $date_parts[2],$date_parts[0]);
211
+            return $curr_timestamp;
212
+        }
213
+
214
+    }
215
+    /**
216
+     * Get specified date and time for a particalur day, in current user's timezone.
217
+     * @param int $days Adjust date by this number of days, negative values are valid.
218
+     * @param time string falg for desired time value, start: minimum time, end: maximum time, default: current time
219
+     */
220
+    function get_db_date($days,$time) {
221 221
         global $timedate;
222 222
 
223 223
         $begin = date($GLOBALS['timedate']->get_db_date_time_format(), time()+(86400 * $days));  //gmt date with day adjustment applied.
224 224
         //kbrill bug #13884
225 225
         //$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user);
226
-		$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
226
+        $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
227 227
 
228 228
         if ($time=='start') {
229 229
             $begin_parts = explode(' ', $begin);
@@ -240,38 +240,38 @@  discard block
 block discarded – undo
240 240
         $begin = $timedate->handle_offset($be, $timedate->get_db_date_time_format(), false, $this->assigned_user);
241 241
 
242 242
         return $begin;
243
-	}
244
-
245
-	/**
246
-	 * Get filter string for a date field.
247
-	 * @param array layout_def field def for field being filtered
248
-	 * @param string $begin start date value (in DB format)
249
-	 * @param string $end End date value (in DB format)
250
-	 */
251
-	function get_start_end_date_filter(& $layout_def, $begin,$end)
252
-	{
253
-	    if (isset ($layout_def['rel_field'])) {
254
-	        $field_name = $this->reporter->db->convert(
255
-	            $this->reporter->db->convert($this->_get_column_select($layout_def), 'date_format', '%Y-%m-%d'),
256
-	            "CONCAT",
257
-	            array("' '", $this->reporter->db->convert($layout_def['rel_field'], 'time_format'))
258
-	        );
259
-	    } else {
260
-	       $field_name = $this->_get_column_select($layout_def);
261
-	    }
262
-	    return $field_name.">=".$this->reporter->db->quoted($begin)." AND ".$field_name."<=".$this->reporter->db->quoted($end)."\n";
263
-	}
264
-
265
-	/**
266
-	 * Create query for binary operation of field of certain type
267
-	 * Produces query like:
268
-	 * arg1 op to_date(arg2), e.g.:
269
-	 * 		date_closed < '2009-12-01'
270
-	 * @param string $arg1 1st arg - column name
271
-	 * @param string|DateTime $arg2 2nd arg - value to be converted
272
-	 * @param string $op
273
-	 * @param string $type
274
-	 */
243
+    }
244
+
245
+    /**
246
+     * Get filter string for a date field.
247
+     * @param array layout_def field def for field being filtered
248
+     * @param string $begin start date value (in DB format)
249
+     * @param string $end End date value (in DB format)
250
+     */
251
+    function get_start_end_date_filter(& $layout_def, $begin,$end)
252
+    {
253
+        if (isset ($layout_def['rel_field'])) {
254
+            $field_name = $this->reporter->db->convert(
255
+                $this->reporter->db->convert($this->_get_column_select($layout_def), 'date_format', '%Y-%m-%d'),
256
+                "CONCAT",
257
+                array("' '", $this->reporter->db->convert($layout_def['rel_field'], 'time_format'))
258
+            );
259
+        } else {
260
+            $field_name = $this->_get_column_select($layout_def);
261
+        }
262
+        return $field_name.">=".$this->reporter->db->quoted($begin)." AND ".$field_name."<=".$this->reporter->db->quoted($end)."\n";
263
+    }
264
+
265
+    /**
266
+     * Create query for binary operation of field of certain type
267
+     * Produces query like:
268
+     * arg1 op to_date(arg2), e.g.:
269
+     * 		date_closed < '2009-12-01'
270
+     * @param string $arg1 1st arg - column name
271
+     * @param string|DateTime $arg2 2nd arg - value to be converted
272
+     * @param string $op
273
+     * @param string $type
274
+     */
275 275
     protected function queryDateOp($arg1, $arg2, $op, $type)
276 276
     {
277 277
         global $timedate;
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         return $timedate->tzUser($timedate->getNow(), $this->getAssignedUser());
292 292
     }
293 293
 
294
-	/**
294
+    /**
295 295
      * Create query from the beginning to the end of certain day
296 296
      * @param array $layout_def
297 297
      * @param SugarDateTime $day
@@ -303,43 +303,43 @@  discard block
 block discarded – undo
303 303
         return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
304 304
     }
305 305
 
306
-	function queryFilterTP_yesterday($layout_def)
307
-	{
308
-		global $timedate;
309
-		return $this->queryDay($layout_def, $this->now()->get("-1 day"));
310
-	}
306
+    function queryFilterTP_yesterday($layout_def)
307
+    {
308
+        global $timedate;
309
+        return $this->queryDay($layout_def, $this->now()->get("-1 day"));
310
+    }
311 311
 
312
-	function queryFilterTP_today($layout_def)
313
-	{
314
-		global $timedate;
315
-		return $this->queryDay($layout_def, $this->now());
316
-	}
312
+    function queryFilterTP_today($layout_def)
313
+    {
314
+        global $timedate;
315
+        return $this->queryDay($layout_def, $this->now());
316
+    }
317 317
 
318
-	function queryFilterTP_tomorrow(& $layout_def)
319
-	{
320
-		global $timedate;
321
-		return $this->queryDay($layout_def, $this->now()->get("+1 day"));
322
-	}
318
+    function queryFilterTP_tomorrow(& $layout_def)
319
+    {
320
+        global $timedate;
321
+        return $this->queryDay($layout_def, $this->now()->get("+1 day"));
322
+    }
323 323
 
324
-	function queryFilterTP_last_7_days($layout_def)
325
-	{
326
-		global $timedate;
324
+    function queryFilterTP_last_7_days($layout_def)
325
+    {
326
+        global $timedate;
327 327
 
328
-		$begin = $this->now()->get("-6 days")->get_day_begin();
329
-		$end = $this->now()->get_day_end();
328
+        $begin = $this->now()->get("-6 days")->get_day_begin();
329
+        $end = $this->now()->get_day_end();
330 330
 
331
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
332
-	}
331
+        return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
332
+    }
333 333
 
334
-	function queryFilterTP_next_7_days($layout_def)
335
-	{
336
-		global $timedate;
334
+    function queryFilterTP_next_7_days($layout_def)
335
+    {
336
+        global $timedate;
337 337
 
338
-		$begin = $this->now()->get_day_begin();
339
-		$end = $this->now()->get("+6 days")->get_day_end();
338
+        $begin = $this->now()->get_day_begin();
339
+        $end = $this->now()->get("+6 days")->get_day_end();
340 340
 
341
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
342
-	}
341
+        return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
342
+    }
343 343
 
344 344
     /**
345 345
      * Create query from the beginning to the end of certain month
@@ -350,20 +350,20 @@  discard block
 block discarded – undo
350 350
     {
351 351
         $begin = $month->setTime(0, 0, 0);
352 352
         $end = clone($begin);
353
-		$end->setDate($begin->year, $begin->month, $begin->days_in_month)->setTime(23, 59, 59);
353
+        $end->setDate($begin->year, $begin->month, $begin->days_in_month)->setTime(23, 59, 59);
354 354
         return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
355 355
     }
356 356
 
357 357
     function queryFilterTP_last_month($layout_def)
358
-	{
359
-		global $timedate;
360
-		$month = $this->now();
361
-		return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month-1, 1));
362
-	}
358
+    {
359
+        global $timedate;
360
+        $month = $this->now();
361
+        return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month-1, 1));
362
+    }
363 363
 
364
-	function queryFilterTP_this_month($layout_def)
365
-	{
366
-		global $timedate;
364
+    function queryFilterTP_this_month($layout_def)
365
+    {
366
+        global $timedate;
367 367
 
368 368
         //Bug 62414 - take timezone into account when determining current month
369 369
         $now = $this->now();
@@ -372,30 +372,30 @@  discard block
 block discarded – undo
372 372
         $now->modify($timezoneOffset);
373 373
 
374 374
         return $this->queryMonth($layout_def, $now->get_day_by_index_this_month(0));
375
-	}
376
-
377
-	function queryFilterTP_next_month($layout_def)
378
-	{
379
-		global $timedate;
380
-		$month = $this->now();
381
-		return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month+1, 1));
382
-	}
383
-
384
-	function queryFilterTP_last_30_days($layout_def)
385
-	{
386
-		global $timedate;
387
-		$begin = $this->now()->get("-29 days")->get_day_begin();
388
-		$end = $this->now()->get_day_end();
389
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
390
-	}
391
-
392
-	function queryFilterTP_next_30_days($layout_def)
393
-	{
394
-		global $timedate;
395
-		$begin = $this->now()->get_day_begin();
396
-		$end = $this->now()->get("+29 days")->get_day_end();
397
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
398
-	}
375
+    }
376
+
377
+    function queryFilterTP_next_month($layout_def)
378
+    {
379
+        global $timedate;
380
+        $month = $this->now();
381
+        return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month+1, 1));
382
+    }
383
+
384
+    function queryFilterTP_last_30_days($layout_def)
385
+    {
386
+        global $timedate;
387
+        $begin = $this->now()->get("-29 days")->get_day_begin();
388
+        $end = $this->now()->get_day_end();
389
+        return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
390
+    }
391
+
392
+    function queryFilterTP_next_30_days($layout_def)
393
+    {
394
+        global $timedate;
395
+        $begin = $this->now()->get_day_begin();
396
+        $end = $this->now()->get("+29 days")->get_day_end();
397
+        return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
398
+    }
399 399
 
400 400
     /**
401 401
      * Return the between WHERE query for Quarter filter
@@ -468,59 +468,59 @@  discard block
 block discarded – undo
468 468
         return $this->getQuarterFilter($layout_def, '+3 month');
469 469
     }
470 470
 
471
-	function queryFilterTP_last_year($layout_def)
472
-	{
473
-		global $timedate;
474
-		$begin = $this->now();
475
-		$begin->setDate($begin->year-1, 1, 1)->setTime(0, 0);
476
-		$end = clone $begin;
477
-		$end->setDate($end->year, 12, 31)->setTime(23, 59, 59);
478
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
479
-	}
480
-
481
-	function queryFilterTP_this_year($layout_def)
482
-	{
483
-		global $timedate;
484
-		$begin = $this->now();
485
-		$begin->setDate($begin->year, 1, 1)->setTime(0, 0);
486
-		$end = clone $begin;
487
-		$end->setDate($end->year, 12, 31)->setTime(23, 59, 59);
488
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
489
-	}
490
-
491
-	function queryFilterTP_next_year(& $layout_def)
492
-	{
493
-		global $timedate;
494
-		$begin = $this->now();
495
-		$begin->setDate($begin->year+1, 1, 1)->setTime(0, 0);
496
-		$end = clone $begin;
497
-		$end->setDate($end->year, 12, 31)->setTime(23, 59, 59);
498
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
499
-	}
500
-
501
-	function queryGroupBy($layout_def)
502
-	{
503
-		// i guess qualifier and column_function are the same..
504
-		if (!empty ($layout_def['qualifier'])) {
505
-			$func_name = 'queryGroupBy'.$layout_def['qualifier'];
506
-			if (method_exists($this, $func_name)) {
507
-				return $this-> $func_name ($layout_def)." \n";
508
-			}
509
-		}
510
-		return parent :: queryGroupBy($layout_def)." \n";
511
-	}
512
-
513
-	function queryOrderBy($layout_def)
514
-	{
471
+    function queryFilterTP_last_year($layout_def)
472
+    {
473
+        global $timedate;
474
+        $begin = $this->now();
475
+        $begin->setDate($begin->year-1, 1, 1)->setTime(0, 0);
476
+        $end = clone $begin;
477
+        $end->setDate($end->year, 12, 31)->setTime(23, 59, 59);
478
+        return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
479
+    }
480
+
481
+    function queryFilterTP_this_year($layout_def)
482
+    {
483
+        global $timedate;
484
+        $begin = $this->now();
485
+        $begin->setDate($begin->year, 1, 1)->setTime(0, 0);
486
+        $end = clone $begin;
487
+        $end->setDate($end->year, 12, 31)->setTime(23, 59, 59);
488
+        return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
489
+    }
490
+
491
+    function queryFilterTP_next_year(& $layout_def)
492
+    {
493
+        global $timedate;
494
+        $begin = $this->now();
495
+        $begin->setDate($begin->year+1, 1, 1)->setTime(0, 0);
496
+        $end = clone $begin;
497
+        $end->setDate($end->year, 12, 31)->setTime(23, 59, 59);
498
+        return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
499
+    }
500
+
501
+    function queryGroupBy($layout_def)
502
+    {
503
+        // i guess qualifier and column_function are the same..
504
+        if (!empty ($layout_def['qualifier'])) {
505
+            $func_name = 'queryGroupBy'.$layout_def['qualifier'];
506
+            if (method_exists($this, $func_name)) {
507
+                return $this-> $func_name ($layout_def)." \n";
508
+            }
509
+        }
510
+        return parent :: queryGroupBy($layout_def)." \n";
511
+    }
512
+
513
+    function queryOrderBy($layout_def)
514
+    {
515 515
         if (!empty ($layout_def['qualifier'])) {
516
-			$func_name ='queryOrderBy'.$layout_def['qualifier'];
517
-			if (method_exists($this, $func_name)) {
518
-				return $this-> $func_name ($layout_def)."\n";
519
-			}
520
-		}
521
-		$order_by = parent :: queryOrderBy($layout_def)."\n";
522
-		return $order_by;
523
-	}
516
+            $func_name ='queryOrderBy'.$layout_def['qualifier'];
517
+            if (method_exists($this, $func_name)) {
518
+                return $this-> $func_name ($layout_def)."\n";
519
+            }
520
+        }
521
+        $order_by = parent :: queryOrderBy($layout_def)."\n";
522
+        return $order_by;
523
+    }
524 524
 
525 525
     function displayListPlain($layout_def) {
526 526
         global $timedate;
@@ -566,39 +566,39 @@  discard block
 block discarded – undo
566 566
         return $timedate->to_display_date_time($content);
567 567
     }
568 568
 
569
-	function querySelect(& $layout_def) {
570
-		// i guess qualifier and column_function are the same..
571
-		if (!empty ($layout_def['column_function'])) {
572
-			$func_name = 'querySelect'.$layout_def['column_function'];
573
-			if (method_exists($this, $func_name)) {
574
-				return $this-> $func_name ($layout_def)." \n";
575
-			}
576
-		}
577
-		return parent :: querySelect($layout_def)." \n";
578
-	}
579
-	function & displayListday(& $layout_def) {
569
+    function querySelect(& $layout_def) {
570
+        // i guess qualifier and column_function are the same..
571
+        if (!empty ($layout_def['column_function'])) {
572
+            $func_name = 'querySelect'.$layout_def['column_function'];
573
+            if (method_exists($this, $func_name)) {
574
+                return $this-> $func_name ($layout_def)." \n";
575
+            }
576
+        }
577
+        return parent :: querySelect($layout_def)." \n";
578
+    }
579
+    function & displayListday(& $layout_def) {
580
+        $value = parent:: displayListPlain($layout_def);
581
+        return $value;
582
+    }
583
+
584
+    function & displayListyear(& $layout_def) {
585
+        global $app_list_strings;
580 586
         $value = parent:: displayListPlain($layout_def);
581 587
         return $value;
582
-	}
583
-
584
-	function & displayListyear(& $layout_def) {
585
-		global $app_list_strings;
586
-    	$value = parent:: displayListPlain($layout_def);
587
-    	return $value;
588
-	}
589
-
590
-	function displayListmonth($layout_def)
591
-	{
592
-		global $app_list_strings;
593
-		$display = '';
594
-		$match = array();
588
+    }
589
+
590
+    function displayListmonth($layout_def)
591
+    {
592
+        global $app_list_strings;
593
+        $display = '';
594
+        $match = array();
595 595
         if (preg_match('/(\d{4})-(\d\d)/', $this->displayListPlain($layout_def), $match)) {
596
-			$match[2] = preg_replace('/^0/', '', $match[2]);
597
-			$display = $app_list_strings['dom_cal_month_long'][$match[2]]." {$match[1]}";
598
-		}
599
-		return $display;
596
+            $match[2] = preg_replace('/^0/', '', $match[2]);
597
+            $display = $app_list_strings['dom_cal_month_long'][$match[2]]." {$match[1]}";
598
+        }
599
+        return $display;
600 600
 
601
-	}
601
+    }
602 602
 
603 603
     /**
604 604
      * Returns part of query for select
@@ -721,32 +721,32 @@  discard block
 block discarded – undo
721 721
         return $this->reporter->db->convert($return, "date_format", array('%Y')) . "\n";
722 722
     }
723 723
 
724
-	function querySelectquarter($layout_def)
725
-	{
726
-	    $column = $this->_get_column_select($layout_def);
727
-	    return $this->reporter->db->convert($this->reporter->db->convert($column, "date_format", array('%Y')),
728
-	        	'CONCAT',
729
-	            array("'-'", $this->reporter->db->convert($column, "quarter")))
730
-	        ." ".$this->_get_column_alias($layout_def)."\n";
731
-	}
724
+    function querySelectquarter($layout_def)
725
+    {
726
+        $column = $this->_get_column_select($layout_def);
727
+        return $this->reporter->db->convert($this->reporter->db->convert($column, "date_format", array('%Y')),
728
+                'CONCAT',
729
+                array("'-'", $this->reporter->db->convert($column, "quarter")))
730
+            ." ".$this->_get_column_alias($layout_def)."\n";
731
+    }
732 732
 
733
-	function displayListquarter(& $layout_def) {
734
-		$match = array();
733
+    function displayListquarter(& $layout_def) {
734
+        $match = array();
735 735
         if (preg_match('/(\d{4})-(\d)/', $this->displayListPlain($layout_def), $match)) {
736
-			return "Q".$match[2]." ".$match[1];
737
-		}
738
-		return '';
736
+            return "Q".$match[2]." ".$match[1];
737
+        }
738
+        return '';
739 739
 
740
-	}
740
+    }
741 741
 
742
-	function queryGroupByQuarter($layout_def)
743
-	{
744
-		$this->getReporter();
742
+    function queryGroupByQuarter($layout_def)
743
+    {
744
+        $this->getReporter();
745 745
         $column = $this->_get_column_select($layout_def);
746
-	    return $this->reporter->db->convert($this->reporter->db->convert($column, "date_format", array('%Y')),
747
-	        	'CONCAT',
748
-	            array("'-'", $this->reporter->db->convert($column, "quarter")));
749
-	}
746
+        return $this->reporter->db->convert($this->reporter->db->convert($column, "date_format", array('%Y')),
747
+                'CONCAT',
748
+                array("'-'", $this->reporter->db->convert($column, "quarter")));
749
+    }
750 750
 
751 751
     /**
752 752
      * For oracle we have to return order by string like group by string instead of return field alias
@@ -775,23 +775,23 @@  discard block
 block discarded – undo
775 775
     }
776 776
 
777 777
     function displayInput(&$layout_def) {
778
-    	global $timedate, $current_language, $app_strings;
778
+        global $timedate, $current_language, $app_strings;
779 779
         $home_mod_strings = return_module_language($current_language, 'Home');
780 780
         $filterTypes = array(' '                 => $app_strings['LBL_NONE'],
781
-                             'TP_today'         => $home_mod_strings['LBL_TODAY'],
782
-                             'TP_yesterday'     => $home_mod_strings['LBL_YESTERDAY'],
783
-                             'TP_tomorrow'      => $home_mod_strings['LBL_TOMORROW'],
784
-                             'TP_this_month'    => $home_mod_strings['LBL_THIS_MONTH'],
785
-                             'TP_this_year'     => $home_mod_strings['LBL_THIS_YEAR'],
786
-                             'TP_last_30_days'  => $home_mod_strings['LBL_LAST_30_DAYS'],
787
-                             'TP_last_7_days'   => $home_mod_strings['LBL_LAST_7_DAYS'],
788
-                             'TP_last_month'    => $home_mod_strings['LBL_LAST_MONTH'],
789
-                             'TP_last_year'     => $home_mod_strings['LBL_LAST_YEAR'],
790
-                             'TP_next_30_days'  => $home_mod_strings['LBL_NEXT_30_DAYS'],
791
-                             'TP_next_7_days'   => $home_mod_strings['LBL_NEXT_7_DAYS'],
792
-                             'TP_next_month'    => $home_mod_strings['LBL_NEXT_MONTH'],
793
-                             'TP_next_year'     => $home_mod_strings['LBL_NEXT_YEAR'],
794
-                             );
781
+                                'TP_today'         => $home_mod_strings['LBL_TODAY'],
782
+                                'TP_yesterday'     => $home_mod_strings['LBL_YESTERDAY'],
783
+                                'TP_tomorrow'      => $home_mod_strings['LBL_TOMORROW'],
784
+                                'TP_this_month'    => $home_mod_strings['LBL_THIS_MONTH'],
785
+                                'TP_this_year'     => $home_mod_strings['LBL_THIS_YEAR'],
786
+                                'TP_last_30_days'  => $home_mod_strings['LBL_LAST_30_DAYS'],
787
+                                'TP_last_7_days'   => $home_mod_strings['LBL_LAST_7_DAYS'],
788
+                                'TP_last_month'    => $home_mod_strings['LBL_LAST_MONTH'],
789
+                                'TP_last_year'     => $home_mod_strings['LBL_LAST_YEAR'],
790
+                                'TP_next_30_days'  => $home_mod_strings['LBL_NEXT_30_DAYS'],
791
+                                'TP_next_7_days'   => $home_mod_strings['LBL_NEXT_7_DAYS'],
792
+                                'TP_next_month'    => $home_mod_strings['LBL_NEXT_MONTH'],
793
+                                'TP_next_year'     => $home_mod_strings['LBL_NEXT_YEAR'],
794
+                                );
795 795
 
796 796
         $cal_dateformat = $timedate->get_cal_date_format();
797 797
         $str = "<select name='type_{$layout_def['name']}'>";
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 class SugarWidgetFieldDateTime extends SugarWidgetReportField
45 45
 {
46 46
 	var $reporter;
47
-	var $assigned_user=null;
47
+	var $assigned_user = null;
48 48
 
49 49
     function __construct($layout_manager)
50 50
     {
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
     /**
55 55
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
56 56
      */
57
-    function SugarWidgetFieldDateTime($layout_manager){
57
+    function SugarWidgetFieldDateTime($layout_manager) {
58 58
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
59
-        if(isset($GLOBALS['log'])) {
59
+        if (isset($GLOBALS['log'])) {
60 60
             $GLOBALS['log']->deprecated($deprecatedMessage);
61 61
         }
62 62
         else {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 		$report_def_str = $json_obj->decode($this->reporter->report_def_str);
83 83
 
84
-		if(empty($report_def_str['assigned_user_id'])) return null;
84
+		if (empty($report_def_str['assigned_user_id'])) return null;
85 85
 
86 86
 		$this->assigned_user = new User();
87 87
 		$this->assigned_user->retrieve($report_def_str['assigned_user_id']);
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	protected function expandDate($date, $end = false)
127 127
 	{
128 128
 	    global $timedate;
129
-	    if($this->hasTime($date)) {
129
+	    if ($this->hasTime($date)) {
130 130
 	        return $date;
131 131
 	    }
132 132
 
133 133
         //C.L. Bug 48616 - If the $date is set to the Today macro, then adjust accordingly
134
-        if(strtolower($date) == 'today')
134
+        if (strtolower($date) == 'today')
135 135
         {
136 136
            $startEnd = $timedate->getDayStartEndGMT($timedate->getNow(true));
137 137
            return $end ? $startEnd['end'] : $startEnd['start'];
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $date = $timedate->tzUser(new SugarDateTime());
142 142
         $date->setDate($parsed->year, $parsed->month, $parsed->day);
143 143
 
144
-	    if($end) {
144
+	    if ($end) {
145 145
 	        return $date->setTime(23, 59, 59);
146 146
 	    } else {
147 147
 	        return $date->setTime(0, 0, 0);
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
         $column = $this->_get_column_select($layout_def);
177 177
         $begin = $layout_def['input_name0'];
178 178
         $hasTime = $this->hasTime($begin);
179
-        if(!$hasTime){
179
+        if (!$hasTime) {
180 180
      	    $end = $this->expandDate($begin, true);
181 181
             $begin = $this->expandDate($begin);
182 182
             $cond = $this->queryDateOp($column, $begin, "<", "datetime")." OR ".
183 183
                 $this->queryDateOp($column, $end, ">", "datetime");
184 184
         } else {
185
-            $cond =  $this->queryDateOp($column, $begin, "!=", "datetime");
185
+            $cond = $this->queryDateOp($column, $begin, "!=", "datetime");
186 186
         }
187 187
         return "($column IS NULL OR $cond)";
188 188
 	}
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      * Get assigned or logged in user's current date and time value.
192 192
      * @param boolean $timestamp Format of return value, if set to true, return unix like timestamp , else a formatted date.
193 193
      */
194
-	function get_users_current_date_time($timestamp=false)
194
+	function get_users_current_date_time($timestamp = false)
195 195
 	{
196 196
 	 	global $current_user;
197 197
         global $timedate;
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
         	return $begin;
206 206
         } else {
207 207
         	$begin_parts = explode(' ', $begin);
208
-        	$date_parts=explode('-', $begin_parts[0]);
209
-        	$time_parts=explode(':', $begin_parts[1]);
210
-        	$curr_timestamp=mktime($time_parts[0],$time_parts[1],0,$date_parts[1], $date_parts[2],$date_parts[0]);
208
+        	$date_parts = explode('-', $begin_parts[0]);
209
+        	$time_parts = explode(':', $begin_parts[1]);
210
+        	$curr_timestamp = mktime($time_parts[0], $time_parts[1], 0, $date_parts[1], $date_parts[2], $date_parts[0]);
211 211
         	return $curr_timestamp;
212 212
         }
213 213
 
@@ -217,23 +217,23 @@  discard block
 block discarded – undo
217 217
 	 * @param int $days Adjust date by this number of days, negative values are valid.
218 218
 	 * @param time string falg for desired time value, start: minimum time, end: maximum time, default: current time
219 219
 	 */
220
-	function get_db_date($days,$time) {
220
+	function get_db_date($days, $time) {
221 221
         global $timedate;
222 222
 
223
-        $begin = date($GLOBALS['timedate']->get_db_date_time_format(), time()+(86400 * $days));  //gmt date with day adjustment applied.
223
+        $begin = date($GLOBALS['timedate']->get_db_date_time_format(), time() + (86400 * $days)); //gmt date with day adjustment applied.
224 224
         //kbrill bug #13884
225 225
         //$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user);
226 226
 		$begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user);
227 227
 
228
-        if ($time=='start') {
228
+        if ($time == 'start') {
229 229
             $begin_parts = explode(' ', $begin);
230
-            $be = $begin_parts[0] . ' 00:00:00';
230
+            $be = $begin_parts[0].' 00:00:00';
231 231
         }
232
-        else if ($time=='end') {
232
+        else if ($time == 'end') {
233 233
             $begin_parts = explode(' ', $begin);
234
-            $be = $begin_parts[0] . ' 23:59:59';
234
+            $be = $begin_parts[0].' 23:59:59';
235 235
         } else {
236
-            $be=$begin;
236
+            $be = $begin;
237 237
         }
238 238
 
239 239
         //convert date to db format without converting to GMT.
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 * @param string $begin start date value (in DB format)
249 249
 	 * @param string $end End date value (in DB format)
250 250
 	 */
251
-	function get_start_end_date_filter(& $layout_def, $begin,$end)
251
+	function get_start_end_date_filter(& $layout_def, $begin, $end)
252 252
 	{
253 253
 	    if (isset ($layout_def['rel_field'])) {
254 254
 	        $field_name = $this->reporter->db->convert(
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     protected function queryDateOp($arg1, $arg2, $op, $type)
276 276
     {
277 277
         global $timedate;
278
-        if($arg2 instanceof DateTime) {
278
+        if ($arg2 instanceof DateTime) {
279 279
             $arg2 = $timedate->asDbType($arg2, $type);
280 280
         }
281 281
         return "$arg1 $op ".$this->reporter->db->convert($this->reporter->db->quoted($arg2), $type)."\n";
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
     {
301 301
         $begin = $day->get_day_begin();
302 302
         $end = $day->get_day_end();
303
-        return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
303
+        return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb());
304 304
     }
305 305
 
306 306
 	function queryFilterTP_yesterday($layout_def)
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		$begin = $this->now()->get("-6 days")->get_day_begin();
329 329
 		$end = $this->now()->get_day_end();
330 330
 
331
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
331
+		return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb());
332 332
 	}
333 333
 
334 334
 	function queryFilterTP_next_7_days($layout_def)
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		$begin = $this->now()->get_day_begin();
339 339
 		$end = $this->now()->get("+6 days")->get_day_end();
340 340
 
341
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
341
+		return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb());
342 342
 	}
343 343
 
344 344
     /**
@@ -351,14 +351,14 @@  discard block
 block discarded – undo
351 351
         $begin = $month->setTime(0, 0, 0);
352 352
         $end = clone($begin);
353 353
 		$end->setDate($begin->year, $begin->month, $begin->days_in_month)->setTime(23, 59, 59);
354
-        return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
354
+        return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb());
355 355
     }
356 356
 
357 357
     function queryFilterTP_last_month($layout_def)
358 358
 	{
359 359
 		global $timedate;
360 360
 		$month = $this->now();
361
-		return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month-1, 1));
361
+		return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month - 1, 1));
362 362
 	}
363 363
 
364 364
 	function queryFilterTP_this_month($layout_def)
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 	{
379 379
 		global $timedate;
380 380
 		$month = $this->now();
381
-		return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month+1, 1));
381
+		return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month + 1, 1));
382 382
 	}
383 383
 
384 384
 	function queryFilterTP_last_30_days($layout_def)
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 		global $timedate;
387 387
 		$begin = $this->now()->get("-29 days")->get_day_begin();
388 388
 		$end = $this->now()->get_day_end();
389
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
389
+		return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb());
390 390
 	}
391 391
 
392 392
 	function queryFilterTP_next_30_days($layout_def)
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 		global $timedate;
395 395
 		$begin = $this->now()->get_day_begin();
396 396
 		$end = $this->now()->get("+29 days")->get_day_end();
397
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
397
+		return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb());
398 398
 	}
399 399
 
400 400
     /**
@@ -472,10 +472,10 @@  discard block
 block discarded – undo
472 472
 	{
473 473
 		global $timedate;
474 474
 		$begin = $this->now();
475
-		$begin->setDate($begin->year-1, 1, 1)->setTime(0, 0);
475
+		$begin->setDate($begin->year - 1, 1, 1)->setTime(0, 0);
476 476
 		$end = clone $begin;
477 477
 		$end->setDate($end->year, 12, 31)->setTime(23, 59, 59);
478
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
478
+		return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb());
479 479
 	}
480 480
 
481 481
 	function queryFilterTP_this_year($layout_def)
@@ -485,17 +485,17 @@  discard block
 block discarded – undo
485 485
 		$begin->setDate($begin->year, 1, 1)->setTime(0, 0);
486 486
 		$end = clone $begin;
487 487
 		$end->setDate($end->year, 12, 31)->setTime(23, 59, 59);
488
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
488
+		return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb());
489 489
 	}
490 490
 
491 491
 	function queryFilterTP_next_year(& $layout_def)
492 492
 	{
493 493
 		global $timedate;
494 494
 		$begin = $this->now();
495
-		$begin->setDate($begin->year+1, 1, 1)->setTime(0, 0);
495
+		$begin->setDate($begin->year + 1, 1, 1)->setTime(0, 0);
496 496
 		$end = clone $begin;
497 497
 		$end->setDate($end->year, 12, 31)->setTime(23, 59, 59);
498
-		return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb());
498
+		return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb());
499 499
 	}
500 500
 
501 501
 	function queryGroupBy($layout_def)
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 		if (!empty ($layout_def['qualifier'])) {
505 505
 			$func_name = 'queryGroupBy'.$layout_def['qualifier'];
506 506
 			if (method_exists($this, $func_name)) {
507
-				return $this-> $func_name ($layout_def)." \n";
507
+				return $this-> $func_name($layout_def)." \n";
508 508
 			}
509 509
 		}
510 510
 		return parent :: queryGroupBy($layout_def)." \n";
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 	function queryOrderBy($layout_def)
514 514
 	{
515 515
         if (!empty ($layout_def['qualifier'])) {
516
-			$func_name ='queryOrderBy'.$layout_def['qualifier'];
516
+			$func_name = 'queryOrderBy'.$layout_def['qualifier'];
517 517
 			if (method_exists($this, $func_name)) {
518
-				return $this-> $func_name ($layout_def)."\n";
518
+				return $this-> $func_name($layout_def)."\n";
519 519
 			}
520 520
 		}
521 521
 		$order_by = parent :: queryOrderBy($layout_def)."\n";
@@ -526,15 +526,15 @@  discard block
 block discarded – undo
526 526
         global $timedate;
527 527
         $content = parent:: displayListPlain($layout_def);
528 528
         // awu: this if condition happens only in Reports where group by month comes back as YYYY-mm format
529
-        if (count(explode('-',$content)) == 2){
529
+        if (count(explode('-', $content)) == 2) {
530 530
             return $content;
531 531
         // if date field
532
-        }elseif(substr_count($layout_def['type'], 'date') > 0){
532
+        }elseif (substr_count($layout_def['type'], 'date') > 0) {
533 533
             // if date time field
534
-            if(substr_count($layout_def['type'], 'time') > 0 && $this->get_time_part($content)!= false){
534
+            if (substr_count($layout_def['type'], 'time') > 0 && $this->get_time_part($content) != false) {
535 535
                 $td = $timedate->to_display_date_time($content);
536 536
                 return $td;
537
-            }else{// if date only field
537
+            } else {// if date only field
538 538
                 $td = $timedate->to_display_date($content, false); // Avoid PHP notice of returning by reference.
539 539
                 return $td;
540 540
             }
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
     {
546 546
         global $timedate;
547 547
 
548
-        $date_parts=$timedate->split_date_time($date_time_value);
548
+        $date_parts = $timedate->split_date_time($date_time_value);
549 549
         if (count($date_parts) > 1) {
550 550
             return $date_parts[1];
551 551
         } else {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
         if (!empty ($layout_def['column_function'])) {
560 560
             $func_name = 'displayList'.$layout_def['column_function'];
561 561
             if (method_exists($this, $func_name)) {
562
-                return $this-> $func_name ($layout_def);
562
+                return $this-> $func_name($layout_def);
563 563
             }
564 564
         }
565 565
         $content = parent :: displayListPlain($layout_def);
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 		if (!empty ($layout_def['column_function'])) {
572 572
 			$func_name = 'querySelect'.$layout_def['column_function'];
573 573
 			if (method_exists($this, $func_name)) {
574
-				return $this-> $func_name ($layout_def)." \n";
574
+				return $this-> $func_name($layout_def)." \n";
575 575
 			}
576 576
 		}
577 577
 		return parent :: querySelect($layout_def)." \n";
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
         {
614 614
             $return = $this->reporter->db->convert($return, 'add_tz_offset');
615 615
         }
616
-        return $this->reporter->db->convert($return, "date_format", array('%Y-%m')) . ' ' . $this->_get_column_alias($layout_def) . "\n";
616
+        return $this->reporter->db->convert($return, "date_format", array('%Y-%m')).' '.$this->_get_column_alias($layout_def)."\n";
617 617
     }
618 618
 
619 619
     /**
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
         {
630 630
             $return = $this->reporter->db->convert($return, 'add_tz_offset');
631 631
         }
632
-        return $this->reporter->db->convert($return, "date_format", array('%Y-%m')) . "\n";
632
+        return $this->reporter->db->convert($return, "date_format", array('%Y-%m'))."\n";
633 633
     }
634 634
 
635 635
     /**
@@ -649,11 +649,11 @@  discard block
 block discarded – undo
649 649
 
650 650
         if (empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a')
651 651
         {
652
-            return $orderBy . " ASC\n";
652
+            return $orderBy." ASC\n";
653 653
         }
654 654
         else
655 655
         {
656
-            return $orderBy . " DESC\n";
656
+            return $orderBy." DESC\n";
657 657
         }
658 658
     }
659 659
 
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
         {
671 671
             $return = $this->reporter->db->convert($return, 'add_tz_offset');
672 672
         }
673
-        return $this->reporter->db->convert($return, "date_format", array('%Y-%m-%d')) . ' ' . $this->_get_column_alias($layout_def) . "\n";
673
+        return $this->reporter->db->convert($return, "date_format", array('%Y-%m-%d')).' '.$this->_get_column_alias($layout_def)."\n";
674 674
     }
675 675
 
676 676
     /**
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
         {
687 687
             $return = $this->reporter->db->convert($return, 'add_tz_offset');
688 688
         }
689
-        return $this->reporter->db->convert($return, "date_format", array('%Y-%m-%d')) . "\n";
689
+        return $this->reporter->db->convert($return, "date_format", array('%Y-%m-%d'))."\n";
690 690
     }
691 691
 
692 692
     /**
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
         {
703 703
             $return = $this->reporter->db->convert($return, 'add_tz_offset');
704 704
         }
705
-        return $this->reporter->db->convert($return, "date_format", array('%Y')) . ' ' . $this->_get_column_alias($layout_def) . "\n";
705
+        return $this->reporter->db->convert($return, "date_format", array('%Y')).' '.$this->_get_column_alias($layout_def)."\n";
706 706
     }
707 707
 
708 708
     /**
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
         {
719 719
             $return = $this->reporter->db->convert($return, 'add_tz_offset');
720 720
         }
721
-        return $this->reporter->db->convert($return, "date_format", array('%Y')) . "\n";
721
+        return $this->reporter->db->convert($return, "date_format", array('%Y'))."\n";
722 722
     }
723 723
 
724 724
 	function querySelectquarter($layout_def)
@@ -766,11 +766,11 @@  discard block
 block discarded – undo
766 766
 
767 767
         if (empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a')
768 768
         {
769
-            return $orderBy . " ASC\n";
769
+            return $orderBy." ASC\n";
770 770
         }
771 771
         else
772 772
         {
773
-            return $orderBy . " DESC\n";
773
+            return $orderBy." DESC\n";
774 774
         }
775 775
     }
776 776
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -58,8 +60,7 @@  discard block
 block discarded – undo
58 60
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
59 61
         if(isset($GLOBALS['log'])) {
60 62
             $GLOBALS['log']->deprecated($deprecatedMessage);
61
-        }
62
-        else {
63
+        } else {
63 64
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
64 65
         }
65 66
         self::__construct($layout_manager);
@@ -81,7 +82,9 @@  discard block
 block discarded – undo
81 82
 
82 83
 		$report_def_str = $json_obj->decode($this->reporter->report_def_str);
83 84
 
84
-		if(empty($report_def_str['assigned_user_id'])) return null;
85
+		if(empty($report_def_str['assigned_user_id'])) {
86
+		    return null;
87
+		}
85 88
 
86 89
 		$this->assigned_user = new User();
87 90
 		$this->assigned_user->retrieve($report_def_str['assigned_user_id']);
@@ -228,8 +231,7 @@  discard block
 block discarded – undo
228 231
         if ($time=='start') {
229 232
             $begin_parts = explode(' ', $begin);
230 233
             $be = $begin_parts[0] . ' 00:00:00';
231
-        }
232
-        else if ($time=='end') {
234
+        } else if ($time=='end') {
233 235
             $begin_parts = explode(' ', $begin);
234 236
             $be = $begin_parts[0] . ' 23:59:59';
235 237
         } else {
@@ -529,12 +531,12 @@  discard block
 block discarded – undo
529 531
         if (count(explode('-',$content)) == 2){
530 532
             return $content;
531 533
         // if date field
532
-        }elseif(substr_count($layout_def['type'], 'date') > 0){
534
+        } elseif(substr_count($layout_def['type'], 'date') > 0){
533 535
             // if date time field
534 536
             if(substr_count($layout_def['type'], 'time') > 0 && $this->get_time_part($content)!= false){
535 537
                 $td = $timedate->to_display_date_time($content);
536 538
                 return $td;
537
-            }else{// if date only field
539
+            } else{// if date only field
538 540
                 $td = $timedate->to_display_date($content, false); // Avoid PHP notice of returning by reference.
539 541
                 return $td;
540 542
             }
@@ -650,8 +652,7 @@  discard block
 block discarded – undo
650 652
         if (empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a')
651 653
         {
652 654
             return $orderBy . " ASC\n";
653
-        }
654
-        else
655
+        } else
655 656
         {
656 657
             return $orderBy . " DESC\n";
657 658
         }
@@ -767,8 +768,7 @@  discard block
 block discarded – undo
767 768
         if (empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a')
768 769
         {
769 770
             return $orderBy . " ASC\n";
770
-        }
771
-        else
771
+        } else
772 772
         {
773 773
             return $orderBy . " DESC\n";
774 774
         }
Please login to merge, or discard this patch.
include/generic/SugarWidgets/SugarWidgetReportField.php 3 patches
Indentation   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     protected $reporter;
56 56
 
57
-	function __construct(&$layout_manager) {
57
+    function __construct(&$layout_manager) {
58 58
         parent::__construct($layout_manager);
59 59
         $this->reporter = $this->layout_manager->getAttribute("reporter");
60 60
     }
@@ -74,25 +74,25 @@  discard block
 block discarded – undo
74 74
     }
75 75
 
76 76
 
77
-	function  getSubClass($layout_def)
78
-	{
79
-		if (! empty($layout_def['type']))
80
-		{
77
+    function  getSubClass($layout_def)
78
+    {
79
+        if (! empty($layout_def['type']))
80
+        {
81 81
 
82
-			if ($layout_def['type'] == 'time') {
83
-				$layout_def['widget_class'] = 'Fielddate';
84
-			} else {
85
-				$layout_def['widget_class'] = 'Field'.$layout_def['type'];
86
-			}
87
-			return $this->layout_manager->getClassFromWidgetDef($layout_def);
88
-		} else {
89
-			return $this;
90
-		}
91
-	}
82
+            if ($layout_def['type'] == 'time') {
83
+                $layout_def['widget_class'] = 'Fielddate';
84
+            } else {
85
+                $layout_def['widget_class'] = 'Field'.$layout_def['type'];
86
+            }
87
+            return $this->layout_manager->getClassFromWidgetDef($layout_def);
88
+        } else {
89
+            return $this;
90
+        }
91
+    }
92 92
 
93 93
 
94
- function display($layout_def)
95
- {
94
+    function display($layout_def)
95
+    {
96 96
         $obj = $this->getSubClass($layout_def);
97 97
 
98 98
         $context = $this->layout_manager->getAttribute('context');//_ppd($context);
@@ -106,51 +106,51 @@  discard block
 block discarded – undo
106 106
         {
107 107
                 return 'display not found:'.$func_name;
108 108
         }
109
- }
109
+    }
110 110
 
111
- function _get_column_select_special($layout_def)
112
- {
113
- 		$alias = '';
114
-		 if ( ! empty($layout_def['table_alias']))
115
-		 {
116
-			$alias = $layout_def['table_alias'];
117
-		 }
111
+    function _get_column_select_special($layout_def)
112
+    {
113
+            $alias = '';
114
+            if ( ! empty($layout_def['table_alias']))
115
+            {
116
+            $alias = $layout_def['table_alias'];
117
+            }
118 118
 
119 119
     if ($layout_def['name'] == 'weighted_sum' )
120 120
     {
121 121
         return sprintf("SUM(%s * %s * 0.01)", $this->reporter->db->convert("$alias.probability","IFNULL", array(0)),
122 122
             $this->reporter->db->convert("$alias.amount_usdollar","IFNULL", array(0)));
123
-	}
123
+    }
124 124
     if ($layout_def['name'] == 'weighted_amount' )
125 125
     {
126 126
         return sprintf("AVG(%s * %s * 0.01)", $this->reporter->db->convert("$alias.probability","IFNULL", array(0)),
127 127
             $this->reporter->db->convert("$alias.amount_usdollar","IFNULL", array(0)));
128
-	}
129
- }
130
-
131
- function _get_column_select($layout_def)
132
- {
133
- 	global $reportAlias;
134
- 	if (!isset($reportAlias)) {
135
- 		$reportAlias = array();
136
- 	}
137
-
138
-	if ( ! empty($layout_def['table_alias'])) {
139
-		$alias = $layout_def['table_alias'].".".$layout_def['name'];
140
-	} else if (! empty($layout_def['name'])) {
141
-		$alias = $layout_def['name'];
142
-	} else {
143
-		$alias = "*";
144
-	}
145
-
146
-	if ( ! empty($layout_def['group_function']) )
147
-	{
148
-    	if ($layout_def['name'] == 'weighted_sum' || $layout_def['name'] == 'weighted_amount')
149
-    	{
150
-    			$alias = $this->_get_column_select_special($layout_def);
151
-    			$reportAlias[$alias] = $layout_def;
152
-				return $alias;
153
-    	}
128
+    }
129
+    }
130
+
131
+    function _get_column_select($layout_def)
132
+    {
133
+        global $reportAlias;
134
+        if (!isset($reportAlias)) {
135
+            $reportAlias = array();
136
+        }
137
+
138
+    if ( ! empty($layout_def['table_alias'])) {
139
+        $alias = $layout_def['table_alias'].".".$layout_def['name'];
140
+    } else if (! empty($layout_def['name'])) {
141
+        $alias = $layout_def['name'];
142
+    } else {
143
+        $alias = "*";
144
+    }
145
+
146
+    if ( ! empty($layout_def['group_function']) )
147
+    {
148
+        if ($layout_def['name'] == 'weighted_sum' || $layout_def['name'] == 'weighted_amount')
149
+        {
150
+                $alias = $this->_get_column_select_special($layout_def);
151
+                $reportAlias[$alias] = $layout_def;
152
+                return $alias;
153
+        }
154 154
 
155 155
         // Use IFNULL only if it's not AVG aggregate
156 156
         // because it adds NULL rows to the count when it should not, thus getting wrong result
@@ -179,66 +179,66 @@  discard block
 block discarded – undo
179 179
             }
180 180
 
181 181
         }
182
-	}
182
+    }
183 183
 
184
-	$reportAlias[$alias] = $layout_def;
185
-	return $alias;
186
- }
184
+    $reportAlias[$alias] = $layout_def;
185
+    return $alias;
186
+    }
187 187
 
188
- function querySelect(&$layout_def)
189
- {
188
+    function querySelect(&$layout_def)
189
+    {
190 190
     return $this->_get_column_select($layout_def)." ".$this->_get_column_alias($layout_def)."\n";
191
- }
191
+    }
192 192
 
193
- function queryGroupBy($layout_def)
194
- {
195
-	return $this->_get_column_select($layout_def)." \n";
196
- }
193
+    function queryGroupBy($layout_def)
194
+    {
195
+    return $this->_get_column_select($layout_def)." \n";
196
+    }
197 197
 
198 198
 
199
- function queryOrderBy($layout_def)
200
- {
201
-     $field_def = array();
202
-	if(!empty($this->reporter->all_fields[$layout_def['column_key']])) $field_def = $this->reporter->all_fields[$layout_def['column_key']];
199
+    function queryOrderBy($layout_def)
200
+    {
201
+        $field_def = array();
202
+    if(!empty($this->reporter->all_fields[$layout_def['column_key']])) $field_def = $this->reporter->all_fields[$layout_def['column_key']];
203 203
 
204 204
     if (!empty($layout_def['group_function']))
205 205
     {
206 206
         $order_by = $this->_get_column_alias($layout_def);
207 207
     }
208 208
     elseif (!empty($field_def['sort_on']))
209
-	{
210
-			$order_by = $layout_def['table_alias'].".".$field_def['sort_on'];
209
+    {
210
+            $order_by = $layout_def['table_alias'].".".$field_def['sort_on'];
211 211
             if(!empty($field_def['sort_on2']))
212 212
                 $order_by .= ', ' . $layout_def['table_alias'].".".$field_def['sort_on2'];
213 213
     }
214
-	else {
215
-		$order_by = $this->_get_column_alias($layout_def)." \n";
216
-	}
214
+    else {
215
+        $order_by = $this->_get_column_alias($layout_def)." \n";
216
+    }
217 217
 
218
-     //use sugar db function convert on order by string to convert to varchar.  This is mainly for db's
219
-     //that do not allow sorting on clob/text fields
218
+        //use sugar db function convert on order by string to convert to varchar.  This is mainly for db's
219
+        //that do not allow sorting on clob/text fields
220 220
     if ($this->reporter->db->isTextType($this->reporter->db->getFieldType($field_def))) {
221 221
         $order_by = $this->reporter->db->convert($order_by,'text2char', array(10000)); // array(10000) is for db2 only
222 222
     }
223 223
 
224
-			if ( empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a')
225
-			{
226
-				return $order_by." ASC";
227
-			} else {
228
-				return $order_by." DESC";
229
-			}
230
- }
224
+            if ( empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a')
225
+            {
226
+                return $order_by." ASC";
227
+            } else {
228
+                return $order_by." DESC";
229
+            }
230
+    }
231 231
 
232 232
 
233
- function queryFilter($layout_def)
234
- {
235
-	$method_name = "queryFilter".$layout_def['qualifier_name'];
236
-	return $this->$method_name($layout_def);
237
- }
233
+    function queryFilter($layout_def)
234
+    {
235
+    $method_name = "queryFilter".$layout_def['qualifier_name'];
236
+    return $this->$method_name($layout_def);
237
+    }
238 238
 
239
-	function displayHeaderCell($layout_def)
240
-	{
241
-				global $start_link_wrapper,$end_link_wrapper;
239
+    function displayHeaderCell($layout_def)
240
+    {
241
+                global $start_link_wrapper,$end_link_wrapper;
242 242
 
243 243
 
244 244
                 // don't show sort links if name isn't defined
@@ -252,22 +252,22 @@  discard block
 block discarded – undo
252 252
 
253 253
                 $sort_by ='';
254 254
                 if ( ! empty($layout_def['table_key']) && ! empty($layout_def['name']) ) {
255
-                	if (! empty($layout_def['group_function']) && $layout_def['group_function'] == 'count') {
255
+                    if (! empty($layout_def['group_function']) && $layout_def['group_function'] == 'count') {
256 256
                         $sort_by = $layout_def['table_key'].":".'count';
257
-                	} else {
258
-                    	$sort_by = $layout_def['table_key'].":".$layout_def['name'];
257
+                    } else {
258
+                        $sort_by = $layout_def['table_key'].":".$layout_def['name'];
259 259
                         if ( ! empty($layout_def['column_function'])) {
260
-                        	$sort_by .= ':'.$layout_def['column_function'];
261
-                		} else if ( ! empty($layout_def['group_function']) ) {
262
-                        	$sort_by .= ':'.$layout_def['group_function'];
263
-                		}
264
-                	}
260
+                            $sort_by .= ':'.$layout_def['column_function'];
261
+                        } else if ( ! empty($layout_def['group_function']) ) {
262
+                            $sort_by .= ':'.$layout_def['group_function'];
263
+                        }
264
+                    }
265 265
                 } else {
266
-                	return $this->displayHeaderCellPlain($layout_def);
266
+                    return $this->displayHeaderCellPlain($layout_def);
267 267
                 }
268 268
 
269 269
                 $start = empty($start_link_wrapper) ? '': $start_link_wrapper;
270
-				$end = empty($end_link_wrapper) ? '': $end_link_wrapper;
270
+                $end = empty($end_link_wrapper) ? '': $end_link_wrapper;
271 271
 
272 272
                 // unable to retrieve the vardef here, exclude columns of type clob/text from being sortable
273 273
 
@@ -277,40 +277,40 @@  discard block
 block discarded – undo
277 277
                     $objListView = new ListView();
278 278
                     $header_cell .= $objListView->getArrowUpDownStart(isset($layout_def['sort']) ? $layout_def['sort'] : '');
279 279
                     $header_cell .= $objListView->getArrowUpDownEnd(isset($layout_def['sort']) ? $layout_def['sort'] : '');
280
-		            $header_cell .= "</a>";
281
-					return $header_cell;
282
-				}
280
+                    $header_cell .= "</a>";
281
+                    return $header_cell;
282
+                }
283 283
 
284
-		        return $this->displayHeaderCellPlain($layout_def);
284
+                return $this->displayHeaderCellPlain($layout_def);
285 285
     }
286 286
 
287
-	function query($layout_def)
288
- 	{
289
-       		 $obj = $this->getSubClass($layout_def);
287
+    function query($layout_def)
288
+        {
289
+                $obj = $this->getSubClass($layout_def);
290 290
 
291
-        	$context = $this->layout_manager->getAttribute('context');
292
-       	 	$func_name = 'query'.$context;
291
+            $context = $this->layout_manager->getAttribute('context');
292
+                $func_name = 'query'.$context;
293 293
 
294
-        	if ( ! empty($context) && method_exists($obj,$func_name))
295
-       		 {
296
-               		 return  $obj->$func_name($layout_def);
297
-        	} else
298
-        	{
299
-                	return '';
300
-		}
301
- 	}
294
+            if ( ! empty($context) && method_exists($obj,$func_name))
295
+                {
296
+                        return  $obj->$func_name($layout_def);
297
+            } else
298
+            {
299
+                    return '';
300
+        }
301
+        }
302 302
 
303
- function _get_column_alias($layout_def)
304
- {
303
+    function _get_column_alias($layout_def)
304
+    {
305 305
         $alias_arr = array();
306 306
 
307
-	if (!empty($layout_def['table_key']) && $layout_def['table_key'] == 'self' && !empty($layout_def['name']) && $layout_def['name'] == 'id')
308
-	{
309
-		return 'primaryid';
310
-	}
307
+    if (!empty($layout_def['table_key']) && $layout_def['table_key'] == 'self' && !empty($layout_def['name']) && $layout_def['name'] == 'id')
308
+    {
309
+        return 'primaryid';
310
+    }
311 311
 
312
-     // Bug: 44605
313
-     // this comment is being added to trigger the upgrade package
312
+        // Bug: 44605
313
+        // this comment is being added to trigger the upgrade package
314 314
         if ( ! empty($layout_def['group_function']) && $layout_def['group_function']=='count')
315 315
         {
316 316
                 return $layout_def['table_alias'] . '__count';
@@ -337,49 +337,49 @@  discard block
 block discarded – undo
337 337
                 array_push($alias_arr,$layout_def['name']);
338 338
         }
339 339
 
340
-		global $used_aliases, $alias_map;
340
+        global $used_aliases, $alias_map;
341 341
 
342 342
         $alias = strtolower(implode("_",$alias_arr));
343 343
 
344 344
         $short_alias = $this->getTruncatedColumnAlias($alias);
345 345
 
346
-		if ( empty($used_aliases[$short_alias]))
347
-		{
348
-			$alias_map[$alias] = $short_alias;
349
-		    $used_aliases[$short_alias] = 1;
350
-          	return $short_alias;
351
-		} else if ( ! empty($alias_map[$alias]) )
352
-		{
353
-			return $alias_map[$alias];
354
-		} else {
355
-			$alias_map[$alias] = $short_alias.'_'.$used_aliases[$short_alias];
356
-		  $used_aliases[$short_alias]++;
357
-			return $alias_map[$alias];
358
-		}
359
- }
360
-
361
- function queryFilterEmpty($layout_def)
362
- {
363
-     $column = $this->_get_column_select($layout_def);
364
-     return "($column IS NULL OR $column = ".$this->reporter->db->emptyValue($layout_def['type']).")";
365
- }
366
-
367
- function queryFilterIs($layout_def)
368
- {
369
- 	return '( '.$this->_get_column_select($layout_def)."='".$GLOBALS['db']->quote($layout_def['input_name0'])."')\n";
370
- }
371
-
372
- function queryFilteris_not($layout_def)
373
- {
374
- 	return '( '.$this->_get_column_select($layout_def)."<>'".$GLOBALS['db']->quote($layout_def['input_name0'])."')\n";
375
- }
376
-
377
- function queryFilterNot_Empty($layout_def)
378
- {
379
-     /** @var $db DBManager */
380
-     $db = $this->reporter->db;
381
-     $column = $this->_get_column_select($layout_def);
382
-     return "(coalesce(" . $db->convert($column, "length") . ",0) > 0)\n";
383
- }
346
+        if ( empty($used_aliases[$short_alias]))
347
+        {
348
+            $alias_map[$alias] = $short_alias;
349
+            $used_aliases[$short_alias] = 1;
350
+                return $short_alias;
351
+        } else if ( ! empty($alias_map[$alias]) )
352
+        {
353
+            return $alias_map[$alias];
354
+        } else {
355
+            $alias_map[$alias] = $short_alias.'_'.$used_aliases[$short_alias];
356
+            $used_aliases[$short_alias]++;
357
+            return $alias_map[$alias];
358
+        }
359
+    }
360
+
361
+    function queryFilterEmpty($layout_def)
362
+    {
363
+        $column = $this->_get_column_select($layout_def);
364
+        return "($column IS NULL OR $column = ".$this->reporter->db->emptyValue($layout_def['type']).")";
365
+    }
366
+
367
+    function queryFilterIs($layout_def)
368
+    {
369
+        return '( '.$this->_get_column_select($layout_def)."='".$GLOBALS['db']->quote($layout_def['input_name0'])."')\n";
370
+    }
371
+
372
+    function queryFilteris_not($layout_def)
373
+    {
374
+        return '( '.$this->_get_column_select($layout_def)."<>'".$GLOBALS['db']->quote($layout_def['input_name0'])."')\n";
375
+    }
376
+
377
+    function queryFilterNot_Empty($layout_def)
378
+    {
379
+        /** @var $db DBManager */
380
+        $db = $this->reporter->db;
381
+        $column = $this->_get_column_select($layout_def);
382
+        return "(coalesce(" . $db->convert($column, "length") . ",0) > 0)\n";
383
+    }
384 384
 
385 385
 }
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
64 64
      */
65
-    function SugarWidgetReportField(&$layout_manager){
65
+    function SugarWidgetReportField(&$layout_manager) {
66 66
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
67
-        if(isset($GLOBALS['log'])) {
67
+        if (isset($GLOBALS['log'])) {
68 68
             $GLOBALS['log']->deprecated($deprecatedMessage);
69 69
         }
70 70
         else {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 	function  getSubClass($layout_def)
78 78
 	{
79
-		if (! empty($layout_def['type']))
79
+		if (!empty($layout_def['type']))
80 80
 		{
81 81
 
82 82
 			if ($layout_def['type'] == 'time') {
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
  {
96 96
         $obj = $this->getSubClass($layout_def);
97 97
 
98
-        $context = $this->layout_manager->getAttribute('context');//_ppd($context);
98
+        $context = $this->layout_manager->getAttribute('context'); //_ppd($context);
99 99
         $func_name = 'display'.$context;
100 100
 
101 101
 
102
-        if ( ! empty($context) && method_exists($obj,$func_name))
102
+        if (!empty($context) && method_exists($obj, $func_name))
103 103
         {
104 104
                 return  $obj->$func_name($layout_def);
105 105
         } else
@@ -111,20 +111,20 @@  discard block
 block discarded – undo
111 111
  function _get_column_select_special($layout_def)
112 112
  {
113 113
  		$alias = '';
114
-		 if ( ! empty($layout_def['table_alias']))
114
+		 if (!empty($layout_def['table_alias']))
115 115
 		 {
116 116
 			$alias = $layout_def['table_alias'];
117 117
 		 }
118 118
 
119
-    if ($layout_def['name'] == 'weighted_sum' )
119
+    if ($layout_def['name'] == 'weighted_sum')
120 120
     {
121
-        return sprintf("SUM(%s * %s * 0.01)", $this->reporter->db->convert("$alias.probability","IFNULL", array(0)),
122
-            $this->reporter->db->convert("$alias.amount_usdollar","IFNULL", array(0)));
121
+        return sprintf("SUM(%s * %s * 0.01)", $this->reporter->db->convert("$alias.probability", "IFNULL", array(0)),
122
+            $this->reporter->db->convert("$alias.amount_usdollar", "IFNULL", array(0)));
123 123
 	}
124
-    if ($layout_def['name'] == 'weighted_amount' )
124
+    if ($layout_def['name'] == 'weighted_amount')
125 125
     {
126
-        return sprintf("AVG(%s * %s * 0.01)", $this->reporter->db->convert("$alias.probability","IFNULL", array(0)),
127
-            $this->reporter->db->convert("$alias.amount_usdollar","IFNULL", array(0)));
126
+        return sprintf("AVG(%s * %s * 0.01)", $this->reporter->db->convert("$alias.probability", "IFNULL", array(0)),
127
+            $this->reporter->db->convert("$alias.amount_usdollar", "IFNULL", array(0)));
128 128
 	}
129 129
  }
130 130
 
@@ -135,15 +135,15 @@  discard block
 block discarded – undo
135 135
  		$reportAlias = array();
136 136
  	}
137 137
 
138
-	if ( ! empty($layout_def['table_alias'])) {
138
+	if (!empty($layout_def['table_alias'])) {
139 139
 		$alias = $layout_def['table_alias'].".".$layout_def['name'];
140
-	} else if (! empty($layout_def['name'])) {
140
+	} else if (!empty($layout_def['name'])) {
141 141
 		$alias = $layout_def['name'];
142 142
 	} else {
143 143
 		$alias = "*";
144 144
 	}
145 145
 
146
-	if ( ! empty($layout_def['group_function']) )
146
+	if (!empty($layout_def['group_function']))
147 147
 	{
148 148
     	if ($layout_def['name'] == 'weighted_sum' || $layout_def['name'] == 'weighted_amount')
149 149
     	{
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             if ($layout_def['group_function'] != 'avg') {
169 169
                 $alias = "{$layout_def['group_function']}($alias/{$query})*{$currency->conversion_rate}";
170 170
             } else {
171
-                $alias = $this->reporter->db->convert("$alias/$query", "AVG") . " * {$currency->conversion_rate}";
171
+                $alias = $this->reporter->db->convert("$alias/$query", "AVG")." * {$currency->conversion_rate}";
172 172
             }
173 173
         } else {
174 174
             // We need to use convert() for AVG because of Oracle
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
  function queryOrderBy($layout_def)
200 200
  {
201 201
      $field_def = array();
202
-	if(!empty($this->reporter->all_fields[$layout_def['column_key']])) $field_def = $this->reporter->all_fields[$layout_def['column_key']];
202
+	if (!empty($this->reporter->all_fields[$layout_def['column_key']])) $field_def = $this->reporter->all_fields[$layout_def['column_key']];
203 203
 
204 204
     if (!empty($layout_def['group_function']))
205 205
     {
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
     elseif (!empty($field_def['sort_on']))
209 209
 	{
210 210
 			$order_by = $layout_def['table_alias'].".".$field_def['sort_on'];
211
-            if(!empty($field_def['sort_on2']))
212
-                $order_by .= ', ' . $layout_def['table_alias'].".".$field_def['sort_on2'];
211
+            if (!empty($field_def['sort_on2']))
212
+                $order_by .= ', '.$layout_def['table_alias'].".".$field_def['sort_on2'];
213 213
     }
214 214
 	else {
215 215
 		$order_by = $this->_get_column_alias($layout_def)." \n";
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
      //use sugar db function convert on order by string to convert to varchar.  This is mainly for db's
219 219
      //that do not allow sorting on clob/text fields
220 220
     if ($this->reporter->db->isTextType($this->reporter->db->getFieldType($field_def))) {
221
-        $order_by = $this->reporter->db->convert($order_by,'text2char', array(10000)); // array(10000) is for db2 only
221
+        $order_by = $this->reporter->db->convert($order_by, 'text2char', array(10000)); // array(10000) is for db2 only
222 222
     }
223 223
 
224
-			if ( empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a')
224
+			if (empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a')
225 225
 			{
226 226
 				return $order_by." ASC";
227 227
 			} else {
@@ -238,27 +238,27 @@  discard block
 block discarded – undo
238 238
 
239 239
 	function displayHeaderCell($layout_def)
240 240
 	{
241
-				global $start_link_wrapper,$end_link_wrapper;
241
+				global $start_link_wrapper, $end_link_wrapper;
242 242
 
243 243
 
244 244
                 // don't show sort links if name isn't defined
245 245
                 $no_sort = $this->layout_manager->getAttribute('no_sort');
246
-                if(empty($layout_def['name']) || ! empty($no_sort) || ! empty($layout_def['no_sort']))
246
+                if (empty($layout_def['name']) || !empty($no_sort) || !empty($layout_def['no_sort']))
247 247
                 {
248 248
                         return $layout_def['label'];
249 249
                 }
250 250
 
251 251
 
252 252
 
253
-                $sort_by ='';
254
-                if ( ! empty($layout_def['table_key']) && ! empty($layout_def['name']) ) {
255
-                	if (! empty($layout_def['group_function']) && $layout_def['group_function'] == 'count') {
253
+                $sort_by = '';
254
+                if (!empty($layout_def['table_key']) && !empty($layout_def['name'])) {
255
+                	if (!empty($layout_def['group_function']) && $layout_def['group_function'] == 'count') {
256 256
                         $sort_by = $layout_def['table_key'].":".'count';
257 257
                 	} else {
258 258
                     	$sort_by = $layout_def['table_key'].":".$layout_def['name'];
259
-                        if ( ! empty($layout_def['column_function'])) {
259
+                        if (!empty($layout_def['column_function'])) {
260 260
                         	$sort_by .= ':'.$layout_def['column_function'];
261
-                		} else if ( ! empty($layout_def['group_function']) ) {
261
+                		} else if (!empty($layout_def['group_function'])) {
262 262
                         	$sort_by .= ':'.$layout_def['group_function'];
263 263
                 		}
264 264
                 	}
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
                 	return $this->displayHeaderCellPlain($layout_def);
267 267
                 }
268 268
 
269
-                $start = empty($start_link_wrapper) ? '': $start_link_wrapper;
270
-				$end = empty($end_link_wrapper) ? '': $end_link_wrapper;
269
+                $start = empty($start_link_wrapper) ? '' : $start_link_wrapper;
270
+				$end = empty($end_link_wrapper) ? '' : $end_link_wrapper;
271 271
 
272 272
                 // unable to retrieve the vardef here, exclude columns of type clob/text from being sortable
273 273
 
274
-                if(!in_array($layout_def['name'], array('description', 'account_description', 'lead_source_description', 'status_description', 'to_addrs', 'cc_addrs', 'bcc_addrs', 'work_log', 'objective', 'resolution'))) {
274
+                if (!in_array($layout_def['name'], array('description', 'account_description', 'lead_source_description', 'status_description', 'to_addrs', 'cc_addrs', 'bcc_addrs', 'work_log', 'objective', 'resolution'))) {
275 275
                     $header_cell = "<a class=\"listViewThLinkS1\" href=\"".$start.$sort_by.$end."\">";
276 276
                     $header_cell .= $this->displayHeaderCellPlain($layout_def);
277 277
                     $objListView = new ListView();
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         	$context = $this->layout_manager->getAttribute('context');
292 292
        	 	$func_name = 'query'.$context;
293 293
 
294
-        	if ( ! empty($context) && method_exists($obj,$func_name))
294
+        	if (!empty($context) && method_exists($obj, $func_name))
295 295
        		 {
296 296
                		 return  $obj->$func_name($layout_def);
297 297
         	} else
@@ -311,44 +311,44 @@  discard block
 block discarded – undo
311 311
 
312 312
      // Bug: 44605
313 313
      // this comment is being added to trigger the upgrade package
314
-        if ( ! empty($layout_def['group_function']) && $layout_def['group_function']=='count')
314
+        if (!empty($layout_def['group_function']) && $layout_def['group_function'] == 'count')
315 315
         {
316
-                return $layout_def['table_alias'] . '__count';
316
+                return $layout_def['table_alias'].'__count';
317 317
         }
318 318
 
319
-        if ( ! empty($layout_def['table_alias']))
319
+        if (!empty($layout_def['table_alias']))
320 320
         {
321
-                array_push($alias_arr,$layout_def['table_alias']);
321
+                array_push($alias_arr, $layout_def['table_alias']);
322 322
         }
323 323
 
324
-        if ( ! empty($layout_def['group_function']) && $layout_def['group_function'] != 'weighted_amount' && $layout_def['group_function'] != 'weighted_sum')
324
+        if (!empty($layout_def['group_function']) && $layout_def['group_function'] != 'weighted_amount' && $layout_def['group_function'] != 'weighted_sum')
325 325
         {
326
-                array_push($alias_arr,$layout_def['group_function']);
327
-        } else if ( ! empty($layout_def['column_function']))
326
+                array_push($alias_arr, $layout_def['group_function']);
327
+        } else if (!empty($layout_def['column_function']))
328 328
         {
329
-                array_push($alias_arr,$layout_def['column_function']);
330
-        } else if ( ! empty($layout_def['qualifier']))
329
+                array_push($alias_arr, $layout_def['column_function']);
330
+        } else if (!empty($layout_def['qualifier']))
331 331
         {
332
-                array_push($alias_arr,$layout_def['qualifier']);
332
+                array_push($alias_arr, $layout_def['qualifier']);
333 333
         }
334 334
 
335
-        if ( ! empty($layout_def['name']))
335
+        if (!empty($layout_def['name']))
336 336
         {
337
-                array_push($alias_arr,$layout_def['name']);
337
+                array_push($alias_arr, $layout_def['name']);
338 338
         }
339 339
 
340 340
 		global $used_aliases, $alias_map;
341 341
 
342
-        $alias = strtolower(implode("_",$alias_arr));
342
+        $alias = strtolower(implode("_", $alias_arr));
343 343
 
344 344
         $short_alias = $this->getTruncatedColumnAlias($alias);
345 345
 
346
-		if ( empty($used_aliases[$short_alias]))
346
+		if (empty($used_aliases[$short_alias]))
347 347
 		{
348 348
 			$alias_map[$alias] = $short_alias;
349 349
 		    $used_aliases[$short_alias] = 1;
350 350
           	return $short_alias;
351
-		} else if ( ! empty($alias_map[$alias]) )
351
+		} else if (!empty($alias_map[$alias]))
352 352
 		{
353 353
 			return $alias_map[$alias];
354 354
 		} else {
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      /** @var $db DBManager */
380 380
      $db = $this->reporter->db;
381 381
      $column = $this->_get_column_select($layout_def);
382
-     return "(coalesce(" . $db->convert($column, "length") . ",0) > 0)\n";
382
+     return "(coalesce(".$db->convert($column, "length").",0) > 0)\n";
383 383
  }
384 384
 
385 385
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -66,8 +68,7 @@  discard block
 block discarded – undo
66 68
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
67 69
         if(isset($GLOBALS['log'])) {
68 70
             $GLOBALS['log']->deprecated($deprecatedMessage);
69
-        }
70
-        else {
71
+        } else {
71 72
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
72 73
         }
73 74
         self::__construct($layout_manager);
@@ -199,19 +200,20 @@  discard block
 block discarded – undo
199 200
  function queryOrderBy($layout_def)
200 201
  {
201 202
      $field_def = array();
202
-	if(!empty($this->reporter->all_fields[$layout_def['column_key']])) $field_def = $this->reporter->all_fields[$layout_def['column_key']];
203
+	if(!empty($this->reporter->all_fields[$layout_def['column_key']])) {
204
+	    $field_def = $this->reporter->all_fields[$layout_def['column_key']];
205
+	}
203 206
 
204 207
     if (!empty($layout_def['group_function']))
205 208
     {
206 209
         $order_by = $this->_get_column_alias($layout_def);
207
-    }
208
-    elseif (!empty($field_def['sort_on']))
210
+    } elseif (!empty($field_def['sort_on']))
209 211
 	{
210 212
 			$order_by = $layout_def['table_alias'].".".$field_def['sort_on'];
211
-            if(!empty($field_def['sort_on2']))
212
-                $order_by .= ', ' . $layout_def['table_alias'].".".$field_def['sort_on2'];
213
-    }
214
-	else {
213
+            if(!empty($field_def['sort_on2'])) {
214
+                            $order_by .= ', ' . $layout_def['table_alias'].".".$field_def['sort_on2'];
215
+            }
216
+    } else {
215 217
 		$order_by = $this->_get_column_alias($layout_def)." \n";
216 218
 	}
217 219
 
Please login to merge, or discard this patch.
include/generic/SugarWidgets/SugarWidgetFieldenum.php 2 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
     /**
49 49
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
50 50
      */
51
-    public function SugarWidgetFieldEnum($layout_manager){
51
+    public function SugarWidgetFieldEnum($layout_manager) {
52 52
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
53
-        if(isset($GLOBALS['log'])) {
53
+        if (isset($GLOBALS['log'])) {
54 54
             $GLOBALS['log']->deprecated($deprecatedMessage);
55 55
         }
56 56
         else {
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
     public function queryFilterEmpty($layout_def)
64 64
     {
65 65
         $column = $this->_get_column_select($layout_def);
66
-        return "(coalesce(" . $this->reporter->db->convert($column, "length") . ",0) = 0 OR $column = '^^')";
66
+        return "(coalesce(".$this->reporter->db->convert($column, "length").",0) = 0 OR $column = '^^')";
67 67
     }
68 68
 
69 69
     public function queryFilterNot_Empty($layout_def)
70 70
     {
71 71
         $column = $this->_get_column_select($layout_def);
72
-        return "(coalesce(" . $this->reporter->db->convert($column, "length") . ",0) > 0 AND $column != '^^' )\n";
72
+        return "(coalesce(".$this->reporter->db->convert($column, "length").",0) > 0 AND $column != '^^' )\n";
73 73
     }
74 74
 
75 75
     public function queryFilteris($layout_def) {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	}
90 90
 
91 91
 	public function queryFilterone_of($layout_def) {
92
-		$arr = array ();
92
+		$arr = array();
93 93
 		foreach ($layout_def['input_name0'] as $value) {
94 94
 			$arr[] = $this->reporter->db->quoted($value);
95 95
 		}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 	public function queryFilternot_one_of($layout_def) {
101
-		$arr = array ();
101
+		$arr = array();
102 102
 		foreach ($layout_def['input_name0'] as $value) {
103 103
 			$arr[] = $this->reporter->db->quoted($value);
104 104
 		}
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	}
109 109
 
110 110
     function & displayList($layout_def) {
111
-        if(!empty($layout_def['column_key'])){
111
+        if (!empty($layout_def['column_key'])) {
112 112
             $field_def = $this->reporter->all_fields[$layout_def['column_key']];
113
-        }else if(!empty($layout_def['fields'])){
113
+        } else if (!empty($layout_def['fields'])) {
114 114
             $field_def = $layout_def['fields'];
115 115
         }
116 116
         $cell = $this->displayListPlain($layout_def);
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
                 $record = $layout_def['fields'][$key];
130 130
                 $field_name = $field_def['name'];
131 131
                 $field_type = $field_def['type'];
132
-                $div_id = $field_def['module'] ."&$record&$field_name";
133
-                $str = "<div id='$div_id'>" . $cell . "&nbsp;"
132
+                $div_id = $field_def['module']."&$record&$field_name";
133
+                $str = "<div id='$div_id'>".$cell."&nbsp;"
134 134
                      . SugarThemeRegistry::current()->getImage(
135 135
                         "edit_inline",
136
-                        "border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(" .
136
+                        "border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(".
137 137
                         "\"$div_id\",\"$cell\",\"$module\",\"$record\",\"$field_name\",\"$field_type\");'"
138 138
                        )
139 139
                      . "</div>";
@@ -142,25 +142,25 @@  discard block
 block discarded – undo
142 142
         return $str;
143 143
     }
144 144
 	function & displayListPlain($layout_def) {
145
-		if(!empty($layout_def['column_key'])){
145
+		if (!empty($layout_def['column_key'])) {
146 146
 			$field_def = $this->reporter->all_fields[$layout_def['column_key']];
147
-		}else if(!empty($layout_def['fields'])){
147
+		} else if (!empty($layout_def['fields'])) {
148 148
 			$field_def = $layout_def['fields'];
149 149
 		}
150 150
 
151
-		if (!empty($layout_def['table_key'] ) &&( empty ($field_def['fields']) || empty ($field_def['fields'][0]) || empty ($field_def['fields'][1]))){
151
+		if (!empty($layout_def['table_key']) && (empty ($field_def['fields']) || empty ($field_def['fields'][0]) || empty ($field_def['fields'][1]))) {
152 152
 			$value = $this->_get_list_value($layout_def);
153
-		}else if(!empty($layout_def['name']) && !empty($layout_def['fields'])){
153
+		} else if (!empty($layout_def['name']) && !empty($layout_def['fields'])) {
154 154
 			$key = strtoupper($layout_def['name']);
155 155
 			$value = $layout_def['fields'][$key];
156 156
 		}
157 157
 		$cell = '';
158 158
 
159
-			if(isset($field_def['options'])){
159
+			if (isset($field_def['options'])) {
160 160
 				$cell = translate($field_def['options'], $field_def['module'], $value);
161
-			}else if(isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])){
161
+			} else if (isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])) {
162 162
 	            global $beanFiles;
163
-	            if(empty($beanFiles)) {
163
+	            if (empty($beanFiles)) {
164 164
 	                include('include/modules.php');
165 165
 	            }
166 166
 	            $bean_name = get_singular_bean_name($field_def['module']);
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
 
173 173
 			//#22632
174 174
 			$value = unencodeMultienum($value);
175
-			$cell=array();
176
-			foreach($value as $val){
177
-				$returnVal = translate($field_def['options'],$field_def['module'],$val);
178
-				if(!is_array($returnVal)){
179
-					array_push( $cell, translate($field_def['options'],$field_def['module'],$val));
175
+			$cell = array();
176
+			foreach ($value as $val) {
177
+				$returnVal = translate($field_def['options'], $field_def['module'], $val);
178
+				if (!is_array($returnVal)) {
179
+					array_push($cell, translate($field_def['options'], $field_def['module'], $val));
180 180
 				}
181 181
 			}
182
-			$cell = implode(", ",$cell);
182
+			$cell = implode(", ", $cell);
183 183
 		}
184 184
 		return $cell;
185 185
 	}
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 			$order_by = $this->_get_column_select($layout_def);
193 193
 		}
194 194
 		$list = array();
195
-        if(isset($field_def['options'])) {
195
+        if (isset($field_def['options'])) {
196 196
 		    $list = translate($field_def['options'], $field_def['module']);
197
-        } elseif(isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])) {
197
+        } elseif (isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])) {
198 198
 	        global $beanFiles;
199
-		    if(empty($beanFiles)) {
199
+		    if (empty($beanFiles)) {
200 200
 		        include('include/modules.php');
201 201
 		    }
202 202
 		    $bean_name = get_singular_bean_name($field_def['module']);
@@ -214,17 +214,17 @@  discard block
 block discarded – undo
214 214
     public function displayInput($layout_def) {
215 215
         global $app_list_strings;
216 216
 
217
-        if(!empty($layout_def['remove_blank']) && $layout_def['remove_blank']) {
218
-            if ( isset($layout_def['options']) &&  is_array($layout_def['options']) ) {
217
+        if (!empty($layout_def['remove_blank']) && $layout_def['remove_blank']) {
218
+            if (isset($layout_def['options']) && is_array($layout_def['options'])) {
219 219
                 $ops = $layout_def['options'];
220 220
             }
221
-            elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){
221
+            elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])) {
222 222
             	$ops = $app_list_strings[$layout_def['options']];
223
-                if(array_key_exists('', $app_list_strings[$layout_def['options']])) {
223
+                if (array_key_exists('', $app_list_strings[$layout_def['options']])) {
224 224
              	   unset($ops['']);
225 225
 	            }
226 226
             }
227
-            else{
227
+            else {
228 228
             	$ops = array();
229 229
             }
230 230
         }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             $ops = $app_list_strings[$layout_def['options']];
233 233
         }
234 234
 
235
-        $str = '<select multiple="true" size="3" name="' . $layout_def['name'] . '[]">';
235
+        $str = '<select multiple="true" size="3" name="'.$layout_def['name'].'[]">';
236 236
         $str .= get_select_options_with_id($ops, $layout_def['input_name0']);
237 237
         $str .= '</select>';
238 238
         return $str;
Please login to merge, or discard this patch.
Braces   +11 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -52,8 +54,7 @@  discard block
 block discarded – undo
52 54
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
53 55
         if(isset($GLOBALS['log'])) {
54 56
             $GLOBALS['log']->deprecated($deprecatedMessage);
55
-        }
56
-        else {
57
+        } else {
57 58
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
58 59
         }
59 60
         self::__construct($layout_manager);
@@ -110,7 +111,7 @@  discard block
 block discarded – undo
110 111
     function & displayList($layout_def) {
111 112
         if(!empty($layout_def['column_key'])){
112 113
             $field_def = $this->reporter->all_fields[$layout_def['column_key']];
113
-        }else if(!empty($layout_def['fields'])){
114
+        } else if(!empty($layout_def['fields'])){
114 115
             $field_def = $layout_def['fields'];
115 116
         }
116 117
         $cell = $this->displayListPlain($layout_def);
@@ -144,13 +145,13 @@  discard block
 block discarded – undo
144 145
 	function & displayListPlain($layout_def) {
145 146
 		if(!empty($layout_def['column_key'])){
146 147
 			$field_def = $this->reporter->all_fields[$layout_def['column_key']];
147
-		}else if(!empty($layout_def['fields'])){
148
+		} else if(!empty($layout_def['fields'])){
148 149
 			$field_def = $layout_def['fields'];
149 150
 		}
150 151
 
151 152
 		if (!empty($layout_def['table_key'] ) &&( empty ($field_def['fields']) || empty ($field_def['fields'][0]) || empty ($field_def['fields'][1]))){
152 153
 			$value = $this->_get_list_value($layout_def);
153
-		}else if(!empty($layout_def['name']) && !empty($layout_def['fields'])){
154
+		} else if(!empty($layout_def['name']) && !empty($layout_def['fields'])){
154 155
 			$key = strtoupper($layout_def['name']);
155 156
 			$value = $layout_def['fields'][$key];
156 157
 		}
@@ -158,7 +159,7 @@  discard block
 block discarded – undo
158 159
 
159 160
 			if(isset($field_def['options'])){
160 161
 				$cell = translate($field_def['options'], $field_def['module'], $value);
161
-			}else if(isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])){
162
+			} else if(isset($field_def['type']) && $field_def['type'] == 'enum' && isset($field_def['function'])){
162 163
 	            global $beanFiles;
163 164
 	            if(empty($beanFiles)) {
164 165
 	                include('include/modules.php');
@@ -217,18 +218,15 @@  discard block
 block discarded – undo
217 218
         if(!empty($layout_def['remove_blank']) && $layout_def['remove_blank']) {
218 219
             if ( isset($layout_def['options']) &&  is_array($layout_def['options']) ) {
219 220
                 $ops = $layout_def['options'];
220
-            }
221
-            elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){
221
+            } elseif (isset($layout_def['options']) && isset($app_list_strings[$layout_def['options']])){
222 222
             	$ops = $app_list_strings[$layout_def['options']];
223 223
                 if(array_key_exists('', $app_list_strings[$layout_def['options']])) {
224 224
              	   unset($ops['']);
225 225
 	            }
226
-            }
227
-            else{
226
+            } else{
228 227
             	$ops = array();
229 228
             }
230
-        }
231
-        else {
229
+        } else {
232 230
             $ops = $app_list_strings[$layout_def['options']];
233 231
         }
234 232
 
Please login to merge, or discard this patch.
include/generic/SugarWidgets/SugarWidgetFieldcurrency.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 
49 49
 function get_currency()
50 50
 {
51
-        global $current_user,$global_currency_obj;
51
+        global $current_user, $global_currency_obj;
52 52
         if (empty($global_currency_obj))
53 53
         {
54 54
         $global_currency_obj = new Currency();
55 55
       //  $global_currency_symbol = '$';
56 56
 
57
-        if($current_user->getPreference('currency') )
57
+        if ($current_user->getPreference('currency'))
58 58
         {
59 59
                 $global_currency_obj->retrieve($current_user->getPreference('currency'));
60 60
         }
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
     /**
78 78
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
79 79
      */
80
-    function SugarWidgetFieldCurrency(&$layout_manager){
80
+    function SugarWidgetFieldCurrency(&$layout_manager) {
81 81
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
82
-        if(isset($GLOBALS['log'])) {
82
+        if (isset($GLOBALS['log'])) {
83 83
             $GLOBALS['log']->deprecated($deprecatedMessage);
84 84
         }
85 85
         else {
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
             $currency_id = $locale->getPrecedentPreference('currency');
98 98
 
99 99
             // If it's not grouped, or if it's grouped around a system currency column, look up the currency symbol so we can display it next to the amount
100
-            if ( empty($layout_def['group_function']) || $this->isSystemCurrency($layout_def) ) {
100
+            if (empty($layout_def['group_function']) || $this->isSystemCurrency($layout_def)) {
101 101
                 $c = $this->getCurrency($layout_def);
102
-                if(!empty($c['currency_id']) && !empty($c['currency_symbol']))
102
+                if (!empty($c['currency_id']) && !empty($c['currency_symbol']))
103 103
                 {
104 104
                     $symbol = $c['currency_symbol'];
105 105
                     $currency_id = $c['currency_id'];
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
             $layout_def['currency_id'] = $currency_id;
110 110
             $display = $this->displayListPlain($layout_def);
111 111
 
112
-        if(!empty($layout_def['column_key'])){
112
+        if (!empty($layout_def['column_key'])) {
113 113
             $field_def = $this->reporter->all_fields[$layout_def['column_key']];
114
-        }else if(!empty($layout_def['fields'])){
114
+        } else if (!empty($layout_def['fields'])) {
115 115
             $field_def = $layout_def['fields'];
116 116
         }
117 117
         $record = '';
118 118
         if ($layout_def['table_key'] == 'self' && isset($layout_def['fields']['PRIMARYID']))
119 119
             $record = $layout_def['fields']['PRIMARYID'];
120
-        else if (isset($layout_def['fields'][strtoupper($layout_def['table_alias']."_id")])){
120
+        else if (isset($layout_def['fields'][strtoupper($layout_def['table_alias']."_id")])) {
121 121
             $record = $layout_def['fields'][strtoupper($layout_def['table_alias']."_id")];
122 122
         }
123 123
         if (!empty($record)) {
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
 	        $field_type = $field_def['type'];
126 126
 	        $module = $field_def['module'];
127 127
 
128
-	        $div_id = $module ."&$record&$field_name";
128
+	        $div_id = $module."&$record&$field_name";
129 129
 	        $str = "<div id='$div_id'>".$display;
130 130
             global $sugar_config;
131 131
             if (isset ($sugar_config['enable_inline_reports_edit']) && $sugar_config['enable_inline_reports_edit']) {
132
-                $str .= "&nbsp;" .SugarThemeRegistry::current()->getImage("edit_inline","border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(\"$div_id\",\"$value\",\"$module\",\"$record\",\"$field_name\",\"$field_type\",\"$currency_id\",\"$symbol\");'");
132
+                $str .= "&nbsp;".SugarThemeRegistry::current()->getImage("edit_inline", "border='0' alt='Edit Layout' align='bottom' onClick='SUGAR.reportsInlineEdit.inlineEdit(\"$div_id\",\"$value\",\"$module\",\"$record\",\"$field_name\",\"$field_type\",\"$currency_id\",\"$symbol\");'");
133 133
             }
134 134
 	        $str .= "</div>";
135 135
 	        return $str;
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
      return $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))."\n";
171 171
  }
172 172
 
173
- function queryFilterBetween(&$layout_def){
174
-     return $this->_get_column_select($layout_def)." > ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0'])). " AND ". $this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name1']))."\n";
173
+ function queryFilterBetween(&$layout_def) {
174
+     return $this->_get_column_select($layout_def)." > ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name0']))." AND ".$this->_get_column_select($layout_def)." < ".$GLOBALS['db']->quote(unformat_number($layout_def['input_name1']))."\n";
175 175
  }
176 176
 
177 177
  function isSystemCurrency(&$layout_def)
178 178
  {
179
-     if (strpos($layout_def['name'],'_usdoll') === false) {
179
+     if (strpos($layout_def['name'], '_usdoll') === false) {
180 180
          return false;
181 181
      } else {
182 182
          return true;
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
  {
188 188
     // add currency column to select
189 189
     $table = $this->getCurrencyIdTable($layout_def);
190
-    if($table) {
191
-        return $this->_get_column_select($layout_def)." ".$this->_get_column_alias($layout_def)." , ".$table.".currency_id ". $this->getTruncatedColumnAlias($this->_get_column_alias($layout_def)."_currency") . "\n";
190
+    if ($table) {
191
+        return $this->_get_column_select($layout_def)." ".$this->_get_column_alias($layout_def)." , ".$table.".currency_id ".$this->getTruncatedColumnAlias($this->_get_column_alias($layout_def)."_currency")."\n";
192 192
     }
193 193
     return $this->_get_column_select($layout_def)." ".$this->_get_column_alias($layout_def)."\n";
194 194
  }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
  {
198 198
     // add currency column to group by
199 199
     $table = $this->getCurrencyIdTable($layout_def);
200
-    if($table) {
200
+    if ($table) {
201 201
         return $this->_get_column_select($layout_def)." , ".$table.".currency_id \n";
202 202
     }
203 203
     return $this->_get_column_select($layout_def)." \n";
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
  function getCurrencyIdTable($layout_def)
207 207
  {
208 208
     // We need to fetch the currency id as well
209
-    if ( !$this->isSystemCurrency($layout_def) && empty($layout_def['group_function'])) {
209
+    if (!$this->isSystemCurrency($layout_def) && empty($layout_def['group_function'])) {
210 210
 
211
-        if ( !empty($layout_def['table_alias']) ) {
211
+        if (!empty($layout_def['table_alias'])) {
212 212
             $table = $layout_def['table_alias'];
213 213
         } else {
214 214
             $table = '';
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
             $real_table = $this->reporter->all_fields[$layout_def['column_key']]['real_table'];
220 220
 
221 221
         $add_currency_id = false;
222
-        if(!empty($table)) {
222
+        if (!empty($table)) {
223 223
             $cols = $GLOBALS['db']->getHelper()->get_columns($real_table);
224 224
             $add_currency_id = isset($cols['currency_id']) ? true : false;
225 225
 
226
-            if(!$add_currency_id && preg_match('/.*?_cstm$/i', $real_table)) {
226
+            if (!$add_currency_id && preg_match('/.*?_cstm$/i', $real_table)) {
227 227
                 $table = str_replace('_cstm', '', $table);
228 228
                 $cols = $GLOBALS['db']->getHelper()->get_columns($table);
229 229
                 $add_currency_id = isset($cols['currency_id']) ? true : false;
230 230
             }
231
-            if($add_currency_id) {
231
+            if ($add_currency_id) {
232 232
                 return $table;
233 233
             }
234 234
         }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     {
246 246
         $currency_id = false;
247 247
         $currency_symbol = false;
248
-        if(isset($layout_def['currency_symbol']) && isset($layout_def['currency_id']))
248
+        if (isset($layout_def['currency_symbol']) && isset($layout_def['currency_id']))
249 249
         {
250 250
             $currency_symbol = $layout_def['currency_symbol'];
251 251
             $currency_id = $layout_def['currency_id'];
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         else
254 254
         {
255 255
             $key = strtoupper(isset($layout_def['varname']) ? $layout_def['varname'] : $this->_get_column_alias($layout_def));
256
-            if ( $this->isSystemCurrency($layout_def) )
256
+            if ($this->isSystemCurrency($layout_def))
257 257
             {
258 258
                 $currency_id = '-99';
259 259
             }
@@ -261,14 +261,14 @@  discard block
 block discarded – undo
261 261
             {
262 262
                 $currency_id = $layout_def['fields'][$key.'_CURRENCY'];
263 263
             }
264
-            elseif(isset($layout_def['fields'][$this->getTruncatedColumnAlias($this->_get_column_alias($layout_def)."_currency")]))
264
+            elseif (isset($layout_def['fields'][$this->getTruncatedColumnAlias($this->_get_column_alias($layout_def)."_currency")]))
265 265
             {
266 266
                 $currency_id = $layout_def['fields'][$this->getTruncatedColumnAlias($this->_get_column_alias($layout_def)."_currency")];
267 267
             }
268
-            if($currency_id)
268
+            if ($currency_id)
269 269
             {
270 270
                 $currency = BeanFactory::getBean('Currencies', $currency_id);
271
-                if(!empty($currency ->symbol))
271
+                if (!empty($currency ->symbol))
272 272
                 {
273 273
                     $currency_symbol = $currency ->symbol;
274 274
                 }
Please login to merge, or discard this patch.
Braces   +17 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -57,8 +59,7 @@  discard block
 block discarded – undo
57 59
         if($current_user->getPreference('currency') )
58 60
         {
59 61
                 $global_currency_obj->retrieve($current_user->getPreference('currency'));
60
-        }
61
-        else
62
+        } else
62 63
         {
63 64
                 $global_currency_obj->retrieve('-99');
64 65
         }
@@ -81,8 +82,7 @@  discard block
 block discarded – undo
81 82
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
82 83
         if(isset($GLOBALS['log'])) {
83 84
             $GLOBALS['log']->deprecated($deprecatedMessage);
84
-        }
85
-        else {
85
+        } else {
86 86
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
87 87
         }
88 88
         self::__construct($layout_manager);
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 
112 112
         if(!empty($layout_def['column_key'])){
113 113
             $field_def = $this->reporter->all_fields[$layout_def['column_key']];
114
-        }else if(!empty($layout_def['fields'])){
114
+        } else if(!empty($layout_def['fields'])){
115 115
             $field_def = $layout_def['fields'];
116 116
         }
117 117
         $record = '';
118
-        if ($layout_def['table_key'] == 'self' && isset($layout_def['fields']['PRIMARYID']))
119
-            $record = $layout_def['fields']['PRIMARYID'];
120
-        else if (isset($layout_def['fields'][strtoupper($layout_def['table_alias']."_id")])){
118
+        if ($layout_def['table_key'] == 'self' && isset($layout_def['fields']['PRIMARYID'])) {
119
+                    $record = $layout_def['fields']['PRIMARYID'];
120
+        } else if (isset($layout_def['fields'][strtoupper($layout_def['table_alias']."_id")])){
121 121
             $record = $layout_def['fields'][strtoupper($layout_def['table_alias']."_id")];
122 122
         }
123 123
         if (!empty($record)) {
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
             }
134 134
 	        $str .= "</div>";
135 135
 	        return $str;
136
+        } else {
137
+                    return $display;
136 138
         }
137
-        else
138
-            return $display;
139 139
     }
140 140
 
141 141
     function displayListPlain($layout_def) {
@@ -215,8 +215,9 @@  discard block
 block discarded – undo
215 215
         }
216 216
 
217 217
         $real_table = '';
218
-        if (!empty($this->reporter->all_fields[$layout_def['column_key']]['real_table']))
219
-            $real_table = $this->reporter->all_fields[$layout_def['column_key']]['real_table'];
218
+        if (!empty($this->reporter->all_fields[$layout_def['column_key']]['real_table'])) {
219
+                    $real_table = $this->reporter->all_fields[$layout_def['column_key']]['real_table'];
220
+        }
220 221
 
221 222
         $add_currency_id = false;
222 223
         if(!empty($table)) {
@@ -249,19 +250,16 @@  discard block
 block discarded – undo
249 250
         {
250 251
             $currency_symbol = $layout_def['currency_symbol'];
251 252
             $currency_id = $layout_def['currency_id'];
252
-        }
253
-        else
253
+        } else
254 254
         {
255 255
             $key = strtoupper(isset($layout_def['varname']) ? $layout_def['varname'] : $this->_get_column_alias($layout_def));
256 256
             if ( $this->isSystemCurrency($layout_def) )
257 257
             {
258 258
                 $currency_id = '-99';
259
-            }
260
-            elseif (isset($layout_def['fields'][$key.'_CURRENCY']))
259
+            } elseif (isset($layout_def['fields'][$key.'_CURRENCY']))
261 260
             {
262 261
                 $currency_id = $layout_def['fields'][$key.'_CURRENCY'];
263
-            }
264
-            elseif(isset($layout_def['fields'][$this->getTruncatedColumnAlias($this->_get_column_alias($layout_def)."_currency")]))
262
+            } elseif(isset($layout_def['fields'][$this->getTruncatedColumnAlias($this->_get_column_alias($layout_def)."_currency")]))
265 263
             {
266 264
                 $currency_id = $layout_def['fields'][$this->getTruncatedColumnAlias($this->_get_column_alias($layout_def)."_currency")];
267 265
             }
Please login to merge, or discard this patch.
include/generic/SugarWidgets/SugarWidgetSubPanelTopSelectUsersButton.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
 class SugarWidgetSubPanelTopSelectUsersButton extends SugarWidgetSubPanelTopSelectButton
47 47
 {
48 48
 	//button_properties is a collection of properties associated with the widget_class definition. layoutmanager
49
-	function __construct($button_properties=array())
49
+	function __construct($button_properties = array())
50 50
 	{
51
-		$this->button_properties=$button_properties;
51
+		$this->button_properties = $button_properties;
52 52
 	}
53 53
 
54 54
     /**
55 55
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
56 56
      */
57
-    function SugarWidgetSubPanelTopSelectUsersButton($button_properties=array()){
57
+    function SugarWidgetSubPanelTopSelectUsersButton($button_properties = array()) {
58 58
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
59
-        if(isset($GLOBALS['log'])) {
59
+        if (isset($GLOBALS['log'])) {
60 60
             $GLOBALS['log']->deprecated($deprecatedMessage);
61 61
         }
62 62
         else {
@@ -83,32 +83,32 @@  discard block
 block discarded – undo
83 83
 		$this->module_name = 'Users';
84 84
 
85 85
 		if (is_array($this->button_properties)) {
86
-			if( isset($this->button_properties['title'])) {
86
+			if (isset($this->button_properties['title'])) {
87 87
 				$this->title = $app_strings[$this->button_properties['title']];
88 88
 			}
89
-			if( isset($this->button_properties['accesskey'])) {
89
+			if (isset($this->button_properties['accesskey'])) {
90 90
 				//$this->accesskey = $app_strings[$this->button_properties['accesskey']];
91 91
 			}
92
-			if( isset($this->button_properties['form_value'])) {
92
+			if (isset($this->button_properties['form_value'])) {
93 93
 				$this->value = $app_strings[$this->button_properties['form_value']];
94 94
 			}
95
-			if( isset($this->button_properties['module'])) {
95
+			if (isset($this->button_properties['module'])) {
96 96
 				$this->module_name = $this->button_properties['module'];
97 97
 			}
98 98
 		}
99 99
 
100 100
 		$focus = $widget_data['focus'];
101
-		if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){
102
-			$button = ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n"
103
-			. ' title="' . $this->title . '"'
104
-			. ' value="' . $this->value . "\"\n"
101
+		if (ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)) {
102
+			$button = ' <input type="button" name="'.$this->getWidgetId().'" id="'.$this->getWidgetId().'" class="button"'."\"\n"
103
+			. ' title="'.$this->title.'"'
104
+			. ' value="'.$this->value."\"\n"
105 105
 			.' disabled />';
106 106
 			return $button;
107 107
 		}
108 108
 
109 109
 		//refresh the whole page after end of action?
110 110
 		$refresh_page = 0;
111
-		if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){
111
+		if (!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])) {
112 112
 			$refresh_page = 1;
113 113
 		}
114 114
 
@@ -120,43 +120,43 @@  discard block
 block discarded – undo
120 120
 			$this->module_name = $subpanel_name;
121 121
 		}
122 122
 
123
-		if ($subpanel_name == 'Project'){
123
+		if ($subpanel_name == 'Project') {
124 124
 			$link_field_name = 'project_users_1';
125 125
 		}
126
-		else{
126
+		else {
127 127
 			$link_field_name = $subpanel_definition->get_data_source_name(true);
128 128
 		}
129 129
 
130
-		$popup_mode='Single';
131
-		if(isset($widget_data['mode'])){
132
-			$popup_mode=$widget_data['mode'];
130
+		$popup_mode = 'Single';
131
+		if (isset($widget_data['mode'])) {
132
+			$popup_mode = $widget_data['mode'];
133 133
 		}
134
-		if(isset($widget_data['initial_filter_fields'])){
134
+		if (isset($widget_data['initial_filter_fields'])) {
135 135
 			if (is_array($widget_data['initial_filter_fields'])) {
136 136
 				foreach ($widget_data['initial_filter_fields'] as $value=>$alias) {
137 137
 					if (isset($focus->$value) and !empty($focus->$value)) {
138
-						$initial_filter.="&".$alias . '='.urlencode($focus->$value);
138
+						$initial_filter .= "&".$alias.'='.urlencode($focus->$value);
139 139
 					}
140 140
 				}
141 141
 			}
142 142
 		}
143 143
 
144 144
 		if (!empty($widget_data['filter_out_is_admin'])) {
145
-            $initial_filter.="&is_admin_advanced=0";
145
+            $initial_filter .= "&is_admin_advanced=0";
146 146
         }
147 147
 
148
-		$create="true";
149
-		if(isset($widget_data['create'])){
150
-			$create=$widget_data['create'];
148
+		$create = "true";
149
+		if (isset($widget_data['create'])) {
150
+			$create = $widget_data['create'];
151 151
 		}
152 152
 		$return_module = $_REQUEST['module'];
153 153
 		$return_action = 'SubPanelViewer';
154 154
 		$return_id = $_REQUEST['record'];
155 155
 
156 156
 		//field_to_name_array
157
-		$fton_array= array('id' => 'subpanel_id');
158
-		if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){
159
-			$fton_array=array_merge($fton_array,$widget_data['field_to_name_array']);
157
+		$fton_array = array('id' => 'subpanel_id');
158
+		if (isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])) {
159
+			$fton_array = array_merge($fton_array, $widget_data['field_to_name_array']);
160 160
 		}
161 161
 
162 162
 		$return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1";
@@ -175,21 +175,21 @@  discard block
 block discarded – undo
175 175
 		);
176 176
 
177 177
 		if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) {
178
-			$popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']);
178
+			$popup_request_data['passthru_data'] = array_merge($popup_request_data['passthru_data'], $this->button_properties['add_to_passthru_data']);
179 179
 		}
180 180
 
181 181
 		if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) {
182 182
 
183
-			if ($this->button_properties['add_to_passthru_data']['return_type']=='report') {
184
-				$initial_filter = "&module_name=". urlencode($widget_data['module']);
183
+			if ($this->button_properties['add_to_passthru_data']['return_type'] == 'report') {
184
+				$initial_filter = "&module_name=".urlencode($widget_data['module']);
185 185
 			}
186 186
 		}
187 187
 		$json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data);
188 188
 
189
-		return '<form action="index.php">' . "\n"
190
-			. ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n"
191
-				. ' title="' . $this->title . '"'
192
-			. ' value="' . $this->value . "\"\n"
189
+		return '<form action="index.php">'."\n"
190
+			. ' <input type="button" name="'.$this->getWidgetId().'" id="'.$this->getWidgetId().'" class="button"'."\"\n"
191
+				. ' title="'.$this->title.'"'
192
+			. ' value="'.$this->value."\"\n"
193 193
 			. " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' /></form>\n";
194 194
 	}
195 195
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -58,8 +60,7 @@  discard block
 block discarded – undo
58 60
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
59 61
         if(isset($GLOBALS['log'])) {
60 62
             $GLOBALS['log']->deprecated($deprecatedMessage);
61
-        }
62
-        else {
63
+        } else {
63 64
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
64 65
         }
65 66
         self::__construct($button_properties);
@@ -123,8 +124,7 @@  discard block
 block discarded – undo
123 124
 
124 125
 		if ($subpanel_name == 'Project'){
125 126
 			$link_field_name = 'project_contacts_1';
126
-		}
127
-		else{
127
+		} else{
128 128
 			$link_field_name = $subpanel_definition->get_data_source_name(true);
129 129
 		}
130 130
 
Please login to merge, or discard this patch.
include/generic/SugarWidgets/SugarWidgetFieldlong.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
     /**
59 59
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
60 60
      */
61
-    function SugarWidgetFieldLong(&$layout_manager){
61
+    function SugarWidgetFieldLong(&$layout_manager) {
62 62
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
63
-        if(isset($GLOBALS['log'])) {
63
+        if (isset($GLOBALS['log'])) {
64 64
             $GLOBALS['log']->deprecated($deprecatedMessage);
65 65
         }
66 66
         else {
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
  * Date: 06/03/15
44 44
  * Comments
45 45
  */
46
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
46
+if(!defined('sugarEntry') || !sugarEntry) {
47
+    die('Not A Valid Entry Point');
48
+}
47 49
 
48 50
 class CasesController extends SugarController {
49 51
 
@@ -90,8 +92,7 @@  discard block
 block discarded – undo
90 92
                 $count++;
91 93
             }
92 94
             echo '</table>';
93
-        }
94
-        else {
95
+        } else {
95 96
             echo $mod_strings['LBL_NO_SUGGESTIONS'];
96 97
         }
97 98
         die();
Please login to merge, or discard this patch.
include/generic/SugarWidgets/SugarWidgetSubPanelTopSelectContactsButton.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
 class SugarWidgetSubPanelTopSelectContactsButton extends SugarWidgetSubPanelTopSelectButton
47 47
 {
48 48
 	//button_properties is a collection of properties associated with the widget_class definition. layoutmanager
49
-	function __construct($button_properties=array())
49
+	function __construct($button_properties = array())
50 50
 	{
51
-		$this->button_properties=$button_properties;
51
+		$this->button_properties = $button_properties;
52 52
 	}
53 53
 
54 54
     /**
55 55
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
56 56
      */
57
-    function SugarWidgetSubPanelTopSelectContactsButton($button_properties=array()){
57
+    function SugarWidgetSubPanelTopSelectContactsButton($button_properties = array()) {
58 58
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
59
-        if(isset($GLOBALS['log'])) {
59
+        if (isset($GLOBALS['log'])) {
60 60
             $GLOBALS['log']->deprecated($deprecatedMessage);
61 61
         }
62 62
         else {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     public function getWidgetId($buttonSuffix = true)
70 70
     {
71
-        return parent::getWidgetId() . '_select_button';
71
+        return parent::getWidgetId().'_select_button';
72 72
     }
73 73
 
74 74
 	//widget_data is the collection of attributes associated with the button in the layout_defs file.
@@ -84,32 +84,32 @@  discard block
 block discarded – undo
84 84
 		$this->module_name = 'Contacts';
85 85
 
86 86
 		if (is_array($this->button_properties)) {
87
-			if( isset($this->button_properties['title'])) {
87
+			if (isset($this->button_properties['title'])) {
88 88
 				$this->title = $app_strings[$this->button_properties['title']];
89 89
 			}
90
-			if( isset($this->button_properties['accesskey'])) {
90
+			if (isset($this->button_properties['accesskey'])) {
91 91
 				//$this->accesskey = $app_strings[$this->button_properties['accesskey']];
92 92
 			}
93
-			if( isset($this->button_properties['form_value'])) {
93
+			if (isset($this->button_properties['form_value'])) {
94 94
 				$this->value = $app_strings[$this->button_properties['form_value']];
95 95
 			}
96
-			if( isset($this->button_properties['module'])) {
96
+			if (isset($this->button_properties['module'])) {
97 97
 				$this->module_name = $this->button_properties['module'];
98 98
 			}
99 99
 		}
100 100
 
101 101
 		$focus = $widget_data['focus'];
102
-		if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){
103
-			$button = ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n"
104
-			. ' title="' . $this->title . '"'
105
-			. ' value="' . $this->value . "\"\n"
102
+		if (ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)) {
103
+			$button = ' <input type="button" name="'.$this->getWidgetId().'" id="'.$this->getWidgetId().'" class="button"'."\"\n"
104
+			. ' title="'.$this->title.'"'
105
+			. ' value="'.$this->value."\"\n"
106 106
 			.' disabled />';
107 107
 			return $button;
108 108
 		}
109 109
 
110 110
 		//refresh the whole page after end of action?
111 111
 		$refresh_page = 0;
112
-		if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){
112
+		if (!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])) {
113 113
 			$refresh_page = 1;
114 114
 		}
115 115
 
@@ -121,38 +121,38 @@  discard block
 block discarded – undo
121 121
 			$this->module_name = $subpanel_name;
122 122
 		}
123 123
 
124
-		if ($subpanel_name == 'Project'){
124
+		if ($subpanel_name == 'Project') {
125 125
 			$link_field_name = 'project_contacts_1';
126 126
 		}
127
-		else{
127
+		else {
128 128
 			$link_field_name = $subpanel_definition->get_data_source_name(true);
129 129
 		}
130 130
 
131
-		$popup_mode='Single';
132
-		if(isset($widget_data['mode'])){
133
-			$popup_mode=$widget_data['mode'];
131
+		$popup_mode = 'Single';
132
+		if (isset($widget_data['mode'])) {
133
+			$popup_mode = $widget_data['mode'];
134 134
 		}
135
-		if(isset($widget_data['initial_filter_fields'])){
135
+		if (isset($widget_data['initial_filter_fields'])) {
136 136
 			if (is_array($widget_data['initial_filter_fields'])) {
137 137
 				foreach ($widget_data['initial_filter_fields'] as $value=>$alias) {
138 138
 					if (isset($focus->$value) and !empty($focus->$value)) {
139
-						$initial_filter.="&".$alias . '='.urlencode($focus->$value);
139
+						$initial_filter .= "&".$alias.'='.urlencode($focus->$value);
140 140
 					}
141 141
 				}
142 142
 			}
143 143
 		}
144
-		$create="true";
145
-		if(isset($widget_data['create'])){
146
-			$create=$widget_data['create'];
144
+		$create = "true";
145
+		if (isset($widget_data['create'])) {
146
+			$create = $widget_data['create'];
147 147
 		}
148 148
 		$return_module = $_REQUEST['module'];
149 149
 		$return_action = 'SubPanelViewer';
150 150
 		$return_id = $_REQUEST['record'];
151 151
 
152 152
 		//field_to_name_array
153
-		$fton_array= array('id' => 'subpanel_id');
154
-		if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){
155
-			$fton_array=array_merge($fton_array,$widget_data['field_to_name_array']);
153
+		$fton_array = array('id' => 'subpanel_id');
154
+		if (isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])) {
155
+			$fton_array = array_merge($fton_array, $widget_data['field_to_name_array']);
156 156
 		}
157 157
 
158 158
 		$return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1";
@@ -171,21 +171,21 @@  discard block
 block discarded – undo
171 171
 		);
172 172
 
173 173
 		if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) {
174
-			$popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']);
174
+			$popup_request_data['passthru_data'] = array_merge($popup_request_data['passthru_data'], $this->button_properties['add_to_passthru_data']);
175 175
 		}
176 176
 
177 177
 		if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) {
178 178
 
179
-			if ($this->button_properties['add_to_passthru_data']['return_type']=='report') {
180
-				$initial_filter = "&module_name=". urlencode($widget_data['module']);
179
+			if ($this->button_properties['add_to_passthru_data']['return_type'] == 'report') {
180
+				$initial_filter = "&module_name=".urlencode($widget_data['module']);
181 181
 			}
182 182
 		}
183 183
 		$json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data);
184 184
 
185
-		return '<form action="index.php">' . "\n"
186
-			. ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n"
187
-				. ' title="' . $this->title . '"'
188
-			. ' value="' . $this->value . "\"\n"
185
+		return '<form action="index.php">'."\n"
186
+			. ' <input type="button" name="'.$this->getWidgetId().'" id="'.$this->getWidgetId().'" class="button"'."\"\n"
187
+				. ' title="'.$this->title.'"'
188
+			. ' value="'.$this->value."\"\n"
189 189
 			. " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' /></form>\n";
190 190
 	}
191 191
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -58,8 +60,7 @@  discard block
 block discarded – undo
58 60
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
59 61
         if(isset($GLOBALS['log'])) {
60 62
             $GLOBALS['log']->deprecated($deprecatedMessage);
61
-        }
62
-        else {
63
+        } else {
63 64
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
64 65
         }
65 66
         self::__construct($button_properties);
@@ -123,8 +124,7 @@  discard block
 block discarded – undo
123 124
 
124 125
 		if ($subpanel_name == 'Project'){
125 126
 			$link_field_name = 'project_contacts_1';
126
-		}
127
-		else{
127
+		} else{
128 128
 			$link_field_name = $subpanel_definition->get_data_source_name(true);
129 129
 		}
130 130
 
Please login to merge, or discard this patch.
include/generic/SugarWidgets/SugarWidgetFieldCronSchedule.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 class SugarWidgetFieldCronSchedule extends SugarWidgetFieldVarchar
4 4
 {
5 5
     public function __construct($layout_manager) {
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
     /**
10 10
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
11 11
      */
12
-    public function SugarWidgetFieldCronSchedule($layout_manager){
12
+    public function SugarWidgetFieldCronSchedule($layout_manager) {
13 13
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
14
-        if(isset($GLOBALS['log'])) {
14
+        if (isset($GLOBALS['log'])) {
15 15
             $GLOBALS['log']->deprecated($deprecatedMessage);
16 16
         }
17 17
         else {
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
  * Date: 06/03/15
44 44
  * Comments
45 45
  */
46
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
46
+if(!defined('sugarEntry') || !sugarEntry) {
47
+    die('Not A Valid Entry Point');
48
+}
47 49
 
48 50
 class CasesController extends SugarController {
49 51
 
@@ -90,8 +92,7 @@  discard block
 block discarded – undo
90 92
                 $count++;
91 93
             }
92 94
             echo '</table>';
93
-        }
94
-        else {
95
+        } else {
95 96
             echo $mod_strings['LBL_NO_SUGGESTIONS'];
96 97
         }
97 98
         die();
Please login to merge, or discard this patch.