Completed
Push — developer ( a57f3b...617ff5 )
by Błażej
343:19 queued 298:34
created
include/QueryGenerator/QueryGenerator.php 1 patch
Braces   +44 added lines, -30 removed lines patch added patch discarded remove patch
@@ -306,8 +306,9 @@  discard block
 block discarded – undo
306 306
 
307 307
 	public function parseAdvFilterList($advFilterList, $glue = '')
308 308
 	{
309
-		if (!empty($glue))
310
-			$this->addConditionGlue($glue);
309
+		if (!empty($glue)) {
310
+					$this->addConditionGlue($glue);
311
+		}
311 312
 
312 313
 		$customView = new CustomView($this->module);
313 314
 		$dateSpecificConditions = $customView->getStdFilterConditions();
@@ -318,8 +319,9 @@  discard block
 block discarded – undo
318 319
 				foreach ($filtercolumns as $index => $filter) {
319 320
 					$nameComponents = explode(':', $filter['columnname']);
320 321
 					// For Events "End Date & Time" field datatype should be DT. But, db will give D for due_date field
321
-					if ($nameComponents[2] == 'due_date' && $nameComponents[3] == 'Events_End_Date_&_Time')
322
-						$nameComponents[4] = 'DT';
322
+					if ($nameComponents[2] == 'due_date' && $nameComponents[3] == 'Events_End_Date_&_Time') {
323
+											$nameComponents[4] = 'DT';
324
+					}
323 325
 					if (empty($nameComponents[2]) && $nameComponents[1] == 'crmid' && $nameComponents[0] == 'vtiger_crmentity') {
324 326
 						$name = $this->getSQLColumn('id');
325 327
 					} else {
@@ -343,13 +345,15 @@  discard block
 block discarded – undo
343 345
 						// If datatype is DT then we should append time also
344 346
 						if ($nameComponents[4] == 'DT') {
345 347
 							$startdate = explode(' ', $dateFilterResolvedList['startdate']);
346
-							if ($startdate[1] == '')
347
-								$startdate[1] = '00:00:00';
348
+							if ($startdate[1] == '') {
349
+															$startdate[1] = '00:00:00';
350
+							}
348 351
 							$dateFilterResolvedList['startdate'] = $startdate[0] . ' ' . $startdate[1];
349 352
 
350 353
 							$enddate = explode(' ', $dateFilterResolvedList['enddate']);
351
-							if ($enddate[1] == '')
352
-								$enddate[1] = '23:59:59';
354
+							if ($enddate[1] == '') {
355
+															$enddate[1] = '23:59:59';
356
+							}
353 357
 							$dateFilterResolvedList['enddate'] = $enddate[0] . ' ' . $enddate[1];
354 358
 						}
355 359
 						$value = [];
@@ -367,12 +371,14 @@  discard block
 block discarded – undo
367 371
 
368 372
 						$value = [];
369 373
 						$start = explode(' ', $startDate);
370
-						if ($start[1] == "")
371
-							$startDate = $start[0] . ' ' . '00:00:00';
374
+						if ($start[1] == "") {
375
+													$startDate = $start[0] . ' ' . '00:00:00';
376
+						}
372 377
 
373 378
 						$end = explode(' ', $endDate);
374
-						if ($end[1] == "")
375
-							$endDate = $end[0] . ' ' . '23:59:59';
379
+						if ($end[1] == "") {
380
+													$endDate = $end[0] . ' ' . '23:59:59';
381
+						}
376 382
 
377 383
 						$value[] = $startDate;
378 384
 						$value[] = $endDate;
@@ -405,8 +411,9 @@  discard block
 block discarded – undo
405 411
 				}
406 412
 				$this->endGroup();
407 413
 				$groupConditionGlue = $groupcolumns['condition'];
408
-				if (!empty($groupConditionGlue))
409
-					$this->addConditionGlue($groupConditionGlue);
414
+				if (!empty($groupConditionGlue)) {
415
+									$this->addConditionGlue($groupConditionGlue);
416
+				}
410 417
 			}
411 418
 		}
412 419
 	}
@@ -696,8 +703,9 @@  discard block
 block discarded – undo
696 703
 				$fields = $meta->getModuleFields();
697 704
 				$fieldObject = $fields[$fieldName];
698 705
 
699
-				if (empty($fieldObject))
700
-					continue;
706
+				if (empty($fieldObject)) {
707
+									continue;
708
+				}
701 709
 
