@@ -46,12 +46,15 @@ |
||
46 | 46 | public static function getIconByFileType($exntension) |
47 | 47 | { |
48 | 48 | $explodeExtension = reset(explode("/", $exntension)); |
49 | - if (isset(self::$extensionIcon[$explodeExtension])) |
|
50 | - $fileIcon = self::$extensionIcon[$explodeExtension]; |
|
51 | - if (isset(self::$extensionIcon[$exntension])) |
|
52 | - $fileIcon = self::$extensionIcon[$exntension]; |
|
53 | - if (!$fileIcon) |
|
54 | - $fileIcon = 'userIcon-Documents'; |
|
49 | + if (isset(self::$extensionIcon[$explodeExtension])) { |
|
50 | + $fileIcon = self::$extensionIcon[$explodeExtension]; |
|
51 | + } |
|
52 | + if (isset(self::$extensionIcon[$exntension])) { |
|
53 | + $fileIcon = self::$extensionIcon[$exntension]; |
|
54 | + } |
|
55 | + if (!$fileIcon) { |
|
56 | + $fileIcon = 'userIcon-Documents'; |
|
57 | + } |
|
55 | 58 | return $fileIcon; |
56 | 59 | } |
57 | 60 | } |
@@ -1401,7 +1401,7 @@ |
||
1401 | 1401 | function isRecordExists($recordId, $cache = true) |
1402 | 1402 | { |
1403 | 1403 | $recordMetaData = vtlib\Functions::getCRMRecordMetadata($recordId); |
1404 | - return (isset($recordMetaData) && $recordMetaData['deleted'] == 0 ) ? true : false; |
|
1404 | + return (isset($recordMetaData) && $recordMetaData['deleted'] == 0) ? true : false; |
|
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | /** Function to set date values compatible to database (YY_MM_DD) |
@@ -201,8 +201,9 @@ discard block |
||
201 | 201 | $inUTF8 = (strtoupper($default_charset) == 'UTF-8'); |
202 | 202 | } |
203 | 203 | |
204 | - if (AppRequest::has('module') && AppRequest::has('file') && AppRequest::get('module') != 'Settings' && AppRequest::get('file') != 'ListView' && AppRequest::get('module') != 'Portal' && AppRequest::get('module') != 'Reports') |
|
205 | - $ajaxAction = AppRequest::get('module') . 'Ajax'; |
|
204 | + if (AppRequest::has('module') && AppRequest::has('file') && AppRequest::get('module') != 'Settings' && AppRequest::get('file') != 'ListView' && AppRequest::get('module') != 'Portal' && AppRequest::get('module') != 'Reports') { |
|
205 | + $ajaxAction = AppRequest::get('module') . 'Ajax'; |
|
206 | + } |
|
206 | 207 | |
207 | 208 | if (is_string($string)) { |
208 | 209 | if ($action != 'CustomView' && $action != 'Export' && $action != $ajaxAction && $action != 'LeadConvertToEntities' && $action != 'CreatePDF' && $action != 'ConvertAsFAQ' && AppRequest::get('module') != 'Dashboard' && $action != 'CreateSOPDF' && $action != 'SendPDFMail' && (!AppRequest::has('submode'))) { |
@@ -214,10 +215,11 @@ discard block |
||
214 | 215 | |
215 | 216 | // In vtiger5 ajax request are treated specially and the data is encoded |
216 | 217 | if ($doconvert == true) { |
217 | - if ($inUTF8) |
|
218 | - $string = htmlentities($string, ENT_QUOTES, $default_charset); |
|
219 | - else |
|
220 | - $string = preg_replace(['/</', '/>/', '/"/'], ['<', '>', '"'], $string); |
|
218 | + if ($inUTF8) { |
|
219 | + $string = htmlentities($string, ENT_QUOTES, $default_charset); |
|
220 | + } else { |
|
221 | + $string = preg_replace(['/</', '/>/', '/"/'], ['<', '>', '"'], $string); |
|
222 | + } |
|
221 | 223 | } |
222 | 224 | } |
223 | 225 | Vtiger_Cache::set('to_html', $oginalString, $string); |
@@ -273,10 +275,11 @@ discard block |
||
273 | 275 | if ($module == 'Calendar') { |
274 | 276 | $cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events'); |
275 | 277 | if ($cachedEventsFields) { |
276 | - if (empty($cachedModuleFields)) |
|
277 | - $cachedModuleFields = $cachedEventsFields; |
|
278 | - else |
|
279 | - $cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields); |
|
278 | + if (empty($cachedModuleFields)) { |
|
279 | + $cachedModuleFields = $cachedEventsFields; |
|
280 | + } else { |
|
281 | + $cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields); |
|
282 | + } |
|
280 | 283 | } |
281 | 284 | } |
282 | 285 | |
@@ -704,10 +707,11 @@ discard block |
||
704 | 707 | $pos++; |
705 | 708 | } |
706 | 709 | } |
707 | - if (strtolower($default_charset) == 'utf-8') |
|
708 | - return html_to_utf8($decodedStr); |
|
709 | - else |
|
710 | - return $decodedStr; |
|
710 | + if (strtolower($default_charset) == 'utf-8') { |
|
711 | + return html_to_utf8($decodedStr); |
|
712 | + } else { |
|
713 | + return $decodedStr; |
|
714 | + } |
|
711 | 715 | //return html_to_utf8($decodedStr); |
712 | 716 | } |
713 | 717 | |
@@ -726,13 +730,15 @@ discard block |
||
726 | 730 | while (($i--) > 0) { |
727 | 731 | if ($data != ($a = $data % ($p = pow(64, $i)))) { |
728 | 732 | $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); |
729 | - for ($i; $i > 0; $i--) |
|
730 | - $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); |
|
733 | + for ($i; $i > 0; $i--) { |
|
734 | + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); |
|
735 | + } |
|
731 | 736 | break; |
732 | 737 | } |
733 | 738 | } |
734 | - } else |
|
735 | - $ret = "&#$data;"; |
|
739 | + } else { |
|
740 | + $ret = "&#$data;"; |
|
741 | + } |
|
736 | 742 | return $ret; |
737 | 743 | } |
738 | 744 | |
@@ -781,8 +787,9 @@ discard block |
||
781 | 787 | */ |
782 | 788 | function escape_single_quotes($value) |
783 | 789 | { |
784 | - if (isset($value)) |
|
785 | - $value = str_replace("'", "\'", $value); |
|
790 | + if (isset($value)) { |
|
791 | + $value = str_replace("'", "\'", $value); |
|
792 | + } |
|
786 | 793 | return $value; |
787 | 794 | } |
788 | 795 | |
@@ -803,10 +810,11 @@ discard block |
||
803 | 810 | $str = str_replace('_', '\_', $str); |
804 | 811 | if ($flag == 0) { |
805 | 812 | // If value what to search is null then we should not add % which will fail |
806 | - if (empty($str)) |
|
807 | - $str = '' . $str . ''; |
|
808 | - else |
|
809 | - $str = '%' . $str . '%'; |
|
813 | + if (empty($str)) { |
|
814 | + $str = '' . $str . ''; |
|
815 | + } else { |
|
816 | + $str = '%' . $str . '%'; |
|
817 | + } |
|
810 | 818 | } elseif ($flag == 1) { |
811 | 819 | $str = '%' . $str; |
812 | 820 | } elseif ($flag == 2) { |
@@ -865,8 +873,9 @@ discard block |
||
865 | 873 | } else { |
866 | 874 | $mulsel = "select distinct $fieldname from vtiger_$fieldname inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_$fieldname.picklist_valueid where roleid ='" . $roleid . "' and picklistid in (select picklistid from vtiger_$fieldname) order by sortid asc"; |
867 | 875 | } |
868 | - if ($fieldname != 'firstname') |
|
869 | - $mulselresult = $adb->query($mulsel); |
|
876 | + if ($fieldname != 'firstname') { |
|
877 | + $mulselresult = $adb->query($mulsel); |
|
878 | + } |
|
870 | 879 | for ($j = 0; $j < $adb->num_rows($mulselresult); $j++) { |
871 | 880 | $fieldvalues[] = $adb->query_result($mulselresult, $j, $fieldname); |
872 | 881 | } |
@@ -878,15 +887,17 @@ discard block |
||
878 | 887 | $temp_status[$keyvalue][($temp_count + $t)] = $fieldvalues[$t]; |
879 | 888 | } |
880 | 889 | $fieldvalues = $temp_status[$keyvalue]; |
881 | - } else |
|
882 | - $temp_status[$keyvalue] = $fieldvalues; |
|
890 | + } else { |
|
891 | + $temp_status[$keyvalue] = $fieldvalues; |
|
892 | + } |
|
893 | + } |
|
894 | + if ($uitype == 33) { |
|
895 | + $fieldlists[1][$keyvalue] = $fieldvalues; |
|
896 | + } else if ($uitype == 55 && $fieldname == 'salutationtype') { |
|
897 | + $fieldlists[$keyvalue] = $fieldvalues; |
|
898 | + } else if ($uitype == 15) { |
|
899 | + $fieldlists[$keyvalue] = $fieldvalues; |
|
883 | 900 | } |
884 | - if ($uitype == 33) |
|
885 | - $fieldlists[1][$keyvalue] = $fieldvalues; |
|
886 | - else if ($uitype == 55 && $fieldname == 'salutationtype') |
|
887 | - $fieldlists[$keyvalue] = $fieldvalues; |
|
888 | - else if ($uitype == 15) |
|
889 | - $fieldlists[$keyvalue] = $fieldvalues; |
|
890 | 901 | } |
891 | 902 | $log->debug("Exit from function getAccessPickListValues($module)"); |
892 | 903 | |
@@ -907,8 +918,9 @@ discard block |
||
907 | 918 | |
908 | 919 | $ret_str .= " ifnull($tbl_name.$col_name,'null') = ifnull(temp.$col_name,'null')"; |
909 | 920 | |
910 | - if (count($field_array) != $i) |
|
911 | - $ret_str .= " and "; |
|
921 | + if (count($field_array) != $i) { |
|
922 | + $ret_str .= " and "; |
|
923 | + } |
|
912 | 924 | $i++; |
913 | 925 | } |
914 | 926 | return $ret_str; |
@@ -1021,8 +1033,9 @@ discard block |
||
1021 | 1033 | foreach ($name as $module) { |
1022 | 1034 | $focus = CRMEntity::getInstance($module); |
1023 | 1035 | $query = $focus->buildSearchQueryForFieldTypes(11, $number); |
1024 | - if (empty($query)) |
|
1025 | - return; |
|
1036 | + if (empty($query)) { |
|
1037 | + return; |
|
1038 | + } |
|
1026 | 1039 | |
1027 | 1040 | $result = $adb->pquery($query, []); |
1028 | 1041 | if ($adb->num_rows($result) > 0) { |
@@ -1229,8 +1242,9 @@ discard block |
||
1229 | 1242 | //require_once('modules/com_vtiger_workflow/VTEntityCache.inc'); |
1230 | 1243 | $em = new VTEventsManager($adb); |
1231 | 1244 | $em->initTriggerCache(); |
1232 | - if (!is_array($destinationRecordIds)) |
|
1233 | - $destinationRecordIds = [$destinationRecordIds]; |
|
1245 | + if (!is_array($destinationRecordIds)) { |
|
1246 | + $destinationRecordIds = [$destinationRecordIds]; |
|
1247 | + } |
|
1234 | 1248 | |
1235 | 1249 | $data = []; |
1236 | 1250 | $data['CRMEntity'] = $focus; |
@@ -1277,11 +1291,13 @@ discard block |
||
1277 | 1291 | { |
1278 | 1292 | global $Vtiger_Utils_Log, $_installOrUpdateVtlibModule; |
1279 | 1293 | $log = LoggerManager::getInstance(); |
1280 | - if (!file_exists($packagepath)) |
|
1281 | - return; |
|
1294 | + if (!file_exists($packagepath)) { |
|
1295 | + return; |
|
1296 | + } |
|
1282 | 1297 | |
1283 | - if (isset($_installOrUpdateVtlibModule[$packagename . $packagepath])) |
|
1284 | - return; |
|
1298 | + if (isset($_installOrUpdateVtlibModule[$packagename . $packagepath])) { |
|
1299 | + return; |
|
1300 | + } |
|
1285 | 1301 | $_installOrUpdateVtlibModule[$packagename . $packagepath] = 'install'; |
1286 | 1302 | |
1287 | 1303 | $Vtiger_Utils_Log = defined('INSTALLATION_MODE_DEBUG') ? INSTALLATION_MODE_DEBUG : true; |
@@ -1328,11 +1344,13 @@ discard block |
||
1328 | 1344 | { |
1329 | 1345 | global $_installOrUpdateVtlibModule; |
1330 | 1346 | $log = LoggerManager::getInstance(); |
1331 | - if (!file_exists($packagepath)) |
|
1332 | - return; |
|
1347 | + if (!file_exists($packagepath)) { |
|
1348 | + return; |
|
1349 | + } |
|
1333 | 1350 | |
1334 | - if (isset($_installOrUpdateVtlibModule[$module . $packagepath])) |
|
1335 | - return; |
|
1351 | + if (isset($_installOrUpdateVtlibModule[$module . $packagepath])) { |
|
1352 | + return; |
|
1353 | + } |
|
1336 | 1354 | $_installOrUpdateVtlibModule[$module . $packagepath] = 'update'; |
1337 | 1355 | |
1338 | 1356 | $Vtiger_Utils_Log = defined('INSTALLATION_MODE_DEBUG') ? INSTALLATION_MODE_DEBUG : true; |
@@ -1416,20 +1434,23 @@ discard block |
||
1416 | 1434 | $delim = array('/', '.'); |
1417 | 1435 | foreach ($delim as $delimiter) { |
1418 | 1436 | $x = strpos($value, $delimiter); |
1419 | - if ($x === false) |
|
1420 | - continue; |
|
1421 | - else { |
|
1437 | + if ($x === false) { |
|
1438 | + continue; |
|
1439 | + } else { |
|
1422 | 1440 | $value = str_replace($delimiter, '-', $value); |
1423 | 1441 | break; |
1424 | 1442 | } |
1425 | 1443 | } |
1426 | 1444 | list($y, $m, $d) = explode('-', $value); |
1427 | - if (strlen($y) == 1) |
|
1428 | - $y = '0' . $y; |
|
1429 | - if (strlen($m) == 1) |
|
1430 | - $m = '0' . $m; |
|
1431 | - if (strlen($d) == 1) |
|
1432 | - $d = '0' . $d; |
|
1445 | + if (strlen($y) == 1) { |
|
1446 | + $y = '0' . $y; |
|
1447 | + } |
|
1448 | + if (strlen($m) == 1) { |
|
1449 | + $m = '0' . $m; |
|
1450 | + } |
|
1451 | + if (strlen($d) == 1) { |
|
1452 | + $d = '0' . $d; |
|
1453 | + } |
|
1433 | 1454 | $value = implode('-', array($y, $m, $d)); |
1434 | 1455 | |
1435 | 1456 | if (strlen($y) < 4) { |
@@ -1821,8 +1842,9 @@ discard block |
||
1821 | 1842 | $query = $queryGenerator->getQuery(); |
1822 | 1843 | $current_page = ListViewSession::getCurrentPage($moduleName, $viewid); |
1823 | 1844 | $limit_start_rec = ($current_page - 1) * $list_max_entries_per_page; |
1824 | - if ($limit_start_rec < 0) |
|
1825 | - $limit_start_rec = 0; |
|
1845 | + if ($limit_start_rec < 0) { |
|
1846 | + $limit_start_rec = 0; |
|
1847 | + } |
|
1826 | 1848 | $query .= sprintf(' LIMIT %s,%s', $limit_start_rec, $list_max_entries_per_page); |
1827 | 1849 | |
1828 | 1850 | $result = $adb->pquery($query, []); |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | |
57 | 57 | /** Function to return a full name |
58 | 58 | * @param $row -- row:: Type integer |
59 | - * @param $first_column -- first column:: Type string |
|
60 | - * @param $last_column -- last column:: Type string |
|
59 | + * @param string $first_column -- first column:: Type string |
|
60 | + * @param string $last_column -- last column:: Type string |
|
61 | 61 | * @returns $fullname -- fullname:: Type string |
62 | 62 | * |
63 | 63 | */ |
@@ -713,6 +713,7 @@ discard block |
||
713 | 713 | |
714 | 714 | /** |
715 | 715 | * simple HTML to UTF-8 conversion: |
716 | + * @param string $data |
|
716 | 717 | */ |
717 | 718 | function html_to_utf8($data) |
718 | 719 | { |
@@ -757,6 +758,7 @@ discard block |
||
757 | 758 | |
758 | 759 | /** |
759 | 760 | * Function to find the UI type of a field based on the uitype id |
761 | + * @param string $reqtype |
|
760 | 762 | */ |
761 | 763 | function is_uitype($uitype, $reqtype) |
762 | 764 | { |
@@ -1539,6 +1541,8 @@ discard block |
||
1539 | 1541 | |
1540 | 1542 | /** |
1541 | 1543 | * Function to get the approximate difference between two date time values as string |
1544 | + * @param integer $d1 |
|
1545 | + * @param integer $d2 |
|
1542 | 1546 | */ |
1543 | 1547 | function dateDiffAsString($d1, $d2) |
1544 | 1548 | { |
@@ -61,8 +61,9 @@ |
||
61 | 61 | self::$modules[$module] = $CONFIG; |
62 | 62 | switch ($argsLength) { |
63 | 63 | case 2: |
64 | - if (!isset($CONFIG[$key])) |
|
65 | - return false; |
|
64 | + if (!isset($CONFIG[$key])) { |
|
65 | + return false; |
|
66 | + } |
|
66 | 67 | return $CONFIG[$key]; |
67 | 68 | break; |
68 | 69 | default: |
@@ -16,11 +16,17 @@ discard block |
||
16 | 16 | protected static $sounds = []; |
17 | 17 | protected static $search = []; |
18 | 18 | |
19 | + /** |
|
20 | + * @param string $key |
|
21 | + */ |
|
19 | 22 | public static function load($key, $config) |
20 | 23 | { |
21 | 24 | self::$$key = $config; |
22 | 25 | } |
23 | 26 | |
27 | + /** |
|
28 | + * @param string $key |
|
29 | + */ |
|
24 | 30 | public static function main($key, $value = false) |
25 | 31 | { |
26 | 32 | if (isset(self::$main[$key])) { |
@@ -71,11 +77,17 @@ discard block |
||
71 | 77 | } |
72 | 78 | } |
73 | 79 | |
80 | + /** |
|
81 | + * @param string $key |
|
82 | + */ |
|
74 | 83 | public static function api($key, $defvalue = false) |
75 | 84 | { |
76 | 85 | return self::$api[$key]; |
77 | 86 | } |
78 | 87 | |
88 | + /** |
|
89 | + * @param string $key |
|
90 | + */ |
|
79 | 91 | public static function debug($key, $defvalue = false) |
80 | 92 | { |
81 | 93 | if (empty(self::$debug)) { |
@@ -85,6 +97,9 @@ discard block |
||
85 | 97 | return self::$debug[$key]; |
86 | 98 | } |
87 | 99 | |
100 | + /** |
|
101 | + * @param string $key |
|
102 | + */ |
|
88 | 103 | public static function developer($key, $defvalue = false) |
89 | 104 | { |
90 | 105 | if (empty(self::$developer)) { |
@@ -94,6 +109,9 @@ discard block |
||
94 | 109 | return self::$developer[$key]; |
95 | 110 | } |
96 | 111 | |
112 | + /** |
|
113 | + * @param string $key |
|
114 | + */ |
|
97 | 115 | public static function security($key, $defvalue = false) |
98 | 116 | { |
99 | 117 | if (empty(self::$security)) { |
@@ -103,6 +121,9 @@ discard block |
||
103 | 121 | return self::$security[$key]; |
104 | 122 | } |
105 | 123 | |
124 | + /** |
|
125 | + * @param string $key |
|
126 | + */ |
|
106 | 127 | public static function securityKeys($key, $defvalue = false) |
107 | 128 | { |
108 | 129 | if (empty(self::$securityKeys)) { |
@@ -112,6 +133,9 @@ discard block |
||
112 | 133 | return self::$securityKeys[$key]; |
113 | 134 | } |
114 | 135 | |
136 | + /** |
|
137 | + * @param string $key |
|
138 | + */ |
|
115 | 139 | public static function performance($key, $defvalue = false) |
116 | 140 | { |
117 | 141 | if (empty(self::$performance)) { |
@@ -121,6 +145,11 @@ discard block |
||
121 | 145 | return self::$performance[$key]; |
122 | 146 | } |
123 | 147 | |
148 | + /** |
|
149 | + * @param string $key |
|
150 | + * |
|
151 | + * @return boolean |
|
152 | + */ |
|
124 | 153 | public static function relation($key, $defvalue = false) |
125 | 154 | { |
126 | 155 | if (empty(self::$relation)) { |
@@ -143,6 +172,9 @@ discard block |
||
143 | 172 | return self::$sounds[$key]; |
144 | 173 | } |
145 | 174 | |
175 | + /** |
|
176 | + * @param string $key |
|
177 | + */ |
|
146 | 178 | public static function search($key, $defvalue = false) |
147 | 179 | { |
148 | 180 | if (empty(self::$search)) { |
@@ -152,6 +184,10 @@ discard block |
||
152 | 184 | return self::$search[$key]; |
153 | 185 | } |
154 | 186 | |
187 | + /** |
|
188 | + * @param string $key |
|
189 | + * @param integer $value |
|
190 | + */ |
|
155 | 191 | public static function iniSet($key, $value) |
156 | 192 | { |
157 | 193 | @ini_set($key, $value); |
@@ -306,8 +306,9 @@ discard block |
||
306 | 306 | |
307 | 307 | public function parseAdvFilterList($advFilterList, $glue = '') |
308 | 308 | { |
309 | - if (!empty($glue)) |
|
310 | - $this->addConditionGlue($glue); |
|
309 | + if (!empty($glue)) { |
|
310 | + $this->addConditionGlue($glue); |
|
311 | + } |
|
311 | 312 | |
312 | 313 | $customView = new CustomView($this->module); |
313 | 314 | $dateSpecificConditions = $customView->getStdFilterConditions(); |
@@ -318,8 +319,9 @@ discard block |
||
318 | 319 | foreach ($filtercolumns as $index => $filter) { |
319 | 320 | $nameComponents = explode(':', $filter['columnname']); |
320 | 321 | // For Events "End Date & Time" field datatype should be DT. But, db will give D for due_date field |
321 | - if ($nameComponents[2] == 'due_date' && $nameComponents[3] == 'Events_End_Date_&_Time') |
|
322 | - $nameComponents[4] = 'DT'; |
|
322 | + if ($nameComponents[2] == 'due_date' && $nameComponents[3] == 'Events_End_Date_&_Time') { |
|
323 | + $nameComponents[4] = 'DT'; |
|
324 | + } |
|
323 | 325 | if (empty($nameComponents[2]) && $nameComponents[1] == 'crmid' && $nameComponents[0] == 'vtiger_crmentity') { |
324 | 326 | $name = $this->getSQLColumn('id'); |
325 | 327 | } else { |
@@ -343,13 +345,15 @@ discard block |
||
343 | 345 | // If datatype is DT then we should append time also |
344 | 346 | if ($nameComponents[4] == 'DT') { |
345 | 347 | $startdate = explode(' ', $dateFilterResolvedList['startdate']); |
346 | - if ($startdate[1] == '') |
|
347 | - $startdate[1] = '00:00:00'; |
|
348 | + if ($startdate[1] == '') { |
|
349 | + $startdate[1] = '00:00:00'; |
|
350 | + } |
|
348 | 351 | $dateFilterResolvedList['startdate'] = $startdate[0] . ' ' . $startdate[1]; |
349 | 352 | |
350 | 353 | $enddate = explode(' ', $dateFilterResolvedList['enddate']); |
351 | - if ($enddate[1] == '') |
|
352 | - $enddate[1] = '23:59:59'; |
|
354 | + if ($enddate[1] == '') { |
|
355 | + $enddate[1] = '23:59:59'; |
|
356 | + } |
|
353 | 357 | $dateFilterResolvedList['enddate'] = $enddate[0] . ' ' . $enddate[1]; |
354 | 358 | } |
355 | 359 | $value = []; |
@@ -367,12 +371,14 @@ discard block |
||
367 | 371 | |
368 | 372 | $value = []; |
369 | 373 | $start = explode(' ', $startDate); |
370 | - if ($start[1] == "") |
|
371 | - $startDate = $start[0] . ' ' . '00:00:00'; |
|
374 | + if ($start[1] == "") { |
|
375 | + $startDate = $start[0] . ' ' . '00:00:00'; |
|
376 | + } |
|
372 | 377 | |
373 | 378 | $end = explode(' ', $endDate); |
374 | - if ($end[1] == "") |
|
375 | - $endDate = $end[0] . ' ' . '23:59:59'; |
|
379 | + if ($end[1] == "") { |
|
380 | + $endDate = $end[0] . ' ' . '23:59:59'; |
|
381 | + } |
|
376 | 382 | |
377 | 383 | $value[] = $startDate; |
378 | 384 | $value[] = $endDate; |
@@ -405,8 +411,9 @@ discard block |
||
405 | 411 | } |
406 | 412 | $this->endGroup(); |
407 | 413 | $groupConditionGlue = $groupcolumns['condition']; |
408 | - if (!empty($groupConditionGlue)) |
|
409 | - $this->addConditionGlue($groupConditionGlue); |
|
414 | + if (!empty($groupConditionGlue)) { |
|
415 | + $this->addConditionGlue($groupConditionGlue); |
|
416 | + } |
|
410 | 417 | } |
411 | 418 | } |
412 | 419 | } |
@@ -698,8 +705,9 @@ discard block |
||
698 | 705 | $fields = $meta->getModuleFields(); |
699 | 706 | $fieldObject = $fields[$fieldName]; |
700 | 707 | |
701 | - if (empty($fieldObject)) |
|
702 | - continue; |
|
708 | + if (empty($fieldObject)) { |
|
709 | + continue; |
|
710 | + } |
|
703 | 711 | |
704 | 712 | $tableName = $fieldObject->getTableName(); |
705 | 713 | if (!in_array($tableName, $referenceFieldTableList)) { |
@@ -758,8 +766,9 @@ discard block |
||
758 | 766 | $operator = strtolower($conditionInfo['operator']); |
759 | 767 | if ($operator == 'between' && $this->isDateType($field->getFieldDataType())) { |
760 | 768 | $start = explode(' ', $conditionInfo['value'][0]); |
761 | - if (count($start) == 2) |
|
762 | - $conditionInfo['value'][0] = getValidDBInsertDateTimeValue($start[0] . ' ' . $start[1]); |
|
769 | + if (count($start) == 2) { |
|
770 | + $conditionInfo['value'][0] = getValidDBInsertDateTimeValue($start[0] . ' ' . $start[1]); |
|
771 | + } |
|
763 | 772 | |
764 | 773 | $end = explode(' ', $conditionInfo['values'][1]); |
765 | 774 | // Dates will be equal for Today, Tomorrow, Yesterday. |
@@ -920,8 +929,9 @@ discard block |
||
920 | 929 | $conditionGlue = ' && '; |
921 | 930 | if ($conditionInfo['operator'] == 'n') { |
922 | 931 | $specialCondition = ' || ' . $field->getTableName() . '.' . $field->getColumnName() . ' IS NULL '; |
923 | - if (!empty($otherField)) |
|
924 | - $specialConditionForOtherField = ' || ' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' IS NULL '; |
|
932 | + if (!empty($otherField)) { |
|
933 | + $specialConditionForOtherField = ' || ' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' IS NULL '; |
|
934 | + } |
|
925 | 935 | } |
926 | 936 | } |
927 | 937 | |
@@ -931,10 +941,11 @@ discard block |
||
931 | 941 | } |
932 | 942 | |
933 | 943 | $fieldSql .= "$fieldGlue ((" . $field->getTableName() . '.' . $field->getColumnName() . ' ' . $valueSql . " $specialCondition) "; |
934 | - if (!empty($otherField)) |
|
935 | - $fieldSql .= $conditionGlue . '(' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' ' . $otherFieldValueSql . ' ' . $specialConditionForOtherField . '))'; |
|
936 | - else |
|
937 | - $fieldSql .= ')'; |
|
944 | + if (!empty($otherField)) { |
|
945 | + $fieldSql .= $conditionGlue . '(' . $otherField->getTableName() . '.' . $otherField->getColumnName() . ' ' . $otherFieldValueSql . ' ' . $specialConditionForOtherField . '))'; |
|
946 | + } else { |
|
947 | + $fieldSql .= ')'; |
|
948 | + } |
|
938 | 949 | } elseif ($conditionInfo['custom']) { |
939 | 950 | $fieldSql .= $fieldGlue . 'vtiger_crmentity.crmid ' . $valueSql; |
940 | 951 | } else { |
@@ -1306,8 +1317,9 @@ discard block |
||
1306 | 1317 | public function addCondition($fieldname, $value, $operator, $glue = null, $custom = false, $newGroupType = null, $ignoreComma = false) |
1307 | 1318 | { |
1308 | 1319 | $conditionNumber = $this->conditionInstanceCount++; |
1309 | - if ($glue != null && $conditionNumber > 0) |
|
1310 | - $this->addConditionGlue($glue); |
|
1320 | + if ($glue != null && $conditionNumber > 0) { |
|
1321 | + $this->addConditionGlue($glue); |
|
1322 | + } |
|
1311 | 1323 | |
1312 | 1324 | $this->groupInfo .= "$conditionNumber "; |
1313 | 1325 | $this->whereFields[] = $fieldname; |
@@ -1328,8 +1340,9 @@ discard block |
||
1328 | 1340 | public function addReferenceModuleFieldCondition($relatedModule, $referenceField, $fieldName, $value, $SQLOperator, $glue = null) |
1329 | 1341 | { |
1330 | 1342 | $conditionNumber = $this->conditionInstanceCount++; |
1331 | - if ($glue != null && $conditionNumber > 0) |
|
1332 | - $this->addConditionGlue($glue); |
|
1343 | + if ($glue != null && $conditionNumber > 0) { |
|
1344 | + $this->addConditionGlue($glue); |
|
1345 | + } |
|
1333 | 1346 | |
1334 | 1347 | $this->groupInfo .= "$conditionNumber "; |
1335 | 1348 | $this->referenceModuleField[$conditionNumber] = array('relatedModule' => $relatedModule, 'referenceField' => $referenceField, 'fieldName' => $fieldName, 'value' => $value, |
@@ -1403,8 +1416,9 @@ discard block |
||
1403 | 1416 | } |
1404 | 1417 | $this->endGroup(); |
1405 | 1418 | $groupConditionGlue = $groupcolumns['condition']; |
1406 | - if (!empty($groupConditionGlue)) |
|
1407 | - $this->addConditionGlue($groupConditionGlue); |
|
1419 | + if (!empty($groupConditionGlue)) { |
|
1420 | + $this->addConditionGlue($groupConditionGlue); |
|
1421 | + } |
|
1408 | 1422 | } |
1409 | 1423 | } |
1410 | 1424 | $this->endGroup(); |
@@ -153,6 +153,9 @@ discard block |
||
153 | 153 | return $this->whereFields; |
154 | 154 | } |
155 | 155 | |
156 | + /** |
|
157 | + * @param string $columns |
|
158 | + */ |
|
156 | 159 | public function setCustomColumn($columns) |
157 | 160 | { |
158 | 161 | $this->columnsCustom[] = $columns; |
@@ -183,6 +186,9 @@ discard block |
||
183 | 186 | $this->sourceRecord = $sourceRecord; |
184 | 187 | } |
185 | 188 | |
189 | + /** |
|
190 | + * @return boolean |
|
191 | + */ |
|
186 | 192 | public function getSourceRecord() |
187 | 193 | { |
188 | 194 | return $this->sourceRecord; |
@@ -193,6 +199,9 @@ discard block |
||
193 | 199 | return $this->ownerFields; |
194 | 200 | } |
195 | 201 | |
202 | + /** |
|
203 | + * @return string |
|
204 | + */ |
|
196 | 205 | public function getModuleNameFields($module) |
197 | 206 | { |
198 | 207 | return $this->moduleNameFields[$module]; |
@@ -1250,6 +1259,9 @@ discard block |
||
1250 | 1259 | return $sql; |
1251 | 1260 | } |
1252 | 1261 | |
1262 | + /** |
|
1263 | + * @param string $groupSql |
|
1264 | + */ |
|
1253 | 1265 | private function makeGroupSqlReplacements($fieldSqlList, $groupSql) |
1254 | 1266 | { |
1255 | 1267 | $pos = 0; |
@@ -1287,6 +1299,9 @@ discard block |
||
1287 | 1299 | return ($type == 'date' || $type == 'datetime'); |
1288 | 1300 | } |
1289 | 1301 | |
1302 | + /** |
|
1303 | + * @return string |
|
1304 | + */ |
|
1290 | 1305 | public function fixDateTimeValue($name, $value, $first = true) |
1291 | 1306 | { |
1292 | 1307 | $moduleFields = $this->getModuleFields(); |
@@ -1304,6 +1319,10 @@ discard block |
||
1304 | 1319 | return $value; |
1305 | 1320 | } |
1306 | 1321 | |
1322 | + /** |
|
1323 | + * @param string $glue |
|
1324 | + * @param string $newGroupType |
|
1325 | + */ |
|
1307 | 1326 | public function addCondition($fieldname, $value, $operator, $glue = null, $custom = false, $newGroupType = null, $ignoreComma = false) |
1308 | 1327 | { |
1309 | 1328 | $conditionNumber = $this->conditionInstanceCount++; |
@@ -1347,6 +1366,9 @@ discard block |
||
1347 | 1366 | return array('name' => $fieldname, 'value' => $value, 'operator' => $operator, 'custom' => $custom); |
1348 | 1367 | } |
1349 | 1368 | |
1369 | + /** |
|
1370 | + * @param string $groupType |
|
1371 | + */ |
|
1350 | 1372 | public function startGroup($groupType) |
1351 | 1373 | { |
1352 | 1374 | $this->groupInfo .= " $groupType ("; |
@@ -270,8 +270,7 @@ |
||
270 | 270 | foreach ($moduleFields as $fieldName => $webserviceField) { |
271 | 271 | array_push($fields, $this->getDescribeFieldArray($webserviceField)); |
272 | 272 | } |
273 | - $label = ($app_strings[$this->meta->getObectIndexColumn()]) ? $app_strings[$this->meta->getObectIndexColumn()] : |
|
274 | - $this->meta->getObectIndexColumn(); |
|
273 | + $label = ($app_strings[$this->meta->getObectIndexColumn()]) ? $app_strings[$this->meta->getObectIndexColumn()] : $this->meta->getObectIndexColumn(); |
|
275 | 274 | $this->moduleFields = $fields; |
276 | 275 | } |
277 | 276 | return $this->moduleFields; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $params = array_merge($params, $ownerIds); |
118 | 118 | } |
119 | 119 | |
120 | - $q .=" order by modifiedtime limit $numRecordsLimit"; |
|
120 | + $q .= " order by modifiedtime limit $numRecordsLimit"; |
|
121 | 121 | $result = $adb->pquery($q, $params); |
122 | 122 | |
123 | 123 | $modTime = []; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | // since not all fields present in delete condition will be present in the fieldnames of the module |
157 | 157 | foreach ($deleteColumnNames as $table_fieldName => $columnName) { |
158 | 158 | if (!in_array($columnName, $moduleFieldNames)) { |
159 | - $selectClause .=", " . $table_fieldName; |
|
159 | + $selectClause .= ", " . $table_fieldName; |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | if ($elementType == "Emails") |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | |
167 | 167 | $fromClause .= " INNER JOIN (select modifiedtime, crmid,deleted,setype FROM $baseCRMTable WHERE setype=? and modifiedtime >? and modifiedtime<=?"; |
168 | 168 | if (!$applicationSync) { |
169 | - $fromClause.= 'and smownerid IN(' . generateQuestionMarks($ownerIds) . ')'; |
|
169 | + $fromClause .= 'and smownerid IN(' . generateQuestionMarks($ownerIds) . ')'; |
|
170 | 170 | $params = array_merge($params, $ownerIds); |
171 | 171 | } |
172 | - $fromClause.= ' ) vtiger_ws_sync ON (vtiger_crmentity.crmid = vtiger_ws_sync.crmid)'; |
|
172 | + $fromClause .= ' ) vtiger_ws_sync ON (vtiger_crmentity.crmid = vtiger_ws_sync.crmid)'; |
|
173 | 173 | $q = $selectClause . " " . $fromClause; |
174 | 174 | $result = $adb->pquery($q, $params); |
175 | 175 | $recordDetails = []; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $params[] = $entityModule; |
207 | 207 | } |
208 | 208 | if (!$applicationSync) { |
209 | - $q.='and smownerid IN(' . generateQuestionMarks($ownerIds) . ')'; |
|
209 | + $q .= 'and smownerid IN(' . generateQuestionMarks($ownerIds) . ')'; |
|
210 | 210 | $params = array_merge($params, $ownerIds); |
211 | 211 | } |
212 | 212 |
@@ -73,14 +73,16 @@ discard block |
||
73 | 73 | $modulesInformation = $modulesDetails["information"]; |
74 | 74 | |
75 | 75 | foreach ($modulesInformation as $moduleName => $entityInformation) { |
76 | - if ($entityInformation["isEntity"]) |
|
77 | - $entityModules[] = $moduleName; |
|
76 | + if ($entityInformation["isEntity"]) { |
|
77 | + $entityModules[] = $moduleName; |
|
78 | + } |
|
78 | 79 | } |
79 | 80 | if (!$typed) { |
80 | 81 | $accessableModules = $entityModules; |
81 | 82 | } else { |
82 | - if (!in_array($elementType, $entityModules)) |
|
83 | - throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied"); |
|
83 | + if (!in_array($elementType, $entityModules)) { |
|
84 | + throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied"); |
|
85 | + } |
|
84 | 86 | $accessableModules[] = $elementType; |
85 | 87 | } |
86 | 88 | |
@@ -101,15 +103,17 @@ discard block |
||
101 | 103 | if ($elementType == "Calendar" || $elementType == "Events") { |
102 | 104 | $baseCRMTable = getSyncQueryBaseTable($elementType); |
103 | 105 | } |
104 | - } else |
|
105 | - $baseCRMTable = " vtiger_crmentity "; |
|
106 | + } else { |
|
107 | + $baseCRMTable = " vtiger_crmentity "; |
|
108 | + } |
|
106 | 109 | |
107 | 110 | //modifiedtime - next token |
108 | 111 | $q = "SELECT modifiedtime FROM $baseCRMTable WHERE modifiedtime>? and setype IN(" . generateQuestionMarks($accessableModules) . ") "; |
109 | 112 | $params = array($datetime); |
110 | 113 | foreach ($accessableModules as $entityModule) { |
111 | - if ($entityModule == "Events") |
|
112 | - $entityModule = "Calendar"; |
|
114 | + if ($entityModule == "Events") { |
|
115 | + $entityModule = "Calendar"; |
|
116 | + } |
|
113 | 117 | $params[] = $entityModule; |
114 | 118 | } |
115 | 119 | if (!$applicationSync) { |
@@ -159,10 +163,11 @@ discard block |
||
159 | 163 | $selectClause .=", " . $table_fieldName; |
160 | 164 | } |
161 | 165 | } |
162 | - if ($elementType == "Emails") |
|
163 | - $fromClause = vtws_getEmailFromClause(); |
|
164 | - else |
|
165 | - $fromClause = $queryGenerator->getFromClause(); |
|
166 | + if ($elementType == "Emails") { |
|
167 | + $fromClause = vtws_getEmailFromClause(); |
|
168 | + } else { |
|
169 | + $fromClause = $queryGenerator->getFromClause(); |
|
170 | + } |
|
166 | 171 | |
167 | 172 | $fromClause .= " INNER JOIN (select modifiedtime, crmid,deleted,setype FROM $baseCRMTable WHERE setype=? and modifiedtime >? and modifiedtime<=?"; |
168 | 173 | if (!$applicationSync) { |
@@ -201,8 +206,9 @@ discard block |
||
201 | 206 | $params = array($maxModifiedTime); |
202 | 207 | |
203 | 208 | foreach ($accessableModules as $entityModule) { |
204 | - if ($entityModule == "Events") |
|
205 | - $entityModule = "Calendar"; |
|
209 | + if ($entityModule == "Events") { |
|
210 | + $entityModule = "Calendar"; |
|
211 | + } |
|
206 | 212 | $params[] = $entityModule; |
207 | 213 | } |
208 | 214 | if (!$applicationSync) { |
@@ -285,10 +291,11 @@ discard block |
||
285 | 291 | |
286 | 292 | function getCalendarTypeCondition($elementType) |
287 | 293 | { |
288 | - if ($elementType == "Events") |
|
289 | - $activityCondition = "vtiger_activity.activitytype !='Task' and vtiger_activity.activitytype !='Emails'"; |
|
290 | - else |
|
291 | - $activityCondition = "vtiger_activity.activitytype ='Task'"; |
|
294 | + if ($elementType == "Events") { |
|
295 | + $activityCondition = "vtiger_activity.activitytype !='Task' and vtiger_activity.activitytype !='Emails'"; |
|
296 | + } else { |
|
297 | + $activityCondition = "vtiger_activity.activitytype ='Task'"; |
|
298 | + } |
|
292 | 299 | return $activityCondition; |
293 | 300 | } |
294 | 301 |
@@ -13,6 +13,9 @@ discard block |
||
13 | 13 | require_once 'include/utils/CommonUtils.php'; |
14 | 14 | require_once 'include/Webservices/DescribeObject.php'; |
15 | 15 | |
16 | +/** |
|
17 | + * @param string $syncType |
|
18 | + */ |
|
16 | 19 | function vtws_sync($mtime, $elementType, $syncType, $user) |
17 | 20 | { |
18 | 21 | global $recordString, $modifiedTimeString; |
@@ -244,6 +247,9 @@ discard block |
||
244 | 247 | return strtotime($mtimeString); |
245 | 248 | } |
246 | 249 | |
250 | +/** |
|
251 | + * @param string[] $deletedValues |
|
252 | + */ |
|
247 | 253 | function vtws_isRecordDeleted($recordDetails, $deleteColumnDetails, $deletedValues) |
248 | 254 | { |
249 | 255 | $deletedRecord = false; |
@@ -212,8 +212,9 @@ discard block |
||
212 | 212 | $adb = PearDatabase::getInstance(); |
213 | 213 | |
214 | 214 | // administrator's have assign privilege |
215 | - if (\vtlib\Functions::userIsAdministrator($this->user)) |
|
216 | - return true; |
|
215 | + if (\vtlib\Functions::userIsAdministrator($this->user)) { |
|
216 | + return true; |
|
217 | + } |
|
217 | 218 | |
218 | 219 | $idComponents = vtws_getIdComponents($webserviceId); |
219 | 220 | $userId = $idComponents[1]; |
@@ -353,8 +354,9 @@ discard block |
||
353 | 354 | $theme = vtws_preserveGlobal('theme', $this->user->theme); |
354 | 355 | $default_language = AppConfig::main('default_language'); |
355 | 356 | $current_language = vglobal('current_language'); |
356 | - if (empty($current_language)) |
|
357 | - $current_language = $default_language; |
|
357 | + if (empty($current_language)) { |
|
358 | + $current_language = $default_language; |
|
359 | + } |
|
358 | 360 | $current_language = vtws_preserveGlobal('current_language', $current_language); |
359 | 361 | |
360 | 362 | $this->computeAccess(); |
@@ -31,8 +31,9 @@ discard block |
||
31 | 31 | $page = empty($element['page']) ? 0 : intval($element['page']); // Page to start |
32 | 32 | |
33 | 33 | $acrossAllModule = false; |
34 | - if ($moduleName == 'Home') |
|
35 | - $acrossAllModule = true; |
|
34 | + if ($moduleName == 'Home') { |
|
35 | + $acrossAllModule = true; |
|
36 | + } |
|
36 | 37 | |
37 | 38 | // Pre-condition check |
38 | 39 | if (empty($moduleName)) { |
@@ -71,8 +72,10 @@ discard block |
||
71 | 72 | |
72 | 73 | // Get most recently tracked changes with limit |
73 | 74 | $start = $page * $MAXLIMIT; |
74 | - if ($start > 0) |
|
75 | - $start = $start + 1; // Adjust the start range |
|
75 | + if ($start > 0) { |
|
76 | + $start = $start + 1; |
|
77 | + } |
|
78 | + // Adjust the start range |
|
76 | 79 | $sql .= sprintf(' ORDER BY vtiger_modtracker_basic.id DESC LIMIT %s,%s', $start, $MAXLIMIT); |
77 | 80 | |
78 | 81 | $result = $adb->pquery($sql, $params); |
@@ -52,8 +52,9 @@ discard block |
||
52 | 52 | generateQuestionMarks($fieldTypeList) . ')'; |
53 | 53 | $params = []; |
54 | 54 | $params[] = $user->id; |
55 | - foreach ($fieldTypeList as $fieldType) |
|
56 | - $params[] = $fieldType; |
|
55 | + foreach ($fieldTypeList as $fieldType) { |
|
56 | + $params[] = $fieldType; |
|
57 | + } |
|
57 | 58 | $result = $db->pquery($sql, $params); |
58 | 59 | $it = new SqlResultIterator($db, $result); |
59 | 60 | $moduleList = []; |
@@ -107,8 +108,9 @@ discard block |
||
107 | 108 | |
108 | 109 | $default_language = VTWS_PreserveGlobal::getGlobal('default_language'); |
109 | 110 | $current_language = vglobal('current_language'); |
110 | - if (empty($current_language)) |
|
111 | - $current_language = $default_language; |
|
111 | + if (empty($current_language)) { |
|
112 | + $current_language = $default_language; |
|
113 | + } |
|
112 | 114 | $current_language = vtws_preserveGlobal('current_language', $current_language); |
113 | 115 | |
114 | 116 | $appStrings = return_application_language($current_language); |