Completed
Push — developer ( b87714...e261b6 )
by Błażej
55:53
created
include/CRMEntity.php 3 patches
Doc Comments   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -374,6 +374,11 @@  discard block
 block discarded – undo
374 374
 	}
375 375
 
376 376
 	// Function which returns the value based on result type (array / ADODB ResultSet)
377
+
378
+	/**
379
+	 * @param integer $index
380
+	 * @param string $columnname
381
+	 */
377 382
 	private function resolve_query_result_value($result, $index, $columnname)
378 383
 	{
379 384
 		$adb = PearDatabase::getInstance();
@@ -633,7 +638,7 @@  discard block
 block discarded – undo
633 638
 	}
634 639
 
635 640
 	/** Function to delete a record in the specifed table
636
-	 * @param $table_name -- table name:: Type varchar
641
+	 * @param string $table_name -- table name:: Type varchar
637 642
 	 * The function will delete a record .The id is obtained from the class variable $this->id and the columnname got from $this->tab_name_index[$table_name]
638 643
 	 */
639 644
 	public function deleteRelation($table_name)
@@ -817,6 +822,7 @@  discard block
 block discarded – undo
817 822
 
818 823
 	/** Function to saves the values in all the tables mentioned in the class variable $tab_name for the specified module
819 824
 	 * @param $module -- module:: Type varchar
825
+	 * @param string $module_name
820 826
 	 */
821 827
 	public function save($module_name, $fileid = '')
822 828
 	{
@@ -2562,10 +2568,10 @@  discard block
 block discarded – undo
2562 2568
 
2563 2569
 	/**
2564 2570
 	 *
2565
-	 * @param <type> $module
2566
-	 * @param <type> $user
2571
+	 * @param Users $user
2567 2572
 	 * @param <type> $parentRole
2568 2573
 	 * @param <type> $userGroups
2574
+	 * @param string $tableName
2569 2575
 	 */
2570 2576
 	protected function setupTemporaryTable($tableName, $tabId, $user, $parentRole, $userGroups)
2571 2577
 	{
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1970,7 +1970,7 @@  discard block
 block discarded – undo
1970 1970
 					$matrix->addDependency($tab_name, $crmentityRelModuleFieldTable);
1971 1971
 
1972 1972
 					if ($queryPlanner->requireTable($crmentityRelModuleFieldTable, $matrix)) {
1973
-						$relquery.= " left join vtiger_crmentity as $crmentityRelModuleFieldTable on $crmentityRelModuleFieldTable.crmid = $tab_name.$field_name and vtiger_crmentityRel$module$field_id.deleted=0";
1973
+						$relquery .= " left join vtiger_crmentity as $crmentityRelModuleFieldTable on $crmentityRelModuleFieldTable.crmid = $tab_name.$field_name and vtiger_crmentityRel$module$field_id.deleted=0";
1974 1974
 					}
1975 1975
 
1976 1976
 					for ($j = 0; $j < $adb->num_rows($ui10_modules_query); $j++) {
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
 						$rel_tab_name_rel_module_table_alias = $rel_tab_name . "Rel$module$field_id";
1985 1985
 
1986 1986
 						if ($queryPlanner->requireTable($rel_tab_name_rel_module_table_alias)) {
1987
-							$relquery.= " left join $rel_tab_name as $rel_tab_name_rel_module_table_alias  on $rel_tab_name_rel_module_table_alias.$rel_tab_index = $crmentityRelModuleFieldTable.crmid";
1987
+							$relquery .= " left join $rel_tab_name as $rel_tab_name_rel_module_table_alias  on $rel_tab_name_rel_module_table_alias.$rel_tab_index = $crmentityRelModuleFieldTable.crmid";
1988 1988
 						}
1989 1989
 					}
1990 1990
 				}
@@ -2376,7 +2376,7 @@  discard block
 block discarded – undo
2376 2376
 		$entitycolumnnames = $entityfields['fieldname'];
2377 2377
 		$query = "select crmid as id, $querycolumnnames, $entitycolumnnames as name ";
2378 2378
 		$query .= " FROM $this->table_name ";
2379
-		$query .=" INNER JOIN vtiger_crmentity ON $this->table_name.$this->table_index = vtiger_crmentity.crmid && deleted = 0 ";
2379
+		$query .= " INNER JOIN vtiger_crmentity ON $this->table_name.$this->table_index = vtiger_crmentity.crmid && deleted = 0 ";
2380 2380
 
2381 2381
 		//remove the base table
2382 2382
 		$LookupTable = array_unique($lookuptables);
@@ -2391,7 +2391,7 @@  discard block
 block discarded – undo
2391 2391
 						on $this->table_name.$this->table_index = $tablename." . $this->tab_name_index[$tablename];
2392 2392
 		}
2393 2393
 		if (!empty($lookupcolumns) && $value !== false) {
2394
-			$query .=" WHERE ";
2394
+			$query .= " WHERE ";
2395 2395
 			$i = 0;
2396 2396
 			$columnCount = count($lookupcolumns);
2397 2397
 			foreach ($lookupcolumns as $columnname) {
Please login to merge, or discard this patch.
Braces   +157 added lines, -114 removed lines patch added patch discarded remove patch
@@ -169,8 +169,9 @@  discard block
 block discarded – undo
169 169
 
170 170
 		//to get the owner id
171 171
 		$ownerid = $this->column_fields['assigned_user_id'];
172
-		if (!isset($ownerid) || $ownerid == '')
173
-			$ownerid = $current_user->id;
172
+		if (!isset($ownerid) || $ownerid == '') {
173
+					$ownerid = $current_user->id;
174
+		}
174 175
 
175 176
 		if (isset($file_details['original_name']) && $file_details['original_name'] != null) {
176 177
 			$file_name = $file_details['original_name'];
@@ -338,16 +339,18 @@  discard block
 block discarded – undo
338 339
 			} else {
339 340
 				$this->id = $this->newRecord;
340 341
 			}
341
-			if (empty($current_user->id))
342
-				$current_user->id = 0;
342
+			if (empty($current_user->id)) {
343
+							$current_user->id = 0;
344
+			}
343 345
 
344 346
 			// Customization
345 347
 			$created_date_var = $adb->formatDate($date_var, true);
346 348
 			$modified_date_var = $adb->formatDate($date_var, true);
347 349
 			// Preserve the timestamp
348 350
 			if (self::isBulkSaveMode()) {
349
-				if (!empty($this->column_fields['createdtime']))
350
-					$created_date_var = $adb->formatDate($this->column_fields['createdtime'], true);
351
+				if (!empty($this->column_fields['createdtime'])) {
352
+									$created_date_var = $adb->formatDate($this->column_fields['createdtime'], true);
353
+				}
351 354
 				//NOTE : modifiedtime ignored to support vtws_sync API track changes.
352 355
 			}
353 356
 			// END
@@ -377,10 +380,11 @@  discard block
 block discarded – undo
377 380
 	private function resolve_query_result_value($result, $index, $columnname)
378 381
 	{
379 382
 		$adb = PearDatabase::getInstance();
380
-		if (is_array($result))
381
-			return $result[$index][$columnname];
382
-		else
383
-			return $adb->query_result($result, $index, $columnname);
383
+		if (is_array($result)) {
384
+					return $result[$index][$columnname];
385
+		} else {
386
+					return $adb->query_result($result, $index, $columnname);
387
+		}
384 388
 	}
385 389
 
386 390
 	/** Function to insert values in the specifed table for the specified module
@@ -600,10 +604,10 @@  discard block
 block discarded – undo
600 604
 				} else {
601 605
 					$fldvalue = $this->column_fields[$fieldname];
602 606
 				}
603
-				if ($uitype != 33 && $uitype != 8)
604
-					$fldvalue = \vtlib\Functions::fromHTML($fldvalue, ($insertion_mode == 'edit') ? true : false);
605
-			}
606
-			else {
607
+				if ($uitype != 33 && $uitype != 8) {
608
+									$fldvalue = \vtlib\Functions::fromHTML($fldvalue, ($insertion_mode == 'edit') ? true : false);
609
+				}
610
+			} else {
607 611
 				$fldvalue = '';
608 612
 			}
609 613
 
@@ -661,8 +665,9 @@  discard block
 block discarded – undo
661 665
 		$query1 = "select * from vtiger_seattachmentsrel where crmid=?";
662 666
 		$result = $adb->pquery($query1, array($notesid));
663 667
 		$noofrows = $adb->num_rows($result);
664
-		if ($noofrows != 0)
665
-			$attachmentid = $adb->query_result($result, 0, 'attachmentsid');
668
+		if ($noofrows != 0) {
669
+					$attachmentid = $adb->query_result($result, 0, 'attachmentsid');
670
+		}
666 671
 		if ($attachmentid != '') {
667 672
 			$query2 = "select * from vtiger_attachments where attachmentsid=?";
668 673
 			$filename = $adb->query_result($adb->pquery($query2, array($attachmentid)), 0, 'name');
@@ -713,10 +718,11 @@  discard block
 block discarded – undo
713 718
 		// Lookup module field cache
714 719
 		if ($module == 'Calendar' || $module == 'Events') {
715 720
 			getColumnFields('Calendar');
716
-			if (VTCacheUtils::lookupFieldInfo_Module('Events'))
717
-				$cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events');
718
-			else
719
-				$cachedEventsFields = [];
721
+			if (VTCacheUtils::lookupFieldInfo_Module('Events')) {
722
+							$cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events');
723
+			} else {
724
+							$cachedEventsFields = [];
725
+			}
720 726
 			$cachedCalendarFields = VTCacheUtils::lookupFieldInfo_Module('Calendar');
721 727
 			$cachedModuleFields = array_merge($cachedEventsFields, $cachedCalendarFields);
722 728
 			$module = 'Calendar';
@@ -861,10 +867,11 @@  discard block
 block discarded – undo
861 867
 			while ($row = $this->db->fetchByAssoc($result)) {
862 868
 				$rowid = $row[$this->table_index];
863 869
 
864
-				if (isset($rowid))
865
-					$this->retrieve_entity_info($rowid, $this->module_name);
866
-				else
867
-					$this->db->println("rowid not set unable to retrieve");
870
+				if (isset($rowid)) {
871
+									$this->retrieve_entity_info($rowid, $this->module_name);
872
+				} else {
873
+									$this->db->println("rowid not set unable to retrieve");
874
+				}
868 875
 
869 876
 
870 877
 
@@ -877,10 +884,11 @@  discard block
 block discarded – undo
877 884
 			}
878 885
 		}
879 886
 
880
-		if (isset($list))
881
-			return $list;
882
-		else
883
-			return null;
887
+		if (isset($list)) {
888
+					return $list;
889
+		} else {
890
+					return null;
891
+		}
884 892
 	}
885 893
 
886 894
 	/** This function should be overridden in each module.  It marks an item as deleted.
@@ -1050,19 +1058,22 @@  discard block
 block discarded – undo
1050 1058
 		require_once('include/utils/UserInfoUtil.php');
1051 1059
 		foreach ($this->column_fields as $fieldname => $fieldvalue) {
1052 1060
 			$reset_value = false;
1053
-			if (getFieldVisibilityPermission($moduleName, $current_user->id, $fieldname) != '0')
1054
-				$reset_value = true;
1061
+			if (getFieldVisibilityPermission($moduleName, $current_user->id, $fieldname) != '0') {
1062
+							$reset_value = true;
1063
+			}
1055 1064
 
1056
-			if ($fieldname == "record_id" || $fieldname == "record_module")
1057
-				$reset_value = false;
1065
+			if ($fieldname == "record_id" || $fieldname == "record_module") {
1066
+							$reset_value = false;
1067
+			}
1058 1068
 
1059 1069
 			/*
1060 1070
 			  if (isset($this->additional_column_fields) && in_array($fieldname, $this->additional_column_fields) == true)
1061 1071
 			  $reset_value = false;
1062 1072
 			 */
1063 1073
 
1064
-			if ($reset_value == true)
1065
-				$this->column_fields[$fieldname] = "";
1074
+			if ($reset_value == true) {
1075
+							$this->column_fields[$fieldname] = "";
1076
+			}
1066 1077
 		}
1067 1078
 	}