702 710
 				$tableName = $fieldObject->getTableName();
703 711
 				if (!in_array($tableName, $referenceFieldTableList)) {
@@ -756,8 +764,9 @@  discard block
 block discarded – undo
756 764
 			$operator = strtolower($conditionInfo['operator']);
757 765
 			if ($operator == 'between' && $this->isDateType($field->getFieldDataType())) {
758 766
 				$start = explode(' ', $conditionInfo['value'][0]);
759
-				if (count($start) == 2)
760
-					$conditionInfo['value'][0] = getValidDBInsertDateTimeValue($start[0] . ' ' . $start[1]);
767
+				if (count($start) == 2) {
768
+									$conditionInfo['value'][0] = getValidDBInsertDateTimeValue($start[0] . ' ' . $start[1]);
769
+				}
761 770
 
762 771
 				$end = explode(' ', $conditionInfo['values'][1]);
763 772
 				// Dates will be equal for Today, Tomorrow, Yesterday.
@@ -918,8 +927,9 @@  discard block
 block discarded – undo
918 927
 						$conditionGlue = ' && ';
919 928
 						if ($conditionInfo['operator'] == 'n') {
920 929
 							$specialCondition = ' || ' . $field->getTableName() . '.' . $field->getColumnName() . ' IS NULL ';
921
-							if (!empty($otherField))
922
-								$specialConditionForOtherField = ' || ' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' IS NULL ';
930
+							if (!empty($otherField)) {
931
+															$specialConditionForOtherField = ' || ' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' IS NULL ';
932
+							}
923 933
 						}
924 934
 					}
925 935
 
@@ -929,10 +939,11 @@  discard block
 block discarded – undo
929 939
 					}
930 940
 
931 941
 					$fieldSql .= "$fieldGlue ((" . $field->getTableName() . '.' . $field->getColumnName() . ' ' . $valueSql . " $specialCondition) ";
932
-					if (!empty($otherField))
933
-						$fieldSql .= $conditionGlue . '(' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' ' . $otherFieldValueSql . ' ' . $specialConditionForOtherField . '))';
934
-					else
935
-						$fieldSql .= ')';
942
+					if (!empty($otherField)) {
943
+											$fieldSql .= $conditionGlue . '(' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' ' . $otherFieldValueSql . ' ' . $specialConditionForOtherField . '))';
944
+					} else {
945
+											$fieldSql .= ')';
946
+					}
936 947
 				} elseif ($conditionInfo['custom']) {
937 948
 					$fieldSql .= $fieldGlue . 'vtiger_crmentity.crmid ' . $valueSql;
938 949
 				} else {
@@ -1304,8 +1315,9 @@  discard block
 block discarded – undo
1304 1315
 	public function addCondition($fieldname, $value, $operator, $glue = null, $custom = false, $newGroupType = null, $ignoreComma = false)
1305 1316
 	{
1306 1317
 		$conditionNumber = $this->conditionInstanceCount++;
1307
-		if ($glue !== null && $conditionNumber > 0)
1308
-			$this->addConditionGlue($glue);
1318
+		if ($glue !== null && $conditionNumber > 0) {
1319
+					$this->addConditionGlue($glue);
1320
+		}
1309 1321
 
1310 1322
 		$this->groupInfo .= "$conditionNumber ";
1311 1323
 		$this->whereFields[] = $fieldname;
@@ -1326,8 +1338,9 @@  discard block
 block discarded – undo
1326 1338
 	public function addReferenceModuleFieldCondition($relatedModule, $referenceField, $fieldName, $value, $SQLOperator, $glue = null)
1327 1339
 	{
1328 1340
 		$conditionNumber = $this->conditionInstanceCount++;
1329
-		if ($glue !== null && $conditionNumber > 0)
1330
-			$this->addConditionGlue($glue);
1341
+		if ($glue !== null && $conditionNumber > 0) {
1342
+					$this->addConditionGlue($glue);
1343
+		}
1331 1344
 
1332 1345
 		$this->groupInfo .= "$conditionNumber ";
1333 1346
 		$this->referenceModuleField[$conditionNumber] = array('relatedModule' => $relatedModule, 'referenceField' => $referenceField, 'fieldName' => $fieldName, 'value' => $value,
@@ -1401,8 +1414,9 @@  discard block
 block discarded – undo
1401 1414
 					}
1402 1415
 					$this->endGroup();
1403 1416
 					$groupConditionGlue = $groupcolumns['condition'];
1404
-					if (!empty($groupConditionGlue))
1405
-						$this->addConditionGlue($groupConditionGlue);
1417
+					if (!empty($groupConditionGlue)) {
1418
+											$this->addConditionGlue($groupConditionGlue);
1419
+					}
1406 1420
 				}
1407 1421
 			}
1408 1422
 			$this->endGroup();
Please login to merge, or discard this patch.
modules/PaymentsIn/views/PaymentsImport.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,11 +31,13 @@
 block discarded – undo
31 31
 					$banks = explode('_', str_replace(".php", "", $file->getFilename()));
32 32
 					$status = false;
33 33
 					for ($i = 0; $i < count($bank); $i++) {
34
-						if ($bank[$i] == $banks[1])
35
-							$status = true;
34
+						if ($bank[$i] == $banks[1]) {
35
+													$status = true;
36
+						}
37
+					}
38
+					if ($status !== true) {
39
+											$bank[] = $banks[1];
36 40
 					}
37
-					if ($status !== true)
38
-						$bank[] = $banks[1];
39 41
 				}
