@@ -176,8 +176,7 @@ |
||
176 | 176 | |
177 | 177 | echo "<th>".ucfirst($field_val)."</th>"; |
178 | 178 | |
179 | - } |
|
180 | - else { |
|
179 | + } else { |
|
181 | 180 | echo "<td class='portlet-content'>" . $field_val . "</td>"; |
182 | 181 | $cnt++; |
183 | 182 | } |
@@ -37,7 +37,9 @@ discard block |
||
37 | 37 | ini_set("memory_limit", "2048M"); |
38 | 38 | ini_set("max_execution_time", "259200"); |
39 | 39 | ini_set("upload_max_filesize", "200M"); |
40 | - if ($this->session->userdata('user_login') == FALSE) redirect(base_url() . '/astpp/login'); |
|
40 | + if ($this->session->userdata('user_login') == FALSE) { |
|
41 | + redirect(base_url() . '/astpp/login'); |
|
42 | + } |
|
41 | 43 | } |
42 | 44 | |
43 | 45 | function termination_rates_list() |
@@ -125,24 +127,20 @@ discard block |
||
125 | 127 | $data['check_header'] = $check_header; |
126 | 128 | $data['page_title'] = 'Termination Rates Preview'; |
127 | 129 | $this->session->set_userdata('import_termination_rate_csv', $actual_file_name); |
128 | - } |
|
129 | - else |
|
130 | + } else |
|
130 | 131 | { |
131 | 132 | $data['error'] = "File Uploading Fail Please Try Again"; |
132 | 133 | } |
133 | 134 | } |
134 | - } |
|
135 | - else |
|
135 | + } else |
|
136 | 136 | { |
137 | 137 | $data['error'] == "File Uploading Fail Please Try Again"; |
138 | 138 | } |
139 | - } |
|
140 | - else |
|
139 | + } else |
|
141 | 140 | { |
142 | 141 | $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)"; |
143 | 142 | } |
144 | - } |
|
145 | - else |
|
143 | + } else |
|
146 | 144 | { |
147 | 145 | $invalid_flag = true; |
148 | 146 | } |
@@ -200,8 +198,7 @@ discard block |
||
200 | 198 | { |
201 | 199 | $invalid_array[$i] = $csv_data; |
202 | 200 | $invalid_array[$i]['error'] = $str; |
203 | - } |
|
204 | - else |
|
201 | + } else |
|
205 | 202 | { |
206 | 203 | $csv_data['trunk_id'] = $trunkID; |
207 | 204 | $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*"; |
@@ -243,8 +240,7 @@ discard block |
||
243 | 240 | $data['failure_count'] = count($invalid_array) - 1; |
244 | 241 | $data['page_title'] = 'Termination Rates Import Error'; |
245 | 242 | $this->load->view('view_import_error', $data); |
246 | - } |
|
247 | - else |
|
243 | + } else |
|
248 | 244 | { |
249 | 245 | $this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' Termination rates imported successfully!'); |
250 | 246 | redirect(base_url() . "rates/termination_rates_list/"); |
@@ -316,24 +312,20 @@ discard block |
||
316 | 312 | $data['page_title'] = "Origination Rates Preview"; |
317 | 313 | $data['check_header'] = $check_header; |
318 | 314 | $this->session->set_userdata('import_origination_rate_csv', $actual_file_name); |
319 | - } |
|
320 | - else |
|
315 | + } else |
|
321 | 316 | { |
322 | 317 | $data['error'] = "File Uploading Fail Please Try Again"; |
323 | 318 | } |
324 | 319 | } |
325 | - } |
|
326 | - else |
|
320 | + } else |
|
327 | 321 | { |
328 | 322 | $data['error'] == "File Uploading Fail Please Try Again"; |
329 | 323 | } |
330 | - } |
|
331 | - else |
|
324 | + } else |
|
332 | 325 | { |
333 | 326 | $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)"; |
334 | 327 | } |
335 | - } |
|
336 | - else |
|
328 | + } else |
|
337 | 329 | { |
338 | 330 | $invalid_flag = true; |
339 | 331 | } |
@@ -393,8 +385,7 @@ discard block |
||
393 | 385 | { |
394 | 386 | $invalid_array[$i] = $csv_data; |
395 | 387 | $invalid_array[$i]['error'] = $str; |
396 | - } |
|
397 | - else |
|
388 | + } else |
|
398 | 389 | { |
399 | 390 | $csv_data['pricelist_id'] = $pricelistID; |
400 | 391 | $csv_data['trunk_id'] = $trunkid; |
@@ -439,8 +430,7 @@ discard block |
||
439 | 430 | $data['failure_count'] = count($invalid_array) - 1; |
440 | 431 | $data['page_title'] = 'Origination Rates Import Error'; |
441 | 432 | $this->load->view('view_import_error', $data); |
442 | - } |
|
443 | - else |
|
433 | + } else |
|
444 | 434 | { |
445 | 435 | $this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' Origination rates imported successfully!'); |
446 | 436 | redirect(base_url() . "rates/origination_rates_list/"); |
@@ -470,13 +460,11 @@ discard block |
||
470 | 460 | $count = count($error_field); |
471 | 461 | $str.= $count > 1 ? ' are not valid' : ' is not Valid'; |
472 | 462 | return $str; |
473 | - } |
|
474 | - else |
|
463 | + } else |
|
475 | 464 | { |
476 | 465 | return false; |
477 | 466 | } |
478 | - } |
|
479 | - else |
|
467 | + } else |
|
480 | 468 | { |
481 | 469 | $str = rtrim($str, ','); |
482 | 470 | $error_field = explode(',', $str); |
@@ -515,8 +503,7 @@ discard block |
||
515 | 503 | 'id' => $edit_id, |
516 | 504 | "reseller_id" => $reseller |
517 | 505 | ); |
518 | - } |
|
519 | - else |
|
506 | + } else |
|
520 | 507 | { |
521 | 508 | $where = array( |
522 | 509 | 'id' => $edit_id |
@@ -536,8 +523,7 @@ discard block |
||
536 | 523 | $edit_data['pattern'] = filter_var($edit_data['pattern'], FILTER_SANITIZE_NUMBER_INT); |
537 | 524 | $data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields() , $edit_data); |
538 | 525 | $this->load->view('view_origination_rate_add_edit', $data); |
539 | - } |
|
540 | - else |
|
526 | + } else |
|
541 | 527 | { |
542 | 528 | redirect(base_url() . 'rates/origination_rate_list/'); |
543 | 529 | } |
@@ -555,8 +541,7 @@ discard block |
||
555 | 541 | $data['validation_errors'] = validation_errors(); |
556 | 542 | echo $data['validation_errors']; |
557 | 543 | exit; |
558 | - } |
|
559 | - else |
|
544 | + } else |
|
560 | 545 | { |
561 | 546 | $add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false); |
562 | 547 | $add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false); |
@@ -566,8 +551,7 @@ discard block |
||
566 | 551 | )); |
567 | 552 | exit; |
568 | 553 | } |
569 | - } |
|
570 | - else |
|
554 | + } else |
|
571 | 555 | { |
572 | 556 | $data['page_title'] = 'Add Origination Rate'; |
573 | 557 | if ($this->form_validation->run() == FALSE) |
@@ -575,8 +559,7 @@ discard block |
||
575 | 559 | $data['validation_errors'] = validation_errors(); |
576 | 560 | echo $data['validation_errors']; |
577 | 561 | exit; |
578 | - } |
|
579 | - else |
|
562 | + } else |
|
580 | 563 | { |
581 | 564 | $add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false); |
582 | 565 | $add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false); |
@@ -715,8 +698,7 @@ discard block |
||
715 | 698 | $data['validation_errors'] = validation_errors(); |
716 | 699 | echo $data['validation_errors']; |
717 | 700 | exit; |
718 | - } |
|
719 | - else |
|
701 | + } else |
|
720 | 702 | { |
721 | 703 | $add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false); |
722 | 704 | $add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false); |
@@ -726,8 +708,7 @@ discard block |
||
726 | 708 | )); |
727 | 709 | exit; |
728 | 710 | } |
729 | - } |
|
730 | - else |
|
711 | + } else |
|
731 | 712 | { |
732 | 713 | $data['page_title'] = 'Add Termination Rate'; |
733 | 714 | if ($this->form_validation->run() == FALSE) |
@@ -735,8 +716,7 @@ discard block |
||
735 | 716 | $data['validation_errors'] = validation_errors(); |
736 | 717 | echo $data['validation_errors']; |
737 | 718 | exit; |
738 | - } |
|
739 | - else |
|
719 | + } else |
|
740 | 720 | { |
741 | 721 | $add_array['connectcost'] = $this->common_model->add_calculate_currency($add_array['connectcost'], '', '', false, false); |
742 | 722 | $add_array['cost'] = $this->common_model->add_calculate_currency($add_array['cost'], '', '', false, false); |
@@ -783,11 +763,15 @@ discard block |
||
783 | 763 | ); |
784 | 764 | $instant_search = $this->session->userdata('left_panel_search_' . $accounttype . '_pattern'); |
785 | 765 | $like_str = !empty($instant_search) ? "(blocked_patterns like '%$instant_search%' OR destination like '%$instant_search%' )" : null; |
786 | - if (!empty($like_str)) $this->db->where($like_str); |
|
766 | + if (!empty($like_str)) { |
|
767 | + $this->db->where($like_str); |
|
768 | + } |
|
787 | 769 | $count_all = $this->db_model->countQuery("*", "block_patterns", $where); |
788 | 770 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
789 | 771 | $json_data = $paging_data["json_paging"]; |
790 | - if (!empty($like_str)) $this->db->where($like_str); |
|
772 | + if (!empty($like_str)) { |
|
773 | + $this->db->where($like_str); |
|
774 | + } |
|
791 | 775 | $pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
792 | 776 | $grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid, $accounttype)); |
793 | 777 | $json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields); |
@@ -1371,15 +1355,20 @@ discard block |
||
1371 | 1355 | |
1372 | 1356 | function csv_to_array($filename = '', $delimiter = ',') |
1373 | 1357 | { |
1374 | - if (!file_exists($filename) || !is_readable($filename)) return FALSE; |
|
1358 | + if (!file_exists($filename) || !is_readable($filename)) { |
|
1359 | + return FALSE; |
|
1360 | + } |
|
1375 | 1361 | $header = NULL; |
1376 | 1362 | $data = array(); |
1377 | 1363 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1378 | 1364 | { |
1379 | 1365 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1380 | 1366 | { |
1381 | - if (!$header) $header = $row; |
|
1382 | - else $data[] = array_combine($header, $row); |
|
1367 | + if (!$header) { |
|
1368 | + $header = $row; |
|
1369 | + } else { |
|
1370 | + $data[] = array_combine($header, $row); |
|
1371 | + } |
|
1383 | 1372 | } |
1384 | 1373 | |
1385 | 1374 | fclose($handle); |
@@ -1449,25 +1438,21 @@ discard block |
||
1449 | 1438 | $data['check_header'] = $check_header; |
1450 | 1439 | $data['page_title'] = 'Map CSV to Termination Rates'; |
1451 | 1440 | $this->session->set_userdata('import_termination_rate_mapper_csv', $actual_file_name); |
1452 | - } |
|
1453 | - else |
|
1441 | + } else |
|
1454 | 1442 | { print_r(error_get_last()); |
1455 | 1443 | $data['error'] = "File Uploading Fail Please Try Again"; |
1456 | 1444 | } |
1457 | 1445 | } |
1458 | - } |
|
1459 | - else |
|
1446 | + } else |
|
1460 | 1447 | { |
1461 | 1448 | $data['error'] == "File Uploading Fail Please Try Again"; |
1462 | 1449 | } |
1463 | - } |
|
1464 | - else |
|
1450 | + } else |
|
1465 | 1451 | { |
1466 | 1452 | $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)"; |
1467 | 1453 | |
1468 | 1454 | } |
1469 | - } |
|
1470 | - else |
|
1455 | + } else |
|
1471 | 1456 | { |
1472 | 1457 | $invalid_flag = true; |
1473 | 1458 | } |
@@ -1548,8 +1533,7 @@ discard block |
||
1548 | 1533 | { |
1549 | 1534 | $invalid_array[$i] = $csv_data; |
1550 | 1535 | $invalid_array[$i]['error'] = $str; |
1551 | - } |
|
1552 | - else |
|
1536 | + } else |
|
1553 | 1537 | { |
1554 | 1538 | $new_final_arr[$i]['trunk_id'] = $trunkID; |
1555 | 1539 | $new_final_arr[$i]['pattern'] = "^" . $csv_data['pattern'] . ".*"; |
@@ -1571,8 +1555,7 @@ discard block |
||
1571 | 1555 | if (!empty($new_final_arr)) |
1572 | 1556 | { |
1573 | 1557 | $result = $this->rates_model->bulk_insert_termination_rate($new_final_arr); |
1574 | - } |
|
1575 | - else |
|
1558 | + } else |
|
1576 | 1559 | { |
1577 | 1560 | echo "Nothing Selected!"; |
1578 | 1561 | exit; |
@@ -1604,8 +1587,7 @@ discard block |
||
1604 | 1587 | $data['failure_count'] = count($invalid_array) - 1; |
1605 | 1588 | $data['page_title'] = 'Termination Rates Import Error'; |
1606 | 1589 | $this->load->view('view_import_error', $data); |
1607 | - } |
|
1608 | - else |
|
1590 | + } else |
|
1609 | 1591 | { |
1610 | 1592 | $this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' Termination rates imported successfully!'); |
1611 | 1593 | redirect(base_url() . "rates/termination_rate_list/"); |