@@ -191,11 +191,11 @@ |
||
191 | 191 | |
192 | 192 | </div> |
193 | 193 | <? |
194 | - if($params_name!='') |
|
194 | + if ($params_name != '') |
|
195 | 195 | { |
196 | - $type="edit_setting"; |
|
197 | - }else{ |
|
198 | - $type="add_setting"; |
|
196 | + $type = "edit_setting"; |
|
197 | + } else { |
|
198 | + $type = "add_setting"; |
|
199 | 199 | } |
200 | 200 | ?> |
201 | 201 | <input type='hidden' name='type_settings' value='<?=$type?>' /> |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | function add_account($accountinfo) { |
32 | 32 | |
33 | 33 | $account_data = $this->session->userdata("accountinfo"); |
34 | - $accountinfo['reseller_id'] = ($account_data['type'] == 1 ) ? $account_data['id'] : 0; |
|
35 | - $accountinfo['maxchannels'] = ($accountinfo['type'] == 1 || $account_data['type'] == 2 || $account_data['type'] == -1 ) ? "0" : $accountinfo['maxchannels']; |
|
34 | + $accountinfo['reseller_id'] = ($account_data['type'] == 1) ? $account_data['id'] : 0; |
|
35 | + $accountinfo['maxchannels'] = ($accountinfo['type'] == 1 || $account_data['type'] == 2 || $account_data['type'] == -1) ? "0" : $accountinfo['maxchannels']; |
|
36 | 36 | unset($accountinfo['action']); |
37 | 37 | $sip_flag = isset($accountinfo['sip_device_flag']) ? 1 : 0; |
38 | 38 | $opensip_flag = isset($accountinfo['opensips_device_flag']) ? 1 : 0; |
39 | - unset($accountinfo['sip_device_flag'],$accountinfo['opensips_device_flag'],$accountinfo['tax_id']); |
|
39 | + unset($accountinfo['sip_device_flag'], $accountinfo['opensips_device_flag'], $accountinfo['tax_id']); |
|
40 | 40 | |
41 | 41 | /* * ******************************** */ |
42 | 42 | $accountinfo['creation'] = gmdate('Y-m-d H:i:s'); |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | }else{ |
52 | 52 | $accountinfo['allow_ip_management']=1; |
53 | 53 | }*/ |
54 | - if(isset($accountinfo['local_call'])){ |
|
55 | - $accountinfo['local_call']=0; |
|
56 | - }else{ |
|
57 | - $accountinfo['local_call']=1; |
|
54 | + if (isset($accountinfo['local_call'])) { |
|
55 | + $accountinfo['local_call'] = 0; |
|
56 | + } else { |
|
57 | + $accountinfo['local_call'] = 1; |
|
58 | 58 | } |
59 | - if ($accountinfo['type'] == 1){ |
|
59 | + if ($accountinfo['type'] == 1) { |
|
60 | 60 | $invoice_config = $accountinfo['invoice_config_flag']; |
61 | - }else{ |
|
61 | + } else { |
|
62 | 62 | $invoice_config = ""; |
63 | 63 | } |
64 | 64 | unset($accountinfo['invoice_config_flag']); |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | } |
87 | 87 | if ($sip_flag == '1') { |
88 | 88 | $this->db->select('id'); |
89 | - $this->db->where('name','default'); |
|
90 | - $sipprofile_result=(array)$this->db->get('sip_profiles')->first_row(); |
|
89 | + $this->db->where('name', 'default'); |
|
90 | + $sipprofile_result = (array)$this->db->get('sip_profiles')->first_row(); |
|
91 | 91 | $free_switch_array = array('fs_username' => $accountinfo['number'], |
92 | 92 | 'fs_password' => $this->common->decode($accountinfo['password']), |
93 | 93 | 'context' => 'default', |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | $this->load->model('opensips/opensips_model'); |
110 | 110 | $this->opensips_model->add_opensipsdevices($opensips_array); |
111 | 111 | } |
112 | - $accountinfo['confirm'] = base_url(); |
|
113 | - if($accountinfo['id'] == ""){ |
|
112 | + $accountinfo['confirm'] = base_url(); |
|
113 | + if ($accountinfo['id'] == "") { |
|
114 | 114 | $accountinfo['id'] = $last_id; |
115 | 115 | } |
116 | 116 | $accountinfo['password'] = $this->common->decode($accountinfo['password']); |
@@ -154,16 +154,16 @@ discard block |
||
154 | 154 | if ($query_pricelist->num_rows > 0) { |
155 | 155 | $description = ''; |
156 | 156 | if ($update_array['balance']['operator'] == '2') { |
157 | - $description .="Reseller update set balance by admin"; |
|
157 | + $description .= "Reseller update set balance by admin"; |
|
158 | 158 | } |
159 | 159 | if ($update_array['balance']['operator'] == '3') { |
160 | - $description .="Reseller update increase balance by admin"; |
|
160 | + $description .= "Reseller update increase balance by admin"; |
|
161 | 161 | } |
162 | 162 | if ($update_array['balance']['operator'] == '4') { |
163 | - $description .="Reseller update descrise balance by admin"; |
|
163 | + $description .= "Reseller update descrise balance by admin"; |
|
164 | 164 | } |
165 | 165 | foreach ($query_pricelist->result_array() as $key => $reseller_payment) { |
166 | - if (!empty($reseller_payment['reseller_id']) && $reseller_payment['reseller_id'] != '') { |
|
166 | + if ( ! empty($reseller_payment['reseller_id']) && $reseller_payment['reseller_id'] != '') { |
|
167 | 167 | $payment_by = $reseller_payment['reseller_id']; |
168 | 168 | } else { |
169 | 169 | $payment_by = '-1'; |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | if ($query_pricelist->num_rows > 0) { |
219 | 219 | $description = ''; |
220 | 220 | if ($update_array['balance']['operator'] == '2') { |
221 | - $description .="Customer update set balance by admin"; |
|
221 | + $description .= "Customer update set balance by admin"; |
|
222 | 222 | } |
223 | 223 | if ($update_array['balance']['operator'] == '3') { |
224 | - $description .="Customer update increase balance by admin"; |
|
224 | + $description .= "Customer update increase balance by admin"; |
|
225 | 225 | } |
226 | 226 | if ($update_array['balance']['operator'] == '4') { |
227 | - $description .="Customer update descrise balance by admin"; |
|
227 | + $description .= "Customer update descrise balance by admin"; |
|
228 | 228 | } |
229 | 229 | foreach ($query_pricelist->result_array() as $key => $customer_payment) { |
230 | - if (!empty($customer_payment['reseller_id']) && $customer_payment['reseller_id'] != '0') { |
|
230 | + if ( ! empty($customer_payment['reseller_id']) && $customer_payment['reseller_id'] != '0') { |
|
231 | 231 | $payment_by = $customer_payment['reseller_id']; |
232 | 232 | } else { |
233 | 233 | $payment_by = '-1'; |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | $pin = $this->common->find_uniq_rendno_accno($number_length, 'pin', 'accounts', '', $count); |
284 | 284 | } |
285 | 285 | $sip_flag = false; |
286 | - $opensip_flag=false; |
|
287 | - if (isset($add_array['sip_device_flag']) && common_model::$global_config['system_config']['opensips']== 0) { |
|
286 | + $opensip_flag = false; |
|
287 | + if (isset($add_array['sip_device_flag']) && common_model::$global_config['system_config']['opensips'] == 0) { |
|
288 | 288 | $sip_flag = true; |
289 | 289 | } |
290 | - if (isset($add_array['opensips_device_flag']) && common_model::$global_config['system_config']['opensips']== 1) { |
|
290 | + if (isset($add_array['opensips_device_flag']) && common_model::$global_config['system_config']['opensips'] == 1) { |
|
291 | 291 | $opensip_flag = true; |
292 | 292 | } |
293 | 293 | unset( |
@@ -298,20 +298,20 @@ discard block |
||
298 | 298 | $add_array['sip_device_flag'], |
299 | 299 | $add_array['opensips_device_flag'] |
300 | 300 | ); |
301 | - if(isset($add_array['is_recording']) && $add_array['is_recording'] != ''){ |
|
302 | - $is_recording=1; |
|
303 | - }else{ |
|
304 | - $is_recording=0; |
|
301 | + if (isset($add_array['is_recording']) && $add_array['is_recording'] != '') { |
|
302 | + $is_recording = 1; |
|
303 | + } else { |
|
304 | + $is_recording = 0; |
|
305 | 305 | } |
306 | - if(isset($add_array['allow_ip_management']) && $add_array['allow_ip_management'] != ''){ |
|
307 | - $allow_ip_management=1; |
|
308 | - }else{ |
|
309 | - $allow_ip_management=0; |
|
306 | + if (isset($add_array['allow_ip_management']) && $add_array['allow_ip_management'] != '') { |
|
307 | + $allow_ip_management = 1; |
|
308 | + } else { |
|
309 | + $allow_ip_management = 0; |
|
310 | 310 | } |
311 | - if(isset($add_array['local_call']) && $add_array['local_call'] != ''){ |
|
312 | - $local_call=1; |
|
313 | - }else{ |
|
314 | - $local_call=0; |
|
311 | + if (isset($add_array['local_call']) && $add_array['local_call'] != '') { |
|
312 | + $local_call = 1; |
|
313 | + } else { |
|
314 | + $local_call = 0; |
|
315 | 315 | } |
316 | 316 | if ($sip_flag) { |
317 | 317 | $query = $this->db_model->select("*", "sip_profiles", array('status' => "0"), "id", "ASC", '1', '0'); |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | $this->db->insert_batch('accounts', $insert_array); |
420 | 420 | if ($opensip_flag == 1) { |
421 | 421 | $db_config = Common_model::$global_config['system_config']; |
422 | - $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
422 | + $opensipdsn = "mysql://".$db_config['opensips_dbuser'].":".$db_config['opensips_dbpass']."@".$db_config['opensips_dbhost']."/".$db_config['opensips_dbname']."?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
423 | 423 | $this->opensips_db = $this->load->database($opensipdsn, true); |
424 | 424 | $this->opensips_db->insert_batch("subscriber", $opensips_array); |
425 | 425 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | } |
429 | 429 | |
430 | 430 | function get_max_limit($add_array) { |
431 | - $this->db->where('deleted','0'); |
|
431 | + $this->db->where('deleted', '0'); |
|
432 | 432 | $this->db->where("length(number)", $add_array['account_length']); |
433 | 433 | $this->db->like('number', $add_array['prefix'], 'after'); |
434 | 434 | $this->db->select("count(id) as count"); |
@@ -444,16 +444,16 @@ discard block |
||
444 | 444 | } |
445 | 445 | function account_process_payment($data) { |
446 | 446 | $data['accountid'] = $data['id']; |
447 | - $accountdata=(array)$this->db->get_where('accounts',array("id"=>$data['accountid']))->first_row(); |
|
448 | - $accountinfo =$this->session->userdata('accountinfo'); |
|
447 | + $accountdata = (array)$this->db->get_where('accounts', array("id"=>$data['accountid']))->first_row(); |
|
448 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
449 | 449 | $data["payment_by"] = $accountdata['reseller_id'] > 0 ? $accountdata['reseller_id'] : '-1'; |
450 | 450 | $data['payment_mode'] = $data['payment_type']; |
451 | - unset($data['action'],$data['id'],$data['account_currency'],$data['payment_type']); |
|
452 | - if (isset($data) && !empty($accountdata)) { |
|
453 | - $data['credit']=$data['credit'] =='' ? 0 : $data['credit']; |
|
451 | + unset($data['action'], $data['id'], $data['account_currency'], $data['payment_type']); |
|
452 | + if (isset($data) && ! empty($accountdata)) { |
|
453 | + $data['credit'] = $data['credit'] == '' ? 0 : $data['credit']; |
|
454 | 454 | $date = gmdate('Y-m-d H:i:s'); |
455 | - if($data['payment_mode']== 1){ |
|
456 | - $balance = $this->update_balance($data['credit'], $data['accountid'],$data['payment_mode']); |
|
455 | + if ($data['payment_mode'] == 1) { |
|
456 | + $balance = $this->update_balance($data['credit'], $data['accountid'], $data['payment_mode']); |
|
457 | 457 | $insert_arr = array("accountid" => $data['accountid'], |
458 | 458 | "credit" => "-".$data['credit'], |
459 | 459 | 'payment_mode'=>$data['payment_mode'], |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | 'payment_by'=>$data['payment_by'], |
475 | 475 | ); |
476 | 476 | $this->db->insert("payments", $insert_arr); |
477 | - $accountdata['refill_amount']=$data['credit']; |
|
478 | - $current_id=$accountinfo['type'] ==1 ? $accountinfo['id'] : '0'; |
|
479 | - if($accountdata['reseller_id'] == $current_id){ |
|
477 | + $accountdata['refill_amount'] = $data['credit']; |
|
478 | + $current_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : '0'; |
|
479 | + if ($accountdata['reseller_id'] == $current_id) { |
|
480 | 480 | $this->common->mail_to_users('voip_account_refilled', $accountdata); |
481 | - }else{ |
|
481 | + } else { |
|
482 | 482 | $this->common->mail_to_users('voip_child_account_refilled', $accountdata); |
483 | 483 | } |
484 | 484 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | |
489 | 489 | function get_admin_Account_list($flag, $start = 0, $limit = 0, $reseller_id = 0) { |
490 | 490 | $this->db_model->build_search('admin_list_search'); |
491 | - $where = "reseller_id =" . $reseller_id . " AND deleted =0 AND type in (2,4,-1)"; |
|
491 | + $where = "reseller_id =".$reseller_id." AND deleted =0 AND type in (2,4,-1)"; |
|
492 | 492 | if ($this->session->userdata('advance_search') == 1) { |
493 | 493 | $search = $this->session->userdata('admin_list_search'); |
494 | 494 | if ($search['type'] == '') { |
@@ -504,10 +504,10 @@ discard block |
||
504 | 504 | if ($flag) { |
505 | 505 | $this->db->limit($limit, $start); |
506 | 506 | } |
507 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
508 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
509 | - }else{ |
|
510 | - $this->db->order_by('number','desc'); |
|
507 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') { |
|
508 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']); |
|
509 | + } else { |
|
510 | + $this->db->order_by('number', 'desc'); |
|
511 | 511 | } |
512 | 512 | $result = $this->db->get('accounts'); |
513 | 513 | |
@@ -535,13 +535,13 @@ discard block |
||
535 | 535 | $this->db->where($type); |
536 | 536 | } |
537 | 537 | if ($flag) { |
538 | - if (!$export) |
|
538 | + if ( ! $export) |
|
539 | 539 | $this->db->limit($limit, $start); |
540 | 540 | } |
541 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
542 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
543 | - }else{ |
|
544 | - $this->db->order_by('number','desc'); |
|
541 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') { |
|
542 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']); |
|
543 | + } else { |
|
544 | + $this->db->order_by('number', 'desc'); |
|
545 | 545 | } |
546 | 546 | $result = $this->db->get('accounts'); |
547 | 547 | if ($flag) { |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | function insert_block($data, $accountid) { |
591 | 591 | $data = explode(",", $data); |
592 | 592 | $tmp = array(); |
593 | - if (!empty($data)) { |
|
593 | + if ( ! empty($data)) { |
|
594 | 594 | foreach ($data as $key => $data_value) { |
595 | 595 | $tmp[$key]["accountid"] = $accountid; |
596 | 596 | $result = $this->get_pattern_by_id($data_value); |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | } |
622 | 622 | |
623 | 623 | function add_callerid($data) { |
624 | - unset($data['action'],$data['flag']); |
|
624 | + unset($data['action'], $data['flag']); |
|
625 | 625 | $data['accountid'] = $this->common->get_field_name('id', 'accounts', array('number' => $data['accountid'])); |
626 | 626 | $this->db->insert('accounts_callerid', $data); |
627 | 627 | return true; |
@@ -706,10 +706,10 @@ discard block |
||
706 | 706 | |
707 | 707 | function update_balance($amount, $accountid, $payment_type) { |
708 | 708 | if ($payment_type == 0) { |
709 | - $query = 'UPDATE `accounts` SET `balance` = (balance + ' . $amount . ') WHERE `id` = ' . $accountid; |
|
709 | + $query = 'UPDATE `accounts` SET `balance` = (balance + '.$amount.') WHERE `id` = '.$accountid; |
|
710 | 710 | return $this->db->query($query); |
711 | 711 | }if ($payment_type == 1) { |
712 | - $query = 'UPDATE `accounts` SET `balance` = (balance - ' . $amount . ') WHERE `id` = ' . $accountid; |
|
712 | + $query = 'UPDATE `accounts` SET `balance` = (balance - '.$amount.') WHERE `id` = '.$accountid; |
|
713 | 713 | return $this->db->query($query); |
714 | 714 | } |
715 | 715 | } |
@@ -131,7 +131,7 @@ |
||
131 | 131 | </label> |
132 | 132 | </div> |
133 | 133 | <div class="col-md-3"> |
134 | - <input class="col-md-2 form-control" name="speed_dial_<?php echo $i; ?>" id="speed_dial_<?php echo $i; ?>" size="16" type="text" value="<?php if (isset($speeddial[$i]) && !empty($speeddial[$i])) { |
|
134 | + <input class="col-md-2 form-control" name="speed_dial_<?php echo $i; ?>" id="speed_dial_<?php echo $i; ?>" size="16" type="text" value="<?php if (isset($speeddial[$i]) && ! empty($speeddial[$i])) { |
|
135 | 135 | echo $speeddial[$i]; |
136 | 136 | } ?>"> |
137 | 137 | </div> |
@@ -57,10 +57,10 @@ |
||
57 | 57 | <div style="color:red;margin-left: 60px;"> |
58 | 58 | <?php |
59 | 59 | if (isset($validation_errors)) { |
60 | - $validation_array=json_decode($validation_errors); |
|
61 | - if(is_object($validation_array)){ |
|
60 | + $validation_array = json_decode($validation_errors); |
|
61 | + if (is_object($validation_array)) { |
|
62 | 62 | $validation_array = get_object_vars($validation_array); |
63 | - foreach($validation_array as $key=>$value) |
|
63 | + foreach ($validation_array as $key=>$value) |
|
64 | 64 | echo $value."<br/>"; |
65 | 65 | } |
66 | 66 | else |
@@ -206,13 +206,13 @@ |
||
206 | 206 | </div> |
207 | 207 | </div> |
208 | 208 | <?php |
209 | - if($account_data['logo'] != ''){ |
|
210 | - $logo=$account_data['file']; |
|
211 | - }else{ |
|
212 | - $logo=$account_data['logo']; |
|
209 | + if ($account_data['logo'] != '') { |
|
210 | + $logo = $account_data['file']; |
|
211 | + } else { |
|
212 | + $logo = $account_data['logo']; |
|
213 | 213 | } |
214 | - if($logo != ''){ |
|
215 | - $file_name= base_url()."upload/$logo"; |
|
214 | + if ($logo != '') { |
|
215 | + $file_name = base_url()."upload/$logo"; |
|
216 | 216 | ?> |
217 | 217 | |
218 | 218 | <div class='col-md-12 no-padding'> |
@@ -51,7 +51,7 @@ |
||
51 | 51 | } |
52 | 52 | $data_errrors = json_decode($validation_errors); |
53 | 53 | foreach ($data_errrors as $key => $value) { |
54 | - echo $value . "<br/>"; |
|
54 | + echo $value."<br/>"; |
|
55 | 55 | } |
56 | 56 | ?> |
57 | 57 | </div> |
@@ -28,7 +28,7 @@ |
||
28 | 28 | <!-- <?php |
29 | 29 | $data_errrors = json_decode($validation_errors); |
30 | 30 | foreach ($data_errrors as $key => $value) { |
31 | - echo $value . "<br/>"; |
|
31 | + echo $value."<br/>"; |
|
32 | 32 | } |
33 | 33 | ?> |
34 | 34 | </div> |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | ASTPP 3.0 |
33 | 33 | Batch Delete |
34 | 34 | ********/ |
35 | - if($this->session->userdata('advance_batch_delete') == 1){ |
|
35 | + if ($this->session->userdata('advance_batch_delete') == 1) { |
|
36 | 36 | $this->db->where(array("trunk_id >"=>"0")); |
37 | 37 | $this->db->delete("outbound_routes"); |
38 | - $this->session->set_userdata('advance_batch_delete','0'); |
|
38 | + $this->session->set_userdata('advance_batch_delete', '0'); |
|
39 | 39 | $this->session->unset_userdata('advance_batch_delete'); |
40 | 40 | } |
41 | 41 | /**************/ |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if ($export) |
54 | 54 | $this->db->limit($limit, $start); |
55 | 55 | $result = $this->db->get(); |
56 | - }else { |
|
56 | + } else { |
|
57 | 57 | $result = $this->db->count_all_results(); |
58 | 58 | } |
59 | 59 | return $result; |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | if ($export) |
75 | 75 | $this->db->limit($limit, $start); |
76 | 76 | $result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start); |
77 | - }else { |
|
77 | + } else { |
|
78 | 78 | $result = $this->db_model->countQuery("*", "routes", $where); |
79 | 79 | } |
80 | 80 | // echo "<pre>";print_r($result->result());exit; |
81 | 81 | return $result; |
82 | 82 | } |
83 | 83 | |
84 | - function get_origination_rate_for_user($flag, $start = 0, $limit = 0,$export = true) { |
|
84 | + function get_origination_rate_for_user($flag, $start = 0, $limit = 0, $export = true) { |
|
85 | 85 | $this->db_model->build_search('origination_rate_list_search'); |
86 | 86 | |
87 | 87 | $account_data = $this->session->userdata("accountinfo"); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if ($export) |
94 | 94 | $this->db->limit($limit, $start); |
95 | 95 | $result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start); |
96 | - }else { |
|
96 | + } else { |
|
97 | 97 | $result = $this->db_model->countQuery("*", "routes", $where); |
98 | 98 | } |
99 | 99 | return $result; |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | ASTPP 3.0 |
112 | 112 | Batch delete |
113 | 113 | ************/ |
114 | - if($this->session->userdata('advance_batch_delete') == 1){ |
|
114 | + if ($this->session->userdata('advance_batch_delete') == 1) { |
|
115 | 115 | $this->db->where($where); |
116 | 116 | $this->db->delete("routes"); |
117 | 117 | //echo $this->db->last_query(); exit; |
118 | - $this->session->set_userdata('advance_batch_delete','0'); |
|
118 | + $this->session->set_userdata('advance_batch_delete', '0'); |
|
119 | 119 | $this->session->unset_userdata('advance_batch_delete'); |
120 | 120 | |
121 | 121 | } |
@@ -336,21 +336,21 @@ discard block |
||
336 | 336 | /** |
337 | 337 | * @param string $table_name |
338 | 338 | */ |
339 | - function insert_if_not_exitst($add_array,$table_name){ |
|
339 | + function insert_if_not_exitst($add_array, $table_name) { |
|
340 | 340 | $insert_str = "Insert into $table_name ("; |
341 | 341 | $insert_key = ""; |
342 | 342 | $insert_value = ""; |
343 | 343 | $update_str = ""; |
344 | - foreach($add_array as $key => $value){ |
|
345 | - if($key != 'id'){ |
|
344 | + foreach ($add_array as $key => $value) { |
|
345 | + if ($key != 'id') { |
|
346 | 346 | $insert_key .= $key.","; |
347 | 347 | $insert_value .= "'$value',"; |
348 | 348 | $update_str .= $key." = '$value',"; |
349 | 349 | } |
350 | 350 | } |
351 | - $insert_key = rtrim($insert_key,","); |
|
352 | - $insert_value = rtrim($insert_value,","); |
|
353 | - $update_str = rtrim($update_str,","); |
|
351 | + $insert_key = rtrim($insert_key, ","); |
|
352 | + $insert_value = rtrim($insert_value, ","); |
|
353 | + $update_str = rtrim($update_str, ","); |
|
354 | 354 | $insert_str .= $insert_key.") values"."(".$insert_value.") ON DUPLICATE KEY UPDATE $update_str"; |
355 | 355 | $this->db->query($insert_str); |
356 | 356 | } |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $this->load->library('astpp/form'); |
33 | 33 | $this->load->model('rates_model'); |
34 | 34 | $this->load->library('csvreader'); |
35 | - ini_set("memory_limit","2048M"); |
|
36 | - ini_set("max_execution_time","259200"); |
|
35 | + ini_set("memory_limit", "2048M"); |
|
36 | + ini_set("max_execution_time", "259200"); |
|
37 | 37 | if ($this->session->userdata('user_login') == FALSE) |
38 | - redirect(base_url() . '/astpp/login'); |
|
38 | + redirect(base_url().'/astpp/login'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | function termination_rates_list() { |
@@ -72,70 +72,70 @@ discard block |
||
72 | 72 | |
73 | 73 | echo json_encode($json_data); |
74 | 74 | } |
75 | - function termination_rates_list_delete($flag='') { |
|
75 | + function termination_rates_list_delete($flag = '') { |
|
76 | 76 | $json_data = array(); |
77 | - $this->session->set_userdata('advance_batch_data_delete',1); |
|
77 | + $this->session->set_userdata('advance_batch_data_delete', 1); |
|
78 | 78 | $count_all = $this->rates_model->get_termination_rates_list(false); |
79 | 79 | echo $count_all; |
80 | 80 | } |
81 | 81 | /****************/ |
82 | 82 | function termination_rate_import() { |
83 | 83 | $data['page_title'] = 'Import Termination Rates'; |
84 | - $this->session->set_userdata('import_termination_rate_csv',""); |
|
85 | - $this->session->set_userdata('import_termination_rate_csv_error',""); |
|
84 | + $this->session->set_userdata('import_termination_rate_csv', ""); |
|
85 | + $this->session->set_userdata('import_termination_rate_csv_error', ""); |
|
86 | 86 | $this->load->view('view_import_termination_rate', $data); |
87 | 87 | } |
88 | - function termination_rate_preview_file(){ |
|
89 | - $invalid_flag= false; |
|
90 | - $check_header=$this->input->post('check_header',true); |
|
88 | + function termination_rate_preview_file() { |
|
89 | + $invalid_flag = false; |
|
90 | + $check_header = $this->input->post('check_header', true); |
|
91 | 91 | $data['page_title'] = 'Import Termination Rates'; |
92 | 92 | $new_final_arr_key = $this->config->item('Termination-rates-field'); |
93 | - if(empty($_FILES) || !isset($_FILES)){ |
|
93 | + if (empty($_FILES) || ! isset($_FILES)) { |
|
94 | 94 | redirect(base_url()."rates/termination_rates_list/"); |
95 | 95 | } |
96 | - if (isset($_FILES['termination_rate_import']['name']) && $_FILES['termination_rate_import']['name'] != "" && isset($_POST['trunk_id']) && $_POST['trunk_id'] != '') { |
|
96 | + if (isset($_FILES['termination_rate_import']['name']) && $_FILES['termination_rate_import']['name'] != "" && isset($_POST['trunk_id']) && $_POST['trunk_id'] != '') { |
|
97 | 97 | list($txt, $ext) = explode(".", $_FILES['termination_rate_import']['name']); |
98 | - if($ext == "csv" && $_FILES['termination_rate_import']['size'] > 0){ |
|
98 | + if ($ext == "csv" && $_FILES['termination_rate_import']['size'] > 0) { |
|
99 | 99 | $error = $_FILES['termination_rate_import']['error']; |
100 | - if ($error == 0 ) { |
|
100 | + if ($error == 0) { |
|
101 | 101 | $uploadedFile = $_FILES["termination_rate_import"]["tmp_name"]; |
102 | - $csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header); |
|
103 | - if(!empty($csv_data)){ |
|
102 | + $csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header); |
|
103 | + if ( ! empty($csv_data)) { |
|
104 | 104 | $full_path = $this->config->item('rates-file-path'); |
105 | - $actual_file_name = "ASTPP-TERMINATION-RATES-".date("Y-m-d H:i:s"). "." . $ext; |
|
106 | - if (move_uploaded_file($uploadedFile,$full_path.$actual_file_name)) { |
|
105 | + $actual_file_name = "ASTPP-TERMINATION-RATES-".date("Y-m-d H:i:s").".".$ext; |
|
106 | + if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) { |
|
107 | 107 | $data['csv_tmp_data'] = $csv_data; |
108 | 108 | $data['trunkid'] = $_POST['trunk_id']; |
109 | - $data['check_header']=$check_header; |
|
109 | + $data['check_header'] = $check_header; |
|
110 | 110 | $data['page_title'] = 'Termination Rates Preview'; |
111 | - $this->session->set_userdata('import_termination_rate_csv',$actual_file_name); |
|
112 | - }else{ |
|
111 | + $this->session->set_userdata('import_termination_rate_csv', $actual_file_name); |
|
112 | + } else { |
|
113 | 113 | $data['error'] = "File Uploading Fail Please Try Again"; |
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
117 | - else{ |
|
118 | - $data['error']=="File Uploading Fail Please Try Again"; |
|
117 | + else { |
|
118 | + $data['error'] == "File Uploading Fail Please Try Again"; |
|
119 | 119 | } |
120 | - }else { |
|
120 | + } else { |
|
121 | 121 | $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)"; |
122 | 122 | } |
123 | - }else{ |
|
124 | - $invalid_flag=true; |
|
123 | + } else { |
|
124 | + $invalid_flag = true; |
|
125 | 125 | } |
126 | 126 | if ($invalid_flag) { |
127 | 127 | $str = ''; |
128 | - if (!isset($_POST['trunk_id']) || empty($_POST['trunk_id'])) { |
|
129 | - $str.= '<br/>Please Create Trunk.'; |
|
128 | + if ( ! isset($_POST['trunk_id']) || empty($_POST['trunk_id'])) { |
|
129 | + $str .= '<br/>Please Create Trunk.'; |
|
130 | 130 | } |
131 | 131 | if (empty($_FILES['termination_rate_import']['name'])) { |
132 | - $str.= '<br/>Please Select File.'; |
|
132 | + $str .= '<br/>Please Select File.'; |
|
133 | 133 | } |
134 | - $data['error']=$str; |
|
134 | + $data['error'] = $str; |
|
135 | 135 | } |
136 | 136 | $this->load->view('view_import_termination_rate', $data); |
137 | 137 | } |
138 | - function termination_rate_rates_import($trunkID,$check_header=false) { |
|
138 | + function termination_rate_rates_import($trunkID, $check_header = false) { |
|
139 | 139 | $new_final_arr = array(); |
140 | 140 | $invalid_array = array(); |
141 | 141 | $new_final_arr_key = $this->config->item('Termination-rates-field'); |
@@ -145,65 +145,65 @@ discard block |
||
145 | 145 | } |
146 | 146 | $full_path = $this->config->item('rates-file-path'); |
147 | 147 | $terminationrate_file_name = $this->session->userdata('import_termination_rate_csv'); |
148 | - $csv_tmp_data = $this->csvreader->parse_file($full_path.$terminationrate_file_name,$new_final_arr_key,$check_header); |
|
149 | - $i=0; |
|
148 | + $csv_tmp_data = $this->csvreader->parse_file($full_path.$terminationrate_file_name, $new_final_arr_key, $check_header); |
|
149 | + $i = 0; |
|
150 | 150 | foreach ($csv_tmp_data as $key => $csv_data) { |
151 | - if(isset($csv_data['pattern']) && $csv_data['pattern']!= '' && $i != 0){ |
|
152 | - $str=null; |
|
153 | - $csv_data['prepend']= isset($csv_data['prepend'])? $csv_data['prepend'] :''; |
|
154 | - $csv_data['comment']= isset($csv_data['comment'])? $csv_data['comment'] :''; |
|
155 | - $csv_data['connectcost']= isset($csv_data['connectcost']) ? $csv_data['connectcost'] :0; |
|
156 | - $csv_data['includedseconds']= isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] :0; |
|
157 | - $csv_data['cost']= !empty($csv_data['cost']) && is_numeric( $csv_data['cost']) ? $csv_data['cost'] :0; |
|
158 | - $csv_data['inc']= isset($csv_data['inc']) ? $csv_data['inc'] :0; |
|
159 | - $csv_data['precedence']= isset($csv_data['precedence']) ? $csv_data['precedence'] :''; |
|
160 | - $csv_data['strip']= isset($csv_data['strip']) ? $csv_data['strip'] :''; |
|
151 | + if (isset($csv_data['pattern']) && $csv_data['pattern'] != '' && $i != 0) { |
|
152 | + $str = null; |
|
153 | + $csv_data['prepend'] = isset($csv_data['prepend']) ? $csv_data['prepend'] : ''; |
|
154 | + $csv_data['comment'] = isset($csv_data['comment']) ? $csv_data['comment'] : ''; |
|
155 | + $csv_data['connectcost'] = isset($csv_data['connectcost']) ? $csv_data['connectcost'] : 0; |
|
156 | + $csv_data['includedseconds'] = isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] : 0; |
|
157 | + $csv_data['cost'] = ! empty($csv_data['cost']) && is_numeric($csv_data['cost']) ? $csv_data['cost'] : 0; |
|
158 | + $csv_data['inc'] = isset($csv_data['inc']) ? $csv_data['inc'] : 0; |
|
159 | + $csv_data['precedence'] = isset($csv_data['precedence']) ? $csv_data['precedence'] : ''; |
|
160 | + $csv_data['strip'] = isset($csv_data['strip']) ? $csv_data['strip'] : ''; |
|
161 | 161 | $csv_data['last_modified_date'] = date("Y-m-d H:i:s"); |
162 | - $str=$this->data_validate($csv_data); |
|
163 | - if($str != ""){ |
|
164 | - $invalid_array[$i]=$csv_data; |
|
162 | + $str = $this->data_validate($csv_data); |
|
163 | + if ($str != "") { |
|
164 | + $invalid_array[$i] = $csv_data; |
|
165 | 165 | $invalid_array[$i]['error'] = $str; |
166 | 166 | } |
167 | - else{ |
|
168 | - $csv_data['trunk_id']=$trunkID; |
|
169 | - $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*"; |
|
170 | - $new_final_arr[$i]=$csv_data; |
|
167 | + else { |
|
168 | + $csv_data['trunk_id'] = $trunkID; |
|
169 | + $csv_data['pattern'] = "^".$csv_data['pattern'].".*"; |
|
170 | + $new_final_arr[$i] = $csv_data; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | $i++; |
174 | 174 | } |
175 | - if(!empty($new_final_arr)){ |
|
175 | + if ( ! empty($new_final_arr)) { |
|
176 | 176 | $result = $this->rates_model->bulk_insert_termination_rate($new_final_arr); |
177 | 177 | } |
178 | 178 | unlink($full_path.$terminationrate_file_name); |
179 | - $count=count($invalid_array); |
|
180 | - if($count >0){ |
|
179 | + $count = count($invalid_array); |
|
180 | + if ($count > 0) { |
|
181 | 181 | $session_id = "-1"; |
182 | 182 | $fp = fopen($full_path.$session_id.'.csv', 'w'); |
183 | - foreach($new_final_arr_key as $key=>$value){ |
|
184 | - $custom_array[0][$key]=ucfirst($key); |
|
183 | + foreach ($new_final_arr_key as $key=>$value) { |
|
184 | + $custom_array[0][$key] = ucfirst($key); |
|
185 | 185 | } |
186 | - $custom_array[0]['error']= "Error"; |
|
187 | - $invalid_array =array_merge($custom_array,$invalid_array); |
|
188 | - foreach($invalid_array as $err_data){ |
|
189 | - fputcsv($fp,$err_data); |
|
186 | + $custom_array[0]['error'] = "Error"; |
|
187 | + $invalid_array = array_merge($custom_array, $invalid_array); |
|
188 | + foreach ($invalid_array as $err_data) { |
|
189 | + fputcsv($fp, $err_data); |
|
190 | 190 | } |
191 | 191 | fclose($fp); |
192 | 192 | $this->session->set_userdata('import_termination_rate_csv_error', $session_id.".csv"); |
193 | 193 | $data["error"] = $invalid_array; |
194 | 194 | $data['trunkid'] = $trunkID; |
195 | 195 | $data['impoted_count'] = count($new_final_arr); |
196 | - $data['failure_count'] = count($invalid_array)-1; |
|
196 | + $data['failure_count'] = count($invalid_array) - 1; |
|
197 | 197 | $data['page_title'] = 'Termination Rates Import Error'; |
198 | - $this->load->view('view_import_error',$data); |
|
199 | - } else{ |
|
198 | + $this->load->view('view_import_error', $data); |
|
199 | + } else { |
|
200 | 200 | $this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Termination rates imported successfully!'); |
201 | 201 | redirect(base_url()."rates/termination_rates_list/"); |
202 | 202 | } |
203 | 203 | } |
204 | - function termination_rate_error_download(){ |
|
204 | + function termination_rate_error_download() { |
|
205 | 205 | $this->load->helper('download'); |
206 | - $error_data = $this->session->userdata('import_termination_rate_csv_error'); |
|
206 | + $error_data = $this->session->userdata('import_termination_rate_csv_error'); |
|
207 | 207 | $full_path = $this->config->item('rates-file-path'); |
208 | 208 | $data = file_get_contents($full_path.$error_data); |
209 | 209 | force_download("Termination_rate_error.csv", $data); |
@@ -211,182 +211,182 @@ discard block |
||
211 | 211 | } |
212 | 212 | function origination_rate_import() { |
213 | 213 | $data['page_title'] = 'Import Origination Rates'; |
214 | - $this->session->set_userdata('import_origination_rate_csv',""); |
|
215 | - $error_data = $this->session->userdata('import_origination_rate_csv_error'); |
|
214 | + $this->session->set_userdata('import_origination_rate_csv', ""); |
|
215 | + $error_data = $this->session->userdata('import_origination_rate_csv_error'); |
|
216 | 216 | $full_path = $this->config->item('rates-file-path'); |
217 | - if(file_exists($full_path.$error_data) && $error_data != ""){ |
|
217 | + if (file_exists($full_path.$error_data) && $error_data != "") { |
|
218 | 218 | unlink($full_path.$error_data); |
219 | - $this->session->set_userdata('import_origination_rate_csv_error',""); |
|
219 | + $this->session->set_userdata('import_origination_rate_csv_error', ""); |
|
220 | 220 | } |
221 | 221 | $this->load->view('view_import_origination_rate', $data); |
222 | 222 | } |
223 | - function origination_rate_preview_file(){ |
|
224 | - $invalid_flag= false; |
|
225 | - $data=array(); |
|
223 | + function origination_rate_preview_file() { |
|
224 | + $invalid_flag = false; |
|
225 | + $data = array(); |
|
226 | 226 | $data['page_title'] = 'Import Origination Rates'; |
227 | - $check_header=$this->input->post('check_header',true); |
|
228 | - if(empty($_FILES) || !isset($_FILES)){ |
|
227 | + $check_header = $this->input->post('check_header', true); |
|
228 | + if (empty($_FILES) || ! isset($_FILES)) { |
|
229 | 229 | redirect(base_url()."rates/origination_rate_list/"); |
230 | 230 | } |
231 | - $get_extension=strpos($_FILES['origination_rate_import']['name'],'.'); |
|
231 | + $get_extension = strpos($_FILES['origination_rate_import']['name'], '.'); |
|
232 | 232 | $new_final_arr_key = $this->config->item('Origination-rates-field'); |
233 | - if(!$get_extension){ |
|
234 | - $data['error']= "Please Upload File Atleast"; |
|
233 | + if ( ! $get_extension) { |
|
234 | + $data['error'] = "Please Upload File Atleast"; |
|
235 | 235 | } |
236 | 236 | if (isset($_FILES['origination_rate_import']['name']) && $_FILES['origination_rate_import']['name'] != "" && isset($_POST['pricelist_id']) && $_POST['pricelist_id'] != '') { |
237 | - list($txt,$ext) = explode(".", $_FILES['origination_rate_import']['name']); |
|
237 | + list($txt, $ext) = explode(".", $_FILES['origination_rate_import']['name']); |
|
238 | 238 | |
239 | - if($ext == "csv" && $_FILES['origination_rate_import']['size'] > 0){ |
|
239 | + if ($ext == "csv" && $_FILES['origination_rate_import']['size'] > 0) { |
|
240 | 240 | $error = $_FILES['origination_rate_import']['error']; |
241 | 241 | if ($error == 0) { |
242 | 242 | $uploadedFile = $_FILES["origination_rate_import"]["tmp_name"]; |
243 | - $csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header); |
|
244 | - if(!empty($csv_data)){ |
|
243 | + $csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header); |
|
244 | + if ( ! empty($csv_data)) { |
|
245 | 245 | $full_path = $this->config->item('rates-file-path'); |
246 | - $actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s"). "." . $ext; |
|
247 | - if (move_uploaded_file($uploadedFile,$full_path.$actual_file_name)) { |
|
248 | - $flag=false; |
|
249 | - $data['trunkid']=isset($_POST['trunk_id']) && $_POST['trunk_id'] > 0 ? $_POST['trunk_id'] : 0; |
|
246 | + $actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s").".".$ext; |
|
247 | + if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) { |
|
248 | + $flag = false; |
|
249 | + $data['trunkid'] = isset($_POST['trunk_id']) && $_POST['trunk_id'] > 0 ? $_POST['trunk_id'] : 0; |
|
250 | 250 | $data['csv_tmp_data'] = $csv_data; |
251 | 251 | $data['pricelistid'] = $_POST['pricelist_id']; |
252 | 252 | $data['page_title'] = "Origination Rates Preview"; |
253 | - $data['check_header']=$check_header; |
|
254 | - $this->session->set_userdata('import_origination_rate_csv',$actual_file_name); |
|
255 | - }else{ |
|
253 | + $data['check_header'] = $check_header; |
|
254 | + $this->session->set_userdata('import_origination_rate_csv', $actual_file_name); |
|
255 | + } else { |
|
256 | 256 | $data['error'] = "File Uploading Fail Please Try Again"; |
257 | 257 | } |
258 | 258 | } |
259 | 259 | } |
260 | - else{ |
|
261 | - $data['error']=="File Uploading Fail Please Try Again"; |
|
260 | + else { |
|
261 | + $data['error'] == "File Uploading Fail Please Try Again"; |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | else { |
265 | 265 | $data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)"; |
266 | 266 | } |
267 | - }else{ |
|
268 | - $invalid_flag=true; |
|
267 | + } else { |
|
268 | + $invalid_flag = true; |
|
269 | 269 | } |
270 | 270 | if ($invalid_flag) { |
271 | 271 | $str = ''; |
272 | - if (!isset($_POST['pricelist_id']) || empty($_POST['pricelist_id'])) { |
|
273 | - $str.= '<br/>Please Create Rate Group.'; |
|
272 | + if ( ! isset($_POST['pricelist_id']) || empty($_POST['pricelist_id'])) { |
|
273 | + $str .= '<br/>Please Create Rate Group.'; |
|
274 | 274 | } |
275 | 275 | if (empty($_FILES['origination_rate_import']['name'])) { |
276 | - $str.= '<br/>Please Select File.'; |
|
276 | + $str .= '<br/>Please Select File.'; |
|
277 | 277 | } |
278 | - $data['error']=$str; |
|
278 | + $data['error'] = $str; |
|
279 | 279 | } |
280 | 280 | $this->load->view('view_import_origination_rate', $data); |
281 | 281 | } |
282 | - function origination_rate_import_file($pricelistID,$trunkid,$check_header=false) { |
|
282 | + function origination_rate_import_file($pricelistID, $trunkid, $check_header = false) { |
|
283 | 283 | $new_final_arr = array(); |
284 | 284 | $invalid_array = array(); |
285 | 285 | $new_final_arr_key = $this->config->item('Origination-rates-field'); |
286 | 286 | $screen_path = $this->config->item('screen_path'); |
287 | - $reseller_id=0; |
|
287 | + $reseller_id = 0; |
|
288 | 288 | if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
289 | 289 | $reseller_id = $this->session->userdata["accountinfo"]['id']; |
290 | 290 | } |
291 | 291 | |
292 | 292 | $full_path = $this->config->item('rates-file-path'); |
293 | 293 | $originationrate_file_name = $this->session->userdata('import_origination_rate_csv'); |
294 | - $csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name,$new_final_arr_key,$check_header); |
|
294 | + $csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name, $new_final_arr_key, $check_header); |
|
295 | 295 | //echo "<pre>";print_r($csv_tmp_data);exit; |
296 | - $i=0; |
|
296 | + $i = 0; |
|
297 | 297 | foreach ($csv_tmp_data as $key => $csv_data) { |
298 | - if(isset($csv_data['pattern']) && $csv_data['pattern']!= '' && $i != 0){ |
|
299 | - $str=null; |
|
300 | - $csv_data['comment']= isset($csv_data['comment'])? $csv_data['comment'] :''; |
|
301 | - $csv_data['connectcost']= isset($csv_data['connectcost']) ? $csv_data['connectcost'] :0; |
|
302 | - $csv_data['includedseconds']= isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] :0; |
|
303 | - $csv_data['cost']= !empty($csv_data['cost']) && is_numeric( $csv_data['cost']) ? $csv_data['cost'] :0; |
|
304 | - $csv_data['inc']= isset($csv_data['inc']) ? $csv_data['inc'] :0; |
|
305 | - $csv_data['precedence']= isset($csv_data['precedence']) ? $csv_data['precedence'] :''; |
|
298 | + if (isset($csv_data['pattern']) && $csv_data['pattern'] != '' && $i != 0) { |
|
299 | + $str = null; |
|
300 | + $csv_data['comment'] = isset($csv_data['comment']) ? $csv_data['comment'] : ''; |
|
301 | + $csv_data['connectcost'] = isset($csv_data['connectcost']) ? $csv_data['connectcost'] : 0; |
|
302 | + $csv_data['includedseconds'] = isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] : 0; |
|
303 | + $csv_data['cost'] = ! empty($csv_data['cost']) && is_numeric($csv_data['cost']) ? $csv_data['cost'] : 0; |
|
304 | + $csv_data['inc'] = isset($csv_data['inc']) ? $csv_data['inc'] : 0; |
|
305 | + $csv_data['precedence'] = isset($csv_data['precedence']) ? $csv_data['precedence'] : ''; |
|
306 | 306 | $csv_data['last_modified_date'] = date("Y-m-d H:i:s"); |
307 | - $str=$this->data_validate($csv_data); |
|
308 | - if($str != ""){ |
|
309 | - $invalid_array[$i]=$csv_data; |
|
307 | + $str = $this->data_validate($csv_data); |
|
308 | + if ($str != "") { |
|
309 | + $invalid_array[$i] = $csv_data; |
|
310 | 310 | $invalid_array[$i]['error'] = $str; |
311 | 311 | } |
312 | - else{ |
|
313 | - $csv_data['pricelist_id']=$pricelistID; |
|
314 | - $csv_data['trunk_id']=$trunkid; |
|
315 | - $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*"; |
|
316 | - $csv_data['reseller_id']= $reseller_id; |
|
312 | + else { |
|
313 | + $csv_data['pricelist_id'] = $pricelistID; |
|
314 | + $csv_data['trunk_id'] = $trunkid; |
|
315 | + $csv_data['pattern'] = "^".$csv_data['pattern'].".*"; |
|
316 | + $csv_data['reseller_id'] = $reseller_id; |
|
317 | 317 | $csv_data['creation_date'] = gmdate('Y-m-d H:i:s'); |
318 | - $new_final_arr[$i]=$csv_data; |
|
318 | + $new_final_arr[$i] = $csv_data; |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | $i++; |
322 | 322 | } |
323 | - if(!empty($new_final_arr)){ |
|
323 | + if ( ! empty($new_final_arr)) { |
|
324 | 324 | $result = $this->rates_model->bulk_insert_origination_rate($new_final_arr); |
325 | 325 | } |
326 | 326 | unlink($full_path.$originationrate_file_name); |
327 | - $count=count($invalid_array); |
|
328 | - if($count >0){ |
|
327 | + $count = count($invalid_array); |
|
328 | + if ($count > 0) { |
|
329 | 329 | $session_id = "-1"; |
330 | 330 | $fp = fopen($full_path.$session_id.'.csv', 'w'); |
331 | - foreach($new_final_arr_key as $key=>$value){ |
|
332 | - $custom_array[0][$key]=ucfirst($key); |
|
331 | + foreach ($new_final_arr_key as $key=>$value) { |
|
332 | + $custom_array[0][$key] = ucfirst($key); |
|
333 | 333 | } |
334 | - $custom_array[0]['error']= "Error"; |
|
335 | - $invalid_array =array_merge($custom_array,$invalid_array); |
|
336 | - foreach($invalid_array as $err_data){ |
|
337 | - fputcsv($fp,$err_data); |
|
334 | + $custom_array[0]['error'] = "Error"; |
|
335 | + $invalid_array = array_merge($custom_array, $invalid_array); |
|
336 | + foreach ($invalid_array as $err_data) { |
|
337 | + fputcsv($fp, $err_data); |
|
338 | 338 | } |
339 | 339 | fclose($fp); |
340 | 340 | $this->session->set_userdata('import_origination_rate_csv_error', $session_id.".csv"); |
341 | 341 | $data["error"] = $invalid_array; |
342 | 342 | $data['pricelistid'] = $pricelistID; |
343 | 343 | $data['impoted_count'] = count($new_final_arr); |
344 | - $data['failure_count'] = count($invalid_array)-1; |
|
344 | + $data['failure_count'] = count($invalid_array) - 1; |
|
345 | 345 | $data['page_title'] = 'Origination Rates Import Error'; |
346 | - $this->load->view('view_import_error',$data); |
|
347 | - } else{ |
|
346 | + $this->load->view('view_import_error', $data); |
|
347 | + } else { |
|
348 | 348 | $this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Origination rates imported successfully!'); |
349 | 349 | redirect(base_url()."rates/origination_rates_list/"); |
350 | 350 | } |
351 | 351 | } |
352 | - function data_validate($csvdata){ |
|
353 | - $str=null; |
|
352 | + function data_validate($csvdata) { |
|
353 | + $str = null; |
|
354 | 354 | $alpha_regex = "/^[a-z ,.'-]+$/i"; |
355 | 355 | $alpha_numeric_regex = "/^[a-z0-9 ,.'-]+$/i"; |
356 | 356 | $email_regex = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/"; |
357 | - $str.= $csvdata['pattern']!= '' ? null : 'Code,'; |
|
358 | - $str=rtrim($str,','); |
|
359 | - if(!$str){ |
|
360 | - $str.= is_numeric($csvdata['pattern']) ? null : 'Code,'; |
|
357 | + $str .= $csvdata['pattern'] != '' ? null : 'Code,'; |
|
358 | + $str = rtrim($str, ','); |
|
359 | + if ( ! $str) { |
|
360 | + $str .= is_numeric($csvdata['pattern']) ? null : 'Code,'; |
|
361 | 361 | |
362 | - $str.= !empty($csvdata['connectcost']) && is_numeric( $csvdata['connectcost']) ? null :( empty($csvdata['connectcost']) ? null : 'Connect Cost,'); |
|
363 | - $str.= !empty($csvdata['includedseconds']) && is_numeric( $csvdata['includedseconds']) ? null :( empty($csvdata['includedseconds']) ? null : 'Included Seconds,'); |
|
362 | + $str .= ! empty($csvdata['connectcost']) && is_numeric($csvdata['connectcost']) ? null : (empty($csvdata['connectcost']) ? null : 'Connect Cost,'); |
|
363 | + $str .= ! empty($csvdata['includedseconds']) && is_numeric($csvdata['includedseconds']) ? null : (empty($csvdata['includedseconds']) ? null : 'Included Seconds,'); |
|
364 | 364 | |
365 | - $str.= !empty($csvdata['inc']) && is_numeric( $csvdata['inc']) ? null :( empty($csvdata['inc']) ? null : 'Increment,'); |
|
366 | - $str.= !empty($csvdata['precedence']) && is_numeric( $csvdata['precedence']) ? null :( empty($csvdata['precedence']) ? null : 'Precedence,'); |
|
367 | - $str.= (isset($csvdata['strip']) && !empty($csvdata['strip'])) ? (is_numeric($csvdata['strip']) ? null :'Strip,') : null; |
|
368 | - if($str){ |
|
369 | - $str=rtrim($str,','); |
|
370 | - $error_field=explode(',',$str); |
|
365 | + $str .= ! empty($csvdata['inc']) && is_numeric($csvdata['inc']) ? null : (empty($csvdata['inc']) ? null : 'Increment,'); |
|
366 | + $str .= ! empty($csvdata['precedence']) && is_numeric($csvdata['precedence']) ? null : (empty($csvdata['precedence']) ? null : 'Precedence,'); |
|
367 | + $str .= (isset($csvdata['strip']) && ! empty($csvdata['strip'])) ? (is_numeric($csvdata['strip']) ? null : 'Strip,') : null; |
|
368 | + if ($str) { |
|
369 | + $str = rtrim($str, ','); |
|
370 | + $error_field = explode(',', $str); |
|
371 | 371 | $count = count($error_field); |
372 | - $str.= $count > 1 ? ' are not valid' : ' is not Valid'; |
|
372 | + $str .= $count > 1 ? ' are not valid' : ' is not Valid'; |
|
373 | 373 | return $str; |
374 | 374 | } |
375 | - else{ |
|
375 | + else { |
|
376 | 376 | return false; |
377 | 377 | } |
378 | 378 | } |
379 | - else{ |
|
380 | - $str=rtrim($str,','); |
|
381 | - $error_field=explode(',',$str); |
|
379 | + else { |
|
380 | + $str = rtrim($str, ','); |
|
381 | + $error_field = explode(',', $str); |
|
382 | 382 | $count = count($error_field); |
383 | - $str.= $count > 1 ? ' are required' : ' is Required'; |
|
383 | + $str .= $count > 1 ? ' are required' : ' is Required'; |
|
384 | 384 | return $str; |
385 | 385 | } |
386 | 386 | } |
387 | - function origination_rate_error_download(){ |
|
387 | + function origination_rate_error_download() { |
|
388 | 388 | $this->load->helper('download'); |
389 | - $error_data = $this->session->userdata('import_origination_rate_csv_error'); |
|
389 | + $error_data = $this->session->userdata('import_origination_rate_csv_error'); |
|
390 | 390 | $full_path = $this->config->item('rates-file-path'); |
391 | 391 | $data = file_get_contents($full_path.$error_data); |
392 | 392 | force_download("Origination_rate_error.csv", $data); |
@@ -416,13 +416,13 @@ discard block |
||
416 | 416 | $edit_data = $value; |
417 | 417 | } |
418 | 418 | $edit_data['connectcost'] = $this->common_model->to_calculate_currency($edit_data['connectcost'], '', '', true, false); |
419 | - $edit_data['cost'] = $this->common_model->to_calculate_currency($edit_data['cost'], '', '',true, false); |
|
419 | + $edit_data['cost'] = $this->common_model->to_calculate_currency($edit_data['cost'], '', '', true, false); |
|
420 | 420 | $edit_data['pattern'] = filter_var($edit_data['pattern'], FILTER_SANITIZE_NUMBER_INT); |
421 | 421 | |
422 | 422 | $data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), $edit_data); |
423 | 423 | $this->load->view('view_origination_rate_add_edit', $data); |
424 | 424 | } else { |
425 | - redirect(base_url() . 'rates/origination_rate_list/'); |
|
425 | + redirect(base_url().'rates/origination_rate_list/'); |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | $this->session->set_userdata('origination_rate_list_search', $action); |
471 | 471 | } |
472 | 472 | if (@$ajax_search != 1) { |
473 | - redirect(base_url() . 'rates/origination_rates_list/'); |
|
473 | + redirect(base_url().'rates/origination_rates_list/'); |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | |
@@ -482,13 +482,13 @@ discard block |
||
482 | 482 | function termination_rate_delete($id) { |
483 | 483 | $this->rates_model->remove_termination_rate($id); |
484 | 484 | $this->session->set_flashdata('astpp_notification', 'Termination removed successfully!'); |
485 | - redirect(base_url() . '/rates/termination_rates_list/'); |
|
485 | + redirect(base_url().'/rates/termination_rates_list/'); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | function origination_rate_delete($id) { |
489 | 489 | $this->rates_model->remove_origination_rate($id); |
490 | 490 | $this->session->set_flashdata('astpp_notification', 'Origination rate removed successfully!'); |
491 | - redirect(base_url() . 'rates/origination_rates_list/'); |
|
491 | + redirect(base_url().'rates/origination_rates_list/'); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | function origination_rates_list() { |
@@ -527,9 +527,9 @@ discard block |
||
527 | 527 | echo json_encode($json_data); |
528 | 528 | } |
529 | 529 | |
530 | - function origination_rates_list_delete($flag='') { |
|
530 | + function origination_rates_list_delete($flag = '') { |
|
531 | 531 | $json_data = array(); |
532 | - $this->session->set_userdata('advance_batch_data_delete',1); |
|
532 | + $this->session->set_userdata('advance_batch_data_delete', 1); |
|
533 | 533 | $count_all = $this->rates_model->get_origination_rate_list(false); |
534 | 534 | echo $count_all; |
535 | 535 | } |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | $this->session->set_userdata('termination_rates_list_search', $action); |
604 | 604 | } |
605 | 605 | if (@$ajax_search != 1) { |
606 | - redirect(base_url() . 'rates/termination_rates_list/'); |
|
606 | + redirect(base_url().'rates/termination_rates_list/'); |
|
607 | 607 | } |
608 | 608 | } |
609 | 609 | |
@@ -612,20 +612,20 @@ discard block |
||
612 | 612 | $this->session->set_userdata('account_search', ""); |
613 | 613 | } |
614 | 614 | |
615 | - function customer_block_pattern_list($accountid,$accounttype) { |
|
615 | + function customer_block_pattern_list($accountid, $accounttype) { |
|
616 | 616 | $json_data = array(); |
617 | 617 | $where = array('accountid' => $accountid); |
618 | - $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_pattern'); |
|
619 | - $like_str=!empty($instant_search) ? "(blocked_patterns like '%$instant_search%' OR destination like '%$instant_search%' )" :null; |
|
620 | - if(!empty($like_str)) |
|
618 | + $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_pattern'); |
|
619 | + $like_str = ! empty($instant_search) ? "(blocked_patterns like '%$instant_search%' OR destination like '%$instant_search%' )" : null; |
|
620 | + if ( ! empty($like_str)) |
|
621 | 621 | $this->db->where($like_str); |
622 | 622 | $count_all = $this->db_model->countQuery("*", "block_patterns", $where); |
623 | 623 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
624 | 624 | $json_data = $paging_data["json_paging"]; |
625 | - if(!empty($like_str)) |
|
625 | + if ( ! empty($like_str)) |
|
626 | 626 | $this->db->where($like_str); |
627 | 627 | $pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
628 | - $grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid,$accounttype)); |
|
628 | + $grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid, $accounttype)); |
|
629 | 629 | $json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields); |
630 | 630 | echo json_encode($json_data); |
631 | 631 | } |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | $json_data = array(); |
649 | 649 | $account_data = $this->session->userdata("accountinfo"); |
650 | 650 | $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
651 | - $markup = ($markup > 0)?$markup:1; |
|
651 | + $markup = ($markup > 0) ? $markup : 1; |
|
652 | 652 | |
653 | 653 | $count_all = $this->rates_model->get_origination_rate_list_for_user(false); |
654 | 654 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
@@ -658,11 +658,11 @@ discard block |
||
658 | 658 | $grid_fields = json_decode($this->rates_form->build_origination_rate_list_for_user()); |
659 | 659 | foreach ($query->result_array() as $key => $value) { |
660 | 660 | $json_data['rows'][] = array('cell' => array( |
661 | - $this->common->get_only_numeric_val("","",$value["pattern"]), |
|
661 | + $this->common->get_only_numeric_val("", "", $value["pattern"]), |
|
662 | 662 | $value['comment'], |
663 | 663 | $value['inc'], |
664 | - $this->common_model->calculate_currency(($value['cost'] + ($value['cost']*$markup)/100),'','','',true), |
|
665 | - $this->common_model->calculate_currency($value['connectcost'],'','','',true), |
|
664 | + $this->common_model->calculate_currency(($value['cost'] + ($value['cost'] * $markup) / 100), '', '', '', true), |
|
665 | + $this->common_model->calculate_currency($value['connectcost'], '', '', '', true), |
|
666 | 666 | $value['includedseconds'] |
667 | 667 | )); |
668 | 668 | } |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | $this->session->set_userdata('origination_rate_list_search', $action); |
682 | 682 | } |
683 | 683 | if (@$ajax_search != 1) { |
684 | - redirect(base_url() . 'user/user_rates_list/'); |
|
684 | + redirect(base_url().'user/user_rates_list/'); |
|
685 | 685 | } |
686 | 686 | } |
687 | 687 | |
@@ -689,10 +689,10 @@ discard block |
||
689 | 689 | $this->session->set_userdata('advance_search', 0); |
690 | 690 | $this->session->set_userdata('account_search', ""); |
691 | 691 | } |
692 | - function customer_rates_download_sample_file($file_name){ |
|
692 | + function customer_rates_download_sample_file($file_name) { |
|
693 | 693 | $this->load->helper('download'); |
694 | 694 | $full_path = base_url()."assets/Rates_File/".$file_name.".csv"; |
695 | - $arrContextOptions=array( |
|
695 | + $arrContextOptions = array( |
|
696 | 696 | "ssl"=>array( |
697 | 697 | "verify_peer"=>false, |
698 | 698 | "verify_peer_name"=>false, |
@@ -701,19 +701,19 @@ discard block |
||
701 | 701 | $file = file_get_contents($full_path, false, stream_context_create($arrContextOptions)); |
702 | 702 | force_download("samplefile.csv", $file); |
703 | 703 | } |
704 | - function termination_rate_batch_update(){ |
|
704 | + function termination_rate_batch_update() { |
|
705 | 705 | $batch_update_arr = $this->input->post(); |
706 | - $batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"])?$this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false):"0.0000"; |
|
707 | - $batch_update_arr["connectcost"]["connectcost"] = isset($batch_update_arr["connectcost"]["connectcost"])?$this->common_model->add_calculate_currency($batch_update_arr["connectcost"]["connectcost"], '', '', true, false):"0.0000"; |
|
706 | + $batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"]) ? $this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false) : "0.0000"; |
|
707 | + $batch_update_arr["connectcost"]["connectcost"] = isset($batch_update_arr["connectcost"]["connectcost"]) ? $this->common_model->add_calculate_currency($batch_update_arr["connectcost"]["connectcost"], '', '', true, false) : "0.0000"; |
|
708 | 708 | // $batch_update_arr = array("inc"=> array("inc"=>"1","operator"=>"3"),"cost"=> array("cost"=>"1","operator"=>"4")); |
709 | 709 | $result = $this->rates_model->termination_rate_batch_update($batch_update_arr); |
710 | 710 | echo json_encode(array("SUCCESS"=> "Termination rates batch updated successfully!")); |
711 | 711 | exit; |
712 | 712 | } |
713 | 713 | |
714 | - function origination_rate_batch_update(){ |
|
714 | + function origination_rate_batch_update() { |
|
715 | 715 | $batch_update_arr = $this->input->post(); |
716 | - $batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"])?$this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false):"0.0000"; |
|
716 | + $batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"]) ? $this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false) : "0.0000"; |
|
717 | 717 | // $batch_update_arr = array("inc"=> array("inc"=>"1","operator"=>"3"),"cost"=> array("cost"=>"1","operator"=>"4")); |
718 | 718 | $result = $this->rates_model->origination_rate_batch_update($batch_update_arr); |
719 | 719 | echo json_encode(array("SUCCESS"=> "Origination rates batch updated successfully!")); |
@@ -722,23 +722,23 @@ discard block |
||
722 | 722 | |
723 | 723 | function termination_rate_export_cdr_xls() { |
724 | 724 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
725 | - $currency_id=$account_info['currency_id']; |
|
726 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
725 | + $currency_id = $account_info['currency_id']; |
|
726 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
727 | 727 | $query = $this->rates_model->get_termination_rate(true, '', '', false); |
728 | 728 | $outbound_array = array(); |
729 | 729 | ob_clean(); |
730 | - $outbound_array[] = array("Code", "Destination", "Connect Cost($currency)", "Included Seconds","Per Minute Cost($currency)","Initial Increment", "Increment","Priority","Strip","Prepend","Trunk","Status","Created Date"); |
|
730 | + $outbound_array[] = array("Code", "Destination", "Connect Cost($currency)", "Included Seconds", "Per Minute Cost($currency)", "Initial Increment", "Increment", "Priority", "Strip", "Prepend", "Trunk", "Status", "Created Date"); |
|
731 | 731 | if ($query->num_rows() > 0) { |
732 | 732 | |
733 | 733 | foreach ($query->result_array() as $row) { |
734 | 734 | //echo"<pre>";print_r($row);exit; |
735 | 735 | $outbound_array[] = array( |
736 | - $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]), |
|
736 | + $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]), |
|
737 | 737 | $row['comment'], |
738 | - $this->common_model->calculate_currency($row['connectcost'],'','',TRUE,false), |
|
738 | + $this->common_model->calculate_currency($row['connectcost'], '', '', TRUE, false), |
|
739 | 739 | |
740 | 740 | $row['includedseconds'], |
741 | - $this->common_model->calculate_currency($row['cost'],'','',TRUE,false), |
|
741 | + $this->common_model->calculate_currency($row['cost'], '', '', TRUE, false), |
|
742 | 742 | /** |
743 | 743 | ASTPP 3.0 |
744 | 744 | For Add Initial Increment field |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | $row['strip'], |
751 | 751 | $row['prepend'], |
752 | 752 | //$row['trunk_id'], |
753 | - $this->common->get_field_name('name','trunks',$row["trunk_id"]), |
|
753 | + $this->common->get_field_name('name', 'trunks', $row["trunk_id"]), |
|
754 | 754 | $this->common->get_status('export', '', $row['status']), |
755 | 755 | $row['creation_date'], |
756 | 756 | |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | } |
760 | 760 | $this->load->helper('csv'); |
761 | 761 | |
762 | - array_to_csv($outbound_array, 'Termination_Rates_' . date("Y-m-d") . '.csv'); |
|
762 | + array_to_csv($outbound_array, 'Termination_Rates_'.date("Y-m-d").'.csv'); |
|
763 | 763 | |
764 | 764 | } |
765 | 765 | |
@@ -770,13 +770,13 @@ discard block |
||
770 | 770 | $this->load->library('pdf'); |
771 | 771 | $this->fpdf = new PDF('P', 'pt'); |
772 | 772 | $this->fpdf->initialize('P', 'mm', 'A4'); |
773 | - $this->fpdf->tablewidths = array(20, 30, 20, 20, 20, 20, 20,20,20); |
|
774 | - $outbound_array[] = array("Code", "Destination", "Connect Cost","Included Seconds","Per Minute Cost","Initial Increment", "Increment","Precedence","Prepend","Strip"); |
|
773 | + $this->fpdf->tablewidths = array(20, 30, 20, 20, 20, 20, 20, 20, 20); |
|
774 | + $outbound_array[] = array("Code", "Destination", "Connect Cost", "Included Seconds", "Per Minute Cost", "Initial Increment", "Increment", "Precedence", "Prepend", "Strip"); |
|
775 | 775 | if ($query->num_rows() > 0) { |
776 | 776 | |
777 | 777 | foreach ($query->result_array() as $row) { |
778 | 778 | $outbound_array[] = array( |
779 | - $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]), |
|
779 | + $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]), |
|
780 | 780 | $row['comment'], |
781 | 781 | $row['connectcost'], |
782 | 782 | $row['includedseconds'], |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | |
800 | 800 | $this->fpdf->SetFont('Arial', '', 15); |
801 | 801 | $this->fpdf->SetXY(60, 5); |
802 | - $this->fpdf->Cell(100, 10, "Outbound Rates Report " . date('Y-m-d')); |
|
802 | + $this->fpdf->Cell(100, 10, "Outbound Rates Report ".date('Y-m-d')); |
|
803 | 803 | |
804 | 804 | $this->fpdf->SetY(20); |
805 | 805 | $this->fpdf->SetFont('Arial', '', 7); |
@@ -807,29 +807,29 @@ discard block |
||
807 | 807 | $this->fpdf->lMargin = 2; |
808 | 808 | |
809 | 809 | $dimensions = $this->fpdf->export_pdf($outbound_array, "7"); |
810 | - $this->fpdf->Output('Termination_Rate_' . date("Y-m-d") . '.pdf', "D"); |
|
810 | + $this->fpdf->Output('Termination_Rate_'.date("Y-m-d").'.pdf', "D"); |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | |
814 | 814 | function origination_rate_export_cdr_xls() { |
815 | 815 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
816 | - $currency_id=$account_info['currency_id']; |
|
817 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
816 | + $currency_id = $account_info['currency_id']; |
|
817 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
818 | 818 | $query = $this->rates_model->get_origination_rate(true, '', '', false); |
819 | 819 | //echo "<pre>";print_r($query);exit; |
820 | 820 | $inbound_array = array(); |
821 | 821 | ob_clean(); |
822 | - $inbound_array[] = array("Code", "Destination","Connect Cost($currency)","Included Seconds","Per Minute Cost($currency)", "Initial Increment", "Increment","Rate Group","Status","Created Date"); |
|
822 | + $inbound_array[] = array("Code", "Destination", "Connect Cost($currency)", "Included Seconds", "Per Minute Cost($currency)", "Initial Increment", "Increment", "Rate Group", "Status", "Created Date"); |
|
823 | 823 | if ($query->num_rows() > 0) { |
824 | 824 | |
825 | 825 | foreach ($query->result_array() as $row) { |
826 | 826 | //echo"<pre>";print_r($row);exit; |
827 | 827 | $inbound_array[] = array( |
828 | - $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]), |
|
828 | + $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]), |
|
829 | 829 | $row['comment'], |
830 | - $this->common_model->calculate_currency($row['connectcost'],'','',TRUE,false), |
|
830 | + $this->common_model->calculate_currency($row['connectcost'], '', '', TRUE, false), |
|
831 | 831 | $row['includedseconds'], |
832 | - $this->common_model->calculate_currency($row['cost'],'','',TRUE,false), |
|
832 | + $this->common_model->calculate_currency($row['cost'], '', '', TRUE, false), |
|
833 | 833 | /** |
834 | 834 | ASTPP 3.0 |
835 | 835 | For Add Initial Increment field |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | } |
846 | 846 | } |
847 | 847 | $this->load->helper('csv'); |
848 | - array_to_csv($inbound_array, 'Origination_Rates_' . date("Y-m-d") . '.csv'); |
|
848 | + array_to_csv($inbound_array, 'Origination_Rates_'.date("Y-m-d").'.csv'); |
|
849 | 849 | } |
850 | 850 | function origination_rate_export_cdr_pdf() { |
851 | 851 | $query = $this->rates_model->get_origination_rate(true, '', '', false); |
@@ -856,15 +856,15 @@ discard block |
||
856 | 856 | $this->fpdf = new PDF('P', 'pt'); |
857 | 857 | $this->fpdf->initialize('P', 'mm', 'A4'); |
858 | 858 | $this->fpdf->tablewidths = array(20, 20, 20, 20, 20, 20); |
859 | - $inbound_array[] = array("Code", "Destination","Connect Cost","Included Seconds","Per Minute Cost","Initial Increment","Increment"); |
|
859 | + $inbound_array[] = array("Code", "Destination", "Connect Cost", "Included Seconds", "Per Minute Cost", "Initial Increment", "Increment"); |
|
860 | 860 | if ($query->num_rows() > 0) { |
861 | 861 | foreach ($query->result_array() as $row) { |
862 | 862 | $inbound_array[] = array( |
863 | - $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]), |
|
863 | + $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]), |
|
864 | 864 | $row['comment'], |
865 | 865 | $row['connectcost'], |
866 | 866 | $row['includedseconds'], |
867 | - $this->common_model->calculate_currency($row['cost'],'','','',false), |
|
867 | + $this->common_model->calculate_currency($row['cost'], '', '', '', false), |
|
868 | 868 | /** |
869 | 869 | ASTPP 3.0 |
870 | 870 | For Add Initial Increment field |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | |
881 | 881 | $this->fpdf->SetFont('Arial', '', 15); |
882 | 882 | $this->fpdf->SetXY(60, 5); |
883 | - $this->fpdf->Cell(100, 10, "Origination Rates Report " . date('Y-m-d')); |
|
883 | + $this->fpdf->Cell(100, 10, "Origination Rates Report ".date('Y-m-d')); |
|
884 | 884 | |
885 | 885 | $this->fpdf->SetY(20); |
886 | 886 | $this->fpdf->SetFont('Arial', '', 7); |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | $this->fpdf->lMargin = 2; |
889 | 889 | |
890 | 890 | $dimensions = $this->fpdf->export_pdf($inbound_array, "5"); |
891 | - $this->fpdf->Output('Origination_Rate_' . date("Y-m-d") . '.pdf', "D"); |
|
891 | + $this->fpdf->Output('Origination_Rate_'.date("Y-m-d").'.pdf', "D"); |
|
892 | 892 | } |
893 | 893 | |
894 | 894 | |
@@ -900,14 +900,14 @@ discard block |
||
900 | 900 | $this->fpdf = new PDF('P', 'pt'); |
901 | 901 | $this->fpdf->initialize('P', 'mm', 'A4'); |
902 | 902 | $this->fpdf->tablewidths = array(20, 20, 20, 20, 20, 20); |
903 | - $inbound_array[] = array("Code", "Destination", "Increment","Cost Per Minutes", "Connect Charge", "Included Seconds"); |
|
903 | + $inbound_array[] = array("Code", "Destination", "Increment", "Cost Per Minutes", "Connect Charge", "Included Seconds"); |
|
904 | 904 | if ($query->num_rows() > 0) { |
905 | 905 | foreach ($query->result_array() as $row) { |
906 | 906 | $inbound_array[] = array( |
907 | - $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]), |
|
907 | + $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]), |
|
908 | 908 | $row['comment'], |
909 | 909 | $row['inc'], |
910 | - $this->common_model->calculate_currency($row['cost'],'','','',false), |
|
910 | + $this->common_model->calculate_currency($row['cost'], '', '', '', false), |
|
911 | 911 | $row['connectcost'], |
912 | 912 | $row['includedseconds'] |
913 | 913 | ); |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | |
920 | 920 | $this->fpdf->SetFont('Arial', '', 15); |
921 | 921 | $this->fpdf->SetXY(60, 5); |
922 | - $this->fpdf->Cell(100, 10, "Rates Report " . date('Y-m-d')); |
|
922 | + $this->fpdf->Cell(100, 10, "Rates Report ".date('Y-m-d')); |
|
923 | 923 | |
924 | 924 | $this->fpdf->SetY(20); |
925 | 925 | $this->fpdf->SetFont('Arial', '', 7); |
@@ -927,12 +927,12 @@ discard block |
||
927 | 927 | $this->fpdf->lMargin = 2; |
928 | 928 | |
929 | 929 | $dimensions = $this->fpdf->export_pdf($inbound_array, "5"); |
930 | - $this->fpdf->Output('Rates_' . date("Y-m-d") . '.pdf', "D"); |
|
930 | + $this->fpdf->Output('Rates_'.date("Y-m-d").'.pdf', "D"); |
|
931 | 931 | } |
932 | - function resellersrates_list(){ |
|
933 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
932 | + function resellersrates_list() { |
|
933 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
934 | 934 | $data['username'] = $this->session->userdata('user_name'); |
935 | - $data['page_title'] = 'My Rates' ; |
|
935 | + $data['page_title'] = 'My Rates'; |
|
936 | 936 | $data['search_flag'] = true; |
937 | 937 | $this->session->set_userdata('advance_search', 0); |
938 | 938 | $data['grid_fields'] = $this->rates_form->build_rates_list_for_reseller(); |
@@ -952,11 +952,11 @@ discard block |
||
952 | 952 | $grid_fields = json_decode($this->rates_form->build_rates_list_for_reseller()); |
953 | 953 | foreach ($query->result_array() as $key => $value) { |
954 | 954 | $json_data['rows'][] = array('cell' => array( |
955 | - $this->common->get_only_numeric_val("","",$value["pattern"]), |
|
955 | + $this->common->get_only_numeric_val("", "", $value["pattern"]), |
|
956 | 956 | $value['comment'], |
957 | - $this->common_model->calculate_currency($value['connectcost'],'','','true',true), |
|
957 | + $this->common_model->calculate_currency($value['connectcost'], '', '', 'true', true), |
|
958 | 958 | $value['includedseconds'], |
959 | - $this->common_model->calculate_currency(($value['cost'] + ($value['cost']*$markup)/100),'','','true',true), |
|
959 | + $this->common_model->calculate_currency(($value['cost'] + ($value['cost'] * $markup) / 100), '', '', 'true', true), |
|
960 | 960 | $value['inc'], |
961 | 961 | $value['precedence'], |
962 | 962 | )); |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | $this->session->set_userdata('resellerrates_list_search', $action); |
977 | 977 | } |
978 | 978 | if (@$ajax_search != 1) { |
979 | - redirect(base_url() . 'rates/resellersrates_list/'); |
|
979 | + redirect(base_url().'rates/resellersrates_list/'); |
|
980 | 980 | } |
981 | 981 | } |
982 | 982 | function resellersrates_list_clearsearchfilter() { |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | foreach ($query->result_array() as $row) { |
1001 | 1001 | |
1002 | 1002 | $customer_array[] = array( |
1003 | - $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]), |
|
1003 | + $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]), |
|
1004 | 1004 | $row['comment'], |
1005 | 1005 | $row['connectcost'], |
1006 | 1006 | $row['includedseconds'], |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | } |
1013 | 1013 | } |
1014 | 1014 | $this->load->helper('csv'); |
1015 | - array_to_csv($customer_array, 'My_Own_Rate_' . date("Y-m-d") . '.csv'); |
|
1015 | + array_to_csv($customer_array, 'My_Own_Rate_'.date("Y-m-d").'.csv'); |
|
1016 | 1016 | exit; |
1017 | 1017 | } |
1018 | 1018 | /*********** |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | $this->session->set_userdata('termination_rates_list_search', $action); |
1030 | 1030 | } |
1031 | 1031 | if (@$ajax_search != 1) { |
1032 | - redirect(base_url() . 'rates/termination_rates_list/'); |
|
1032 | + redirect(base_url().'rates/termination_rates_list/'); |
|
1033 | 1033 | } |
1034 | 1034 | } |
1035 | 1035 | function origination_rates_list_batch_delete() { |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | $this->session->set_userdata('origination_rate_list_search', $action); |
1043 | 1043 | } |
1044 | 1044 | if (@$ajax_search != 1) { |
1045 | - redirect(base_url() . 'rates/origination_rates_list/'); |
|
1045 | + redirect(base_url().'rates/origination_rates_list/'); |
|
1046 | 1046 | } |
1047 | 1047 | } |
1048 | 1048 | /*************************/ |