@@ -28,6 +28,7 @@ |
||
28 | 28 | /** |
29 | 29 | * Initialize Import |
30 | 30 | * @access private |
31 | + * @param boolean $overwrite |
|
31 | 32 | */ |
32 | 33 | public function initImport($zipfile, $overwrite) |
33 | 34 | { |
@@ -23,6 +23,9 @@ |
||
23 | 23 | protected $user; |
24 | 24 | protected $module; |
25 | 25 | |
26 | + /** |
|
27 | + * @param Link $link |
|
28 | + */ |
|
26 | 29 | public function __construct($link, $user, $input = null) |
27 | 30 | { |
28 | 31 | $this->link = $link; |
@@ -53,6 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Get type of package (as specified in manifest) |
56 | + * @return string |
|
56 | 57 | */ |
57 | 58 | public function type() |
58 | 59 | { |
@@ -393,6 +394,7 @@ discard block |
||
393 | 394 | /** |
394 | 395 | * Cache the field instance for re-use |
395 | 396 | * @access private |
397 | + * @param Field $fieldInstance |
|
396 | 398 | */ |
397 | 399 | public function __AddModuleFieldToCache($moduleInstance, $fieldname, $fieldInstance) |
398 | 400 | { |
@@ -674,6 +676,8 @@ discard block |
||
674 | 676 | /** |
675 | 677 | * Import Blocks of the module |
676 | 678 | * @access private |
679 | + * @param \SimpleXMLElement $modulenode |
|
680 | + * @param Module $moduleInstance |
|
677 | 681 | */ |
678 | 682 | public function import_Blocks($modulenode, $moduleInstance) |
679 | 683 | { |
@@ -717,6 +721,7 @@ discard block |
||
717 | 721 | /** |
718 | 722 | * Import Fields of the module |
719 | 723 | * @access private |
724 | + * @param Block $blockInstance |
|
720 | 725 | */ |
721 | 726 | public function import_Fields($blocknode, $blockInstance, $moduleInstance) |
722 | 727 | { |
@@ -807,6 +812,8 @@ discard block |
||
807 | 812 | /** |
808 | 813 | * Import Custom views of the module |
809 | 814 | * @access private |
815 | + * @param \SimpleXMLElement $modulenode |
|
816 | + * @param Module $moduleInstance |
|
810 | 817 | */ |
811 | 818 | public function import_CustomViews($modulenode, $moduleInstance) |
812 | 819 | { |
@@ -851,6 +858,8 @@ discard block |
||
851 | 858 | /** |
852 | 859 | * Import Sharing Access of the module |
853 | 860 | * @access private |
861 | + * @param \SimpleXMLElement $modulenode |
|
862 | + * @param Module $moduleInstance |
|
854 | 863 | */ |
855 | 864 | public function import_SharingAccess($modulenode, $moduleInstance) |
856 | 865 | { |
@@ -867,6 +876,8 @@ discard block |
||
867 | 876 | /** |
868 | 877 | * Import Events of the module |
869 | 878 | * @access private |
879 | + * @param \SimpleXMLElement $modulenode |
|
880 | + * @param Module $moduleInstance |
|
870 | 881 | */ |
871 | 882 | public function import_Events($modulenode, $moduleInstance) |
872 | 883 | { |
@@ -899,6 +910,8 @@ discard block |
||
899 | 910 | /** |
900 | 911 | * Import actions of the module |
901 | 912 | * @access private |
913 | + * @param \SimpleXMLElement $modulenode |
|
914 | + * @param Module $moduleInstance |
|
902 | 915 | */ |
903 | 916 | public function import_Actions($modulenode, $moduleInstance) |
904 | 917 | { |
@@ -925,6 +938,8 @@ discard block |
||
925 | 938 | /** |
926 | 939 | * Import related lists of the module |
927 | 940 | * @access private |
941 | + * @param \SimpleXMLElement $modulenode |
|
942 | + * @param Module $moduleInstance |
|
928 | 943 | */ |
929 | 944 | public function import_RelatedLists($modulenode, $moduleInstance) |
930 | 945 | { |
@@ -1004,6 +1019,7 @@ discard block |
||
1004 | 1019 | /** |
1005 | 1020 | * Import cron jobs of the module. |
1006 | 1021 | * @access private |
1022 | + * @param \SimpleXMLElement $modulenode |
|
1007 | 1023 | */ |
1008 | 1024 | public function import_CronTasks($modulenode) |
1009 | 1025 | { |
@@ -1022,6 +1038,9 @@ discard block |
||
1022 | 1038 | } |
1023 | 1039 | } |
1024 | 1040 | |
1041 | + /** |
|
1042 | + * @param \SimpleXMLElement $modulenode |
|
1043 | + */ |
|
1025 | 1044 | public function import_update($modulenode) |
1026 | 1045 | { |
1027 | 1046 | $dirName = 'cache/updates'; |
@@ -98,8 +98,9 @@ discard block |
||
98 | 98 | { |
99 | 99 | $xpathres = $this->xpath($path); |
100 | 100 | foreach ($xpathres as $pathkey => $pathvalue) { |
101 | - if ($pathkey == $path) |
|
102 | - return $pathvalue; |
|
101 | + if ($pathkey == $path) { |
|
102 | + return $pathvalue; |
|
103 | + } |
|
103 | 104 | } |
104 | 105 | return false; |
105 | 106 | } |
@@ -118,13 +119,15 @@ discard block |
||
118 | 119 | |
119 | 120 | if ($packagetype) { |
120 | 121 | $lcasetype = strtolower($packagetype); |
121 | - if ($lcasetype == 'language') |
|
122 | - return true; |
|
122 | + if ($lcasetype == 'language') { |
|
123 | + return true; |
|
124 | + } |
|
123 | 125 | } |
124 | 126 | if ($packagetype) { |
125 | 127 | $lcasetype = strtolower($packagetype); |
126 | - if ($lcasetype == 'layout') |
|
127 | - return true; |
|
128 | + if ($lcasetype == 'layout') { |
|
129 | + return true; |
|
130 | + } |
|
128 | 131 | } |
129 | 132 | return false; |
130 | 133 | } |
@@ -143,8 +146,9 @@ discard block |
||
143 | 146 | |
144 | 147 | if ($packagetype) { |
145 | 148 | $lcasetype = strtolower($packagetype); |
146 | - if ($lcasetype === 'extension') |
|
147 | - return true; |
|
149 | + if ($lcasetype === 'extension') { |
|
150 | + return true; |
|
151 | + } |
|
148 | 152 | } |
149 | 153 | return false; |
150 | 154 | } |
@@ -160,8 +164,9 @@ discard block |
||
160 | 164 | |
161 | 165 | if ($packagetype) { |
162 | 166 | $lcasetype = strtolower($packagetype); |
163 | - if ($lcasetype === 'update') |
|
164 | - return true; |
|
167 | + if ($lcasetype === 'update') { |
|
168 | + return true; |
|
169 | + } |
|
165 | 170 | } |
166 | 171 | return false; |
167 | 172 | } |
@@ -180,8 +185,9 @@ discard block |
||
180 | 185 | |
181 | 186 | if ($packagetype) { |
182 | 187 | $lcasetype = strtolower($packagetype); |
183 | - if ($lcasetype === 'layout') |
|
184 | - return true; |
|
188 | + if ($lcasetype === 'layout') { |
|
189 | + return true; |
|
190 | + } |
|
185 | 191 | } |
186 | 192 | return false; |
187 | 193 | } |
@@ -224,8 +230,9 @@ discard block |
||
224 | 230 | public function getParameters() |
225 | 231 | { |
226 | 232 | $parameters = []; |
227 | - if (empty($this->_modulexml->parameters)) |
|
228 | - return $parameters; |
|
233 | + if (empty($this->_modulexml->parameters)) { |
|
234 | + return $parameters; |
|
235 | + } |
|
229 | 236 | foreach ($this->_modulexml->parameters->parameter as $parameter) { |
230 | 237 | $parameters[] = $parameter; |
231 | 238 | } |
@@ -333,17 +340,21 @@ discard block |
||
333 | 340 | } |
334 | 341 | |
335 | 342 | $validzip = false; |
336 | - if ($manifestxml_found && $languagefile_found && $moduleVersionFound) |
|
337 | - $validzip = true; |
|
343 | + if ($manifestxml_found && $languagefile_found && $moduleVersionFound) { |
|
344 | + $validzip = true; |
|
345 | + } |
|
338 | 346 | |
339 | - if ($manifestxml_found && $layoutfile_found && $moduleVersionFound) |
|
340 | - $validzip = true; |
|
347 | + if ($manifestxml_found && $layoutfile_found && $moduleVersionFound) { |
|
348 | + $validzip = true; |
|
349 | + } |
|
341 | 350 | |
342 | - if ($manifestxml_found && $languagefile_found && $extensionfile_found && $moduleVersionFound) |
|
343 | - $validzip = true; |
|
351 | + if ($manifestxml_found && $languagefile_found && $extensionfile_found && $moduleVersionFound) { |
|
352 | + $validzip = true; |
|
353 | + } |
|
344 | 354 | |
345 | - if ($manifestxml_found && $updatefile_found && $moduleVersionFound) |
|
346 | - $validzip = true; |
|
355 | + if ($manifestxml_found && $updatefile_found && $moduleVersionFound) { |
|
356 | + $validzip = true; |
|
357 | + } |
|
347 | 358 | |
348 | 359 | if ($validzip) { |
349 | 360 | if (!empty($this->_modulexml->license)) { |
@@ -371,8 +382,9 @@ discard block |
||
371 | 382 | */ |
372 | 383 | public function getModuleNameFromZip($zipfile) |
373 | 384 | { |
374 | - if (!$this->checkZip($zipfile)) |
|
375 | - return null; |
|
385 | + if (!$this->checkZip($zipfile)) { |
|
386 | + return null; |
|
387 | + } |
|
376 | 388 | return (string) $this->_modulexml->name; |
377 | 389 | } |
378 | 390 | |
@@ -619,8 +631,9 @@ discard block |
||
619 | 631 | */ |
620 | 632 | public function import_Tables($modulenode) |
621 | 633 | { |
622 | - if (empty($modulenode->tables) || empty($modulenode->tables->table)) |
|
623 | - return; |
|
634 | + if (empty($modulenode->tables) || empty($modulenode->tables->table)) { |
|
635 | + return; |
|
636 | + } |
|
624 | 637 | $adb = \PearDatabase::getInstance(); |
625 | 638 | $adb->query('SET FOREIGN_KEY_CHECKS = 0;'); |
626 | 639 | |
@@ -654,8 +667,9 @@ discard block |
||
654 | 667 | */ |
655 | 668 | public function import_Blocks($modulenode, $moduleInstance) |
656 | 669 | { |
657 | - if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) |
|
658 | - return; |
|
670 | + if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) { |
|
671 | + return; |
|
672 | + } |
|
659 | 673 | foreach ($modulenode->blocks->block as $blocknode) { |
660 | 674 | $blockInstance = $this->import_Block($modulenode, $moduleInstance, $blocknode); |
661 | 675 | $this->import_Fields($blocknode, $blockInstance, $moduleInstance); |
@@ -674,8 +688,9 @@ discard block |
||
674 | 688 | $blockInstance->label = $blocklabel; |
675 | 689 | if (isset($blocknode->sequence) && isset($blocknode->display_status)) { |
676 | 690 | $blockInstance->sequence = strval($blocknode->sequence); |
677 | - if ($blockInstance->sequence = "") |
|
678 | - $blockInstance->sequence = NULL; |
|
691 | + if ($blockInstance->sequence = "") { |
|
692 | + $blockInstance->sequence = NULL; |
|
693 | + } |
|
679 | 694 | $blockInstance->showtitle = strval($blocknode->show_title); |
680 | 695 | $blockInstance->visible = strval($blocknode->visible); |
681 | 696 | $blockInstance->increateview = strval($blocknode->create_view); |
@@ -697,8 +712,9 @@ discard block |
||
697 | 712 | */ |
698 | 713 | public function import_Fields($blocknode, $blockInstance, $moduleInstance) |
699 | 714 | { |
700 | - if (empty($blocknode->fields) || empty($blocknode->fields->field)) |
|
701 | - return; |
|
715 | + if (empty($blocknode->fields) || empty($blocknode->fields->field)) { |
|
716 | + return; |
|
717 | + } |
|
702 | 718 | |
703 | 719 | foreach ($blocknode->fields->field as $fieldnode) { |
704 | 720 | $this->import_Field($blocknode, $blockInstance, $moduleInstance, $fieldnode); |
@@ -729,17 +745,21 @@ discard block |
||
729 | 745 | $fieldInstance->displaytype = $fieldnode->displaytype; |
730 | 746 | $fieldInstance->info_type = $fieldnode->info_type; |
731 | 747 | |
732 | - if (!empty($fieldnode->fieldparams)) |
|
733 | - $fieldInstance->fieldparams = $fieldnode->fieldparams; |
|
748 | + if (!empty($fieldnode->fieldparams)) { |
|
749 | + $fieldInstance->fieldparams = $fieldnode->fieldparams; |
|
750 | + } |
|
734 | 751 | |
735 | - if (!empty($fieldnode->helpinfo)) |
|
736 | - $fieldInstance->helpinfo = $fieldnode->helpinfo; |
|
752 | + if (!empty($fieldnode->helpinfo)) { |
|
753 | + $fieldInstance->helpinfo = $fieldnode->helpinfo; |
|
754 | + } |
|
737 | 755 | |
738 | - if (isset($fieldnode->masseditable)) |
|
739 | - $fieldInstance->masseditable = $fieldnode->masseditable; |
|
756 | + if (isset($fieldnode->masseditable)) { |
|
757 | + $fieldInstance->masseditable = $fieldnode->masseditable; |
|
758 | + } |
|
740 | 759 | |
741 | - if (isset($fieldnode->columntype) && !empty($fieldnode->columntype)) |
|
742 | - $fieldInstance->columntype = strval($fieldnode->columntype); |
|
760 | + if (isset($fieldnode->columntype) && !empty($fieldnode->columntype)) { |
|
761 | + $fieldInstance->columntype = strval($fieldnode->columntype); |
|
762 | + } |
|
743 | 763 | |
744 | 764 | if (!empty($fieldnode->tree_template)) { |
745 | 765 | $templateid = $fieldInstance->setTreeTemplate($fieldnode->tree_template, $moduleInstance); |
@@ -787,8 +807,9 @@ discard block |
||
787 | 807 | */ |
788 | 808 | public function import_CustomViews($modulenode, $moduleInstance) |
789 | 809 | { |
790 | - if (empty($modulenode->customviews) || empty($modulenode->customviews->customview)) |
|
791 | - return; |
|
810 | + if (empty($modulenode->customviews) || empty($modulenode->customviews->customview)) { |
|
811 | + return; |
|
812 | + } |
|
792 | 813 | foreach ($modulenode->customviews->customview as $customviewnode) { |
793 | 814 | $this->import_CustomView($modulenode, $moduleInstance, $customviewnode); |
794 | 815 | } |
@@ -831,8 +852,9 @@ discard block |
||
831 | 852 | */ |
832 | 853 | public function import_SharingAccess($modulenode, $moduleInstance) |
833 | 854 | { |
834 | - if (empty($modulenode->sharingaccess)) |
|
835 | - return; |
|
855 | + if (empty($modulenode->sharingaccess)) { |
|
856 | + return; |
|
857 | + } |
|
836 | 858 | |
837 | 859 | if (!empty($modulenode->sharingaccess->default)) { |
838 | 860 | foreach ($modulenode->sharingaccess->default as $defaultnode) { |
@@ -862,8 +884,9 @@ discard block |
||
862 | 884 | */ |
863 | 885 | public function import_Actions($modulenode, $moduleInstance) |
864 | 886 | { |
865 | - if (empty($modulenode->actions) || empty($modulenode->actions->action)) |
|
866 | - return; |
|
887 | + if (empty($modulenode->actions) || empty($modulenode->actions->action)) { |
|
888 | + return; |
|
889 | + } |
|
867 | 890 | foreach ($modulenode->actions->action as $actionnode) { |
868 | 891 | $this->import_Action($modulenode, $moduleInstance, $actionnode); |
869 | 892 | } |
@@ -945,8 +968,9 @@ discard block |
||
945 | 968 | */ |
946 | 969 | public function import_CustomLinks($modulenode, $moduleInstance) |
947 | 970 | { |
948 | - if (empty($modulenode->customlinks) || empty($modulenode->customlinks->customlink)) |
|
949 | - return; |
|
971 | + if (empty($modulenode->customlinks) || empty($modulenode->customlinks->customlink)) { |
|
972 | + return; |
|
973 | + } |
|
950 | 974 | |
951 | 975 | foreach ($modulenode->customlinks->customlink as $customlinknode) { |
952 | 976 | $handlerInfo = null; |
@@ -968,8 +992,9 @@ discard block |
||
968 | 992 | */ |
969 | 993 | public function import_CronTasks($modulenode) |
970 | 994 | { |
971 | - if (empty($modulenode->crons) || empty($modulenode->crons->cron)) |
|
972 | - return; |
|
995 | + if (empty($modulenode->crons) || empty($modulenode->crons->cron)) { |
|
996 | + return; |
|
997 | + } |
|
973 | 998 | foreach ($modulenode->crons->cron as $cronTask) { |
974 | 999 | if (empty($cronTask->status)) { |
975 | 1000 | $cronTask->status = Cron::$STATUS_DISABLED; |
@@ -1043,8 +1068,9 @@ discard block |
||
1043 | 1068 | */ |
1044 | 1069 | public function importInventory() |
1045 | 1070 | { |
1046 | - if (empty($this->_modulexml->inventory) || empty($this->_modulexml->inventory->fields->field)) |
|
1047 | - return false; |
|
1071 | + if (empty($this->_modulexml->inventory) || empty($this->_modulexml->inventory->fields->field)) { |
|
1072 | + return false; |
|
1073 | + } |
|
1048 | 1074 | $module = (string) $this->moduleInstance->name; |
1049 | 1075 | |
1050 | 1076 | $inventoryInstance = \Vtiger_Inventory_Model::getInstance($module); |
@@ -112,6 +112,7 @@ |
||
112 | 112 | /** |
113 | 113 | * Clean up the input to be used as a regex |
114 | 114 | * @access private |
115 | + * @param string $value |
|
115 | 116 | */ |
116 | 117 | public function __formatAsRegex($value) |
117 | 118 | { |
@@ -70,8 +70,9 @@ discard block |
||
70 | 70 | unset($this->tplvars); |
71 | 71 | |
72 | 72 | $this->tplvars = []; |
73 | - foreach ($restorevars as $key => $val) |
|
74 | - $this->assign($key, $val); |
|
73 | + foreach ($restorevars as $key => $val) { |
|
74 | + $this->assign($key, $val); |
|
75 | + } |
|
75 | 76 | } |
76 | 77 | |
77 | 78 | /** |
@@ -82,8 +83,9 @@ discard block |
||
82 | 83 | */ |
83 | 84 | public function merge($instring, $avoidLookup = false) |
84 | 85 | { |
85 | - if (empty($instring)) |
|
86 | - return $instring; |
|
86 | + if (empty($instring)) { |
|
87 | + return $instring; |
|
88 | + } |
|
87 | 89 | |
88 | 90 | if (!$avoidLookup) { |
89 | 91 |
@@ -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); |
@@ -124,8 +124,9 @@ |
||
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 | } |
@@ -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) |
@@ -232,10 +232,11 @@ discard block |
||
232 | 232 | $str = str_replace('_', '\_', $str); |
233 | 233 | if ($flag == 0) { |
234 | 234 | // If value what to search is null then we should not add % which will fail |
235 | - if (empty($str)) |
|
236 | - $str = '' . $str . ''; |
|
237 | - else |
|
238 | - $str = '%' . $str . '%'; |
|
235 | + if (empty($str)) { |
|
236 | + $str = '' . $str . ''; |
|
237 | + } else { |
|
238 | + $str = '%' . $str . '%'; |
|
239 | + } |
|
239 | 240 | } elseif ($flag == 1) { |
240 | 241 | $str = '%' . $str; |
241 | 242 | } elseif ($flag == 2) { |
@@ -267,8 +268,9 @@ discard block |
||
267 | 268 | |
268 | 269 | $ret_str .= " ifnull($tbl_name.$col_name,'null') = ifnull(temp.$col_name,'null')"; |
269 | 270 | |
270 | - if (count($field_array) != $i) |
|
271 | - $ret_str .= " and "; |
|
271 | + if (count($field_array) != $i) { |
|
272 | + $ret_str .= " and "; |
|
273 | + } |
|
272 | 274 | $i++; |
273 | 275 | } |
274 | 276 | return $ret_str; |
@@ -360,8 +362,9 @@ discard block |
||
360 | 362 | function relateEntities(CRMEntity $focus, $sourceModule, $sourceRecordId, $destinationModule, $destinationRecordIds, $relatedName = false) |
361 | 363 | { |
362 | 364 | \App\Log::trace("Entering relateEntities method ($sourceModule, $sourceRecordId, $destinationModule, $destinationRecordIds)"); |
363 | - if (!is_array($destinationRecordIds)) |
|
364 | - $destinationRecordIds = [$destinationRecordIds]; |
|
365 | + if (!is_array($destinationRecordIds)) { |
|
366 | + $destinationRecordIds = [$destinationRecordIds]; |
|
367 | + } |
|
365 | 368 | |
366 | 369 | $data = [ |
367 | 370 | 'CRMEntity' => $focus, |
@@ -404,20 +407,23 @@ discard block |
||
404 | 407 | $delim = array('/', '.'); |
405 | 408 | foreach ($delim as $delimiter) { |
406 | 409 | $x = strpos($value, $delimiter); |
407 | - if ($x === false) |
|
408 | - continue; |
|
409 | - else { |
|
410 | + if ($x === false) { |
|
411 | + continue; |
|
412 | + } else { |
|
410 | 413 | $value = str_replace($delimiter, '-', $value); |
411 | 414 | break; |
412 | 415 | } |
413 | 416 | } |
414 | 417 | list($y, $m, $d) = explode('-', $value); |
415 | - if (strlen($y) == 1) |
|
416 | - $y = '0' . $y; |
|
417 | - if (strlen($m) == 1) |
|
418 | - $m = '0' . $m; |
|
419 | - if (strlen($d) == 1) |
|
420 | - $d = '0' . $d; |
|
418 | + if (strlen($y) == 1) { |
|
419 | + $y = '0' . $y; |
|
420 | + } |
|
421 | + if (strlen($m) == 1) { |
|
422 | + $m = '0' . $m; |
|
423 | + } |
|
424 | + if (strlen($d) == 1) { |
|
425 | + $d = '0' . $d; |
|
426 | + } |
|
421 | 427 | $value = implode('-', array($y, $m, $d)); |
422 | 428 | |
423 | 429 | if (strlen($y) < 4) { |
@@ -197,6 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | /** |
199 | 199 | * Function to find the UI type of a field based on the uitype id |
200 | + * @param string $reqtype |
|
200 | 201 | */ |
201 | 202 | function is_uitype($uitype, $reqtype) |
202 | 203 | { |
@@ -322,6 +323,8 @@ discard block |
||
322 | 323 | /** |
323 | 324 | * This function returns no value but handles the delete functionality of each entity. |
324 | 325 | * Input Parameter are $module - module name, $return_module - return module name, $focus - module object, $record - entity id, $return_id - return entity id. |
326 | + * @param integer $destinationRecordId |
|
327 | + * @param integer $sourceRecordId |
|
325 | 328 | */ |
326 | 329 | function DeleteEntity($destinationModule, $sourceModule, CRMEntity $focus, $destinationRecordId, $sourceRecordId, $relatedName = false) |
327 | 330 | { |
@@ -481,6 +484,8 @@ discard block |
||
481 | 484 | |
482 | 485 | /** |
483 | 486 | * Function to get the approximate difference between two date time values as string |
487 | + * @param integer $d1 |
|
488 | + * @param integer $d2 |
|
484 | 489 | */ |
485 | 490 | function dateDiffAsString($d1, $d2) |
486 | 491 | { |
@@ -214,7 +214,7 @@ |
||
214 | 214 | if ($dir = @opendir($languageFolder)) { // open languages folder |
215 | 215 | while (($langName = readdir($dir)) !== false) { |
216 | 216 | if ($langName != '..' && $langName != '.' && is_dir($languageFolder . "/" . $langName)) { |
217 | - $langDir = @opendir($languageFolder . '/' . $langName); //open languages/en_us folder |
|
217 | + $langDir = @opendir($languageFolder . '/' . $langName); //open languages/en_us folder |
|
218 | 218 | while (($moduleLangFile = readdir($langDir)) !== false) { |
219 | 219 | $langFilePath = $languageFolder . '/' . $langName . '/' . $moduleLangFile; |
220 | 220 | if (is_file($langFilePath) && $moduleLangFile === $module . '.php') { //check if languages/en_us/module.php file exists |
@@ -78,6 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * Initialize Export |
80 | 80 | * @access private |
81 | + * @param boolean $module |
|
81 | 82 | */ |
82 | 83 | public function __initExport($module) |
83 | 84 | { |
@@ -204,7 +205,7 @@ discard block |
||
204 | 205 | |
205 | 206 | /** |
206 | 207 | * Function copies language files to zip |
207 | - * @param <vtlib\Zip> $zip |
|
208 | + * @param Zip $zip |
|
208 | 209 | * @param string $module |
209 | 210 | */ |
210 | 211 | public function __copyLanguageFiles($zip, $module) |
@@ -239,6 +240,7 @@ discard block |
||
239 | 240 | /** |
240 | 241 | * Export vtiger dependencies |
241 | 242 | * @access private |
243 | + * @param boolean $moduleInstance |
|
242 | 244 | */ |
243 | 245 | public function export_Dependencies($moduleInstance) |
244 | 246 | { |
@@ -367,6 +369,7 @@ discard block |
||
367 | 369 | /** |
368 | 370 | * Export module blocks with its related fields |
369 | 371 | * @access private |
372 | + * @param boolean $moduleInstance |
|
370 | 373 | */ |
371 | 374 | public function export_Blocks($moduleInstance) |
372 | 375 | { |
@@ -531,6 +534,7 @@ discard block |
||
531 | 534 | /** |
532 | 535 | * Export Custom views of the module |
533 | 536 | * @access private |
537 | + * @param boolean $moduleInstance |
|
534 | 538 | */ |
535 | 539 | public function export_CustomViews($moduleInstance) |
536 | 540 | { |
@@ -590,6 +594,7 @@ discard block |
||
590 | 594 | /** |
591 | 595 | * Export Sharing Access of the module |
592 | 596 | * @access private |
597 | + * @param boolean $moduleInstance |
|
593 | 598 | */ |
594 | 599 | public function export_SharingAccess($moduleInstance) |
595 | 600 | { |
@@ -621,6 +626,9 @@ discard block |
||
621 | 626 | $this->closeNode('sharingaccess'); |
622 | 627 | } |
623 | 628 | |
629 | + /** |
|
630 | + * @param boolean $moduleInstance |
|
631 | + */ |
|
624 | 632 | public function export_Actions($moduleInstance) |
625 | 633 | { |
626 | 634 | |
@@ -646,6 +654,7 @@ discard block |
||
646 | 654 | /** |
647 | 655 | * Export related lists associated with module. |
648 | 656 | * @access private |
657 | + * @param boolean $moduleInstance |
|
649 | 658 | */ |
650 | 659 | public function export_RelatedLists($moduleInstance) |
651 | 660 | { |
@@ -720,6 +729,7 @@ discard block |
||
720 | 729 | /** |
721 | 730 | * Export custom links of the module. |
722 | 731 | * @access private |
732 | + * @param boolean $moduleInstance |
|
723 | 733 | */ |
724 | 734 | public function export_CustomLinks($moduleInstance) |
725 | 735 | { |
@@ -745,6 +755,7 @@ discard block |
||
745 | 755 | /** |
746 | 756 | * Export cron tasks for the module. |
747 | 757 | * @access private |
758 | + * @param boolean $moduleInstance |
|
748 | 759 | */ |
749 | 760 | public function export_CronTasks($moduleInstance) |
750 | 761 | { |
@@ -48,11 +48,13 @@ discard block |
||
48 | 48 | /** @access private */ |
49 | 49 | public function outputNode($value, $node = '') |
50 | 50 | { |
51 | - if ($node != '') |
|
52 | - $this->openNode($node, ''); |
|
51 | + if ($node != '') { |
|
52 | + $this->openNode($node, ''); |
|
53 | + } |
|
53 | 54 | $this->__write($value); |
54 | - if ($node != '') |
|
55 | - $this->closeNode($node); |
|
55 | + if ($node != '') { |
|
56 | + $this->closeNode($node); |
|
57 | + } |
|
56 | 58 | } |
57 | 59 | |
58 | 60 | /** @access private */ |
@@ -144,20 +146,24 @@ discard block |
||
144 | 146 | $zip->copyDirectoryFromDisk("modules/$module"); |
145 | 147 | |
146 | 148 | // Copy Settings/module directory |
147 | - if (is_dir("modules/Settings/$module")) |
|
148 | - $zip->copyDirectoryFromDisk("modules/Settings/$module", 'settings/'); |
|
149 | + if (is_dir("modules/Settings/$module")) { |
|
150 | + $zip->copyDirectoryFromDisk("modules/Settings/$module", 'settings/'); |
|
151 | + } |
|
149 | 152 | |
150 | 153 | // Copy cron files of the module (if any) |
151 | - if (is_dir("cron/modules/$module")) |
|
152 | - $zip->copyDirectoryFromDisk("cron/modules/$module", "cron"); |
|
154 | + if (is_dir("cron/modules/$module")) { |
|
155 | + $zip->copyDirectoryFromDisk("cron/modules/$module", "cron"); |
|
156 | + } |
|
153 | 157 | |
154 | 158 | //Copy module templates files |
155 | - if (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . '/modules/' . $module)) |
|
156 | - $zip->copyDirectoryFromDisk('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . '/modules/' . $module, 'templates'); |
|
159 | + if (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . '/modules/' . $module)) { |
|
160 | + $zip->copyDirectoryFromDisk('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . '/modules/' . $module, 'templates'); |
|
161 | + } |
|
157 | 162 | |
158 | 163 | //Copy Settings module templates files, if any |
159 | - if (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/$module")) |
|
160 | - $zip->copyDirectoryFromDisk('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/$module", "settings/templates"); |
|
164 | + if (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/$module")) { |
|
165 | + $zip->copyDirectoryFromDisk('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/$module", "settings/templates"); |
|
166 | + } |
|
161 | 167 | |
162 | 168 | //Support to multiple layouts of module |
163 | 169 | $layoutDirectories = glob('layouts' . '/*', GLOB_ONLYDIR); |
@@ -261,8 +267,9 @@ discard block |
||
261 | 267 | } |
262 | 268 | $this->openNode('dependencies'); |
263 | 269 | $this->outputNode($minVersion, 'vtiger_version'); |
264 | - if ($maxVersion !== false) |
|
265 | - $this->outputNode($maxVersion, 'vtiger_max_version'); |
|
270 | + if ($maxVersion !== false) { |
|
271 | + $this->outputNode($maxVersion, 'vtiger_max_version'); |
|
272 | + } |
|
266 | 273 | $this->closeNode('dependencies'); |
267 | 274 | } |
268 | 275 | |
@@ -374,8 +381,9 @@ discard block |
||
374 | 381 | $sqlresult = $adb->pquery("SELECT * FROM vtiger_blocks WHERE tabid = ?", Array($moduleInstance->id)); |
375 | 382 | $resultrows = $adb->num_rows($sqlresult); |
376 | 383 | |
377 | - if (empty($resultrows)) |
|
378 | - return; |
|
384 | + if (empty($resultrows)) { |
|
385 | + return; |
|
386 | + } |
|
379 | 387 | |
380 | 388 | $this->openNode('blocks'); |
381 | 389 | for ($index = 0; $index < $resultrows; ++$index) { |
@@ -421,8 +429,9 @@ discard block |
||
421 | 429 | $fieldresult = $adb->pquery("SELECT * FROM vtiger_field WHERE tabid=? && block=?", Array($moduleInstance->id, $blockid)); |
422 | 430 | $fieldcount = $adb->num_rows($fieldresult); |
423 | 431 | |
424 | - if (empty($fieldcount)) |
|
425 | - return; |
|
432 | + if (empty($fieldcount)) { |
|
433 | + return; |
|
434 | + } |
|
426 | 435 | |
427 | 436 | $entityresult = $adb->pquery("SELECT * FROM vtiger_entityname WHERE tabid=?", Array($moduleInstance->id)); |
428 | 437 | $entity_fieldname = $adb->query_result($entityresult, 0, 'fieldname'); |
@@ -537,8 +546,9 @@ discard block |
||
537 | 546 | $db = \PearDatabase::getInstance(); |
538 | 547 | |
539 | 548 | $customviewres = $db->pquery("SELECT * FROM vtiger_customview WHERE entitytype = ?", [$moduleInstance->name]); |
540 | - if (!$customviewres->rowCount()) |
|
541 | - return; |
|
549 | + if (!$customviewres->rowCount()) { |
|
550 | + return; |
|
551 | + } |
|
542 | 552 | |
543 | 553 | $this->openNode('customviews'); |
544 | 554 | while ($row = $db->getRow($customviewres)) { |
@@ -598,22 +608,27 @@ discard block |
||
598 | 608 | $deforgshare = $adb->pquery("SELECT * FROM vtiger_def_org_share WHERE tabid=?", Array($moduleInstance->id)); |
599 | 609 | $deforgshareCount = $adb->num_rows($deforgshare); |
600 | 610 | |
601 | - if (empty($deforgshareCount)) |
|
602 | - return; |
|
611 | + if (empty($deforgshareCount)) { |
|
612 | + return; |
|
613 | + } |
|
603 | 614 | |
604 | 615 | $this->openNode('sharingaccess'); |
605 | 616 | if ($deforgshareCount) { |
606 | 617 | for ($index = 0; $index < $deforgshareCount; ++$index) { |
607 | 618 | $permission = $adb->query_result($deforgshare, $index, 'permission'); |
608 | 619 | $permissiontext = ''; |
609 | - if ($permission == '0') |
|
610 | - $permissiontext = 'public_readonly'; |
|
611 | - if ($permission == '1') |
|
612 | - $permissiontext = 'public_readwrite'; |
|
613 | - if ($permission == '2') |
|
614 | - $permissiontext = 'public_readwritedelete'; |
|
615 | - if ($permission == '3') |
|
616 | - $permissiontext = 'private'; |
|
620 | + if ($permission == '0') { |
|
621 | + $permissiontext = 'public_readonly'; |
|
622 | + } |
|
623 | + if ($permission == '1') { |
|
624 | + $permissiontext = 'public_readwrite'; |
|
625 | + } |
|
626 | + if ($permission == '2') { |
|
627 | + $permissiontext = 'public_readwritedelete'; |
|
628 | + } |
|
629 | + if ($permission == '3') { |
|
630 | + $permissiontext = 'private'; |
|
631 | + } |
|
617 | 632 | |
618 | 633 | $this->outputNode($permissiontext, 'default'); |
619 | 634 | } |
@@ -624,8 +639,9 @@ discard block |
||
624 | 639 | public function export_Actions($moduleInstance) |
625 | 640 | { |
626 | 641 | |
627 | - if (!$moduleInstance->isentitytype) |
|
628 | - return; |
|
642 | + if (!$moduleInstance->isentitytype) { |
|
643 | + return; |
|
644 | + } |
|
629 | 645 | |
630 | 646 | $adb = \PearDatabase::getInstance(); |
631 | 647 | $result = $adb->pquery('SELECT distinct(actionname) FROM vtiger_profile2utility, vtiger_actionmapping |
@@ -650,8 +666,9 @@ discard block |
||
650 | 666 | public function export_RelatedLists($moduleInstance) |
651 | 667 | { |
652 | 668 | |
653 | - if (!$moduleInstance->isentitytype) |
|
654 | - return; |
|
669 | + if (!$moduleInstance->isentitytype) { |
|
670 | + return; |
|
671 | + } |
|
655 | 672 | |
656 | 673 | $adb = \PearDatabase::getInstance(); |
657 | 674 | $result = $adb->pquery("SELECT * FROM vtiger_relatedlists WHERE tabid = ?", Array($moduleInstance->id)); |
@@ -785,8 +802,9 @@ discard block |
||
785 | 802 | $tableName = $inventoryFieldModel->getTableName('fields'); |
786 | 803 | |
787 | 804 | $result = $db->query(sprintf('SELECT * FROM %s', $tableName)); |
788 | - if ($db->getRowCount($result) == 0) |
|
789 | - return false; |
|
805 | + if ($db->getRowCount($result) == 0) { |
|
806 | + return false; |
|
807 | + } |
|
790 | 808 | |
791 | 809 | $this->openNode('inventory'); |
792 | 810 | $this->openNode('fields'); |