@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | $where['callstart <=']=date('Y-m-d') . " 23:59:59"; |
40 | 40 | } |
41 | 41 | $this->db->where($where); |
42 | - if(!empty($group_by)) |
|
43 | - $this->db->group_by($group_by); |
|
42 | + if(!empty($group_by)) { |
|
43 | + $this->db->group_by($group_by); |
|
44 | + } |
|
44 | 45 | if ($flag) { |
45 | 46 | if ($export) { |
46 | 47 | $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', '', '', ''); |
@@ -66,8 +67,9 @@ discard block |
||
66 | 67 | $where['callstart <=']=date('Y-m-d') . " 23:59:59"; |
67 | 68 | } |
68 | 69 | $this->db->where($where); |
69 | - if(!empty($group_by)) |
|
70 | - $this->db->group_by($group_by); |
|
70 | + if(!empty($group_by)) { |
|
71 | + $this->db->group_by($group_by); |
|
72 | + } |
|
71 | 73 | if ($flag) { |
72 | 74 | if ($export) { |
73 | 75 | $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', ''); |
@@ -96,8 +98,9 @@ discard block |
||
96 | 98 | $where['callstart <=']=date('Y-m-d') . " 23:59:59"; |
97 | 99 | } |
98 | 100 | $this->db->where($where); |
99 | - if(!empty($group_by)) |
|
100 | - $this->db->group_by($group_by); |
|
101 | + if(!empty($group_by)) { |
|
102 | + $this->db->group_by($group_by); |
|
103 | + } |
|
101 | 104 | if ($flag) { |
102 | 105 | if ($export) { |
103 | 106 | $result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', ''); |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | $this->fpdf = new PDF('P', 'pt'); |
39 | 39 | $this->fpdf->initialize('P', 'mm', 'A4'); |
40 | 40 | |
41 | - if ($this->session->userdata('user_login') == FALSE) |
|
42 | - redirect(base_url().'/astpp/login'); |
|
41 | + if ($this->session->userdata('user_login') == FALSE) { |
|
42 | + redirect(base_url().'/astpp/login'); |
|
43 | + } |
|
43 | 44 | } |
44 | 45 | function customer() { |
45 | 46 | $data['page_title'] = 'Customer Summary Report'; |
@@ -202,7 +203,7 @@ discard block |
||
202 | 203 | $new_arr[] = $row1['notes']; |
203 | 204 | } elseif ($search_arr['groupby_3'] == 'trunk_id') { |
204 | 205 | $new_arr[] = $this->common->get_field_name('name', 'trunks', $row1['trunk_id']); |
205 | - } elseif ($search_arr['groupby_3'] == 'package_id') { |
|
206 | + } elseif ($search_arr['groupby_3'] == 'package_id') { |
|
206 | 207 | $new_arr[] = $this->common->get_field_name('package_name', 'packages', $row1['package_id']); |
207 | 208 | } |
208 | 209 | if (empty($new_arr)) { |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | # along with this program. If not, see <http://www.gnu.org/licenses/> |
21 | 21 | ############################################################################ |
22 | 22 | |
23 | -if (!defined('BASEPATH')) |
|
24 | - exit('No direct script access allowed'); |
|
23 | +if (!defined('BASEPATH')) { |
|
24 | + exit('No direct script access allowed'); |
|
25 | +} |
|
25 | 26 | |
26 | 27 | class Summary_form { |
27 | 28 | function __construct() { |
@@ -96,8 +97,9 @@ discard block |
||
96 | 97 | } |
97 | 98 | } |
98 | 99 | } |
99 | - if(empty($new_arr)) |
|
100 | - $new_arr[]=array("Account", "453", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
100 | + if(empty($new_arr)) { |
|
101 | + $new_arr[]=array("Account", "453", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string"); |
|
102 | + } |
|
101 | 103 | $fixed_arr = array( |
102 | 104 | array("Attempted Calls", "130", "attempted_calls", "", "", ""), |
103 | 105 | array("Completed Calls", "130", "description", "", "", ""), |
@@ -64,7 +64,7 @@ |
||
64 | 64 | *******/ |
65 | 65 | if( $accountinfo['type'] == '0'){ |
66 | 66 | $where=array('accountid'=>$accountinfo['id']); |
67 | - }else{ |
|
67 | + } else{ |
|
68 | 68 | $where=''; |
69 | 69 | } |
70 | 70 | /**************************************************************************************************************/ |
@@ -31,8 +31,9 @@ discard block |
||
31 | 31 | $this->load->library("ipmap_form"); |
32 | 32 | $this->load->library('astpp/form'); |
33 | 33 | $this->load->model('ipmap_model'); |
34 | - if ($this->session->userdata('user_login') == FALSE) |
|
35 | - redirect(base_url() . '/astpp/login'); |
|
34 | + if ($this->session->userdata('user_login') == FALSE) { |
|
35 | + redirect(base_url() . '/astpp/login'); |
|
36 | + } |
|
36 | 37 | } |
37 | 38 | function ipmap_add() { |
38 | 39 | $data['username'] = $this->session->userdata('user_name'); |
@@ -66,8 +67,7 @@ discard block |
||
66 | 67 | $ip = $add_array['ip']; |
67 | 68 | if (strpos($ip,'/') !== false) { |
68 | 69 | $add_array['ip']=$add_array['ip']; |
69 | - } |
|
70 | - else{ |
|
70 | + } else{ |
|
71 | 71 | $add_array['ip']=$add_array['ip'].'/32'; |
72 | 72 | } |
73 | 73 | $data['form'] = $this->form->build_form($this->ipmap_form->get_ipmap_form_fields(), $add_array); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $accountdata=$this->session->userdata['accountinfo']; |
127 | 127 | if($accountdata['type'] == '0'){ |
128 | 128 | redirect(base_url() . 'user/user_ipmap_detail/'); |
129 | - }else{ |
|
129 | + } else{ |
|
130 | 130 | redirect(base_url() . 'ipmap/ipmap_detail/'); |
131 | 131 | } |
132 | 132 | /*********************************************************************/ |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $ret_url, |
191 | 191 | |
192 | 192 | )); |
193 | - }else{ |
|
193 | + } else{ |
|
194 | 194 | $ret_url = '<a href="'. base_url() .'ipmap/ipmap_edit/'.$value['id'].'" class="btn btn-royelblue btn-sm" rel="facebox" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> <a href="'. base_url() .'ipmap/ipmap_delete/' . $value['id'].'" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>'; |
195 | 195 | $account_name =$this->common->build_concat_string("first_name,last_name,number", "accounts",$value['accountid']); |
196 | 196 | $json_data['rows'][] = array('cell' => array( |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | # You should have received a copy of the GNU Affero General Public License |
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | -if (!defined('BASEPATH')) |
|
24 | - exit('No direct script access allowed'); |
|
23 | +if (!defined('BASEPATH')) { |
|
24 | + exit('No direct script access allowed'); |
|
25 | +} |
|
25 | 26 | |
26 | 27 | class Ipmap_form { |
27 | 28 | function __construct($library_name = '') { |
@@ -42,7 +43,7 @@ discard block |
||
42 | 43 | if($account_type == '0' || $logintype == '0'){ |
43 | 44 | $account=null; |
44 | 45 | $form['forms'] = array(base_url() . 'user/user_ipmap_save/', array('id' => 'ipmap_form', 'method' => 'POST', 'name' => 'ipmap_form')); |
45 | - }else{ |
|
46 | + } else{ |
|
46 | 47 | $account=array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type" => "0,3", "deleted" => "0","status" => "0")); |
47 | 48 | $form['forms'] = array(base_url() . 'ipmap/ipmap_save/', array('id' => 'ipmap_form', 'method' => 'POST', 'name' => 'ipmap_form')); |
48 | 49 | } |
@@ -79,7 +80,7 @@ discard block |
||
79 | 80 | *****************************************/ |
80 | 81 | if($account_data =='0'){ |
81 | 82 | $account=null; |
82 | - }else{ |
|
83 | + } else{ |
|
83 | 84 | $account=array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => $reseller_id,"type"=>"0", "deleted" => "0")); |
84 | 85 | } |
85 | 86 | /***************************************************************************************/ |
@@ -127,7 +128,7 @@ discard block |
||
127 | 128 | array("Action", "205", "", "", "", array("EDIT" => array("url" => "ipmap/ipmap_edit/", "mode" => "popup", 'popup'), |
128 | 129 | "DELETE" => array("url" => "ipmap/ipmap_delete/", "mode" => "single"))) |
129 | 130 | )); |
130 | - }else{ |
|
131 | + } else{ |
|
131 | 132 | $grid_field_arr = json_encode(array( |
132 | 133 | array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "","","","false","center"), |
133 | 134 | array("Account", "200", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"), |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->session->set_userdata('mode_cur', 'user'); |
121 | 121 | if($result['type'] == 1){ |
122 | 122 | redirect(base_url() . 'dashboard/'); |
123 | - }else{ |
|
123 | + } else{ |
|
124 | 124 | redirect(base_url() . 'user/user/'); |
125 | 125 | } |
126 | 126 | } else { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $this->session->set_userdata('user_login', FALSE); |
152 | 152 | $data['app_name'] = 'ASTPP - Open Source Billing Solution'; |
153 | 153 | $this->load->view('view_login', $data); |
154 | - }else { |
|
154 | + } else { |
|
155 | 155 | /* |
156 | 156 | * |
157 | 157 | * Purpose : Display logo based on domain name |
@@ -113,8 +113,7 @@ discard block |
||
113 | 113 | } |
114 | 114 | $this->db->limit($limit, $start); |
115 | 115 | $query=$this->db->query("SELECT a.note AS number,a.*,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo['id']." AND a.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = a.note AND c.parent_id =".$accountinfo['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo['id']." AND d.number=a.note)) AS accountid FROM reseller_pricing AS a where a.reseller_id=".$accountinfo['id']." AND a.parent_id =".$accountinfo['reseller_id'].$search_string); |
116 | - } |
|
117 | - else{ |
|
116 | + } else{ |
|
118 | 117 | $this->db_model->build_search('did_list_search'); |
119 | 118 | $query = $this->db_model->select("*,note as number,IF((SELECT COUNT( id ) AS count FROM reseller_pricing AS b WHERE b.parent_id =".$accountinfo['id']." AND reseller_pricing.note = b.note ) >0,(SELECT reseller_id AS accountid FROM reseller_pricing AS c WHERE c.note = reseller_pricing.note AND c.parent_id =".$accountinfo['id']."), (SELECT accountid from dids as d where d.parent_id = ".$accountinfo['id']." AND d.number=reseller_pricing.note)) AS accountid", "reseller_pricing", $where, "note", "desc", $limit, $start); |
120 | 119 | } |
@@ -123,8 +122,7 @@ discard block |
||
123 | 122 | $query = $this->db_model->countQuery("*", "reseller_pricing", $where); |
124 | 123 | } |
125 | 124 | |
126 | - } |
|
127 | - else |
|
125 | + } else |
|
128 | 126 | { |
129 | 127 | $this->db_model->build_search('did_list_search'); |
130 | 128 | if ($flag) { |
@@ -175,10 +173,11 @@ discard block |
||
175 | 173 | $this->db->where("country", ucfirst($field_value)); |
176 | 174 | $query = $this->db->get('countrycode'); |
177 | 175 | $data = $query->result(); |
178 | - if ($query->num_rows > 0) |
|
179 | - return $data[0]->id; |
|
180 | - else |
|
181 | - return ''; |
|
176 | + if ($query->num_rows > 0) { |
|
177 | + return $data[0]->id; |
|
178 | + } else { |
|
179 | + return ''; |
|
180 | + } |
|
182 | 181 | } |
183 | 182 | |
184 | 183 | function bulk_insert_dids($field_value) { |
@@ -250,10 +249,11 @@ discard block |
||
250 | 249 | $this->db->where("id", $number); |
251 | 250 | $this->db->or_where("number", $number); |
252 | 251 | $query = $this->db->get("dids"); |
253 | - if ($query->num_rows() > 0) |
|
254 | - return $query->row_array(); |
|
255 | - else |
|
256 | - return false; |
|
252 | + if ($query->num_rows() > 0) { |
|
253 | + return $query->row_array(); |
|
254 | + } else { |
|
255 | + return false; |
|
256 | + } |
|
257 | 257 | } |
258 | 258 | function edit_did_reseller($did_id,$post) { |
259 | 259 | $accountinfo = $this->session->userdata('accountinfo'); |
@@ -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")); |
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")); |
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); |