Completed
Push — developer ( 81429f...31cfdf )
by Błażej
38:40
created
modules/Vtiger/actions/Save.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 
73 73
 	/**
74 74
 	 * Function to save record
75
-	 * @param <Vtiger_Request> $request - values of the record
75
+	 * @param Vtiger_Request $request - values of the record
76 76
 	 * @return <RecordModel> - record Model of saved record
77 77
 	 */
78 78
 	public function saveRecord($request)
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -87,8 +87,9 @@  discard block
 block discarded – undo
87 87
 			$relatedRecordId = $recordModel->getId();
88 88
 
89 89
 			$relationModel = Vtiger_Relation_Model::getInstance($parentModuleModel, $relatedModule);
90
-			if ($relationModel)
91
-				$relationModel->addRelation($parentRecordId, $relatedRecordId);
90
+			if ($relationModel) {
91
+							$relationModel->addRelation($parentRecordId, $relatedRecordId);
92
+			}
92 93
 		}
93 94
 		if ($request->get('imgDeleted')) {
94 95
 			$imageIds = $request->get('imageid');
@@ -144,8 +145,9 @@  discard block
 block discarded – undo
144 145
 					$fieldValue = trim($fieldValue);
145 146
 				}
146 147
 				$recordModel->set($fieldName, $fieldValue);
147
-			} else
148
-				$recordModel->set($fieldName, null);
148
+			} else {
149
+							$recordModel->set($fieldName, null);
150
+			}
149 151
 		}
150 152
 		return $recordModel;
151 153
 	}
Please login to merge, or discard this patch.
modules/Vtiger/models/ChartFilter.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -113,6 +113,9 @@  discard block
 block discarded – undo
113 113
 		return [];
114 114
 	}
115 115
 
116
+	/**
117
+	 * @param Vtiger_Widget_Model $widgetModel
118
+	 */
116 119
 	public function setWidgetModel($widgetModel)
117 120
 	{
118 121
 		$this->widgetModel = $widgetModel;
@@ -127,6 +130,9 @@  discard block
 block discarded – undo
127 130
 		}
128 131
 	}
129 132
 
133
+	/**
134
+	 * @return string
135
+	 */
130 136
 	public function getType()
