@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Function to get the Module to which the record belongs |
72 | - * @return Vtiger_Module_Model |
|
72 | + * @return boolean |
|
73 | 73 | */ |
74 | 74 | public function getModule() |
75 | 75 | { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | /** |
220 | 220 | * Function to retieve display value for a field |
221 | 221 | * @param <String> $fieldName - field name for which values need to get |
222 | - * @return <String> |
|
222 | + * @return string |
|
223 | 223 | */ |
224 | 224 | public function getDisplayValue($fieldName, $recordId = false, $rawText = false) |
225 | 225 | { |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | /** |
326 | 326 | * Static Function to get the instance of the Vtiger Record Model given the recordid and the module name |
327 | 327 | * @param <Number> $recordId |
328 | - * @param <String> $moduleName |
|
328 | + * @param <String> $module |
|
329 | 329 | * @return Vtiger_Record_Model or Module Specific Record Model instance |
330 | 330 | */ |
331 | 331 | public static function getInstanceById($recordId, $module = null) |
@@ -493,7 +493,6 @@ discard block |
||
493 | 493 | |
494 | 494 | /** |
495 | 495 | * Function to get Display value for RelatedList |
496 | - * @param <String> $value |
|
497 | 496 | * @return <String> |
498 | 497 | */ |
499 | 498 | public function getRelatedListDisplayValue($fieldName) |
@@ -596,6 +595,7 @@ discard block |
||
596 | 595 | /** |
597 | 596 | * Function to set record module field values |
598 | 597 | * @param parent record model |
598 | + * @param Vtiger_Record_Model $parentRecordModel |
|
599 | 599 | */ |
600 | 600 | public function setRecordFieldValues($parentRecordModel) |
601 | 601 | { |
@@ -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; |
@@ -32,6 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | } |
34 | 34 | |
35 | + /** |
|
36 | + * @param boolean $interactive |
|
37 | + */ |
|
35 | 38 | public function setArguments($args, $interactive) |
36 | 39 | { |
37 | 40 | $this->arguments = $args; |
@@ -156,11 +159,18 @@ discard block |
||
156 | 159 | } while (true); |
157 | 160 | } |
158 | 161 | |
162 | + /** |
|
163 | + * @return string |
|
164 | + */ |
|
159 | 165 | protected function toAlphaNumeric($value) |
160 | 166 | { |
161 | 167 | return preg_replace("/[^a-zA-Z0-9_]/", "", $value); |
162 | 168 | } |
163 | 169 | |
170 | + /** |
|
171 | + * @param string $dir |
|
172 | + * @param string $file_pattern |
|
173 | + */ |
|
164 | 174 | protected function findFiles($dir, $file_pattern, &$files) |
165 | 175 | { |
166 | 176 | $items = glob($dir . '/*', GLOB_NOSORT); |
@@ -257,6 +267,9 @@ discard block |
||
257 | 267 | echo "DONE.\n"; |
258 | 268 | } |
259 | 269 | |
270 | + /** |
|
271 | + * @param string $name |
|
272 | + */ |
|
260 | 273 | public function find($name) |
261 | 274 | { |
262 | 275 | return vtlib\Module::getInstance($name); |
@@ -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); |
@@ -53,6 +53,7 @@ discard block |
||
53 | 53 | * Enable or Disable sharing access control to module |
54 | 54 | * @param Module Instance of the module to use |
55 | 55 | * @param Boolean true to enable sharing access, false disable sharing access |
56 | + * @param ModuleBasic $moduleInstance |
|
56 | 57 | * @access private |
57 | 58 | */ |
58 | 59 | static function allowSharing($moduleInstance, $enable = true) |
@@ -66,6 +67,7 @@ discard block |
||
66 | 67 | /** |
67 | 68 | * Initialize sharing access. |
68 | 69 | * @param Module Instance of the module to use |
70 | + * @param ModuleBasic $moduleInstance |
|
69 | 71 | * @access private |
70 | 72 | * @internal This method is called from Module during creation. |
71 | 73 | */ |
@@ -139,6 +141,8 @@ discard block |
||
139 | 141 | * @param String Tool (action name) like Import, Export, Merge |
140 | 142 | * @param Boolean true to enable tool, false to disable |
141 | 143 | * @param Integer (optional) profile id to use, false applies to all profile. |
144 | + * @param ModuleBasic $moduleInstance |
|
145 | + * @param boolean $flag |
|
142 | 146 | * @access private |
143 | 147 | */ |
144 | 148 | static function updateTool($moduleInstance, $toolAction, $flag, $profileid = false) |
@@ -179,6 +183,7 @@ discard block |
||
179 | 183 | /** |
180 | 184 | * Delete tool (actions) of the module |
181 | 185 | * @param Module Instance of module to use |
186 | + * @param ModuleBasic $moduleInstance |
|
182 | 187 | */ |
183 | 188 | static function deleteTools($moduleInstance) |
184 | 189 | { |
@@ -108,16 +108,18 @@ |
||
108 | 108 | |
109 | 109 | $permission_text = strtolower($permission_text); |
110 | 110 | |
111 | - if ($permission_text == 'public_readonly') |
|
112 | - $permission = 0; |
|
113 | - else if ($permission_text == 'public_readwrite') |
|
114 | - $permission = 1; |
|
115 | - else if ($permission_text == 'public_readwritedelete') |
|
116 | - $permission = 2; |
|
117 | - else if ($permission_text == 'private') |
|
118 | - $permission = 3; |
|
119 | - else |
|
120 | - $permission = 2; // public_readwritedelete is default |
|
111 | + if ($permission_text == 'public_readonly') { |
|
112 | + $permission = 0; |
|
113 | + } else if ($permission_text == 'public_readwrite') { |
|
114 | + $permission = 1; |
|
115 | + } else if ($permission_text == 'public_readwritedelete') { |
|
116 | + $permission = 2; |
|
117 | + } else if ($permission_text == 'private') { |
|
118 | + $permission = 3; |
|
119 | + } else { |
|
120 | + $permission = 2; |
|
121 | + } |
|
122 | + // public_readwritedelete is default |
|
121 | 123 | |
122 | 124 | $editstatus = 0; // 0 or 1 |
123 | 125 |
@@ -78,6 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * Create vtiger CRM block |
80 | 80 | * @access private |
81 | + * @param boolean $moduleInstance |
|
81 | 82 | */ |
82 | 83 | public function __create($moduleInstance) |
83 | 84 | { |
@@ -150,7 +151,8 @@ discard block |
||
150 | 151 | /** |
151 | 152 | * Add field to this block |
152 | 153 | * @param Field Instance of field to add to this block. |
153 | - * @return Reference to this block instance |
|
154 | + * @param Field $fieldInstance |
|
155 | + * @return Block to this block instance |
|
154 | 156 | */ |
155 | 157 | public function addField($fieldInstance) |
156 | 158 | { |
@@ -226,6 +228,7 @@ discard block |
||
226 | 228 | * Delete all blocks associated with module |
227 | 229 | * @param Module Instnace of module to use |
228 | 230 | * @param Boolean true to delete associated fields, false otherwise |
231 | + * @param ModuleBasic $moduleInstance |
|
229 | 232 | * @access private |
230 | 233 | */ |
231 | 234 | static function deleteForModule($moduleInstance, $recursive = true) |
@@ -86,8 +86,9 @@ discard block |
||
86 | 86 | $this->module = $moduleInstance; |
87 | 87 | |
88 | 88 | $this->id = $this->__getUniqueId(); |
89 | - if (!$this->sequence) |
|
90 | - $this->sequence = $this->__getNextSequence(); |
|
89 | + if (!$this->sequence) { |
|
90 | + $this->sequence = $this->__getNextSequence(); |
|
91 | + } |
|
91 | 92 | if ($this->display_status != 0) { |
92 | 93 | $this->display_status = 1; |
93 | 94 | } |
@@ -126,10 +127,11 @@ discard block |
||
126 | 127 | */ |
127 | 128 | public function save($moduleInstance = false) |
128 | 129 | { |
129 | - if ($this->id) |
|
130 | - $this->__update(); |
|
131 | - else |
|
132 | - $this->__create($moduleInstance); |
|
130 | + if ($this->id) { |
|
131 | + $this->__update(); |
|
132 | + } else { |
|
133 | + $this->__create($moduleInstance); |
|
134 | + } |
|
133 | 135 | return $this->id; |
134 | 136 | } |
135 | 137 | |
@@ -141,8 +143,9 @@ discard block |
||
141 | 143 | { |
142 | 144 | if ($recursive) { |
143 | 145 | $fields = Field::getAllForBlock($this); |
144 | - foreach ($fields as $fieldInstance) |
|
145 | - $fieldInstance->delete($recursive); |
|
146 | + foreach ($fields as $fieldInstance) { |
|
147 | + $fieldInstance->delete($recursive); |
|
148 | + } |
|
146 | 149 | } |
147 | 150 | $this->__delete(); |
148 | 151 | } |
@@ -231,8 +234,9 @@ discard block |
||
231 | 234 | static function deleteForModule($moduleInstance, $recursive = true) |
232 | 235 | { |
233 | 236 | $adb = \PearDatabase::getInstance(); |
234 | - if ($recursive) |
|
235 | - Field::deleteForModule($moduleInstance); |
|
237 | + if ($recursive) { |
|
238 | + Field::deleteForModule($moduleInstance); |
|
239 | + } |
|
236 | 240 | $adb->delete('vtiger_module_dashboard_blocks', 'tabid = ?', [$moduleInstance->getId()]); |
237 | 241 | $adb->pquery('DELETE vtiger_blocks, vtiger_blocks_hide' |
238 | 242 | . ' FROM vtiger_blocks' |
@@ -36,7 +36,8 @@ discard block |
||
36 | 36 | |
37 | 37 | /** |
38 | 38 | * set the value to the data |
39 | - * @param type $value,$key |
|
39 | + * @param string $key |
|
40 | + * @param integer $value |
|
40 | 41 | */ |
41 | 42 | public function set($key, $value) |
42 | 43 | { |
@@ -179,6 +180,7 @@ discard block |
||
179 | 180 | |
180 | 181 | /** |
181 | 182 | * Helper function to check the status value. |
183 | + * @param integer $value |
|
182 | 184 | */ |
183 | 185 | public function statusEqual($value) |
184 | 186 | { |
@@ -212,6 +214,7 @@ discard block |
||
212 | 214 | |
213 | 215 | /** |
214 | 216 | * Update status |
217 | + * @param integer $status |
|
215 | 218 | */ |
216 | 219 | public function updateStatus($status) |
217 | 220 | { |
@@ -287,6 +290,7 @@ discard block |
||
287 | 290 | |
288 | 291 | /** |
289 | 292 | * Execute SQL query silently (even when table doesn't exist) |
293 | + * @param string $sql |
|
290 | 294 | */ |
291 | 295 | protected static function querySilent($sql, $params = false) |
292 | 296 | { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | { |
163 | 163 | return $this->data['description']; |
164 | 164 | } |
165 | - public function getLockStatus(){ |
|
165 | + public function getLockStatus() { |
|
166 | 166 | return isset($this->data['lockStatus']) ? $this->data['lockStatus'] : false; |
167 | 167 | } |
168 | 168 | /** |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | $time = time(); |
254 | 254 | $query = 'UPDATE vtiger_cron_task SET lastend = ?'; |
255 | 255 | $params = [$time]; |
256 | - if(!$lock){ |
|
256 | + if (!$lock) { |
|
257 | 257 | $query .= ' ,status = ?'; |
258 | - $params []= self::$STATUS_ENABLED; |
|
258 | + $params [] = self::$STATUS_ENABLED; |
|
259 | 259 | } |
260 | 260 | $query .= ' WHERE id = ?'; |
261 | - $params []= $this->getId(); |
|
261 | + $params [] = $this->getId(); |
|
262 | 262 | self::querySilent($query, $params); |
263 | 263 | return $this->set('lastend', $time); |
264 | 264 | } |
@@ -80,6 +80,7 @@ |
||
80 | 80 | * Trigger event based on CRM Record |
81 | 81 | * @param String Name of the Event to trigger |
82 | 82 | * @param Integer CRM record id on which event needs to be triggered. |
83 | + * @param string $eventname |
|
83 | 84 | */ |
84 | 85 | static function trigger($eventname, $crmid) |
85 | 86 | { |
@@ -83,8 +83,9 @@ |
||
83 | 83 | */ |
84 | 84 | static function trigger($eventname, $crmid) |
85 | 85 | { |
86 | - if (!self::hasSupport()) |
|
87 | - return; |
|
86 | + if (!self::hasSupport()) { |
|
87 | + return; |
|
88 | + } |
|
88 | 89 | |
89 | 90 | $adb = \PearDatabase::getInstance(); |
90 | 91 | $checkres = $adb->pquery("SELECT setype, crmid, deleted FROM vtiger_crmentity WHERE crmid=?", Array($crmid)); |
@@ -146,6 +146,7 @@ |
||
146 | 146 | /** |
147 | 147 | * Create this field instance |
148 | 148 | * @param vtlib\Block Instance of the block to use |
149 | + * @param boolean $blockInstance |
|
149 | 150 | * @access private |
150 | 151 | */ |
151 | 152 | public function __create($blockInstance) |
@@ -173,16 +173,19 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | // Initialize other variables which are not done |
176 | - if (!$this->table) |
|
177 | - $this->table = $moduleInstance->basetable; |
|
176 | + if (!$this->table) { |
|
177 | + $this->table = $moduleInstance->basetable; |
|
178 | + } |
|
178 | 179 | if (!$this->column) { |
179 | 180 | $this->column = strtolower($this->name); |
180 | - if (!$this->columntype) |
|
181 | - $this->columntype = 'VARCHAR(100)'; |
|
181 | + if (!$this->columntype) { |
|
182 | + $this->columntype = 'VARCHAR(100)'; |
|
183 | + } |
|
182 | 184 | } |
183 | 185 | |
184 | - if (!$this->label) |
|
185 | - $this->label = $this->name; |
|
186 | + if (!$this->label) { |
|
187 | + $this->label = $this->name; |
|
188 | + } |
|
186 | 189 | |
187 | 190 | $adb->pquery('INSERT INTO vtiger_field (tabid, fieldid, columnname, tablename, generatedtype, |
188 | 191 | uitype, fieldname, fieldlabel, readonly, presence, defaultvalue, maximumlength, sequence, |
@@ -199,8 +202,9 @@ discard block |
||
199 | 202 | |
200 | 203 | if (!empty($this->columntype)) { |
201 | 204 | $columntype = $this->columntype; |
202 | - if ($this->uitype == 10) |
|
203 | - $columntype .= ', ADD INDEX (`' . $this->column . '`)'; |
|
205 | + if ($this->uitype == 10) { |
|
206 | + $columntype .= ', ADD INDEX (`' . $this->column . '`)'; |
|
207 | + } |
|
204 | 208 | Utils::AddColumn($this->table, $this->column, $columntype); |
205 | 209 | } |
206 | 210 | |
@@ -275,10 +279,11 @@ discard block |
||
275 | 279 | */ |
276 | 280 | public function save($blockInstance = false) |
277 | 281 | { |
278 | - if ($this->id) |
|
279 | - $this->__update(); |
|
280 | - else |
|
281 | - $this->__create($blockInstance); |
|
282 | + if ($this->id) { |
|
283 | + $this->__update(); |
|
284 | + } else { |
|
285 | + $this->__create($blockInstance); |
|
286 | + } |
|
282 | 287 | return $this->id; |
283 | 288 | } |
284 | 289 |