@@ -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 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | <div class="col-md-12"> |
| 19 | 19 | <div class="w-box"> |
| 20 | 20 | <span style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;"> |
| 21 | - <? if(isset($error) && !empty($error)) { |
|
| 21 | + <? if (isset($error) && ! empty($error)) { |
|
| 22 | 22 | echo $error; |
| 23 | 23 | }?> |
| 24 | 24 | </span> |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | <div class="col-md-12 no-padding"> |
| 35 | 35 | <label class="col-md-3">Trunk List:</label> |
| 36 | 36 | <div class=""> |
| 37 | - <? $trunklist = form_dropdown('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr",array("status " => "0")), ''); |
|
| 37 | + <? $trunklist = form_dropdown('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr", array("status " => "0")), ''); |
|
| 38 | 38 | echo $trunklist; ?></div> |
| 39 | 39 | </div> |
| 40 | 40 | <div class="col-md-12 no-padding"> |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | <?}?> |
| 89 | 89 | |
| 90 | 90 | <?php |
| 91 | - if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?> |
|
| 91 | + if (isset($csv_tmp_data) && ! empty($csv_tmp_data)) { ?> |
|
| 92 | 92 | |
| 93 | 93 | <section class="slice color-three padding-b-20"> |
| 94 | 94 | <div class="w-section inverse no-padding"> |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | <div class="col-md-12 margin-t-10"> |
| 98 | 98 | <form id="import_form" name="import_form" action="<?=base_url()?>rates/termination_rate_rates_import/<?= $trunkid?>/<?=$check_header?>/" method="POST"> |
| 99 | 99 | <table width="100%" border="1" class="details_table table"> |
| 100 | - <? $cnt =7; |
|
| 101 | - foreach($csv_tmp_data as $csv_key => $csv_value){ |
|
| 102 | - if($csv_key < 15){ |
|
| 100 | + <? $cnt = 7; |
|
| 101 | + foreach ($csv_tmp_data as $csv_key => $csv_value) { |
|
| 102 | + if ($csv_key < 15) { |
|
| 103 | 103 | echo "<tr>"; |
| 104 | - foreach($csv_value as $field_name => $field_val){ |
|
| 105 | - if($csv_key == 0){ |
|
| 104 | + foreach ($csv_value as $field_name => $field_val) { |
|
| 105 | + if ($csv_key == 0) { |
|
| 106 | 106 | echo "<th>".ucfirst($field_name)."</th>"; |
| 107 | - }else{ |
|
| 107 | + } else { |
|
| 108 | 108 | echo "<td class='portlet-content'>".$field_val."</td>"; |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -51,49 +51,49 @@ |
||
| 51 | 51 | $data['reseller_id'] = $data['key_unique']; |
| 52 | 52 | unset($data['agreeCheck']); |
| 53 | 53 | unset($data['key_unique']); |
| 54 | - $data['creation']=gmdate('Y-m-d H:i:s'); |
|
| 54 | + $data['creation'] = gmdate('Y-m-d H:i:s'); |
|
| 55 | 55 | $data['expiry'] = date('Y-m-d H:i:s', strtotime('+10 years')); |
| 56 | - $this->db->insert("accounts",$data); |
|
| 56 | + $this->db->insert("accounts", $data); |
|
| 57 | 57 | return $this->db->insert_id(); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - function check_user($accno,$email,$balance) |
|
| 60 | + function check_user($accno, $email, $balance) |
|
| 61 | 61 | { |
| 62 | - $info = array("number"=>$accno,"email"=>$email,"status"=>1); |
|
| 62 | + $info = array("number"=>$accno, "email"=>$email, "status"=>1); |
|
| 63 | 63 | $this->db->where($info); |
| 64 | 64 | $this->db->select('*'); |
| 65 | - $acc_res=$this->db->get('accounts'); |
|
| 66 | - if($acc_res->num_rows() > 0) |
|
| 65 | + $acc_res = $this->db->get('accounts'); |
|
| 66 | + if ($acc_res->num_rows() > 0) |
|
| 67 | 67 | { |
| 68 | - $acc_res=$acc_res->result_array(); |
|
| 69 | - $acc_res=$acc_res[0]; |
|
| 70 | - $this->db->where('pricelist_id',$acc_res['pricelist_id']); |
|
| 68 | + $acc_res = $acc_res->result_array(); |
|
| 69 | + $acc_res = $acc_res[0]; |
|
| 70 | + $this->db->where('pricelist_id', $acc_res['pricelist_id']); |
|
| 71 | 71 | $this->db->select("*"); |
| 72 | - $charge_res=$this->db->get('charges'); |
|
| 72 | + $charge_res = $this->db->get('charges'); |
|
| 73 | 73 | |
| 74 | - if($charge_res->num_rows() > 0){ |
|
| 75 | - $charge_res=$charge_res->result_array(); |
|
| 76 | - $charge_res=$charge_res[0]; |
|
| 77 | - $charge_acc_arr=array( |
|
| 74 | + if ($charge_res->num_rows() > 0) { |
|
| 75 | + $charge_res = $charge_res->result_array(); |
|
| 76 | + $charge_res = $charge_res[0]; |
|
| 77 | + $charge_acc_arr = array( |
|
| 78 | 78 | "charge_id"=>$charge_res['id'], |
| 79 | 79 | "accountid"=>$acc_res['id'], |
| 80 | 80 | "status"=>0, |
| 81 | 81 | "assign_date"=>date('Y-m-d H:i:s') |
| 82 | 82 | ); |
| 83 | - }else{ |
|
| 84 | - $charge_res=$charge_res->result_array(); |
|
| 83 | + } else { |
|
| 84 | + $charge_res = $charge_res->result_array(); |
|
| 85 | 85 | //echo "<pre>"; print_r($charge_res); exit; |
| 86 | 86 | $charge_acc_arr = array("charge_id"=>'id', |
| 87 | 87 | "accountid"=>$acc_res['id'], |
| 88 | 88 | "assign_date"=>date('Y-m-d H:i:s')); |
| 89 | 89 | } |
| 90 | - $result=$this->db->insert("charge_to_account",$charge_acc_arr); |
|
| 91 | - $update = array("status" => 0,"balance" => $balance ); |
|
| 90 | + $result = $this->db->insert("charge_to_account", $charge_acc_arr); |
|
| 91 | + $update = array("status" => 0, "balance" => $balance); |
|
| 92 | 92 | $this->db->where($info); |
| 93 | 93 | $result = $this->db->update('accounts', $update); |
| 94 | - $sip_device_update = array('username'=>$accno,"status"=>1); |
|
| 94 | + $sip_device_update = array('username'=>$accno, "status"=>1); |
|
| 95 | 95 | return 1; |
| 96 | - } else{ |
|
| 96 | + } else { |
|
| 97 | 97 | return 0; |
| 98 | 98 | } |
| 99 | 99 | } |