1068 1079
 
@@ -1108,8 +1119,9 @@  discard block
 block discarded – undo
1108 1119
 		}
1109 1120
 
1110 1121
 		foreach ($colf as $key => $value) {
1111
-			if (getFieldVisibilityPermission($module, $current_user->id, $key, 'readwrite') == '0')
1112
-				$this->importable_fields[$key] = $value;
1122
+			if (getFieldVisibilityPermission($module, $current_user->id, $key, 'readwrite') == '0') {
1123
+							$this->importable_fields[$key] = $value;
1124
+			}
1113 1125
 		}
1114 1126
 	}
1115 1127
 
@@ -1359,13 +1371,15 @@  discard block
 block discarded – undo
1359 1371
 		$num_rows = $adb->num_rows($result);
1360 1372
 		for ($i = 0; $i < $num_rows; $i++) {
1361 1373
 			$columnname = $adb->query_result($result, $i, 'columnname');
1362
-			if (in_array($columnname, $this->sortby_fields))
1363
-				continue;
1364
-			else
1365
-				$this->sortby_fields[] = $columnname;
1374
+			if (in_array($columnname, $this->sortby_fields)) {
1375
+							continue;
1376
+			} else {
1377
+							$this->sortby_fields[] = $columnname;
1378
+			}
1379
+		}
1380
+		if ($tabid == 21 || $tabid == 22) {
1381
+					$this->sortby_fields[] = 'crmid';
1366 1382
 		}
1367
-		if ($tabid == 21 || $tabid == 22)
1368
-			$this->sortby_fields[] = 'crmid';
1369 1383
 		$log->debug("Exiting initSortByField");
1370 1384
 	}
1371 1385
 	/* Function to check if the mod number already exits */
@@ -1375,10 +1389,11 @@  discard block
 block discarded – undo
1375 1389
 		$adb = PearDatabase::getInstance();
1376 1390
 		$result = $adb->pquery(sprintf("SELECT %s FROM *s WHERE %s = ?", $adb->sql_escape_string($column), $adb->sql_escape_string($table), $adb->sql_escape_string($column)), [$no]);
1377 1391
 		$num_rows = $adb->num_rows($result);
1378
-		if ($num_rows > 0)
1379
-			return true;
1380
-		else
1381
-			return false;
1392
+		if ($num_rows > 0) {
1393
+					return true;
1394
+		} else {
1395
+					return false;
1396
+		}
1382 1397
 	}
1383 1398
 
1384 1399
 	// END
@@ -1391,8 +1406,9 @@  discard block
 block discarded – undo
1391 1406
 
1392 1407
 		vtlib_setup_modulevars($module, $this);
1393 1408
 		$tabid = \includes\Modules::getModuleId($module);
1394
-		if (!\includes\fields\RecordNumber::isModuleSequenceConfigured($tabid))
1395
-			return;
1409
+		if (!\includes\fields\RecordNumber::isModuleSequenceConfigured($tabid)) {
1410
+					return;
1411
+		}
1396 1412
 		$fieldinfo = $adb->pquery("SELECT * FROM vtiger_field WHERE tabid = ? && uitype = 4", Array($tabid));
1397 1413
 
1398 1414
 		$returninfo = [];
@@ -1449,8 +1465,9 @@  discard block
 block discarded – undo
1449 1465
 		$singular_modname = vtlib_toSingular($related_module);
1450 1466
 		$button = '';
1451 1467
 		if ($actions) {
1452
-			if (is_string($actions))
1453
-				$actions = explode(',', strtoupper($actions));
1468
+			if (is_string($actions)) {
1469
+							$actions = explode(',', strtoupper($actions));
1470
+			}
1454 1471
 			if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
1455 1472
 				$button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$currentModule&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "'>&nbsp;";
1456 1473
 			}
@@ -1463,10 +1480,11 @@  discard block
 block discarded – undo
1463 1480
 		}
1464 1481
 
1465 1482
 		// To make the edit or del link actions to return back to same view.
1466
-		if ($singlepane_view == 'true')
1467
-			$returnset = "&return_module=$this_module&return_action=DetailView&return_id=$id";
1468
-		else
1469
-			$returnset = "&return_module=$this_module&return_action=CallRelatedList&return_id=$id";
1483
+		if ($singlepane_view == 'true') {
1484
+					$returnset = "&return_module=$this_module&return_action=DetailView&return_id=$id";
1485
+		} else {
1486
+					$returnset = "&return_module=$this_module&return_action=CallRelatedList&return_id=$id";
1487
+		}
1470 1488
 
1471 1489
 		$userNameSql = \vtlib\Deprecated::getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name',
1472 1490
 				'last_name' => 'vtiger_users.last_name'), 'Users');
@@ -1488,8 +1506,9 @@  discard block
 block discarded – undo
1488 1506
 
1489 1507
 		$return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
1490 1508
 
1491
-		if ($return_value == null)
1492
-			$return_value = [];
1509
+		if ($return_value == null) {
1510
+					$return_value = [];
1511
+		}
1493 1512
 		$return_value['CUSTOM_BUTTON'] = $button;
1494 1513
 		return $return_value;
1495 1514
 	}
@@ -1521,8 +1540,9 @@  discard block
 block discarded – undo
1521 1540
 				return true;
1522 1541
 			} else if ($lastviewed && $modifiedon) {
1523 1542
 				/** Lastviewed and Modified time is available. */
1524
-				if ($this->__timediff($modifiedon, $lastviewed) > 0)
1525
-					return true;
1543
+				if ($this->__timediff($modifiedon, $lastviewed) > 0) {
1544
+									return true;
1545
+				}
1526 1546
 			}
1527 1547
 		}
1528 1548
 		return false;
@@ -1542,8 +1562,9 @@  discard block
 block discarded – undo
1542 1562
 
1543 1563
 		$t2 = mktime($t2_h, $t2_i, $t2_s, $t2_m, $t2_d, $t2_y);