40 42
 			}
41 43
 		}
Please login to merge, or discard this patch.
modules/Webforms/Webforms.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,8 +57,9 @@  discard block
 block discarded – undo
57 57
 		$seq_res = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
58 58
 		if ($adb->num_rows($seq_res) > 0) {
59 59
 			$cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
60
-			if ($cur_seq !== null)
61
-				$seq = $cur_seq + 1;
60
+			if ($cur_seq !== null) {
61
+							$seq = $cur_seq + 1;
62
+			}
62 63
 		}
63 64
 
64 65
 		$result = $adb->pquery('SELECT 1 FROM vtiger_settings_field WHERE name=?', array($this->LBL_WEBFORMS));
@@ -70,8 +71,9 @@  discard block
 block discarded – undo
70 71
 
71 72
 	static function checkAdminAccess($user)
72 73
 	{
73
-		if (\vtlib\Functions::userIsAdministrator($user))
74
-			return;
74
+		if (\vtlib\Functions::userIsAdministrator($user)) {
75
+					return;
76
+		}
75 77
 
76 78
 		echo "<table border='0' cellpadding='5' cellspacing='0' width='100%' height='450px'><tr><td align='center'>";
77 79
 		echo "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 55%; position: relative; z-index: 10000000;'>
Please login to merge, or discard this patch.
modules/PaymentsOut/views/PaymentsImport.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,11 +31,13 @@
 block discarded – undo
31 31
 					$banks = explode('_', str_replace(".php", "", $file->getFilename()));
32 32
 					$status = false;
33 33
 					for ($i = 0; $i < count($bank); $i++) {
34
-						if ($bank[$i] == $banks[1])
35
-							$status = true;
34
+						if ($bank[$i] == $banks[1]) {
35
+													$status = true;
36
+						}
37
+					}
38
+					if ($status !== true) {
39
+											$bank[] = $banks[1];
36 40
 					}
37
-					if ($status !== true)
38
-						$bank[] = $banks[1];
39 41
 				}
40 42
 			}
41 43
 		}
Please login to merge, or discard this patch.
modules/ModTracker/ModTracker.php 1 patch
Braces   +32 added lines, -22 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
59 59
 			$seq_res = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
60 60
 			if ($adb->num_rows($seq_res) > 0) {
61 61
 				$cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
62
-				if ($cur_seq !== null)
63
-					$seq = $cur_seq + 1;
62
+				if ($cur_seq !== null) {
63
+									$seq = $cur_seq + 1;
64
+				}
64 65
 			}
65 66
 
66 67
 			$adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence)
@@ -189,10 +190,12 @@  discard block
 block discarded – undo
189 190
 				$visible = $adb->query_result($query, 0, 'visible');
190 191
 				self::updateCache($tabid, $visible);
191 192
 				return true;
192
-			} else
193
-				return false;
194
-		} else
195
-			return true;
193
+			} else {
194
+							return false;
195
+			}
196
+		} else {
197
+					return true;
198
+		}
196 199
 	}
197 200
 
