Completed
Push — developer ( a57f3b...617ff5 )
by Błażej
343:19 queued 298:34
created
vtlib/Vtiger/Zip.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -69,6 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
 	/**
71 71
 	 * Normalize the directory path separators.
72
+	 * @param string $path
72 73
 	 */
73 74
 	public function __normalizePath($path)
74 75
 	{
@@ -79,6 +80,7 @@  discard block
 block discarded – undo
79 80
 
80 81
 	/**
81 82
 	 * Copy the directory on the disk into zip file.
83
+	 * @param string $zipdirname
82 84
 	 */
83 85
 	public function copyDirectoryFromDisk($dirname, $zipdirname = null, $excludeList = null, $basedirname = null)
84 86
 	{
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -50,8 +50,9 @@  discard block
 block discarded – undo
50 50
 		if ($search_index === 0) {
51 51
 			$startindex = strlen($base_realpath) + 1;
52 52
 			// On windows $base_realpath ends with / and On Linux it will not have / at end!
53
-			if (strrpos($base_realpath, '/') == strlen($base_realpath) - 1)
54
-				$startindex -= 1;
53
+			if (strrpos($base_realpath, '/') == strlen($base_realpath) - 1) {
54
+							$startindex -= 1;
55
+			}
55 56
 			$relpath = substr($src_realpath, $startindex);
56 57
 		}
57 58
 		return $relpath;
@@ -62,8 +63,9 @@  discard block
 block discarded – undo
62 63
 	 */
63 64
 	public function __fixDirSeparator($path)
64 65
 	{
65
-		if ($path != '' && (strripos($path, '/') != strlen($path) - 1))
66
-			$path .= '/';
66
+		if ($path != '' && (strripos($path, '/') != strlen($path) - 1)) {
67
+					$path .= '/';
68
+		}
67 69
 		return $path;
68 70
 	}
69 71
 
@@ -72,8 +74,9 @@  discard block
 block discarded – undo
72 74
 	 */
73 75
 	public function __normalizePath($path)
74 76
 	{
75
-		if ($path && strpos($path, '\\') !== false)
76
-			$path = preg_replace("/\\\\/", "/", $path);
77
+		if ($path && strpos($path, '\\') !== false) {
78
+					$path = preg_replace("/\\\\/", "/", $path);
79
+		}
77 80
 		return $path;
78 81
 	}
79 82
 
@@ -83,18 +86,21 @@  discard block
 block discarded – undo
83 86
 	public function copyDirectoryFromDisk($dirname, $zipdirname = null, $excludeList = null, $basedirname = null)
84 87
 	{
85 88
 		$dir = opendir($dirname);
86
-		if (strripos($dirname, '/') != strlen($dirname) - 1)
87
-			$dirname .= '/';
89
+		if (strripos($dirname, '/') != strlen($dirname) - 1) {
90
+					$dirname .= '/';
91
+		}
88 92
 
89
-		if ($basedirname === null)
90
-			$basedirname = realpath($dirname);
93
+		if ($basedirname === null) {
94
+					$basedirname = realpath($dirname);
95
+		}
91 96
 
92 97
 		while (false !== ($file = readdir($dir))) {
93 98
 			if ($file != '.' && $file != '..' &&
94 99
 				$file != '.svn' && $file != 'CVS') {
95 100
 				// Exclude the file/directory 
96
-				if (!empty($excludeList) && in_array("$dirname$file", $excludeList))
97
-					continue;
101
+				if (!empty($excludeList) && in_array("$dirname$file", $excludeList)) {
102
+									continue;
103
+				}
98 104
 
99 105
 				if (is_dir("$dirname$file")) {
100 106
 					$this->copyDirectoryFromDisk("$dirname$file", $zipdirname, $excludeList, $basedirname);
Please login to merge, or discard this patch.
api.php 2 patches
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,33 +19,26 @@
 block discarded – undo
19 19
 	if($service == "customerportal")
20 20
 	{
21 21
 		include("api/customerportal.php");
22
-	}	
23
-	elseif($service == "mobile")	
22
+	} elseif($service == "mobile")	
24 23
 	{		
25 24
 		include("api/mobile.php");
26
-	}
27
-	elseif($service == "yetiportal")	
25
+	} elseif($service == "yetiportal")	
28 26
 	{		
29 27
 		include("api/yetiportal.php");
30
-	}
31
-	elseif($service == "firefox")
28
+	} elseif($service == "firefox")
32 29
 	{
33 30
 		include("api/firefoxtoolbar.php");
34
-	}
35
-	elseif($service == "wordplugin")
31
+	} elseif($service == "wordplugin")
36 32
 	{
37 33
 		include("api/wordplugin.php");
38
-	}
39
-	elseif($service == "thunderbird")
34
+	} elseif($service == "thunderbird")
40 35
 	{
41 36
 		include("api/thunderbirdplugin.php");
42
-	}
43
-	else
37
+	} else
44 38
 	{
45 39
 		echo "No Service Configured for ". strip_tags($service);
46 40
 	}
