@@ -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 | |
@@ -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 | { |
@@ -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 | |
@@ -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 = []; |
@@ -126,6 +126,9 @@ discard block |
||
| 126 | 126 | return $assignedRecordIds; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | +/** |
|
| 130 | + * @param string $appName |
|
| 131 | + */ |
|
| 129 | 132 | function wsapp_getAppKey($appName) |
| 130 | 133 | { |
| 131 | 134 | $db = PearDatabase::getInstance(); |
@@ -152,6 +155,11 @@ discard block |
||
| 152 | 155 | return $syncType; |
| 153 | 156 | } |
| 154 | 157 | |
| 158 | +/** |
|
| 159 | + * @param string $type |
|
| 160 | + * @param string $handlerClass |
|
| 161 | + * @param string $handlerPath |
|
| 162 | + */ |
|
| 155 | 163 | function wsapp_RegisterHandler($type, $handlerClass, $handlerPath) |
| 156 | 164 | { |
| 157 | 165 | $db = PearDatabase::getInstance(); |
@@ -38,10 +38,11 @@ discard block |
||
| 38 | 38 | throw new WebServiceException('WSAPP04', "Access restricted to app"); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if (!is_array($element)) |
|
| 42 | - $records = array($element); |
|
| 43 | - else |
|
| 44 | - $records = $element; |
|
| 41 | + if (!is_array($element)) { |
|
| 42 | + $records = array($element); |
|
| 43 | + } else { |
|
| 44 | + $records = $element; |
|
| 45 | + } |
|
| 45 | 46 | |
| 46 | 47 | //hardcoded since the destination handler will be vtigerCRM |
| 47 | 48 | $serverKey = wsapp_getAppKey("vtigerCRM"); |
@@ -64,16 +65,18 @@ discard block |
||
| 64 | 65 | $clientRecordId = $record['id']; |
| 65 | 66 | |
| 66 | 67 | // Missing client record id? |
| 67 | - if (empty($clientRecordId)) |
|
| 68 | - continue; |
|
| 68 | + if (empty($clientRecordId)) { |
|
| 69 | + continue; |
|
| 70 | + } |
|
| 69 | 71 | |
| 70 | 72 | $lookupRecordId = false; |
| 71 | 73 | // Added for Duplication handling |
| 72 | 74 | if (!empty($record['crmid'])) { |
| 73 | 75 | $crmid = vtws_getIdComponents($record['crmid']); |
| 74 | 76 | $lookupResult = $db->pquery("SELECT crmid,modifiedtime FROM vtiger_crmentity WHERE crmid=?", array($crmid[1])); |
| 75 | - if ($db->num_rows($lookupResult)) |
|
| 76 | - $lookupRecordId = $record['crmid']; |
|
| 77 | + if ($db->num_rows($lookupResult)) { |
|
| 78 | + $lookupRecordId = $record['crmid']; |
|
| 79 | + } |
|
| 77 | 80 | if (!(empty($lookupRecordId))) { |
| 78 | 81 | $clientLastModifiedTime = $db->query_result($lookupResult, 0, 'modifiedtime'); |
| 79 | 82 | $record['values']['id'] = $lookupRecordId; |
@@ -86,8 +89,9 @@ discard block |
||
| 86 | 89 | // End |
| 87 | 90 | else { |
| 88 | 91 | $lookupResult = $db->pquery("SELECT serverid,clientmodifiedtime FROM vtiger_wsapp_recordmapping WHERE appid=? && clientid=?", array($appid, $clientRecordId)); |
| 89 | - if ($db->num_rows($lookupResult)) |
|
| 90 | - $lookupRecordId = $db->query_result($lookupResult, 0, 'serverid'); |
|
| 92 | + if ($db->num_rows($lookupResult)) { |
|
| 93 | + $lookupRecordId = $db->query_result($lookupResult, 0, 'serverid'); |
|
| 94 | + } |
|
| 91 | 95 | if (empty($lookupRecordId) && $record['mode'] != "delete") { |
| 92 | 96 | $createRecords[$clientRecordId] = $record['values']; |
| 93 | 97 | $createRecords[$clientRecordId]['module'] = $record['module']; |
@@ -97,8 +101,9 @@ discard block |
||
| 97 | 101 | $deleteRecords[$clientRecordId] = $lookupRecordId; |
| 98 | 102 | } else if (!(empty($lookupRecordId))) { |
| 99 | 103 | $clientLastModifiedTime = $db->query_result($lookupResult, 0, 'clientmodifiedtime'); |
| 100 | - if ($clientLastModifiedTime >= $record['values']['modifiedtime']) |
|
| 101 | - continue; |
|
| 104 | + if ($clientLastModifiedTime >= $record['values']['modifiedtime']) { |
|
| 105 | + continue; |
|
| 106 | + } |
|
| 102 | 107 | $record['values']['id'] = $lookupRecordId; |
| 103 | 108 | $updateRecords[$clientRecordId] = $record['values']; |
| 104 | 109 | $updateRecords[$clientRecordId]['module'] = $record['module']; |
@@ -124,8 +124,9 @@ |
||
| 124 | 124 | $appTypehandler['handlerpath'] = "modules/WSAPP/Handlers/vtigerCRMHandler.php"; |
| 125 | 125 | $handlerDetails[] = $appTypehandler; |
| 126 | 126 | |
| 127 | - foreach ($handlerDetails as $appHandlerDetails) |
|
| 128 | - $adb->pquery("INSERT INTO vtiger_wsapp_handlerdetails VALUES(?,?,?)", array($appHandlerDetails['type'], $appHandlerDetails['handlerclass'], $appHandlerDetails['handlerpath'])); |
|
| 127 | + foreach ($handlerDetails as $appHandlerDetails) { |
|
| 128 | + $adb->pquery("INSERT INTO vtiger_wsapp_handlerdetails VALUES(?,?,?)", array($appHandlerDetails['type'], $appHandlerDetails['handlerclass'], $appHandlerDetails['handlerpath'])); |
|
| 129 | + } |
|
| 129 | 130 | } |
| 130 | 131 | |
| 131 | 132 | public function registerVtigerCRMApp() |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | } |
| 29 | 29 | $showFields = array_keys($recordModel->getModule()->getQuickCreateFields()); |
| 30 | 30 | $configureFields = AppConfig::module($moduleName, 'SHOW_FIELD_IN_MODAL'); |
| 31 | - if($configureFields){ |
|
| 31 | + if ($configureFields) { |
|
| 32 | 32 | $showFields = array_merge($showFields, $configureFields); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -97,8 +97,9 @@ |
||
| 97 | 97 | $viewer->assign('MODE', 'edit'); |
| 98 | 98 | } else { |
| 99 | 99 | $firstModuleName = reset($modulesList); |
| 100 | - if ($firstModuleName) |
|
| 101 | - $reportModel->setPrimaryModule($firstModuleName); |
|
| 100 | + if ($firstModuleName) { |
|
| 101 | + $reportModel->setPrimaryModule($firstModuleName); |
|
| 102 | + } |
|
| 102 | 103 | $viewer->assign('MODE', ''); |
| 103 | 104 | } |
| 104 | 105 | |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | function getFieldByReportLabel($module, $label) |
| 16 | 16 | { |
| 17 | 17 | $cacheLabel = VTCacheUtils::getReportFieldByLabel($module, $label); |
| 18 | - if ($cacheLabel) |
|
| 19 | - return $cacheLabel; |
|
| 18 | + if ($cacheLabel) { |
|
| 19 | + return $cacheLabel; |
|
| 20 | + } |
|
| 20 | 21 | |
| 21 | 22 | // this is required so the internal cache is populated or reused. |
| 22 | 23 | getColumnFields($module); |
@@ -27,10 +28,11 @@ discard block |
||
| 27 | 28 | if ($module == 'Calendar') { |
| 28 | 29 | $cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events'); |
| 29 | 30 | if ($cachedEventsFields) { |
| 30 | - if (empty($cachedModuleFields)) |
|
| 31 | - $cachedModuleFields = $cachedEventsFields; |
|
| 32 | - else |
|
| 33 | - $cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields); |
|
| 31 | + if (empty($cachedModuleFields)) { |
|
| 32 | + $cachedModuleFields = $cachedEventsFields; |
|
| 33 | + } else { |
|
| 34 | + $cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields); |
|
| 35 | + } |
|
| 34 | 36 | } |
| 35 | 37 | if ($label == 'Start_Date_and_Time') { |
| 36 | 38 | $label = 'Start_Date_&_Time'; |