1544 1564
 
1545
-		if ($t1 == $t2)
1546
-			return 0;
1565
+		if ($t1 == $t2) {
1566
+					return 0;
1567
+		}
1547 1568
 		return $t2 - $t1;
1548 1569
 	}
1549 1570
 
@@ -1563,8 +1584,9 @@  discard block
 block discarded – undo
1563 1584
 	 */
1564 1585
 	public function save_related_module($module, $crmid, $withModule, $withCrmid, $relatedName = false)
1565 1586
 	{
1566
-		if (!is_array($withCrmid))
1567
-			$withCrmid = [$withCrmid];
1587
+		if (!is_array($withCrmid)) {
1588
+					$withCrmid = [$withCrmid];
1589
+		}
1568 1590
 		switch ($relatedName) {
1569 1591
 			case 'get_many_to_many':
1570 1592
 				$this->saveRelatedM2M($module, $crmid, $withModule, $withCrmid);
@@ -1585,8 +1607,9 @@  discard block
 block discarded – undo
1585 1607
 		foreach ($withCrmid as $relcrmid) {
1586 1608
 			$check = $db->pquery(sprintf('SELECT 1 FROM `%s` WHERE %s = ? && %s = ?', $referenceInfo['table'], $referenceInfo['base'], $referenceInfo['rel']), [$relcrmid, $crmid]);
1587 1609
 			// Relation already exists? No need to add again
1588
-			if ($check && $db->getRowCount($check))
1589
-				continue;
1610
+			if ($check && $db->getRowCount($check)) {
1611
+							continue;
1612
+			}
1590 1613
 			$db->insert($referenceInfo['table'], [
1591 1614
 				$referenceInfo['base'] => $relcrmid,
1592 1615
 				$referenceInfo['rel'] => $crmid
@@ -1602,8 +1625,9 @@  discard block
 block discarded – undo
1602 1625
 			if ($withModule == 'Documents') {
1603 1626
 				$checkpresence = $db->pquery('SELECT crmid FROM vtiger_senotesrel WHERE crmid = ? && notesid = ?', [$crmid, $relcrmid]);
1604 1627
 				// Relation already exists? No need to add again
1605
-				if ($checkpresence && $db->getRowCount($checkpresence))
1606
-					continue;
1628
+				if ($checkpresence && $db->getRowCount($checkpresence)) {
1629
+									continue;
1630
+				}
1607 1631
 
1608 1632
 				$db->insert('vtiger_senotesrel', [
1609 1633
 					'crmid' => $crmid,
@@ -1613,8 +1637,9 @@  discard block
 block discarded – undo
1613 1637
 				$checkpresence = $db->pquery('SELECT crmid FROM vtiger_crmentityrel WHERE crmid = ? && module = ? && relcrmid = ? && relmodule = ?', [$crmid, $module, $relcrmid, $withModule]
1614 1638
 				);
1615 1639
 				// Relation already exists? No need to add again
1616
-				if ($checkpresence && $db->getRowCount($checkpresence))
1617
-					continue;
1640
+				if ($checkpresence && $db->getRowCount($checkpresence)) {
1641
+									continue;
1642
+				}
1618 1643
 
1619 1644
 				$db->insert('vtiger_crmentityrel', [
1620 1645
 					'crmid' => $crmid,
@@ -1638,8 +1663,9 @@  discard block
 block discarded – undo
1638 1663
 	public function delete_related_module($module, $crmid, $withModule, $withCrmid)
1639 1664
 	{
1640 1665
 		$db = PearDatabase::getInstance();
1641
-		if (!is_array($withCrmid))
1642
-			$withCrmid = Array($withCrmid);
1666
+		if (!is_array($withCrmid)) {
1667
+					$withCrmid = Array($withCrmid);
1668
+		}
1643 1669
 		foreach ($withCrmid as $relcrmid) {
1644 1670
 
1645 1671
 			if ($withModule == 'Documents') {
@@ -1673,8 +1699,9 @@  discard block
 block discarded – undo
1673 1699
 
1674 1700
 		$button = '';
1675 1701
 		if ($actions) {
1676
-			if (is_string($actions))
1677
-				$actions = explode(',', strtoupper($actions));
1702
+			if (is_string($actions)) {
1703
+							$actions = explode(',', strtoupper($actions));
1704
+			}
1678 1705
 			if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
1679 1706
 				$button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' " .
1680 1707
 					" type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$current_module&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id','test','width=640,height=602,resizable=0,scrollbars=0');\"" .
@@ -1689,10 +1716,11 @@  discard block
 block discarded – undo
1689 1716
 		}
1690 1717
 
1691 1718
 		// To make the edit or del link actions to return back to same view.
1692
-		if ($singlepane_view == 'true')
1693
-			$returnset = "&return_module=$current_module&return_action=DetailView&return_id=$id";
1694
-		else
1695
-			$returnset = "&return_module=$current_module&return_action=CallRelatedList&return_id=$id";
1719
+		if ($singlepane_view == 'true') {
1720
+					$returnset = "&return_module=$current_module&return_action=DetailView&return_id=$id";
1721
+		} else {
1722
+					$returnset = "&return_module=$current_module&return_action=CallRelatedList&return_id=$id";
1723
+		}
1696 1724
 
1697 1725
 		$query = "SELECT vtiger_crmentity.*, $other->table_name.*";
1698 1726
 
@@ -1706,10 +1734,12 @@  discard block
 block discarded – undo
1706 1734
 				$query .= ", $tname.*";
1707 1735
 
1708 1736
 				// Setup the default JOIN conditions if not specified
1709
-				if (empty($relmap[1]))
1710
-					$relmap[1] = $other->table_name;
1711
-				if (empty($relmap[2]))
1712
-					$relmap[2] = $relmap[0];
1737
+				if (empty($relmap[1])) {
1738
+									$relmap[1] = $other->table_name;
1739
+				}
1740
+				if (empty($relmap[2])) {
1741
+									$relmap[2] = $relmap[0];
1742
+				}
1713 1743
 				$more_relation .= " LEFT JOIN $tname ON $tname.$relmap[0] = $relmap[1].$relmap[2]";
1714 1744
 			}
1715 1745
 		}
@@ -1723,8 +1753,9 @@  discard block
 block discarded – undo
1723 1753
 		$query .= " WHERE vtiger_crmentity.deleted = 0 && (vtiger_crmentityrel.crmid = $id || vtiger_crmentityrel.relcrmid = $id)";
1724 1754
 		$return_value = GetRelatedList($current_module, $related_module, $other, $query, $button, $returnset);
1725 1755
 
1726
-		if ($return_value == null)
1727
-			$return_value = [];
1756
+		if ($return_value == null) {
1757
+					$return_value = [];
1758
+		}
1728 1759
 		$return_value['CUSTOM_BUTTON'] = $button;
1729 1760
 
1730 1761
 		return $return_value;
@@ -1757,10 +1788,11 @@  discard block
 block discarded – undo
1757 1788
 		$row = [];
1758 1789
 
1759 1790
 		// To make the edit or del link actions to return back to same view.
1760
-		if ($singlepane_view == 'true')
1761
-			$returnset = "&return_module=$currentModule&return_action=DetailView&return_id=$id";
1762
-		else
1763
-			$returnset = "&return_module=$currentModule&return_action=CallRelatedList&return_id=$id";
1791
+		if ($singlepane_view == 'true') {
1792
+					$returnset = "&return_module=$currentModule&return_action=DetailView&return_id=$id";
1793
+		} else {
1794
+					$returnset = "&return_module=$currentModule&return_action=CallRelatedList&return_id=$id";
1795
+		}
1764 1796
 
1765 1797
 		$return_value = null;
1766 1798
 
@@ -1791,8 +1823,9 @@  discard block
 block discarded – undo
1791 1823
 			$button .= '<input type="hidden" name="' . $dependentColumn . '" id="' . $dependentColumn . '" value="' . $id . '">';
1792 1824
 			$button .= '<input type="hidden" name="' . $dependentColumn . '_type" id="' . $dependentColumn . '_type" value="' . $currentModule . '">';
1793 1825
 			if ($actions) {
1794
-				if (is_string($actions))
1795
-					$actions = explode(',', strtoupper($actions));
1826
+				if (is_string($actions)) {
1827
+									$actions = explode(',', strtoupper($actions));
1828
+				}
1796 1829
 				if (in_array('ADD', $actions) && isPermitted($relatedModule, 1, '') == 'yes' && getFieldVisibilityPermission($relatedModule, $current_user->id, $dependentField, 'readwrite') == '0') {
1797 1830
 					$button .= "<input title='" . \includes\Language::translate('LBL_ADD_NEW') . " " . \includes\Language::translate($singular_modname, $relatedModule) . "' class='crmbutton small create'" .
1798 1831
 						" onclick='this.form.action.value=\"EditView\";this.form.module.value=\"$relatedModule\"' type='submit' name='button'" .
@@ -1802,8 +1835,9 @@  discard block
 block discarded – undo
1802 1835
 			$query = $this->createDependentQuery($other, $row, $id);
1803 1836
 			$return_value = GetRelatedList($currentModule, $relatedModule, $other, $query, $button, $returnset);
1804 1837
 		}
1805
-		if ($return_value == null)
1806
-			$return_value = [];
1838
+		if ($return_value == null) {
1839
+					$return_value = [];
1840
+		}
1807 1841
 		$return_value['CUSTOM_BUTTON'] = $button;
1808 1842
 
1809 1843
 		return $return_value;
@@ -1831,10 +1865,12 @@  discard block
 block discarded – undo
1831 1865
 					continue;
1832 1866
 				}
1833 1867
 				// Setup the default JOIN conditions if not specified
1834
-				if (empty($relmap[1]))
1835
-					$relmap[1] = $other->table_name;
1836
-				if (empty($relmap[2]))
1837
-					$relmap[2] = $relmap[0];
1868
+				if (empty($relmap[1])) {
1869
+									$relmap[1] = $other->table_name;
1870
+				}
1871
+				if (empty($relmap[2])) {
1872
+									$relmap[2] = $relmap[0];
1873
+				}
1838 1874
 				$join .= " LEFT JOIN $tname ON $tname.$relmap[0] = $relmap[1].$relmap[2]";
1839 1875
 			}
1840 1876
 		}
@@ -2351,8 +2387,9 @@  discard block
 block discarded – undo
2351 2387
 	{
2352 2388
 		$adb = PearDatabase::getInstance();
2353 2389
 
2354
-		if (!is_array($uitypes))
2355
-			$uitypes = array($uitypes);
2390
+		if (!is_array($uitypes)) {
2391
+					$uitypes = array($uitypes);
2392
+		}
2356 2393
 		$module = get_class($this);
2357 2394
 
2358 2395
 		$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
@@ -2396,10 +2433,11 @@  discard block
 block discarded – undo
2396 2433
 			$columnCount = count($lookupcolumns);
2397 2434
 			foreach ($lookupcolumns as $columnname) {
2398 2435
 				if (!empty($columnname)) {
2399
-					if ($i == 0 || $i == ($columnCount))
2400
-						$query .= sprintf("%s = '%s'", $columnname, $value);
2401
-					else
2402
-						$query .= sprintf(" || %s = '%s'", $columnname, $value);
2436
+					if ($i == 0 || $i == ($columnCount)) {
2437
+											$query .= sprintf("%s = '%s'", $columnname, $value);
2438
+					} else {
2439
+											$query .= sprintf(" || %s = '%s'", $columnname, $value);
2440
+					}
2403 2441
 					$i++;
2404 2442
 				}
2405 2443
 			}
@@ -2456,8 +2494,9 @@  discard block
 block discarded – undo
2456 2494
 
2457 2495
 	public function getUserAccessConditionsQuerySR($module, $currentUser = false, $relatedRecord = false)
2458 2496
 	{
2459
-		if ($currentUser == false)
2460
-			$currentUser = vglobal('current_user');
2497
+		if ($currentUser == false) {
2498
+					$currentUser = vglobal('current_user');
2499
+		}
2461 2500
 
2462 2501
 		$userid = $currentUser->id;
2463 2502
 		$userPrivileges = \Vtiger_Util_Helper::getUserPrivilegesFile($userid);
@@ -2683,10 +2722,11 @@  discard block
 block discarded – undo
2683 2722
 		$log = LoggerManager::getInstance();
2684 2723
 		$currentModule = vglobal('currentModule');
2685 2724
 		$log->debug("Entering getSortOrder() method ...");
2686
-		if (AppRequest::has('sorder'))
2687
-			$sorder = $this->db->sql_escape_string(AppRequest::getForSql('sorder'));
2688
-		else
2689
-			$sorder = (($_SESSION[$currentModule . '_Sort_Order'] != '') ? ($_SESSION[$currentModule . '_Sort_Order']) : ($this->default_sort_order));
2725
+		if (AppRequest::has('sorder')) {
2726
+					$sorder = $this->db->sql_escape_string(AppRequest::getForSql('sorder'));
2727
+		} else {
2728
+					$sorder = (($_SESSION[$currentModule . '_Sort_Order'] != '') ? ($_SESSION[$currentModule . '_Sort_Order']) : ($this->default_sort_order));
2729
+		}
2690 2730
 		$log->debug("Exiting getSortOrder() method ...");
2691 2731
 		return $sorder;
2692 2732
 	}
@@ -2706,10 +2746,11 @@  discard block
 block discarded – undo
2706 2746
 			$use_default_order_by = $this->default_order_by;
2707 2747
 		}
2708 2748
 
2709
-		if (AppRequest::has('order_by'))
2710
-			$order_by = $this->db->sql_escape_string(AppRequest::getForSql('order_by'));
2711
-		else
2712
-			$order_by = (($_SESSION[$currentModule . '_Order_By'] != '') ? ($_SESSION[$currentModule . '_Order_By']) : ($use_default_order_by));
2749
+		if (AppRequest::has('order_by')) {
2750
+					$order_by = $this->db->sql_escape_string(AppRequest::getForSql('order_by'));
2751
+		} else {
2752
+					$order_by = (($_SESSION[$currentModule . '_Order_By'] != '') ? ($_SESSION[$currentModule . '_Order_By']) : ($use_default_order_by));
2753
+		}
2713 2754
 		$log->debug("Exiting getOrderBy method ...");
2714 2755
 		return $order_by;
2715 2756
 	}
@@ -2749,8 +2790,9 @@  discard block
 block discarded – undo
2749 2790
 		$selectClause = sprintf('SELECT %s.%s AS recordid,%s%s', $this->table_name, $this->table_index, $tableColumnsString, $additionalColumns);
2750 2791
 
2751 2792
 		// Select Custom Field Table Columns if present
2752
-		if (isset($this->customFieldTable))
2753
-			$query .= ", " . $this->customFieldTable[0] . ".* ";
2793
+		if (isset($this->customFieldTable)) {
2794
+					$query .= ", " . $this->customFieldTable[0] . ".* ";
2795
+		}
2754 2796
 
2755 2797
 		$fromClause = " FROM $this->table_name";
2756 2798
 
@@ -2794,8 +2836,9 @@  discard block
 block discarded – undo
2794 2836
 		foreach ($tableColumns as $tableColumn) {
2795 2837
 			$tableInfo = explode('.', $tableColumn);
2796 2838
 			$duplicateCheckClause .= " ifnull($tableColumn,'null') = ifnull(temp.$tableInfo[1],'null')";
2797
-			if (count($tableColumns) != $i++)
2798
-				$duplicateCheckClause .= ' && ';
2839
+			if (count($tableColumns) != $i++) {
2840
+							$duplicateCheckClause .= ' && ';
2841
+			}
2799 2842
 		}
2800 2843
 
2801 2844
 		$query = $selectClause . $fromClause .
Please login to merge, or discard this patch.
include/database/PearDatabase.php 2 patches
Doc Comments   +34 added lines patch added patch discarded remove patch
@@ -127,6 +127,9 @@  discard block
 block discarded – undo
127 127
 		}
128 128
 	}
129 129
 
130
+	/**
131
+	 * @param string $type
132
+	 */
130 133
 	public static function getDBConfig($type)
131 134
 	{
132 135
 		if (!self::$dbConfig) {
@@ -139,6 +142,14 @@  discard block
 block discarded – undo
139 142
 		return false;
140 143
 	}
141 144
 
145
+	/**
146
+	 * @param string $dbtype
147
+	 * @param string $host
148
+	 * @param string $dbname
149
+	 * @param string $username
150
+	 * @param string $passwd
151
+	 * @param integer $port
152
+	 */
142 153
 	protected function loadDBConfig($dbtype, $host, $dbname, $username, $passwd, $port)
143 154
 	{
144 155
 		if ($host == '_SERVER_') {
@@ -232,6 +243,9 @@  discard block
 block discarded – undo
232 243
 		$this->dieOnError = $value;
233 244
 	}
234 245
 
246
+	/**
247
+	 * @param boolean $value
248
+	 */
235 249
 	public function setAttribute($attribute, $value)
236 250
 	{
237 251
 		$this->database->setAttribute($attribute, $value);
@@ -298,6 +312,10 @@  discard block
 block discarded – undo
298 312
 	}
299 313
 
300 314
 	//TODO DEPRECATED recommended to use getRow
315
+
316
+	/**
317
+	 * @return string
318
+	 */
301 319
 	public function fetch_array(&$result)
302 320
 	{
303 321
 		return $result->fetch(PDO::FETCH_ASSOC);
@@ -498,6 +516,10 @@  discard block
 block discarded – undo
498 516
 	}
499 517
 
500 518
 	//TODO DEPRECATED
519
+
520
+	/**
521
+	 * @param integer $row
522
+	 */
501 523
 	public function query_result(&$result, $row, $col = 0)
502 524
 	{
503 525
 		return to_html($this->query_result_raw($result, $row, $col));
@@ -674,6 +696,9 @@  discard block
 block discarded – undo
674 696
 		return $id;
675 697
 	}
676 698
 
699
+	/**
700
+	 * @param string $tableName
701
+	 */
677 702
 	public function checkExistTable($tableName, $cache = true)
678 703
 	{
679 704
 		$tablePresent = Vtiger_Cache::get('checkExistTable', $tableName);
@@ -702,6 +727,9 @@  discard block
 block discarded – undo
702 727
 		return $lastInsertID;
703 728
 	}
704 729
 
730
+	/**
731
+	 * @param string $datetime
732
+	 */
705 733
 	public function formatDate($datetime, $strip_quotes = false)
706 734
 	{
707 735
 		/* remove single quotes to use the date as parameter for Prepared statement */
@@ -792,6 +820,9 @@  discard block
 block discarded – undo
792 820
 		return ' ( ' . $l . ' ) ';
793 821
 	}
794 822
 
823
+	/**
824
+	 * @param PDOStatement $result
825
+	 */
795 826
 	public function getAffectedRowCount(&$result)
796 827
 	{
797 828
 		$rows = $result->rowCount();
@@ -861,6 +892,9 @@  discard block
 block discarded – undo
861 892
 	protected $logSqlTimeID = false;
862 893
 	protected $logSqlTimeGroup = 1;
863 894
 
895
+	/**
896
+	 * @param double $endat
897
+	 */
864 898
 	public function logSqlTime($startat, $endat, $sql, $params = false)
865 899
 	{
866 900
 		if (!AppConfig::performance('SQL_LOG_INCLUDE_CALLER')) {
Please login to merge, or discard this patch.
Braces   +33 added lines, -22 removed lines patch added patch discarded remove patch
@@ -464,8 +464,9 @@  discard block
 block discarded – undo
464 464
 			$this->checkError('Missing table name');
465 465
 			return false;
466 466
 		}
467
-		if ($where != '')
468
-			$where = sprintf('WHERE %s', $where);
467
+		if ($where != '') {
468
+					$where = sprintf('WHERE %s', $where);
469
+		}
469 470
 		if (count($params) === 0) {
470 471
 			$this->query(sprintf('DELETE FROM %s %s', $table, $where));
471 472
 		} else {
@@ -558,10 +559,12 @@  discard block
 block discarded – undo
558 559
 	//TODO DEPRECATED
559 560
 	public function flatten_array($input, $output = null)
560 561
 	{
561
-		if ($input == null)
562
-			return null;
563
-		if ($output == null)
564
-			$output = [];
562
+		if ($input == null) {
563
+					return null;
564
+		}
565
+		if ($output == null) {
566
+					$output = [];
567
+		}
565 568
 		foreach ($input as $value) {
566 569
 			if (is_array($value)) {
567 570
 				$output = $this->flatten_array($value, $output);
@@ -634,15 +637,17 @@  discard block
 block discarded – undo
634 637
 	{
635 638
 		if (isset($result) && $rowNum < 0) {
636 639
 			$row = $this->getRow($result);
637
-			if ($encode && is_array($row))
638
-				return array_map('to_html', $row);
640
+			if ($encode && is_array($row)) {
641
+							return array_map('to_html', $row);
642
+			}
639 643
 			return $row;
640 644
 		}
641 645
 		if ($this->getRowCount($result) > $rowNum) {
642 646
 			$row = $this->raw_query_result_rowdata($result, $rowNum);
643 647
 		}
644
-		if ($encode && is_array($row))
645
-			return array_map('to_html', $row);
648
+		if ($encode && is_array($row)) {
649
+					return array_map('to_html', $row);
650
+		}
646 651
 		return $row;
647 652
 	}
648 653
 
@@ -787,8 +792,9 @@  discard block
 block discarded – undo
787 792
 			$this->log('sqlExprDatalist: empty arrays not allowed', 'error');
788 793
 			$this->checkError('sqlExprDatalist: empty arrays not allowed');
789 794
 		}
790
-		foreach ($array as $key => $val)
791
-			$l .= ($l ? ',' : '') . $this->quote($val);
795
+		foreach ($array as $key => $val) {
796
+					$l .= ($l ? ',' : '') . $this->quote($val);
797
+		}
792 798
 		return ' ( ' . $l . ' ) ';
793 799
 	}
794 800
 
@@ -803,8 +809,9 @@  discard block
 block discarded – undo
803 809
 	{
804 810
 		$result = $this->query($sql, $dieOnError, $msg);
805 811
 
806
-		if ($this->getRowCount($result) == 1)
807
-			return $result;
812
+		if ($this->getRowCount($result) == 1) {
813
+					return $result;
814
+		}
808 815
 		$this->log('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, 'error');
809 816
 		$this->checkError('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, $dieOnError);
810 817
 		return '';
@@ -816,8 +823,9 @@  discard block
 block discarded – undo
816 823
 	{
817 824
 		$result = $this->pquery($sql, $params, $dieOnError, $msg);
818 825
 
819
-		if ($this->getRowCount($result) == 1)
820
-			return $result;
826
+		if ($this->getRowCount($result) == 1) {
827
+					return $result;
828
+		}
821 829
 		$this->log('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, 'error');
822 830
 		$this->checkError('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, $dieOnError);
823 831
 		return '';
@@ -881,8 +889,9 @@  discard block
 block discarded – undo
881 889
 			if (isset($_SERVER['REQUEST_METHOD'])) {
882 890
 				$uri = $_SERVER['REQUEST_URI'];
883 891
 				$qmarkIndex = strpos($_SERVER['REQUEST_URI'], '?');
884
-				if ($qmarkIndex !== false)
885
-					$uri = substr($uri, 0, $qmarkIndex);
892
+				if ($qmarkIndex !== false) {
893
+									$uri = substr($uri, 0, $qmarkIndex);
894
+				}
886 895
 				$data = $uri . '?' . http_build_query($_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST);
887 896
 			}
888 897
 			$stmt = $db->database->prepare($logQuery);
@@ -917,10 +926,12 @@  discard block
 block discarded – undo
917 926
 					}
918 927
 					$args = rtrim($args, ',');
919 928
 				}
920
-				if (!empty($callerfunc))
921
-					$callerfunc = " ($callerfunc)";
922
-				if (!empty($args))
923
-					$callerfunc .= "[$args] ";
929
+				if (!empty($callerfunc)) {
930
+									$callerfunc = " ($callerfunc)";
931
+				}
932
+				if (!empty($args)) {
933
+									$callerfunc .= "[$args] ";
934
+				}
924 935
 			}
925 936
 			$data[] = 'CALLER: (' . $callers[$calleridx]['line'] . ') ' . $callers[$calleridx]['file'] . $callerfunc;
926 937
 		}
Please login to merge, or discard this patch.
include/database/Postgres8.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@  discard block
 block discarded – undo
14 14
  * ****************************************************************************** */
15 15
 
16 16
 //Fix postgres queries
17
+/**
18
+ * @param integer $debug
19
+ */
17 20
 function fixPostgresQuery($query, $log, $debug)
18 21
 {
19 22
 	// First select the query fields from the remaining query
@@ -115,6 +118,9 @@  discard block
 block discarded – undo
115 118
 }
116 119
 
117 120
 //return an expanded table field list
121
+/**
122
+ * @param string $table
123
+ */
118 124
 function expandRecord($table, $log)
119 125
 {
120 126
 	$result = "";
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	if ($debug)
73 73
 		$log->info("fixPostgresQuery result: " . $query);
74 74
 
75
-	return( $query);
75
+	return($query);
76 76
 }
77 77
 
78 78
 // Postgres8 will not accept a "tablename.*" entry in the GROUP BY clause
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	if ($expanded != '')
112 112
 		$expanded = " GROUP BY " . trim($expanded, ",");
113 113
 	//return the expanded fieldlist
114
-	return( $expanded);
114
+	return($expanded);
115 115
 }
116 116
 
117 117
 //return an expanded table field list
@@ -195,5 +195,5 @@  discard block
 block discarded – undo
195 195
 		$result = substr($result, 0, strlen($result) - 1);
196 196
 
197 197
 	//return out new string
198
-	return( $result);
198
+	return($result);
199 199
 }
Please login to merge, or discard this patch.
Braces   +81 added lines, -56 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
 	$groupClause = "";
23 23
 	$orderClause = "";
24 24
 
25
-	if ($debug)
26
-		$log->info("fixPostgresQuery: " . $query);
25
+	if ($debug) {
26
+			$log->info("fixPostgresQuery: " . $query);
27
+	}
27 28
 
28 29
 	// If we already have an order or group cluase separate ist for later use
29 30
 	if (stripos($queryRecord, 'GROUP BY') > 0) {
@@ -45,32 +46,36 @@  discard block
 block discarded – undo
45 46
 	$privateGroupList = [];
46 47
 	$token = strtok($queryFields, ", ()	");
47 48
 	while ($token !== false) {
48
-		if (strpos($token, ".") !== false)
49
-			array_push($privateGroupList, $token);
49
+		if (strpos($token, ".") !== false) {
50
+					array_push($privateGroupList, $token);
51
+		}
50 52
 		$token = strtok(", ()	");
51 53
 	}
52 54
 	sort($privateGroupList);
53 55
 	$groupFields = "";
54 56
 	$last = "";
55 57
 	for ($i = 0; $i < count($privateGroupList); $i++) {
56
-		if ($last != $privateGroupList[$i])
57
-			if ($groupFields == "")
58
+		if ($last != $privateGroupList[$i]) {
59
+					if ($groupFields == "")
58 60
 				$groupFields = $privateGroupList[$i];
59
-			else
60
-				$groupFields .= "," . $privateGroupList[$i];
61
+		} else {
62
+							$groupFields .= "," . $privateGroupList[$i];
63
+			}
61 64
 		$last = $privateGroupList[$i];
62 65
 	}
63 66
 
64 67
 	// Rebuild the query
65 68
 	$query = sprintf("SELECT %s%s", $queryFields, $queryRecord);
66
-	if ($groupClause != "")
67
-		$groupClause = $groupClause . "," . $groupFields;
68
-	else
69
-		$groupClause = $groupFields;
69
+	if ($groupClause != "") {
70
+			$groupClause = $groupClause . "," . $groupFields;
71
+	} else {
72
+			$groupClause = $groupFields;
73
+	}
70 74
 	$query .= expandStar($groupClause, $log) . " " . $orderClause;
71 75
 
72
-	if ($debug)
73
-		$log->info("fixPostgresQuery result: " . $query);
76
+	if ($debug) {
77
+			$log->info("fixPostgresQuery result: " . $query);
78
+	}
74 79
 
75 80
 	return( $query);
76 81
 }
@@ -94,22 +99,25 @@  discard block
 block discarded – undo
94 99
 				$subfield = substr($field, $pos + 1, strlen($field) - $pos);
95 100
 
96 101
 				//do we need to expand?
97
-				if ($subfield == "*")
98
-					$field = expandRecord($table, $log);
102
+				if ($subfield == "*") {
103
+									$field = expandRecord($table, $log);
104
+				}
99 105
 			}
100 106
 
101 107
 			//add the propably expanded field to the querylist
102
-			if ($expanded == "")
103
-				$expanded = $field;
104
-			else
105
-				$expanded .= "," . $field;
108
+			if ($expanded == "") {
109
+							$expanded = $field;
110
+			} else {
111
+							$expanded .= "," . $field;
112
+			}
106 113
 		}
107 114
 
108 115
 		//next field
109 116
 		$field = strtok(",");
110 117
 	}
111
-	if ($expanded != '')
112
-		$expanded = " GROUP BY " . trim($expanded, ",");
118
+	if ($expanded != '') {
119
+			$expanded = " GROUP BY " . trim($expanded, ",");
120
+	}
113 121
 	//return the expanded fieldlist
114 122
 	return( $expanded);
115 123
 }
@@ -122,68 +130,84 @@  discard block
 block discarded – undo
122 130
 	$subfields = [];
123 131
 
124 132
 	//vtiger_products table
125
-	if ($table == "vtiger_products")
126
-		$subfields = array("productid", "productname", "productcode", "productcategory", "manufacturer", "qty_per_unit", "unit_price", "weight", "pack_size", "sales_start_date", "sales_end_date", "start_date", "expiry_date", "cost_factor", "commissionrate", "commissionmethod", "discontinued", "usageunit", "currency", "reorderlevel", "website", "taxclass", "mfr_part_no", "vendor_part_no", "serialno", "qtyinstock", "productsheet", "qtyindemand", "glacct", "vendor_id", "imagename");
133
+	if ($table == "vtiger_products") {
134
+			$subfields = array("productid", "productname", "productcode", "productcategory", "manufacturer", "qty_per_unit", "unit_price", "weight", "pack_size", "sales_start_date", "sales_end_date", "start_date", "expiry_date", "cost_factor", "commissionrate", "commissionmethod", "discontinued", "usageunit", "currency", "reorderlevel", "website", "taxclass", "mfr_part_no", "vendor_part_no", "serialno", "qtyinstock", "productsheet", "qtyindemand", "glacct", "vendor_id", "imagename");
135
+	}
127 136
 	
128 137
 	//vtiger_activity table
129
-	elseif ($table == "vtiger_activity")
130
-		$subfields = array("activityid", "subject", "semodule", "activitytype", "date_start", "due_date", "time_start", "time_end", "sendnotification", "duration_hours", "duration_minutes", "status", "eventstatus", "priority", "location", "notime", "visibility", "recurringtype");
138
+	elseif ($table == "vtiger_activity") {
139
+			$subfields = array("activityid", "subject", "semodule", "activitytype", "date_start", "due_date", "time_start", "time_end", "sendnotification", "duration_hours", "duration_minutes", "status", "eventstatus", "priority", "location", "notime", "visibility", "recurringtype");
140
+	}
131 141
 
132 142
 	//vtiger_notes table
133
-	elseif ($table == "vtiger_notes")
134
-		$subfields = array("notesid", "contact_id", "title", "filename", "notecontent");
143
+	elseif ($table == "vtiger_notes") {
144
+			$subfields = array("notesid", "contact_id", "title", "filename", "notecontent");
145
+	}
135 146
 
136 147
 	//vtiger_faq table
137
-	elseif ($table == "vtiger_faq")
138
-		$subfields = array("id", "product_id", "question", "answer", "category", "status");
148
+	elseif ($table == "vtiger_faq") {
149
+			$subfields = array("id", "product_id", "question", "answer", "category", "status");
150
+	}
139 151
 
140 152
 	//vtiger_profile2field
141
-	elseif ($table == "vtiger_profile2field")
142
-		$subfields = array("profileid", "tabid", "fieldid", "visible", "readonly");
153
+	elseif ($table == "vtiger_profile2field") {
154
+			$subfields = array("profileid", "tabid", "fieldid", "visible", "readonly");
155
+	}
143 156
 
144 157
 	//vtiger_field
145
-	elseif ($table == "vtiger_field")
146
-		$subfields = array("tabid", "fieldid", "columnname", "tablename", "generatedtype", "uitype", "fieldname", "fieldlabel", "readonly", "presence", "selected", "maximumlength", "sequence", "block", "displaytype", "typeofdata", "quickcreate", "quickcreatesequence", "info_type");
158
+	elseif ($table == "vtiger_field") {
159
+			$subfields = array("tabid", "fieldid", "columnname", "tablename", "generatedtype", "uitype", "fieldname", "fieldlabel", "readonly", "presence", "selected", "maximumlength", "sequence", "block", "displaytype", "typeofdata", "quickcreate", "quickcreatesequence", "info_type");
160
+	}
147 161
 
148 162
 	//vtiger_producttaxrel
149
-	elseif ($table == "vtiger_producttaxrel")
150
-		$subfields = array("productid", "taxid", "taxpercentage");
163
+	elseif ($table == "vtiger_producttaxrel") {
164
+			$subfields = array("productid", "taxid", "taxpercentage");
165
+	}
151 166
 
152 167
 	//vtiger_inventorytaxinfo
153
-	elseif ($table == "vtiger_inventorytaxinfo")
154
-		$subfields = array("taxid", "taxname", "taxlabel", "percentage", "deleted");
168
+	elseif ($table == "vtiger_inventorytaxinfo") {
169
+			$subfields = array("taxid", "taxname", "taxlabel", "percentage", "deleted");
170
+	}
155 171
 
156 172
 	//vtiger_role2picklist
157
-	elseif ($table == "vtiger_role2picklist")
158
-		$subfields = array("roleid", "picklistid", "sortid");
173
+	elseif ($table == "vtiger_role2picklist") {
174
+			$subfields = array("roleid", "picklistid", "sortid");
175
+	}
159 176
 
160 177
 	//vtiger_contactdetails
161
-	elseif ($table == "vtiger_contactdetails")
162
-		$subfields = array("lastname", "contactid", "accountid", "salutation", "firstname", "email", "phone", "mobile", "title", "department", "fax", "reportsto", "training", "usertype", "contacttype", "otheremail", "yahooid", "donotcall", "emailoptout", "imagename", "reference", "notify_owner");
178
+	elseif ($table == "vtiger_contactdetails") {
179
+			$subfields = array("lastname", "contactid", "accountid", "salutation", "firstname", "email", "phone", "mobile", "title", "department", "fax", "reportsto", "training", "usertype", "contacttype", "otheremail", "yahooid", "donotcall", "emailoptout", "imagename", "reference", "notify_owner");
180
+	}
163 181
 
164 182
 	//vtiger_crmentity
165
-	elseif ($table == "vtiger_crmentity")
166
-		$subfields = array("crmid", "smcreatorid", "smownerid", "modifiedby", "setype", "description", "createdtime", "modifiedtime", "viewedtime", "status", "version", "presence", "deleted");
183
+	elseif ($table == "vtiger_crmentity") {
184
+			$subfields = array("crmid", "smcreatorid", "smownerid", "modifiedby", "setype", "description", "createdtime", "modifiedtime", "viewedtime", "status", "version", "presence", "deleted");
185
+	}
167 186
 
168 187
 	//vtiger_seactivityrel
169
-	elseif ($table == "vtiger_seactivityrel")
170
-		$subfields = array("crmid", "activityid");
188
+	elseif ($table == "vtiger_seactivityrel") {
189
+			$subfields = array("crmid", "activityid");
190
+	}
171 191
 
172 192
 	//vtiger_cntactivityrel
173
-	elseif ($table == "vtiger_cntactivityrel")
174
-		$subfields = array("contactid", "activityid");
193
+	elseif ($table == "vtiger_cntactivityrel") {
194
+			$subfields = array("contactid", "activityid");
195
+	}
175 196
 
176 197
 	//vtiger_leaddetails
177
-	elseif ($table == "vtiger_leaddetails")
178
-		$subfields = array("leadid", "email", "interest", "firstname", "salutation", "lastname", "company", "annualrevenue", "industry", "campaign", "rating", "leadstatus", "leadsource", "converted", "designation", "space", "comments", "priority", "demorequest", "partnercontact", "productversion", "product", "maildate", "nextstepdate", "fundingsituation", "purpose", "evaluationstatus", "transferdate", "revenuetype", "noofemployees", "yahooid", "assignleadchk");
198
+	elseif ($table == "vtiger_leaddetails") {
199
+			$subfields = array("leadid", "email", "interest", "firstname", "salutation", "lastname", "company", "annualrevenue", "industry", "campaign", "rating", "leadstatus", "leadsource", "converted", "designation", "space", "comments", "priority", "demorequest", "partnercontact", "productversion", "product", "maildate", "nextstepdate", "fundingsituation", "purpose", "evaluationstatus", "transferdate", "revenuetype", "noofemployees", "yahooid", "assignleadchk");
200
+	}
179 201
 
180 202
 	//vtiger_pricebook
181
-	elseif ($table == "vtiger_pricebook")
182
-		$subfields = array("pricebookid", "bookname", "active", "description");
203
+	elseif ($table == "vtiger_pricebook") {
204
+			$subfields = array("pricebookid", "bookname", "active", "description");
205
+	}
183 206
 
184 207
 	//fields of the requested array still undefined
185
-	else
186
-		$log->info("function expandRecord: please add structural information for table '" . $table . "'");
208
+	else {
209
+			$log->info("function expandRecord: please add structural information for table '" . $table . "'");
210
+	}
187 211
 
188 212
 	//construct an entity string
189 213
 	for ($i = 0; $i < count($subfields); $i++) {
@@ -191,8 +215,9 @@  discard block
 block discarded – undo
191 215
 	}
192 216
 
193 217
 	//remove the trailiung ,
194
-	if (strlen($result) > 0)
195
-		$result = substr($result, 0, strlen($result) - 1);
218
+	if (strlen($result) > 0) {
219
+			$result = substr($result, 0, strlen($result) - 1);
220
+	}
196 221
 
197 222
 	//return out new string
198 223
 	return( $result);
Please login to merge, or discard this patch.
include/InventoryPDFController.php 3 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -390,6 +390,9 @@  discard block
 block discarded – undo
390 390
 		return false;
391 391
 	}
392 392
 
393
+	/**
394
+	 * @param string[] $names
395
+	 */
393 396
 	public function focusColumnValues($names, $delimeter = "\n")
394 397
 	{
395 398
 		if (!is_array($names)) {
@@ -414,6 +417,9 @@  discard block
 block discarded – undo
414 417
 		return $defvalue;
415 418
 	}
416 419
 
420
+	/**
421
+	 * @param string $id
422
+	 */
417 423
 	public function resolveReferenceLabel($id, $module = false)
418 424
 	{
419 425
 		if (empty($id)) {
@@ -448,6 +454,9 @@  discard block
 block discarded – undo
448 454
 		return $currencyField->getDisplayValue(null, true);
449 455
 	}
450 456
 
457
+	/**
458
+	 * @param string $value
459
+	 */
451 460
 	public function formatDate($value)
452 461
 	{
453 462
 		return DateTimeField::convertToUserFormat($value);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@
 block discarded – undo
148 148
 			$subProducts = $productLineItem["subProductArray{$productLineItemIndex}"];
149 149
 			if ($subProducts != '') {
150 150
 				foreach ($subProducts as $subProduct) {
151
-					$productName .="\n" . " - " . decode_html($subProduct);
151
+					$productName .= "\n" . " - " . decode_html($subProduct);
152 152
 				}
153 153
 			}
154 154
 			$contentModel->set('Name', $productName);
Please login to merge, or discard this patch.
Braces   +30 added lines, -20 removed lines patch added patch discarded remove patch
@@ -83,8 +83,9 @@  discard block
 block discarded – undo
83 83
 
84 84
 	public function Output($filename, $type)
85 85
 	{
86
-		if (is_null($this->focus))
87
-			return;
86
+		if (is_null($this->focus)) {
87
+					return;
88
+		}
88 89
 
89 90
 		$pdfgenerator = $this->getPDFGenerator();
90 91
 
@@ -256,24 +257,32 @@  discard block
 block discarded – undo
256 257
 
257 258
 			$addressValues = [];
258 259
 			$addressValues[] = $resultrow['address'];
259
-			if (!empty($resultrow['city']))
260
-				$addressValues[] = "\n" . $resultrow['city'];
261
-			if (!empty($resultrow['state']))
262
-				$addressValues[] = "," . $resultrow['state'];
263
-			if (!empty($resultrow['code']))
264
-				$addressValues[] = $resultrow['code'];
265
-			if (!empty($resultrow['country']))
266
-				$addressValues[] = "\n" . $resultrow['country'];
260
+			if (!empty($resultrow['city'])) {
261
+							$addressValues[] = "\n" . $resultrow['city'];
262
+			}
263
+			if (!empty($resultrow['state'])) {
264
+							$addressValues[] = "," . $resultrow['state'];
265
+			}
266
+			if (!empty($resultrow['code'])) {
267
+							$addressValues[] = $resultrow['code'];
268
+			}
269
+			if (!empty($resultrow['country'])) {
270
+							$addressValues[] = "\n" . $resultrow['country'];
271
+			}
267 272
 
268 273
 			$additionalCompanyInfo = [];
269
-			if (!empty($resultrow['phone']))
270
-				$additionalCompanyInfo[] = "\n" . \includes\Language::translate("Phone: ", $this->moduleName) . $resultrow['phone'];
271
-			if (!empty($resultrow['fax']))
272
-				$additionalCompanyInfo[] = "\n" . \includes\Language::translate("Fax: ", $this->moduleName) . $resultrow['fax'];
273
-			if (!empty($resultrow['website']))
274
-				$additionalCompanyInfo[] = "\n" . \includes\Language::translate("Website: ", $this->moduleName) . $resultrow['website'];
275
-			if (!empty($resultrow['vatid']))
276
-				$additionalCompanyInfo[] = "\n" . \includes\Language::translate("VAT ID: ", $this->moduleName) . $resultrow['vatid'];
274
+			if (!empty($resultrow['phone'])) {
275
+							$additionalCompanyInfo[] = "\n" . \includes\Language::translate("Phone: ", $this->moduleName) . $resultrow['phone'];
276
+			}
277
+			if (!empty($resultrow['fax'])) {
278
+							$additionalCompanyInfo[] = "\n" . \includes\Language::translate("Fax: ", $this->moduleName) . $resultrow['fax'];
279
+			}
280
+			if (!empty($resultrow['website'])) {
281
+							$additionalCompanyInfo[] = "\n" . \includes\Language::translate("Website: ", $this->moduleName) . $resultrow['website'];
282
+			}
283
+			if (!empty($resultrow['vatid'])) {
284
+							$additionalCompanyInfo[] = "\n" . \includes\Language::translate("VAT ID: ", $this->moduleName) . $resultrow['vatid'];
285
+			}
277 286
 
278 287
 			$modelColumnLeft = array(
279 288
 				'logo' => "storage/Logo/" . $resultrow['logoname'],
@@ -430,8 +439,9 @@  discard block
 block discarded – undo
430 439
 	{
431 440
 		$valueString = '';
432 441
 		foreach ($values as $value) {
433
-			if (empty($value))
434
-				continue;
442
+			if (empty($value)) {
443
+							continue;
444
+			}
435 445
 			$valueString .= $value . $delimeter;
436 446
 		}
437 447
 		return rtrim($valueString, $delimeter);
Please login to merge, or discard this patch.
include/Loader.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
 
99 99
 	/**
100 100
 	 * Function to get the class name of a given Component, of given Type, for a given Module
101
-	 * @param <String> $componentType
101
+	 * @param string $componentType
102 102
 	 * @param <String> $componentName
103 103
 	 * @param <String> $moduleName
104 104
 	 * @return <String> Required Class Name
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,8 +124,9 @@
 block discarded – undo
124 124
 			$secondFallBackModuleDir = $secondFallBackModuleClassPath = $actualModule;
125 125
 			if ($actualModule != 'Users') {
126 126
 				$baseModule = $moduleHierarchyParts[0];
127
-				if ($baseModule == 'Settings')
128
-					$baseModule = 'Settings:Vtiger';
127
+				if ($baseModule == 'Settings') {
128
+									$baseModule = 'Settings:Vtiger';
129
+				}
129 130
 				$firstFallBackDir = str_replace(':', '.', $baseModule);
130 131
 				$firstFallBackClassPath = str_replace(':', '_', $baseModule);
131 132
 			}
Please login to merge, or discard this patch.
include/main/WebUI.php 1 patch
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -54,6 +54,9 @@  discard block
 block discarded – undo
54 54
 		return $user;
55 55
 	}
56 56
 
57
+	/**
58
+	 * @param Vtiger_Request $request
59
+	 */
57 60
 	protected function triggerCheckPermission($handler, $request)
58 61
 	{
59 62
 		$moduleName = $request->getModule();
@@ -73,6 +76,9 @@  discard block
 block discarded – undo
73 76
 		throw new \Exception\NoPermitted('LBL_NOT_ACCESSIBLE');
74 77
 	}
75 78
 
79
+	/**
80
+	 * @param Vtiger_Request $request
81
+	 */
76 82
 	protected function triggerPreProcess($handler, $request)
77 83
 	{
78 84
 		if ($request->isAjax()) {
@@ -82,6 +88,9 @@  discard block
 block discarded – undo
82 88
 		$handler->preProcess($request);
83 89
 	}
84 90
 
91
+	/**
92
+	 * @param Vtiger_Request $request
93
+	 */
85 94
 	protected function triggerPostProcess($handler, $request)
86 95
 	{
87 96
 		if ($request->isAjax()) {
Please login to merge, or discard this patch.
include/PrivilegeFile.php 1 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/recaptcha/recaptchalib.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -206,6 +206,9 @@  discard block
 block discarded – undo
206 206
 }
207 207
 /* Mailhide related code */
208 208
 
209
+/**
210
+ * @param string $ky
211
+ */
209 212
 function _recaptcha_aes_encrypt($val, $ky)
210 213
 {
211 214
 	if (!function_exists("mcrypt_encrypt")) {
@@ -217,6 +220,9 @@  discard block
 block discarded – undo
217 220
 	return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
218 221
 }
219 222
 
223
+/**
224
+ * @param null|string $x
225
+ */
220 226
 function _recaptcha_mailhide_urlbase64($x)
221 227
 {
222 228
 	return strtr(base64_encode($x), '+/', '-_');
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,6 @@
 block discarded – undo
98 98
  * @param string $pubkey A public key for reCAPTCHA
99 99
  * @param string $error The error given by reCAPTCHA (optional, default is null)
100 100
  * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
101
-
102 101
  * @return string - The HTML to be embedded in the user's form.
103 102
  */
104 103
 function recaptcha_get_html($pubkey, $error = null, $use_ssl = false)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 	$http_request .= $req;
78 78
 
79 79
 	$response = '';
80
-	if (false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) )) {
80
+	if (false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) {
81 81
 		die('Could not open socket');
82 82
 	}
83 83
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@  discard block
 block discarded – undo
47 47
 function _recaptcha_qsencode($data)
48 48
 {
49 49
 	$req = "";
50
-	foreach ($data as $key => $value)
51
-		$req .= $key . '=' . urlencode(stripslashes($value)) . '&';
50
+	foreach ($data as $key => $value) {
51
+			$req .= $key . '=' . urlencode(stripslashes($value)) . '&';
52
+	}
52 53
 
53 54
 	// Cut the last '&'
54 55
 	$req = substr($req, 0, strlen($req) - 1);
@@ -83,8 +84,10 @@  discard block
 block discarded – undo
83 84
 
84 85
 	fwrite($fs, $http_request);
85 86
 
86
-	while (!feof($fs))
87
-		$response .= fgets($fs, 1160); // One TCP-IP packet
87
+	while (!feof($fs)) {
88
+			$response .= fgets($fs, 1160);
89
+	}
90
+	// One TCP-IP packet
88 91
 	fclose($fs);
89 92
 	$response = explode("\r\n\r\n", $response, 2);
90 93
 
Please login to merge, or discard this patch.
include/RelatedListView.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 
64 64
 /** 	Function to display the Products which are related to the PriceBook
65 65
  * 	@param string $query - query to get the list of products which are related to the current PriceBook
66
- * 	@param object $focus - PriceBook object which contains all the information of the current PriceBook
66
+ * 	@param PriceBooks $focus - PriceBook object which contains all the information of the current PriceBook
67 67
  * 	@param string $returnset - return_module, return_action and return_id which are sequenced with & to pass to the URL which is optional
68 68
  * 	return array $return_data which will be formed like array('header'=>$header,'entries'=>$entries_list) where as $header contains all the header columns and $entries_list will contain all the Product entries
69 69
  */
Please login to merge, or discard this patch.
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -115,22 +115,26 @@  discard block
 block discarded – undo
115 115
 
116 116
 	$limit_start_rec = ($start - 1) * $listMaxEntriesPerPage;
117 117
 
118
-	if ($adb->isPostgres())
119
-		$list_result = $adb->pquery($query .
118
+	if ($adb->isPostgres()) {
119
+			$list_result = $adb->pquery($query .
120 120
 			" OFFSET $limit_start_rec LIMIT $listMaxEntriesPerPage ", []);
121
-	else
122
-		$list_result = $adb->pquery($query .
121
+	} else {
122
+			$list_result = $adb->pquery($query .
123 123
 			" LIMIT $limit_start_rec, $listMaxEntriesPerPage ", []);
124
+	}
124 125
 
125 126
 	$header = [];
126 127
 	$header[] = $mod_strings['LBL_LIST_PRODUCT_NAME'];
127
-	if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0')
128
-		$header[] = $mod_strings['LBL_PRODUCT_CODE'];
129
-	if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0')
130
-		$header[] = $mod_strings['LBL_PRODUCT_UNIT_PRICE'];
128
+	if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') {
129
+			$header[] = $mod_strings['LBL_PRODUCT_CODE'];
130
+	}
131
+	if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') {
132
+			$header[] = $mod_strings['LBL_PRODUCT_UNIT_PRICE'];
133
+	}
131 134
 	$header[] = $mod_strings['LBL_PB_LIST_PRICE'];
132
-	if (isPermitted("PriceBooks", "EditView", "") == 'yes' || isPermitted("PriceBooks", "Delete", "") == 'yes')
133
-		$header[] = $mod_strings['LBL_ACTION'];
135
+	if (isPermitted("PriceBooks", "EditView", "") == 'yes' || isPermitted("PriceBooks", "Delete", "") == 'yes') {
136
+			$header[] = $mod_strings['LBL_ACTION'];
137
+	}
134 138
 
135 139
 	$currency_id = $focus->column_fields['currency_id'];
136 140
 	$numRows = $adb->num_rows($list_result);
@@ -146,10 +150,12 @@  discard block
 block discarded – undo
146 150
 
147 151
 		$entries = [];
148 152
 		$entries[] = textlength_check($adb->query_result($list_result, $i, "productname"));
149
-		if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0')
150
-			$entries[] = $adb->query_result($list_result, $i, "productcode");
151
-		if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0')
152
-			$entries[] = CurrencyField::convertToUserFormat($unit_price, null, true);
153
+		if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') {
154
+					$entries[] = $adb->query_result($list_result, $i, "productcode");
155
+		}
156
+		if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') {
157
+					$entries[] = CurrencyField::convertToUserFormat($unit_price, null, true);
158
+		}
153 159
 
154 160
 		$entries[] = CurrencyField::convertToUserFormat($listprice, null, true);
155 161
 		$action = "";
@@ -159,12 +165,14 @@  discard block
 block discarded – undo
159 165
 			$action .= '<img src="' . vtiger_imageurl('blank.gif', $theme) . '" border="0" />';
160 166
 		}
161 167
 		if (isPermitted("PriceBooks", "Delete", "") == 'yes' && isPermitted('Products', 'Delete', $entity_id) == 'yes') {
162
-			if ($action != "")
163
-				$action .= '&nbsp;|&nbsp;';
168
+			if ($action != "") {
169
+							$action .= '&nbsp;|&nbsp;';
170
+			}
164 171
 			$action .= '<img src="' . vtiger_imageurl('delete.gif', $theme) . '" onclick="if(confirm(\'' . \includes\Language::translate('ARE_YOU_SURE') . '\')) deletePriceBookProductRel(' . $entity_id . ',' . $pricebook_id . ');" alt="' . \includes\Language::translate('LBL_DELETE') . '" title="' . \includes\Language::translate('LBL_DELETE') . '" style="cursor:pointer;" border="0">';
165 172
 		}
166
-		if ($action != "")
167
-			$entries[] = $action;
173
+		if ($action != "") {
174
+					$entries[] = $action;
175
+		}
168 176
 		$entries_list[] = $entries;
169 177
 	}
170 178
 	$navigationOutput[] = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
Please login to merge, or discard this patch.