@@ -18,6 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Get current version of vtiger in use. |
21 | + * @return string|null |
|
21 | 22 | */ |
22 | 23 | static function current() |
23 | 24 | { |
@@ -40,6 +41,9 @@ discard block |
||
40 | 41 | return version_compare($current_version, $with_version, $condition); |
41 | 42 | } |
42 | 43 | |
44 | + /** |
|
45 | + * @param string $endString |
|
46 | + */ |
|
43 | 47 | static function endsWith($string, $endString) |
44 | 48 | { |
45 | 49 | $strLen = strlen($string); |
@@ -49,6 +53,11 @@ discard block |
||
49 | 53 | return substr_compare($string, $endString, -$endStrLen) === 0; |
50 | 54 | } |
51 | 55 | |
56 | + /** |
|
57 | + * @param string $version |
|
58 | + * |
|
59 | + * @return string|null |
|
60 | + */ |
|
52 | 61 | static function getUpperLimitVersion($version) |
53 | 62 | { |
54 | 63 | if (!self::endsWith($version, '.*')) |
@@ -44,15 +44,17 @@ |
||
44 | 44 | { |
45 | 45 | $strLen = strlen($string); |
46 | 46 | $endStrLen = strlen($endString); |
47 | - if ($endStrLen > $strLen) |
|
48 | - return false; |
|
47 | + if ($endStrLen > $strLen) { |
|
48 | + return false; |
|
49 | + } |
|
49 | 50 | return substr_compare($string, $endString, -$endStrLen) === 0; |
50 | 51 | } |
51 | 52 | |
52 | 53 | static function getUpperLimitVersion($version) |
53 | 54 | { |
54 | - if (!self::endsWith($version, '.*')) |
|
55 | - return $version; |
|
55 | + if (!self::endsWith($version, '.*')) { |
|
56 | + return $version; |
|
57 | + } |
|
56 | 58 | |
57 | 59 | $version = rtrim($version, '.*'); |
58 | 60 | $lastVersionPartIndex = strrpos($version, '.'); |
@@ -20,6 +20,7 @@ discard block |
||
20 | 20 | * Helper function to log messages |
21 | 21 | * @param String Message to log |
22 | 22 | * @param Boolean true appends linebreak, false to avoid it |
23 | + * @param string $message |
|
23 | 24 | * @access private |
24 | 25 | */ |
25 | 26 | static function log($message, $delim = true) |
@@ -30,6 +31,7 @@ discard block |
||
30 | 31 | /** |
31 | 32 | * Initialize webservice for the given module |
32 | 33 | * @param Module Instance of the module. |
34 | + * @param Module $moduleInstance |
|
33 | 35 | */ |
34 | 36 | static function initialize($moduleInstance) |
35 | 37 | { |
@@ -45,6 +47,7 @@ discard block |
||
45 | 47 | /** |
46 | 48 | * Initialize webservice for the given module |
47 | 49 | * @param Module Instance of the module. |
50 | + * @param Module $moduleInstance |
|
48 | 51 | */ |
49 | 52 | static function uninitialize($moduleInstance) |
50 | 53 | { |
@@ -69,6 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Normalize the directory path separators. |
72 | + * @param string $path |
|
72 | 73 | */ |
73 | 74 | public function __normalizePath($path) |
74 | 75 | { |
@@ -79,6 +80,7 @@ discard block |
||
79 | 80 | |
80 | 81 | /** |
81 | 82 | * Copy the directory on the disk into zip file. |
83 | + * @param string $zipdirname |
|
82 | 84 | */ |
83 | 85 | public function copyDirectoryFromDisk($dirname, $zipdirname = null, $excludeList = null, $basedirname = null) |
84 | 86 | { |
@@ -50,8 +50,9 @@ discard block |
||
50 | 50 | if ($search_index === 0) { |
51 | 51 | $startindex = strlen($base_realpath) + 1; |
52 | 52 | // On windows $base_realpath ends with / and On Linux it will not have / at end! |
53 | - if (strrpos($base_realpath, '/') == strlen($base_realpath) - 1) |
|
54 | - $startindex -= 1; |
|
53 | + if (strrpos($base_realpath, '/') == strlen($base_realpath) - 1) { |
|
54 | + $startindex -= 1; |
|
55 | + } |
|
55 | 56 | $relpath = substr($src_realpath, $startindex); |
56 | 57 | } |
57 | 58 | return $relpath; |
@@ -62,8 +63,9 @@ discard block |
||
62 | 63 | */ |
63 | 64 | public function __fixDirSeparator($path) |
64 | 65 | { |
65 | - if ($path != '' && (strripos($path, '/') != strlen($path) - 1)) |
|
66 | - $path .= '/'; |
|
66 | + if ($path != '' && (strripos($path, '/') != strlen($path) - 1)) { |
|
67 | + $path .= '/'; |
|
68 | + } |
|
67 | 69 | return $path; |
68 | 70 | } |
69 | 71 | |
@@ -72,8 +74,9 @@ discard block |
||
72 | 74 | */ |
73 | 75 | public function __normalizePath($path) |
74 | 76 | { |
75 | - if ($path && strpos($path, '\\') !== false) |
|
76 | - $path = preg_replace("/\\\\/", "/", $path); |
|
77 | + if ($path && strpos($path, '\\') !== false) { |
|
78 | + $path = preg_replace("/\\\\/", "/", $path); |
|
79 | + } |
|
77 | 80 | return $path; |
78 | 81 | } |
79 | 82 | |
@@ -83,18 +86,21 @@ discard block |
||
83 | 86 | public function copyDirectoryFromDisk($dirname, $zipdirname = null, $excludeList = null, $basedirname = null) |
84 | 87 | { |
85 | 88 | $dir = opendir($dirname); |
86 | - if (strripos($dirname, '/') != strlen($dirname) - 1) |
|
87 | - $dirname .= '/'; |
|
89 | + if (strripos($dirname, '/') != strlen($dirname) - 1) { |
|
90 | + $dirname .= '/'; |
|
91 | + } |
|
88 | 92 | |
89 | - if ($basedirname == null) |
|
90 | - $basedirname = realpath($dirname); |
|
93 | + if ($basedirname == null) { |
|
94 | + $basedirname = realpath($dirname); |
|
95 | + } |
|
91 | 96 | |
92 | 97 | while (false !== ($file = readdir($dir))) { |
93 | 98 | if ($file != '.' && $file != '..' && |
94 | 99 | $file != '.svn' && $file != 'CVS') { |
95 | 100 | // Exclude the file/directory |
96 | - if (!empty($excludeList) && in_array("$dirname$file", $excludeList)) |
|
97 | - continue; |
|
101 | + if (!empty($excludeList) && in_array("$dirname$file", $excludeList)) { |
|
102 | + continue; |
|
103 | + } |
|
98 | 104 | |
99 | 105 | if (is_dir("$dirname$file")) { |
100 | 106 | $this->copyDirectoryFromDisk("$dirname$file", $zipdirname, $excludeList, $basedirname); |
@@ -11,38 +11,38 @@ |
||
11 | 11 | require_once 'config/api.php'; |
12 | 12 | $service = $_REQUEST['service']; |
13 | 13 | |
14 | -if(isset($service)) |
|
14 | +if (isset($service)) |
|
15 | 15 | { |
16 | - if(!in_array($service,$enabledServices)){ |
|
17 | - die($service.' - Service is not active'); |
|
16 | + if (!in_array($service, $enabledServices)) { |
|
17 | + die($service . ' - Service is not active'); |
|
18 | 18 | } |
19 | - if($service == "customerportal") |
|
19 | + if ($service == "customerportal") |
|
20 | 20 | { |
21 | 21 | include("api/customerportal.php"); |
22 | 22 | } |
23 | - elseif($service == "mobile") |
|
23 | + elseif ($service == "mobile") |
|
24 | 24 | { |
25 | 25 | include("api/mobile.php"); |
26 | 26 | } |
27 | - elseif($service == "yetiportal") |
|
27 | + elseif ($service == "yetiportal") |
|
28 | 28 | { |
29 | 29 | include("api/yetiportal.php"); |
30 | 30 | } |
31 | - elseif($service == "firefox") |
|
31 | + elseif ($service == "firefox") |
|
32 | 32 | { |
33 | 33 | include("api/firefoxtoolbar.php"); |
34 | 34 | } |
35 | - elseif($service == "wordplugin") |
|
35 | + elseif ($service == "wordplugin") |
|
36 | 36 | { |
37 | 37 | include("api/wordplugin.php"); |
38 | 38 | } |
39 | - elseif($service == "thunderbird") |
|
39 | + elseif ($service == "thunderbird") |
|
40 | 40 | { |
41 | 41 | include("api/thunderbirdplugin.php"); |
42 | 42 | } |
43 | 43 | else |
44 | 44 | { |
45 | - echo "No Service Configured for ". strip_tags($service); |
|
45 | + echo "No Service Configured for " . strip_tags($service); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | else |
@@ -19,33 +19,26 @@ |
||
19 | 19 | if($service == "customerportal") |
20 | 20 | { |
21 | 21 | include("api/customerportal.php"); |
22 | - } |
|
23 | - elseif($service == "mobile") |
|
22 | + } elseif($service == "mobile") |
|
24 | 23 | { |
25 | 24 | include("api/mobile.php"); |
26 | - } |
|
27 | - elseif($service == "yetiportal") |
|
25 | + } elseif($service == "yetiportal") |
|
28 | 26 | { |
29 | 27 | include("api/yetiportal.php"); |
30 | - } |
|
31 | - elseif($service == "firefox") |
|
28 | + } elseif($service == "firefox") |
|
32 | 29 | { |
33 | 30 | include("api/firefoxtoolbar.php"); |
34 | - } |
|
35 | - elseif($service == "wordplugin") |
|
31 | + } elseif($service == "wordplugin") |
|
36 | 32 | { |
37 | 33 | include("api/wordplugin.php"); |
38 | - } |
|
39 | - elseif($service == "thunderbird") |
|
34 | + } elseif($service == "thunderbird") |
|
40 | 35 | { |
41 | 36 | include("api/thunderbirdplugin.php"); |
42 | - } |
|
43 | - else |
|
37 | + } else |
|
44 | 38 | { |
45 | 39 | echo "No Service Configured for ". strip_tags($service); |
46 | 40 | } |
47 | -} |
|
48 | -else |
|
41 | +} else |
|
49 | 42 | { |
50 | 43 | echo "<h1>YetiForceCRM API Services</h1>"; |
51 | 44 | echo "<li>YetiForceCRM Yeti Portal EndPoint URL -- Click <a href='api.php?service=yetiportal'>here</a></li>"; |
@@ -16,10 +16,11 @@ discard block |
||
16 | 16 | { |
17 | 17 | $entity = false; |
18 | 18 | if ($mixed) { |
19 | - if (is_numeric($mixed)) |
|
20 | - $entity = isset(self::$moduleEntityCacheById[$mixed]) ? self::$moduleEntityCacheById[$mixed] : false; |
|
21 | - else |
|
22 | - $entity = isset(self::$moduleEntityCacheByName[$mixed]) ? self::$moduleEntityCacheByName[$mixed] : false; |
|
19 | + if (is_numeric($mixed)) { |
|
20 | + $entity = isset(self::$moduleEntityCacheById[$mixed]) ? self::$moduleEntityCacheById[$mixed] : false; |
|
21 | + } else { |
|
22 | + $entity = isset(self::$moduleEntityCacheByName[$mixed]) ? self::$moduleEntityCacheByName[$mixed] : false; |
|
23 | + } |
|
23 | 24 | } |
24 | 25 | if (!$entity) { |
25 | 26 | $adb = \PearDatabase::getInstance(); |
@@ -31,10 +32,11 @@ discard block |
||
31 | 32 | self::$moduleEntityCacheById[$row['tabid']] = $row; |
32 | 33 | } |
33 | 34 | if ($mixed) { |
34 | - if (is_numeric($mixed)) |
|
35 | - return self::$moduleEntityCacheById[$mixed]; |
|
36 | - else |
|
37 | - return self::$moduleEntityCacheByName[$mixed]; |
|
35 | + if (is_numeric($mixed)) { |
|
36 | + return self::$moduleEntityCacheById[$mixed]; |
|
37 | + } else { |
|
38 | + return self::$moduleEntityCacheByName[$mixed]; |
|
39 | + } |
|
38 | 40 | } |
39 | 41 | } |
40 | 42 | return $entity; |
@@ -31,6 +31,9 @@ |
||
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) { |
@@ -464,8 +464,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -127,6 +127,9 @@ discard block |
||
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 |
||
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 |
||
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); |
@@ -296,6 +310,9 @@ discard block |
||
296 | 310 | return $result->columnCount(); |
297 | 311 | } |
298 | 312 | |
313 | + /** |
|
314 | + * @return string |
|
315 | + */ |
|
299 | 316 | public function fetch_array(&$result) |
300 | 317 | { |
301 | 318 | return $result->fetch(PDO::FETCH_ASSOC); |
@@ -495,6 +512,9 @@ discard block |
||
495 | 512 | return $this->stmt->rowCount(); |
496 | 513 | } |
497 | 514 | |
515 | + /** |
|
516 | + * @param integer $row |
|
517 | + */ |
|
498 | 518 | public function query_result(&$result, $row, $col = 0) |
499 | 519 | { |
500 | 520 | return to_html($this->query_result_raw($result, $row, $col)); |
@@ -667,6 +687,9 @@ discard block |
||
667 | 687 | return $id; |
668 | 688 | } |
669 | 689 | |
690 | + /** |
|
691 | + * @param string $tableName |
|
692 | + */ |
|
670 | 693 | public function checkExistTable($tableName, $cache = true) |
671 | 694 | { |
672 | 695 | $tablePresent = Vtiger_Cache::get('checkExistTable', $tableName); |
@@ -695,6 +718,9 @@ discard block |
||
695 | 718 | return $lastInsertID; |
696 | 719 | } |
697 | 720 | |
721 | + /** |
|
722 | + * @param string $datetime |
|
723 | + */ |
|
698 | 724 | public function formatDate($datetime, $strip_quotes = false) |
699 | 725 | { |
700 | 726 | /* remove single quotes to use the date as parameter for Prepared statement */ |
@@ -785,6 +811,9 @@ discard block |
||
785 | 811 | return ' ( ' . $l . ' ) '; |
786 | 812 | } |
787 | 813 | |
814 | + /** |
|
815 | + * @param PDOStatement $result |
|
816 | + */ |
|
788 | 817 | public function getAffectedRowCount(&$result) |
789 | 818 | { |
790 | 819 | $rows = $result->rowCount(); |
@@ -854,6 +883,9 @@ discard block |
||
854 | 883 | protected $logSqlTimeID = false; |
855 | 884 | protected $logSqlTimeGroup = 1; |
856 | 885 | |
886 | + /** |
|
887 | + * @param double $endat |
|
888 | + */ |
|
857 | 889 | public function logSqlTime($startat, $endat, $sql, $params = false) |
858 | 890 | { |
859 | 891 | if (!AppConfig::performance('SQL_LOG_INCLUDE_CALLER')) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $x = ""; |
57 | 57 | for ($j = 0; $j < count($val); $j++) { |
58 | 58 | if ($j != $n) { |
59 | - $x .=" " . $val[$j]; |
|
59 | + $x .= " " . $val[$j]; |
|
60 | 60 | } else { |
61 | 61 | $x .= "@#" . $val[$j]; |
62 | 62 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $x = ""; |
241 | 241 | for ($j = 0; $j < count($val); $j++) { |
242 | 242 | if ($j != $n) { |
243 | - $x .=" " . $val[$j]; |
|
243 | + $x .= " " . $val[$j]; |
|
244 | 244 | } else { |
245 | 245 | $x .= "@#" . $val[$j]; |
246 | 246 | } |
@@ -32,14 +32,18 @@ discard block |
||
32 | 32 | } else { |
33 | 33 | $cache_file_name = $cachedFileName; |
34 | 34 | } |
35 | - if (empty($width)) |
|
36 | - $width = '400'; |
|
37 | - if (empty($height)) |
|
38 | - $height = '300'; |
|
39 | - if ($target === false) |
|
40 | - $target = []; |
|
41 | - if (empty($color)) |
|
42 | - $color = 'black'; |
|
35 | + if (empty($width)) { |
|
36 | + $width = '400'; |
|
37 | + } |
|
38 | + if (empty($height)) { |
|
39 | + $height = '300'; |
|
40 | + } |
|
41 | + if ($target === false) { |
|
42 | + $target = []; |
|
43 | + } |
|
44 | + if (empty($color)) { |
|
45 | + $color = 'black'; |
|
46 | + } |
|
43 | 47 | |
44 | 48 | $alts = []; |
45 | 49 | $temp = []; |
@@ -48,8 +52,9 @@ discard block |
||
48 | 52 | $pos = substr_count($name, " "); |
49 | 53 | $alts[] = $name; |
50 | 54 | //If the daatx value of a string is greater, adding '\n' to it so that it'll cme inh 2nd line |
51 | - if (strlen($name) >= 14) |
|
52 | - $name = substr($name, 0, 44); |
|
55 | + if (strlen($name) >= 14) { |
|
56 | + $name = substr($name, 0, 44); |
|
57 | + } |
|
53 | 58 | if ($pos >= 2) { |
54 | 59 | $val = explode(" ", $name); |
55 | 60 | $n = count($val) - 1; |
@@ -102,8 +107,9 @@ discard block |
||
102 | 107 | |
103 | 108 | for ($i = 0; $i < count($yaxisData); $i++) { |
104 | 109 | $x = 1 + $i; |
105 | - if ($yaxisData[$i] >= $max) |
|
106 | - $max = $yaxisData[$i]; |
|
110 | + if ($yaxisData[$i] >= $max) { |
|
111 | + $max = $yaxisData[$i]; |
|
112 | + } |
|
107 | 113 | $dataset->addPoint( |
108 | 114 | $x, $yaxisData[$i], array( |
109 | 115 | 'url' => $target[$i], |
@@ -125,8 +131,9 @@ discard block |
||
125 | 131 | $bplot->setFillStyle($fill); |
126 | 132 | |
127 | 133 | //You can change the width of the bars if you like |
128 | - if (!empty($xaxisData)) |
|
129 | - $bplot->setBarWidth($barwidth / count($xaxisData), "%"); |
|
134 | + if (!empty($xaxisData)) { |
|
135 | + $bplot->setBarWidth($barwidth / count($xaxisData), "%"); |
|
136 | + } |
|
130 | 137 | $bplot->setBackground(Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_HORIZONTAL, 'white', 'white'))); |
131 | 138 | $xaxis = & $plotarea->getAxis(IMAGE_GRAPH_AXIS_X); |
132 | 139 | $yaxis = & $plotarea->getAxis(IMAGE_GRAPH_AXIS_Y); |
@@ -150,8 +157,9 @@ discard block |
||
150 | 157 | $ticks = get_tickspacing(round(($max * 1.1) + 0.5)); |
151 | 158 | |
152 | 159 | // First make the labels look right |
153 | - if ($charttype == 'horizontal') |
|
154 | - $yaxis->setFontAngle('vertical'); |
|
160 | + if ($charttype == 'horizontal') { |
|
161 | + $yaxis->setFontAngle('vertical'); |
|
162 | + } |
|
155 | 163 | $yaxis->setLabelInterval($ticks[0]); |
156 | 164 | $yaxis->setTickOptions(-5, 0); |
157 | 165 | $yaxis->setLabelInterval($ticks[1], 2); |
@@ -165,8 +173,9 @@ discard block |
||
165 | 173 | $xaxis->setDataPreprocessor($array_data); |
166 | 174 | $xaxis->forceMinimum(0.5); |
167 | 175 | $xaxis->forceMaximum(0.5 + count($yaxisData)); |
168 | - if ($charttype == 'vertical') |
|
169 | - $xaxis->setFontAngle('vertical'); |
|
176 | + if ($charttype == 'vertical') { |
|
177 | + $xaxis->setFontAngle('vertical'); |
|
178 | + } |
|
170 | 179 | $xaxis->setLabelInterval(1); |
171 | 180 | $xaxis->setTickOptions(0, 0); |
172 | 181 | $xaxis->setLabelInterval(2, 2); |
@@ -218,12 +227,15 @@ discard block |
||
218 | 227 | $cache_file_name = $cachedFileName; |
219 | 228 | } |
220 | 229 | |
221 | - if (empty($width)) |
|
222 | - $width = '500'; |
|
223 | - if (empty($height)) |
|
224 | - $height = '400'; |
|
225 | - if ($target === false) |
|
226 | - $target = []; |
|
230 | + if (empty($width)) { |
|
231 | + $width = '500'; |
|
232 | + } |
|
233 | + if (empty($height)) { |
|
234 | + $height = '400'; |
|
235 | + } |
|
236 | + if ($target === false) { |
|
237 | + $target = []; |
|
238 | + } |
|
227 | 239 | |
228 | 240 | $alts = []; |
229 | 241 | $temp = []; |
@@ -232,8 +244,9 @@ discard block |
||
232 | 244 | $pos = substr_count($name, " "); |
233 | 245 | $alts[] = $name; |
234 | 246 | //If the datax value of a string is greater, adding '\n' to it so that it'll come in 2nd line |
235 | - if (strlen($name) >= 14) |
|
236 | - $name = substr($name, 0, 34); |
|
247 | + if (strlen($name) >= 14) { |
|
248 | + $name = substr($name, 0, 34); |
|
249 | + } |
|
237 | 250 | if ($pos >= 2) { |
238 | 251 | $val = explode(" ", $name); |
239 | 252 | $n = count($val) - 1; |
@@ -297,8 +310,9 @@ discard block |
||
297 | 310 | $pcvalues[$yaxisData[$i]] = sprintf('%0.1f%%', 100 * $yaxisData[$i] / $sum); |
298 | 311 | $fills->addColor($colors[$i]); |
299 | 312 | } |
300 | - if ($sum == 0) |
|
301 | - return null; |
|
313 | + if ($sum == 0) { |
|
314 | + return null; |
|
315 | + } |
|
302 | 316 | // create the pie chart and associate the filling colours |
303 | 317 | $gbplot = & $plotarea->addNew('pie', $dataset); |
304 | 318 | $plotarea->setPadding(array('top' => 0, 'bottom' => 0, 'left' => 0, 'right' => ($width / 20))); |
@@ -361,8 +375,9 @@ discard block |
||
361 | 375 | $restrictedModules = false; |
362 | 376 | foreach ($reportModules as $mod) { |
363 | 377 | if (isPermitted($mod, 'index') != 'yes' || \includes\Modules::isModuleActive($mod) == false) { |
364 | - if (!is_array($restrictedModules)) |
|
365 | - $restrictedModules = []; |
|
378 | + if (!is_array($restrictedModules)) { |
|
379 | + $restrictedModules = []; |
|
380 | + } |
|
366 | 381 | $restrictedModules[] = $mod; |
367 | 382 | } |
368 | 383 | } |
@@ -409,12 +424,12 @@ discard block |
||
409 | 424 | $groupFieldValue = $valueComp[1]; |
410 | 425 | } |
411 | 426 | if ($dateField) { |
412 | - if (!empty($groupFieldValue)) |
|
413 | - $groupByFields[] = CustomReportUtils::getXAxisDateFieldValue($groupFieldValue, $criteria); |
|
414 | - else |
|
415 | - $groupByFields[] = "Null"; |
|
416 | - } |
|
417 | - else if (in_array($fieldname, array_keys($referenceFields))) { |
|
427 | + if (!empty($groupFieldValue)) { |
|
428 | + $groupByFields[] = CustomReportUtils::getXAxisDateFieldValue($groupFieldValue, $criteria); |
|
429 | + } else { |
|
430 | + $groupByFields[] = "Null"; |
|
431 | + } |
|
432 | + } else if (in_array($fieldname, array_keys($referenceFields))) { |
|
418 | 433 | if (count($referenceFields[$fieldname]) > 1) { |
419 | 434 | $refenceModule = CustomReportUtils::getEntityTypeFromName($decodedGroupFieldValue, $referenceFields[$fieldname]); |
420 | 435 | } else { |
@@ -443,10 +458,10 @@ discard block |
||
443 | 458 | $advanceSearchCondition = CustomReportUtils::getAdvanceSearchCondition($fieldDetails, $criteria, $groupFieldValue); |
444 | 459 | if ($module == 'Calendar') { |
445 | 460 | $link_val = "index.php?module=" . $module . "&query=true&action=ListView&" . $advanceSearchCondition; |
446 | - } else |
|
447 | - $link_val = "index.php?module=" . $module . "&query=true&action=index&" . $advanceSearchCondition; |
|
448 | - } |
|
449 | - else { |
|
461 | + } else { |
|
462 | + $link_val = "index.php?module=" . $module . "&query=true&action=index&" . $advanceSearchCondition; |
|
463 | + } |
|
464 | + } else { |
|
450 | 465 | $cvid = \vtlib\Deprecated::getIdOfCustomViewByNameAll($module); |
451 | 466 | $esc_search_str = urlencode($decodedGroupFieldValue); |
452 | 467 | if ($single == 'DT') { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $moduleTableIndexList = $meta->getEntityTableIndexList(); |
121 | 121 | foreach ($tableList as $index => $tableName) { |
122 | 122 | if ($tableName != $tableList[0]) { |
123 | - $sql .=' INNER JOIN ' . $tableName . ' ON ' . $tableList[0] . '.' . |
|
123 | + $sql .= ' INNER JOIN ' . $tableName . ' ON ' . $tableList[0] . '.' . |
|
124 | 124 | $moduleTableIndexList[$tableList[0]] . '=' . $tableName . '.' . |
125 | 125 | $moduleTableIndexList[$tableName]; |
126 | 126 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | //If module is Leads and if you are not selected any leads fields then query failure is happening. |
129 | 129 | //By default we are checking where condition on base table. |
130 | 130 | if ($module == 'Leads' && !in_array('vtiger_leaddetails', $tableList)) { |
131 | - $sql .=' INNER JOIN vtiger_leaddetails ON vtiger_leaddetails.leadid = vtiger_crmentity.crmid'; |
|
131 | + $sql .= ' INNER JOIN vtiger_leaddetails ON vtiger_leaddetails.leadid = vtiger_crmentity.crmid'; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | $sql .= ' WHERE'; |
@@ -209,8 +209,9 @@ discard block |
||
209 | 209 | $needle = '$' . strtolower($this->module) . '-' . $parentFieldColumnMapping[$params['field']] . ':' . $column . '$'; |
210 | 210 | $this->processedDescription = str_replace($needle, $values[array_search($column, $fieldColumnMapping)], $this->processedDescription); |
211 | 211 | } |
212 | - if (!$params['owner']) |
|
213 | - $this->processedmodules[$module] = true; |
|
212 | + if (!$params['owner']) { |
|
213 | + $this->processedmodules[$module] = true; |
|
214 | + } |
|
214 | 215 | } |
215 | 216 | } |
216 | 217 | } |
@@ -253,7 +254,8 @@ discard block |
||
253 | 254 | $rows = $adb->num_rows($res); |
254 | 255 | if ($rows > 0) { |
255 | 256 | return true; |
256 | - } else |
|
257 | - return false; |
|
257 | + } else { |
|
258 | + return false; |
|
259 | + } |
|
258 | 260 | } |
259 | 261 | } |
@@ -37,8 +37,9 @@ discard block |
||
37 | 37 | |
38 | 38 | public function setConfig($key, $value) |
39 | 39 | { |
40 | - if (empty($key)) |
|
41 | - return; |
|
40 | + if (empty($key)) { |
|
41 | + return; |
|
42 | + } |
|
42 | 43 | $this->properties[$key] = $value; |
43 | 44 | //not neccessary for php5.x versions |
44 | 45 | self::$propertiesCache[$this->name] = $this->properties; |
@@ -46,8 +47,9 @@ discard block |
||
46 | 47 | |
47 | 48 | public function getConfig($key) |
48 | 49 | { |
49 | - if (empty($key)) |
|
50 | - return ''; |
|
50 | + if (empty($key)) { |
|
51 | + return ''; |
|
52 | + } |
|
51 | 53 | return $this->properties[$key]; |
52 | 54 | } |
53 | 55 | } |
@@ -15,6 +15,10 @@ discard block |
||
15 | 15 | protected $name; |
16 | 16 | static $propertiesCache = []; |
17 | 17 | |
18 | + /** |
|
19 | + * @param string $path |
|
20 | + * @param string $name |
|
21 | + */ |
|
18 | 22 | public function __construct($path, $name, $force = false) |
19 | 23 | { |
20 | 24 | $this->load($path, $name, $force); |
@@ -41,6 +45,9 @@ discard block |
||
41 | 45 | self::$propertiesCache[$this->name] = $this->properties; |
42 | 46 | } |
43 | 47 | |
48 | + /** |
|
49 | + * @param string $key |
|
50 | + */ |
|
44 | 51 | public function getConfig($key) |
45 | 52 | { |
46 | 53 | if (empty($key)) |