47
-}
48
-else
41
+} else
49 42
 {
50 43
 	echo "<h1>YetiForceCRM API Services</h1>";
51 44
 	echo "<li>YetiForceCRM Yeti Portal EndPoint URL -- Click <a href='api.php?service=yetiportal'>here</a></li>";
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,39 +11,39 @@
 block discarded – undo
11 11
 require_once 'config/api.php';
12 12
 $service = $_REQUEST['service'];
13 13
 
14
-if(isset($service))
14
+if (isset($service))
15 15
 {
16
-	if(!in_array($service,$enabledServices)){
17
-		echo $service.' - Service is not active';
16
+	if (!in_array($service, $enabledServices)) {
17
+		echo $service . ' - Service is not active';
18 18
 		return;
19 19
 	}	
20
-	if($service == "customerportal")
20
+	if ($service == "customerportal")
21 21
 	{
22 22
 		include("api/customerportal.php");
23 23
 	}	
24
-	elseif($service == "mobile")	
24
+	elseif ($service == "mobile")	
25 25
 	{		
26 26
 		include("api/mobile.php");
27 27
 	}
28
-	elseif($service == "yetiportal")	
28
+	elseif ($service == "yetiportal")	
29 29
 	{		
30 30
 		include("api/yetiportal.php");
31 31
 	}
32
-	elseif($service == "firefox")
32
+	elseif ($service == "firefox")
33 33
 	{
34 34
 		include("api/firefoxtoolbar.php");
35 35
 	}
36
-	elseif($service == "wordplugin")
36
+	elseif ($service == "wordplugin")
37 37
 	{
38 38
 		include("api/wordplugin.php");
39 39
 	}
40
-	elseif($service == "thunderbird")
40
+	elseif ($service == "thunderbird")
41 41
 	{
42 42
 		include("api/thunderbirdplugin.php");
43 43
 	}
44 44
 	else
45 45
 	{
46
-		echo "No Service Configured for ". strip_tags($service);
46
+		echo "No Service Configured for " . strip_tags($service);
47 47
 	}
48 48
 }
49 49
 else
Please login to merge, or discard this patch.
include/Modules.php 2 patches
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,10 +16,11 @@  discard block
 block discarded – undo
16 16
 	{
17 17
 		$entity = false;
18 18
 		if ($mixed) {
19
-			if (is_numeric($mixed))
20
-				$entity = isset(self::$moduleEntityCacheById[$mixed]) ? self::$moduleEntityCacheById[$mixed] : false;
21
-			else
22
-				$entity = isset(self::$moduleEntityCacheByName[$mixed]) ? self::$moduleEntityCacheByName[$mixed] : false;
19
+			if (is_numeric($mixed)) {
20
+							$entity = isset(self::$moduleEntityCacheById[$mixed]) ? self::$moduleEntityCacheById[$mixed] : false;
21
+			} else {
22
+							$entity = isset(self::$moduleEntityCacheByName[$mixed]) ? self::$moduleEntityCacheByName[$mixed] : false;
23
+			}
23 24
 		}
24 25
 		if (!$entity) {
25 26
 			$adb = \PearDatabase::getInstance();
@@ -31,10 +32,11 @@  discard block
 block discarded – undo
31 32
 				self::$moduleEntityCacheById[$row['tabid']] = $row;
32 33
 			}
33 34
 			if ($mixed) {
34
-				if (is_numeric($mixed))
35
-					return self::$moduleEntityCacheById[$mixed];
36
-				else
37
-					return self::$moduleEntityCacheByName[$mixed];
35
+				if (is_numeric($mixed)) {
36
+									return self::$moduleEntityCacheById[$mixed];
37
+				} else {
38
+									return self::$moduleEntityCacheByName[$mixed];
39
+				}
38 40
 			}
39 41
 		}
40 42
 		return $entity;
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -31,6 +31,9 @@
 block discarded – undo
31 31
 		file_put_contents(self::$usersFile, '<?php return ' . \vtlib\Functions::varExportMin($users) . ';');
32 32
 	}
33 33
 
34
+	/**
35
+	 * @param string $type
36
+	 */
34 37
 	public static function getUser($type)
35 38
 	{
36 39
 		if (self::$usersFileCache === false) {
Please login to merge, or discard this patch.
include/ChartUtils.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 				$x = "";
57 57
 				for ($j = 0; $j < count($val); $j++) {
58 58
 					if ($j != $n) {
59
-						$x .=" " . $val[$j];
59
+						$x .= " " . $val[$j];
60 60
 					} else {
61 61
 						$x .= "@#" . $val[$j];
62 62
 					}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 				$x = "";
241 241
 				for ($j = 0; $j < count($val); $j++) {
242 242
 					if ($j != $n) {
243
-						$x .=" " . $val[$j];
243
+						$x .= " " . $val[$j];
244 244
 					} else {
245 245
 						$x .= "@#" . $val[$j];
246 246
 					}
Please login to merge, or discard this patch.
Braces   +55 added lines, -40 removed lines patch added patch discarded remove patch
@@ -32,14 +32,18 @@  discard block
 block discarded – undo
32 32
 		} else {
33 33
 			$cache_file_name = $cachedFileName;
34 34
 		}
35
-		if (empty($width))
36
-			$width = '400';
37
-		if (empty($height))
38
-			$height = '300';
39
-		if ($target === false)
40
-			$target = [];
41
-		if (empty($color))
42
-			$color = 'black';
35
+		if (empty($width)) {
36
+					$width = '400';
37
+		}
38
+		if (empty($height)) {
39
+					$height = '300';
40
+		}
41
+		if ($target === false) {
42
+					$target = [];
43
+		}
44
+		if (empty($color)) {
45
+					$color = 'black';
46
+		}
43 47
 
44 48
 		$alts = [];
45 49
 		$temp = [];
@@ -48,8 +52,9 @@  discard block
 block discarded – undo
48 52
 			$pos = substr_count($name, " ");
49 53
 			$alts[] = $name;
50 54
 			//If the daatx value of a string is greater, adding '\n' to it so that it'll cme inh 2nd line
51
-			if (strlen($name) >= 14)
52
-				$name = substr($name, 0, 44);
55
+			if (strlen($name) >= 14) {
56
+							$name = substr($name, 0, 44);
57
+			}
53 58
 			if ($pos >= 2) {
54 59
 				$val = explode(" ", $name);
55 60
 				$n = count($val) - 1;
@@ -102,8 +107,9 @@  discard block
 block discarded – undo
102 107
 
103 108
 		for ($i = 0; $i < count($yaxisData); $i++) {
104 109
 			$x = 1 + $i;
105
-			if ($yaxisData[$i] >= $max)
106
-				$max = $yaxisData[$i];
110
+			if ($yaxisData[$i] >= $max) {
111
+							$max = $yaxisData[$i];
112
+			}
107 113
 			$dataset->addPoint(
108 114
 				$x, $yaxisData[$i], array(
109 115
 				'url' => $target[$i],
@@ -125,8 +131,9 @@  discard block
 block discarded – undo
125 131
 		$bplot->setFillStyle($fill);
126 132
 
127 133
 		//You can change the width of the bars if you like
128
-		if (!empty($xaxisData))
129
-			$bplot->setBarWidth($barwidth / count($xaxisData), "%");
134
+		if (!empty($xaxisData)) {
135
+					$bplot->setBarWidth($barwidth / count($xaxisData), "%");
136
+		}
130 137
 		$bplot->setBackground(Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_HORIZONTAL, 'white', 'white')));
131 138
 		$xaxis = & $plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
132 139
 		$yaxis = & $plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
@@ -150,8 +157,9 @@  discard block
 block discarded – undo
150 157
 		$ticks = get_tickspacing(round(($max * 1.1) + 0.5));
151 158
 
152 159
 		// First make the labels look right
153
-		if ($charttype == 'horizontal')
154
-			$yaxis->setFontAngle('vertical');
160
+		if ($charttype == 'horizontal') {
161
+					$yaxis->setFontAngle('vertical');
162
+		}
155 163
 		$yaxis->setLabelInterval($ticks[0]);
156 164
 		$yaxis->setTickOptions(-5, 0);
157 165
 		$yaxis->setLabelInterval($ticks[1], 2);
@@ -165,8 +173,9 @@  discard block
 block discarded – undo
165 173
 		$xaxis->setDataPreprocessor($array_data);
166 174
 		$xaxis->forceMinimum(0.5);
167 175
 		$xaxis->forceMaximum(0.5 + count($yaxisData));
168
-		if ($charttype == 'vertical')
169
-			$xaxis->setFontAngle('vertical');
176
+		if ($charttype == 'vertical') {
177
+					$xaxis->setFontAngle('vertical');
178
+		}
170 179
 		$xaxis->setLabelInterval(1);
171 180
 		$xaxis->setTickOptions(0, 0);
172 181
 		$xaxis->setLabelInterval(2, 2);
@@ -218,12 +227,15 @@  discard block
 block discarded – undo
218 227
 			$cache_file_name = $cachedFileName;
219 228
 		}
220 229
 
221
-		if (empty($width))
222
-			$width = '500';
223
-		if (empty($height))
224
-			$height = '400';
225
-		if ($target === false)
226
-			$target = [];
230
+		if (empty($width)) {
231
+					$width = '500';
232
+		}
233
+		if (empty($height)) {
234
+					$height = '400';
235
+		}
236
+		if ($target === false) {
237
+					$target = [];
238
+		}
227 239
 
228 240
 		$alts = [];
229 241
 		$temp = [];
@@ -232,8 +244,9 @@  discard block
 block discarded – undo
232 244
 			$pos = substr_count($name, " ");
233 245
 			$alts[] = $name;
234 246
 			//If the datax value of a string is greater, adding '\n' to it so that it'll come in 2nd line
235
-			if (strlen($name) >= 14)
236
-				$name = substr($name, 0, 34);
247
+			if (strlen($name) >= 14) {
248
+							$name = substr($name, 0, 34);
249
+			}
237 250
 			if ($pos >= 2) {
238 251
 				$val = explode(" ", $name);
239 252
 				$n = count($val) - 1;
@@ -297,8 +310,9 @@  discard block
 block discarded – undo
297 310
 			$pcvalues[$yaxisData[$i]] = sprintf('%0.1f%%', 100 * $yaxisData[$i] / $sum);
298 311
 			$fills->addColor($colors[$i]);
299 312
 		}
300
-		if ($sum == 0)
301
-			return null;
313
+		if ($sum == 0) {
314
+					return null;
315
+		}
302 316
 		// create the pie chart and associate the filling colours
303 317
 		$gbplot = & $plotarea->addNew('pie', $dataset);
304 318
 		$plotarea->setPadding(array('top' => 0, 'bottom' => 0, 'left' => 0, 'right' => ($width / 20)));
@@ -361,8 +375,9 @@  discard block
 block discarded – undo
361 375
 		$restrictedModules = false;
362 376
 		foreach ($reportModules as $mod) {
363 377
 			if (isPermitted($mod, 'index') != 'yes' || \includes\Modules::isModuleActive($mod) == false) {
364
-				if (!is_array($restrictedModules))
365
-					$restrictedModules = [];
378
+				if (!is_array($restrictedModules)) {
379
+									$restrictedModules = [];
380
+				}
366 381
 				$restrictedModules[] = $mod;
367 382
 			}
368 383
 		}
@@ -409,12 +424,12 @@  discard block
 block discarded – undo
409 424
 					$groupFieldValue = $valueComp[1];
410 425
 				}
411 426
 				if ($dateField) {
412
-					if (!empty($groupFieldValue))
413
-						$groupByFields[] = CustomReportUtils::getXAxisDateFieldValue($groupFieldValue, $criteria);
414
-					else
415
-						$groupByFields[] = "Null";
416
-				}
417
-				else if (in_array($fieldname, array_keys($referenceFields))) {
427
+					if (!empty($groupFieldValue)) {
428
+											$groupByFields[] = CustomReportUtils::getXAxisDateFieldValue($groupFieldValue, $criteria);
429
+					} else {
430
+											$groupByFields[] = "Null";
431
+					}
432
+				} else if (in_array($fieldname, array_keys($referenceFields))) {
418 433
 					if (count($referenceFields[$fieldname]) > 1) {
419 434
 						$refenceModule = CustomReportUtils::getEntityTypeFromName($decodedGroupFieldValue, $referenceFields[$fieldname]);
420 435
 					} else {
@@ -443,10 +458,10 @@  discard block
 block discarded – undo
443 458
 						$advanceSearchCondition = CustomReportUtils::getAdvanceSearchCondition($fieldDetails, $criteria, $groupFieldValue);
444 459
 						if ($module == 'Calendar') {
445 460
 							$link_val = "index.php?module=" . $module . "&query=true&action=ListView&" . $advanceSearchCondition;
446
-						} else
447
-							$link_val = "index.php?module=" . $module . "&query=true&action=index&" . $advanceSearchCondition;
448
-					}
449
-					else {
461
+						} else {
462
+													$link_val = "index.php?module=" . $module . "&query=true&action=index&" . $advanceSearchCondition;
463
+						}
464
+					} else {
450 465
 						$cvid = \vtlib\Deprecated::getIdOfCustomViewByNameAll($module);
451 466
 						$esc_search_str = urlencode($decodedGroupFieldValue);
452 467
 						if ($single == 'DT') {
Please login to merge, or discard this patch.
include/utils/EmailTemplate.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 				$moduleTableIndexList = $meta->getEntityTableIndexList();
121 121
 				foreach ($tableList as $index => $tableName) {
122 122
 					if ($tableName != $tableList[0]) {
123
-						$sql .=' INNER JOIN ' . $tableName . ' ON ' . $tableList[0] . '.' .
123
+						$sql .= ' INNER JOIN ' . $tableName . ' ON ' . $tableList[0] . '.' .
124 124
 							$moduleTableIndexList[$tableList[0]] . '=' . $tableName . '.' .
125 125
 							$moduleTableIndexList[$tableName];
126 126
 					}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 				//If module is Leads and if you are not selected any leads fields then query failure is happening.
129 129
 				//By default we are checking where condition on base table.
130 130
 				if ($module == 'Leads' && !in_array('vtiger_leaddetails', $tableList)) {
131
-					$sql .=' INNER JOIN vtiger_leaddetails ON vtiger_leaddetails.leadid = vtiger_crmentity.crmid';
131
+					$sql .= ' INNER JOIN vtiger_leaddetails ON vtiger_leaddetails.leadid = vtiger_crmentity.crmid';
132 132
 				}
133 133
 
134 134
 				$sql .= ' WHERE';
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -209,8 +209,9 @@  discard block
 block discarded – undo
209 209
 						$needle = '$' . strtolower($this->module) . '-' . $parentFieldColumnMapping[$params['field']] . ':' . $column . '$';
210 210
 						$this->processedDescription = str_replace($needle, $values[array_search($column, $fieldColumnMapping)], $this->processedDescription);
211 211
 					}
212
-					if (!$params['owner'])
213
-						$this->processedmodules[$module] = true;
212
+					if (!$params['owner']) {
213
+											$this->processedmodules[$module] = true;
214
+					}
214 215
 				}
215 216
 			}
216 217
 		}
@@ -253,7 +254,8 @@  discard block
 block discarded – undo
253 254
 		$rows = $adb->num_rows($res);
254 255
 		if ($rows > 0) {
255 256
 			return true;
256
-		} else
257
-			return false;
257
+		} else {
258
+					return false;
259
+		}
258 260
 	}
259 261
 }
