| @@ 472-496 (lines=25) @@ | ||
| 469 | //unlink($full_path.$originationrate_file_name); |
|
| 470 | $count=count($invalid_array); |
|
| 471 | //echo "<pre>";print_r($count);exit; |
|
| 472 | if($count >0){ |
|
| 473 | $session_id = "-1"; |
|
| 474 | $fp = fopen($full_path.$session_id.'.csv', 'w'); |
|
| 475 | foreach($new_final_arr_key as $key=>$value){ |
|
| 476 | $custom_array[0][$key]=ucfirst($key); |
|
| 477 | } |
|
| 478 | $custom_array[0]['error']= "Error"; |
|
| 479 | $invalid_array =array_merge($custom_array,$invalid_array); |
|
| 480 | foreach($invalid_array as $err_data){ |
|
| 481 | fputcsv($fp,$err_data); |
|
| 482 | } |
|
| 483 | fclose($fp); |
|
| 484 | $this->session->set_userdata('import_package_code_csv_error', $session_id.".csv"); |
|
| 485 | $data["error"] = $invalid_array; |
|
| 486 | $data['packageid'] = $edit_id; |
|
| 487 | $data['impoted_count'] = count($new_final_arr); |
|
| 488 | $data['failure_count'] = count($invalid_array)-1; |
|
| 489 | $data['page_title'] = 'Package Patterns Import Error'; |
|
| 490 | //print_r($data) ;exit; |
|
| 491 | $this->load->view('view_import_error',$data); |
|
| 492 | } else{ |
|
| 493 | $this->session->set_flashdata('astpp_errormsg', 'Package patterns imported successfully!'); |
|
| 494 | //echo base_url()."package/package_pattern_list/" . $edit_id . "/";exit; |
|
| 495 | redirect(base_url()."package/package_pattern_list/" . $edit_id . "/"); |
|
| 496 | } |
|
| 497 | } |
|
| 498 | ||
| 499 | function data_validate($csvdata){ |
|
| @@ 222-244 (lines=23) @@ | ||
| 219 | ||
| 220 | unlink($full_path . $terminationrate_file_name); |
|
| 221 | $count = count($invalid_array); |
|
| 222 | if ($count > 0) |
|
| 223 | { |
|
| 224 | $session_id = "-1"; |
|
| 225 | $fp = fopen($full_path . $session_id . '.csv', 'w'); |
|
| 226 | foreach($new_final_arr_key as $key => $value) |
|
| 227 | { |
|
| 228 | $custom_array[0][$key] = ucfirst($key); |
|
| 229 | } |
|
| 230 | ||
| 231 | $custom_array[0]['error'] = "Error"; |
|
| 232 | $invalid_array = array_merge($custom_array, $invalid_array); |
|
| 233 | foreach($invalid_array as $err_data) |
|
| 234 | { |
|
| 235 | fputcsv($fp, $err_data); |
|
| 236 | } |
|
| 237 | ||
| 238 | fclose($fp); |
|
| 239 | $this->session->set_userdata('import_termination_rate_csv_error', $session_id . ".csv"); |
|
| 240 | $data["error"] = $invalid_array; |
|
| 241 | $data['trunkid'] = $trunkID; |
|
| 242 | $data['impoted_count'] = count($new_final_arr); |
|
| 243 | $data['failure_count'] = count($invalid_array) - 1; |
|
| 244 | $data['page_title'] = 'Termination Rates Import Error'; |
|
| 245 | $this->load->view('view_import_error', $data); |
|
| 246 | } |
|
| 247 | else |
|
| @@ 418-440 (lines=23) @@ | ||
| 415 | ||
| 416 | unlink($full_path . $originationrate_file_name); |
|
| 417 | $count = count($invalid_array); |
|
| 418 | if ($count > 0) |
|
| 419 | { |
|
| 420 | $session_id = "-1"; |
|
| 421 | $fp = fopen($full_path . $session_id . '.csv', 'w'); |
|
| 422 | foreach($new_final_arr_key as $key => $value) |
|
| 423 | { |
|
| 424 | $custom_array[0][$key] = ucfirst($key); |
|
| 425 | } |
|
| 426 | ||
| 427 | $custom_array[0]['error'] = "Error"; |
|
| 428 | $invalid_array = array_merge($custom_array, $invalid_array); |
|
| 429 | foreach($invalid_array as $err_data) |
|
| 430 | { |
|
| 431 | fputcsv($fp, $err_data); |
|
| 432 | } |
|
| 433 | ||
| 434 | fclose($fp); |
|
| 435 | $this->session->set_userdata('import_origination_rate_csv_error', $session_id . ".csv"); |
|
| 436 | $data["error"] = $invalid_array; |
|
| 437 | $data['pricelistid'] = $pricelistID; |
|
| 438 | $data['impoted_count'] = count($new_final_arr); |
|
| 439 | $data['failure_count'] = count($invalid_array) - 1; |
|
| 440 | $data['page_title'] = 'Origination Rates Import Error'; |
|
| 441 | $this->load->view('view_import_error', $data); |
|
| 442 | } |
|
| 443 | else |
|
| @@ 1578-1607 (lines=30) @@ | ||
| 1575 | ||
| 1576 | unlink($full_path . $terminationrate_file_name); |
|
| 1577 | $count = count($invalid_array); |
|
| 1578 | if ($count > 0) |
|
| 1579 | { |
|
| 1580 | $session_id = "-1"; |
|
| 1581 | $fp = fopen($full_path . $session_id . '.csv', 'w'); |
|
| 1582 | foreach($new_final_arr_key as $key => $value) |
|
| 1583 | { |
|
| 1584 | $custom_array[0][$key] = ucfirst($key); |
|
| 1585 | } |
|
| 1586 | ||
| 1587 | $custom_array[0]['error'] = "Error"; |
|
| 1588 | $invalid_array = array_merge($custom_array, $invalid_array); |
|
| 1589 | foreach($invalid_array as $err_data) |
|
| 1590 | { |
|
| 1591 | fputcsv($fp, $err_data); |
|
| 1592 | } |
|
| 1593 | ||
| 1594 | fclose($fp); |
|
| 1595 | $this->session->set_userdata('import_termination_rate_mapper_csv_error', $session_id . ".csv"); |
|
| 1596 | $data["error"] = $invalid_array; |
|
| 1597 | $data['trunkid'] = $trunkID; |
|
| 1598 | $data['impoted_count'] = count($new_final_arr); |
|
| 1599 | $data['failure_count'] = count($invalid_array) - 1; |
|
| 1600 | $data['page_title'] = 'Termination Rates Import Error'; |
|
| 1601 | $this->load->view('view_import_error', $data); |
|
| 1602 | } |
|
| 1603 | else |
|
| 1604 | { |
|
| 1605 | ||
| 1606 | $this->session->set_flashdata('astpp_errormsg', 'Total ' . count($new_final_arr) . ' Termination rates imported successfully!'); |
|
| 1607 | redirect(base_url() . 'rates/termination_rates_list/'); |
|
| 1608 | } |
|
| 1609 | } |
|
| 1610 | ||