@@ -17,6 +17,9 @@ |
||
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param Vtiger_Record_Model $recordModel |
|
| 22 | + */ |
|
| 20 | 23 | public function checkMandatoryFields($recordModel) |
| 21 | 24 | { |
| 22 | 25 | $mandatoryFields = $recordModel->getModule()->getMandatoryFieldModels(); |
@@ -221,7 +221,7 @@ |
||
| 221 | 221 | /** |
| 222 | 222 | * Checks if given record has valid pdf template |
| 223 | 223 | * @param Vtiger_Request $request |
| 224 | - * @return boolean true if valid template exists for this record |
|
| 224 | + * @return boolean|null true if valid template exists for this record |
|
| 225 | 225 | */ |
| 226 | 226 | public function hasValidTemplate(Vtiger_Request $request) |
| 227 | 227 | { |
@@ -113,6 +113,9 @@ discard block |
||
| 113 | 113 | return []; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | + /** |
|
| 117 | + * @param Vtiger_Widget_Model $widgetModel |
|
| 118 | + */ |
|
| 116 | 119 | public function setWidgetModel($widgetModel) |
| 117 | 120 | { |
| 118 | 121 | $this->widgetModel = $widgetModel; |
@@ -127,6 +130,9 @@ discard block |
||
| 127 | 130 | } |
| 128 | 131 | } |
| 129 | 132 | |
| 133 | + /** |
|
| 134 | + * @return string |
|
| 135 | + */ |
|
| 130 | 136 | public function getType() |
| 131 | 137 | { |
| 132 | 138 | return $this->extraData['chartType']; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | if (!isset($groupData[$displayValue]['count'])) { |
| 111 | 111 | $groupData[$displayValue]['count'] = 1; |
| 112 | 112 | } else { |
| 113 | - $groupData[$displayValue]['count'] ++; |
|
| 113 | + $groupData[$displayValue]['count']++; |
|
| 114 | 114 | } |
| 115 | 115 | if (!isset($groupData[$displayValue]['link'])) { |
| 116 | 116 | $moduleModel = $this->getTargetModuleModel(); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | if (!isset($count[$sectorId])) { |
| 128 | 128 | $count[$sectorId] = 1; |
| 129 | 129 | } else { |
| 130 | - $count[$sectorId] ++; |
|
| 130 | + $count[$sectorId]++; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -122,6 +122,9 @@ discard block |
||
| 122 | 122 | return html_entity_decode($value); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | + /** |
|
| 126 | + * @param string $fileName |
|
| 127 | + */ |
|
| 125 | 128 | public function outputFile($fileName) |
| 126 | 129 | { |
| 127 | 130 | header("Content-Disposition:attachment;filename=$fileName.xml"); |
@@ -133,6 +136,9 @@ discard block |
||
| 133 | 136 | readfile($this->tmpXmlPath); |
| 134 | 137 | } |
| 135 | 138 | |
| 139 | + /** |
|
| 140 | + * @param string $fileName |
|
| 141 | + */ |
|
| 136 | 142 | protected function outputZipFile($fileName) |
| 137 | 143 | { |
| 138 | 144 | |
@@ -16,8 +16,6 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Create the name of the Inventory data table |
| 19 | - * @param string $module Module name |
|
| 20 | - * @param string $prefix Prefix table |
|
| 21 | 19 | * @return string Table name |
| 22 | 20 | */ |
| 23 | 21 | public function getTableName($type = 'data') |
@@ -118,8 +116,6 @@ discard block |
||
| 118 | 116 | |
| 119 | 117 | /** |
| 120 | 118 | * Get inventory columns |
| 121 | - * @param string $module Module name |
|
| 122 | - * @param boolean $returnInBlock Should the result be divided into blocks |
|
| 123 | 119 | * @return array Inventory columns |
| 124 | 120 | */ |
| 125 | 121 | public function getColumns() |
@@ -164,7 +160,6 @@ discard block |
||
| 164 | 160 | |
| 165 | 161 | /** |
| 166 | 162 | * Retrieve list of all fields |
| 167 | - * @param string $moduleName Module name |
|
| 168 | 163 | * @return array Fields instance Vtiger_Basic_InventoryField |
| 169 | 164 | */ |
| 170 | 165 | public function getAllFields() |
@@ -133,8 +133,9 @@ discard block |
||
| 133 | 133 | $columns = []; |
| 134 | 134 | foreach ($this->getFields() as $key => $field) { |
| 135 | 135 | $column = $field->getColumnName(); |
| 136 | - if (!empty($column) && $column != '-') |
|
| 137 | - $columns[] = $column; |
|
| 136 | + if (!empty($column) && $column != '-') { |
|
| 137 | + $columns[] = $column; |
|
| 138 | + } |
|
| 138 | 139 | foreach ($field->getCustomColumn() as $name => $field) { |
| 139 | 140 | $columns[] = $name; |
| 140 | 141 | } |
@@ -187,8 +188,9 @@ discard block |
||
| 187 | 188 | } |
| 188 | 189 | $fields = []; |
| 189 | 190 | foreach ($fieldPaths as $fieldPath) { |
| 190 | - if (!is_dir($fieldPath)) |
|
| 191 | - continue; |
|
| 191 | + if (!is_dir($fieldPath)) { |
|
| 192 | + continue; |
|
| 193 | + } |
|
| 192 | 194 | foreach (new DirectoryIterator($fieldPath) as $fileinfo) { |
| 193 | 195 | if ($fileinfo->isFile() && $fileinfo->getFilename() != 'Basic.php') { |
| 194 | 196 | $fieldName = str_replace('.php', '', $fileinfo->getFilename()); |
@@ -332,7 +332,6 @@ |
||
| 332 | 332 | |
| 333 | 333 | /** |
| 334 | 334 | * Function to get the list view entries |
| 335 | - * @param Vtiger_Paging_Model $pagingModel |
|
| 336 | 335 | * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance. |
| 337 | 336 | */ |
| 338 | 337 | public function getListViewCount() |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Functions returns webservices meta object |
| 45 | - * @return webservices meta |
|
| 45 | + * @return boolean meta |
|
| 46 | 46 | */ |
| 47 | 47 | public function getMeta() |
| 48 | 48 | { |
@@ -302,6 +302,9 @@ |
||
| 302 | 302 | return $viewer->view('DetailViewFullContents.tpl', $moduleName, true); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | + /** |
|
| 306 | + * @param Vtiger_Request $request |
|
| 307 | + */ |
|
| 305 | 308 | public function showModuleSummaryView($request) |
| 306 | 309 | { |
| 307 | 310 | $recordId = $request->get('record'); |
@@ -686,8 +686,9 @@ |
||
| 686 | 686 | $sortImage = 'glyphicon glyphicon-chevron-up'; |
| 687 | 687 | } |
| 688 | 688 | if (empty($orderBy) && empty($sortOrder)) { |
| 689 | - if (is_numeric($relatedModuleName)) |
|
| 690 | - $relatedModuleName = vtlib\Functions::getModuleName($relatedModuleName); |
|
| 689 | + if (is_numeric($relatedModuleName)) { |
|
| 690 | + $relatedModuleName = vtlib\Functions::getModuleName($relatedModuleName); |
|
| 691 | + } |
|
| 691 | 692 | $relatedInstance = CRMEntity::getInstance($relatedModuleName); |
| 692 | 693 | $orderBy = $relatedInstance->default_order_by; |
| 693 | 694 | $sortOrder = $relatedInstance->default_sort_order; |
@@ -81,6 +81,9 @@ discard block |
||
| 81 | 81 | return $mapping; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | + /** |
|
| 85 | + * @param string $flag |
|
| 86 | + */ |
|
| 84 | 87 | public function idmap_storeRecordsInQueue($syncServerId, $recordDetails, $flag, $appid) |
| 85 | 88 | { |
| 86 | 89 | if (!is_array($recordDetails)) |
@@ -182,7 +185,7 @@ discard block |
||
| 182 | 185 | * @param <type> $appid |
| 183 | 186 | * @param <type> $serverid |
| 184 | 187 | * @param <type> $clientid |
| 185 | - * @param <type> $modifiedTime |
|
| 188 | + * @param <type> $clientModifiedTime |
|
| 186 | 189 | * update the mapping of server and client id |
| 187 | 190 | */ |
| 188 | 191 | public function idmap_update($appid, $serverid, $clientid, $clientModifiedTime, $serverModifiedTime, $serverAppId) |
@@ -499,6 +502,9 @@ discard block |
||
| 499 | 502 | return $serverIds; |
| 500 | 503 | } |
| 501 | 504 | |
| 505 | + /** |
|
| 506 | + * @param string $flag |
|
| 507 | + */ |
|
| 502 | 508 | public function convertToQueueRecordFormat($record, $flag) |
| 503 | 509 | { |
| 504 | 510 | if ($flag != $this->delete) |
@@ -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; |