Please login to merge, or discard this patch.
include/utils/ConfigReader.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
 
38 38
 	public function setConfig($key, $value)
39 39
 	{
40
-		if (empty($key))
41
-			return;
40
+		if (empty($key)) {
41
+					return;
42
+		}
42 43
 		$this->properties[$key] = $value;
43 44
 		//not neccessary for php5.x versions
44 45
 		self::$propertiesCache[$this->name] = $this->properties;
@@ -46,8 +47,9 @@  discard block
 block discarded – undo
46 47
 
47 48
 	public function getConfig($key)
48 49
 	{
49
-		if (empty($key))
50
-			return '';
50
+		if (empty($key)) {
51
+					return '';
52
+		}
51 53
 		return $this->properties[$key];
52 54
 	}
53 55
 }
Please login to merge, or discard this patch.
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -15,6 +15,10 @@  discard block
 block discarded – undo
15 15
 	protected $name;
16 16
 	static $propertiesCache = [];
17 17
 
18
+	/**
19
+	 * @param string $path
20
+	 * @param string $name
21
+	 */
18 22
 	public function __construct($path, $name, $force = false)
19 23
 	{
20 24
 		$this->load($path, $name, $force);
@@ -41,6 +45,9 @@  discard block
 block discarded – undo
41 45
 		self::$propertiesCache[$this->name] = $this->properties;
42 46
 	}
