@@ -37,17 +37,19 @@ |
||
37 | 37 | $sourceData = $entity->column_fields; |
38 | 38 | if ($sourceModule == 'HelpDesk') { |
39 | 39 | $sourceData['contact_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['contact_id']); |
40 | - if (vtlib\Functions::getCRMRecordType($sourceData['parent_id']) != 'Accounts') |
|
41 | - unset($sourceData['parent_id']); |
|
42 | - else |
|
43 | - $sourceData['account_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['parent_id']); |
|
40 | + if (vtlib\Functions::getCRMRecordType($sourceData['parent_id']) != 'Accounts') { |
|
41 | + unset($sourceData['parent_id']); |
|
42 | + } else { |
|
43 | + $sourceData['account_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['parent_id']); |
|
44 | + } |
|
44 | 45 | } else if ($sourceModule == 'Project') { |
45 | 46 | $query = sprintf("select * from vtiger_account where accountid = %s", $sourceData['linktoaccountscontacts']); |
46 | 47 | $ifExist = $adb->query($query, true, "Błąd podczas pobierania danych z vtiger_crmentityrel"); |
47 | - if ($adb->num_rows($ifExist) > 0) |
|
48 | - $sourceData['account_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['linktoaccountscontacts']); |
|
49 | - else |
|
50 | - $sourceData['contact_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['linktoaccountscontacts']); |
|
48 | + if ($adb->num_rows($ifExist) > 0) { |
|
49 | + $sourceData['account_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['linktoaccountscontacts']); |
|
50 | + } else { |
|
51 | + $sourceData['contact_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['linktoaccountscontacts']); |
|
52 | + } |
|
51 | 53 | } |
52 | 54 | } |
53 | 55 |
@@ -96,10 +96,11 @@ discard block |
||
96 | 96 | $currentModule = vglobal('currentModule'); |
97 | 97 | |
98 | 98 | $sortorder = $this->default_sort_order; |
99 | - if (!AppRequest::isEmpty('sorder')) |
|
100 | - $sortorder = $this->db->sql_escape_string(AppRequest::get('sorder')); |
|
101 | - else if ($_SESSION[$currentModule . '_Sort_Order']) |
|
102 | - $sortorder = $_SESSION[$currentModule . '_Sort_Order']; |
|
99 | + if (!AppRequest::isEmpty('sorder')) { |
|
100 | + $sortorder = $this->db->sql_escape_string(AppRequest::get('sorder')); |
|
101 | + } else if ($_SESSION[$currentModule . '_Sort_Order']) { |
|
102 | + $sortorder = $_SESSION[$currentModule . '_Sort_Order']; |
|
103 | + } |
|
103 | 104 | |
104 | 105 | return $sortorder; |
105 | 106 | } |
@@ -114,10 +115,11 @@ discard block |
||
114 | 115 | } |
115 | 116 | |
116 | 117 | $orderby = $use_default_order_by; |
117 | - if (!AppRequest::isEmpty('order_by')) |
|
118 | - $orderby = $this->db->sql_escape_string(AppRequest::get('order_by')); |
|
119 | - else if ($_SESSION[$currentModule . '_Order_By']) |
|
120 | - $orderby = $_SESSION[$currentModule . '_Order_By']; |
|
118 | + if (!AppRequest::isEmpty('order_by')) { |
|
119 | + $orderby = $this->db->sql_escape_string(AppRequest::get('order_by')); |
|
120 | + } else if ($_SESSION[$currentModule . '_Order_By']) { |
|
121 | + $orderby = $_SESSION[$currentModule . '_Order_By']; |
|
122 | + } |
|
121 | 123 | return $orderby; |
122 | 124 | } |
123 | 125 | |
@@ -146,8 +148,9 @@ discard block |
||
146 | 148 | $joinedTables = array(); |
147 | 149 | |
148 | 150 | // Select Custom Field Table Columns if present |
149 | - if (!empty($this->customFieldTable)) |
|
150 | - $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
151 | + if (!empty($this->customFieldTable)) { |
|
152 | + $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
153 | + } |
|
151 | 154 | |
152 | 155 | $query .= " FROM $this->table_name"; |
153 | 156 | |
@@ -285,10 +288,11 @@ discard block |
||
285 | 288 | |
286 | 289 | $where_auto = " vtiger_crmentity.deleted=0"; |
287 | 290 | |
288 | - if ($where != '') |
|
289 | - $query .= " WHERE ($where) && $where_auto"; |
|
290 | - else |
|
291 | - $query .= " WHERE $where_auto"; |
|
291 | + if ($where != '') { |
|
292 | + $query .= " WHERE ($where) && $where_auto"; |
|
293 | + } else { |
|
294 | + $query .= " WHERE $where_auto"; |
|
295 | + } |
|
292 | 296 | |
293 | 297 | require('user_privileges/user_privileges_' . $current_user->id . '.php'); |
294 | 298 | require('user_privileges/sharing_privileges_' . $current_user->id . '.php'); |
@@ -317,8 +321,9 @@ discard block |
||
317 | 321 | $select_clause = sprintf('SELECT %s.%s AS recordid, vtiger_users_last_import.deleted, %s', $this->table_name, $this->table_index, $table_cols); |
318 | 322 | |
319 | 323 | // Select Custom Field Table Columns if present |
320 | - if (isset($this->customFieldTable)) |
|
321 | - $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
324 | + if (isset($this->customFieldTable)) { |
|
325 | + $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
326 | + } |
|
322 | 327 | |
323 | 328 | $from_clause = " FROM $this->table_name"; |
324 | 329 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $db = PearDatabase::getInstance(); |
19 | 19 | |
20 | 20 | $query = 'UPDATE vtiger_field SET '; |
21 | - $query .=' quickcreatesequence= CASE '; |
|
21 | + $query .= ' quickcreatesequence= CASE '; |
|
22 | 22 | foreach ($blockFieldSequence as $newFieldSequence) { |
23 | 23 | $fieldId = $newFieldSequence['fieldid']; |
24 | 24 | $sequence = $newFieldSequence['sequence']; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $query .= ' WHEN fieldid=' . $fieldId . ' THEN ' . $sequence; |
28 | 28 | } |
29 | 29 | |
30 | - $query .=' END '; |
|
30 | + $query .= ' END '; |
|
31 | 31 | $query .= sprintf(' WHERE fieldid IN (%s)', generateQuestionMarks($fieldIdList)); |
32 | 32 | $db->pquery($query, array($fieldIdList)); |
33 | 33 | } |
@@ -37,13 +37,15 @@ |
||
37 | 37 | //To get the first element |
38 | 38 | $firstElement = reset($menuModelsList); |
39 | 39 | $sourceModule = array($firstElement->get('name')); |
40 | - } else |
|
41 | - $sourceModule = array($sourceModule); |
|
40 | + } else { |
|
41 | + $sourceModule = array($sourceModule); |
|
42 | + } |
|
42 | 43 | |
43 | 44 | $quickCreateContents = array(); |
44 | 45 | |
45 | - if (in_array('Calendar', $sourceModule)) |
|
46 | - $sourceModule = array('Calendar', 'Events'); |
|
46 | + if (in_array('Calendar', $sourceModule)) { |
|
47 | + $sourceModule = array('Calendar', 'Events'); |
|
48 | + } |
|
47 | 49 | |
48 | 50 | foreach ($sourceModule as $module) { |
49 | 51 | $recordModel = Vtiger_Record_Model::getCleanInstance($module); |
@@ -237,10 +237,11 @@ |
||
237 | 237 | $viewer->assign('MODULENAME', $moduleName); |
238 | 238 | $viewer->assign('SAVE', 'Save'); |
239 | 239 | $viewer->assign('CANCEL', 'Cancel'); |
240 | - if (\vtlib\Functions::userIsAdministrator($current_user)) |
|
241 | - $viewer->assign('ISADMIN', 1); |
|
242 | - else |
|
243 | - $viewer->assign('ISADMIN', 0); |
|
240 | + if (\vtlib\Functions::userIsAdministrator($current_user)) { |
|
241 | + $viewer->assign('ISADMIN', 1); |
|
242 | + } else { |
|
243 | + $viewer->assign('ISADMIN', 0); |
|
244 | + } |
|
244 | 245 | |
245 | 246 | // encryption variables |
246 | 247 | $viewer->assign('CONFIG', (!$config ? false : array('key' => $config['key']))); |
@@ -52,8 +52,9 @@ discard block |
||
52 | 52 | $query = "SELECT vtiger_crmentity.*, $this->table_name.*"; |
53 | 53 | |
54 | 54 | // Select Custom Field Table Columns if present |
55 | - if (!empty($this->customFieldTable)) |
|
56 | - $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
55 | + if (!empty($this->customFieldTable)) { |
|
56 | + $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
57 | + } |
|
57 | 58 | |
58 | 59 | $query .= " FROM $this->table_name"; |
59 | 60 | |
@@ -180,10 +181,11 @@ discard block |
||
180 | 181 | $query .= $this->getNonAdminAccessControlQuery($thismodule, $current_user); |
181 | 182 | $where_auto = " vtiger_crmentity.deleted=0"; |
182 | 183 | |
183 | - if ($where != '') |
|
184 | - $query .= " WHERE ($where) && $where_auto"; |
|
185 | - else |
|
186 | - $query .= " WHERE $where_auto"; |
|
184 | + if ($where != '') { |
|
185 | + $query .= " WHERE ($where) && $where_auto"; |
|
186 | + } else { |
|
187 | + $query .= " WHERE $where_auto"; |
|
188 | + } |
|
187 | 189 | |
188 | 190 | return $query; |
189 | 191 | } |
@@ -196,8 +198,9 @@ discard block |
||
196 | 198 | $select_clause = sprintf("SELECT %s.%s AS recordid, vtiger_users_last_import.deleted,%s", $this->table_name, $this->table_index, $table_cols); |
197 | 199 | |
198 | 200 | // Select Custom Field Table Columns if present |
199 | - if (isset($this->customFieldTable)) |
|
200 | - $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
201 | + if (isset($this->customFieldTable)) { |
|
202 | + $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
203 | + } |
|
201 | 204 | |
202 | 205 | $from_clause = " FROM $this->table_name"; |
203 | 206 |
@@ -22,10 +22,11 @@ |
||
22 | 22 | $modelClassName = Vtiger_Loader::getComponentClassName('Model', 'TransferOwnership', $module); |
23 | 23 | $transferModel = new $modelClassName(); |
24 | 24 | |
25 | - if (empty($record)) |
|
26 | - $recordIds = $this->getBaseModuleRecordIds($request); |
|
27 | - else |
|
28 | - $recordIds = [$record]; |
|
25 | + if (empty($record)) { |
|
26 | + $recordIds = $this->getBaseModuleRecordIds($request); |
|
27 | + } else { |
|
28 | + $recordIds = [$record]; |
|
29 | + } |
|
29 | 30 | if (!empty($recordIds)) { |
30 | 31 | $transferModel->transferRecordsOwnership($module, $transferOwnerId, $recordIds); |
31 | 32 | } |
@@ -144,7 +144,7 @@ |
||
144 | 144 | $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($editViewLinks); |
145 | 145 | } |
146 | 146 | |
147 | - if (($recordModel->isEditable() && $recordModel->editFieldByModalPermission() ) || $recordModel->editFieldByModalPermission(true)) { |
|
147 | + if (($recordModel->isEditable() && $recordModel->editFieldByModalPermission()) || $recordModel->editFieldByModalPermission(true)) { |
|
148 | 148 | $fieldByEditData = $recordModel->getFieldToEditByModal(); |
149 | 149 | $basicActionLink = [ |
150 | 150 | 'linktype' => 'DETAILVIEW', |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Function to get Module instance |
22 | - * @return Vtiger_Module_Model |
|
22 | + * @return boolean |
|
23 | 23 | */ |
24 | 24 | public function getModule() |
25 | 25 | { |
@@ -306,8 +306,9 @@ |
||
306 | 306 | */ |
307 | 307 | public function getWidgets() |
308 | 308 | { |
309 | - if (count($this->widgetsList) > 0) |
|
310 | - return; |
|
309 | + if (count($this->widgetsList) > 0) { |
|
310 | + return; |
|
311 | + } |
|
311 | 312 | $moduleModel = $this->getModule(); |
312 | 313 | $module = $this->getModuleName(); |
313 | 314 | $record = $this->getRecord()->getId(); |
@@ -39,8 +39,9 @@ |
||
39 | 39 | $fieldModel->set('fieldvalue', $recordModel->get($fieldName)); |
40 | 40 | } else { |
41 | 41 | $defaultValue = $fieldModel->getDefaultFieldValue(); |
42 | - if (!empty($defaultValue) && !$recordId) |
|
43 | - $fieldModel->set('fieldvalue', $defaultValue); |
|
42 | + if (!empty($defaultValue) && !$recordId) { |
|
43 | + $fieldModel->set('fieldvalue', $defaultValue); |
|
44 | + } |
|
44 | 45 | } |
45 | 46 | $values[$blockLabel][$fieldName] = $fieldModel; |
46 | 47 | } |