131 137
 	{
132 138
 		return $this->extraData['chartType'];
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
 				if (!isset($groupData[$displayValue]['count'])) {
93 93
 					$groupData[$displayValue]['count'] = 1;
94 94
 				} else {
95
-					$groupData[$displayValue]['count'] ++;
95
+					$groupData[$displayValue]['count']++;
96 96
 				}
97 97
 				if (!isset($groupData[$displayValue]['link'])) {
98 98
 					$moduleModel = $this->getTargetModuleModel();
Please login to merge, or discard this patch.
modules/Vtiger/models/ExportToXml.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -122,6 +122,9 @@  discard block
 block discarded – undo
122 122
 		return html_entity_decode($value);
123 123
 	}
124 124
 
125
+	/**
126
+	 * @param string $fileName
127
+	 */
125 128
 	public function outputFile($fileName)
126 129
 	{
127 130
 		header("Content-Disposition:attachment;filename=$fileName.xml");
@@ -133,6 +136,9 @@  discard block
 block discarded – undo
133 136
 		readfile($this->tmpXmlPath);
134 137
 	}
135 138
 
139
+	/**
140
+	 * @param string $fileName
141
+	 */
136 142
 	protected function outputZipFile($fileName)
137 143
 	{
138 144
 
Please login to merge, or discard this patch.
modules/Vtiger/models/InventoryField.php 3 patches
Doc Comments   -5 removed lines patch added patch discarded remove patch
@@ -16,8 +16,6 @@  discard block
 block discarded – undo
16 16
 
17 17
 	/**
18 18
 	 * Create the name of the Inventory data table
19
-	 * @param string $module Module name
20
-	 * @param string $prefix Prefix table
21 19
 	 * @return string Table name
22 20
 	 */
23 21
 	public function getTableName($type = 'data')
@@ -118,8 +116,6 @@  discard block
 block discarded – undo
118 116
 
119 117
 	/**
120 118
 	 * Get inventory columns
121
-	 * @param string $module Module name
122
-	 * @param boolean $returnInBlock Should the result be divided into blocks
123 119
 	 * @return array Inventory columns
124 120
 	 */
125 121
 	public function getColumns()
@@ -164,7 +160,6 @@  discard block
 block discarded – undo
164 160
 
165 161
 	/**
166 162
 	 * Retrieve list of all fields
167
-	 * @param string $moduleName Module name
168 163
 	 * @return array Fields instance Vtiger_Basic_InventoryField
169 164
 	 */
170 165
 	public function getAllFields()
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -497,9 +497,9 @@
 block discarded – undo
497 497
 		$db = PearDatabase::getInstance();
498 498
 		$query = sprintf('UPDATE `%s` SET sequence = CASE id ', $this->getTableName('fields'));
499 499
 		foreach ($sequenceList as $sequence => $id) {
500
-			$query .=' WHEN ' . $id . ' THEN ' . $sequence;
500
+			$query .= ' WHEN ' . $id . ' THEN ' . $sequence;
501 501
 		}
502
-		$query .=' END ';
502
+		$query .= ' END ';
503 503
 		$query .= sprintf(' WHERE id IN (%s)', generateQuestionMarks($sequenceList));
504 504
 		return $db->pquery($query, array_values($sequenceList));
505 505
 	}
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -133,8 +133,9 @@  discard block
 block discarded – undo
133 133
 		$columns = [];
134 134
 		foreach ($this->getFields() as $key => $field) {
135 135
 			$column = $field->getColumnName();
136
-			if (!empty($column) && $column != '-')
137
-				$columns[] = $column;
136
+			if (!empty($column) && $column != '-') {
137
+							$columns[] = $column;
138
+			}
138 139
 			foreach ($field->getCustomColumn() as $name => $field) {
139 140
 				$columns[] = $name;
140 141
 			}
@@ -187,8 +188,9 @@  discard block
 block discarded – undo
187 188
 		}
188 189
 		$fields = [];
189 190
 		foreach ($fieldPaths as $fieldPath) {
190
-			if (!is_dir($fieldPath))
191
-				continue;
191
+			if (!is_dir($fieldPath)) {
192
+							continue;
193
+			}
192 194
 			foreach (new DirectoryIterator($fieldPath) as $fileinfo) {
193 195
 				if ($fileinfo->isFile() && $fileinfo->getFilename() != 'Basic.php') {
194 196
 					$fieldName = str_replace('.php', '', $fileinfo->getFilename());
Please login to merge, or discard this patch.
modules/Vtiger/models/ListView.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -332,7 +332,6 @@
 block discarded – undo
332 332
 
333 333
 	/**
334 334
 	 * Function to get the list view entries
335
-	 * @param Vtiger_Paging_Model $pagingModel
336 335
 	 * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
337 336
 	 */
338 337
 	public function getListViewCount()
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -169,8 +169,9 @@
 block discarded – undo
169 169
 		$headerFieldModels = [];
170 170
 		$headerFields = $listViewContoller->getListViewHeaderFields();
171 171
 		foreach ($headerFields as $fieldName => $webserviceField) {
172
-			if ($webserviceField && !in_array($webserviceField->getPresence(), [0, 2]))
173
-				continue;
172
+			if ($webserviceField && !in_array($webserviceField->getPresence(), [0, 2])) {
173
+							continue;
174
+			}
174 175
 			$headerFieldModels[$fieldName] = Vtiger_Field_Model::getInstance($fieldName, $module);
175 176
 		}
176 177
 		return $headerFieldModels;
Please login to merge, or discard this patch.
modules/Vtiger/models/MiniList.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -20,6 +20,9 @@
 block discarded – undo
20 20
 	protected $listviewRecords;
21 21
 	protected $targetModuleModel;
22 22
 
23
+	/**
24
+	 * @param Vtiger_Widget_Model $widgetModel
25
+	 */
23 26
 	public function setWidgetModel($widgetModel)
24 27
 	{
25 28
 		$this->widgetModel = $widgetModel;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,9 @@
 block discarded – undo
42 42
 	public function getTargetFields()
43 43
 	{
44 44
 		$fields = $this->extraData['fields'];
45
-		if (!in_array("id", $fields))
46
-			$fields[] = "id";
45
+		if (!in_array("id", $fields)) {
46
+					$fields[] = "id";
47
+		}
47 48
 		return $fields;
48 49
 	}
49 50
 
Please login to merge, or discard this patch.
modules/Vtiger/models/Record.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
 	/**
71 71
 	 * Function to get the Module to which the record belongs
72
-	 * @return Vtiger_Module_Model
72
+	 * @return boolean
73 73
 	 */
74 74
 	public function getModule()
75 75
 	{
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	/**
220 220
 	 * Function to retieve display value for a field
221 221
 	 * @param <String> $fieldName - field name for which values need to get
222
-	 * @return <String>
222
+	 * @return string
223 223
 	 */
224 224
 	public function getDisplayValue($fieldName, $recordId = false, $rawText = false)
225 225
 	{
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	/**
326 326
 	 * Static Function to get the instance of the Vtiger Record Model given the recordid and the module name
327 327
 	 * @param <Number> $recordId
328
-	 * @param <String> $moduleName
328
+	 * @param <String> $module
329 329
 	 * @return Vtiger_Record_Model or Module Specific Record Model instance
330 330
 	 */
331 331
 	public static function getInstanceById($recordId, $module = null)
@@ -493,7 +493,6 @@  discard block
 block discarded – undo
493 493
 
494 494
 	/**
495 495
 	 * Function to get Display value for RelatedList
496
-	 * @param <String> $value
497 496
 	 * @return <String>
498 497
 	 */
499 498
 	public function getRelatedListDisplayValue($fieldName)
@@ -596,6 +595,7 @@  discard block
 block discarded – undo
596 595
 	/**
597 596
 	 * Function to set record module field values
598 597
 	 * @param parent record model
598
+	 * @param Vtiger_Record_Model $parentRecordModel
599 599
 	 */
600 600
 	public function setRecordFieldValues($parentRecordModel)
601 601
 	{
Please login to merge, or discard this patch.
modules/Vtiger/views/Detail.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -302,6 +302,9 @@
 block discarded – undo
302 302
 		return $viewer->view('DetailViewFullContents.tpl', $moduleName, true);
303 303
 	}
304 304
 
305
+	/**
306
+	 * @param Vtiger_Request $request
307
+	 */
305 308
 	public function showModuleSummaryView($request)
306 309
 	{
307 310
 		$recordId = $request->get('record');
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -686,8 +686,9 @@
 block discarded – undo
686 686
 			$sortImage = 'glyphicon glyphicon-chevron-up';
687 687
 		}
688 688
 		if (empty($orderBy) && empty($sortOrder)) {
689
-			if (is_numeric($relatedModuleName))
690
-				$relatedModuleName = vtlib\Functions::getModuleName($relatedModuleName);
689
+			if (is_numeric($relatedModuleName)) {
690
+							$relatedModuleName = vtlib\Functions::getModuleName($relatedModuleName);
691
+			}
691 692
 			$relatedInstance = CRMEntity::getInstance($relatedModuleName);
692 693
 			$orderBy = $relatedInstance->default_order_by;
693 694
 			$sortOrder = $relatedInstance->default_sort_order;
Please login to merge, or discard this patch.
modules/WSAPP/SyncServer.php 2 patches
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,6 +81,9 @@  discard block
 block discarded – undo
81 81
 		return $mapping;
82 82
 	}
83 83
 
84
+	/**
85
+	 * @param string $flag
86
+	 */
84 87
 	public function idmap_storeRecordsInQueue($syncServerId, $recordDetails, $flag, $appid)
85 88
 	{
86 89
 		if (!is_array($recordDetails))
@@ -182,7 +185,7 @@  discard block
 block discarded – undo
182 185
 	 * @param <type> $appid
183 186
 	 * @param <type> $serverid
184 187
 	 * @param <type> $clientid
185
-	 * @param <type> $modifiedTime
188
+	 * @param <type> $clientModifiedTime
186 189
 	 * update the mapping of server and client id
187 190
 	 */
188 191
 	public function idmap_update($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId)
@@ -499,6 +502,9 @@  discard block
 block discarded – undo
499 502
 		return $serverIds;
500 503
 	}
501 504
 
505
+	/**
506
+	 * @param string $flag
507
+	 */
502 508
 	public function convertToQueueRecordFormat($record, $flag)
503 509
 	{
504 510
 		if ($flag != $this->delete)
Please login to merge, or discard this patch.
Braces   +53 added lines, -40 removed lines patch added patch discarded remove patch
@@ -31,8 +31,9 @@  discard block
 block discarded – undo
31 31
 	{
32 32
 		$db = PearDatabase::getInstance();
33 33
 		$appidresult = $db->pquery("SELECT appid FROM vtiger_wsapp WHERE appkey=?", array($key));
34
-		if ($db->num_rows($appidresult))
35
-			return $db->query_result($appidresult, 0, 'appid');
34
+		if ($db->num_rows($appidresult)) {
35
+					return $db->query_result($appidresult, 0, 'appid');
36
+		}
36 37
 		return false;
37 38
 	}
38 39
 
@@ -42,8 +43,9 @@  discard block
 block discarded – undo
42 43
 	 */
43 44
 	public function idmap_get_clientmap($appid, $serverids)
44 45
 	{
45
-		if (!is_array($serverids))
46
-			$serverids = array($serverids);
46
+		if (!is_array($serverids)) {
47
+					$serverids = array($serverids);
48
+		}
47 49
 		$db = PearDatabase::getInstance();
48 50
 		;
49 51
 		$result = $db->pquery(sprintf(
@@ -65,8 +67,9 @@  discard block
 block discarded – undo
65 67
 	 */
66 68
 	public function idmap_get_clientservermap($appid, $clientids)
67 69
 	{
68
-		if (!is_array($clientids))
69
-			$clientids = array($clientids);
70
+		if (!is_array($clientids)) {
71
+					$clientids = array($clientids);
72
+		}
70 73
 
71 74
 		$db = PearDatabase::getInstance();
72 75
 
@@ -83,8 +86,9 @@  discard block
 block discarded – undo
83 86
 
84 87
 	public function idmap_storeRecordsInQueue($syncServerId, $recordDetails, $flag, $appid)
85 88
 	{
86
-		if (!is_array($recordDetails))
87
-			$recordDetails = array($recordDetails);
89
+		if (!is_array($recordDetails)) {
90
+					$recordDetails = array($recordDetails);
91
+		}
88 92
 		$db = PearDatabase::getInstance();
89 93
 		$params = array();
90 94
 		$params[] = $syncServerId;
@@ -99,8 +103,9 @@  discard block
 block discarded – undo
99 103
 		$db = PearDatabase::getInstance();
100 104
 		$checkQuery = "SELECT syncserverid FROM vtiger_wsapp_queuerecords WHERE syncserverid=?";
101 105
 		$result = $db->pquery($checkQuery, array($syncServerId));
102
-		if ($db->num_rows($result) > 0)
103
-			return true;
106
+		if ($db->num_rows($result) > 0) {
107
+					return true;
108
+		}
104 109
 		return false;
105 110
 	}
106 111
 
@@ -148,19 +153,20 @@  discard block
 block discarded – undo
148 153
 	public function idmap_put($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId, $mode = "save")
149 154
 	{
150 155
 		$db = PearDatabase::getInstance();
151
-		if ($mode == $this->create)
152
-			$this->idmap_create($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId);
153
-		else if ($mode == $this->update)
154
-			$this->idmap_update($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId);
155
-		else if ($mode == $this->save) {
156
+		if ($mode == $this->create) {
157
+					$this->idmap_create($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId);
158
+		} else if ($mode == $this->update) {
159
+					$this->idmap_update($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId);
160
+		} else if ($mode == $this->save) {
156 161
 			$result = $db->pquery("SELECT * FROM vtiger_wsapp_recordmapping WHERE appid=? and serverid=? and clientid=?", array($appid, $serverid, $clientid));
157
-			if ($db->num_rows($result) <= 0)
158
-				$this->idmap_create($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId);
159
-			else
160
-				$this->idmap_update($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId);
162
+			if ($db->num_rows($result) <= 0) {
163
+							$this->idmap_create($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId);
164
+			} else {
165
+							$this->idmap_update($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId);
166
+			}
167
+		} else if ($mode == $this->delete) {
168
+					$this->idmap_delete($appid, $serverid, $clientid, $serverAppId);
161 169
 		}
162
-		else if ($mode == $this->delete)
163
-			$this->idmap_delete($appid, $serverid, $clientid, $serverAppId);
164 170
 	}
165 171
 
166 172
 	/**
@@ -229,11 +235,13 @@  discard block
 block discarded – undo
229 235
 		if (empty($type)) {
230 236
 			throw new WebServiceException('WSAPP06', "No sync type specified");
231 237
 		}
232
-		if (is_array($name))
233
-			throw new WebServiceException("WSAPP07", "type is in the wrong format");
238
+		if (is_array($name)) {
239
+					throw new WebServiceException("WSAPP07", "type is in the wrong format");
240
+		}
234 241
 		$type = strtolower($type);
235
-		if (!in_array($type, $this->syncTypes))
236
-			throw new WebServiceException('WSAPP05', "Wrong sync type specified");
242
+		if (!in_array($type, $this->syncTypes)) {
243
+					throw new WebServiceException('WSAPP05', "Wrong sync type specified");
244
+		}
237 245
 		$db = PearDatabase::getInstance();
238 246
 		$uid = uniqid();
239 247
 		$db->pquery("INSERT INTO vtiger_wsapp (name, appkey,type) VALUES(?,?,?)", array($name, $uid, $type));
@@ -267,10 +275,11 @@  discard block
 block discarded – undo
267 275
 			throw new WebServiceException('WSAPP04', "Access restricted to app");
268 276
 		}
269 277
 
270
-		if (!is_array($element))
271
-			$records = array($element);
272
-		else
273
-			$records = $element;
278
+		if (!is_array($element)) {
279
+					$records = array($element);
280
+		} else {
281
+					$records = $element;
282
+		}
274 283
 
275 284
 		//hardcoded since the destination handler will be vtigerCRM
276 285
 		$serverKey = wsapp_getAppKey("vtigerCRM");
@@ -293,13 +302,15 @@  discard block
 block discarded – undo
293 302
 			$clientRecordId = $record['id'];
294 303
 
295 304
 			// Missing client record id?
296
-			if (empty($clientRecordId))
297
-				continue;
305
+			if (empty($clientRecordId)) {
306
+							continue;
307
+			}
298 308
 
299 309
 			$lookupRecordId = false;
300 310
 			$lookupResult = $db->pquery("SELECT serverid,clientmodifiedtime FROM vtiger_wsapp_recordmapping WHERE appid=? && clientid=?", array($appid, $clientRecordId));
301
-			if ($db->num_rows($lookupResult))
302
-				$lookupRecordId = $db->query_result($lookupResult, 0, 'serverid');
311
+			if ($db->num_rows($lookupResult)) {
312
+							$lookupRecordId = $db->query_result($lookupResult, 0, 'serverid');
313
+			}
303 314
 			if (empty($lookupRecordId) && $record['mode'] != "delete") {
304 315
 				$createRecords[$clientRecordId] = $record['values'];
305 316
 				$createRecords[$clientRecordId]['module'] = $record['module'];
@@ -309,8 +320,9 @@  discard block
 block discarded – undo
309 320
 					$deleteRecords[$clientRecordId] = $lookupRecordId;
310 321
 				} else if (!(empty($lookupRecordId))) {
311 322
 					$clientLastModifiedTime = $db->query_result($lookupResult, 0, 'clientmodifiedtime');
312
-					if ($clientLastModifiedTime >= $record['values']['modifiedtime'])
313
-						continue;
323
+					if ($clientLastModifiedTime >= $record['values']['modifiedtime']) {
324
+											continue;
325
+					}
314 326
 					$record['values']['id'] = $lookupRecordId;
315 327
 					$updateRecords[$clientRecordId] = $record['values'];
316 328
 					$updateRecords[$clientRecordId]['module'] = $record['module'];
@@ -446,8 +458,9 @@  discard block
 block discarded – undo
446 458
 	 */
447 459
 	public function map($key, $element, $user)
448 460
 	{
449
-		if (empty($element))
450
-			return;
461
+		if (empty($element)) {
462
+					return;
463
+		}
451 464
 		$db = PearDatabase::getInstance();
452 465
 		$appid = $this->appid_with_key($key);
453 466
 		$createDetails = $element["create"];
@@ -501,9 +514,9 @@  discard block
 block discarded – undo
501 514
 
502 515
 	public function convertToQueueRecordFormat($record, $flag)
503 516
 	{
504
-		if ($flag != $this->delete)
505
-			return $record;
506
-		else {
517
+		if ($flag != $this->delete) {
518
+					return $record;
519
+		} else {
507 520
 			$recordFormat = array();
508 521
 			$recordFormat['id'] = $record['id'];
509 522
 			return $recordFormat;
Please login to merge, or discard this patch.