43 47
 
48
+	/**
49
+	 * @param string $key
50
+	 */
44 51
 	public function getConfig($key)
45 52
 	{
46 53
 		if (empty($key))
Please login to merge, or discard this patch.
include/utils/ExportUtils.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@
 block discarded – undo
28 28
 	$blockid_list = '(';
29 29
 	for ($i = 0; $i < $noofrows; $i++) {
30 30
 		$blockid = $adb->query_result($result, $i, "blockid");
31
-		if ($i != 0)
32
-			$blockid_list .= ', ';
31
+		if ($i != 0) {
32
+					$blockid_list .= ', ';
33
+		}
33 34
 		$blockid_list .= $blockid;
34 35
 		$block_label[$blockid] = $adb->query_result($result, $i, "blocklabel");
35 36
 	}
Please login to merge, or discard this patch.
include/utils/InventoryUtils.php 3 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	$moduleName = $entity->getModuleName();
314 314
 
315 315
 	$statusChanged = false;
316
-	$vtEntityDelta = new VTEntityDelta ();
316
+	$vtEntityDelta = new VTEntityDelta();
317 317
 	$oldEntity = $vtEntityDelta->getOldValue($moduleName, $entity_id, $statusFieldName);
318 318
 	$recordDetails = $entity->getData();
319 319
 	$statusChanged = $vtEntityDelta->hasChanged($moduleName, $entity_id, $statusFieldName);
@@ -941,19 +941,19 @@  discard block
 block discarded – undo
941 941
 		for ($i = 0; $i < $noOfRows; ++$i) {
942 942
 			$status = $adb->query_result($result, $i, 'temp_status');
943 943
 			if ($obj->getImportRecordStatus('none') == $status) {
944
-				$statusCount['PENDING'] ++;
944
+				$statusCount['PENDING']++;
945 945
 			} elseif ($obj->getImportRecordStatus('failed') == $status) {
946
-				$statusCount['FAILED'] ++;
946
+				$statusCount['FAILED']++;
947 947
 			} else {
948
-				$statusCount['IMPORTED'] ++;
948
+				$statusCount['IMPORTED']++;
949 949
 				switch ($status) {
950
-					case $obj->getImportRecordStatus('created') : $statusCount['CREATED'] ++;
950
+					case $obj->getImportRecordStatus('created') : $statusCount['CREATED']++;
951 951
 						break;
952
-					case $obj->getImportRecordStatus('skipped') : $statusCount['SKIPPED'] ++;
952
+					case $obj->getImportRecordStatus('skipped') : $statusCount['SKIPPED']++;
953 953
 						break;
954
-					case $obj->getImportRecordStatus('updated') : $statusCount['UPDATED'] ++;
954
+					case $obj->getImportRecordStatus('updated') : $statusCount['UPDATED']++;
955 955
 						break;
956
-					case $obj->getImportRecordStatus('merged') : $statusCount['MERGED'] ++;
956
+					case $obj->getImportRecordStatus('merged') : $statusCount['MERGED']++;
957 957
 						break;
958 958
 				}
959 959
 			}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,6 +17,7 @@  discard block
 block discarded – undo
17 17
  * Param $ext_prod_arr - existing vtiger_products
18 18
  * Param $module - module name
19 19
  * return type void
20
+ * @param string $mode
20 21
  */
21 22
 function updateStk($product_id, $qty, $mode, $ext_prod_arr, $module)
22 23
 {
@@ -250,9 +251,6 @@  discard block
 block discarded – undo
250 251
 }
251 252
 
252 253
 /** 	Function used to delete the Inventory product details for the passed entity
253
- * 	@param int $objectid - entity id to which we want to delete the product details from REQUEST values where as the entity will be Purchase Order or Invoice
254
- * 	@param string $return_old_values - string which contains the string return_old_values or may be empty, if the string is return_old_values then before delete old values will be retrieved
255
- * 	@return array $ext_prod_arr - if the second input parameter is 'return_old_values' then the array which contains the productid and quantity which will be retrieved before delete the product details will be returned otherwise return empty
256 254
  */
257 255
 function deleteInventoryProductDetails($focus)
258 256
 {
Please login to merge, or discard this patch.
Braces   +27 added lines, -19 removed lines patch added patch discarded remove patch
@@ -128,16 +128,18 @@  discard block
 block discarded – undo
128 128
 	$taxpercentage = $adb->query_result($res, 0, 'taxpercentage');
129 129
 
130 130
 	//This is to retrive the default configured value if the taxpercentage related to product is empty
131
-	if ($taxpercentage == '' && $default == 'default')
132
-		$taxpercentage = getTaxPercentage($type);
131
+	if ($taxpercentage == '' && $default == 'default') {
132
+			$taxpercentage = getTaxPercentage($type);
133
+	}
133 134
 
134 135
 
135 136
 	$log->debug("Exiting from getProductTaxPercentage($productid,$type) function. return value=$taxpercentage");
136
-	if ($current_user->truncate_trailing_zeros === true)
137
-		return \vtlib\Functions::formatDecimal($taxpercentage);
138
-	else
139
-		return $taxpercentage;
140
-}
137
+	if ($current_user->truncate_trailing_zeros === true) {
138
+			return \vtlib\Functions::formatDecimal($taxpercentage);
139
+	} else {
140
+			return $taxpercentage;
141
+	}
142
+	}
141 143
 
142 144
 /** 	Function used to get the list of Tax types as a array
143 145
  * 	@param string $available - available or empty where as default is all, if available then the taxes which are available now will be returned otherwise all taxes will be returned
@@ -229,8 +231,9 @@  discard block
 block discarded – undo
229 231
 		$params = array($productid);
230 232
 
231 233
 		//Postgres 8 fixes
232
-		if ($adb->isPostgres())
233
-			$query = fixPostgresQuery($query, $log, 0);
234
+		if ($adb->isPostgres()) {
235
+					$query = fixPostgresQuery($query, $log, 0);
236
+		}
234 237
 
235 238
 		$res = $adb->pquery($query, $params);
236 239
 		for ($i = 0; $i < $adb->num_rows($res); $i++) {
@@ -372,8 +375,9 @@  discard block
 block discarded – undo
372 375
 
373 376
 	$inv_table_array = [];
374 377
 	$inv_id_array = [];
375
-	if (!array_key_exists($module, $inv_table_array))
376
-		return '';
378
+	if (!array_key_exists($module, $inv_table_array)) {
379
+			return '';
380
+	}
377 381
 
378 382
 	$res = $adb->pquery("select taxtype from $inv_table_array[$module] where $inv_id_array[$module]=?", array($id));
379 383
 
@@ -428,8 +432,9 @@  discard block
 block discarded – undo
428 432
 	$res = $adb->pquery("select $taxname from vtiger_inventoryproductrel where id = ? and productid = ?", array($id, $productid));
429 433
 	$taxvalue = $adb->query_result($res, 0, $taxname);
430 434
 
431
-	if ($taxvalue == '')
432
-		$taxvalue = '0';
435
+	if ($taxvalue == '') {
436
+			$taxvalue = '0';
437
+	}
433 438
 
434 439
 	$log->debug("Exit from function getInventoryProductTaxValue($id, $productid, $taxname).");
435 440
 
@@ -477,8 +482,9 @@  discard block
 block discarded – undo
477 482
 		}
478 483
 
479 484
 		//Postgres 8 fixes
480
-		if ($adb->isPostgres())
481
-			$query = fixPostgresQuery($query, $log, 0);
485
+		if ($adb->isPostgres()) {
486
+					$query = fixPostgresQuery($query, $log, 0);
487
+		}
482 488
 
483 489
 		$res = $adb->pquery($query, $params);
484 490
 		for ($i = 0; $i < $adb->num_rows($res); $i++) {
@@ -775,8 +781,9 @@  discard block
 block discarded – undo
775 781
 		$subject = $row['subject'];
776 782
 		$sql = 'SELECT * FROM %s WHERE temp_status = %s';
777 783
 		$sql = sprintf($sql, $tableName, Import_Data_Action::$IMPORT_RECORD_NONE);
778
-		if (!empty($subject))
779
-			$sql .= ' && subject = "' . str_replace("\"", "\\\"", $subject) . '"';
784
+		if (!empty($subject)) {
785
+					$sql .= ' && subject = "' . str_replace("\"", "\\\"", $subject) . '"';
786
+		}
780 787
 		$subjectResult = $adb->query($sql);
781 788
 		$count = $adb->num_rows($subjectResult);
782 789
 		$subjectRowIDs = [];
@@ -893,8 +900,9 @@  discard block
 block discarded – undo
893 900
 			foreach ($fieldMapping as $fieldName => $index) {
894 901
 				if ($moduleFields[$fieldName]->getTableName() == 'vtiger_inventoryproductrel') {
895 902
 					$lineItemData[$fieldName] = $lineItemFieldData[$fieldName];
896
-					if ($fieldName != 'productid')
897
-						$inventoryFieldData[$fieldName] = '';
903
+					if ($fieldName != 'productid') {
904
+											$inventoryFieldData[$fieldName] = '';
905
+					}
898 906
 				}
899 907
 			}
900 908
 			array_push($lineItems, $lineItemData);
Please login to merge, or discard this patch.
include/utils/EditViewUtils.php 1 patch
Braces   +25 added lines, -15 removed lines patch added patch discarded remove patch
@@ -111,10 +111,12 @@  discard block
 block discarded – undo
111 111
 			$product_Detail[$i]['entityType' . $i] = $entitytype;
112 112
 		}
113 113
 
114
-		if ($listprice == '')
115
-			$listprice = $unitprice;
116
-		if ($qty == '')
117
-			$qty = 1;
114
+		if ($listprice == '') {
115
+					$listprice = $unitprice;
116
+		}
117
+		if ($qty == '') {
118
+					$qty = 1;
119
+		}
118 120
 
119 121
 		//calculate productTotal
120 122
 		$productTotal = $qty * $listprice;
@@ -136,8 +138,9 @@  discard block
 block discarded – undo
136 138
 				$sprod_id = $adb->query_result($sub_prod_query, $j, 'prod_id');
137 139
 				$sprod_name = $subProductArray[] = \vtlib\Functions::getCRMRecordLabel($sprod_id);
138 140
 				$str_sep = "";
139
-				if ($j > 0)
140
-					$str_sep = ":";
141
+				if ($j > 0) {
142
+									$str_sep = ":";
143
+				}
141 144
 				$subprodid_str .= $str_sep . $sprod_id;
142 145
 				if (isset($sprod_name)) {
143 146
 					$subprodname_str .= $str_sep . " - " . $sprod_name;
@@ -219,12 +222,17 @@  discard block
 block discarded – undo
219 222
 
220 223
 			//condition to avoid this function call when create new PO/Invoice from Product module
221 224
 			if ($focus->id != '') {
222
-				if ($taxtype == 'individual')//if individual then show the entered tax percentage
225
+				if ($taxtype == 'individual') {
226
+					//if individual then show the entered tax percentage
223 227
 					$tax_value = getInventoryProductTaxValue($focus->id, $hdnProductId, $tax_name);
224
-				else//if group tax then we have to show the default value when change to individual tax
228
+				} else {
229
+					//if group tax then we have to show the default value when change to individual tax
225 230
 					$tax_value = $tax_details[$tax_count]['percentage'];
226
-			} else//if the above function not called then assign the default associated value of the product
231
+				}
232
+			} else {
233
+				//if the above function not called then assign the default associated value of the product
227 234
 				$tax_value = $tax_details[$tax_count]['percentage'];
235
+			}
228 236
 
229 237
 
230 238
 			$product_Detail[$i]['taxes'][$tax_count]['taxname'] = $tax_name;
@@ -310,13 +318,15 @@  discard block
 block discarded – undo
310 318
 
311 319
 		//if taxtype is individual and want to change to group during edit time then we have to show the all available taxes and their default values
312 320
 		//Also taxtype is group and want to change to individual during edit time then we have to provide the asspciated taxes and their default tax values for individual products
313
-		if ($taxtype == 'group')
314
-			$tax_percent = $adb->query_result($result, 0, $tax_name);
315
-		else
316
-			$tax_percent = $allTaxes[$tax_count]['percentage'];
321
+		if ($taxtype == 'group') {
322
+					$tax_percent = $adb->query_result($result, 0, $tax_name);
323
+		} else {
324
+					$tax_percent = $allTaxes[$tax_count]['percentage'];
325
+		}
317 326
 
318
-		if ($tax_percent == '' || $tax_percent == 'NULL')
319
-			$tax_percent = '0';
327
+		if ($tax_percent == '' || $tax_percent == 'NULL') {
328
+					$tax_percent = '0';
329
+		}
320 330
 		$taxamount = ($subTotal - $finalDiscount) * $tax_percent / 100;
321 331
 		$taxamount = number_format($taxamount, $no_of_decimal_places, '.', '');
322 332
 		$product_Detail[1]['final_details']['taxes'][$tax_count]['taxname'] = $tax_name;
Please login to merge, or discard this patch.