@@ -11,9 +11,9 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class Version { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Full version number |
|
| 16 | - */ |
|
| 17 | - const VERSION = '1.1.0'; |
|
| 14 | + /** |
|
| 15 | + * Full version number |
|
| 16 | + */ |
|
| 17 | + const VERSION = '1.1.0'; |
|
| 18 | 18 | |
| 19 | 19 | } |
@@ -401,7 +401,7 @@ |
||
| 401 | 401 | if (!file_exists($tplpath . $tplname)) { |
| 402 | 402 | $initialContent = "{* License Text *}\n"; |
| 403 | 403 | // Enable debug to make it easy to implement. |
| 404 | - $initialContent.= "{debug}{* REMOVE THIS LINE AFTER IMPLEMENTATION *}\n\n"; |
|
| 404 | + $initialContent .= "{debug}{* REMOVE THIS LINE AFTER IMPLEMENTATION *}\n\n"; |
|
| 405 | 405 | file_put_contents($tplpath . $tplname, $initialContent); |
| 406 | 406 | } |
| 407 | 407 | file_put_contents($tplpath . $tplname, "{* $file *}\n", FILE_APPEND); |
@@ -116,8 +116,9 @@ discard block |
||
| 116 | 116 | protected function prompt($msg = '', $type = self::PROMPT_ANY) |
| 117 | 117 | { |
| 118 | 118 | do { |
| 119 | - if ($msg) |
|
| 120 | - echo $msg; |
|
| 119 | + if ($msg) { |
|
| 120 | + echo $msg; |
|
| 121 | + } |
|
| 121 | 122 | $value = trim(fgets(STDIN)); |
| 122 | 123 | |
| 123 | 124 | if (!$value && $type == self::PROMPT_OPTIONAL) { |
@@ -463,8 +464,9 @@ discard block |
||
| 463 | 464 | $filename = basename($file, true); |
| 464 | 465 | $dir = substr($file, 0, strpos($file, $filename)); |
| 465 | 466 | $dir = str_replace('languages/' . self::BASE_LANG_PREFIX, 'languages/' . $languageInformation['prefix'], $dir); |
| 466 | - if (!file_exists($dir)) |
|
| 467 | - mkdir($dir); |
|
| 467 | + if (!file_exists($dir)) { |
|
| 468 | + mkdir($dir); |
|
| 469 | + } |
|
| 468 | 470 | |
| 469 | 471 | if (isset($languageInformation['prefix_value'])) { |
| 470 | 472 | $contents = file_get_contents($file); |
@@ -78,8 +78,9 @@ discard block |
||
| 78 | 78 | foreach ($filelist as $filename => $fileinfo) { |
| 79 | 79 | if (!$unzip->isdir($filename)) { |
| 80 | 80 | |
| 81 | - if (strpos($filename, '/') === false) |
|
| 82 | - continue; |
|
| 81 | + if (strpos($filename, '/') === false) { |
|
| 82 | + continue; |
|
| 83 | + } |
|
| 83 | 84 | |
| 84 | 85 | |
| 85 | 86 | $targetdir = substr($filename, 0, strripos($filename, '/')); |
@@ -130,8 +131,9 @@ discard block |
||
| 130 | 131 | } |
| 131 | 132 | } |
| 132 | 133 | } |
| 133 | - if ($unzip) |
|
| 134 | - $unzip->close(); |
|
| 134 | + if ($unzip) { |
|
| 135 | + $unzip->close(); |
|
| 136 | + } |
|
| 135 | 137 | |
| 136 | 138 | self::register($name, $label); |
| 137 | 139 | |
@@ -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 |
@@ -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 */ |
@@ -145,20 +147,24 @@ discard block |
||
| 145 | 147 | $zip->copyDirectoryFromDisk("modules/$module"); |
| 146 | 148 | |
| 147 | 149 | // Copy Settings/module directory |
| 148 | - if (is_dir("modules/Settings/$module")) |
|
| 149 | - $zip->copyDirectoryFromDisk("modules/Settings/$module", 'settings/'); |
|
| 150 | + if (is_dir("modules/Settings/$module")) { |
|
| 151 | + $zip->copyDirectoryFromDisk("modules/Settings/$module", 'settings/'); |
|
| 152 | + } |
|
| 150 | 153 | |
| 151 | 154 | // Copy cron files of the module (if any) |
| 152 | - if (is_dir("cron/modules/$module")) |
|
| 153 | - $zip->copyDirectoryFromDisk("cron/modules/$module", "cron"); |
|
| 155 | + if (is_dir("cron/modules/$module")) { |
|
| 156 | + $zip->copyDirectoryFromDisk("cron/modules/$module", "cron"); |
|
| 157 | + } |
|
| 154 | 158 | |
| 155 | 159 | //Copy module templates files |
| 156 | - if (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . '/modules/' . $module)) |
|
| 157 | - $zip->copyDirectoryFromDisk('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . '/modules/' . $module, 'templates'); |
|
| 160 | + if (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . '/modules/' . $module)) { |
|
| 161 | + $zip->copyDirectoryFromDisk('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . '/modules/' . $module, 'templates'); |
|
| 162 | + } |
|
| 158 | 163 | |
| 159 | 164 | //Copy Settings module templates files, if any |
| 160 | - if (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/$module")) |
|
| 161 | - $zip->copyDirectoryFromDisk('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/$module", "settings/templates"); |
|
| 165 | + if (is_dir('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/$module")) { |
|
| 166 | + $zip->copyDirectoryFromDisk('layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/modules/Settings/$module", "settings/templates"); |
|
| 167 | + } |
|
| 162 | 168 | |
| 163 | 169 | //Support to multiple layouts of module |
| 164 | 170 | $layoutDirectories = glob('layouts' . '/*', GLOB_ONLYDIR); |
@@ -262,8 +268,9 @@ discard block |
||
| 262 | 268 | } |
| 263 | 269 | $this->openNode('dependencies'); |
| 264 | 270 | $this->outputNode($minVersion, 'vtiger_version'); |
| 265 | - if ($maxVersion !== false) |
|
| 266 | - $this->outputNode($maxVersion, 'vtiger_max_version'); |
|
| 271 | + if ($maxVersion !== false) { |
|
| 272 | + $this->outputNode($maxVersion, 'vtiger_max_version'); |
|
| 273 | + } |
|
| 267 | 274 | $this->closeNode('dependencies'); |
| 268 | 275 | } |
| 269 | 276 | |
@@ -382,8 +389,9 @@ discard block |
||
| 382 | 389 | $sqlresult = $adb->pquery("SELECT * FROM vtiger_blocks WHERE tabid = ?", Array($moduleInstance->id)); |
| 383 | 390 | $resultrows = $adb->num_rows($sqlresult); |
| 384 | 391 | |
| 385 | - if (empty($resultrows)) |
|
| 386 | - return; |
|
| 392 | + if (empty($resultrows)) { |
|
| 393 | + return; |
|
| 394 | + } |
|
| 387 | 395 | |
| 388 | 396 | $this->openNode('blocks'); |
| 389 | 397 | for ($index = 0; $index < $resultrows; ++$index) { |
@@ -429,8 +437,9 @@ discard block |
||
| 429 | 437 | $fieldresult = $adb->pquery("SELECT * FROM vtiger_field WHERE tabid=? && block=?", Array($moduleInstance->id, $blockid)); |
| 430 | 438 | $fieldcount = $adb->num_rows($fieldresult); |
| 431 | 439 | |
| 432 | - if (empty($fieldcount)) |
|
| 433 | - return; |
|
| 440 | + if (empty($fieldcount)) { |
|
| 441 | + return; |
|
| 442 | + } |
|
| 434 | 443 | |
| 435 | 444 | $entityresult = $adb->pquery("SELECT * FROM vtiger_entityname WHERE tabid=?", Array($moduleInstance->id)); |
| 436 | 445 | $entity_fieldname = $adb->query_result($entityresult, 0, 'fieldname'); |
@@ -545,8 +554,9 @@ discard block |
||
| 545 | 554 | $db = \PearDatabase::getInstance(); |
| 546 | 555 | |
| 547 | 556 | $customviewres = $db->pquery("SELECT * FROM vtiger_customview WHERE entitytype = ?", [$moduleInstance->name]); |
| 548 | - if (!$customviewres->rowCount()) |
|
| 549 | - return; |
|
| 557 | + if (!$customviewres->rowCount()) { |
|
| 558 | + return; |
|
| 559 | + } |
|
| 550 | 560 | |
| 551 | 561 | $this->openNode('customviews'); |
| 552 | 562 | while ($row = $db->getRow($customviewres)) { |
@@ -606,22 +616,27 @@ discard block |
||
| 606 | 616 | $deforgshare = $adb->pquery("SELECT * FROM vtiger_def_org_share WHERE tabid=?", Array($moduleInstance->id)); |
| 607 | 617 | $deforgshareCount = $adb->num_rows($deforgshare); |
| 608 | 618 | |
| 609 | - if (empty($deforgshareCount)) |
|
| 610 | - return; |
|
| 619 | + if (empty($deforgshareCount)) { |
|
| 620 | + return; |
|
| 621 | + } |
|
| 611 | 622 | |
| 612 | 623 | $this->openNode('sharingaccess'); |
| 613 | 624 | if ($deforgshareCount) { |
| 614 | 625 | for ($index = 0; $index < $deforgshareCount; ++$index) { |
| 615 | 626 | $permission = $adb->query_result($deforgshare, $index, 'permission'); |
| 616 | 627 | $permissiontext = ''; |
| 617 | - if ($permission == '0') |
|
| 618 | - $permissiontext = 'public_readonly'; |
|
| 619 | - if ($permission == '1') |
|
| 620 | - $permissiontext = 'public_readwrite'; |
|
| 621 | - if ($permission == '2') |
|
| 622 | - $permissiontext = 'public_readwritedelete'; |
|
| 623 | - if ($permission == '3') |
|
| 624 | - $permissiontext = 'private'; |
|
| 628 | + if ($permission == '0') { |
|
| 629 | + $permissiontext = 'public_readonly'; |
|
| 630 | + } |
|
| 631 | + if ($permission == '1') { |
|
| 632 | + $permissiontext = 'public_readwrite'; |
|
| 633 | + } |
|
| 634 | + if ($permission == '2') { |
|
| 635 | + $permissiontext = 'public_readwritedelete'; |
|
| 636 | + } |
|
| 637 | + if ($permission == '3') { |
|
| 638 | + $permissiontext = 'private'; |
|
| 639 | + } |
|
| 625 | 640 | |
| 626 | 641 | $this->outputNode($permissiontext, 'default'); |
| 627 | 642 | } |
@@ -638,8 +653,9 @@ discard block |
||
| 638 | 653 | //TODU: needs updating |
| 639 | 654 | return false; |
| 640 | 655 | //$events = Event::getAll($moduleInstance); |
| 641 | - if (!$events) |
|
| 642 | - return; |
|
| 656 | + if (!$events) { |
|
| 657 | + return; |
|
| 658 | + } |
|
| 643 | 659 | |
| 644 | 660 | $this->openNode('events'); |
| 645 | 661 | foreach ($events as $event) { |
@@ -656,8 +672,9 @@ discard block |
||
| 656 | 672 | public function export_Actions($moduleInstance) |
| 657 | 673 | { |
| 658 | 674 | |
| 659 | - if (!$moduleInstance->isentitytype) |
|
| 660 | - return; |
|
| 675 | + if (!$moduleInstance->isentitytype) { |
|
| 676 | + return; |
|
| 677 | + } |
|
| 661 | 678 | |
| 662 | 679 | $adb = \PearDatabase::getInstance(); |
| 663 | 680 | $result = $adb->pquery('SELECT distinct(actionname) FROM vtiger_profile2utility, vtiger_actionmapping |
@@ -682,8 +699,9 @@ discard block |
||
| 682 | 699 | public function export_RelatedLists($moduleInstance) |
| 683 | 700 | { |
| 684 | 701 | |
| 685 | - if (!$moduleInstance->isentitytype) |
|
| 686 | - return; |
|
| 702 | + if (!$moduleInstance->isentitytype) { |
|
| 703 | + return; |
|
| 704 | + } |
|
| 687 | 705 | |
| 688 | 706 | $adb = \PearDatabase::getInstance(); |
| 689 | 707 | $result = $adb->pquery("SELECT * FROM vtiger_relatedlists WHERE tabid = ?", Array($moduleInstance->id)); |
@@ -817,8 +835,9 @@ discard block |
||
| 817 | 835 | $tableName = $inventoryFieldModel->getTableName('fields'); |
| 818 | 836 | |
| 819 | 837 | $result = $db->query(sprintf('SELECT * FROM %s', $tableName)); |
| 820 | - if ($db->getRowCount($result) == 0) |
|
| 821 | - return false; |
|
| 838 | + if ($db->getRowCount($result) == 0) { |
|
| 839 | + return false; |
|
| 840 | + } |
|
| 822 | 841 | |
| 823 | 842 | $this->openNode('inventory'); |
| 824 | 843 | $this->openNode('fields'); |
@@ -78,8 +78,9 @@ discard block |
||
| 78 | 78 | foreach ($filelist as $filename => $fileinfo) { |
| 79 | 79 | if (!$unzip->isdir($filename)) { |
| 80 | 80 | |
| 81 | - if (strpos($filename, '/') === false) |
|
| 82 | - continue; |
|
| 81 | + if (strpos($filename, '/') === false) { |
|
| 82 | + continue; |
|
| 83 | + } |
|
| 83 | 84 | |
| 84 | 85 | |
| 85 | 86 | $targetdir = substr($filename, 0, strripos($filename, '/')); |
@@ -107,8 +108,9 @@ discard block |
||
| 107 | 108 | } |
| 108 | 109 | } |
| 109 | 110 | } |
| 110 | - if ($unzip) |
|
| 111 | - $unzip->close(); |
|
| 111 | + if ($unzip) { |
|
| 112 | + $unzip->close(); |
|
| 113 | + } |
|
| 112 | 114 | |
| 113 | 115 | self::register($label, $name, $parent); |
| 114 | 116 | |
@@ -84,8 +84,9 @@ discard block |
||
| 84 | 84 | foreach ($filelist as $filename => $fileinfo) { |
| 85 | 85 | if (!$unzip->isdir($filename)) { |
| 86 | 86 | |
| 87 | - if (strpos($filename, '/') === false) |
|
| 88 | - continue; |
|
| 87 | + if (strpos($filename, '/') === false) { |
|
| 88 | + continue; |
|
| 89 | + } |
|
| 89 | 90 | |
| 90 | 91 | $targetdir = substr($filename, 0, strripos($filename, '/')); |
| 91 | 92 | $targetfile = basename($filename); |
@@ -146,8 +147,9 @@ discard block |
||
| 146 | 147 | } |
| 147 | 148 | } |
| 148 | 149 | } |
| 149 | - if ($unzip) |
|
| 150 | - $unzip->close(); |
|
| 150 | + if ($unzip) { |
|
| 151 | + $unzip->close(); |
|
| 152 | + } |
|
| 151 | 153 | |
| 152 | 154 | self::register($prefix, $label, $name); |
| 153 | 155 | |
@@ -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 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | //END |
| 36 | 36 | |
| 37 | 37 | $recordId = $entityData->getId(); |
| 38 | - $vtEntityDelta = new VTEntityDelta (); |
|
| 38 | + $vtEntityDelta = new VTEntityDelta(); |
|
| 39 | 39 | $newEntityData = $vtEntityDelta->getNewEntity($moduleName, $recordId); |
| 40 | 40 | $recordValues = $newEntityData->getData(); |
| 41 | 41 | $isAssignToModified = $this->isAssignToChanged($moduleName, $recordId, $current_user); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $meta = $handler->getMeta(); |
| 61 | 61 | $moduleOwnerFields = $meta->getOwnerFields(); |
| 62 | 62 | $assignToChanged = false; |
| 63 | - $vtEntityDelta = new VTEntityDelta (); |
|
| 63 | + $vtEntityDelta = new VTEntityDelta(); |
|
| 64 | 64 | foreach ($moduleOwnerFields as $ownerField) { |
| 65 | 65 | $assignToChanged = $vtEntityDelta->hasChanged($moduleName, $recordId, $ownerField); |
| 66 | 66 | if ($assignToChanged) |
@@ -62,8 +62,9 @@ discard block |
||
| 62 | 62 | $vtEntityDelta = new VTEntityDelta (); |
| 63 | 63 | foreach ($moduleOwnerFields as $ownerField) { |
| 64 | 64 | $assignToChanged = $vtEntityDelta->hasChanged($moduleName, $recordId, $ownerField); |
| 65 | - if ($assignToChanged) |
|
| 66 | - break; |
|
| 65 | + if ($assignToChanged) { |
|
| 66 | + break; |
|
| 67 | + } |
|
| 67 | 68 | } |
| 68 | 69 | return $assignToChanged; |
| 69 | 70 | } |
@@ -71,8 +72,9 @@ discard block |
||
| 71 | 72 | public function getWsModuleName($workFlowModuleName) |
| 72 | 73 | { |
| 73 | 74 | $wsModuleName = $workFlowModuleName; |
| 74 | - if ($workFlowModuleName == "Activity") |
|
| 75 | - $wsModuleName = "Calendar"; |
|
| 75 | + if ($workFlowModuleName == "Activity") { |
|
| 76 | + $wsModuleName = "Calendar"; |
|
| 77 | + } |
|
| 76 | 78 | return $wsModuleName; |
| 77 | 79 | } |
| 78 | 80 | } |
@@ -42,15 +42,19 @@ discard block |
||
| 42 | 42 | $entityMetaList = array(); |
| 43 | 43 | $db = PearDatabase::getInstance(); |
| 44 | 44 | |
| 45 | - if (empty($entityNames)) |
|
| 46 | - return; |
|
| 47 | - |
|
| 48 | - if (!is_array($entityNames)) |
|
| 49 | - $entityNames = array($entityNames); |
|
| 50 | - if (empty($modules)) |
|
| 51 | - return array(); |
|
| 52 | - if (!is_array($modules)) |
|
| 53 | - $modules = array($modules); |
|
| 45 | + if (empty($entityNames)) { |
|
| 46 | + return; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + if (!is_array($entityNames)) { |
|
| 50 | + $entityNames = array($entityNames); |
|
| 51 | + } |
|
| 52 | + if (empty($modules)) { |
|
| 53 | + return array(); |
|
| 54 | + } |
|
| 55 | + if (!is_array($modules)) { |
|
| 56 | + $modules = array($modules); |
|
| 57 | + } |
|
| 54 | 58 | $entityNameIds = array(); |
| 55 | 59 | foreach ($modules as $moduleName) { |
| 56 | 60 | if (empty($entityMetaList[$moduleName])) { |
@@ -62,8 +66,9 @@ discard block |
||
| 62 | 66 | $nameFieldsArray = explode(",", $meta->getNameFields()); |
| 63 | 67 | if (count($nameFieldsArray) > 1) { |
| 64 | 68 | $nameFields = "concat(" . implode(",' ',", $nameFieldsArray) . ")"; |
| 65 | - } else |
|
| 66 | - $nameFields = $nameFieldsArray[0]; |
|
| 69 | + } else { |
|
| 70 | + $nameFields = $nameFieldsArray[0]; |
|
| 71 | + } |
|
| 67 | 72 | |
| 68 | 73 | $query = sprintf("SELECT %s as id,%s as entityname |
| 69 | 74 | FROM %s as moduleentity |
@@ -102,12 +107,15 @@ discard block |
||
| 102 | 107 | function wsapp_checkIfRecordsAssignToUser($recordsIds, $userIds) |
| 103 | 108 | { |
| 104 | 109 | $assignedRecordIds = []; |
| 105 | - if (!is_array($recordsIds)) |
|
| 106 | - $recordsIds = [$recordsIds]; |
|
| 107 | - if (count($recordsIds) <= 0) |
|
| 108 | - return $assignedRecordIds; |
|
| 109 | - if (!is_array($userIds)) |
|
| 110 | - $userIds = [$userIds]; |
|
| 110 | + if (!is_array($recordsIds)) { |
|
| 111 | + $recordsIds = [$recordsIds]; |
|
| 112 | + } |
|
| 113 | + if (count($recordsIds) <= 0) { |
|
| 114 | + return $assignedRecordIds; |
|
| 115 | + } |
|
| 116 | + if (!is_array($userIds)) { |
|
| 117 | + $userIds = [$userIds]; |
|
| 118 | + } |
|
| 111 | 119 | $db = PearDatabase::getInstance(); |
| 112 | 120 | $query = sprintf("SELECT * FROM vtiger_crmentity where crmid IN (%s) and smownerid in (%s)", generateQuestionMarks($recordsIds), generateQuestionMarks($userIds)); |
| 113 | 121 | $params = []; |