@@ -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); |
@@ -54,10 +56,11 @@ discard block |
||
| 54 | 56 | self::parseOperation($value); |
| 55 | 57 | break; |
| 56 | 58 | case '86': |
| 57 | - if ($this->_lastTag == 'NS') |
|
| 58 | - $this->parseTransaction($value); |
|
| 59 | - else |
|
| 60 | - $this->info .= $value; |
|
| 59 | + if ($this->_lastTag == 'NS') { |
|
| 60 | + $this->parseTransaction($value); |
|
| 61 | + } else { |
|
| 62 | + $this->info .= $value; |
|
| 63 | + } |
|
| 61 | 64 | break; |
| 62 | 65 | default: |
| 63 | 66 | break; |
@@ -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,10 +58,11 @@ discard block |
||
| 56 | 58 | self::parseOperation($value); |
| 57 | 59 | break; |
| 58 | 60 | case '86': |
| 59 | - if ($this->_lastTag == '86') |
|
| 60 | - $this->parseTransaction($value); |
|
| 61 | - else |
|
| 62 | - $this->info .= $value; |
|
| 61 | + if ($this->_lastTag == '86') { |
|
| 62 | + $this->parseTransaction($value); |
|
| 63 | + } else { |
|
| 64 | + $this->info .= $value; |
|
| 65 | + } |
|
| 63 | 66 | $this->lastLine = $value; |
| 64 | 67 | break; |
| 65 | 68 | default: |
@@ -79,8 +82,9 @@ discard block |
||
| 79 | 82 | 'contAccount' => '', |
| 80 | 83 | 'currancy' => '' |
| 81 | 84 | ); |
| 82 | - if ($transaction['code'] == '940') |
|
| 83 | - return; |
|
| 85 | + if ($transaction['code'] == '940') { |
|
| 86 | + return; |
|
| 87 | + } |
|
| 84 | 88 | $delimiter = substr($value, 3, 1); |
| 85 | 89 | $transaction['currancy'] = substr($this->lastLine, 9, 3); |
| 86 | 90 | $transaction['currancyAmount'] = substr($this->lastLine, 12, 14); |
@@ -37,8 +37,9 @@ |
||
| 37 | 37 | $j = array(); |
| 38 | 38 | foreach ($recordParse->operations as $transfers) { |
| 39 | 39 | foreach ($transfers as $key => $value) { |
| 40 | - if ($key == 'indicator' && $value == 'C') |
|
| 41 | - $paymentsIn[] = $transfers; |
|
| 40 | + if ($key == 'indicator' && $value == 'C') { |
|
| 41 | + $paymentsIn[] = $transfers; |
|
| 42 | + } |
|
| 42 | 43 | if ($key == 'third_letter_currency_code') { |
| 43 | 44 | $j[] = $i; |
| 44 | 45 | } |
@@ -125,8 +125,9 @@ |
||
| 125 | 125 | $i = 0; |
| 126 | 126 | foreach ($responseLines as $responseLine) { |
| 127 | 127 | $responseLine = trim($responseLine); |
| 128 | - if (empty($responseLine)) |
|
| 129 | - continue; |
|
| 128 | + if (empty($responseLine)) { |
|
| 129 | + continue; |
|
| 130 | + } |
|
| 130 | 131 | |
| 131 | 132 | $result = array('error' => false, 'statusmessage' => ''); |
| 132 | 133 | if (preg_match("/ERR:(.*)/", trim($responseLine), $matches)) { |
@@ -124,8 +124,9 @@ |
||
| 124 | 124 | $results = array(); |
| 125 | 125 | foreach ($responseLines as $responseLine) { |
| 126 | 126 | $responseLine = trim($responseLine); |
| 127 | - if (empty($responseLine)) |
|
| 128 | - continue; |
|
| 127 | + if (empty($responseLine)) { |
|
| 128 | + continue; |
|
| 129 | + } |
|
| 129 | 130 | |
| 130 | 131 | $result = array('error' => false, 'statusmessage' => ''); |
| 131 | 132 | if (preg_match("/ERR:(.*)/", trim($responseLine), $matches)) { |
@@ -98,10 +98,11 @@ discard block |
||
| 98 | 98 | $currentModule = vglobal('currentModule'); |
| 99 | 99 | |
| 100 | 100 | $sortorder = $this->default_sort_order; |
| 101 | - if (!AppRequest::isEmpty('sorder')) |
|
| 102 | - $sortorder = AppRequest::get('sorder'); |
|
| 103 | - else if ($_SESSION[$currentModule . '_Sort_Order']) |
|
| 104 | - $sortorder = $_SESSION[$currentModule . '_Sort_Order']; |
|
| 101 | + if (!AppRequest::isEmpty('sorder')) { |
|
| 102 | + $sortorder = AppRequest::get('sorder'); |
|
| 103 | + } else if ($_SESSION[$currentModule . '_Sort_Order']) { |
|
| 104 | + $sortorder = $_SESSION[$currentModule . '_Sort_Order']; |
|
| 105 | + } |
|
| 105 | 106 | |
| 106 | 107 | return $sortorder; |
| 107 | 108 | } |
@@ -109,10 +110,11 @@ discard block |
||
| 109 | 110 | public function getOrderBy() |
| 110 | 111 | { |
| 111 | 112 | $orderby = $this->default_order_by; |
| 112 | - if (!AppRequest::isEmpty('order_by')) |
|
| 113 | - $sortorder = AppRequest::get('order_by'); |
|
| 114 | - else if ($_SESSION[$currentModule . '_Order_By']) |
|
| 115 | - $orderby = $_SESSION[$currentModule . '_Order_By']; |
|
| 113 | + if (!AppRequest::isEmpty('order_by')) { |
|
| 114 | + $sortorder = AppRequest::get('order_by'); |
|
| 115 | + } else if ($_SESSION[$currentModule . '_Order_By']) { |
|
| 116 | + $orderby = $_SESSION[$currentModule . '_Order_By']; |
|
| 117 | + } |
|
| 116 | 118 | return $orderby; |
| 117 | 119 | } |
| 118 | 120 | |
@@ -138,8 +140,9 @@ discard block |
||
| 138 | 140 | $query = "SELECT vtiger_crmentity.*, $this->table_name.*"; |
| 139 | 141 | |
| 140 | 142 | // Select Custom Field Table Columns if present |
| 141 | - if (!empty($this->customFieldTable)) |
|
| 142 | - $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
| 143 | + if (!empty($this->customFieldTable)) { |
|
| 144 | + $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
| 145 | + } |
|
| 143 | 146 | |
| 144 | 147 | $query .= " FROM $this->table_name"; |
| 145 | 148 | |
@@ -270,10 +273,11 @@ discard block |
||
| 270 | 273 | |
| 271 | 274 | $where_auto = " vtiger_crmentity.deleted=0"; |
| 272 | 275 | |
| 273 | - if ($where != '') |
|
| 274 | - $query .= " WHERE ($where) && $where_auto"; |
|
| 275 | - else |
|
| 276 | - $query .= " WHERE $where_auto"; |
|
| 276 | + if ($where != '') { |
|
| 277 | + $query .= " WHERE ($where) && $where_auto"; |
|
| 278 | + } else { |
|
| 279 | + $query .= " WHERE $where_auto"; |
|
| 280 | + } |
|
| 277 | 281 | |
| 278 | 282 | require('user_privileges/user_privileges_' . $current_user->id . '.php'); |
| 279 | 283 | require('user_privileges/sharing_privileges_' . $current_user->id . '.php'); |
@@ -302,8 +306,9 @@ discard block |
||
| 302 | 306 | $select_clause = "SELECT %s.%s AS recordid, vtiger_users_last_import.deleted,%s"; |
| 303 | 307 | $select_clause = sprintf($select_clause, $this->table_name, $this->table_index, $table_cols); |
| 304 | 308 | // Select Custom Field Table Columns if present |
| 305 | - if (isset($this->customFieldTable)) |
|
| 306 | - $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
| 309 | + if (isset($this->customFieldTable)) { |
|
| 310 | + $query .= ", " . $this->customFieldTable[0] . ".* "; |
|
| 311 | + } |
|
| 307 | 312 | |
| 308 | 313 | $from_clause = " FROM $this->table_name"; |
| 309 | 314 | |
@@ -239,10 +239,11 @@ discard block |
||
| 239 | 239 | $recordModel = PBXManager_Record_Model::getCleanInstance(); |
| 240 | 240 | $recordModel->saveRecordWithArrray($params); |
| 241 | 241 | |
| 242 | - if ($direction == self::INCOMING_TYPE) |
|
| 243 | - $this->respondToIncomingCall($details); |
|
| 244 | - else |
|
| 245 | - $this->respondToOutgoingCall($params['CustomerNumber']); |
|
| 242 | + if ($direction == self::INCOMING_TYPE) { |
|
| 243 | + $this->respondToIncomingCall($details); |
|
| 244 | + } else { |
|
| 245 | + $this->respondToOutgoingCall($params['CustomerNumber']); |
|
| 246 | + } |
|
| 246 | 247 | } |
| 247 | 248 | |
| 248 | 249 | /** |
@@ -312,8 +313,9 @@ discard block |
||
| 312 | 313 | } else { |
| 313 | 314 | $response .= '<Number>SIP/'; |
| 314 | 315 | $response .= $to; |
| 315 | - if ($numberLength > 5) |
|
| 316 | - $response .= '@' . $this->getOutboundTrunk(); |
|
| 316 | + if ($numberLength > 5) { |
|
| 317 | + $response .= '@' . $this->getOutboundTrunk(); |
|
| 318 | + } |
|
| 317 | 319 | $response .= '</Number>'; |
| 318 | 320 | } |
| 319 | 321 | |
@@ -28,23 +28,25 @@ |
||
| 28 | 28 | $recordModel = Vtiger_Record_Model::getInstanceById($ID, $moduleName); |
| 29 | 29 | $vatId = $recordModel->get('vat_id'); |
| 30 | 30 | } else { |
| 31 | - if (array_key_exists('vat_id', $recordForm)) |
|
| 32 | - $vatId = $recordForm['vat_id']; |
|
| 31 | + if (array_key_exists('vat_id', $recordForm)) { |
|
| 32 | + $vatId = $recordForm['vat_id']; |
|
| 33 | + } |
|
| 33 | 34 | } |
| 34 | 35 | if ($ID != 0 && $ID != '' && !array_key_exists('accountname', $recordForm)) { |
| 35 | 36 | $recordModel = Vtiger_Record_Model::getInstanceById($ID, $moduleName); |
| 36 | 37 | $accountName = $recordModel->get('accountname'); |
| 37 | 38 | } else { |
| 38 | - if (array_key_exists('accountname', $recordForm)) |
|
| 39 | - $accountName = $recordForm['accountname']; |
|
| 39 | + if (array_key_exists('accountname', $recordForm)) { |
|
| 40 | + $accountName = $recordForm['accountname']; |
|
| 41 | + } |
|
| 40 | 42 | } |
| 41 | 43 | |
| 42 | 44 | $moduleModel = Vtiger_Module_Model::getInstance($moduleName); |
| 43 | 45 | $hierarchyField = Vtiger_Field_Model::getInstance('account_id', $moduleModel); |
| 44 | 46 | if ($hierarchyField->isActiveField()) { |
| 45 | - if (array_key_exists('account_id', $recordForm)) |
|
| 46 | - $hierarchyValue = $recordForm['account_id']; |
|
| 47 | - elseif ($ID != 0 && $ID != '' && !array_key_exists('account_id', $recordForm)) { |
|
| 47 | + if (array_key_exists('account_id', $recordForm)) { |
|
| 48 | + $hierarchyValue = $recordForm['account_id']; |
|
| 49 | + } elseif ($ID != 0 && $ID != '' && !array_key_exists('account_id', $recordForm)) { |
|
| 48 | 50 | $recordModel = Vtiger_Record_Model::getInstanceById($ID, $moduleName); |
| 49 | 51 | $hierarchyValue = $recordModel->get('account_id'); |
| 50 | 52 | } |
@@ -296,7 +296,7 @@ |
||
| 296 | 296 | $buffer = fread($handle, filesize($validate)); |
| 297 | 297 | if (substr_count($buffer, $authkey) < $i) |
| 298 | 298 | return -1; |
| 299 | - }else { |
|
| 299 | + } else { |
|
| 300 | 300 | return -1; |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -118,10 +118,11 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | |
| 120 | 120 | \App\Log::trace("Entering getSortOrder() method ..."); |
| 121 | - if (AppRequest::has('sorder')) |
|
| 122 | - $sorder = $this->db->sql_escape_string(AppRequest::get('sorder')); |
|
| 123 | - else |
|
| 124 | - $sorder = (($_SESSION['USERS_SORT_ORDER'] != '') ? ($_SESSION['USERS_SORT_ORDER']) : ($this->default_sort_order)); |
|
| 121 | + if (AppRequest::has('sorder')) { |
|
| 122 | + $sorder = $this->db->sql_escape_string(AppRequest::get('sorder')); |
|
| 123 | + } else { |
|
| 124 | + $sorder = (($_SESSION['USERS_SORT_ORDER'] != '') ? ($_SESSION['USERS_SORT_ORDER']) : ($this->default_sort_order)); |
|
| 125 | + } |
|
| 125 | 126 | \App\Log::trace("Exiting getSortOrder method ..."); |
| 126 | 127 | return $sorder; |
| 127 | 128 | } |
@@ -140,10 +141,11 @@ discard block |
||
| 140 | 141 | $use_default_order_by = $this->default_order_by; |
| 141 | 142 | } |
| 142 | 143 | |
| 143 | - if (AppRequest::has('order_by')) |
|
| 144 | - $order_by = $this->db->sql_escape_string(AppRequest::get('order_by')); |
|
| 145 | - else |
|
| 146 | - $order_by = (($_SESSION['USERS_ORDER_BY'] != '') ? ($_SESSION['USERS_ORDER_BY']) : ($use_default_order_by)); |
|
| 144 | + if (AppRequest::has('order_by')) { |
|
| 145 | + $order_by = $this->db->sql_escape_string(AppRequest::get('order_by')); |
|
| 146 | + } else { |
|
| 147 | + $order_by = (($_SESSION['USERS_ORDER_BY'] != '') ? ($_SESSION['USERS_ORDER_BY']) : ($use_default_order_by)); |
|
| 148 | + } |
|
| 147 | 149 | \App\Log::trace("Exiting getOrderBy method ..."); |
| 148 | 150 | return $order_by; |
| 149 | 151 | } |
@@ -157,10 +159,11 @@ discard block |
||
| 157 | 159 | public function setPreference($name, $value) |
| 158 | 160 | { |
| 159 | 161 | if (!isset($this->user_preferences)) { |
| 160 | - if (isset($_SESSION["USER_PREFERENCES"])) |
|
| 161 | - $this->user_preferences = $_SESSION["USER_PREFERENCES"]; |
|
| 162 | - else |
|
| 163 | - $this->user_preferences = []; |
|
| 162 | + if (isset($_SESSION["USER_PREFERENCES"])) { |
|
| 163 | + $this->user_preferences = $_SESSION["USER_PREFERENCES"]; |
|
| 164 | + } else { |
|
| 165 | + $this->user_preferences = []; |
|
| 166 | + } |
|
| 164 | 167 | } |
| 165 | 168 | if (!array_key_exists($name, $this->user_preferences) || $this->user_preferences[$name] != $value) { |
| 166 | 169 | \App\Log::trace("Saving To Preferences:" . $name . "=" . $value); |
@@ -284,9 +287,10 @@ discard block |
||
| 284 | 287 | $authkey = base64_decode($authkey); |
| 285 | 288 | if (file_exists($validate) && $handle = fopen($validate, 'rb', true)) { |
| 286 | 289 | $buffer = fread($handle, filesize($validate)); |
| 287 | - if (substr_count($buffer, $authkey) < $i) |
|
| 288 | - return -1; |
|
| 289 | - }else { |
|
| 290 | + if (substr_count($buffer, $authkey) < $i) { |
|
| 291 | + return -1; |
|
| 292 | + } |
|
| 293 | + } else { |
|
| 290 | 294 | return -1; |
| 291 | 295 | } |
| 292 | 296 | } |
@@ -378,8 +382,9 @@ discard block |
||
| 378 | 382 | } |
| 379 | 383 | \App\Log::trace("Starting user load for $usr_name"); |
| 380 | 384 | |
| 381 | - if (!isset($this->column_fields["user_name"]) || $this->column_fields["user_name"] == "" || !isset($user_password) || $user_password == "") |
|
| 382 | - return null; |
|
| 385 | + if (!isset($this->column_fields["user_name"]) || $this->column_fields["user_name"] == "" || !isset($user_password) || $user_password == "") { |
|
| 386 | + return null; |
|
| 387 | + } |
|
| 383 | 388 | |
| 384 | 389 | $authCheck = false; |
| 385 | 390 | $authCheck = $this->doLogin($user_password); |
@@ -407,8 +412,9 @@ discard block |
||
| 407 | 412 | $this->loadPreferencesFromDB($row['user_preferences']); |
| 408 | 413 | |
| 409 | 414 | |
| 410 | - if ($row['status'] != "Inactive") |
|
| 411 | - $this->authenticated = true; |
|
| 415 | + if ($row['status'] != "Inactive") { |
|
| 416 | + $this->authenticated = true; |
|
| 417 | + } |
|
| 412 | 418 | |
| 413 | 419 | unset($_SESSION['loginattempts']); |
| 414 | 420 | return $this; |
@@ -940,8 +946,9 @@ discard block |
||
| 940 | 946 | $db = App\Db::getInstance(); |
| 941 | 947 | //to get the owner id |
| 942 | 948 | $ownerid = $this->column_fields['assigned_user_id']; |
| 943 | - if (!isset($ownerid) || $ownerid == '') |
|
| 944 | - $ownerid = $currentUserId; |
|
| 949 | + if (!isset($ownerid) || $ownerid == '') { |
|
| 950 | + $ownerid = $currentUserId; |
|
| 951 | + } |
|
| 945 | 952 | $fileInstance = \App\Fields\File::loadFromRequest($fileDetails); |
| 946 | 953 | if (!$fileInstance->validate('image')) { |
| 947 | 954 | \App\Log::trace('Skip the save attachment process.'); |
@@ -1202,10 +1209,10 @@ discard block |
||
| 1202 | 1209 | $result = $adb->pquery($qry, [$id, $this->homeorder_array[$i]]); |
| 1203 | 1210 | } |
| 1204 | 1211 | } |
| 1205 | - if ($save_array != "") |
|
| 1206 | - $homeorder = implode(',', $save_array); |
|
| 1207 | - } |
|
| 1208 | - else { |
|
| 1212 | + if ($save_array != "") { |
|
| 1213 | + $homeorder = implode(',', $save_array); |
|
| 1214 | + } |
|
| 1215 | + } else { |
|
| 1209 | 1216 | $this->insertUserdetails('postinstall'); |
| 1210 | 1217 | } |
| 1211 | 1218 | \App\Log::trace("Exiting from function saveHomeOrder($id)"); |