@@ -34,8 +34,9 @@ discard block |
||
| 34 | 34 | $this->load->model('did_model'); |
| 35 | 35 | $this->load->library('csvreader'); |
| 36 | 36 | |
| 37 | - if ($this->session->userdata('user_login') == FALSE) |
|
| 38 | - redirect(base_url() . '/astpp/login'); |
|
| 37 | + if ($this->session->userdata('user_login') == FALSE) { |
|
| 38 | + redirect(base_url() . '/astpp/login'); |
|
| 39 | + } |
|
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | function did_add() { |
@@ -163,7 +164,7 @@ discard block |
||
| 163 | 164 | $this->db->where('note',$did_info['number']); |
| 164 | 165 | $this->db->delete("reseller_pricing"); |
| 165 | 166 | } |
| 166 | - }else{ |
|
| 167 | + } else{ |
|
| 167 | 168 | $reseller_ids=$this->common->get_subreseller_info($accountinfo['id']); |
| 168 | 169 | $reseller_ids=rtrim($reseller_ids,","); |
| 169 | 170 | $where="parent_id IN ($reseller_ids)"; |
@@ -172,7 +173,7 @@ discard block |
||
| 172 | 173 | } |
| 173 | 174 | if($accountinfo['type']==1){ |
| 174 | 175 | $update_array = array('parent_id' => $accountinfo['id'], 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00","last_modified_date"=>gmdate("Y-m-d H:i:s"),'call_type'=>'-1','extensions'=>''); |
| 175 | - }else{ |
|
| 176 | + } else{ |
|
| 176 | 177 | $update_array = array('parent_id' => 0, 'accountid' => 0, 'assign_date' => '0000-00-00 00:00:00', "charge_upto" => "0000-00-00 00:00:00","last_modified_date"=>gmdate("Y-m-d H:i:s"),'call_type'=>'-1','extensions'=>''); |
| 177 | 178 | } |
| 178 | 179 | $where = array('id' => $id); |
@@ -181,7 +182,7 @@ discard block |
||
| 181 | 182 | $accountid=$did_info['accountid'] > 0 ? $did_info['accountid']:0; |
| 182 | 183 | if($did_info['accountid'] > 0 ){ |
| 183 | 184 | $email_user_id=$did_info['accountid']; |
| 184 | - }elseif($did_info['parent_id'] > 0){ |
|
| 185 | + } elseif($did_info['parent_id'] > 0){ |
|
| 185 | 186 | $email_user_id=$did_info['parent_id']; |
| 186 | 187 | } |
| 187 | 188 | $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$email_user_id))->first_row(); |
@@ -208,7 +209,7 @@ discard block |
||
| 208 | 209 | $accountinfo = $this->session->userdata('accountinfo'); |
| 209 | 210 | if($accountinfo['reseller_id'] > 0){ |
| 210 | 211 | $dids_array=$this->db->query("SELECT a.id AS id,a.number as number, b.monthlycost, b.setup FROM dids AS a, reseller_pricing AS b WHERE a.number = b.note AND b.reseller_id = ".$accountinfo['reseller_id']." AND a.parent_id =".$accountinfo['reseller_id'])->result_array(); |
| 211 | - }else{ |
|
| 212 | + } else{ |
|
| 212 | 213 | $this->db->select('id,monthlycost,setup,number'); |
| 213 | 214 | $this->db->where('accountid',0); |
| 214 | 215 | $this->db->where('parent_id',0); |
@@ -332,8 +333,9 @@ discard block |
||
| 332 | 333 | OR a.connectcost like '%$instant_search%' |
| 333 | 334 | )" :null; |
| 334 | 335 | if ($account_arr['reseller_id'] != 0) { |
| 335 | - if(!empty($like_str)) |
|
| 336 | - $this->db->where($like_str); |
|
| 336 | + if(!empty($like_str)) { |
|
| 337 | + $this->db->where($like_str); |
|
| 338 | + } |
|
| 337 | 339 | if($accounttype=='reseller'){ |
| 338 | 340 | $this->db->where('a.note','b.number',false); |
| 339 | 341 | $this->db->where('a.reseller_id',$account_arr['id']); |
@@ -348,13 +350,13 @@ discard block |
||
| 348 | 350 | $this->db->select('a . * , b.id, a.reseller_id AS accountid,a.note as number,b.country_id as country_id'); |
| 349 | 351 | $this->db->limit($paging_data["paging"]["page_no"],$paging_data["paging"]["start"]); |
| 350 | 352 | $query=$this->db->get('reseller_pricing as a,dids as b'); |
| 351 | - }else{ |
|
| 353 | + } else{ |
|
| 352 | 354 | $count_result=(array)$this->db->query('select count(id) as count from dids where accountid='.$accountid." AND parent_id =".$account_arr['reseller_id'])->first_row(); |
| 353 | 355 | $paging_data = $this->form->load_grid_config($count_result['count'], $_GET['rp'], $_GET['page']); |
| 354 | 356 | $json_data = $paging_data["json_paging"]; |
| 355 | 357 | $query=$this->db->query("SELECT a . * ,a.note as number,b.country_id as country_id,b.id FROM reseller_pricing AS a, dids AS b WHERE b.accountid =".$account_arr['id']." AND a.note = b.number AND a.reseller_id =".$account_arr['reseller_id']); |
| 356 | 358 | } |
| 357 | - }else{ |
|
| 359 | + } else{ |
|
| 358 | 360 | $like_str=!empty($instant_search) ? |
| 359 | 361 | "(dids.number like '%$instant_search%' |
| 360 | 362 | OR dids.inc like '%$instant_search%' |
@@ -364,14 +366,16 @@ discard block |
||
| 364 | 366 | OR dids.monthlycost like '%$instant_search%' |
| 365 | 367 | OR dids.connectcost like '%$instant_search%' |
| 366 | 368 | )" :null; |
| 367 | - if(!empty($like_str)) |
|
| 368 | - $this->db->where($like_str); |
|
| 369 | + if(!empty($like_str)) { |
|
| 370 | + $this->db->where($like_str); |
|
| 371 | + } |
|
| 369 | 372 | $where = array($field_name => $accountid); |
| 370 | 373 | $count_all = $this->db_model->countQuery("*", "dids", $where); |
| 371 | 374 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
| 372 | 375 | $json_data = $paging_data["json_paging"]; |
| 373 | - if(!empty($like_str)) |
|
| 374 | - $this->db->where($like_str); |
|
| 376 | + if(!empty($like_str)) { |
|
| 377 | + $this->db->where($like_str); |
|
| 378 | + } |
|
| 375 | 379 | $query = $this->db_model->select("*", "dids", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
| 376 | 380 | } |
| 377 | 381 | $did_grid_fields = json_decode($this->did_form->build_did_list_for_customer($accountid, $accounttype)); |
@@ -714,21 +718,21 @@ discard block |
||
| 714 | 718 | unset($reseller_array['number'],$csv_data['accountid'],$reseller_array['accountid'],$reseller_array['country_id'],$reseller_array['init_inc']); |
| 715 | 719 | $csv_data['accountid']=0; |
| 716 | 720 | $final_reseller_array[$i]=$reseller_array; |
| 717 | - }else{ |
|
| 721 | + } else{ |
|
| 718 | 722 | $csv_data['parent_id']=0; |
| 719 | 723 | } |
| 720 | 724 | $csv_data['assign_date']=gmdate("Y-m-d H:i:s"); |
| 721 | 725 | $new_final_arr[$i] = $csv_data; |
| 722 | 726 | $this->common->mail_to_users('email_add_did', $account_info); |
| 723 | - }else{ |
|
| 727 | + } else{ |
|
| 724 | 728 | $invalid_array[$i] = $csv_data; |
| 725 | 729 | $invalid_array[$i]['error'] = 'Account have not sufficient amount to purchase this DID.'; |
| 726 | 730 | } |
| 727 | - }else{ |
|
| 731 | + } else{ |
|
| 728 | 732 | $invalid_array[$i] = $csv_data; |
| 729 | 733 | $invalid_array[$i]['error'] = 'Account not found or assign to invalid account'; |
| 730 | 734 | } |
| 731 | - }else{ |
|
| 735 | + } else{ |
|
| 732 | 736 | $csv_data['setup'] = $this->common_model->add_calculate_currency($csv_data['setup'], '', '', false, false); |
| 733 | 737 | $csv_data['monthlycost'] = $this->common_model->add_calculate_currency($csv_data['monthlycost'], '', '', false, false); |
| 734 | 738 | $csv_data['cost'] = $this->common_model->add_calculate_currency($csv_data['cost'], '', '', false, false); |