198 201
 	/**
@@ -205,10 +208,11 @@  discard block
 block discarded – undo
205 208
 		$query1 = $adb->pquery("SELECT * FROM vtiger_links WHERE linktype='DETAILVIEWBASIC' AND
206 209
 							  linklabel = 'View History' && tabid = ?", array($tabid));
207 210
 		$row = $adb->num_rows($query1);
208
-		if ($row >= 1)
209
-			return true;
210
-		else
211
-			return false;
211
+		if ($row >= 1) {
212
+					return true;
213
+		} else {
214
+					return false;
215
+		}
212 216
 	}
213 217
 
214 218
 	/**
@@ -232,8 +236,9 @@  discard block
 block discarded – undo
232 236
 	{
233 237
 		if (isset(self::$__cache_modtracker[$tabid])) {
234 238
 			return true;
235
-		} else
236
-			return false;
239
+		} else {
240
+					return false;
241
+		}
237 242
 	}
238 243
 
239 244
 	/**
@@ -262,8 +267,9 @@  discard block
 block discarded – undo
262 267
 
263 268
 		$accessibleModules = $this->getModTrackerEnabledModules();
264 269
 
265
-		if (empty($accessibleModules))
266
-			throw new Exception('Modtracker not enabled for any modules');
270
+		if (empty($accessibleModules)) {
271
+					throw new Exception('Modtracker not enabled for any modules');
272
+		}
267 273
 
268 274
 		$query = sprintf('SELECT id, module, modifiedtime, vtiger_crmentity.crmid, smownerid, vtiger_modtracker_basic.status
269 275
                 FROM vtiger_modtracker_basic
@@ -277,8 +283,9 @@  discard block
 block discarded – undo
277 283
 			$params[] = $entityModule;
278 284
 		}
279 285
 
280
-		if ($limit !== false)
281
-			$query .=" LIMIT $limit";
286
+		if ($limit !== false) {
287
+					$query .=" LIMIT $limit";
288
+		}
282 289
 
283 290
 		$result = $adb->pquery($query, $params);
284 291
 
@@ -306,8 +313,9 @@  discard block
 block discarded – undo
306 313
 			$uniqueIds[] = $record['uniqueid'];
307 314
 		}
308 315
 
309
-		if (!empty($uniqueIds))
310
-			$maxUniqueId = max($uniqueIds);
316
+		if (!empty($uniqueIds)) {
317
+					$maxUniqueId = max($uniqueIds);
318
+		}
311 319
 
312 320
 		if (empty($maxUniqueId)) {
313 321
 			$maxUniqueId = $uniqueId;
@@ -367,8 +375,9 @@  discard block
 block discarded – undo
367 375
 		for ($i = 0; $i < $adb->num_rows($fieldResult); $i++) {
368 376
 			$fieldName = $adb->query_result($fieldResult, $i, 'fieldname');
369 377
 			if ($fieldName == 'record_id' || $fieldName == 'record_module' ||
370
-				$fieldName == 'createdtime')
371
-				continue;
378
+				$fieldName == 'createdtime') {
379
+							continue;
380
+			}
372 381
 
373 382
 			$field['postvalue'] = $adb->query_result($fieldResult, $i, 'postvalue');
374 383
 			$field['prevalue'] = $adb->query_result($fieldResult, $i, 'prevalue');
@@ -416,8 +425,9 @@  discard block
 block discarded – undo
416 425
 		]);
417 426
 		$isMyRecord = $adb->pquery('SELECT crmid FROM vtiger_crmentity WHERE smownerid <> ? && crmid = ?', array($currentUser->getRealId(), $sourceId));
418 427
 
419
-		if ($adb->num_rows($isMyRecord) > 0)
420
-			$adb->pquery("UPDATE vtiger_crmentity SET was_read = 0 WHERE crmid = ?;", array($sourceId));
428
+		if ($adb->num_rows($isMyRecord) > 0) {
429
+					$adb->pquery("UPDATE vtiger_crmentity SET was_read = 0 WHERE crmid = ?;", array($sourceId));
430
+		}
421 431
 	}
422 432
 
423 433
 	static function linkRelation($sourceModule, $sourceId, $targetModule, $targetId)
Please login to merge, or discard this patch.
modules/CustomerPortal/CustomerPortal.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@
 block discarded – undo
52 52
 			$seq_res = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
53 53
 			if ($adb->num_rows($seq_res) > 0) {
54 54
 				$cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
55
-				if ($cur_seq !== null)
56
-					$seq = $cur_seq + 1;
55
+				if ($cur_seq !== null) {
56
+									$seq = $cur_seq + 1;
57
+				}
57 58
 			}
58 59
 
59 60
 			$adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence)
Please login to merge, or discard this patch.