@@ -31,8 +31,9 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $db = PearDatabase::getInstance(); |
| 33 | 33 | $appidresult = $db->pquery("SELECT appid FROM vtiger_wsapp WHERE appkey=?", array($key)); |
| 34 | - if ($db->num_rows($appidresult)) |
|
| 35 | - return $db->query_result($appidresult, 0, 'appid'); |
|
| 34 | + if ($db->num_rows($appidresult)) { |
|
| 35 | + return $db->query_result($appidresult, 0, 'appid'); |
|
| 36 | + } |
|
| 36 | 37 | return false; |
| 37 | 38 | } |
| 38 | 39 | |
@@ -42,8 +43,9 @@ discard block |
||
| 42 | 43 | */ |
| 43 | 44 | public function idmap_get_clientmap($appid, $serverids) |
| 44 | 45 | { |
| 45 | - if (!is_array($serverids)) |
|
| 46 | - $serverids = array($serverids); |
|
| 46 | + if (!is_array($serverids)) { |
|
| 47 | + $serverids = array($serverids); |
|
| 48 | + } |
|
| 47 | 49 | $db = PearDatabase::getInstance(); |
| 48 | 50 | ; |
| 49 | 51 | $result = $db->pquery(sprintf( |
@@ -65,8 +67,9 @@ discard block |
||
| 65 | 67 | */ |
| 66 | 68 | public function idmap_get_clientservermap($appid, $clientids) |
| 67 | 69 | { |
| 68 | - if (!is_array($clientids)) |
|
| 69 | - $clientids = array($clientids); |
|
| 70 | + if (!is_array($clientids)) { |
|
| 71 | + $clientids = array($clientids); |
|
| 72 | + } |
|
| 70 | 73 | |
| 71 | 74 | $db = PearDatabase::getInstance(); |
| 72 | 75 | |
@@ -83,8 +86,9 @@ discard block |
||
| 83 | 86 | |
| 84 | 87 | public function idmap_storeRecordsInQueue($syncServerId, $recordDetails, $flag, $appid) |
| 85 | 88 | { |
| 86 | - if (!is_array($recordDetails)) |
|
| 87 | - $recordDetails = array($recordDetails); |
|
| 89 | + if (!is_array($recordDetails)) { |
|
| 90 | + $recordDetails = array($recordDetails); |
|
| 91 | + } |
|
| 88 | 92 | $db = PearDatabase::getInstance(); |
| 89 | 93 | $params = array(); |
| 90 | 94 | $params[] = $syncServerId; |
@@ -99,8 +103,9 @@ discard block |
||
| 99 | 103 | $db = PearDatabase::getInstance(); |
| 100 | 104 | $checkQuery = "SELECT syncserverid FROM vtiger_wsapp_queuerecords WHERE syncserverid=?"; |
| 101 | 105 | $result = $db->pquery($checkQuery, array($syncServerId)); |
| 102 | - if ($db->num_rows($result) > 0) |
|
| 103 | - return true; |
|
| 106 | + if ($db->num_rows($result) > 0) { |
|
| 107 | + return true; |
|
| 108 | + } |
|
| 104 | 109 | return false; |
| 105 | 110 | } |
| 106 | 111 | |
@@ -148,19 +153,20 @@ discard block |
||
| 148 | 153 | public function idmap_put($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId, $mode = "save") |
| 149 | 154 | { |
| 150 | 155 | $db = PearDatabase::getInstance(); |
| 151 | - if ($mode == $this->create) |
|
| 152 | - $this->idmap_create($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId); |
|
| 153 | - else if ($mode == $this->update) |
|
| 154 | - $this->idmap_update($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId); |
|
| 155 | - else if ($mode == $this->save) { |
|
| 156 | + if ($mode == $this->create) { |
|
| 157 | + $this->idmap_create($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId); |
|
| 158 | + } else if ($mode == $this->update) { |
|
| 159 | + $this->idmap_update($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId); |
|
| 160 | + } else if ($mode == $this->save) { |
|
| 156 | 161 | $result = $db->pquery("SELECT * FROM vtiger_wsapp_recordmapping WHERE appid=? and serverid=? and clientid=?", array($appid, $serverid, $clientid)); |
| 157 | - if ($db->num_rows($result) <= 0) |
|
| 158 | - $this->idmap_create($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId); |
|
| 159 | - else |
|
| 160 | - $this->idmap_update($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId); |
|
| 162 | + if ($db->num_rows($result) <= 0) { |
|
| 163 | + $this->idmap_create($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId); |
|
| 164 | + } else { |
|
| 165 | + $this->idmap_update($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId); |
|
| 166 | + } |
|
| 167 | + } else if ($mode == $this->delete) { |
|
| 168 | + $this->idmap_delete($appid, $serverid, $clientid, $serverAppId); |
|
| 161 | 169 | } |
| 162 | - else if ($mode == $this->delete) |
|
| 163 | - $this->idmap_delete($appid, $serverid, $clientid, $serverAppId); |
|
| 164 | 170 | } |
| 165 | 171 | |
| 166 | 172 | /** |
@@ -229,11 +235,13 @@ discard block |
||
| 229 | 235 | if (empty($type)) { |
| 230 | 236 | throw new WebServiceException('WSAPP06', "No sync type specified"); |
| 231 | 237 | } |
| 232 | - if (is_array($name)) |
|
| 233 | - throw new WebServiceException("WSAPP07", "type is in the wrong format"); |
|
| 238 | + if (is_array($name)) { |
|
| 239 | + throw new WebServiceException("WSAPP07", "type is in the wrong format"); |
|
| 240 | + } |
|
| 234 | 241 | $type = strtolower($type); |
| 235 | - if (!in_array($type, $this->syncTypes)) |
|
| 236 | - throw new WebServiceException('WSAPP05', "Wrong sync type specified"); |
|
| 242 | + if (!in_array($type, $this->syncTypes)) { |
|
| 243 | + throw new WebServiceException('WSAPP05', "Wrong sync type specified"); |
|
| 244 | + } |
|
| 237 | 245 | $db = PearDatabase::getInstance(); |
| 238 | 246 | $uid = uniqid(); |
| 239 | 247 | $db->pquery("INSERT INTO vtiger_wsapp (name, appkey,type) VALUES(?,?,?)", array($name, $uid, $type)); |
@@ -267,10 +275,11 @@ discard block |
||
| 267 | 275 | throw new WebServiceException('WSAPP04', "Access restricted to app"); |
| 268 | 276 | } |
| 269 | 277 | |
| 270 | - if (!is_array($element)) |
|
| 271 | - $records = array($element); |
|
| 272 | - else |
|
| 273 | - $records = $element; |
|
| 278 | + if (!is_array($element)) { |
|
| 279 | + $records = array($element); |
|
| 280 | + } else { |
|
| 281 | + $records = $element; |
|
| 282 | + } |
|
| 274 | 283 | |
| 275 | 284 | //hardcoded since the destination handler will be vtigerCRM |
| 276 | 285 | $serverKey = wsapp_getAppKey("vtigerCRM"); |
@@ -293,13 +302,15 @@ discard block |
||
| 293 | 302 | $clientRecordId = $record['id']; |
| 294 | 303 | |
| 295 | 304 | // Missing client record id? |
| 296 | - if (empty($clientRecordId)) |
|
| 297 | - continue; |
|
| 305 | + if (empty($clientRecordId)) { |
|
| 306 | + continue; |
|
| 307 | + } |
|
| 298 | 308 | |
| 299 | 309 | $lookupRecordId = false; |
| 300 | 310 | $lookupResult = $db->pquery("SELECT serverid,clientmodifiedtime FROM vtiger_wsapp_recordmapping WHERE appid=? && clientid=?", array($appid, $clientRecordId)); |
| 301 | - if ($db->num_rows($lookupResult)) |
|
| 302 | - $lookupRecordId = $db->query_result($lookupResult, 0, 'serverid'); |
|
| 311 | + if ($db->num_rows($lookupResult)) { |
|
| 312 | + $lookupRecordId = $db->query_result($lookupResult, 0, 'serverid'); |
|
| 313 | + } |
|
| 303 | 314 | if (empty($lookupRecordId) && $record['mode'] != "delete") { |
| 304 | 315 | $createRecords[$clientRecordId] = $record['values']; |
| 305 | 316 | $createRecords[$clientRecordId]['module'] = $record['module']; |
@@ -309,8 +320,9 @@ discard block |
||
| 309 | 320 | $deleteRecords[$clientRecordId] = $lookupRecordId; |
| 310 | 321 | } else if (!(empty($lookupRecordId))) { |
| 311 | 322 | $clientLastModifiedTime = $db->query_result($lookupResult, 0, 'clientmodifiedtime'); |
| 312 | - if ($clientLastModifiedTime >= $record['values']['modifiedtime']) |
|
| 313 | - continue; |
|
| 323 | + if ($clientLastModifiedTime >= $record['values']['modifiedtime']) { |
|
| 324 | + continue; |
|
| 325 | + } |
|
| 314 | 326 | $record['values']['id'] = $lookupRecordId; |
| 315 | 327 | $updateRecords[$clientRecordId] = $record['values']; |
| 316 | 328 | $updateRecords[$clientRecordId]['module'] = $record['module']; |
@@ -446,8 +458,9 @@ discard block |
||
| 446 | 458 | */ |
| 447 | 459 | public function map($key, $element, $user) |
| 448 | 460 | { |
| 449 | - if (empty($element)) |
|
| 450 | - return; |
|
| 461 | + if (empty($element)) { |
|
| 462 | + return; |
|
| 463 | + } |
|
| 451 | 464 | $db = PearDatabase::getInstance(); |
| 452 | 465 | $appid = $this->appid_with_key($key); |
| 453 | 466 | $createDetails = $element["create"]; |
@@ -501,9 +514,9 @@ discard block |
||
| 501 | 514 | |
| 502 | 515 | public function convertToQueueRecordFormat($record, $flag) |
| 503 | 516 | { |
| 504 | - if ($flag != $this->delete) |
|
| 505 | - return $record; |
|
| 506 | - else { |
|
| 517 | + if ($flag != $this->delete) { |
|
| 518 | + return $record; |
|
| 519 | + } else { |
|
| 507 | 520 | $recordFormat = array(); |
| 508 | 521 | $recordFormat['id'] = $record['id']; |
| 509 | 522 | return $recordFormat; |
@@ -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'; |
@@ -26,8 +26,9 @@ |
||
| 26 | 26 | |
| 27 | 27 | $viewer = $this->getViewer($request); |
| 28 | 28 | $moduleModel = Vtiger_Module_Model::getInstance('OSSTimeControl'); |
| 29 | - if ($moduleModel) |
|
| 30 | - $data = $moduleModel->getTimeUsers($recordId, $moduleName); |
|
| 29 | + if ($moduleModel) { |
|
| 30 | + $data = $moduleModel->getTimeUsers($recordId, $moduleName); |
|
| 31 | + } |
|
| 31 | 32 | $viewer->assign('MODULE_NAME', $moduleName); |
| 32 | 33 | $viewer->assign('DATA', $data); |
| 33 | 34 | $viewer->view('charts/ShowTimeProjectUsers.tpl', $moduleName); |
@@ -34,8 +34,9 @@ discard block |
||
| 34 | 34 | public function parse() |
| 35 | 35 | { |
| 36 | 36 | $tab = $this->prepareFile(); |
| 37 | - foreach ($tab as $line) |
|
| 38 | - $this->parseLine($line); |
|
| 37 | + foreach ($tab as $line) { |
|
| 38 | + $this->parseLine($line); |
|
| 39 | + } |
|
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | public function getXML() |
@@ -53,13 +54,15 @@ discard block |
||
| 53 | 54 | protected function createXML($key, $value, $level) |
| 54 | 55 | { |
| 55 | 56 | $indent = ''; |
| 56 | - for ($i = 0; $i <= $level; $i++) |
|
| 57 | - $indent .= "\t"; |
|
| 57 | + for ($i = 0; $i <= $level; $i++) { |
|
| 58 | + $indent .= "\t"; |
|
| 59 | + } |
|
| 58 | 60 | if (is_array($value)) { |
| 59 | 61 | $xml = "$indent<$key>\n"; |
| 60 | 62 | foreach ($value as $subKey => $subVal) { |
| 61 | - if (is_numeric($subKey)) |
|
| 62 | - $subKey = substr($key, 0, -1); |
|
| 63 | + if (is_numeric($subKey)) { |
|
| 64 | + $subKey = substr($key, 0, -1); |
|
| 65 | + } |
|
| 63 | 66 | $xml .= $this->createXML($subKey, $subVal, $level + 1); |
| 64 | 67 | } |
| 65 | 68 | $xml .= "$indent</$key>\n"; |
@@ -85,10 +88,11 @@ discard block |
||
| 85 | 88 | break; |
| 86 | 89 | case 'NS': |
| 87 | 90 | $code = substr($value, 0, 2); |
| 88 | - if ($code == '22') |
|
| 89 | - $this->ownerName = substr($value, 2); |
|
| 90 | - else if ($code == '23') |
|
| 91 | - $this->accountName = substr($value, 2); |
|
| 91 | + if ($code == '22') { |
|
| 92 | + $this->ownerName = substr($value, 2); |
|
| 93 | + } else if ($code == '23') { |
|
| 94 | + $this->accountName = substr($value, 2); |
|
| 95 | + } |
|
| 92 | 96 | break; |
| 93 | 97 | case '60F': |
| 94 | 98 | $this->openBalance = $this->parseBalance($value); |
@@ -103,10 +107,11 @@ discard block |
||
| 103 | 107 | self::parseOperation($value); |
| 104 | 108 | break; |
| 105 | 109 | case '86': |
| 106 | - if ($this->_lastTag == '61') |
|
| 107 | - $this->parseTransaction($value); |
|
| 108 | - else |
|
| 109 | - $this->info .= $value; |
|
| 110 | + if ($this->_lastTag == '61') { |
|
| 111 | + $this->parseTransaction($value); |
|
| 112 | + } else { |
|
| 113 | + $this->info .= $value; |
|
| 114 | + } |
|
| 110 | 115 | break; |
| 111 | 116 | default: |
| 112 | 117 | break; |
@@ -16,8 +16,9 @@ discard block |
||
| 16 | 16 | public function parse() |
| 17 | 17 | { |
| 18 | 18 | $tab = $this->prepareFile(); |
| 19 | - foreach ($tab as $line) |
|
| 20 | - $this->parseLine($line); |
|
| 19 | + foreach ($tab as $line) { |
|
| 20 | + $this->parseLine($line); |
|
| 21 | + } |
|
| 21 | 22 | } |
| 22 | 23 | |
| 23 | 24 | protected function parseLine($line) |
@@ -36,10 +37,11 @@ discard block |
||
| 36 | 37 | break; |
| 37 | 38 | case 'NS': |
| 38 | 39 | $code = substr($value, 0, 2); |
| 39 | - if ($code == '22') |
|
| 40 | - $this->ownerName = substr($value, 2); |
|
| 41 | - else if ($code == '23') |
|
| 42 | - $this->accountName = substr($value, 2); |
|
| 40 | + if ($code == '22') { |
|
| 41 | + $this->ownerName = substr($value, 2); |
|
| 42 | + } else if ($code == '23') { |
|
| 43 | + $this->accountName = substr($value, 2); |
|
| 44 | + } |
|
| 43 | 45 | break; |
| 44 | 46 | case '60F': |
| 45 | 47 | $this->openBalance = $this->parseBalance($value); |
@@ -62,8 +64,9 @@ discard block |
||
| 62 | 64 | default: |
| 63 | 65 | break; |
| 64 | 66 | } |
| 65 | - if ($tag) |
|
| 66 | - $this->_lastTag = $tag; |
|
| 67 | + if ($tag) { |
|
| 68 | + $this->_lastTag = $tag; |
|
| 69 | + } |
|
| 67 | 70 | } |
| 68 | 71 | |
| 69 | 72 | protected function parseTransaction($value) |
@@ -18,8 +18,9 @@ discard block |
||
| 18 | 18 | public function parse() |
| 19 | 19 | { |
| 20 | 20 | $tab = $this->prepareFile(); |
| 21 | - foreach ($tab as $line) |
|
| 22 | - $this->parseLine($line); |
|
| 21 | + foreach ($tab as $line) { |
|
| 22 | + $this->parseLine($line); |
|
| 23 | + } |
|
| 23 | 24 | } |
| 24 | 25 | |
| 25 | 26 | protected function parseLine($line) |
@@ -38,10 +39,11 @@ discard block |
||
| 38 | 39 | break; |
| 39 | 40 | case 'NS': |
| 40 | 41 | $code = substr($value, 0, 2); |
| 41 | - if ($code == '22') |
|
| 42 | - $this->ownerName = substr($value, 2); |
|
| 43 | - else if ($code == '23') |
|
| 44 | - $this->accountName = substr($value, 2); |
|
| 42 | + if ($code == '22') { |
|
| 43 | + $this->ownerName = substr($value, 2); |
|
| 44 | + } else if ($code == '23') { |
|
| 45 | + $this->accountName = substr($value, 2); |
|
| 46 | + } |
|
| 45 | 47 | break; |
| 46 | 48 | case '60F': |
| 47 | 49 | $this->openBalance = $this->parseBalance($value); |
@@ -56,16 +58,18 @@ discard block |
||
| 56 | 58 | self::parseOperation($value); |
| 57 | 59 | break; |
| 58 | 60 | case '86': |
| 59 | - if ($this->_lastTag == '61') |
|
| 60 | - $this->parseTransaction($value); |
|
| 61 | - else |
|
| 62 | - $this->info .= $value; |
|
| 61 | + if ($this->_lastTag == '61') { |
|
| 62 | + $this->parseTransaction($value); |
|
| 63 | + } else { |
|
| 64 | + $this->info .= $value; |
|
| 65 | + } |
|
| 63 | 66 | break; |
| 64 | 67 | default: |
| 65 | 68 | break; |
| 66 | 69 | } |
| 67 | - if ($tag) |
|
| 68 | - $this->_lastTag = $tag; |
|
| 70 | + if ($tag) { |
|
| 71 | + $this->_lastTag = $tag; |
|
| 72 | + } |
|
| 69 | 73 | } |
| 70 | 74 | |
| 71 | 75 | protected function parseTransaction($value) |