Passed
Pull Request — v3.0 (#166)
by Samir
12:13
created
web_interface/astpp/application/modules/trunk/controllers/trunk.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		$this->load->model('trunk_model');
34 34
 
35 35
 		if ($this->session->userdata('user_login') == FALSE)
36
-			redirect(base_url() . '/astpp/login');
36
+			redirect(base_url().'/astpp/login');
37 37
 	}
38 38
 
39 39
 	function trunk_list() {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	function trunk_list_json() {
51 51
 		$json_data = array();
52 52
 		$count_all = $this->trunk_model->gettrunk_list(false);
53
-		$paging_data = $this->form->load_grid_config($count_all,$_GET['rp'], $_GET['page']);
53
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
54 54
 		$json_data = $paging_data["json_paging"];
55 55
 		$query = $this->trunk_model->gettrunk_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
56 56
 		$grid_fields = json_decode($this->trunk_form->build_trunk_list_for_admin());
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			$this->session->set_userdata('trunk_list_search', $action);
118 118
 		}
119 119
 		if (@$ajax_search != 1) {
120
-			redirect(base_url() . 'trunk/trunk_list/');
120
+			redirect(base_url().'trunk/trunk_list/');
121 121
 		}
122 122
 	}
123 123
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
 	function trunk_remove($id) {
130 130
 		$this->trunk_model->remove_trunk($id);
131
-	$this->db->delete("routing",array("trunk_id"=>$id));
131
+	$this->db->delete("routing", array("trunk_id"=>$id));
132 132
 		$this->session->set_flashdata('astpp_notification', 'Trunk removed successfully!');
133
-		redirect(base_url() . 'trunk/trunk_list/');
133
+		redirect(base_url().'trunk/trunk_list/');
134 134
 	}
135 135
 
136 136
 	function trunk_delete_multiple() {
@@ -144,34 +144,34 @@  discard block
 block discarded – undo
144 144
 			$this->db->update('trunks', $update_data);
145 145
 			echo TRUE;
146 146
 		} else {
147
-			$trunk_arr=array();
147
+			$trunk_arr = array();
148 148
 			$this->db->select('id,name');
149 149
 			$this->db->where('id '.$where);
150
-			$trunk_res=$this->db->get('trunks');
151
-			$trunk_res=$trunk_res->result_array();
152
-			foreach($trunk_res as $value){
153
-				$trunk_arr[$value['id']]['name']=$value['name'];
150
+			$trunk_res = $this->db->get('trunks');
151
+			$trunk_res = $trunk_res->result_array();
152
+			foreach ($trunk_res as $value) {
153
+				$trunk_arr[$value['id']]['name'] = $value['name'];
154 154
 			}
155 155
 			$this->db->where('trunk_id '.$where);
156 156
 			$this->db->select('count(id) as cnt,trunk_id');
157 157
 			$this->db->group_by('trunk_id');
158
-			$outbound_routes_res=$this->db->get('outbound_routes');
159
-			if($outbound_routes_res->num_rows() > 0){
160
-			 $outbound_routes_res=$outbound_routes_res->result_array();
161
-			 foreach($outbound_routes_res as $key=>$value){
162
-				$trunk_arr[$value['trunk_id']]['outbound_routes']=$value['cnt'];
158
+			$outbound_routes_res = $this->db->get('outbound_routes');
159
+			if ($outbound_routes_res->num_rows() > 0) {
160
+			 $outbound_routes_res = $outbound_routes_res->result_array();
161
+			 foreach ($outbound_routes_res as $key=>$value) {
162
+				$trunk_arr[$value['trunk_id']]['outbound_routes'] = $value['cnt'];
163 163
 			 }
164 164
 			}
165
-			$str=null;
166
-			foreach($trunk_arr as $key=>$value){
167
-				 if(isset($value['outbound_routes'])){
168
-					 $str.= $value['name']."trunk using by ".$value['outbound_routes']." termination rates \n";
165
+			$str = null;
166
+			foreach ($trunk_arr as $key=>$value) {
167
+				 if (isset($value['outbound_routes'])) {
168
+					 $str .= $value['name']."trunk using by ".$value['outbound_routes']." termination rates \n";
169 169
 				 }
170 170
 			} 
171
-			if(!empty($str)){
172
-				$data['str']=$str;
171
+			if ( ! empty($str)) {
172
+				$data['str'] = $str;
173 173
 			}
174
-			$data['selected_ids']=$add_array['selected_ids'];
174
+			$data['selected_ids'] = $add_array['selected_ids'];
175 175
 			echo json_encode($data);
176 176
 		}
177 177
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@
 block discarded – undo
32 32
 		$this->load->library('astpp/form');
33 33
 		$this->load->model('taxes_model');
34 34
 
35
-		if ($this->session->userdata('user_login') == FALSE)
36
-			redirect(base_url() . '/astpp/login');
35
+		if ($this->session->userdata('user_login') == FALSE) {
36
+					redirect(base_url() . '/astpp/login');
37
+		}
37 38
 	}
38 39
 
39 40
 	function taxes_add() {
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/trunk/libraries/trunk_form.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,25 +20,25 @@  discard block
 block discarded – undo
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'))
23
+if ( ! defined('BASEPATH'))
24 24
 	exit('No direct script access allowed');
25 25
 
26 26
 class trunk_form {
27 27
 
28 28
 	function get_trunk_form_fields() {
29
-		$form['forms'] = array(base_url() . 'trunk/trunk_save/', array('id' => 'trunks_form', 'method' => 'POST', 'name' => 'trunks_form'));
29
+		$form['forms'] = array(base_url().'trunk/trunk_save/', array('id' => 'trunks_form', 'method' => 'POST', 'name' => 'trunks_form'));
30 30
 		$form['Information'] = array(
31 31
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
32 32
 			array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
33
-			array('Provider', 'provider_id', 'SELECT', '', 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr',array('type'=>3,"deleted"=>"0","status"=>"0")),
34
-			array('Gateway Name', 'gateway_id', 'SELECT', '', 'trim|required|xss_clean', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', array("status" => "0")),
33
+			array('Provider', 'provider_id', 'SELECT', '', 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array('type'=>3, "deleted"=>"0", "status"=>"0")),
34
+			array('Gateway Name', 'gateway_id', 'SELECT', '', 'trim|required|xss_clean', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),
35 35
 			array('Failover GW Name #1', 'failover_gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),
36 36
 			array('Failover GW Name #2', 'failover_gateway_id1', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),            
37
-			array('CC', 'INPUT', array('name' => 'maxchannels', 'value' => '0' , 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''));
37
+			array('CC', 'INPUT', array('name' => 'maxchannels', 'value' => '0', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''));
38 38
 		$form['Settings'] = array(  
39
-			array('Number Translation', 'INPUT', array('name' => 'dialed_modify', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
39
+			array('Number Translation', 'INPUT', array('name' => 'dialed_modify', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
40 40
 			array('Codecs', 'INPUT', array('name' => 'codec', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
41
-			array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
41
+			array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
42 42
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
43 43
 		);
44 44
 		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 		$form['forms'] = array("", array('id' => "trunk_search"));
51 51
 		$form['Search'] = array(
52 52
 			array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''),
53
-			array('Provider', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr',array('type'=>3, "status"=>0, "deleted" => 0)),
54
-			array('Gateway Name', 'gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', array("status" => "0")),
53
+			array('Provider', 'provider_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array('type'=>3, "status"=>0, "deleted" => 0)),
54
+			array('Gateway Name', 'gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', array("status" => "0")),
55 55
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
56 56
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
57 57
 			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
@@ -63,26 +63,26 @@  discard block
 block discarded – undo
63 63
 
64 64
 	function build_trunk_list_for_admin() {
65 65
         
66
-		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
67
-			array("Name", "100", "name", "", "", "","EDITABLE","true","center"),
68
-			array("Provider", "110", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
69
-			array("Gateway Name", "100", "gateway_id", "name", "gateways", "get_field_name","","true","center"),
70
-			array("Failover <br>GW Name #1", "130", "failover_gateway_id","name", "gateways", "get_field_name","","true","center"),
71
-			array("Failover<br> GW Name #2", "130", "failover_gateway_id1","name", "gateways", "get_field_name","","true","center"),
72
-			array("CC", "90", "maxchannels", "", "", "","","true","center"),
73
-			array("Codecs", "90", "codec", "", "", "","","true","center"),
74
-			array("Rate<br>Count", "70", "id", "trunk_id", "outbound_routes", "get_field_count","","true","center"),
75
-			array("Status", "100", "status", "status", "trunks", "get_status","","true","center"),
66
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
67
+			array("Name", "100", "name", "", "", "", "EDITABLE", "true", "center"),
68
+			array("Provider", "110", "provider_id", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"),
69
+			array("Gateway Name", "100", "gateway_id", "name", "gateways", "get_field_name", "", "true", "center"),
70
+			array("Failover <br>GW Name #1", "130", "failover_gateway_id", "name", "gateways", "get_field_name", "", "true", "center"),
71
+			array("Failover<br> GW Name #2", "130", "failover_gateway_id1", "name", "gateways", "get_field_name", "", "true", "center"),
72
+			array("CC", "90", "maxchannels", "", "", "", "", "true", "center"),
73
+			array("Codecs", "90", "codec", "", "", "", "", "true", "center"),
74
+			array("Rate<br>Count", "70", "id", "trunk_id", "outbound_routes", "get_field_count", "", "true", "center"),
75
+			array("Status", "100", "status", "status", "trunks", "get_status", "", "true", "center"),
76 76
 			array("Created Date", "110", "creation_date", "creation_date", "creation_date", "convert_GMT_to"),
77
-			array("Modified <br/>Date", "105", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
78
-			array("Action", "100", "", "", "", array("EDIT" => array("url" => "trunk/trunk_edit/", "mode" => "popup","layout"=>"medium"),
77
+			array("Modified <br/>Date", "105", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
78
+			array("Action", "100", "", "", "", array("EDIT" => array("url" => "trunk/trunk_edit/", "mode" => "popup", "layout"=>"medium"),
79 79
 					"DELETE" => array("url" => "trunk/trunk_remove/", "mode" => "single")))
80 80
 				));
81 81
 			return $grid_field_arr;
82 82
 	}
83 83
 
84 84
 	function build_grid_buttons() {
85
-		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/trunk/trunk_add/", "popup","medium"),
85
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/trunk/trunk_add/", "popup", "medium"),
86 86
 			array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/trunk/trunk_delete_multiple/")
87 87
 			));
88 88
 		return $buttons_json;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@
 block discarded – undo
22 22
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 23
 ###############################################################################
24 24
 
25
-if (!defined('BASEPATH'))
26
-	exit('No direct script access allowed');
25
+if (!defined('BASEPATH')) {
26
+	exit('No direct script access allowed');
27
+}
27 28
 
28 29
 class Package_form {
29 30
 
Please login to merge, or discard this patch.
astpp/application/modules/freeswitch/models/freeswitch_model.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 ASTPP  3.0 
33 33
 Voicemail data get
34 34
 ******/
35
-	function get_sipdevices_list($flag, $accountid = "",$entitytype='',$start = "", $limit = "") {
35
+	function get_sipdevices_list($flag, $accountid = "", $entitytype = '', $start = "", $limit = "") {
36 36
 	if ($accountid != "") {
37 37
 		$where = array("accountid" => $accountid);
38 38
 	}
39 39
 	$this->db_model->build_search('fssipdevices_list_search');
40
-		$instant_search=$this->session->userdata('left_panel_search_'.$entitytype.'_sipdevices');
41
-		if(!empty($instant_search)){
42
-			$like_str="(username like '%$instant_search%' OR creation_date like '%$instant_search%' OR last_modified_date like '%$instant_search%')";
40
+		$instant_search = $this->session->userdata('left_panel_search_'.$entitytype.'_sipdevices');
41
+		if ( ! empty($instant_search)) {
42
+			$like_str = "(username like '%$instant_search%' OR creation_date like '%$instant_search%' OR last_modified_date like '%$instant_search%')";
43 43
 			$this->db->where($like_str);   
44 44
 		}
45 45
 	$query = array();
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 		$where = array('id' => $add_array['accountcode']);
89 89
 		$query = $this->db_model->getSelect("*", "accounts", $where);
90 90
 		$query = $query->result_array();
91
-		$account_data=$query[0];
91
+		$account_data = $query[0];
92 92
        
93 93
 		$log_type = $this->session->userdata("logintype");
94 94
         	
95
-		$reseller_id = $log_type==1 ? $account_data['reseller_id']:0;
95
+		$reseller_id = $log_type == 1 ? $account_data['reseller_id'] : 0;
96 96
         
97
-		$sip_profile_id = isset($add_array['sip_profile_id'])?$add_array['sip_profile_id']:$this->common->get_field_name('id','sip_profiles',array('name'=>'default'));
97
+		$sip_profile_id = isset($add_array['sip_profile_id']) ? $add_array['sip_profile_id'] : $this->common->get_field_name('id', 'sip_profiles', array('name'=>'default'));
98 98
 	
99 99
 	$parms_array = array('password' => $add_array['fs_password'],
100 100
 			'vm-enabled' => $add_array['voicemail_enabled'],
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 ASTPP  3.0 
129 129
 Email broadcast when Sip Device create
130 130
 ******/
131
-		$mail = (isset($add_array['voicemail_mail_to']) && $add_array['voicemail_mail_to'] != "")?$add_array['voicemail_mail_to']:$account_data['email'];
131
+		$mail = (isset($add_array['voicemail_mail_to']) && $add_array['voicemail_mail_to'] != "") ? $add_array['voicemail_mail_to'] : $account_data['email'];
132 132
     
133
-		$add_array['id']=$add_array['accountcode'];
134
-		$add_array['reseller_id']=$account_data['reseller_id'];
135
-		$add_array['email']=$mail;
136
-		$add_array['first_name']=$account_data['first_name'];
137
-		$add_array['last_name']=$account_data['last_name'];
138
-		$add_array['number']=$add_array['fs_username'];
133
+		$add_array['id'] = $add_array['accountcode'];
134
+		$add_array['reseller_id'] = $account_data['reseller_id'];
135
+		$add_array['email'] = $mail;
136
+		$add_array['first_name'] = $account_data['first_name'];
137
+		$add_array['last_name'] = $account_data['last_name'];
138
+		$add_array['number'] = $add_array['fs_username'];
139 139
 		//$add_array['password']=$this->common->decode($add_array['fs_password']);
140
-		$add_array['password']=$add_array['fs_password'];
140
+		$add_array['password'] = $add_array['fs_password'];
141 141
 		//echo "<pre>"; print_r($add_array); exit;		
142 142
 		$this->common->mail_to_users('add_sip_device', $add_array);
143 143
 /****************************/
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 		$add_array = $deviceinfo->result_array();
192 192
 		foreach ($add_array as $key => $value) {
193 193
 			$vars = json_decode($value['dir_vars']);
194
-			$vars_new = json_decode($value['dir_params'],true);
194
+			$vars_new = json_decode($value['dir_params'], true);
195 195
 			$passowrds = json_decode($value['dir_params']);
196
-			$query = array('id' => $value['id'],'fs_username' => $value['username'],
196
+			$query = array('id' => $value['id'], 'fs_username' => $value['username'],
197 197
 						'accountcode' => $value['accountid'],
198 198
 						'status' => $value['status'],
199 199
 						'sip_profile_id' => $value['sip_profile_id'],
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
 		$deviceinfo = array();
224 224
 		$this->db_model->build_search('fssipdevices_list_search');
225 225
 		$accountinfo = $this->session->userdata("accountinfo");
226
-		$reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0;
226
+		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
227 227
 		$query = array();
228 228
 		$logintype = $this->session->userdata("logintype");
229 229
         
230
-		$where['reseller_id']=$reseller_id;
230
+		$where['reseller_id'] = $reseller_id;
231 231
       
232 232
 		if ($flag) {
233 233
 			$deviceinfo = $this->db_model->select("*", "sip_devices", $where, "id", "ASC", $limit, $start);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 				$add_array = $deviceinfo->result_array();
236 236
 				foreach ($add_array as $key => $value) {
237 237
 					$vars = json_decode($value['dir_vars']);
238
-					$vars_new = json_decode($value['dir_params'],true);
238
+					$vars_new = json_decode($value['dir_params'], true);
239 239
 					$passowrds = json_decode($value['dir_params']);
240 240
 					/*
241 241
                     ASTPP  3.0 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		/*
310 310
         ASTPP  3.0  ADD creation date 
311 311
         */
312
-		$data['creation_date']=gmdate('Y-m-d H:i:s');
312
+		$data['creation_date'] = gmdate('Y-m-d H:i:s');
313 313
 		/***********************************/
314 314
 		unset($data['action']);
315 315
 		$this->db->insert('freeswich_servers', $data);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 		/*
322 322
         ASTPP  3.0  edit modified date add
323 323
         */
324
-		$data['last_modified_date']=gmdate('Y-m-d H:i:s');
324
+		$data['last_modified_date'] = gmdate('Y-m-d H:i:s');
325 325
 		/***********************************************/
326 326
 		$this->db->where('id', $id);
327 327
 		$this->db->update('freeswich_servers', $data);
@@ -334,21 +334,21 @@  discard block
 block discarded – undo
334 334
 		return true;
335 335
 	}
336 336
 
337
-	function reload_freeswitch($command,$server_host="") {
338
-	$response='';
337
+	function reload_freeswitch($command, $server_host = "") {
338
+	$response = '';
339 339
 		$query = $this->db_model->getSelect("*", "freeswich_servers", "");
340 340
 		$fs_data = $query->result_array();
341 341
 	   foreach ($fs_data as $fs_key => $fs_value) {
342 342
 		$fp = $this->freeswitch_lib->event_socket_create($fs_value["freeswitch_host"], $fs_value["freeswitch_port"], $fs_value["freeswitch_password"]);
343 343
 		if ($fp) {
344
-		$response.= $this->freeswitch_lib->event_socket_request($fp, $command);
344
+		$response .= $this->freeswitch_lib->event_socket_request($fp, $command);
345 345
 		fclose($fp);
346 346
 		}
347 347
 	   }
348 348
 		return $response;
349 349
 	}
350 350
 	function reload_live_freeswitch($command) {
351
-	$response='';
351
+	$response = '';
352 352
 		$query = $this->db_model->getSelect("*", "freeswich_servers", "");
353 353
 		$fs_data = $query->result_array();
354 354
         
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 		fclose($fp);
360 360
 		}
361 361
 		}
362
-	$response = str_replace("0 total.","",$response);
362
+	$response = str_replace("0 total.", "", $response);
363 363
 		return $response;
364 364
 	}
365 365
 
Please login to merge, or discard this patch.
astpp/application/modules/freeswitch/controllers/freeswitch.php 2 patches
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		$this->load->model('freeswitch_model');
37 37
 
38 38
 		if ($this->session->userdata('user_login') == FALSE)
39
-			redirect(base_url() . '/astpp/login');
39
+			redirect(base_url().'/astpp/login');
40 40
 	}
41 41
 
42 42
 	function fssipdevices_add($type = "") {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		 $account_data = $this->session->userdata("accountinfo");
45 45
 		$data['flag'] = 'create';
46 46
 		$data['page_title'] = 'Create SIP Device';
47
-	   if($account_data['type'] == '-1'  || $account_data['type'] == '1')
47
+	   if ($account_data['type'] == '-1' || $account_data['type'] == '1')
48 48
 	   {
49 49
 			$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($type), '');
50 50
 			$this->load->view('view_freeswitch_add_edit', $data);
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 	 $data['username'] = $this->session->userdata('user_name');
58 58
 	 $account_data = $this->session->userdata("accountinfo");
59 59
 		$data['page_title'] = 'Create SIP Device';
60
-		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid),"");
61
-		if($account_data['type'] == '-1'  || $account_data['type'] == '1')
60
+		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid), "");
61
+		if ($account_data['type'] == '-1' || $account_data['type'] == '1')
62 62
 		{
63 63
 			$this->load->view('view_freeswitch_add_edit', $data);
64
-		}else{
64
+		} else {
65 65
 			$this->load->view('view_freeswitch_customer_add_edit', $data);
66 66
 		}
67 67
 	}
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 		$account_data = $this->session->userdata("accountinfo");
72 72
 		$where = array('id' => $edit_id);
73 73
 		$account = $this->freeswitch_model->get_edited_data($edit_id);
74
-		if($account_data['type'] == '-1')
74
+		if ($account_data['type'] == '-1')
75 75
 		{
76 76
 			$data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($edit_id), $account);
77 77
 			$this->load->view('view_freeswitch_add_edit', $data);
78
-		}else{
78
+		} else {
79 79
 		 $data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($edit_id), $account);
80 80
 		$this->load->view('view_freeswitch_customer_add_edit', $data);
81 81
 		}
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 		$data['page_title'] = 'Edit SIP device';
88 88
 		$where = array('id' => $edit_id);
89 89
 		$account = $this->freeswitch_model->get_edited_data($edit_id);
90
-		  if($account_data['type'] == '-1' || $account_data['type'] == '1')
90
+		  if ($account_data['type'] == '-1' || $account_data['type'] == '1')
91 91
 		{
92
-		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid,$edit_id), $account);
92
+		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid, $edit_id), $account);
93 93
 		$this->load->view('view_freeswitch_add_edit', $data);
94
-		}else{
94
+		} else {
95 95
         
96
-		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid,$edit_id), $account);
96
+		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid, $edit_id), $account);
97 97
 		$this->load->view('view_freeswitch_customer_add_edit', $data);
98 98
 		}
99 99
 	}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 			$this->session->set_userdata('fsgateway_list_search', $action);
110 110
 		}
111 111
 		if (@$ajax_search != 1) {
112
-			redirect(base_url() . 'freeswitch/fsgateway/');
112
+			redirect(base_url().'freeswitch/fsgateway/');
113 113
 		}
114 114
 	}
115 115
 	function fssipprofile_search() {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			$this->session->set_userdata('fssipprofile_list_search', $action);
124 124
 		}
125 125
 		if (@$ajax_search != 1) {
126
-			redirect(base_url() . 'freeswitch/fssipprofile/');
126
+			redirect(base_url().'freeswitch/fssipprofile/');
127 127
 		}
128 128
 	}
129 129
 	function fssipdevices_clearsearchfilter() {
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 	}
141 141
 	function fssipdevices_save($user_flg = false) {
142 142
 		$add_array = $this->input->post();
143
-		if (!$user_flg) {
143
+		if ( ! $user_flg) {
144 144
 			$data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($add_array['id']), $add_array);
145 145
 		} else {
146
-			$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"],$add_array['id']),  $add_array);
146
+			$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"], $add_array['id']), $add_array);
147 147
 		}
148 148
 		if ($add_array['id'] != '') {
149 149
 			$data['page_title'] = 'Freeswitch SIP Devices';
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 	function customer_fssipdevices_save($user_flg = false) {
173 173
 		$add_array = $this->input->post();      
174
-		if (!$user_flg) {
174
+		if ( ! $user_flg) {
175 175
 			$data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields(), $add_array);
176 176
 		} else {
177
-			$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"],$add_array['id']), $add_array);
177
+			$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"], $add_array['id']), $add_array);
178 178
 		}
179 179
 		if ($add_array['id'] != '') {
180 180
 			$data['page_title'] = 'Edit Freeswitch SIP Devices';
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	}
203 203
 	function user_fssipdevices_save($user_flg = false) {
204 204
 		$add_array = $this->input->post();
205
-		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"],$add_array['id']), $add_array);
205
+		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($add_array["accountcode"], $add_array['id']), $add_array);
206 206
 		if ($add_array['id'] != '') {
207 207
 			$data['page_title'] = 'Edit Freeswitch SIP Devices';
208 208
 			if ($this->form_validation->run() == FALSE) {
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 				echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!"));
215 215
 				exit;
216 216
 			}
217
-		}else{
217
+		} else {
218 218
 			$data['page_title'] = 'Create Freeswitch SIP Devices';
219 219
 			if ($this->form_validation->run() == FALSE) {
220 220
 				$data['validation_errors'] = validation_errors();
221 221
 				echo $data['validation_errors'];
222 222
 				exit;
223 223
 			} else {
224
-		$sip_profile_id=$this->common->get_field_name('id','sip_profiles',array('name'=>'default'));
224
+		$sip_profile_id = $this->common->get_field_name('id', 'sip_profiles', array('name'=>'default'));
225 225
 				$this->freeswitch_model->add_freeswith($add_array);
226 226
 				echo json_encode(array("SUCCESS"=> "SIP Device Added Successfully!"));
227 227
 				exit;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 			$this->session->set_userdata('fssipdevices_list_search', $action);
240 240
 		}
241 241
 		if (@$ajax_search != 1) {
242
-			redirect(base_url() . 'freeswitch/fssipdevices/');
242
+			redirect(base_url().'freeswitch/fssipdevices/');
243 243
 		}
244 244
 	}
245 245
 
@@ -267,13 +267,13 @@  discard block
 block discarded – undo
267 267
 		foreach ($query as $key => $value) {
268 268
 	$path_true = base_url().'/assets/images/true.png';
269 269
 	$path_false = base_url().'/assets/images/false.png';
270
-	if($value['voicemail_enabled'] == 'true'){
271
-		$voicemail_enabled ='<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">';
272
-	} else{
273
-		$voicemail_enabled ='<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">';
270
+	if ($value['voicemail_enabled'] == 'true') {
271
+		$voicemail_enabled = '<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">';
272
+	} else {
273
+		$voicemail_enabled = '<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">';
274 274
 	}
275 275
 		$json_data['rows'][] = array('cell' => array(
276
-			'<input type="checkbox" name="chkAll" id=' . $value['id'] . ' class="ace chkRefNos" onclick="clickchkbox(' . $value['id'] . ')" value=' . $value['id'] . '><lable class="lbl"></lable>',
276
+			'<input type="checkbox" name="chkAll" id='.$value['id'].' class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value='.$value['id'].'><lable class="lbl"></lable>',
277 277
 			"<a href='/freeswitch/fssipdevices_edit/".$value['id']."' style='cursor:pointer;color:#005298;' rel='facebox_medium' title='username'>".$value['username']."</a>",
278 278
 /**************************/
279 279
 					$value['password'],
@@ -281,10 +281,10 @@  discard block
 block discarded – undo
281 281
 					$this->common->get_field_name_coma_new('first_name,last_name,number', 'accounts', array('0' => $value['accountid'])),
282 282
 					$value['effective_caller_id_name'],
283 283
 					$value['effective_caller_id_number'],
284
-					 $voicemail_enabled ,
285
-					 $this->common->get_status('status', 'sip_devices',$value),
286
-					$this->common->convert_GMT_to('','',$value['creation_date']),
287
-					$this->common->convert_GMT_to('','',$value['last_modified_date']),                
284
+					 $voicemail_enabled,
285
+					 $this->common->get_status('status', 'sip_devices', $value),
286
+					$this->common->convert_GMT_to('', '', $value['creation_date']),
287
+					$this->common->convert_GMT_to('', '', $value['last_modified_date']),                
288 288
 					$this->get_action_buttons_fssipdevices($value['id'])
289 289
 					));
290 290
 		}
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		$this->db->delete("sip_devices");
305 305
 		echo TRUE;
306 306
 	}
307
-	function customer_fssipdevices_delete_multiple(){
307
+	function customer_fssipdevices_delete_multiple() {
308 308
 		$ids = $this->input->post("selected_ids", true);
309 309
 		$where = "id IN ($ids)";
310 310
 		$this->db->where($where);
@@ -316,42 +316,42 @@  discard block
 block discarded – undo
316 316
 ASTPP 3.0
317 317
 Customer side show voice mail detials
318 318
 ******/
319
-	function customer_fssipdevices_json($accountid,$entity_type='') {
319
+	function customer_fssipdevices_json($accountid, $entity_type = '') {
320 320
 		$json_data = array();
321
-		$count_all = $this->freeswitch_model->get_sipdevices_list(false, $accountid,$entity_type);
321
+		$count_all = $this->freeswitch_model->get_sipdevices_list(false, $accountid, $entity_type);
322 322
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
323 323
 		$json_data = $paging_data["json_paging"];
324 324
 		$devices_result = array();
325
-		$query = $this->freeswitch_model->get_sipdevices_list(true, $accountid,$entity_type, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
325
+		$query = $this->freeswitch_model->get_sipdevices_list(true, $accountid, $entity_type, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
326 326
 		foreach ($query as $key => $value) {
327 327
 	$path_true = base_url().'/assets/images/true.png';
328 328
 	$path_false = base_url().'/assets/images/false.png';
329
-	$voicemail_enabled = $value['voicemail_enabled'] == 'true'? '<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">' : '<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">';
329
+	$voicemail_enabled = $value['voicemail_enabled'] == 'true' ? '<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">' : '<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">';
330 330
 		$json_data['rows'][] = array('cell' => array(
331
-			'<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value=' .$value['id'].'><lable class="lbl"></lable>',
331
+			'<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value='.$value['id'].'><lable class="lbl"></lable>',
332 332
 					$value['username'],
333 333
 					$value['password'],
334 334
 					$this->common->get_field_name('name', '`sip_profiles', array('id' => $value['sip_profile_id'])),
335 335
 					$value['effective_caller_id_name'],
336 336
 					$value['effective_caller_id_number'],
337 337
 					$voicemail_enabled,
338
-					$this->common->get_status('status', 'sip_devices',$value),
339
-					$this->common->convert_GMT_to('','',$value['creation_date']),
340
-					$this->common->convert_GMT_to('','',$value['last_modified_date']),
341
-					$this->get_action_fssipdevices_buttons($value['id'], $value['accountid'],$entity_type)
338
+					$this->common->get_status('status', 'sip_devices', $value),
339
+					$this->common->convert_GMT_to('', '', $value['creation_date']),
340
+					$this->common->convert_GMT_to('', '', $value['last_modified_date']),
341
+					$this->get_action_fssipdevices_buttons($value['id'], $value['accountid'], $entity_type)
342 342
 					));
343 343
 		}//exit;
344 344
 		echo json_encode($json_data);
345 345
 	}
346 346
 /****************************/
347
-	function get_action_fssipdevices_buttons($id, $accountid,$entity_type='') {
347
+	function get_action_fssipdevices_buttons($id, $accountid, $entity_type = '') {
348 348
 		$ret_url = '';
349
-		if ($this->session->userdata("logintype") == '0'||$this->session->userdata("logintype") == '3') {
350
-			$ret_url = '<a href="'. base_url() .'user/user_fssipdevices_action/edit/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm"  rel="facebox_medium" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
351
-			$ret_url .= '<a href="'. base_url() .'user/user_fssipdevices_action/delete/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
349
+		if ($this->session->userdata("logintype") == '0' || $this->session->userdata("logintype") == '3') {
350
+			$ret_url = '<a href="'.base_url().'user/user_fssipdevices_action/edit/'.$id.'/'.$accountid.'/" class="btn btn-royelblue btn-sm"  rel="facebox_medium" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
351
+			$ret_url .= '<a href="'.base_url().'user/user_fssipdevices_action/delete/'.$id.'/'.$accountid.'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
352 352
 		} else {
353
-			$ret_url = '<a href="'. base_url() .'accounts/'.$entity_type.'_fssipdevices_action/edit/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm"  rel="facebox_medium" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
354
-			$ret_url .= '<a href="'. base_url() .'accounts/'.$entity_type.'_fssipdevices_action/delete/' . $id . '/' . $accountid . '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
353
+			$ret_url = '<a href="'.base_url().'accounts/'.$entity_type.'_fssipdevices_action/edit/'.$id.'/'.$accountid.'/" class="btn btn-royelblue btn-sm"  rel="facebox_medium" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
354
+			$ret_url .= '<a href="'.base_url().'accounts/'.$entity_type.'_fssipdevices_action/delete/'.$id.'/'.$accountid.'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
355 355
 		}
356 356
 		return $ret_url;
357 357
 	}
@@ -359,15 +359,15 @@  discard block
 block discarded – undo
359 359
 	function fssipdevices_delete($id) {
360 360
 		$this->freeswitch_model->delete_freeswith_devices($id);
361 361
 		$this->session->set_flashdata('astpp_notification', 'SIP Device Removed Successfully!');
362
-		redirect(base_url() . 'freeswitch/fssipdevices/');
362
+		redirect(base_url().'freeswitch/fssipdevices/');
363 363
 		exit;
364 364
 	}
365 365
 
366 366
 	function get_action_buttons_fssipdevices($id) {
367 367
 
368 368
 		$ret_url = '';
369
-		$ret_url = '<a href="'. base_url() .'freeswitch/fssipdevices_edit/' . $id . '/" class="btn btn-royelblue btn-sm"  rel="facebox_medium" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
370
-		$ret_url .= '<a href="'. base_url() .'freeswitch/fssipdevices_delete/' . $id . '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
369
+		$ret_url = '<a href="'.base_url().'freeswitch/fssipdevices_edit/'.$id.'/" class="btn btn-royelblue btn-sm"  rel="facebox_medium" title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;';
370
+		$ret_url .= '<a href="'.base_url().'freeswitch/fssipdevices_delete/'.$id.'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>';
371 371
 		return $ret_url;
372 372
 	}
373 373
 
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 		$calls_final = array();
386 386
 		$data_header = array();
387 387
 		$k = 0;
388
-			$data = explode("\n",$response);
388
+			$data = explode("\n", $response);
389 389
 			for ($i = 0; $i < count($data) - 2; $i++) {
390 390
 				if (trim($data[$i]) != '') {
391
-					if (count($data_header) ==0 || substr($data[$i],0,4) == "uuid") {
391
+					if (count($data_header) == 0 || substr($data[$i], 0, 4) == "uuid") {
392 392
 						$data_header = explode(",", $data[$i]);
393 393
 					} else {
394 394
 						$data_call = explode(",", $data[$i]);
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 		$this->session->set_userdata('advance_search', 0);
436 436
 		$data['grid_fields'] = $this->freeswitch_form->build_fsgateway_list_for_admin();
437 437
 		$data["grid_buttons"] = $this->freeswitch_form->build_fdgateway_grid_buttons();
438
-	  	$data['form_search']=$this->form->build_serach_form($this->freeswitch_form->get_gateway_search_form());
438
+	  	$data['form_search'] = $this->form->build_serach_form($this->freeswitch_form->get_gateway_search_form());
439 439
 		$this->load->view('view_fsgateway_list', $data);
440 440
 	}
441 441
 
@@ -452,13 +452,13 @@  discard block
 block discarded – undo
452 452
 		if ($query->num_rows > 0) {
453 453
 			$query = $query->result_array();
454 454
 			foreach ($query as $key => $query_value) {
455
-$gateway_data=array();
456
-$tmp=null;
455
+$gateway_data = array();
456
+$tmp = null;
457 457
 				foreach ($query_value as $gateway_key => $gateway_val) {
458 458
 					if ($gateway_key != "gateway_data") {
459 459
 						$gateway_data[$gateway_key] = $gateway_val;
460 460
 					} else {
461
-						$tmp = (array) json_decode($gateway_val);
461
+						$tmp = (array)json_decode($gateway_val);
462 462
 					}
463 463
 				}
464 464
 						$gateway_result[$key] = array_merge($gateway_data, $tmp);
@@ -486,22 +486,22 @@  discard block
 block discarded – undo
486 486
 		$gateway_result = array();
487 487
 		foreach ($query as $key => $query_value) {
488 488
 			foreach ($query_value as $gateway_key => $gatewau_val) {
489
-  			$gateway_data["status"] = isset($query_value["status"])?$query_value["status"]:"";
489
+  			$gateway_data["status"] = isset($query_value["status"]) ? $query_value["status"] : "";
490 490
 				if ($gateway_key != "gateway_data") {
491 491
 					$gateway_data[$gateway_key] = $gatewau_val;
492
-				}else if($gateway_key == "status") {
492
+				} else if ($gateway_key == "status") {
493 493
 					$gateway_data[$gateway_key] = $gatewau_val;
494 494
 				} 
495 495
 				 /**
496 496
                  ASTPP 3.0 
497 497
                  put one variable with the name of dialplan variable 
498 498
 				  **/ 
499
-				else if($gateway_key == "dialplan_variable") {
499
+				else if ($gateway_key == "dialplan_variable") {
500 500
 					$gateway_data[$gateway_key] = $gatewau_val;
501 501
 				} 
502 502
 				/****************************************************/
503 503
 				else {
504
-					$tmp = (array) json_decode($gatewau_val);
504
+					$tmp = (array)json_decode($gatewau_val);
505 505
 					$gateway_result = array_merge($gateway_data, $tmp);
506 506
 				}
507 507
 			}
@@ -510,9 +510,9 @@  discard block
 block discarded – undo
510 510
         ASTPP  3.0 
511 511
         put one variable with the name of dialplan variable 
512 512
 		 **/
513
-		if(!empty($gateway_data['dialplan_variable']) && $gateway_data['dialplan_variable'] != ''){
514
-		 $gateway_result['dialplan_variable']  = $gateway_data['dialplan_variable'];
515
-		 }else{
513
+		if ( ! empty($gateway_data['dialplan_variable']) && $gateway_data['dialplan_variable'] != '') {
514
+		 $gateway_result['dialplan_variable'] = $gateway_data['dialplan_variable'];
515
+		 } else {
516 516
 		 $gateway_result['dialplan_variable'] = '';
517 517
 		 }
518 518
 		 /**********************************************************************************************/
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 		$data['form'] = $this->form->build_form($this->freeswitch_form->get_gateway_form_fields(), $gateway_data);
526 526
 		$insert_arr = array();
527 527
 		$gateway_arr = array();
528
-		$insert_arr['dialplan_variable'] ="";
528
+		$insert_arr['dialplan_variable'] = "";
529 529
 		foreach ($gateway_data as $key => $gateway_value) {
530 530
 			if ($gateway_value != "") {
531 531
 				if ($key == "sip_profile_id") {
@@ -543,9 +543,9 @@  discard block
 block discarded – undo
543 543
 					$insert_arr['dialplan_variable'] = $gateway_data["dialplan_variable"];
544 544
 				}
545 545
 				/*********************************************************************/
546
-				else if($key == "status") {
546
+				else if ($key == "status") {
547 547
 					$insert_arr[$key] = $gateway_data["status"];
548
-				}  else {
548
+				} else {
549 549
 					if ($key != "id") {
550 550
 						$gateway_arr[$key] = $gateway_value;
551 551
 					}
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 				echo $data['validation_errors'];
563 563
 				exit;
564 564
 			} else {
565
-		if ( preg_match('/\s/',$insert_arr['name']) )
565
+		if (preg_match('/\s/', $insert_arr['name']))
566 566
 		{
567 567
 		  echo json_encode(array("name_error"=> "Gateway name must not have any space."));
568 568
 		  exit;
@@ -571,17 +571,17 @@  discard block
 block discarded – undo
571 571
 		ASTPP  3.0 
572 572
 		gateway last modified date
573 573
 		*/
574
-		$insert_arr['last_modified_date']=gmdate('Y-m-d H:i:s');
574
+		$insert_arr['last_modified_date'] = gmdate('Y-m-d H:i:s');
575 575
 		/*************************************************/
576 576
 				$update = $this->db->update("gateways", $insert_arr, array('id' => $gateway_data['id']));
577 577
 				if ($update) {
578 578
 					$profile_name = $this->common->get_field_name('name', 'sip_profiles', $insert_arr['sip_profile_id']);
579 579
 			$sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $insert_arr['sip_profile_id']);
580 580
 					$cmd = "api sofia profile ".$profile_name." killgw '".$insert_arr['name']."' ";
581
-					$this->freeswitch_model->reload_freeswitch($cmd,$sip_ip);
581
+					$this->freeswitch_model->reload_freeswitch($cmd, $sip_ip);
582 582
 
583
-					$cmd2 = "api sofia profile " . $profile_name . " rescan reloadacl reloadxml";
584
-					$this->freeswitch_model->reload_freeswitch($cmd2,$sip_ip);
583
+					$cmd2 = "api sofia profile ".$profile_name." rescan reloadacl reloadxml";
584
+					$this->freeswitch_model->reload_freeswitch($cmd2, $sip_ip);
585 585
 				}
586 586
 				echo json_encode(array("SUCCESS"=> $insert_arr['name']." Gateway Updated Successfully!"));
587 587
 				exit;
@@ -593,18 +593,18 @@  discard block
 block discarded – undo
593 593
 				echo $data['validation_errors'];
594 594
 				exit;
595 595
 			} else {
596
-		if ( preg_match('/\s/',$insert_arr['name']) )
596
+		if (preg_match('/\s/', $insert_arr['name']))
597 597
 		{
598 598
 		  echo json_encode(array("name_error"=> "Gateway name must not have any space."));
599 599
 		  exit;
600 600
 		}
601
-			$insert_arr['created_date']=gmdate('Y-m-d H:i:s'); 
601
+			$insert_arr['created_date'] = gmdate('Y-m-d H:i:s'); 
602 602
 				$insert = $this->db->insert("gateways", $insert_arr);
603 603
 				if ($insert) {
604 604
 					$profile_name = $this->common->get_field_name('name', 'sip_profiles', $insert_arr['sip_profile_id']);
605 605
 			$sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $insert_arr['sip_profile_id']);
606
-					$cmd = "api sofia profile " . $profile_name . " rescan reloadacl reloadxml";
607
-					$this->freeswitch_model->reload_freeswitch($cmd,$sip_ip);
606
+					$cmd = "api sofia profile ".$profile_name." rescan reloadacl reloadxml";
607
+					$this->freeswitch_model->reload_freeswitch($cmd, $sip_ip);
608 608
 				}
609 609
 				echo json_encode(array("SUCCESS"=> $insert_arr['name']." Gateway Added Successfully!"));
610 610
 				exit;
@@ -619,12 +619,12 @@  discard block
 block discarded – undo
619 619
 			$profile_name = $this->common->get_field_name('name', 'sip_profiles', $profile_id);
620 620
 		$sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $profile_id);
621 621
 			$gateway_name = $this->common->get_field_name('name', 'gateways', $gateway_id);
622
-			$cmd = "api sofia profile " . $profile_name . " killgw " . $gateway_name . " reloadxml";
623
-			$this->freeswitch_model->reload_freeswitch($cmd,$sip_ip);
622
+			$cmd = "api sofia profile ".$profile_name." killgw ".$gateway_name." reloadxml";
623
+			$this->freeswitch_model->reload_freeswitch($cmd, $sip_ip);
624 624
 		}
625 625
 
626 626
 		$this->session->set_flashdata('astpp_notification', 'Gateway Removed Successfully!');
627
-		redirect(base_url() . 'freeswitch/fsgateway/');
627
+		redirect(base_url().'freeswitch/fsgateway/');
628 628
 	}
629 629
 
630 630
 	function fsgateway_delete_multiple() {
@@ -641,8 +641,8 @@  discard block
 block discarded – undo
641 641
 		$this->session->set_userdata('advance_search', 0);
642 642
 		$data['grid_fields'] = $this->freeswitch_form->build_fssipprofile_list_for_admin();
643 643
 		$data["grid_buttons"] = $this->freeswitch_form->build_fssipprofile_grid_buttons();
644
-	$data['form_search']=$this->form->build_serach_form($this->freeswitch_form->get_sipprofile_search_form());
645
-	$data['button_name']="Add Setting";
644
+	$data['form_search'] = $this->form->build_serach_form($this->freeswitch_form->get_sipprofile_search_form());
645
+	$data['button_name'] = "Add Setting";
646 646
 	//$data['form_search'] = $this->form->build_serach_form($this->trunk_form->get_trunk_search_form());
647 647
 		$this->load->view('view_fssipprofile_list', $data);
648 648
 	}
@@ -674,14 +674,14 @@  discard block
 block discarded – undo
674 674
 		$query = $this->db_model->getSelect("*", "sip_profiles", $where);
675 675
 		$query = $query->result_array();
676 676
 		$gateway_result = array();
677
-		$i=0;
677
+		$i = 0;
678 678
 		foreach ($query as $key => $query_value) {
679 679
 			foreach ($query_value as $gateway_key => $gatewau_val) {
680
-		  if($gateway_key != 'id' && $gateway_key != 'name' && $gateway_key != 'sip_ip' && $gateway_key != 'sip_port'){
680
+		  if ($gateway_key != 'id' && $gateway_key != 'name' && $gateway_key != 'sip_ip' && $gateway_key != 'sip_port') {
681 681
 				if ($gateway_key != "profile_data") {
682 682
 					$gateway_data[$gateway_key] = $gatewau_val;
683 683
 				} else {
684
-					$tmp = (array) json_decode($gatewau_val);
684
+					$tmp = (array)json_decode($gatewau_val);
685 685
 					$gateway_result = array_merge($gateway_data, $tmp);
686 686
 				}
687 687
 	}
@@ -694,74 +694,74 @@  discard block
 block discarded – undo
694 694
 	  $json_data['rows'][] = array('cell' => array(
695 695
 		  $key,
696 696
 		  $value,
697
-		  array('<a href="/freeswitch/fssipprofile_edit/'.$edited_id.'/edit/' . $key .'/" class="btn btn-royelblue btn-sm"  title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="/freeswitch/fssipprofile_delete_params/'.$edited_id.'/' . $key .'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>')
697
+		  array('<a href="/freeswitch/fssipprofile_edit/'.$edited_id.'/edit/'.$key.'/" class="btn btn-royelblue btn-sm"  title="Edit">&nbsp;<i class="fa fa-pencil-square-o fa-fw"></i></a>&nbsp;<a href="/freeswitch/fssipprofile_delete_params/'.$edited_id.'/'.$key.'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();">&nbsp;<i class="fa fa-trash fa-fw"></i></a>')
698 698
 		  ));
699 699
   }
700 700
 		echo json_encode($json_data);
701 701
 	}
702
-	 function fssipprofile_action($button_name,$id) {
702
+	 function fssipprofile_action($button_name, $id) {
703 703
 		$where = array('id' => $id);
704 704
 		$query = $this->db_model->getSelect("*", "sip_profiles", $where);
705 705
 		$query = $query->result_array();
706 706
 		$where = array('sip_profile_id' => $id);
707
-		if($button_name == "start")
707
+		if ($button_name == "start")
708 708
 		{ 
709
-		   $cmd = "api sofia profile " . trim($query[0]['name']) ." start"; 
709
+		   $cmd = "api sofia profile ".trim($query[0]['name'])." start"; 
710 710
 		}
711
-		elseif($button_name == "stop")
711
+		elseif ($button_name == "stop")
712 712
 		{
713
-			$cmd= "api sofia profile stop";
713
+			$cmd = "api sofia profile stop";
714 714
 		}
715
-		elseif($button_name == "reload")
715
+		elseif ($button_name == "reload")
716 716
 		{
717 717
 			$cmd = "api reloadxml";
718 718
 		}
719
-		elseif($button_name == "rescan")
719
+		elseif ($button_name == "rescan")
720 720
 		{
721
-			$cmd = "api sofia profile " . trim($query[0]['name']) . " rescan";
721
+			$cmd = "api sofia profile ".trim($query[0]['name'])." rescan";
722 722
 		}
723 723
         
724 724
 		$this->freeswitch_model->reload_freeswitch($cmd);
725
-	redirect(base_url() . 'freeswitch/fssipprofile/');   
725
+	redirect(base_url().'freeswitch/fssipprofile/');   
726 726
 	}
727
-	 function fssipprofile_add($add='') {
727
+	 function fssipprofile_add($add = '') {
728 728
      
729 729
 		$data['username'] = $this->session->userdata('user_name');
730 730
 		$data['flag'] = 'create';
731 731
 		$data['page_title'] = 'Create SIP Profile';
732 732
 		$sipprofile_data = $this->input->post();
733
-		 $sipprofile_data['status']=$sipprofile_data['sipstatus'];
734
-		$data['button_name']="Add Setting";
735
-		if($add == 'add')
733
+		 $sipprofile_data['status'] = $sipprofile_data['sipstatus'];
734
+		$data['button_name'] = "Add Setting";
735
+		if ($add == 'add')
736 736
 		{
737 737
           
738 738
 	  unset($sipprofile_data['action']);
739 739
 	   unset($sipprofile_data['sipstatus']);
740
-	  $insert_data=$sipprofile_data;
740
+	  $insert_data = $sipprofile_data;
741 741
 	  
742
-	  if($sipprofile_data['name'] == '' || $sipprofile_data['sip_ip'] =='' || $sipprofile_data['sip_port'] =='')
742
+	  if ($sipprofile_data['name'] == '' || $sipprofile_data['sip_ip'] == '' || $sipprofile_data['sip_port'] == '')
743 743
 	  {
744 744
 		  $this->session->set_flashdata('astpp_notification', 'Please enter All profile value!');
745
-		  redirect(base_url() . 'freeswitch/fssipprofile_add/');
745
+		  redirect(base_url().'freeswitch/fssipprofile_add/');
746 746
 		  exit;
747 747
 	  }
748
-	  if(preg_match('/\s/',$sipprofile_data['name']))
748
+	  if (preg_match('/\s/', $sipprofile_data['name']))
749 749
 	  {
750 750
 		$this->session->set_flashdata('astpp_notification', 'SIP Profile name must not have any space!');
751
- 		redirect(base_url() . 'freeswitch/fssipprofile_add/');
751
+ 		redirect(base_url().'freeswitch/fssipprofile_add/');
752 752
  		exit;
753 753
 	  }
754
-	  if(!preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/', $sipprofile_data['sip_ip']))
754
+	  if ( ! preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/', $sipprofile_data['sip_ip']))
755 755
 	  {
756 756
 		$this->session->set_flashdata('astpp_notification', 'SIP IP must be proper!');
757
- 		redirect(base_url() . 'freeswitch/fssipprofile_add/');
757
+ 		redirect(base_url().'freeswitch/fssipprofile_add/');
758 758
  		exit;
759 759
 	  }
760
-	  $sipprofile_data['id']='';
760
+	  $sipprofile_data['id'] = '';
761 761
 	  $check_authentication = $this->freeswitch_model->profile_authentication($sipprofile_data);
762 762
 	  if ($check_authentication->num_rows == 0) {
763 763
 	      
764
-		  $sipprofile_data['created_date']=gmdate('Y-m-d H:i:s');
764
+		  $sipprofile_data['created_date'] = gmdate('Y-m-d H:i:s');
765 765
 		 /** Version 2.1
766 766
 		  * Purpose : Set default data for new created profile
767 767
 		  **/
@@ -772,40 +772,40 @@  discard block
 block discarded – undo
772 772
 		}
773 773
 		else {
774 774
 					$this->session->set_flashdata('astpp_notification', 'Duplicate SIP IP OR Port found it must be unique!');
775
-			redirect(base_url() . 'freeswitch/fssipprofile_add/');
775
+			redirect(base_url().'freeswitch/fssipprofile_add/');
776 776
 		}
777 777
 		$this->session->set_flashdata('astpp_errormsg', 'SIP Profile Added Successfully!');
778
-		redirect(base_url() . 'freeswitch/fssipprofile/');
778
+		redirect(base_url().'freeswitch/fssipprofile/');
779 779
 		}
780 780
 	
781
-		if($add == 'edit')
781
+		if ($add == 'edit')
782 782
 		{
783 783
 	  $check_authentication = $this->freeswitch_model->profile_authentication($sipprofile_data);
784 784
 		unset($sipprofile_data['action']);
785 785
 		unset($sipprofile_data['sipstatus']);
786 786
 		$insert_arr = $sipprofile_data;
787 787
 			if ($check_authentication->num_rows == 0) {
788
-			$insert_arr['last_modified_date']=gmdate("Y-m-d H:i:s");
788
+			$insert_arr['last_modified_date'] = gmdate("Y-m-d H:i:s");
789 789
 					$update = $this->db->update("sip_profiles", $insert_arr, array('id' => $sipprofile_data['id']));
790 790
 					$this->session->set_flashdata('astpp_errormsg', $sipprofile_data['name']." SIP Profile Updated Successfully!");
791
-					redirect(base_url() . 'freeswitch/fssipprofile/');   
791
+					redirect(base_url().'freeswitch/fssipprofile/');   
792 792
 					exit;
793 793
 				} else {
794 794
 					$this->session->set_flashdata('astpp_notification', 'Duplicate SIP IP OR Port found it must be unique!');
795
-			redirect(base_url() . 'freeswitch/fssipprofile/');
795
+			redirect(base_url().'freeswitch/fssipprofile/');
796 796
 				}
797
-	  redirect(base_url() . 'freeswitch/fssipprofile/');   
797
+	  redirect(base_url().'freeswitch/fssipprofile/');   
798 798
 		}
799 799
 		$this->load->view('view_fssipprofile_add', $data);
800 800
 	}
801 801
 
802 802
 
803
-	function fssipprofile_edit($edit_id = '',$type='',$name_prams='') {
803
+	function fssipprofile_edit($edit_id = '', $type = '', $name_prams = '') {
804 804
 		$data['page_title'] = 'Edit SIP Profile';
805 805
 		  $sipprofile_data = $this->input->post();
806
-		if(!$edit_id)
806
+		if ( ! $edit_id)
807 807
 		{
808
-	  $edit_id=$sipprofile_data['id'];
808
+	  $edit_id = $sipprofile_data['id'];
809 809
 		}
810 810
 		$where = array('id' => $edit_id);
811 811
 		$query = $this->db_model->getSelect("*", "sip_profiles", $where);
@@ -816,45 +816,45 @@  discard block
 block discarded – undo
816 816
 				if ($gateway_key != "profile_data") {
817 817
 					$gateway_data[$gateway_key] = $gatewau_val;
818 818
 				} else {
819
-					$tmp = (array) json_decode($gatewau_val);
819
+					$tmp = (array)json_decode($gatewau_val);
820 820
 					$gateway_result = array_merge($gateway_data, $tmp);
821 821
 				}
822 822
 			}
823 823
 		}
824 824
 		$data['grid_fields'] = $this->freeswitch_form->build_fssipprofile_params_list_for_admin();
825 825
 		$data['edited_id'] = $edit_id;
826
-		$data['sip_name']=$query[0]['name'];
827
-	$data['status']=$query[0]['status'];
828
-	$data['sip_ip']= $query[0]['sip_ip'];
829
-	$data['sip_port']=$query[0]['sip_port'];
830
-	$data['id']=$query[0]['id'];
831
-		$data['button_name']="Add Setting";
832
-		if($type == 'edit' || isset($sipprofile_data['type']) && $sipprofile_data['type'] == 'save')
826
+		$data['sip_name'] = $query[0]['name'];
827
+	$data['status'] = $query[0]['status'];
828
+	$data['sip_ip'] = $query[0]['sip_ip'];
829
+	$data['sip_port'] = $query[0]['sip_port'];
830
+	$data['id'] = $query[0]['id'];
831
+		$data['button_name'] = "Add Setting";
832
+		if ($type == 'edit' || isset($sipprofile_data['type']) && $sipprofile_data['type'] == 'save')
833 833
 		{
834
-		if($type == 'edit')
834
+		if ($type == 'edit')
835 835
 		{
836
-		$data['params_name']=$name_prams;
837
-		$data['params_status']=0;
838
-		if($gateway_result[$name_prams] == "true" || $gateway_result[$name_prams] == "false")
836
+		$data['params_name'] = $name_prams;
837
+		$data['params_status'] = 0;
838
+		if ($gateway_result[$name_prams] == "true" || $gateway_result[$name_prams] == "false")
839 839
 		{
840
-		  $data['params_status']=1;
840
+		  $data['params_status'] = 1;
841 841
 		}
842
-		$data['params_value']=$gateway_result[$name_prams];
843
-		$data['button_name']="Update Setting";
842
+		$data['params_value'] = $gateway_result[$name_prams];
843
+		$data['button_name'] = "Update Setting";
844 844
 		}
845
-		if(isset($sipprofile_data['type']) && $sipprofile_data['type'] == 'save'){
845
+		if (isset($sipprofile_data['type']) && $sipprofile_data['type'] == 'save') {
846 846
 		$sipprofile_data = $this->input->post();
847
-		$tmp[$sipprofile_data['params_name']]=$sipprofile_data['params_value'];
848
-		  $final_data= json_encode($tmp);
847
+		$tmp[$sipprofile_data['params_name']] = $sipprofile_data['params_value'];
848
+		  $final_data = json_encode($tmp);
849 849
 		  $insert_arr["profile_data"] = json_encode($tmp);
850 850
 		  $update = $this->db->update("sip_profiles", $insert_arr, array('id' => $edit_id));
851
-		   if($sipprofile_data['type_settings']=="add_setting"){
852
-			$this->session->set_flashdata('astpp_errormsg',$data['sip_name']. " SIP Setting Added Successfully!");
853
-				  }else{
854
-			$this->session->set_flashdata('astpp_errormsg',$data['sip_name']. " SIP Setting Updated Successfully!");
851
+		   if ($sipprofile_data['type_settings'] == "add_setting") {
852
+			$this->session->set_flashdata('astpp_errormsg', $data['sip_name']." SIP Setting Added Successfully!");
853
+				  } else {
854
+			$this->session->set_flashdata('astpp_errormsg', $data['sip_name']." SIP Setting Updated Successfully!");
855 855
 		    
856 856
 				  }
857
-				  redirect(base_url() . 'freeswitch/fssipprofile_edit/'.$sipprofile_data['id']);
857
+				  redirect(base_url().'freeswitch/fssipprofile_edit/'.$sipprofile_data['id']);
858 858
 		  exit;
859 859
 
860 860
 		}
@@ -875,19 +875,19 @@  discard block
 block discarded – undo
875 875
 				if ($gateway_key != "profile_data") {
876 876
 					$gateway_data[$gateway_key] = $gatewau_val;
877 877
 				} else {
878
-					$tmp = (array) json_decode($gatewau_val);
878
+					$tmp = (array)json_decode($gatewau_val);
879 879
 					$gateway_result = array_merge($gateway_data, $tmp);
880 880
 				}
881 881
 			}
882 882
 		}
883
-		$tmp[$sipprofile_data['params_name']]=$sipprofile_data['params_value'];
884
-	$final_data= json_encode($tmp);
883
+		$tmp[$sipprofile_data['params_name']] = $sipprofile_data['params_value'];
884
+	$final_data = json_encode($tmp);
885 885
 	$insert_arr["profile_data"] = json_encode($tmp);
886 886
 	$update = $this->db->update("sip_profiles", $insert_arr, array('id' => $id));
887 887
 	$this->load->view('view_fssipprofile_edit', $data);
888 888
 	}
889 889
     
890
-	function fssipprofile_delete_params($id,$name) {
890
+	function fssipprofile_delete_params($id, $name) {
891 891
 	$where = array('id' => $id);
892 892
 		$query = $this->db_model->getSelect("*", "sip_profiles", $where);
893 893
 		$query = $query->result_array();
@@ -897,18 +897,18 @@  discard block
 block discarded – undo
897 897
 				if ($gateway_key != "profile_data") {
898 898
 					$gateway_data[$gateway_key] = $gatewau_val;
899 899
 				} else {
900
-					$tmp = (array) json_decode($gatewau_val);
900
+					$tmp = (array)json_decode($gatewau_val);
901 901
 					$gateway_result = array_merge($gateway_data, $tmp);
902 902
 				}
903 903
 			}
904 904
 		}
905
-	if(isset($tmp[$name])){
905
+	if (isset($tmp[$name])) {
906 906
 	  unset($tmp[$name]);
907 907
 	}
908 908
 	$insert_arr["profile_data"] = json_encode($tmp);
909 909
 	$update = $this->db->update("sip_profiles", $insert_arr, array('id' => $id));
910 910
 		$this->session->set_flashdata('astpp_notification', $name.' SIP Setting Removed Successfully!');
911
-		redirect(base_url() . 'freeswitch/fssipprofile_edit/'.$id);
911
+		redirect(base_url().'freeswitch/fssipprofile_edit/'.$id);
912 912
 	}
913 913
     
914 914
 	function fssipprofile_delete($profile_id) {
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
 		$sip_ip = $this->common->get_field_name('sip_ip', 'sip_profiles', $profile_id);
917 917
 	$delete = $this->db_model->delete("sip_profiles", array("id" => $profile_id));
918 918
 		$this->session->set_flashdata('astpp_notification', 'SIP Profile Removed Successfully!');
919
-		redirect(base_url() . 'freeswitch/fssipprofile/');
919
+		redirect(base_url().'freeswitch/fssipprofile/');
920 920
 	}
921 921
 
922 922
 	function fsserver_list() {
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 	function fsserver_delete($id) {
1004 1004
 		$this->freeswitch_model->fsserver_delete($id);
1005 1005
 		$this->session->set_flashdata('astpp_notification', 'Freeswitch Server Removed Successfully!');
1006
-		redirect(base_url() . 'freeswitch/fsserver_list/');
1006
+		redirect(base_url().'freeswitch/fsserver_list/');
1007 1007
 		exit;
1008 1008
 	}
1009 1009
 
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 			$this->session->set_userdata('fsserver_list_search', $action);
1019 1019
 		}
1020 1020
 		if (@$ajax_search != 1) {
1021
-			redirect(base_url() . 'freeswitch/fsserver_list/');
1021
+			redirect(base_url().'freeswitch/fsserver_list/');
1022 1022
 		}
1023 1023
 	}
1024 1024
 
@@ -1026,11 +1026,11 @@  discard block
 block discarded – undo
1026 1026
 		$this->session->set_userdata('advance_search', 0);
1027 1027
 		$this->session->set_userdata('account_search', "");
1028 1028
 	}
1029
-	function fssipprofile_edit_validation($id,$name){
1030
-	$sip_profile_data=$this->common->get_field_name('profile_data','sip_profiles',$id);
1031
-	$final_data= json_decode($sip_profile_data,true);
1032
-	foreach($final_data as $key=>$value){
1033
-		if($key == $name){
1029
+	function fssipprofile_edit_validation($id, $name) {
1030
+	$sip_profile_data = $this->common->get_field_name('profile_data', 'sip_profiles', $id);
1031
+	$final_data = json_decode($sip_profile_data, true);
1032
+	foreach ($final_data as $key=>$value) {
1033
+		if ($key == $name) {
1034 1034
 			echo 1;
1035 1035
 			return true;
1036 1036
 		}
Please login to merge, or discard this patch.
Braces   +15 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,8 +35,9 @@  discard block
 block discarded – undo
35 35
 		$this->load->library('freeswitch_lib');
36 36
 		$this->load->model('freeswitch_model');
37 37
 
38
-		if ($this->session->userdata('user_login') == FALSE)
39
-			redirect(base_url() . '/astpp/login');
38
+		if ($this->session->userdata('user_login') == FALSE) {
39
+					redirect(base_url() . '/astpp/login');
40
+		}
40 41
 	}
41 42
 
42 43
 	function fssipdevices_add($type = "") {
@@ -61,7 +62,7 @@  discard block
 block discarded – undo
61 62
 		if($account_data['type'] == '-1'  || $account_data['type'] == '1')
62 63
 		{
63 64
 			$this->load->view('view_freeswitch_add_edit', $data);
64
-		}else{
65
+		} else{
65 66
 			$this->load->view('view_freeswitch_customer_add_edit', $data);
66 67
 		}
67 68
 	}
@@ -75,7 +76,7 @@  discard block
 block discarded – undo
75 76
 		{
76 77
 			$data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($edit_id), $account);
77 78
 			$this->load->view('view_freeswitch_add_edit', $data);
78
-		}else{
79
+		} else{
79 80
 		 $data['form'] = $this->form->build_form($this->freeswitch_form->get_freeswith_form_fields($edit_id), $account);
80 81
 		$this->load->view('view_freeswitch_customer_add_edit', $data);
81 82
 		}
@@ -91,7 +92,7 @@  discard block
 block discarded – undo
91 92
 		{
92 93
 		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid,$edit_id), $account);
93 94
 		$this->load->view('view_freeswitch_add_edit', $data);
94
-		}else{
95
+		} else{
95 96
         
96 97
 		$data['form'] = $this->form->build_form($this->freeswitch_form->fsdevice_form_fields_for_customer($accountid,$edit_id), $account);
97 98
 		$this->load->view('view_freeswitch_customer_add_edit', $data);
@@ -214,7 +215,7 @@  discard block
 block discarded – undo
214 215
 				echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!"));
215 216
 				exit;
216 217
 			}
217
-		}else{
218
+		} else{
218 219
 			$data['page_title'] = 'Create Freeswitch SIP Devices';
219 220
 			if ($this->form_validation->run() == FALSE) {
220 221
 				$data['validation_errors'] = validation_errors();
@@ -489,7 +490,7 @@  discard block
 block discarded – undo
489 490
   			$gateway_data["status"] = isset($query_value["status"])?$query_value["status"]:"";
490 491
 				if ($gateway_key != "gateway_data") {
491 492
 					$gateway_data[$gateway_key] = $gatewau_val;
492
-				}else if($gateway_key == "status") {
493
+				} else if($gateway_key == "status") {
493 494
 					$gateway_data[$gateway_key] = $gatewau_val;
494 495
 				} 
495 496
 				 /**
@@ -512,7 +513,7 @@  discard block
 block discarded – undo
512 513
 		 **/
513 514
 		if(!empty($gateway_data['dialplan_variable']) && $gateway_data['dialplan_variable'] != ''){
514 515
 		 $gateway_result['dialplan_variable']  = $gateway_data['dialplan_variable'];
515
-		 }else{
516
+		 } else{
516 517
 		 $gateway_result['dialplan_variable'] = '';
517 518
 		 }
518 519
 		 /**********************************************************************************************/
@@ -545,7 +546,7 @@  discard block
 block discarded – undo
545 546
 				/*********************************************************************/
546 547
 				else if($key == "status") {
547 548
 					$insert_arr[$key] = $gateway_data["status"];
548
-				}  else {
549
+				} else {
549 550
 					if ($key != "id") {
550 551
 						$gateway_arr[$key] = $gateway_value;
551 552
 					}
@@ -707,16 +708,13 @@  discard block
 block discarded – undo
707 708
 		if($button_name == "start")
708 709
 		{ 
709 710
 		   $cmd = "api sofia profile " . trim($query[0]['name']) ." start"; 
710
-		}
711
-		elseif($button_name == "stop")
711
+		} elseif($button_name == "stop")
712 712
 		{
713 713
 			$cmd= "api sofia profile stop";
714
-		}
715
-		elseif($button_name == "reload")
714
+		} elseif($button_name == "reload")
716 715
 		{
717 716
 			$cmd = "api reloadxml";
718
-		}
719
-		elseif($button_name == "rescan")
717
+		} elseif($button_name == "rescan")
720 718
 		{
721 719
 			$cmd = "api sofia profile " . trim($query[0]['name']) . " rescan";
722 720
 		}
@@ -769,8 +767,7 @@  discard block
 block discarded – undo
769 767
 		  /**====================================================================*/
770 768
 		  $insert = $this->db->insert("sip_profiles", $sipprofile_data);
771 769
 
772
-		}
773
-		else {
770
+		} else {
774 771
 					$this->session->set_flashdata('astpp_notification', 'Duplicate SIP IP OR Port found it must be unique!');
775 772
 			redirect(base_url() . 'freeswitch/fssipprofile_add/');
776 773
 		}
@@ -850,7 +847,7 @@  discard block
 block discarded – undo
850 847
 		  $update = $this->db->update("sip_profiles", $insert_arr, array('id' => $edit_id));
851 848
 		   if($sipprofile_data['type_settings']=="add_setting"){
852 849
 			$this->session->set_flashdata('astpp_errormsg',$data['sip_name']. " SIP Setting Added Successfully!");
853
-				  }else{
850
+				  } else{
854 851
 			$this->session->set_flashdata('astpp_errormsg',$data['sip_name']. " SIP Setting Updated Successfully!");
855 852
 		    
856 853
 				  }
Please login to merge, or discard this patch.
astpp/application/modules/freeswitch/libraries/freeswitch_form.php 2 patches
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 23
 ###############################################################################
24 24
 
25
-if (!defined('BASEPATH'))
25
+if ( ! defined('BASEPATH'))
26 26
 	exit('No direct script access allowed');
27 27
 
28 28
 class Freeswitch_form {
@@ -31,26 +31,26 @@  discard block
 block discarded – undo
31 31
 		$this->CI = & get_instance();
32 32
 	}
33 33
 
34
-	function get_freeswith_form_fields($id=false) {
34
+	function get_freeswith_form_fields($id = false) {
35 35
 	$log_type = $this->CI->session->userdata("logintype");
36
-	if($log_type == 0  || $log_type == 3 || $log_type == 1){
37
-		  $sip_pro=null;
36
+	if ($log_type == 0 || $log_type == 3 || $log_type == 1) {
37
+		  $sip_pro = null;
38 38
 	}
39
-	else{
40
-		  $sip_pro=array('SIP Profile', 'sip_profile_id', 'SELECT', '', 'trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', '', '');
39
+	else {
40
+		  $sip_pro = array('SIP Profile', 'sip_profile_id', 'SELECT', '', 'trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', '', '');
41 41
 
42 42
 	}  
43
-	$val=$id > 0 ? 'sip_devices.username.'.$id : 'sip_devices.username';   
43
+	$val = $id > 0 ? 'sip_devices.username.'.$id : 'sip_devices.username';   
44 44
 	  $uname_user = $this->CI->common->find_uniq_rendno('10', '', '');
45 45
 		$password = $this->CI->common->generate_password();
46 46
 		/*Edit functionality*/
47
-		$form['forms'] = array(base_url() . 'freeswitch/fssipdevices_save/', array("id" => "sipdevices_form", "name" => "sipdevices_form"));
47
+		$form['forms'] = array(base_url().'freeswitch/fssipdevices_save/', array("id" => "sipdevices_form", "name" => "sipdevices_form"));
48 48
 		$form['Device Information'] = array(
49 49
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
50
-			 array('Username', 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user,'id'=>'username1', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number','<i style="cursor:pointer; color:#1BCB61 !important; font-size:14px;    padding-left:5px;    padding-top:8px;    float:left;" title="Reset Password" class="change_number  fa fa-refresh"></i>'),
51
-			array('Password', 'INPUT', array('name' => 'fs_password', 'size' => '20', 'value'=>$password ,'id'=>'password1','class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password','<i style="cursor:pointer; color:#1BCB61 !important; font-size:14px;    padding-left:5px;    padding-top:8px;    float:left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'), 
52
-			array('Account', 'accountcode', 'SELECT', '','trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0")),
53
-			array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
50
+			 array('Username', 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user, 'id'=>'username1', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number', '<i style="cursor:pointer; color:#1BCB61 !important; font-size:14px;    padding-left:5px;    padding-top:8px;    float:left;" title="Reset Password" class="change_number  fa fa-refresh"></i>'),
51
+			array('Password', 'INPUT', array('name' => 'fs_password', 'size' => '20', 'value'=>$password, 'id'=>'password1', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password', '<i style="cursor:pointer; color:#1BCB61 !important; font-size:14px;    padding-left:5px;    padding-top:8px;    float:left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'), 
52
+			array('Account', 'accountcode', 'SELECT', '', 'trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type"=>"0", "deleted" => "0")),
53
+			array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
54 54
 			array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
55 55
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
56 56
 	   $sip_pro,
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
             
91 91
 			 array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', 'where_arr', ''),
92 92
 			array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''),
93
-			array('Gateway', 'gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown','where_arr', ''), 
94
-			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", "deleted" => "0")),
93
+			array('Gateway', 'gateway_id', 'SELECT', '', '', 'tOOL TIP', 'Please select gateway first', 'id', 'name', 'gateways', 'build_dropdown', 'where_arr', ''), 
94
+			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", "deleted" => "0")),
95 95
 	 array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
96
-	array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
96
+	array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
97 97
 		$form['button_search'] = array('name' => 'action', 'id' => "freeswith_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
98 98
 		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
99 99
 		return $form;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	  function get_sipdevices_search_form_user() {
103 103
 		$form['forms'] = array("", array('id' => "sipdevices_search"));
104 104
 		$form['Search'] = array(
105
-			array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20',  'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''),
105
+			array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''),
106 106
 			array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', 'where_arr', ''),
107 107
 		array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
108 108
 			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
132 132
 		return $form;
133 133
 	}
134
-	function get_sipprofile_search_form(){
134
+	function get_sipprofile_search_form() {
135 135
     
136 136
 	   $form['forms'] = array("", array('id' => "freeswitch_search"));
137 137
 		$form['Search'] = array(
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
             
155 155
 			array('Username', 'INPUT', array('name' => 'username[username]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'username[username-string]', '', '', '', 'search_string_type', ''),
156 156
 			array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', 'where_arr', ''),
157
-			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"=>"GLOBAL", "deleted" => "0")),
157
+			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"=>"GLOBAL", "deleted" => "0")),
158 158
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'),  
159 159
 			//array('Voicemail', 'vm-enabled', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_voicemail_status'),
160
-			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
160
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), array('', 'HIDDEN', 'advance_search', '1', '', '', ''));
161 161
 		$form['button_search'] = array('name' => 'action', 'id' => "fssipdevice_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
162 162
 		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
163 163
 		return $form;
@@ -168,18 +168,18 @@  discard block
 block discarded – undo
168 168
     */
169 169
 	function build_system_list_for_admin() {
170 170
 		$grid_field_arr = json_encode(array(
171
-		array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "","","false","center"),
172
-			array("User Name", "100", "username", "", "", "","","true","center"),
173
-			array("Password", "100", "password", "", "", "","","true","center"),
174
-			array("SIP Profile", "100", "sip_profile_id", "name", "sip_profiles", "get_field_name","","true","center"),
175
-			array("Account", "150", "accountid", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
176
-			array("Caller Name", "100", "effective_caller_id_name", "", "", "","","true","center"),
177
-			array("Caller Number", "100", "effective_caller_id_number", "", "", "","","true","center"),
178
-			array("Voicemail", "100", "voicemail_enabled", "", "", "","","true","center"),	
179
-			array("Status", "100", "status", "status", "sip_devies", "get_status","","true","center"),
180
-			array("Created Date", "130", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
181
-			array("Modified Date", "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
182
-			array("Action", "107", "", "", "", array("EDIT" => array("url" => "/freeswitch/fssipdevices_edit/", "mode" => "single","layout"=>"medium"),
171
+		array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "50", "", "", "", "", "", "false", "center"),
172
+			array("User Name", "100", "username", "", "", "", "", "true", "center"),
173
+			array("Password", "100", "password", "", "", "", "", "true", "center"),
174
+			array("SIP Profile", "100", "sip_profile_id", "name", "sip_profiles", "get_field_name", "", "true", "center"),
175
+			array("Account", "150", "accountid", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"),
176
+			array("Caller Name", "100", "effective_caller_id_name", "", "", "", "", "true", "center"),
177
+			array("Caller Number", "100", "effective_caller_id_number", "", "", "", "", "true", "center"),
178
+			array("Voicemail", "100", "voicemail_enabled", "", "", "", "", "true", "center"),	
179
+			array("Status", "100", "status", "status", "sip_devies", "get_status", "", "true", "center"),
180
+			array("Created Date", "130", "creation_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"),
181
+			array("Modified Date", "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
182
+			array("Action", "107", "", "", "", array("EDIT" => array("url" => "/freeswitch/fssipdevices_edit/", "mode" => "single", "layout"=>"medium"),
183 183
 					"DELETE" => array("url" => "/freeswitch/fssipdevices_delete/", "mode" => "single")))
184 184
 				));
185 185
 		return $grid_field_arr;
@@ -188,52 +188,52 @@  discard block
 block discarded – undo
188 188
 
189 189
 
190 190
 	function build_grid_buttons() {
191
-		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fssipdevices_add/", "popup","medium"),
192
-			array("Delete",  "btn btn-line-danger","fa fa-times-circle fa-lg",  "button_action", "/freeswitch/fssipdevices_delete_multiple/")   
191
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fssipdevices_add/", "popup", "medium"),
192
+			array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/freeswitch/fssipdevices_delete_multiple/")   
193 193
 						));
194 194
 		return $buttons_json;
195 195
 	}
196 196
     
197 197
 	function fsdevices_build_grid_buttons($accountid) {
198
-		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/customer_fssipdevices_add/$accountid/", "popup","medium"),
199
-		array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/freeswitch/customer_fssipdevices_delete_multiple/")
198
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/freeswitch/customer_fssipdevices_add/$accountid/", "popup", "medium"),
199
+		array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/freeswitch/customer_fssipdevices_delete_multiple/")
200 200
 			));
201 201
 		return $buttons_json;
202 202
 	}
203 203
 
204 204
 	function get_gateway_form_fields() {
205 205
 
206
-		$form['forms'] = array(base_url() . 'freeswitch/fsgateway_save/', array("id" => "gateway_form", "name" => "gateway_form"));
206
+		$form['forms'] = array(base_url().'freeswitch/fsgateway_save/', array("id" => "gateway_form", "name" => "gateway_form"));
207 207
 		$form['Basic Information'] = array(
208 208
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
209 209
 			array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Gateway Name'),
210 210
 			array('SIP Profile', 'sip_profile_id', 'SELECT', '', '', 'tOOL TIP', '', 'id', 'name', 'sip_profiles', 'build_dropdown', '', ''),
211
-			array('Username', 'INPUT', array('name' => 'username', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter user name'),
212
-		   array('Password', 'INPUT', array('name' => 'password', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
213
-			array('Proxy', 'INPUT', array('name' => 'proxy', 'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
214
-			array('Outbound-<br/>Proxy', 'INPUT', array('name' => 'outbound-proxy', 'size' => '20',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
211
+			array('Username', 'INPUT', array('name' => 'username', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter user name'),
212
+		   array('Password', 'INPUT', array('name' => 'password', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
213
+			array('Proxy', 'INPUT', array('name' => 'proxy', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
214
+			array('Outbound-<br/>Proxy', 'INPUT', array('name' => 'outbound-proxy', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
215 215
 			array('Register', array('name' => 'register', 'class' => 'add_settings'), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'),
216 216
 			array('Caller-id-in-from', array('name' => 'caller-id-in-from', 'class' => 'add_settings'), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'),
217 217
 				array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
218 218
             
219 219
 		);
220 220
 		$form['Optional Information'] = array(
221
-			array('From- Domain', 'INPUT', array('name' => 'from_domain', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
222
-			array('From User', 'INPUT', array('name' => 'from_user', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
223
-			array('Realm', 'INPUT', array('name' => 'realm', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
221
+			array('From- Domain', 'INPUT', array('name' => 'from_domain', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
222
+			array('From User', 'INPUT', array('name' => 'from_user', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
223
+			array('Realm', 'INPUT', array('name' => 'realm', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
224 224
 			array('Extension', 'INPUT', array('name' => 'extension', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
225 225
 			array('Expire Seconds', 'INPUT', array('name' => 'expire-seconds', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
226
-			array('Reg-<br/>Transport', 'INPUT', array('name' => 'register-transport', 'size' => '20','class' => "text field medium"), '', 'tOOL TIP', ''),
226
+			array('Reg-<br/>Transport', 'INPUT', array('name' => 'register-transport', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
227 227
 			array('Contact Params', 'INPUT', array('name' => 'contact-params', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
228 228
 			array('Ping', 'INPUT', array('name' => 'ping', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
229
-			array('Retry-<br/>Seconds', 'INPUT', array('name' => 'retry-seconds', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
230
-			array('Register-<br/>Proxy', 'INPUT', array('name' => 'register-proxy', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
229
+			array('Retry-<br/>Seconds', 'INPUT', array('name' => 'retry-seconds', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
230
+			array('Register-<br/>Proxy', 'INPUT', array('name' => 'register-proxy', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
231 231
 			array('Channel', 'INPUT', array('name' => 'channel', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
232 232
 			   /**
233 233
                ASTPP  3.0 
234 234
                               put one variable with the name of dialplan variable 
235 235
 			    **/ 
236
-			  array('Dialplan Variable', 'TEXTAREA', array('name' => 'dialplan_variable', 'size' => '20','cols'=>'10','rows'=>'5', 'class' => "col_md-5 form-control", 'style'=>"width: 200px; height: 100px;font-family: Open sans,sans-serif !important;"), '', 'tOOL TIP', ''),
236
+			  array('Dialplan Variable', 'TEXTAREA', array('name' => 'dialplan_variable', 'size' => '20', 'cols'=>'10', 'rows'=>'5', 'class' => "col_md-5 form-control", 'style'=>"width: 200px; height: 100px;font-family: Open sans,sans-serif !important;"), '', 'tOOL TIP', ''),
237 237
 			 /*********************************************************************************************************/
238 238
 		);
239 239
 
@@ -250,26 +250,26 @@  discard block
 block discarded – undo
250 250
 	function build_fsgateway_list_for_admin() {
251 251
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
252 252
 		$grid_field_arr = json_encode(array(
253
-		array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
253
+		array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
254 254
 /**
255 255
 ASTPP  3.0 
256 256
 For Gateway Edit on Gateway name
257 257
 **/
258
-			array("Name", "140", "name", "", "", "","EDITABLE","true","center"),
258
+			array("Name", "140", "name", "", "", "", "EDITABLE", "true", "center"),
259 259
 /**********************************/
260
-			array("SIP Profile", "115", "sip_profile_id", "name", "sip_profiles", "get_field_name","","true","center"),
261
-			array("Username", "140", "username", "", "", "","","true","center"),
260
+			array("SIP Profile", "115", "sip_profile_id", "name", "sip_profiles", "get_field_name", "", "true", "center"),
261
+			array("Username", "140", "username", "", "", "", "", "true", "center"),
262 262
 //             array("Password", "181", "password", "", "", ""),
263
-			array("Proxy", "145", "proxy", "", "", "","","true","center"),
264
-			array("Register", "120", "register", "register", "register", "convert_to_ucfirst","","true","center"),
265
-			array("Caller-Id-In-Form", "130", "caller-id-in-from", "caller-id-in-from", "caller-id-in-from", "convert_to_ucfirst","","true","center"),
263
+			array("Proxy", "145", "proxy", "", "", "", "", "true", "center"),
264
+			array("Register", "120", "register", "register", "register", "convert_to_ucfirst", "", "true", "center"),
265
+			array("Caller-Id-In-Form", "130", "caller-id-in-from", "caller-id-in-from", "caller-id-in-from", "convert_to_ucfirst", "", "true", "center"),
266 266
 			 /*
267 267
             ASTPP  3.0 
268 268
              creation field show in grid
269 269
             */
270
-			array("Status", "110", "status", "status", "gateways", "get_status","","true","center"),
271
-			array("Created Date", "100", "created_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
272
-			 array("Modified Date", "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
270
+			array("Status", "110", "status", "status", "gateways", "get_status", "", "true", "center"),
271
+			array("Created Date", "100", "created_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"),
272
+			 array("Modified Date", "130", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
273 273
 			/********************************************************************/
274 274
 		   /*
275 275
             ASTPP  3.0 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
             */
279 279
            
280 280
 			/******************************************/
281
-			array("Action", "106", "", "", "", array("EDIT" => array("url" => "/freeswitch/fsgateway_edit/", "mode" => "popup","layout"=>"medium"),
281
+			array("Action", "106", "", "", "", array("EDIT" => array("url" => "/freeswitch/fsgateway_edit/", "mode" => "popup", "layout"=>"medium"),
282 282
 					"DELETE" => array("url" => "/freeswitch/fsgateway_delete/", "mode" => "single")))
283 283
 				));
284 284
 		return $grid_field_arr;
@@ -286,23 +286,23 @@  discard block
 block discarded – undo
286 286
 	/******************************************************/
287 287
 
288 288
 	function build_fdgateway_grid_buttons() {
289
-		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fsgateway_add/", "popup","medium"),
290
-		array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/freeswitch/fsgateway_delete_multiple/")
289
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fsgateway_add/", "popup", "medium"),
290
+		array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/freeswitch/fsgateway_delete_multiple/")
291 291
 			));
292 292
 		return $buttons_json;
293 293
 	}
294 294
 
295 295
 	function get_sipprofile_form_fields() {
296
-		$form['forms'] = array(base_url() . 'freeswitch/fssipprofile_save/', array("id" => "fssipprofile_form", "name" => "fssipprofile_form"));
296
+		$form['forms'] = array(base_url().'freeswitch/fssipprofile_save/', array("id" => "fssipprofile_form", "name" => "fssipprofile_form"));
297 297
 		$form['Basic Information'] = array(
298 298
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
299
-			array('Profile name', 'INPUT', array('name' => 'name', 'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Name'),
300
-			array('sip-ip', 'INPUT', array('name' => 'sip_ip', 'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter SIP IP Name'),
301
-			array('sip-port', 'INPUT', array('name' => 'sip_port', 'size' => '20', 'value' => '5060',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter SIP Port'),
299
+			array('Profile name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Name'),
300
+			array('sip-ip', 'INPUT', array('name' => 'sip_ip', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter SIP IP Name'),
301
+			array('sip-port', 'INPUT', array('name' => 'sip_port', 'size' => '20', 'value' => '5060', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter SIP Port'),
302 302
 			array('rtp-ip', 'INPUT', array('name' => 'rtp_ip', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
303
-			array('Dial Plan', 'INPUT', array('name' => 'dialplan', 'size' => '20', 'value' => 'XML',  'class' => "text field medium"), '', 'tOOL TIP', ''),
304
-			array('user-agent-string', 'INPUT', array('name' => 'user-agent-string', 'size' => '20', 'value' => 'ASTPP',  'class' => "text field medium"), '', 'tOOL TIP', ''),
305
-			array('debug', 'INPUT', array('name' => 'debug', 'size' => '20', 'value' => '0',  'class' => "text field medium"), '', 'tOOL TIP', ''),
303
+			array('Dial Plan', 'INPUT', array('name' => 'dialplan', 'size' => '20', 'value' => 'XML', 'class' => "text field medium"), '', 'tOOL TIP', ''),
304
+			array('user-agent-string', 'INPUT', array('name' => 'user-agent-string', 'size' => '20', 'value' => 'ASTPP', 'class' => "text field medium"), '', 'tOOL TIP', ''),
305
+			array('debug', 'INPUT', array('name' => 'debug', 'size' => '20', 'value' => '0', 'class' => "text field medium"), '', 'tOOL TIP', ''),
306 306
 			array('sip-trace', 'sip-trace', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_drp_option'),
307 307
 			array('tls', 'tls', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'),
308 308
 			array('inbound-reg-force-matching-username', 'inbound-reg-force-matching-username', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'),
@@ -320,20 +320,20 @@  discard block
 block discarded – undo
320 320
 			array('enable-100rel', 'enable-100rel', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'),
321 321
 			array('rtp-timeout-sec', 'INPUT', array('name' => 'rtp-timeout-sec', 'size' => '20', 'value' => '60', 'class' => "text field medium"), '', 'tOOL TIP', ''),
322 322
 			array('dtmf-duration', 'INPUT', array('name' => 'dtmf-duration', 'size' => '20', 'value' => '2000', 'class' => "text field medium"), '', 'tOOL TIP', ''),
323
-			array('manual-redirect','manual-redirect', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'),
323
+			array('manual-redirect', 'manual-redirect', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'),
324 324
 			array('aggressive-nat-detection', 'aggressive-nat-detection', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'),
325 325
 			array('enable-Timer', 'enable-timer', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'),
326 326
 			array('minimum-session-expires', 'INPUT', array('name' => 'minimum-session-expires', 'value' => '120', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
327 327
 			array('session-timeout', 'INPUT', array('name' => 'session-timeout-pt', 'value' => '1800', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
328 328
 			array('auth-calls', 'auth-calls', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_option'),
329
-			array('apply-inbound-acl', 'INPUT', array('name' => 'apply-inbound-acl', 'value' => 'default', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
330
-			array('inbound-codec-prefs', 'INPUT', array('name' => 'inbound-codec-prefs', 'size' => '25',  'class' => "text field medium"), '', 'tOOL TIP', ''),
329
+			array('apply-inbound-acl', 'INPUT', array('name' => 'apply-inbound-acl', 'value' => 'default', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
330
+			array('inbound-codec-prefs', 'INPUT', array('name' => 'inbound-codec-prefs', 'size' => '25', 'class' => "text field medium"), '', 'tOOL TIP', ''),
331 331
 			array('outbound-codec-prefs', 'INPUT', array('name' => 'outbound-codec-prefs', 'size' => '25', 'class' => "text field medium"), '', 'tOOL TIP', ''),
332 332
 			array('inbound-late-negotiation', 'inbound-late-negotiation', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_sip_config_options'),
333 333
 			array('inbound-codec-negotiation', 'INPUT', array('name' => 'inbound-codec-negotiation', 'size' => '25', 'class' => "text field medium"), '', 'tOOL TIP', ''),
334 334
 		);
335 335
 		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
336
-		$form['button_save'] = array('content' => 'Save', 'value' => 'save', 'type' => 'button','id'=>'submit', 'class' => 'btn btn-line-parrot');
336
+		$form['button_save'] = array('content' => 'Save', 'value' => 'save', 'type' => 'button', 'id'=>'submit', 'class' => 'btn btn-line-parrot');
337 337
 
338 338
 		return $form;
339 339
 	}
@@ -341,22 +341,22 @@  discard block
 block discarded – undo
341 341
 	function build_fssipprofile_list_for_admin() {
342 342
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
343 343
 		$grid_field_arr = json_encode(array(
344
-		array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
344
+		array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
345 345
 /**
346 346
 ASTPP  3.0
347 347
 For Sip Profile edit on Profile name
348 348
 **/
349
-			array("Name", "190", "name", "", "", "","EDITABLE","true","center"),
349
+			array("Name", "190", "name", "", "", "", "EDITABLE", "true", "center"),
350 350
 /************************************/
351
-			array("SIP IP", "205", "sip_ip", "", "", "","","true","center"),
352
-			array("SIP Port", "200", "sip_port", "", "", "","","true","center"),
351
+			array("SIP IP", "205", "sip_ip", "", "", "", "", "true", "center"),
352
+			array("SIP Port", "200", "sip_port", "", "", "", "", "true", "center"),
353 353
 		   /*
354 354
             ASTPP  3.0 
355 355
             status show active or inactive
356 356
             */
357
-			array("Status", "160", "status", "status", "sip_profiles", "get_status","","true","center"),
357
+			array("Status", "160", "status", "status", "sip_profiles", "get_status", "", "true", "center"),
358 358
 		   /*******************************************************/
359
-			 array("Profile Action", "282", "", "", "", array("START" => array("url" => "/freeswitch/fssipprofile_action/start/","mode"=>"single"),
359
+			 array("Profile Action", "282", "", "", "", array("START" => array("url" => "/freeswitch/fssipprofile_action/start/", "mode"=>"single"),
360 360
 					"STOP" => array("url" => "/freeswitch/fssipprofile_action/stop/", "mode" => "single"),
361 361
 					"RELOAD" => array("url" => "/freeswitch/fssipprofile_action/reload/", "mode" => "single"),
362 362
 					"RESCAN" => array("url" => "/freeswitch/fssipprofile_action/rescan/", "mode" => "single"),                    
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
 	}
370 370
 
371 371
 	function build_fssipprofile_grid_buttons() {
372
-		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fssipprofile_add/",""),
373
-		array("Delete","btn btn-line-danger","fa fa-times-circle fa-lg","button_action", "/freeswitch/fssipprofile_delete_multiple/")
372
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fssipprofile_add/", ""),
373
+		array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/freeswitch/fssipprofile_delete_multiple/")
374 374
 		   ));
375 375
 		return $buttons_json;
376 376
 	}
@@ -392,15 +392,15 @@  discard block
 block discarded – undo
392 392
 	function build_fsserver_list() {
393 393
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
394 394
 		$grid_field_arr = json_encode(array(
395
-			array("Host", "200", "freeswitch_host", "", "", "","","true","center"),
396
-			array(" Password", "200", "freeswitch_password", "", "", "","","true","center"),
397
-			array(" Port", "200", "freeswitch_port", "", "", "","","true","center"),
395
+			array("Host", "200", "freeswitch_host", "", "", "", "", "true", "center"),
396
+			array(" Password", "200", "freeswitch_password", "", "", "", "", "true", "center"),
397
+			array(" Port", "200", "freeswitch_port", "", "", "", "", "true", "center"),
398 398
 			/*
399 399
             ASTPP  3.0 .3 creation field show in grid
400 400
             */
401
-			array("Status", "145", "status", "status", "freeswich_servers", "get_status","","true","center"),
402
-			array("Created Date", "170", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
403
-			 array("Modified Date", "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
401
+			array("Status", "145", "status", "status", "freeswich_servers", "get_status", "", "true", "center"),
402
+			array("Created Date", "170", "creation_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"),
403
+			 array("Modified Date", "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
404 404
 			/********************************************************************/
405 405
            
406 406
 			array("Action", "182", "", "", "", array("EDIT" => array("url" => "/freeswitch/fsserver_edit/", "mode" => "popup"),
@@ -411,19 +411,19 @@  discard block
 block discarded – undo
411 411
 	/**************************************************/
412 412
 
413 413
 	function build_fsserver_grid_buttons() {
414
-		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fsserver_add/", "popup"),
414
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/freeswitch/fsserver_add/", "popup"),
415 415
 //array("Delete",  "btn btn-line-danger","fa fa-times-circle fa-lg",  "button_action", "/freeswitch/fssipdevices_delete_multiple/")
416 416
 			));
417 417
 		return $buttons_json;
418 418
 	}
419 419
 
420 420
 	function get_form_fsserver_fields() {
421
-		$form['forms'] = array(base_url() . '/freeswitch/fsserver_save/', array("id" => "fsserver_form", "name" => "fsserver_form"));
421
+		$form['forms'] = array(base_url().'/freeswitch/fsserver_save/', array("id" => "fsserver_form", "name" => "fsserver_form"));
422 422
 		$form['Freeswitch Server Information'] = array(
423 423
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
424 424
 			array(' Host', 'INPUT', array('name' => 'freeswitch_host', 'size' => '20', 'class' => "text field medium"), 'trim|required|valid_ip', 'tOOL TIP', 'Please Enter account number'),
425
-			array(' Password', 'INPUT', array('name' => 'freeswitch_password', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
426
-			array(' Port', 'INPUT', array('name' => 'freeswitch_port', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric', 'tOOL TIP', 'Please Enter account number'),
425
+			array(' Password', 'INPUT', array('name' => 'freeswitch_password', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
426
+			array(' Port', 'INPUT', array('name' => 'freeswitch_port', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric', 'tOOL TIP', 'Please Enter account number'),
427 427
 		);
428 428
 
429 429
 		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
@@ -452,17 +452,17 @@  discard block
 block discarded – undo
452 452
 	*/
453 453
 	function build_devices_list_for_customer() {
454 454
 		$grid_field_arr = json_encode(array(
455
-			array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
456
-			array("User Name", "100", "username", "", "", "","","true","center"),
457
-			array("Password", "100", "password", "", "", "","","true","center"),
458
-			array("SIP Profile", "90", "sip_profile_id", "name", "sip_profiles", "get_field_name","","true","center"),
459
-			array("Caller Name", "100", "effective_caller_id_name", "", "", "","","true","center"),
460
-			array("Caller Number", "100", "effective_caller_id_number", "", "", "","","true","center"),
461
-			array("Voicemail", "100", "voicemail_enabled", "", "", "","","true","center"),
455
+			array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
456
+			array("User Name", "100", "username", "", "", "", "", "true", "center"),
457
+			array("Password", "100", "password", "", "", "", "", "true", "center"),
458
+			array("SIP Profile", "90", "sip_profile_id", "name", "sip_profiles", "get_field_name", "", "true", "center"),
459
+			array("Caller Name", "100", "effective_caller_id_name", "", "", "", "", "true", "center"),
460
+			array("Caller Number", "100", "effective_caller_id_number", "", "", "", "", "true", "center"),
461
+			array("Voicemail", "100", "voicemail_enabled", "", "", "", "", "true", "center"),
462 462
 			//array("Call Waiting", "105", "call_waiting", "", "", ""),
463
-			array("Status", "100", "status", "", "", "","","true","center"),
464
-			array("Created Date", "100", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
465
-			array("Modified Date", "100", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
463
+			array("Status", "100", "status", "", "", "", "", "true", "center"),
464
+			array("Created Date", "100", "creation_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"),
465
+			array("Modified Date", "100", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
466 466
 			array("Action", "110", "", "", "", array("EDIT" => array("url" => "/accounts/fssipdevices_action/edit/", "mode" => "single"),
467 467
 					"DELETE" => array("url" => "/accounts/fssipdevices_action/delete/", "mode" => "single")))
468 468
 				));
@@ -471,21 +471,21 @@  discard block
 block discarded – undo
471 471
     
472 472
 	/******************8*/
473 473
 
474
-	function fsdevice_form_fields_for_customer($accountid , $id=false) {
474
+	function fsdevice_form_fields_for_customer($accountid, $id = false) {
475 475
     
476 476
 	// $val = $id > 0 ? 'sip_devices.username.' . $id : 'sip_devices.username';
477
-	$val=$id > 0 ? 'sip_devices.username.'.$id : 'sip_devices.username';   
477
+	$val = $id > 0 ? 'sip_devices.username.'.$id : 'sip_devices.username';   
478 478
 		$uname_user = $this->CI->common->find_uniq_rendno('10', '', '');
479 479
 		$password = $this->CI->common->generate_password();
480
-		if ($this->CI->session->userdata("logintype") == '0'  || $this->CI->session->userdata("logintype") == '3') {
481
-			$link = base_url() . 'freeswitch/user_fssipdevices_save/true';
480
+		if ($this->CI->session->userdata("logintype") == '0' || $this->CI->session->userdata("logintype") == '3') {
481
+			$link = base_url().'freeswitch/user_fssipdevices_save/true';
482 482
 			$form['forms'] = array($link, array("id" => "sipdevices_form", "name" => "sipdevices_form"));
483 483
 			$form['Device Information'] = array(
484 484
 				array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
485 485
 				array('', 'HIDDEN', array('name' => 'accountcode', 'value' => $accountid), '', '', '', ''),
486
-				array('Username', 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user,'id'=>'username', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number','<i style="cursor:pointer;color:#1BCB61 !important;font-size:14px; padding-left:5px; padding-top:8px; float:left; " title="Reset Password" class="change_number fa fa-refresh"></i>'),
487
-				array('Password', 'INPUT', array('name' => 'fs_password', 'size' => '20','id'=>'password1','value'=>$password, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password','<i style="cursor:pointer;color:#1BCB61 !important;  font-size:14px;    padding-left:5px;    padding-top:8px;    float:left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'),
488
-				array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
486
+				array('Username', 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user, 'id'=>'username', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number', '<i style="cursor:pointer;color:#1BCB61 !important;font-size:14px; padding-left:5px; padding-top:8px; float:left; " title="Reset Password" class="change_number fa fa-refresh"></i>'),
487
+				array('Password', 'INPUT', array('name' => 'fs_password', 'size' => '20', 'id'=>'password1', 'value'=>$password, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password', '<i style="cursor:pointer;color:#1BCB61 !important;  font-size:14px;    padding-left:5px;    padding-top:8px;    float:left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'),
488
+				array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
489 489
 				array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
490 490
 				//array('Call Waiting', 'call_waiting', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_call_waiting'),
491 491
 				array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
@@ -510,25 +510,25 @@  discard block
 block discarded – undo
510 510
 		);   
511 511
 /*******************/           
512 512
 		} else {
513
-			 if($accountid){
514
-				$account_Arr=null;
515
-		 }else{
516
-				$account_Arr=array('Account', 'accountcode', 'SELECT', '','trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0"));
513
+			 if ($accountid) {
514
+				$account_Arr = null;
515
+		 } else {
516
+				$account_Arr = array('Account', 'accountcode', 'SELECT', '', 'trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0", "type"=>"0", "deleted" => "0"));
517 517
 		 }       
518 518
 			if ($this->CI->session->userdata("logintype") == '1') {
519
-		$sip_pro =null;
520
-				$link = base_url() . 'freeswitch/customer_fssipdevices_save/true';
521
-			}else{
522
-		$sip_pro =array('SIP Profile', 'sip_profile_id', 'SELECT', '','trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', '', '');
523
-				$link = base_url() . 'freeswitch/fssipdevices_save/true';
519
+		$sip_pro = null;
520
+				$link = base_url().'freeswitch/customer_fssipdevices_save/true';
521
+			} else {
522
+		$sip_pro = array('SIP Profile', 'sip_profile_id', 'SELECT', '', 'trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', '', '');
523
+				$link = base_url().'freeswitch/fssipdevices_save/true';
524 524
 			}
525 525
 			$form['forms'] = array($link, array("id" => "sipdevices_form", "name" => "sipdevices_form"));
526 526
 			/*Add sipdevice*/
527 527
 			$form['Device Information'] = array(
528 528
 				array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
529 529
 				array('', 'HIDDEN', array('name' => 'accountcode', 'value' => $accountid), '', '', '', ''),
530
-				 array('Username', 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user,'id'=>'username1', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number','<i style="cursor:pointer; color:#1BCB61; font-size:14px; padding-left:5px;  padding-top:8px; float:left;" title="Reset Password" class="change_number fa fa-refresh"></i>'),
531
-			 array('Password', 'INPUT', array('name' => 'fs_password', 'size' => '20', 'id'=>'password1','value'=>$password, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password','<i style="cursor:pointer; color:#1BCB61; font-size:14px; padding-left:5px;padding-top:8px; float:left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'),
530
+				 array('Username', 'INPUT', array('name' => 'fs_username', 'size' => '20', 'value'=>$uname_user, 'id'=>'username1', 'class' => "text field medium"), 'trim|required|is_unique['.$val.']|xss_clean', 'tOOL TIP', 'Please Enter account number', '<i style="cursor:pointer; color:#1BCB61; font-size:14px; padding-left:5px;  padding-top:8px; float:left;" title="Reset Password" class="change_number fa fa-refresh"></i>'),
531
+			 array('Password', 'INPUT', array('name' => 'fs_password', 'size' => '20', 'id'=>'password1', 'value'=>$password, 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter Password', '<i style="cursor:pointer; color:#1BCB61; font-size:14px; padding-left:5px;padding-top:8px; float:left;" title="Reset Password" class="change_pass fa fa-refresh"></i>'),
532 532
 				array('Caller Name', 'INPUT', array('name' => 'effective_caller_id_name', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
533 533
 				array('Caller Number', 'INPUT', array('name' => 'effective_caller_id_number', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
534 534
 		$account_Arr,
Please login to merge, or discard this patch.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 23
 ###############################################################################
24 24
 
25
-if (!defined('BASEPATH'))
26
-	exit('No direct script access allowed');
25
+if (!defined('BASEPATH')) {
26
+	exit('No direct script access allowed');
27
+}
27 28
 
28 29
 class Freeswitch_form {
29 30
 
@@ -35,8 +36,7 @@  discard block
 block discarded – undo
35 36
 	$log_type = $this->CI->session->userdata("logintype");
36 37
 	if($log_type == 0  || $log_type == 3 || $log_type == 1){
37 38
 		  $sip_pro=null;
38
-	}
39
-	else{
39
+	} else{
40 40
 		  $sip_pro=array('SIP Profile', 'sip_profile_id', 'SELECT', '', 'trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', '', '');
41 41
 
42 42
 	}  
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
 		} else {
513 513
 			 if($accountid){
514 514
 				$account_Arr=null;
515
-		 }else{
515
+		 } else{
516 516
 				$account_Arr=array('Account', 'accountcode', 'SELECT', '','trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'first_name,last_name,number', 'accounts', 'build_concat_dropdown', 'where_arr', array("reseller_id" => "0","type"=>"0", "deleted" => "0"));
517 517
 		 }       
518 518
 			if ($this->CI->session->userdata("logintype") == '1') {
519 519
 		$sip_pro =null;
520 520
 				$link = base_url() . 'freeswitch/customer_fssipdevices_save/true';
521
-			}else{
521
+			} else{
522 522
 		$sip_pro =array('SIP Profile', 'sip_profile_id', 'SELECT', '','trim|dropdown|xss_clean', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'sip_profiles', 'build_dropdown', '', '');
523 523
 				$link = base_url() . 'freeswitch/fssipdevices_save/true';
524 524
 			}
Please login to merge, or discard this patch.
astpp/application/modules/freeswitch/views/view_fssipprofile_edit.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -191,11 +191,11 @@
 block discarded – undo
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?>' />
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -119,7 +119,8 @@  discard block
 block discarded – undo
119 119
 			<div style="width:550px;"><label style="text-align:right;" class="col-md-3">Status </label>
120 120
 			<select name="sipstatus" class="col-md-5 form-control selectpicker" data-live-search='true'>
121 121
 			    
122
-			    <option value="0" <?if ($status == 0)echo 'selected=selected;'?>>Active</option>
122
+			    <option value="0" <?if ($status == 0) {
123
+	echo 'selected=selected;'?>>Active</option>
123 124
 			    <option value="1" <?if ($status == 1)echo 'selected=selected;'?>>Inactive</option>
124 125
 			  </select>
125 126
                        </div>
@@ -146,7 +147,8 @@  discard block
 block discarded – undo
146 147
     	<div class="container">
147 148
    	    <div class="row">
148 149
             	<div class="portlet-content"  id="search_bar" style="cursor:pointer; display:none">
149
-                    	<?php echo $form_search;
150
+                    	<?php echo $form_search;
151
+}
150 152
 
151 153
 ?>
152 154
     	        </div>
@@ -194,7 +196,7 @@  discard block
 block discarded – undo
194 196
 			  if($params_name!='')
195 197
 			  {
196 198
 				$type="edit_setting";
197
-			  }else{
199
+			  } else{
198 200
 				$type="add_setting";
199 201
 			  }
200 202
 			?>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/accounts/models/accounts_model.php 2 patches
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
Braces   +36 added lines, -30 removed lines patch added patch discarded remove patch
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
         }*/
54 54
 		if(isset($accountinfo['local_call'])){
55 55
 	  $accountinfo['local_call']=0;
56
-		}else{
56
+		} else{
57 57
 	  $accountinfo['local_call']=1;
58 58
 		}
59 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']);
@@ -300,17 +300,17 @@  discard block
 block discarded – undo
300 300
 		);
301 301
 		if(isset($add_array['is_recording']) &&  $add_array['is_recording'] != ''){
302 302
 		$is_recording=1;
303
-		}else{
303
+		} else{
304 304
 		$is_recording=0;
305 305
 		}
306 306
 		if(isset($add_array['allow_ip_management']) &&  $add_array['allow_ip_management'] != ''){
307 307
 		$allow_ip_management=1;
308
-		}else{
308
+		} else{
309 309
 		$allow_ip_management=0;
310 310
 		}
311 311
 		if(isset($add_array['local_call']) &&  $add_array['local_call'] != ''){
312 312
 		$local_call=1;
313
-		}else{
313
+		} else{
314 314
 		$local_call=0;
315 315
 		}
316 316
 		if ($sip_flag) {
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 		  $current_id=$accountinfo['type'] ==1 ? $accountinfo['id'] : '0';
479 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
 		}
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 		}
507 507
 		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
508 508
 		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
509
-		}else{
509
+		} else{
510 510
 			$this->db->order_by('number','desc');
511 511
 		}
512 512
 		$result = $this->db->get('accounts');
@@ -535,12 +535,13 @@  discard block
 block discarded – undo
535 535
 			$this->db->where($type);
536 536
 		}
537 537
 		if ($flag) {
538
-			if (!$export)
539
-				$this->db->limit($limit, $start);
538
+			if (!$export) {
539
+							$this->db->limit($limit, $start);
540
+			}
540 541
 		}
541 542
 		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
542 543
 		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
543
-		}else{
544
+		} else{
544 545
 			$this->db->order_by('number','desc');
545 546
 		}
546 547
 		$result = $this->db->get('accounts');
@@ -614,10 +615,11 @@  discard block
 block discarded – undo
614 615
 
615 616
 	function get_account_number($accountid) {
616 617
 		$query = $this->db_model->getSelect("number", "accounts", array("id" => $accountid));
617
-		if ($query->num_rows() > 0)
618
-			return $query->row_array();
619
-		else
620
-			return false;
618
+		if ($query->num_rows() > 0) {
619
+					return $query->row_array();
620
+		} else {
621
+					return false;
622
+		}
621 623
 	}
622 624
 
623 625
 	function add_callerid($data) {
@@ -662,10 +664,11 @@  discard block
 block discarded – undo
662 664
 	function get_accounttax_by_id($account_id) {
663 665
 		$this->db->where("accountid", trim($account_id));
664 666
 		$query = $this->db->get("taxes_to_accounts");
665
-		if ($query->num_rows() > 0)
666
-			return $query->result_array();
667
-		else
668
-			return false;
667
+		if ($query->num_rows() > 0) {
668
+					return $query->result_array();
669
+		} else {
670
+					return false;
671
+		}
669 672
 	}
670 673
 
671 674
 	/**
@@ -678,29 +681,32 @@  discard block
 block discarded – undo
678 681
 		$this->db->where("number", $acc_num);
679 682
 		$query = $this->db->get("accounts");
680 683
 
681
-		if ($query->num_rows() > 0)
682
-			return $query->row_array();
683
-		else
684
-			return false;
684
+		if ($query->num_rows() > 0) {
685
+					return $query->row_array();
686
+		} else {
687
+					return false;
688
+		}
685 689
 	}
686 690
 
687 691
 	function get_account_by_number($id) {
688 692
 		$this->db->where("id", $id);
689 693
 		$query = $this->db->get("accounts");
690 694
 
691
-		if ($query->num_rows() > 0)
692
-			return $query->row_array();
693
-		else
694
-			return false;
695
+		if ($query->num_rows() > 0) {
696
+					return $query->row_array();
697
+		} else {
698
+					return false;
699
+		}
695 700
 	}
696 701
 
697 702
 	function get_currency_by_id($currency_id) {
698 703
 
699 704
 		$query = $this->db_model->getSelect("*", 'currency', array('id' => $currency_id));
700
-		if ($query->num_rows() > 0)
701
-			return $query->row_array();
702
-		else
703
-			return false;
705
+		if ($query->num_rows() > 0) {
706
+					return $query->row_array();
707
+		} else {
708
+					return false;
709
+		}
704 710
 	}
705 711
 
706 712
 
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/accounts/controllers/accounts.php 3 patches
Braces   +27 added lines, -20 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
 		$this->load->model('accounts_model');
38 38
 		$this->load->model('Astpp_common');
39 39
 		$this->protected_pages = array('account_list');
40
-		if ($this->session->userdata('user_login') == FALSE)
41
-			redirect(base_url() . '/login/login');
40
+		if ($this->session->userdata('user_login') == FALSE) {
41
+					redirect(base_url() . '/login/login');
42
+		}
42 43
 	}
43 44
 
44 45
 	function customer_list() {
@@ -377,13 +378,15 @@  discard block
 block discarded – undo
377 378
 		$where = array("accountid" => $accountid);
378 379
 		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_ipmap');
379 380
 		$like_str=!empty($instant_search) ? "(name like '%$instant_search%'  OR ip like '%$instant_search%' OR prefix like '%$instant_search%' OR created_date like '%$instant_search%' )" :null;
380
-		if(!empty($like_str))
381
-		$this->db->where($like_str);
381
+		if(!empty($like_str)) {
382
+				$this->db->where($like_str);
383
+		}
382 384
 		$count_all = $this->db_model->countQuery("*", "ip_map", $where);
383 385
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
384 386
 		$json_data = $paging_data["json_paging"];
385
-		if(!empty($like_str))
386
-		$this->db->where($like_str);
387
+		if(!empty($like_str)) {
388
+				$this->db->where($like_str);
389
+		}
387 390
 		$query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
388 391
 		$grid_fields = json_decode($this->accounts_form->build_ip_list_for_customer($accountid, $accounttype));
389 392
 		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
@@ -472,15 +475,17 @@  discard block
 block discarded – undo
472 475
 		$json_data = array();
473 476
 		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_animap'); 
474 477
 		$like_str=!empty($instant_search) ? "(number like '%$instant_search%'  OR  creation_date like '%$instant_search%' )" :null;
475
-		if(!empty($like_str))
476
-		$this->db->where($like_str);
478
+		if(!empty($like_str)) {
479
+				$this->db->where($like_str);
480
+		}
477 481
 		$where = array("accountid" => $accountid);
478 482
 		$count_all = $this->db_model->countQuery("*", "ani_map", $where);
479 483
 
480 484
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
481 485
 		$json_data = $paging_data["json_paging"];
482
-		if(!empty($like_str))
483
-		$this->db->where($like_str);
486
+		if(!empty($like_str)) {
487
+				$this->db->where($like_str);
488
+		}
484 489
 		$query = $this->db_model->select("*", "ani_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
485 490
 
486 491
 		$grid_fields = json_decode($this->accounts_form->build_animap_list_for_customer($accountid, $accounttype));
@@ -1043,7 +1048,7 @@  discard block
 block discarded – undo
1043 1048
 			$data['edit_id'] = $edit_id;
1044 1049
 			$data['accounttype'] = $accounttype;
1045 1050
 			$this->load->view('view_reseller_package_list', $data);
1046
-	   }else {
1051
+	   } else {
1047 1052
 			redirect(base_url() . 'accounts/reseller_list/');
1048 1053
 			exit;
1049 1054
 	   }
@@ -1321,14 +1326,14 @@  discard block
 block discarded – undo
1321 1326
 			$accountinfo = $this->accounts_model->get_account_by_number($post_array['id']);
1322 1327
 			if($accountinfo['reseller_id'] == 0){
1323 1328
 			   $where = array("accountid"=> 1);
1324
-		}else{
1329
+		} else{
1325 1330
 			$where = array("accountid"=> $accountinfo['id']);    
1326 1331
 		}
1327 1332
 		$query = $this->db_model->getSelect("*", "invoice_conf", $where);
1328 1333
 		if($query->num_rows >0){
1329 1334
 			$invoice_conf = $query->result_array();
1330 1335
 			$invoice_conf = $invoice_conf[0];
1331
-		}else{
1336
+		} else{
1332 1337
 			$query = $this->db_model->getSelect("*", "invoice_conf",array("accountid"=> 1));
1333 1338
 			$invoice_conf = $query->result_array();
1334 1339
 			$invoice_conf = $invoice_conf[0];            
@@ -1355,7 +1360,7 @@  discard block
 block discarded – undo
1355 1360
 					  'after_balance'=>$account_balance,
1356 1361
 					);
1357 1362
 			$this->db->insert("invoice_details", $insert_arr);
1358
-				}else{
1363
+				} else{
1359 1364
 			$this->load->module('invoices/invoices');
1360 1365
 			$invoice_id=$this->invoices->invoices->generate_receipt($post_array['id'],$post_array['credit'],$accountinfo,$last_invoice_ID+1,$invoice_prefix,$due_date);
1361 1366
 			$account_balance = $this->common->get_field_name('balance', 'accounts', $post_array['id']);
@@ -1788,8 +1793,9 @@  discard block
 block discarded – undo
1788 1793
 		$json_data['total'] = $config['total_rows'];
1789 1794
 		$perpage = $config['per_page'];
1790 1795
 		$start = ($page_no - 1) * $perpage;
1791
-		if ($start < 0)
1792
-			$start = 0;
1796
+		if ($start < 0) {
1797
+					$start = 0;
1798
+		}
1793 1799
 
1794 1800
 		$account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $perpage, $start, $order_by, $order_type, "");
1795 1801
 		if ($account_charge_list->num_rows > 0) {
@@ -2132,8 +2138,9 @@  discard block
 block discarded – undo
2132 2138
 		$data['username'] = $this->session->userdata('user_name');
2133 2139
 		$data['page_title'] = 'Account Taxes';
2134 2140
 
2135
-		if ($action == false)
2136
-			$action = "list";
2141
+		if ($action == false) {
2142
+					$action = "list";
2143
+		}
2137 2144
 
2138 2145
 		if ($action == 'list') {
2139 2146
 			$this->load->view('view_account_taxes_list', $data);
@@ -2397,10 +2404,10 @@  discard block
 block discarded – undo
2397 2404
 	   $ip_map_result=(array)$this->db->get('ip_map')->first_row();
2398 2405
 	   if($ip_map_result['count'] > 0 ){
2399 2406
 		 echo 'FALSE';
2400
-	   }else{
2407
+	   } else{
2401 2408
 		 echo 'TRUE';
2402 2409
 	   }
2403
-	 }else{
2410
+	 } else{
2404 2411
 	  echo 'FALSE';
2405 2412
 	 }
2406 2413
     
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -209,24 +209,24 @@  discard block
 block discarded – undo
209 209
 		}
210 210
 	}
211 211
 
212
-    function customer_save($add_array = false) {
213
-        $add_array = $this->input->post();
214
-        $entity_name = strtolower($this->common->get_entity_type('', '', $add_array['type']));
215
-        $data['country_id'] = isset($add_array['country_id'])? $add_array['country_id']:'';
216
-        $data['timezone_id'] = isset($add_array['timezone_id']) ? $add_array['timezone_id']:'';
217
-        $data['currency_id'] = isset($add_array['currency_id']) ? $add_array['currency_id']:'';
218
-        $data['entity_name'] = $entity_name;
219
-        $data['callingcard'] = Common_model::$global_config['system_config']['pinlength'];
220
-        $data['edit_id']=$add_array['id'];
221
-        $data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $add_array['id']), $add_array);
222
-        if ($add_array['id'] != '') {
223
-            $data['page_title'] = 'Edit ' . $this->common->get_entity_type('', '', $add_array['type']);
224
-            if ($this->form_validation->run() == FALSE) {
225
-                $data['validation_errors'] = validation_errors();
226
-            } else {
227
-                  ASTPP  3.0 
228
-                  Password encode
229
-                 * **** */
212
+	function customer_save($add_array = false) {
213
+		$add_array = $this->input->post();
214
+		$entity_name = strtolower($this->common->get_entity_type('', '', $add_array['type']));
215
+		$data['country_id'] = isset($add_array['country_id'])? $add_array['country_id']:'';
216
+		$data['timezone_id'] = isset($add_array['timezone_id']) ? $add_array['timezone_id']:'';
217
+		$data['currency_id'] = isset($add_array['currency_id']) ? $add_array['currency_id']:'';
218
+		$data['entity_name'] = $entity_name;
219
+		$data['callingcard'] = Common_model::$global_config['system_config']['pinlength'];
220
+		$data['edit_id']=$add_array['id'];
221
+		$data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $add_array['id']), $add_array);
222
+		if ($add_array['id'] != '') {
223
+			$data['page_title'] = 'Edit ' . $this->common->get_entity_type('', '', $add_array['type']);
224
+			if ($this->form_validation->run() == FALSE) {
225
+				$data['validation_errors'] = validation_errors();
226
+			} else {
227
+				  ASTPP  3.0 
228
+				  Password encode
229
+				 * **** */
230 230
 				$add_array['password'] = $this->common->encode($add_array['password']);
231 231
 				/*                 * ****************** */
232 232
 				$add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false);
@@ -1385,35 +1385,35 @@  discard block
 block discarded – undo
1385 1385
 			  $invoice_id=$this->invoices->invoices->generate_receipt($reseller_info['id'],$custom_array['credit'],$reseller_info,$last_invoice_ID+1,$invoice_prefix,$due_date);
1386 1386
 			  $account_balance = $this->common->get_field_name('balance', 'accounts', $reseller_info['id']);
1387 1387
 			  $insert_arr = array("accountid" => $reseller_info['id'],
1388
-				      "description" => trim($custom_array['notes']),
1389
-				      "debit" => 0,
1390
-				      "credit" => $custom_array['credit'],
1391
-				      "created_date" => gmdate("Y-m-d H:i:s"), 
1392
-				      "invoiceid"=>$invoice_id,
1393
-				      "reseller_id"=>$reseller_info['reseller_id'],
1394
-				      "item_type"=>'Refill',
1395
-				      "item_id"=>'0',
1396
-  				      'before_balance'=>$account_balance - $custom_array['credit'],
1397
-				      'after_balance'=>$account_balance,
1398
-				    );
1399
-			    $this->db->insert("invoice_details", $insert_arr);
1388
+					  "description" => trim($custom_array['notes']),
1389
+					  "debit" => 0,
1390
+					  "credit" => $custom_array['credit'],
1391
+					  "created_date" => gmdate("Y-m-d H:i:s"), 
1392
+					  "invoiceid"=>$invoice_id,
1393
+					  "reseller_id"=>$reseller_info['reseller_id'],
1394
+					  "item_type"=>'Refill',
1395
+					  "item_id"=>'0',
1396
+  					  'before_balance'=>$account_balance - $custom_array['credit'],
1397
+					  'after_balance'=>$account_balance,
1398
+					);
1399
+				$this->db->insert("invoice_details", $insert_arr);
1400
+			}
1401
+			  }
1400 1402
 			}
1401
-		      }
1402
-		    }
1403 1403
 		}
1404
-	        $message = $post_array['payment_type'] == 0 ? "Recharge successfully!" : "Post charge applied successfully.";
1404
+			$message = $post_array['payment_type'] == 0 ? "Recharge successfully!" : "Post charge applied successfully.";
1405 1405
 /***********************************************************************************************/
1406
-                echo json_encode(array("SUCCESS"=> $message));
1407
-                exit;
1408
-        //    }
1409
-        }
1410
-        $this->load->view('view_accounts_process_payment', $data);
1411
-    }
1412
-
1413
-    /**
1414
-     * @param string $select
1415
-     */
1416
-    function get_invoice_date($select,$accountid){
1406
+				echo json_encode(array("SUCCESS"=> $message));
1407
+				exit;
1408
+		//    }
1409
+		}
1410
+		$this->load->view('view_accounts_process_payment', $data);
1411
+	}
1412
+
1413
+	/**
1414
+	 * @param string $select
1415
+	 */
1416
+	function get_invoice_date($select,$accountid){
1417 1417
 	$query = $this->db_model->select($select, "invoices", '',"id","DESC","1","0");
1418 1418
 	if($query->num_rows >0){
1419 1419
 		$invoiceid = $query->result_array();
Please login to merge, or discard this patch.
Spacing   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$this->load->model('Astpp_common');
39 39
 		$this->protected_pages = array('account_list');
40 40
 		if ($this->session->userdata('user_login') == FALSE)
41
-			redirect(base_url() . '/login/login');
41
+			redirect(base_url().'/login/login');
42 42
 	}
43 43
 
44 44
 	function customer_list() {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			$this->session->set_userdata('customer_list_search', $action);
98 98
 		}
99 99
 		if (@$ajax_search != 1) {
100
-			redirect(base_url() . 'accounts/customer_list/');
100
+			redirect(base_url().'accounts/customer_list/');
101 101
 		}
102 102
 	}
103 103
 
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 
109 109
 	function customer_export_cdr_xls() {
110 110
 	$account_info = $accountinfo = $this->session->userdata('accountinfo');
111
-	$currency_id=$account_info['currency_id'];
112
-	 $currency=$this->common->get_field_name('currency', 'currency', $currency_id);
111
+	$currency_id = $account_info['currency_id'];
112
+	 $currency = $this->common->get_field_name('currency', 'currency', $currency_id);
113 113
 		$query = $this->accounts_model->get_customer_Account_list(true, '', '', true);
114 114
 		ob_clean();
115
-		$customer_array[] = array("Account", "First Name", "Last Name", "Company", "Rate Group ", "Balance ($currency)", "Credit Limit ($currency)", "First Used", "Expiry Date","CC","Status","Created Date");
115
+		$customer_array[] = array("Account", "First Name", "Last Name", "Company", "Rate Group ", "Balance ($currency)", "Credit Limit ($currency)", "First Used", "Expiry Date", "CC", "Status", "Created Date");
116 116
 		if ($query->num_rows() > 0) {
117 117
 
118 118
 			foreach ($query->result_array() as $row) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 			}
134 134
 		}
135 135
 		$this->load->helper('csv');
136
-		array_to_csv($customer_array, 'Customers_' . date("Y-m-d") . '.csv');
136
+		array_to_csv($customer_array, 'Customers_'.date("Y-m-d").'.csv');
137 137
 	}
138 138
 
139 139
 	function provider_add() {
@@ -154,20 +154,20 @@  discard block
 block discarded – undo
154 154
 		$entity_type = strtolower($this->common->get_entity_type('', '', $type));
155 155
 		$data['username'] = $this->session->userdata('user_name');
156 156
 		$data['flag'] = 'create';
157
-		$data['page_title'] = 'Create ' . $entity_type;
157
+		$data['page_title'] = 'Create '.$entity_type;
158 158
 		$data['back_flag'] = true;
159 159
 		$data['country_id'] = $accountinfo['country_id'];
160 160
 		$data['callingcard'] = Common_model::$global_config['system_config']['pinlength'];
161 161
 		$data['currency_id'] = $accountinfo['currency_id'];
162 162
 		$data['timezone_id'] = $accountinfo['timezone_id'];
163 163
 		$data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_type), '');
164
-		if (!$data['timezone_id']) {
164
+		if ( ! $data['timezone_id']) {
165 165
 			$data['timezone_id'] = 1;
166 166
 		}
167
-		if (!$data['currency_id']) {
167
+		if ( ! $data['currency_id']) {
168 168
 			$data['currency_id'] = 1;
169 169
 		}
170
-		if (!$data['country_id']) {
170
+		if ( ! $data['country_id']) {
171 171
 			$data['country_id'] = 1;
172 172
 		}
173 173
 		$data['entity_name'] = $entity_type;
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
183 183
 		$account = $this->db_model->getSelect("*", "accounts", $where);
184 184
 		if ($account->num_rows > 0) {
185
-			$account_data = (array) $account->first_row();
185
+			$account_data = (array)$account->first_row();
186 186
 			$entity_name = strtolower($this->common->get_entity_type('', '', $account_data['type']));
187
-			$data['page_title'] =ucfirst($entity_name) . " Profile";
187
+			$data['page_title'] = ucfirst($entity_name)." Profile";
188 188
 			$data['invoice_date'] = $account_data['invoice_day'];
189 189
 			$data["account_data"] = $account_data;
190 190
 			 $data['callingcard'] = Common_model::$global_config['system_config']['pinlength'];
@@ -202,31 +202,31 @@  discard block
 block discarded – undo
202 202
 			$account_data['password'] = $this->common->decode($account_data['password']);
203 203
 			/*             * ********************** */
204 204
 			$data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $edit_id), $account_data);
205
-			$data['edit_id']=$edit_id;
205
+			$data['edit_id'] = $edit_id;
206 206
 			$this->load->view('view_customer_details', $data);
207 207
 		} else {
208
-			redirect(base_url() . 'accounts/customer_list/');
208
+			redirect(base_url().'accounts/customer_list/');
209 209
 		}
210 210
 	}
211 211
 
212 212
     function customer_save($add_array = false) {
213 213
         $add_array = $this->input->post();
214 214
         $entity_name = strtolower($this->common->get_entity_type('', '', $add_array['type']));
215
-        $data['country_id'] = isset($add_array['country_id'])? $add_array['country_id']:'';
216
-        $data['timezone_id'] = isset($add_array['timezone_id']) ? $add_array['timezone_id']:'';
217
-        $data['currency_id'] = isset($add_array['currency_id']) ? $add_array['currency_id']:'';
215
+        $data['country_id'] = isset($add_array['country_id']) ? $add_array['country_id'] : '';
216
+        $data['timezone_id'] = isset($add_array['timezone_id']) ? $add_array['timezone_id'] : '';
217
+        $data['currency_id'] = isset($add_array['currency_id']) ? $add_array['currency_id'] : '';
218 218
         $data['entity_name'] = $entity_name;
219 219
         $data['callingcard'] = Common_model::$global_config['system_config']['pinlength'];
220
-        $data['edit_id']=$add_array['id'];
220
+        $data['edit_id'] = $add_array['id'];
221 221
         $data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $add_array['id']), $add_array);
222 222
         if ($add_array['id'] != '') {
223
-            $data['page_title'] = 'Edit ' . $this->common->get_entity_type('', '', $add_array['type']);
223
+            $data['page_title'] = 'Edit '.$this->common->get_entity_type('', '', $add_array['type']);
224 224
             if ($this->form_validation->run() == FALSE) {
225 225
                 $data['validation_errors'] = validation_errors();
226 226
             } else {
227 227
                   ASTPP  3.0 
228 228
                   Password encode
229
-                 * **** */
229
+                 * **** * /
230 230
 				$add_array['password'] = $this->common->encode($add_array['password']);
231 231
 				/*                 * ****************** */
232 232
 				$add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false);
@@ -244,16 +244,16 @@  discard block
 block discarded – undo
244 244
 					unset($add_array['tax_id']);
245 245
 				}
246 246
 				//Completed
247
-				unset($add_array['posttoexternal'],$add_array['number'],$add_array['balance']);
247
+				unset($add_array['posttoexternal'], $add_array['number'], $add_array['balance']);
248 248
 				$this->accounts_model->edit_account($add_array, $add_array['id']);
249
-				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' updated successfully!');
250
-				redirect(base_url() . 'accounts/customer_list/');
249
+				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name).' updated successfully!');
250
+				redirect(base_url().'accounts/customer_list/');
251 251
 				exit;
252 252
 			}
253 253
 			$data["account_data"]["0"] = $add_array;
254 254
 			$this->load->view('view_customer_details', $data);
255 255
 		} else {
256
-			$data['page_title'] = 'Create ' . $entity_name;
256
+			$data['page_title'] = 'Create '.$entity_name;
257 257
 			if ($this->form_validation->run() == FALSE) {
258 258
 				$data['validation_errors'] = validation_errors();
259 259
 			} else {
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
 					}
277 277
 					unset($add_array['tax_id']);
278 278
 				}
279
-				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' added successfully!');
280
-				redirect(base_url() . 'accounts/customer_list/');
279
+				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name).' added successfully!');
280
+				redirect(base_url().'accounts/customer_list/');
281 281
 				exit;
282 282
 			}
283 283
 			$this->load->view('view_accounts_create', $data);
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		$account = $this->db_model->getSelect("*", "accounts", $where);
299 299
 
300 300
 		if ($account->num_rows > 0) {
301
-			$account_data = (array) $account->first_row();
301
+			$account_data = (array)$account->first_row();
302 302
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
303 303
 			$data['page_title'] = 'Speed Dial';
304 304
 			$data['accounttype'] = $accounttype;
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 			$data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($accounttype, $edit_id), $account_data);
318 318
 			$this->load->view('view_customer_speed_dial', $data);
319 319
 		} else {
320
-			redirect(base_url() . 'accounts/customer_list/');
320
+			redirect(base_url().'accounts/customer_list/');
321 321
 		}
322 322
 	}
323 323
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 
352 352
 	function customer_ipmap($edit_id) {
353 353
 		$data['page_title'] = "IP Settings";
354
-		$data['add_form']=true;
354
+		$data['add_form'] = true;
355 355
 		//Get Account information from session.
356 356
 		$accountinfo = $this->session->userdata('accountinfo');
357 357
 		//Get Parent informartion
@@ -359,14 +359,14 @@  discard block
 block discarded – undo
359 359
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
360 360
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
361 361
 		if ($account_res->num_rows > 0) {
362
-			$account_data = (array) $account_res->first_row();
362
+			$account_data = (array)$account_res->first_row();
363 363
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
364 364
 			$data["grid_fields"] = $this->accounts_form->build_ip_list_for_customer($edit_id, $accounttype);
365 365
 			$data['edit_id'] = $edit_id;
366 366
 			$data['accounttype'] = $accounttype;
367 367
 			$this->load->view('view_customer_ipmap', $data);
368 368
 		} else {
369
-			redirect(base_url() . 'accounts/customer_list/');
369
+			redirect(base_url().'accounts/customer_list/');
370 370
 			exit;
371 371
 		}
372 372
 	}
@@ -374,14 +374,14 @@  discard block
 block discarded – undo
374 374
 	function customer_ipmap_json($accountid, $accounttype) {
375 375
 		$json_data = array();
376 376
 		$where = array("accountid" => $accountid);
377
-		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_ipmap');
378
-		$like_str=!empty($instant_search) ? "(name like '%$instant_search%'  OR ip like '%$instant_search%' OR prefix like '%$instant_search%' OR created_date like '%$instant_search%' )" :null;
379
-		if(!empty($like_str))
377
+		$instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_ipmap');
378
+		$like_str = ! empty($instant_search) ? "(name like '%$instant_search%'  OR ip like '%$instant_search%' OR prefix like '%$instant_search%' OR created_date like '%$instant_search%' )" : null;
379
+		if ( ! empty($like_str))
380 380
 		$this->db->where($like_str);
381 381
 		$count_all = $this->db_model->countQuery("*", "ip_map", $where);
382 382
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
383 383
 		$json_data = $paging_data["json_paging"];
384
-		if(!empty($like_str))
384
+		if ( ! empty($like_str))
385 385
 		$this->db->where($like_str);
386 386
 		$query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
387 387
 		$grid_fields = json_decode($this->accounts_form->build_ip_list_for_customer($accountid, $accounttype));
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 				if (strpos($ip, '/') !== false) {
403 403
 					$add_array['ip'] = $add_array['ip'];
404 404
 				} else {
405
-					$add_array['ip'] = $add_array['ip'] . '/32';
405
+					$add_array['ip'] = $add_array['ip'].'/32';
406 406
 				}
407 407
 				$where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix']));
408 408
 				$getdata = $this->db_model->countQuery("*", "ip_map", $where);
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 			}
438 438
 			$this->session->set_flashdata('astpp_notification', 'IP removed sucessfully.');
439 439
 		}
440
-		redirect(base_url() . "accounts/" . $accounttype . "_ipmap/" . $accountid . "/");
440
+		redirect(base_url()."accounts/".$accounttype."_ipmap/".$accountid."/");
441 441
 	}
442 442
 
443 443
 	//This function using for provider t
@@ -455,30 +455,30 @@  discard block
 block discarded – undo
455 455
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
456 456
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
457 457
 		if ($account_res->num_rows > 0) {
458
-			$account_data = (array) $account_res->first_row();
458
+			$account_data = (array)$account_res->first_row();
459 459
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
460 460
 			$data["grid_fields"] = $this->accounts_form->build_animap_list_for_customer($edit_id, $accounttype);
461 461
 			$data['edit_id'] = $edit_id;
462 462
 			$data['accounttype'] = $accounttype;
463 463
 			$this->load->view('view_customer_animap', $data);
464 464
 		} else {
465
-			redirect(base_url() . 'accounts/customer_list/');
465
+			redirect(base_url().'accounts/customer_list/');
466 466
 			exit;
467 467
 		}
468 468
 	}
469 469
 
470 470
 	function customer_animap_json($accountid, $accounttype) {
471 471
 		$json_data = array();
472
-		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_animap'); 
473
-		$like_str=!empty($instant_search) ? "(number like '%$instant_search%'  OR  creation_date like '%$instant_search%' )" :null;
474
-		if(!empty($like_str))
472
+		$instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_animap'); 
473
+		$like_str = ! empty($instant_search) ? "(number like '%$instant_search%'  OR  creation_date like '%$instant_search%' )" : null;
474
+		if ( ! empty($like_str))
475 475
 		$this->db->where($like_str);
476 476
 		$where = array("accountid" => $accountid);
477 477
 		$count_all = $this->db_model->countQuery("*", "ani_map", $where);
478 478
 
479 479
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
480 480
 		$json_data = $paging_data["json_paging"];
481
-		if(!empty($like_str))
481
+		if ( ! empty($like_str))
482 482
 		$this->db->where($like_str);
483 483
 		$query = $this->db_model->select("*", "ani_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
484 484
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	function customer_animap_action($action, $accountid, $aniid = "") {
497 497
 		$entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid));
498 498
 		$entity_type = strtolower($this->common->get_entity_type('', '', $entity_type));
499
-		$url = "accounts/" . $entity_type . "_animap/$accountid/";
499
+		$url = "accounts/".$entity_type."_animap/$accountid/";
500 500
 		if ($action == "add") {
501 501
 			$ani = $this->input->post();
502 502
 			$this->db->where('number', $ani['number']);
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 			$this->session->set_flashdata('astpp_notification', 'Caller ID removed sucessfully!');
527 527
 			$this->db_model->delete("ani_map", array("id" => $aniid));
528 528
 		}
529
-		redirect(base_url() . $url);
529
+		redirect(base_url().$url);
530 530
 	}
531 531
 
532 532
 	//This function using by Customer/Provider edit tab
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 		}
548 548
 		if ($module == "invoices") {
549 549
 			$this->load->module('invoices/invoices');
550
-			$this->invoices->customer_invoices($accountid,$entity_type, false);
550
+			$this->invoices->customer_invoices($accountid, $entity_type, false);
551 551
 		}
552 552
 		if ($module == "subscription") {
553 553
 			$this->load->module('charges/charges');
@@ -559,11 +559,11 @@  discard block
 block discarded – undo
559 559
 		}
560 560
 		if ($module == "charges") {
561 561
 			$this->load->module('reports/reports');
562
-			$this->reports->customer_charge_history($accountid,$entity_type);
562
+			$this->reports->customer_charge_history($accountid, $entity_type);
563 563
 		}
564 564
 		if ($module == "refill") {
565 565
 			$this->load->module('reports/reports');
566
-			$this->reports->customer_refillreport($accountid,$entity_type);
566
+			$this->reports->customer_refillreport($accountid, $entity_type);
567 567
 		}
568 568
 		if ($module == "emailhistory") {
569 569
 			$this->load->module('email/email');
@@ -571,13 +571,13 @@  discard block
 block discarded – undo
571 571
 		}
572 572
 		if ($module == "opensips") {
573 573
 			$this->load->module('opensips/opensips');
574
-			$this->opensips->customer_opensips_json($accountid,$entity_type);
574
+			$this->opensips->customer_opensips_json($accountid, $entity_type);
575 575
 		}
576 576
 	}
577
-	function customer_details_search($module_name){
577
+	function customer_details_search($module_name) {
578 578
 		$action = $this->input->post();
579
-		$this->session->set_userdata('left_panel_search_'.$module_name,"");
580
-		if(!empty($action['left_panel_search'])){
579
+		$this->session->set_userdata('left_panel_search_'.$module_name, "");
580
+		if ( ! empty($action['left_panel_search'])) {
581 581
 			$this->session->set_userdata('left_panel_search_'.$module_name, $action['left_panel_search']);
582 582
 		}
583 583
 	}
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
595 595
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
596 596
 		if ($account_res->num_rows > 0) {
597
-			$account_data = (array) $account_res->first_row();
597
+			$account_data = (array)$account_res->first_row();
598 598
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
599 599
 			$this->load->module('freeswitch/freeswitch');
600 600
 			$data["grid_buttons"] = $this->freeswitch->freeswitch_form->fsdevices_build_grid_buttons($edit_id, $accounttype);
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 			$data['accounttype'] = $accounttype;
604 604
 			$this->load->view('view_customer_sipdevices', $data);
605 605
 		} else {
606
-			redirect(base_url() . 'accounts/customer_list/');
606
+			redirect(base_url().'accounts/customer_list/');
607 607
 			exit;
608 608
 		}
609 609
 	}
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 		if ($action == "delete") {
620 620
 			$this->freeswitch->freeswitch_model->delete_freeswith_devices($id);
621 621
 			$this->session->set_flashdata('astpp_notification', 'Sip Device removed successfully!');
622
-			redirect(base_url() . "accounts/" . $entity_type . "_sipdevices/$accountid/");
622
+			redirect(base_url()."accounts/".$entity_type."_sipdevices/$accountid/");
623 623
 		}
624 624
 		if ($action == "edit") {
625 625
 			$this->freeswitch->customer_fssipdevices_edit($id, $accountid);
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
641 641
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
642 642
 		if ($account_res->num_rows > 0) {
643
-			$account_data = (array) $account_res->first_row();
643
+			$account_data = (array)$account_res->first_row();
644 644
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
645 645
 			$this->load->module('freeswitch/freeswitch');
646 646
 			$this->load->module('opensips/opensips');
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 			$data['accounttype'] = $accounttype;
651 651
 			$this->load->view('view_customer_opensips_devices', $data);
652 652
 		} else {
653
-			redirect(base_url() . 'accounts/customer_list/');
653
+			redirect(base_url().'accounts/customer_list/');
654 654
 			exit;
655 655
 		}
656 656
 	}
@@ -658,12 +658,12 @@  discard block
 block discarded – undo
658 658
 	function customer_opensips_action($action, $accountid, $id) {
659 659
 		$entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid));
660 660
 		$entity_type = strtolower($this->common->get_entity_type('', '', $entity_type));
661
-		$url = "accounts/" . $entity_type . "_opensips/$accountid/";
661
+		$url = "accounts/".$entity_type."_opensips/$accountid/";
662 662
 		$this->load->module('opensips/opensips');
663 663
 		if ($action == "delete") {
664 664
 			$this->opensips->opensips_model->remove_opensips($id);
665 665
 			$this->session->set_flashdata('astpp_notification', 'Opensips removed successfully!');
666
-			redirect(base_url() . $url);
666
+			redirect(base_url().$url);
667 667
 		}
668 668
 		if ($action == "edit") {
669 669
 			$this->opensips->customer_opensips_edit($accountid, $id);
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
689 689
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
690 690
 		if ($account_res->num_rows > 0) {
691
-			$account_data = (array) $account_res->first_row();
691
+			$account_data = (array)$account_res->first_row();
692 692
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
693 693
 			$data['chargelist'] = form_dropdown('applayable_charge', $this->Astpp_common->list_applyable_charges($edit_id), '');
694 694
 			$this->load->module('reports/reports');
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 			$data['accounttype'] = $accounttype;
698 698
 			$this->load->view('view_customer_charges', $data);
699 699
 		} else {
700
-			redirect(base_url() . 'accounts/customer_list/');
700
+			redirect(base_url().'accounts/customer_list/');
701 701
 			exit;
702 702
 		}
703 703
 	}
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
720 720
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
721 721
 		if ($account_res->num_rows > 0) {
722
-			$account_data = (array) $account_res->first_row();
722
+			$account_data = (array)$account_res->first_row();
723 723
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
724 724
 			$data['chargelist'] = form_dropdown_all(array("name" => 'applayable_charge', 'id' => 'applayable_charge', 'class' => ""), $this->Astpp_common->list_applyable_charges($edit_id), '');
725 725
 			$this->load->module('charges/charges');
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 			$data['accounttype'] = $accounttype;
729 729
 			$this->load->view('view_customer_subscriptions', $data);
730 730
 		} else {
731
-			redirect(base_url() . 'accounts/customer_list/');
731
+			redirect(base_url().'accounts/customer_list/');
732 732
 			exit;
733 733
 		}
734 734
 	}
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
           For Email Broadcast when Subscription Add - Delete
749 749
 		 * */
750 750
 		$accountinfo = $this->db_model->getSelect("*", "accounts", array("id" => $accountid));
751
-		$accountinfo = (array) $accountinfo->first_row();
751
+		$accountinfo = (array)$accountinfo->first_row();
752 752
 		/*         * ****************************** */
753 753
 		if ($action == "add") {
754 754
 			$charge_id = $this->input->post("applayable_charge", true);
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 		 * */
771 771
 		$this->common->mail_to_users($template_name, $accountinfo);
772 772
 		/*         * ********************************* */
773
-		redirect(base_url() . "accounts/" . $accounttype . "_subscription/$accountid/");
773
+		redirect(base_url()."accounts/".$accounttype."_subscription/$accountid/");
774 774
 	}
775 775
 
776 776
 	function provider_dids($edit_id) {
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
787 787
 		$account_res = $this->db_model->getSelect("type,country_id", "accounts", $where);
788 788
 		if ($account_res->num_rows > 0) {
789
-			$account_data = (array) $account_res->first_row();
789
+			$account_data = (array)$account_res->first_row();
790 790
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
791 791
 			$this->load->module('did/did');
792 792
 			$data['grid_fields'] = $this->did->did_form->build_did_list_for_customer($edit_id, $accounttype);
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 			$data['country_id'] = $account_data['country_id'];
799 799
 			$this->load->view('view_customer_dids', $data);
800 800
 		} else {
801
-			redirect(base_url() . 'accounts/customer_list/');
801
+			redirect(base_url().'accounts/customer_list/');
802 802
 			exit;
803 803
 		}
804 804
 	}
@@ -819,16 +819,16 @@  discard block
 block discarded – undo
819 819
 		$did_id = empty($did_id) ? $this->input->post("free_didlist", true) : $did_id;
820 820
 		if ($did_id != "") {
821 821
 			$account_arr = (array)$this->db->get_where("accounts", array("id" => $accountid))->first_row();
822
-			$did_arr = (array) $this->db->get_where("dids", array("id" => $did_id))->first_row();
823
-			$field_name = $account_arr['type'] ==1 ? "parent_id" : 'accountid';
822
+			$did_arr = (array)$this->db->get_where("dids", array("id" => $did_id))->first_row();
823
+			$field_name = $account_arr['type'] == 1 ? "parent_id" : 'accountid';
824 824
 			if ($action == "add") {
825 825
 				if ($did_arr['accountid'] == 0 && $did_arr['parent_id'] == $reseller_id) {
826 826
 					if ($accountinfo['type'] == 1) {
827 827
 						//for getting reseller setup price if reseller customer purchase
828 828
 						$reseller_pricing_query = $this->db_model->getSelect("*", "reseller_pricing", array("note" => $did_arr['number'], 'reseller_id' => $reseller_id));
829 829
 						if ($reseller_pricing_query->num_rows() > 0) {
830
-							$reseller_pricing = (array) $reseller_pricing_query->first_row();
831
-							$did_arr=array_merge($did_arr,$reseller_pricing);
830
+							$reseller_pricing = (array)$reseller_pricing_query->first_row();
831
+							$did_arr = array_merge($did_arr, $reseller_pricing);
832 832
 						}
833 833
 					}
834 834
 					$available_bal = $this->db_model->get_available_bal($account_arr);
@@ -866,12 +866,12 @@  discard block
 block discarded – undo
866 866
 					$this->db->where('note', $did_arr['number']);
867 867
 					$this->db->delete('reseller_pricing');
868 868
 				}
869
-				$account_arr['did_number']=$did_arr['number'];
869
+				$account_arr['did_number'] = $did_arr['number'];
870 870
 				$this->common->mail_to_users('email_remove_did', $account_arr);
871 871
 				$this->session->set_flashdata('astpp_notification', 'Did Removed Successfully.');
872 872
 			}
873 873
 		}
874
-		redirect(base_url() . "accounts/" . $accounttype . "_dids/$accountid/");
874
+		redirect(base_url()."accounts/".$accounttype."_dids/$accountid/");
875 875
 	}
876 876
 
877 877
 	function provider_invoices($edit_id) {
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
892 892
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
893 893
 		if ($account_res->num_rows > 0) {
894
-			$account_data = (array) $account_res->first_row();
894
+			$account_data = (array)$account_res->first_row();
895 895
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
896 896
 			$this->load->module('invoices/invoices');
897 897
 			$data['grid_fields'] = $this->invoices->invoices_form->build_invoices_list_for_customer_admin(false);
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 			$data['accounttype'] = $accounttype;
900 900
 			$this->load->view('view_customer_invoices', $data);
901 901
 		} else {
902
-			redirect(base_url() . 'accounts/customer_list/');
902
+			redirect(base_url().'accounts/customer_list/');
903 903
 			exit;
904 904
 		}
905 905
 	}
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
918 918
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
919 919
 		if ($account_res->num_rows > 0) {
920
-			$account_data = (array) $account_res->first_row();
920
+			$account_data = (array)$account_res->first_row();
921 921
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
922 922
 			$this->load->module('rates/rates');
923 923
 			$data['grid_fields'] = $this->rates->rates_form->build_pattern_list_for_customer($edit_id, $accounttype);
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 			$data['accounttype'] = $accounttype;
927 927
 			$this->load->view('view_customer_blocked_prefixes', $data);
928 928
 		} else {
929
-			redirect(base_url() . 'accounts/customer_list/');
929
+			redirect(base_url().'accounts/customer_list/');
930 930
 			exit;
931 931
 		}
932 932
 	}
@@ -967,16 +967,16 @@  discard block
 block discarded – undo
967 967
 	function customer_delete_block_pattern($accountid, $patternid) {
968 968
 		$entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid));
969 969
 		$entity_type = strtolower($this->common->get_entity_type('', '', $entity_type));
970
-		$url = "accounts/" . $entity_type . "_blocked_prefixes/$accountid";
970
+		$url = "accounts/".$entity_type."_blocked_prefixes/$accountid";
971 971
 		$this->db_model->delete("block_patterns", array("id" => $patternid));
972 972
 		$this->session->set_flashdata('astpp_notification', 'Block Code Removed Sucessfully!');
973 973
         
974
-		redirect(base_url() . $url);
974
+		redirect(base_url().$url);
975 975
 	}
976
-	function customer_blockedprefixes_delete_multiple(){
976
+	function customer_blockedprefixes_delete_multiple() {
977 977
 		$ids = $this->input->post("selected_ids", true);
978 978
 		$where = "id IN ($ids)";
979
-		$this->db->delete("block_patterns",$where);
979
+		$this->db->delete("block_patterns", $where);
980 980
 		echo TRUE;
981 981
 	}
982 982
 
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
1012 1012
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
1013 1013
 		if ($account_res->num_rows > 0) {
1014
-			$account_data = (array) $account_res->first_row();
1014
+			$account_data = (array)$account_res->first_row();
1015 1015
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
1016 1016
 			$this->load->module('reports/reports');
1017 1017
 			$data['grid_fields'] = $this->reports->reports_form->build_report_list_for_user($accounttype);
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 			$data['accounttype'] = $accounttype;
1020 1020
 			$this->load->view('view_customer_cdrs_list', $data);
1021 1021
 		} else {
1022
-			redirect(base_url() . 'accounts/customer_list/');
1022
+			redirect(base_url().'accounts/customer_list/');
1023 1023
 			exit;
1024 1024
 		}
1025 1025
 	}
@@ -1028,27 +1028,27 @@  discard block
 block discarded – undo
1028 1028
 	/* ASTPP  3.0 
1029 1029
      * Using for provider refillreporttab.
1030 1030
      */
1031
-	function reseller_packages($edit_id){
1031
+	function reseller_packages($edit_id) {
1032 1032
 	   $data['page_title'] = "Packages";
1033 1033
 	   $accountinfo = $this->session->userdata('accountinfo');
1034 1034
 	   $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0;
1035 1035
 	   $where = array('id' => $edit_id, "reseller_id" => $reseller_id);
1036 1036
 	   $account_res = $this->db_model->getSelect("type", "accounts", $where);
1037 1037
 	   if ($account_res->num_rows > 0) {
1038
-			$account_data = (array) $account_res->first_row();
1038
+			$account_data = (array)$account_res->first_row();
1039 1039
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
1040 1040
 			$this->load->module('package/package');
1041 1041
 			$data['grid_fields'] = $this->package->package_form->build_package_list_for_reseller();
1042 1042
 			$data['edit_id'] = $edit_id;
1043 1043
 			$data['accounttype'] = $accounttype;
1044 1044
 			$this->load->view('view_reseller_package_list', $data);
1045
-	   }else {
1046
-			redirect(base_url() . 'accounts/reseller_list/');
1045
+	   } else {
1046
+			redirect(base_url().'accounts/reseller_list/');
1047 1047
 			exit;
1048 1048
 	   }
1049 1049
 	} 
1050 1050
      
1051
-	function reseller_refillreport($edit_id){
1051
+	function reseller_refillreport($edit_id) {
1052 1052
 	  $this->customer_refillreport($edit_id);
1053 1053
 	}
1054 1054
 	function provider_refillreport($edit_id) {
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
1070 1070
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
1071 1071
 		if ($account_res->num_rows > 0) {
1072
-			$account_data = (array) $account_res->first_row();
1072
+			$account_data = (array)$account_res->first_row();
1073 1073
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
1074 1074
 			$this->load->module('reports/reports');
1075 1075
 			$data['grid_fields'] = $this->reports->reports_form->build_refillreport_for_customer();
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
 			$data['accounttype'] = $accounttype;
1078 1078
 			$this->load->view('view_customer_refill_report', $data);
1079 1079
 		} else {
1080
-			redirect(base_url() . 'accounts/customer_list/');
1080
+			redirect(base_url().'accounts/customer_list/');
1081 1081
 			exit;
1082 1082
 		}
1083 1083
 	}
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
1108 1108
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
1109 1109
 		if ($account_res->num_rows > 0) {
1110
-			$account_data = (array) $account_res->first_row();
1110
+			$account_data = (array)$account_res->first_row();
1111 1111
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
1112 1112
 			$this->load->module('email/email');
1113 1113
 			$data['grid_fields'] = $this->email->email_form->build_list_for_email_customer($edit_id, $accounttype);
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 			$data['accounttype'] = $accounttype;
1116 1116
 			$this->load->view('view_customer_email_history', $data);
1117 1117
 		} else {
1118
-			redirect(base_url() . 'accounts/customer_list/');
1118
+			redirect(base_url().'accounts/customer_list/');
1119 1119
 			exit;
1120 1120
 		}
1121 1121
 	}
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
1147 1147
 		$account_res = $this->db_model->getSelect("notify_credit_limit,notify_flag,notify_email,type,id", "accounts", $where);
1148 1148
 		if ($account_res->num_rows > 0) {
1149
-			$account_data = (array) $account_res->first_row();
1149
+			$account_data = (array)$account_res->first_row();
1150 1150
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
1151 1151
 			unset($account_data['type']);
1152 1152
 			$data['form'] = $this->form->build_form($this->accounts_form->customer_alert_threshold($accounttype), $account_data);
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
 			$data['accounttype'] = $accounttype;
1155 1155
 			$this->load->view('view_customer_alert_threshold', $data);
1156 1156
 		} else {
1157
-			redirect(base_url() . 'accounts/customer_list/');
1157
+			redirect(base_url().'accounts/customer_list/');
1158 1158
 			exit;
1159 1159
 		}
1160 1160
 	}
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 
1168 1168
 	function customer_alert_threshold_save($entity_type) {
1169 1169
 		$add_array = $this->input->post();
1170
-		if (isset($add_array['id']) && !empty($add_array['id'])) {
1170
+		if (isset($add_array['id']) && ! empty($add_array['id'])) {
1171 1171
 			$data['page_title'] = "Alert Threshold";
1172 1172
 			$data['form'] = $this->form->build_form($this->accounts_form->customer_alert_threshold($entity_type), $add_array);
1173 1173
 			$data['edit_id'] = $add_array['id'];
@@ -1183,38 +1183,38 @@  discard block
 block discarded – undo
1183 1183
 					$data['validation_errors'] = validation_errors();
1184 1184
 				} else {
1185 1185
 					$this->db->where('id', $add_array['id']);
1186
-					$id=$add_array['id'];
1186
+					$id = $add_array['id'];
1187 1187
 					unset($add_array['id'], $add_array['action']);
1188 1188
 					$this->db->update('accounts', $add_array);
1189
-					$this->session->set_flashdata('astpp_errormsg','Alert threshold updated successfully!');
1190
-					redirect(base_url() . 'accounts/'.$entity_type.'_alert_threshold/'.$id."/");
1189
+					$this->session->set_flashdata('astpp_errormsg', 'Alert threshold updated successfully!');
1190
+					redirect(base_url().'accounts/'.$entity_type.'_alert_threshold/'.$id."/");
1191 1191
 					exit;
1192 1192
 				}
1193 1193
 			} else {
1194
-				redirect(base_url() . 'accounts/'.$entity_type.'_list/');
1194
+				redirect(base_url().'accounts/'.$entity_type.'_list/');
1195 1195
 				exit;
1196 1196
 			}
1197 1197
 			$this->load->view('view_customer_alert_threshold', $data);
1198 1198
 		} else {
1199
-			redirect(base_url() . 'accounts/customer_list/');
1199
+			redirect(base_url().'accounts/customer_list/');
1200 1200
 			exit;
1201 1201
 		}
1202 1202
 	}
1203 1203
 
1204 1204
 	function customer_bulk_creation() {
1205
-		$type=0;
1205
+		$type = 0;
1206 1206
 		$data['entity_name'] = strtolower($this->common->get_entity_type('', '', $type));
1207 1207
 		$data['page_title'] = 'Mass Customer';
1208 1208
 		$data['country_id'] = Common_model::$global_config['system_config']['country'];
1209 1209
 		$data['currency_id'] = $this->common->get_field_name('id', 'currency', array('currency' => Common_model::$global_config['system_config']['base_currency']));
1210 1210
 		$data['timezone_id'] = Common_model::$global_config['system_config']['default_timezone'];
1211
-		if (!$data['timezone_id']) {
1211
+		if ( ! $data['timezone_id']) {
1212 1212
 			$data['timezone_id'] = 1;
1213 1213
 		}
1214
-		if (!$data['currency_id']) {
1214
+		if ( ! $data['currency_id']) {
1215 1215
 			$data['currency_id'] = 1;
1216 1216
 		}
1217
-		if (!$data['country_id']) {
1217
+		if ( ! $data['country_id']) {
1218 1218
 			$data['country_id'] = 1;
1219 1219
 		}
1220 1220
 		$data['form'] = $this->form->build_form($this->accounts_form->customer_bulk_generate_form(), '');
@@ -1224,17 +1224,17 @@  discard block
 block discarded – undo
1224 1224
 	function customer_bulk_save() {
1225 1225
 		$data['page_title'] = 'Create Bulk Customer';
1226 1226
 		$add_array = $this->input->post();
1227
-		if (!empty($add_array) && isset($add_array)) {
1227
+		if ( ! empty($add_array) && isset($add_array)) {
1228 1228
 			$currentlength = $this->accounts_model->get_max_limit($add_array);
1229 1229
 			$account_data = $this->session->userdata("accountinfo");
1230
-			$add_array['reseller_id'] = $account_data['type']==1 ? $account_data['id']:0;
1230
+			$add_array['reseller_id'] = $account_data['type'] == 1 ? $account_data['id'] : 0;
1231 1231
 			$data['form'] = $this->form->build_form($this->accounts_form->customer_bulk_generate_form(), $add_array);
1232 1232
 			if ($this->form_validation->run() == FALSE) {
1233 1233
 				$data['validation_errors'] = validation_errors();
1234 1234
 				echo $data['validation_errors'];
1235 1235
 				exit;
1236 1236
 			}
1237
-			if($currentlength <= 0){
1237
+			if ($currentlength <= 0) {
1238 1238
 		echo json_encode(array("prefix_error" => "Your Account Limit has been reached.Please Change Your Prefix."));
1239 1239
 				exit;
1240 1240
 			}
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
 				exit;
1244 1244
 			}
1245 1245
 			if ($currentlength > 0 && $add_array['count'] > $currentlength) {
1246
-				echo json_encode(array("count_error" => "You Can Create Maximum " . $currentlength . " accounts with " . $add_array['prefix'] . " prefix"));
1246
+				echo json_encode(array("count_error" => "You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix"));
1247 1247
 				exit;
1248 1248
 			} else {
1249 1249
 				$this->accounts_model->bulk_insert_accounts($add_array);
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
 				exit;
1252 1252
 			}
1253 1253
 		} else {
1254
-			redirect(base_url() . "accounts/customer_list/");
1254
+			redirect(base_url()."accounts/customer_list/");
1255 1255
 		}
1256 1256
 	}
1257 1257
 
@@ -1268,13 +1268,13 @@  discard block
 block discarded – undo
1268 1268
 
1269 1269
 	function customer_did_country() {
1270 1270
 		$country_id = $_POST['country_id'];
1271
-		$accountid= $this->input->post('accountid',true);
1271
+		$accountid = $this->input->post('accountid', true);
1272 1272
 		$accountinfo = $this->session->userdata("accountinfo");
1273
-		$entity_info=(array)$this->db->get_where('accounts',array("id"=>$accountid))->first_row();
1273
+		$entity_info = (array)$this->db->get_where('accounts', array("id"=>$accountid))->first_row();
1274 1274
 		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
1275 1275
 		if ($entity_info['reseller_id'] > 0) {
1276 1276
 			$parent_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : $accountinfo['reseller_id'];
1277
-			$query = 'select dids.id as id,dids.number as number,reseller_pricing.setup as setup, reseller_pricing.monthlycost as monthlycost from dids,reseller_pricing where dids.number= reseller_pricing.note and reseller_pricing.reseller_id =' . $parent_id . " and dids.accountid=0 and dids.country_id =" . $country_id;
1277
+			$query = 'select dids.id as id,dids.number as number,reseller_pricing.setup as setup, reseller_pricing.monthlycost as monthlycost from dids,reseller_pricing where dids.number= reseller_pricing.note and reseller_pricing.reseller_id ='.$parent_id." and dids.accountid=0 and dids.country_id =".$country_id;
1278 1278
 			$did_list = $this->db->query($query);
1279 1279
 		} else {
1280 1280
 			$did_list = $this->db_model->getSelect("id,number,setup,monthlycost", "dids", array('country_id' => $country_id, 'accountid' => '0', 'parent_id' => $reseller_id));
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
 		if ($did_list->num_rows > 0) {
1284 1284
 			$did_data = $did_list->result_array();
1285 1285
 			foreach ($did_data as $key => $value) {
1286
-				$did_arr[$value['id']] = $value['number'] . " (Setup Cost : " . $this->common_model->calculate_currency($value['setup'], '', '', true) . ") (Monthly cost : " . $this->common_model->calculate_currency($value['monthlycost'], '', '', true) . ")";
1286
+				$did_arr[$value['id']] = $value['number']." (Setup Cost : ".$this->common_model->calculate_currency($value['setup'], '', '', true).") (Monthly cost : ".$this->common_model->calculate_currency($value['monthlycost'], '', '', true).")";
1287 1287
 			}
1288 1288
 		}
1289 1289
 		$did_info = array("name" => "free_didlist", "id" => "free_didlist", "class" => "free_didlist");
@@ -1318,28 +1318,28 @@  discard block
 block discarded – undo
1318 1318
 			$username = $this->session->userdata('username');
1319 1319
 		$login_user_data = $this->session->userdata("accountinfo");
1320 1320
 			$accountinfo = $this->accounts_model->get_account_by_number($post_array['id']);
1321
-			if($accountinfo['reseller_id'] == 0){
1321
+			if ($accountinfo['reseller_id'] == 0) {
1322 1322
 			   $where = array("accountid"=> 1);
1323
-		}else{
1323
+		} else {
1324 1324
 			$where = array("accountid"=> $accountinfo['id']);    
1325 1325
 		}
1326 1326
 		$query = $this->db_model->getSelect("*", "invoice_conf", $where);
1327
-		if($query->num_rows >0){
1327
+		if ($query->num_rows > 0) {
1328 1328
 			$invoice_conf = $query->result_array();
1329 1329
 			$invoice_conf = $invoice_conf[0];
1330
-		}else{
1331
-			$query = $this->db_model->getSelect("*", "invoice_conf",array("accountid"=> 1));
1330
+		} else {
1331
+			$query = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> 1));
1332 1332
 			$invoice_conf = $query->result_array();
1333 1333
 			$invoice_conf = $invoice_conf[0];            
1334 1334
 		}
1335
-		 $last_invoice_ID = $this->get_invoice_date("invoiceid",$accountinfo["id"]);
1336
-		 $invoice_prefix=$invoice_conf['invoice_prefix'];
1337
-		  $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoice_conf['interval']." days"));
1335
+		 $last_invoice_ID = $this->get_invoice_date("invoiceid", $accountinfo["id"]);
1336
+		 $invoice_prefix = $invoice_conf['invoice_prefix'];
1337
+		  $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoice_conf['interval']." days"));
1338 1338
 				$response = $this->accounts_model->account_process_payment($post_array);
1339 1339
 
1340
-				if($post_array['payment_type']== 1 ){
1340
+				if ($post_array['payment_type'] == 1) {
1341 1341
 			$this->load->module('invoices/invoices');
1342
-			$invoice_id=$this->invoices->invoices->generate_receipt($post_array['id'],$post_array['credit'],$accountinfo,$last_invoice_ID+1,$invoice_prefix,$due_date);
1342
+			$invoice_id = $this->invoices->invoices->generate_receipt($post_array['id'], $post_array['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date);
1343 1343
 		$account_balance = $this->common->get_field_name('balance', 'accounts', $post_array['id']);
1344 1344
 			$insert_arr = array("accountid" => $post_array['id'],
1345 1345
 					  "description" => trim($post_array['notes']),
@@ -1350,13 +1350,13 @@  discard block
 block discarded – undo
1350 1350
 					  "reseller_id"=>'0',
1351 1351
 					  "item_type"=>'POSTCHARG',
1352 1352
 					  "item_id"=>'0',
1353
-  					  'before_balance'=>$account_balance+$post_array['credit'],
1353
+  					  'before_balance'=>$account_balance + $post_array['credit'],
1354 1354
 					  'after_balance'=>$account_balance,
1355 1355
 					);
1356 1356
 			$this->db->insert("invoice_details", $insert_arr);
1357
-				}else{
1357
+				} else {
1358 1358
 			$this->load->module('invoices/invoices');
1359
-			$invoice_id=$this->invoices->invoices->generate_receipt($post_array['id'],$post_array['credit'],$accountinfo,$last_invoice_ID+1,$invoice_prefix,$due_date);
1359
+			$invoice_id = $this->invoices->invoices->generate_receipt($post_array['id'], $post_array['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date);
1360 1360
 			$account_balance = $this->common->get_field_name('balance', 'accounts', $post_array['id']);
1361 1361
 			$insert_arr = array("accountid" => $post_array['id'],
1362 1362
 					  "description" => trim($post_array['notes']),
@@ -1367,22 +1367,22 @@  discard block
 block discarded – undo
1367 1367
 					  "reseller_id"=>$accountinfo['reseller_id'],
1368 1368
 					  "item_type"=>'Refill',
1369 1369
 					  "item_id"=>'0',
1370
-  					  'before_balance'=>$account_balance-$post_array['credit'],
1370
+  					  'before_balance'=>$account_balance - $post_array['credit'],
1371 1371
 					  'after_balance'=>$account_balance,
1372 1372
 					);
1373 1373
 			$this->db->insert("invoice_details", $insert_arr);
1374
-			if($login_user_data['type'] ==1){
1375
-			  $reseller_ids=$this->common->get_parent_info($login_user_data['id'],0);
1376
-			  $reseller_ids=rtrim($reseller_ids,",");
1377
-			  $reseller_arr=explode(",",$reseller_ids);
1378
-			  if(!empty($reseller_arr)){
1379
-			 $custom_array=$post_array;
1380
-			foreach($reseller_arr as $key=>$reseller_id){
1381
-			  $custom_array['id']=$reseller_id;
1374
+			if ($login_user_data['type'] == 1) {
1375
+			  $reseller_ids = $this->common->get_parent_info($login_user_data['id'], 0);
1376
+			  $reseller_ids = rtrim($reseller_ids, ",");
1377
+			  $reseller_arr = explode(",", $reseller_ids);
1378
+			  if ( ! empty($reseller_arr)) {
1379
+			 $custom_array = $post_array;
1380
+			foreach ($reseller_arr as $key=>$reseller_id) {
1381
+			  $custom_array['id'] = $reseller_id;
1382 1382
 			  $response = $this->accounts_model->account_process_payment($custom_array);
1383
-			  $reseller_info=(array)$this->db->get_where('accounts',array("id"=>$reseller_id))->first_row();
1384
-			  $last_invoice_ID = $this->get_invoice_date("invoiceid",$reseller_info["id"]);
1385
-			  $invoice_id=$this->invoices->invoices->generate_receipt($reseller_info['id'],$custom_array['credit'],$reseller_info,$last_invoice_ID+1,$invoice_prefix,$due_date);
1383
+			  $reseller_info = (array)$this->db->get_where('accounts', array("id"=>$reseller_id))->first_row();
1384
+			  $last_invoice_ID = $this->get_invoice_date("invoiceid", $reseller_info["id"]);
1385
+			  $invoice_id = $this->invoices->invoices->generate_receipt($reseller_info['id'], $custom_array['credit'], $reseller_info, $last_invoice_ID + 1, $invoice_prefix, $due_date);
1386 1386
 			  $account_balance = $this->common->get_field_name('balance', 'accounts', $reseller_info['id']);
1387 1387
 			  $insert_arr = array("accountid" => $reseller_info['id'],
1388 1388
 				      "description" => trim($custom_array['notes']),
@@ -1413,11 +1413,11 @@  discard block
 block discarded – undo
1413 1413
     /**
1414 1414
      * @param string $select
1415 1415
      */
1416
-    function get_invoice_date($select,$accountid){
1417
-	$query = $this->db_model->select($select, "invoices", '',"id","DESC","1","0");
1418
-	if($query->num_rows >0){
1416
+    function get_invoice_date($select, $accountid) {
1417
+	$query = $this->db_model->select($select, "invoices", '', "id", "DESC", "1", "0");
1418
+	if ($query->num_rows > 0) {
1419 1419
 		$invoiceid = $query->result_array();
1420
-		$invoice_date=$invoiceid[0][$select];
1420
+		$invoice_date = $invoiceid[0][$select];
1421 1421
 		return  $invoice_date;
1422 1422
 	}
1423 1423
 	return false;
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 		$data['form'] = $this->form->build_form($this->accounts_form->get_customer_callerid_fields(), $data);
1455 1455
 		$post_array = $this->input->post();
1456 1456
         
1457
-		if (!empty($post_array)) {
1457
+		if ( ! empty($post_array)) {
1458 1458
 			if ($this->form_validation->run() == FALSE) {
1459 1459
 				$data['validation_errors'] = validation_errors();
1460 1460
 				echo $data['validation_errors'];
@@ -1483,13 +1483,13 @@  discard block
 block discarded – undo
1483 1483
 		$data['country_id'] = $accountinfo['country_id'];
1484 1484
 		$data['currency_id'] = $accountinfo['currency_id'];
1485 1485
 		$data['timezone_id'] = $accountinfo['timezone_id'];
1486
-		if (!$data['timezone_id']) {
1486
+		if ( ! $data['timezone_id']) {
1487 1487
 			$data['timezone_id'] = 1;
1488 1488
 		}
1489
-		if (!$data['currency_id']) {
1489
+		if ( ! $data['currency_id']) {
1490 1490
 			$data['currency_id'] = 1;
1491 1491
 		}
1492
-		if (!$data['country_id']) {
1492
+		if ( ! $data['country_id']) {
1493 1493
 			$data['country_id'] = 1;
1494 1494
 		}
1495 1495
 
@@ -1517,17 +1517,17 @@  discard block
 block discarded – undo
1517 1517
 		 * */
1518 1518
 		$encrypted_string = $this->common->encode($edit_data['id']);
1519 1519
 		$encrypt = $this->common->encode_params($encrypted_string);
1520
-		$edit_data['registration_url'] = base_url() . "signup/" . $encrypt;
1520
+		$edit_data['registration_url'] = base_url()."signup/".$encrypt;
1521 1521
 		/*         * *********************************************************** */
1522 1522
 		/*         * ***
1523 1523
           ASTPP  3.0 
1524 1524
           Password decode
1525 1525
          * **** */
1526 1526
 		$edit_data['password'] = $this->common->decode($edit_data['password']);
1527
-		$edit_data['credit_limit']=$this->common_model->calculate_currency(($edit_data['credit_limit']),'','',true,false);
1527
+		$edit_data['credit_limit'] = $this->common_model->calculate_currency(($edit_data['credit_limit']), '', '', true, false);
1528 1528
 		$entity_name = strtolower($this->common->get_entity_type('', '', $edit_data['type']));
1529
-		$data['edit_id']=$edit_id;
1530
-		$data['page_title'] =ucfirst($entity_name)." Profile";
1529
+		$data['edit_id'] = $edit_id;
1530
+		$data['page_title'] = ucfirst($entity_name)." Profile";
1531 1531
 		$data['entity_name'] = $entity_name;
1532 1532
 		/*         * ********************** */
1533 1533
 		$data['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields($edit_id), $edit_data);
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
 		$data['timezone_id'] = $add_array['timezone_id'];
1544 1544
 		$data['currency_id'] = $add_array['currency_id'];
1545 1545
 		$data['entity_name'] = $entity_name;
1546
-		$data['edit_id']=$add_array['id'];
1546
+		$data['edit_id'] = $add_array['id'];
1547 1547
 		$data['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields($add_array['id']), $add_array);
1548 1548
 		if ($add_array['id'] != '') {
1549 1549
 			$data['page_title'] = 'Edit Reseller';
@@ -1568,11 +1568,11 @@  discard block
 block discarded – undo
1568 1568
 					}
1569 1569
 					unset($add_array['tax_id']);
1570 1570
 				}
1571
-				unset($add_array['number'],$add_array['registration_url']);
1571
+				unset($add_array['number'], $add_array['registration_url']);
1572 1572
 				$this->accounts_model->edit_account($add_array, $add_array['id']);
1573 1573
 				$this->session->set_flashdata('astpp_errormsg', 'Reseller updated successfully!');
1574 1574
 
1575
-				redirect(base_url() . 'accounts/reseller_list/');
1575
+				redirect(base_url().'accounts/reseller_list/');
1576 1576
 				exit;
1577 1577
 			}
1578 1578
 			$data["account_data"]["0"] = $add_array;
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
 					unset($add_array['tax_id']);
1621 1621
 				}
1622 1622
 				$this->session->set_flashdata('astpp_errormsg', 'Reseller added successfully!');
1623
-				redirect(base_url() . 'accounts/reseller_list/');
1623
+				redirect(base_url().'accounts/reseller_list/');
1624 1624
 				exit;
1625 1625
 			}
1626 1626
 			$this->load->view('view_accounts_create', $data);
@@ -1635,7 +1635,7 @@  discard block
 block discarded – undo
1635 1635
 		echo $this->common->generate_password();
1636 1636
 	}
1637 1637
 
1638
-	function customer_generate_number($digit='') {
1638
+	function customer_generate_number($digit = '') {
1639 1639
        
1640 1640
 		echo $this->common->find_uniq_rendno($digit, 'number', 'accounts');
1641 1641
 	}
@@ -1646,19 +1646,19 @@  discard block
 block discarded – undo
1646 1646
 		$entitytype = str_replace(' ', '', $entity_type);
1647 1647
 		$data['username'] = $this->session->userdata('user_name');
1648 1648
 		$data['flag'] = 'create';
1649
-		$data['page_title'] = 'Create ' . ucfirst($entity_type);
1649
+		$data['page_title'] = 'Create '.ucfirst($entity_type);
1650 1650
 		$data['back_flag'] = true;
1651 1651
 		$data['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype), '');
1652 1652
 		$data['country_id'] = $accountinfo['country_id'];
1653 1653
 		$data['currency_id'] = $accountinfo['currency_id'];
1654 1654
 		$data['timezone_id'] = $accountinfo['timezone_id'];
1655
-		if (!$data['timezone_id']) {
1655
+		if ( ! $data['timezone_id']) {
1656 1656
 			$data['timezone_id'] = 1;
1657 1657
 		}
1658
-		if (!$data['currency_id']) {
1658
+		if ( ! $data['currency_id']) {
1659 1659
 			$data['currency_id'] = 1;
1660 1660
 		}
1661
-		if (!$data['country_id']) {
1661
+		if ( ! $data['country_id']) {
1662 1662
 			$data['country_id'] = 1;
1663 1663
 		}
1664 1664
 		$data['entity_name'] = $entity_type;
@@ -1667,13 +1667,13 @@  discard block
 block discarded – undo
1667 1667
 
1668 1668
 	function admin_edit($edit_id = '') {
1669 1669
 	$data['back_flag'] = true;
1670
-		$accountinfo=(array)$this->db->get_where('accounts',array("id"=>$edit_id))->first_row();
1670
+		$accountinfo = (array)$this->db->get_where('accounts', array("id"=>$edit_id))->first_row();
1671 1671
 		$type = $accountinfo['type'] == -1 ? 2 : $accountinfo['type'];
1672 1672
 		$entity_type = strtolower($this->common->get_entity_type('', '', $type));
1673 1673
 		$entitytype = str_replace(' ', '', $entity_type);
1674 1674
 		$accountinfo['password'] = $this->common->decode($accountinfo['password']);
1675 1675
 		$data['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype, $edit_id), $accountinfo);
1676
-		$data['page_title'] = 'Edit ' . ucfirst($entity_type);
1676
+		$data['page_title'] = 'Edit '.ucfirst($entity_type);
1677 1677
 		$this->load->view('view_admin_details', $data);
1678 1678
         
1679 1679
 		}
@@ -1686,10 +1686,10 @@  discard block
 block discarded – undo
1686 1686
 		$entitytype = str_replace(' ', '', $entity_type);
1687 1687
 		$data['username'] = $this->session->userdata('user_name');
1688 1688
 		$data['flag'] = 'create';
1689
-		$data['page_title'] = 'Create ' . $entity_type;
1689
+		$data['page_title'] = 'Create '.$entity_type;
1690 1690
 		$data['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype, $add_array['id']), $add_array);
1691 1691
 		if ($add_array['id'] != '') {
1692
-			$data['page_title'] = 'Edit ' . $entity_type;
1692
+			$data['page_title'] = 'Edit '.$entity_type;
1693 1693
 			if ($this->form_validation->run() == FALSE) {
1694 1694
 				$data['validation_errors'] = validation_errors();
1695 1695
 			} else {
@@ -1718,13 +1718,13 @@  discard block
 block discarded – undo
1718 1718
 					$result = $result->result_array();
1719 1719
 					$this->session->set_userdata('accountinfo', $result[0]);
1720 1720
 				}
1721
-				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type) . ' updated successfully!');
1722
-				redirect(base_url() . 'accounts/admin_list/');
1721
+				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type).' updated successfully!');
1722
+				redirect(base_url().'accounts/admin_list/');
1723 1723
 				exit;
1724 1724
 			}
1725 1725
 			$this->load->view('view_admin_details', $data);
1726 1726
 		} else {
1727
-			$data['page_title'] = 'Create ' . ucfirst($entity_type);
1727
+			$data['page_title'] = 'Create '.ucfirst($entity_type);
1728 1728
 			if ($this->form_validation->run() == FALSE) {
1729 1729
 				$data['validation_errors'] = validation_errors();
1730 1730
 			} else {
@@ -1742,8 +1742,8 @@  discard block
 block discarded – undo
1742 1742
 				}
1743 1743
 				$add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false);
1744 1744
 
1745
-				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type) . ' added successfully!');
1746
-				redirect(base_url() . 'accounts/admin_list/');
1745
+				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type).' added successfully!');
1746
+				redirect(base_url().'accounts/admin_list/');
1747 1747
 				exit;
1748 1748
 			}$this->load->view('view_accounts_create', $data);
1749 1749
 		}
@@ -1894,12 +1894,12 @@  discard block
 block discarded – undo
1894 1894
 				$action['balance']['balance'] = $this->common_model->add_calculate_currency($action['balance']['balance'], "", '', true, false);
1895 1895
 			}
1896 1896
 			if (isset($action['credit_limit']['credit_limit']) && $action['credit_limit']['credit_limit'] != '') {
1897
-				$action['credit_limit']['credit_limit'] = $this->common_model->add_calculate_currency($action['credit_limit']['credit_limit'], "", '',true, false);
1897
+				$action['credit_limit']['credit_limit'] = $this->common_model->add_calculate_currency($action['credit_limit']['credit_limit'], "", '', true, false);
1898 1898
 			}
1899 1899
 			$this->session->set_userdata('reseller_list_search', $action);
1900 1900
 		}
1901 1901
 		if (@$ajax_search != 1) {
1902
-			redirect(base_url() . 'accounts/reseller_list/');
1902
+			redirect(base_url().'accounts/reseller_list/');
1903 1903
 		}
1904 1904
 	}
1905 1905
 
@@ -1925,7 +1925,7 @@  discard block
 block discarded – undo
1925 1925
 			$this->session->set_userdata('admin_list_search', $action);
1926 1926
 		}
1927 1927
 		if (@$ajax_search != 1) {
1928
-			redirect(base_url() . 'accounts/admin_list/');
1928
+			redirect(base_url().'accounts/admin_list/');
1929 1929
 		}
1930 1930
 	}
1931 1931
 
@@ -1938,13 +1938,13 @@  discard block
 block discarded – undo
1938 1938
 	function customer_delete($id) {
1939 1939
 		$this->common->customer_delete_dependencies($id);
1940 1940
 		$this->session->set_flashdata('astpp_notification', 'Customer removed successfully!');
1941
-		redirect(base_url() . 'accounts/customer_list/');
1941
+		redirect(base_url().'accounts/customer_list/');
1942 1942
 	}
1943 1943
 
1944 1944
 	function reseller_delete($id) {
1945 1945
 		$this->common->subreseller_list($id);
1946 1946
 		$this->session->set_flashdata('astpp_notification', 'Reseller removed successfully!');
1947
-		redirect(base_url() . 'accounts/reseller_list/');
1947
+		redirect(base_url().'accounts/reseller_list/');
1948 1948
 	}
1949 1949
 
1950 1950
 	function free_customer_did($accountid) {
@@ -1975,19 +1975,19 @@  discard block
 block discarded – undo
1975 1975
 	function provider_delete($id) {
1976 1976
 		$this->accounts_model->remove_customer($id);
1977 1977
 		$this->session->set_flashdata('astpp_notification', 'Provider removed successfully!');
1978
-		redirect(base_url() . 'accounts/customer_list/');
1978
+		redirect(base_url().'accounts/customer_list/');
1979 1979
 	}
1980 1980
 
1981 1981
 	function admin_delete($id) {
1982 1982
 		$this->accounts_model->remove_customer($id);
1983 1983
 		$this->session->set_flashdata('astpp_notification', 'Admin removed successfully!');
1984
-		redirect(base_url() . 'accounts/admin_list/');
1984
+		redirect(base_url().'accounts/admin_list/');
1985 1985
 	}
1986 1986
 
1987 1987
 	function subadmin_delete($id) {
1988 1988
 		$this->accounts_model->remove_customer($id);
1989 1989
 		$this->session->set_flashdata('astpp_notification', 'Sub admin removed successfully!');
1990
-		redirect(base_url() . 'accounts/admin_list/');
1990
+		redirect(base_url().'accounts/admin_list/');
1991 1991
 	}
1992 1992
     
1993 1993
 	function reseller_details_json($module, $accountid) {
@@ -1998,13 +1998,13 @@  discard block
 block discarded – undo
1998 1998
 		}
1999 1999
 		if ($module == "invoices") {
2000 2000
 			$this->load->module('invoices/invoices');
2001
-			$this->invoices->customer_invoices($accountid,"reseller");
2001
+			$this->invoices->customer_invoices($accountid, "reseller");
2002 2002
 		}
2003 2003
 		if ($module == "charges") {
2004 2004
 			$this->load->module('charges/charges');
2005 2005
 			$this->charges->customer_charge_list($accountid, "reseller");
2006 2006
 		}
2007
-		if($module =='packages'){
2007
+		if ($module == 'packages') {
2008 2008
 	  $this->load->module('package/package');
2009 2009
 	  $this->package->package_list_reseller($accountid, "reseller");
2010 2010
 		}
@@ -2027,9 +2027,9 @@  discard block
 block discarded – undo
2027 2027
 			$this->db->insert("invoice_item", $insert_arr);
2028 2028
 
2029 2029
 			$this->accounts_model->update_balance($charge, $accountid, "debit");
2030
-			redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#packages");
2030
+			redirect(base_url()."accounts/".$accounttype."_edit/$accountid#packages");
2031 2031
 		} else {
2032
-			redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#packages");
2032
+			redirect(base_url()."accounts/".$accounttype."_edit/$accountid#packages");
2033 2033
 		}
2034 2034
 	}
2035 2035
 
@@ -2047,9 +2047,9 @@  discard block
 block discarded – undo
2047 2047
 				$this->did->did_model->add_reseller_pricing($accountid, $did_id);
2048 2048
 
2049 2049
 				$this->session->set_flashdata('astpp_errormsg', 'DID added successfully.');
2050
-				redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#did");
2050
+				redirect(base_url()."accounts/".$accounttype."_edit/$accountid#did");
2051 2051
 			} else {
2052
-				redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#did");
2052
+				redirect(base_url()."accounts/".$accounttype."_edit/$accountid#did");
2053 2053
 			}
2054 2054
 		}
2055 2055
 		if ($action == "delete") {
@@ -2078,14 +2078,14 @@  discard block
 block discarded – undo
2078 2078
 			} else {
2079 2079
 				$this->session->set_flashdata('astpp_notification', 'DID already removed before.');
2080 2080
 			}
2081
-			redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#did");
2081
+			redirect(base_url()."accounts/".$accounttype."_edit/$accountid#did");
2082 2082
 		}
2083 2083
 	}
2084 2084
 
2085 2085
 	function customer_selected_delete() {
2086 2086
 		$ids = $this->input->post("selected_ids", true);
2087
-		$customer_ids=explode(",",$ids);
2088
-		foreach($customer_ids as $customer_id){
2087
+		$customer_ids = explode(",", $ids);
2088
+		foreach ($customer_ids as $customer_id) {
2089 2089
 			$customer_id = str_replace("'", "", $customer_id);
2090 2090
 			$this->common->customer_delete_dependencies($customer_id);
2091 2091
 		}
@@ -2153,7 +2153,7 @@  discard block
 block discarded – undo
2153 2153
 					}
2154 2154
 				}
2155 2155
 				$this->session->set_flashdata('astpp_errormsg', 'Account tax added successfully!');
2156
-				redirect(base_url() . 'accounts/customer_list/');
2156
+				redirect(base_url().'accounts/customer_list/');
2157 2157
 			}
2158 2158
 			$data['id'] = array();
2159 2159
 			$data['taxesList'] = $this->common_model->get_list_taxes();
@@ -2185,9 +2185,9 @@  discard block
 block discarded – undo
2185 2185
 					}
2186 2186
 				}
2187 2187
 				if ($accountinfo['type'] == '0') {
2188
-					$link = base_url() . '/accounts/customer_list/';
2188
+					$link = base_url().'/accounts/customer_list/';
2189 2189
 				} else {
2190
-					$link = base_url() . '/accounts/reseller_list/';
2190
+					$link = base_url().'/accounts/reseller_list/';
2191 2191
 				}
2192 2192
 				$this->session->set_flashdata('astpp_errormsg', 'Account tax added successfully!');
2193 2193
 				redirect($link);
@@ -2197,7 +2197,7 @@  discard block
 block discarded – undo
2197 2197
 		} elseif ($action == 'delete') {
2198 2198
 			$this->accounting_model->remove_account_tax($id);
2199 2199
 			$this->session->set_flashdata('astpp_notification', 'Account tax removed successfully!');
2200
-			redirect(base_url() . 'accounting/account_taxes/');
2200
+			redirect(base_url().'accounting/account_taxes/');
2201 2201
 		}
2202 2202
 	}
2203 2203
 
@@ -2208,7 +2208,7 @@  discard block
 block discarded – undo
2208 2208
 	 */
2209 2209
 	function valid_account_tax() {
2210 2210
 		$tax_id = '';
2211
-		if (!empty($_POST['username'])) {
2211
+		if ( ! empty($_POST['username'])) {
2212 2212
 
2213 2213
 			$account_num = mysql_real_escape_string($_POST['username']);
2214 2214
 			$row = $this->accounts_model->check_account_num($account_num);
@@ -2216,11 +2216,11 @@  discard block
 block discarded – undo
2216 2216
 				$taxes_id = $this->accounts_model->get_accounttax_by_id($row['accountid']);
2217 2217
 				if ($taxes_id) {
2218 2218
 					foreach ($taxes_id as $id) {
2219
-						$tax_id.=$id['taxes_id'] . ",";
2219
+						$tax_id .= $id['taxes_id'].",";
2220 2220
 					}
2221 2221
 
2222 2222
 					$tax_id = rtrim($tax_id, ",");
2223
-					echo $row['accountid'] . ',' . $tax_id;
2223
+					echo $row['accountid'].','.$tax_id;
2224 2224
 				} else {
2225 2225
 					echo $row['accountid'];
2226 2226
 				}
@@ -2246,7 +2246,7 @@  discard block
 block discarded – undo
2246 2246
 					$this->session->set_userdata('accountinfo', $result[0]);
2247 2247
 				}
2248 2248
 				$this->session->set_flashdata('astpp_errormsg', 'Reseller updated successfully!');
2249
-				redirect(base_url() . '/dashboard/');
2249
+				redirect(base_url().'/dashboard/');
2250 2250
 			}
2251 2251
 			$this->load->view('view_reseller_edit_details_own', $data);
2252 2252
 		} else {
@@ -2303,7 +2303,7 @@  discard block
 block discarded – undo
2303 2303
 			echo "2";
2304 2304
 			exit;
2305 2305
 		}
2306
-		if (isset($add_array['number']) && !empty($add_array['number'])) {
2306
+		if (isset($add_array['number']) && ! empty($add_array['number'])) {
2307 2307
 			if (isset($add_array['id']) && $add_array['id'] != '') {
2308 2308
 				unset($add_array['animap_id']);
2309 2309
 				$response = $this->accounts_model->edit_animap($add_array, $add_array['id']);
@@ -2337,7 +2337,7 @@  discard block
 block discarded – undo
2337 2337
 		}
2338 2338
 		$value_edit = '';
2339 2339
 		foreach ($edit_data as $key => $value) {
2340
-			$value_edit.=$value . ",";
2340
+			$value_edit .= $value.",";
2341 2341
 		}
2342 2342
 		echo rtrim($value_edit, ',');
2343 2343
 		exit;
@@ -2356,11 +2356,11 @@  discard block
 block discarded – undo
2356 2356
 
2357 2357
 	function reseller_export_cdr_xls() {
2358 2358
 	$account_info = $accountinfo = $this->session->userdata('accountinfo');
2359
-	$currency_id=$account_info['currency_id'];
2360
-	$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
2359
+	$currency_id = $account_info['currency_id'];
2360
+	$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
2361 2361
 	ob_clean();
2362 2362
 		$query = $this->accounts_model->get_reseller_Account_list(true, '', '', true);
2363
-		$customer_array[] = array("Account", "First Name", "Last Name", "Company", "Rate Group ", "Account type", "Balance($currency)", "Credit Limit($currency)", "Status","Created Date");
2363
+		$customer_array[] = array("Account", "First Name", "Last Name", "Company", "Rate Group ", "Account type", "Balance($currency)", "Credit Limit($currency)", "Status", "Created Date");
2364 2364
 		if ($query->num_rows() > 0) {
2365 2365
 
2366 2366
 			foreach ($query->result_array() as $row) {
@@ -2371,40 +2371,40 @@  discard block
 block discarded – undo
2371 2371
 					$row['company_name'],
2372 2372
 					$this->common->get_field_name('name', 'pricelists', $row['pricelist_id']),
2373 2373
 					$this->common->get_account_type('', '', $row['posttoexternal']),
2374
-					$this->common_model->calculate_currency($row['balance'],false,false),
2375
-					$this->common_model->calculate_currency($row['credit_limit'],false,false),
2374
+					$this->common_model->calculate_currency($row['balance'], false, false),
2375
+					$this->common_model->calculate_currency($row['credit_limit'], false, false),
2376 2376
 					$this->common->get_status('export', '', $row['status']),
2377 2377
 					$row['creation'],
2378 2378
 				);
2379 2379
 			}
2380 2380
 		}
2381 2381
 		$this->load->helper('csv');
2382
-		array_to_csv($customer_array, 'Resellers_' . date("Y-m-d") . '.csv');
2382
+		array_to_csv($customer_array, 'Resellers_'.date("Y-m-d").'.csv');
2383 2383
 	}
2384
-	function customer_validate_ip(){
2385
-	 $add_array=$this->input->post();
2386
-	 if(!empty($add_array)){
2384
+	function customer_validate_ip() {
2385
+	 $add_array = $this->input->post();
2386
+	 if ( ! empty($add_array)) {
2387 2387
 	   $ip = $add_array['ip'];
2388 2388
 	   if (strpos($ip, '/') !== false) {
2389 2389
 		 $add_array['ip'] = $add_array['ip'];
2390 2390
 	   } else {
2391
-		 $add_array['ip'] = $add_array['ip'] . '/32';
2391
+		 $add_array['ip'] = $add_array['ip'].'/32';
2392 2392
 	   }
2393
-	   $this->db->where('ip',$add_array['ip']);
2394
-	   $this->db->where('prefix',$add_array['prefix']);
2393
+	   $this->db->where('ip', $add_array['ip']);
2394
+	   $this->db->where('prefix', $add_array['prefix']);
2395 2395
 	   $this->db->select('count(ip) as count');
2396
-	   $ip_map_result=(array)$this->db->get('ip_map')->first_row();
2397
-	   if($ip_map_result['count'] > 0 ){
2396
+	   $ip_map_result = (array)$this->db->get('ip_map')->first_row();
2397
+	   if ($ip_map_result['count'] > 0) {
2398 2398
 		 echo 'FALSE';
2399
-	   }else{
2399
+	   } else {
2400 2400
 		 echo 'TRUE';
2401 2401
 	   }
2402
-	 }else{
2402
+	 } else {
2403 2403
 	  echo 'FALSE';
2404 2404
 	 }
2405 2405
     
2406 2406
 	}
2407
-function reseller_invoice_config($id=''){
2407
+function reseller_invoice_config($id = '') {
2408 2408
 		$data['page_title'] = 'Company Profile';
2409 2409
 		$accountinfo = $this->session->userdata("accountinfo");
2410 2410
 		$add_array = $this->input->post();
@@ -2414,30 +2414,30 @@  discard block
 block discarded – undo
2414 2414
 				$this->load->module('invoices/invoices');
2415 2415
 				$this->load->model("invoices_model");
2416 2416
 				$invoiceconf = $this->invoices_model->get_invoiceconf();
2417
-				$file_name=($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : '';
2417
+				$file_name = ($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : '';
2418 2418
 			}
2419 2419
 			if (isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') {
2420 2420
 				$files = $_FILES['file'];
2421 2421
 				if ($files['size'] < 0) {
2422 2422
 					$this->session->set_flashdata('astpp_notification', 'PLease upload maximum file');
2423
-				redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/");
2423
+				redirect(base_url()."accounts/reseller_invoice_config/".$add_array['accountid']."/");
2424 2424
 				}
2425 2425
 				$file = $_FILES['file'];
2426 2426
 				$uploadedFile = $file["tmp_name"];
2427 2427
 				$file_name = $file['name'];
2428 2428
 				$file_type = $file['type'];
2429 2429
 				if ($file_type == 'image/jpg' || $file_type == 'image/png' || $file_type == 'image/jpeg') {
2430
-					$dir_path = FCPATH. "upload/";
2431
-					$path = $dir_path . $add_array['accountid']."_".$file['name'];
2430
+					$dir_path = FCPATH."upload/";
2431
+					$path = $dir_path.$add_array['accountid']."_".$file['name'];
2432 2432
 					if (move_uploaded_file($uploadedFile, $path)) {
2433 2433
 						$this->session->set_flashdata('astpp_errormsg', gettext('files added successfully!'));
2434 2434
 					} else {
2435 2435
 						$this->session->set_flashdata('astpp_notification', "File Uploading Fail Please Try Again");
2436
-					redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/");
2436
+					redirect(base_url()."accounts/reseller_invoice_config/".$add_array['accountid']."/");
2437 2437
 					}
2438 2438
 				} else {
2439 2439
 					$this->session->set_flashdata('astpp_notification', 'Please upload only image!');
2440
-				redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/");
2440
+				redirect(base_url()."accounts/reseller_invoice_config/".$add_array['accountid']."/");
2441 2441
 				}
2442 2442
 			}
2443 2443
 			$add_array['logo'] = $file_name;
@@ -2448,30 +2448,30 @@  discard block
 block discarded – undo
2448 2448
 				$this->accounts_model->edit_invoice_config($add_array, $add_array['id']);
2449 2449
 			}
2450 2450
 			$this->session->set_flashdata('astpp_errormsg', 'Invoice config updated successfully!');
2451
-			redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/");
2451
+			redirect(base_url()."accounts/reseller_invoice_config/".$add_array['accountid']."/");
2452 2452
 		} else {
2453
-			$data["account_data"] =(array)$this->db->get_where('invoice_conf',array("accountid"=>$id))->first_row();
2454
-		$data["accounttype"]='Reseller';
2455
-		$data["edit_id"]=$id;
2456
-			if(isset($data["account_data"]['logo'])){
2457
-				$data["account_data"]['file']=$id."_".$data["account_data"]['logo'];
2453
+			$data["account_data"] = (array)$this->db->get_where('invoice_conf', array("accountid"=>$id))->first_row();
2454
+		$data["accounttype"] = 'Reseller';
2455
+		$data["edit_id"] = $id;
2456
+			if (isset($data["account_data"]['logo'])) {
2457
+				$data["account_data"]['file'] = $id."_".$data["account_data"]['logo'];
2458 2458
 		}
2459 2459
 			$this->load->view('view_reseller_invoices_config', $data);
2460 2460
 		}
2461 2461
 }
2462 2462
      
2463
-	 function reseller_invoice_logo_delete($accountid){
2464
-		 $invoiceconf  = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid));
2465
-		 $result=$invoiceconf->result_array();
2466
-		 $logo=$result[0]['logo'];
2467
-		 $post_arr=array('logo'=>'');
2468
-		 $where_arr=array('logo'=>$logo);
2463
+	 function reseller_invoice_logo_delete($accountid) {
2464
+		 $invoiceconf = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid));
2465
+		 $result = $invoiceconf->result_array();
2466
+		 $logo = $result[0]['logo'];
2467
+		 $post_arr = array('logo'=>'');
2468
+		 $where_arr = array('logo'=>$logo);
2469 2469
 		 $this->db->where($where_arr);
2470
-		 $this->db->update('invoice_conf',$post_arr);
2470
+		 $this->db->update('invoice_conf', $post_arr);
2471 2471
 	 }
2472 2472
      
2473 2473
      
2474
-	 function customer_global_grid_list(){
2474
+	 function customer_global_grid_list() {
2475 2475
 	  echo gettext($_POST['display']); 
2476 2476
  	}
2477 2477
  	
Please login to merge, or discard this patch.
astpp/application/modules/accounts/libraries/accounts_form.php 2 patches
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if ( ! defined('BASEPATH'))
25 25
 	exit('No direct script access allowed');
26 26
 
27 27
 class Accounts_form {
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		$type = $entity_type == 'customer' ? 0 : 3;
37 37
 		$uname = $this->CI->common->find_uniq_rendno_customer(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts');
38 38
 		$pin = Common_model::$global_config['system_config']['pinlength'];
39
-		$pin_number=$this->CI->common->find_uniq_rendno($pin, 'pin', 'accounts');
39
+		$pin_number = $this->CI->common->find_uniq_rendno($pin, 'pin', 'accounts');
40 40
 		$uname_user = $this->CI->common->find_uniq_rendno('10', 'number', 'accounts');
41 41
 		$password = $this->CI->common->generate_password();
42 42
 		$logintype = $this->CI->session->userdata('logintype');
@@ -48,33 +48,33 @@  discard block
 block discarded – undo
48 48
 		}
49 49
 		$sip_device = null;
50 50
 		$opensips_device = null;
51
-		if (!$entity_type) {
51
+		if ( ! $entity_type) {
52 52
 			$entity_type = 'customer';
53 53
 		}
54
-		$params=array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number','readonly'=>true);
54
+		$params = array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number', 'readonly'=>true);
55 55
         
56 56
 		if ($id > 0) {
57 57
 			$readable = 'disabled';
58
-			$val = 'accounts.email.' . $id;
59
-			$account_val='accounts.number.'.$id;
58
+			$val = 'accounts.email.'.$id;
59
+			$account_val = 'accounts.number.'.$id;
60 60
 			$password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20', 'class' => "text field medium"), 'required|', 'tOOL TIP', '');
61 61
 			$balance = array('Balance', 'INPUT', array('name' => 'balance', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), '', 'tOOL TIP', '');
62
-			$account=array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', '');
62
+			$account = array('Account', 'INPUT', $params, 'required|integer|greater_than[0]|is_unique['.$account_val.']', 'tOOL TIP', '');
63 63
 			/*             * ******************************** */
64 64
 		} else {
65 65
 			$val = 'accounts.email';
66
-			$account_val='accounts.number';
66
+			$account_val = 'accounts.number';
67 67
 			 if (common_model::$global_config['system_config']['opensips'] == 0) {
68 68
 				$sip_device = array('Create Opensips Device', 'opensips_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_prorate');
69 69
 			} else {
70 70
 			  $sip_device = array('Create SIP Device', 'sip_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_prorate');   
71 71
 		}
72
-			$account = array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>');      
72
+			$account = array('Account', 'INPUT', $params, 'required|integer|greater_than[0]|is_unique['.$account_val.']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>');      
73 73
 			$password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20', 'class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>');
74
-			$balance = array('Balance', 'INPUT', array('name' => 'balance', 'size' => '20','class' => "text field medium"), '', 'tOOL TIP', '');
74
+			$balance = array('Balance', 'INPUT', array('name' => 'balance', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', '');
75 75
 		}
76 76
 		$pin = array('Pin', 'INPUT', array('name' => 'pin', 'value' => $pin_number, 'size' => '20', 'class' => "text field medium", 'id' => 'change_pin'), 'required|is_numeric', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Pin" class="change_pin fa fa-refresh" ></i>');
77
-		$form['forms'] = array(base_url() . 'accounts/' . $entity_type . '_save/'.$id."/", array("id" => "customer_form", "name" => "customer_form"));
77
+		$form['forms'] = array(base_url().'accounts/'.$entity_type.'_save/'.$id."/", array("id" => "customer_form", "name" => "customer_form"));
78 78
 		$form[gettext('Account Profile')] = array(
79 79
 		array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
80 80
 		array('', 'HIDDEN', array('name' => 'type', 'value' => $type), '', '', ''),
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
 			$password,
83 83
 			$pin,
84 84
 			array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '15', 'class' => "text field medium"), 'required', 'tOOL TIP', ''),
85
-			array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
85
+			array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
86 86
 			array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''),
87 87
 			array(gettext('Phone'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
88 88
 			array(gettext('Mobile'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
89
-			array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50',  'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', ''),
90
-			array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15',  'class' => "text field medium"), '', 'tOOL TIP', ''),
89
+			array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique['.$val.']', 'tOOL TIP', ''),
90
+			array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
91 91
 			array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
92
-			array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
93
-			array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15',  'class' => "text field medium"), '', 'tOOL TIP', ''),
94
-			array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
92
+			array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
93
+			array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
94
+			array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
95 95
 			array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', array("name" => "country_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''),
96 96
 			array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', array("name" => "timezone_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''),
97 97
 			array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array())
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 			array(gettext('Number Translation'), 'INPUT', array('name' => 'dialed_modify', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
106 106
 			array(gettext('Concurrent Calls'), 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', ''),
107 107
 			array(gettext('Interval'), 'INPUT', array('name' => 'interval', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', ''),
108
-			array(gettext('First Used'), 'INPUT', array('name' => 'first_used', 'size' => '20', 'readonly' => true,  'class' => "text field medium", 'value' => '0000-00-00 00:00:00'), '', 'tOOL TIP', ''),
108
+			array(gettext('First Used'), 'INPUT', array('name' => 'first_used', 'size' => '20', 'readonly' => true, 'class' => "text field medium", 'value' => '0000-00-00 00:00:00'), '', 'tOOL TIP', ''),
109 109
 		array(gettext('Account Valid Days'), 'INPUT', array('name' => 'validfordays', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
110
-		array(gettext('Expiry Date'), 'INPUT', array('name' => 'expiry', 'size' => '20',  'class' => "text field medium", 'value' => $expiry_date, 'id' => 'expiry'), '', 'tOOL TIP', ''),
110
+		array(gettext('Expiry Date'), 'INPUT', array('name' => 'expiry', 'size' => '20', 'class' => "text field medium", 'value' => $expiry_date, 'id' => 'expiry'), '', 'tOOL TIP', ''),
111 111
 		);
112 112
 		
113 113
 		$form[gettext('Billing Settings')] = array(
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 			array(gettext('LC Charge / Min'), 'INPUT', array('name' => 'charge_per_min', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),           
122 122
 			array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, "reseller_id" => $loginid), 'multi'),
123 123
 		);
124
-	if($id==0){
124
+	if ($id == 0) {
125 125
 	  $form[gettext('Alert Threshold')] = array(
126 126
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
127 127
 			array(gettext('Email Alerts ?'), 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'),
128
-			array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20',  'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''),
129
-			array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50',  'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''),
128
+			array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''),
129
+			array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''),
130 130
 	  );
131 131
 	}
132 132
 		$form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot');
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
 	}
139 139
 
140 140
 	function customer_alert_threshold($entity_type) {
141
-		$form['forms'] = array(base_url() . 'accounts/' . $entity_type . '_alert_threshold_save/' . $entity_type . "/", array("id" => "customer_alert_threshold", "name" => "customer_alert_threshold"));
141
+		$form['forms'] = array(base_url().'accounts/'.$entity_type.'_alert_threshold_save/'.$entity_type."/", array("id" => "customer_alert_threshold", "name" => "customer_alert_threshold"));
142 142
 		$form[gettext('Alert Threshold')] = array(
143 143
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
144 144
 			array(gettext('Email Alerts ?'), 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'),
145
-			array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20',  'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''),
146
-			array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50',  'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''),
145
+			array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''),
146
+			array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''),
147 147
 		);
148 148
 		$form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot');
149 149
 		return $form;
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
 				$sip_device = array(gettext('Create SIP Device'), 'sip_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status');
165 165
 			}
166 166
 		}
167
-		$form['forms'] = array(base_url() . 'accounts/customer_bulk_save/', array("id" => "customer_bulk_form", "name" => "customer_bulk_form"));
167
+		$form['forms'] = array(base_url().'accounts/customer_bulk_save/', array("id" => "customer_bulk_form", "name" => "customer_bulk_form"));
168 168
 		$form[gettext('General Details')] = array(
169
-			array(gettext('Account Count'), 'INPUT', array('name' => 'count', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
170
-			array(gettext('Start Prefix'), 'INPUT', array('name' => 'prefix', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
171
-			array(gettext('Acc. Number Length'), 'INPUT', array('name' => 'account_length', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
172
-			array(gettext('Company'), 'INPUT', array('name' => 'company_name',  'size' => '15', 'class' => 'text field medium'), 'trim|required|xss_clean', 'tOOL TIP', ''),
169
+			array(gettext('Account Count'), 'INPUT', array('name' => 'count', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
170
+			array(gettext('Start Prefix'), 'INPUT', array('name' => 'prefix', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
171
+			array(gettext('Acc. Number Length'), 'INPUT', array('name' => 'account_length', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
172
+			array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|required|xss_clean', 'tOOL TIP', ''),
173 173
 			array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', array("name" => "country_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''),
174 174
 			array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', array("name" => "timezone_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''),
175 175
 			array(gettext('Generate Pin'), 'pin', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_pin_allow_customer'),
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			array(gettext('Billing Schedule'), array('name' => 'sweep_id', 'id' => 'sweep_id', 'class' => 'sweep_id'), 'SELECT', '', '', 'tOOL TIP', '', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''),
185 185
 			array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'),
186 186
 			array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()),
187
-			array(gettext('Balance'), 'INPUT', array('name' => 'balance', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|greater_than[0]|currency_decimal|xss_clean', 'tOOL TIP', ''),
187
+			array(gettext('Balance'), 'INPUT', array('name' => 'balance', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|greater_than[0]|currency_decimal|xss_clean', 'tOOL TIP', ''),
188 188
 			array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), 'trim|currency_decimal|xss_clean', 'tOOL TIP', ''),
189 189
 			array(gettext('Valid Days'), 'INPUT', array('name' => 'validfordays', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
190 190
 		array(gettext('Allow Local Calls'), 'local_call', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'),
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	}
197 197
 
198 198
 	function get_customer_callerid_fields() {
199
-		$form['forms'] = array(base_url() . 'accounts/customer_add_callerid/', array("id" => "callerid_form"));
199
+		$form['forms'] = array(base_url().'accounts/customer_add_callerid/', array("id" => "callerid_form"));
200 200
 		$form[gettext('Information')] = array(
201 201
 			array('', 'HIDDEN', array('name' => 'flag'), '', '', '', ''),
202 202
 			array(gettext('Account'), 'INPUT', array('name' => 'accountid', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	}
211 211
 
212 212
 	function get_customer_payment_fields($currency, $number, $currency_id, $id) {
213
-		$form['forms'] = array(base_url() . 'accounts/customer_payment_save/', array('id' => 'acccount_charges_form', 'method' => 'POST', 'name' => 'acccount_charges_form'));
213
+		$form['forms'] = array(base_url().'accounts/customer_payment_save/', array('id' => 'acccount_charges_form', 'method' => 'POST', 'name' => 'acccount_charges_form'));
214 214
 		$form['​Refill information'] = array(
215 215
 			array('', 'HIDDEN', array('name' => 'id', 'value' => $id), '', '', '', ''),
216 216
 			array('', 'HIDDEN', array('name' => 'account_currency', 'value' => $currency_id), '', '', ''),
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 	function get_form_reseller_fields($id = false) {
228 228
 		$readable = false;
229 229
 		$invoice_config = null;
230
-		$concurrent_calls=null;
230
+		$concurrent_calls = null;
231 231
 		$logintype = $this->CI->session->userdata('logintype');
232 232
 		$uname = $this->CI->common->find_uniq_rendno(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts');
233 233
 		$password = $this->CI->common->generate_password();
234
-		$params=array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number','readonly'=>true);
234
+		$params = array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number', 'readonly'=>true);
235 235
 		if ($logintype == 1 || $logintype == 5) {
236 236
 			$account_data = $this->CI->session->userdata("accountinfo");
237 237
 			$loginid = $account_data['id'];
@@ -239,18 +239,18 @@  discard block
 block discarded – undo
239 239
 			$loginid = "0";
240 240
 		}
241 241
 		if ($id > 0) {
242
-			$val = 'accounts.email.' . $id;
243
-			$account_val='accounts.number.'.$id;
242
+			$val = 'accounts.email.'.$id;
243
+			$account_val = 'accounts.number.'.$id;
244 244
 			$readable = 'disabled';
245
-			$password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20',  'class' => "text field medium"), 'required|notMatch[number]|', 'tOOL TIP', '');
246
-			$concurrent_calls=array('Concurrent Calls', 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', '');
247
-			$account=array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', '');
245
+			$password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20', 'class' => "text field medium"), 'required|notMatch[number]|', 'tOOL TIP', '');
246
+			$concurrent_calls = array('Concurrent Calls', 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', '');
247
+			$account = array('Account', 'INPUT', $params, 'required|integer|greater_than[0]|is_unique['.$account_val.']', 'tOOL TIP', '');
248 248
 		} else {
249 249
 			$val = 'accounts.email';
250
-			$account_val='accounts.number';
250
+			$account_val = 'accounts.number';
251 251
 			$invoice_config = array('Use same credential for Invoice Config', 'invoice_config_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_prorate');
252 252
 			$password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20', 'class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>');
253
-			$account = array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>');
253
+			$account = array('Account', 'INPUT', $params, 'required|integer|greater_than[0]|is_unique['.$account_val.']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>');
254 254
 		}
255 255
 		if ($id == "") {
256 256
 			$reg_url = array('', 'HIDDEN', array('name' => 'id'), '', '', '', '');
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			$reg_url = array('Registration URL', 'INPUT', array('name' => 'registration_url', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'tOOL TIP', '');
259 259
 		}
260 260
 		/*         * ****************************************************************** */
261
-		$form['forms'] = array(base_url() . 'accounts/reseller_save/', array("id" => "reseller_form", "name" => "reseller_form"));
261
+		$form['forms'] = array(base_url().'accounts/reseller_save/', array("id" => "reseller_form", "name" => "reseller_form"));
262 262
 		$form['Client Panel Access'] = array(
263 263
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
264 264
 			array('', 'HIDDEN', array('name' => 'type', 'value' => '1'), '', '', ''),
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
 			array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'),
276 276
 			array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()),
277 277
 			array(gettext('Account Type'), array('name' => 'posttoexternal', 'disabled' => $readable, 'class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'),
278
-			array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
278
+			array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
279 279
 			array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, 'reseller_id' => $loginid), 'multi'),
280 280
 		);
281 281
 
282 282
 }
283
-else{
283
+else {
284 284
 			$form[gettext('Billing Information')] = array(
285 285
 			array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', array("name" => "pricelist_id", 'rules' => 'required'), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")),
286 286
             
@@ -288,31 +288,31 @@  discard block
 block discarded – undo
288 288
 			array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'),
289 289
 			array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()),
290 290
 			array(gettext('Account Type'), array('name' => 'posttoexternal', 'disabled' => $readable, 'class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'),
291
-			array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
291
+			array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
292 292
 			array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, 'reseller_id' => $loginid), 'multi'),
293 293
 			$invoice_config,
294 294
 		);
295 295
 	}
296 296
 		$form[gettext('Reseller Profile')] = array(
297
-			array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '50',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
298
-			array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
299
-			array(gettext('Company'), 'INPUT', array('name' => 'company_name',  'size' => '50', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''),
297
+			array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '50', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
298
+			array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
299
+			array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '50', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''),
300 300
 			array(gettext('Telephone 1'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
301 301
 			array(gettext('Telephone 2'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
302
-			array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', ''),
302
+			array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique['.$val.']', 'tOOL TIP', ''),
303 303
 			array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
304
-			array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15',  'class' => "text field medium"), '', 'tOOL TIP', ''),
304
+			array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
305 305
 			array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
306 306
 			array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
307
-			array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
307
+			array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
308 308
 			array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', array("name" => "country_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''),
309 309
 			array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', array("name" => "timezone_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''),
310 310
 			array(gettext('Account Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
311 311
 		);
312
-		if($id==0){
312
+		if ($id == 0) {
313 313
 	  $form[gettext('Alert Threshold')] = array(
314 314
 	  array('Email Alert?', 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'),
315
-		  array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
315
+		  array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
316 316
 		  array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''),
317 317
 	  );
318 318
 	}
@@ -323,24 +323,24 @@  discard block
 block discarded – undo
323 323
 
324 324
 	function get_form_admin_fields($entity_type = '', $id = false) {
325 325
 	  $uname = $this->CI->common->find_uniq_rendno(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts');
326
-	  $params=array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number','readonly'=>true);
326
+	  $params = array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number', 'readonly'=>true);
327 327
 		if ($id > 0) {
328
-			$val = 'accounts.email.' . $id;
329
-			$account_val='accounts.number.'.$id;
330
-			$password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20',  'class' => "text field medium"), 'required|notMatch[number]|', 'tOOL TIP', '');
331
-			$account=array('Account', 'INPUT',$params, 'required|is_unique[' . $account_val . ']', 'tOOL TIP', '');
328
+			$val = 'accounts.email.'.$id;
329
+			$account_val = 'accounts.number.'.$id;
330
+			$password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20', 'class' => "text field medium"), 'required|notMatch[number]|', 'tOOL TIP', '');
331
+			$account = array('Account', 'INPUT', $params, 'required|is_unique['.$account_val.']', 'tOOL TIP', '');
332 332
 		} else {
333 333
 			$val = 'accounts.email';
334
-			$account_val='accounts.number';
334
+			$account_val = 'accounts.number';
335 335
 			$password = $this->CI->common->generate_password();
336
-			$password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20','class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>');
337
-			$account = array('Account', 'INPUT',$params, 'required|is_unique[' . $account_val . ']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>');
336
+			$password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20', 'class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>');
337
+			$account = array('Account', 'INPUT', $params, 'required|is_unique['.$account_val.']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>');
338 338
 			/*             * ****************** */
339 339
 		}
340 340
 
341 341
         
342 342
 		$type = $entity_type == 'admin' ? 2 : 4;
343
-		$form['forms'] = array(base_url() . 'accounts/' . $entity_type . '_save/', array("id" => "admin_form", "name" => "admin_form"));
343
+		$form['forms'] = array(base_url().'accounts/'.$entity_type.'_save/', array("id" => "admin_form", "name" => "admin_form"));
344 344
 		$form['Client Panel Access'] = array(
345 345
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
346 346
 			array('', 'HIDDEN', array('name' => 'type', 'value' => $type), '', '', ''),
@@ -348,17 +348,17 @@  discard block
 block discarded – undo
348 348
 			$password,
349 349
 				/*                 * ********************* */
350 350
 		);
351
-		$form[gettext($entity_type . ' Profile')] = array(
351
+		$form[gettext($entity_type.' Profile')] = array(
352 352
 			array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '15', 'maxlength' => '40', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
353 353
 			array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter Password'),
354
-			array(gettext('Company'), 'INPUT', array('name' => 'company_name',  'size' => '15', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''),
355
-			array(gettext('Telephone 1'), 'INPUT', array('name' => 'telephone_1', 'size' => '15',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
354
+			array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''),
355
+			array(gettext('Telephone 1'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
356 356
 			array(gettext('Telephone 2'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
357
-			array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50',  'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', ''),
358
-			array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15','class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
359
-			array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
357
+			array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique['.$val.']', 'tOOL TIP', ''),
358
+			array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
359
+			array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
360 360
 			array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
361
-			array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
361
+			array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
362 362
 			array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter Password'),
363 363
 			array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''),
364 364
 			array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''),
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 		$form['forms'] = array("accounts/customer_batch_update/", array('id' => "reseller_batch_update"));
405 405
 		$form[gettext('Batch Update')] = array(
406 406
 			array(gettext('Rate Group'), array('name' => 'pricelist_id[pricelist_id]', 'id' => 'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0"), array('name' => 'pricelist_id[operator]', 'class' => 'update_drp'), 'update_drp_type'),
407
-			array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'id' => 'balance', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name' => 'balance[operator]', 'class' => 'update_drp'), '', '', '', 'update_int_type', ''),
407
+			array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'id' => 'balance', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name' => 'balance[operator]', 'class' => 'update_drp'), '', '', '', 'update_int_type', ''),
408 408
 			$status,
409 409
 		);
410 410
 		$form['button_search'] = array('name' => 'action', 'id' => "batch_update_btn", 'content' => gettext('Update'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 
420 420
 	function get_search_customer_form() {
421 421
 		$logintype = $this->CI->session->userdata('userlevel_logintype');
422
-		 if($logintype != 1){
422
+		 if ($logintype != 1) {
423 423
 		$form['forms'] = array("", array('id' => "account_search"));
424 424
 		$form[gettext('Search')] = array(
425 425
 			array(gettext('Account'), 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''),
@@ -525,15 +525,15 @@  discard block
 block discarded – undo
525 525
 	function build_account_list_for_admin() {
526 526
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
527 527
 		$grid_field_arr = json_encode(array(
528
-			array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
529
-			array(gettext("Account"), "135", "number", "number", "accounts", "account_number_icon", "EDITABLE","true","left"),
530
-			array(gettext("First Name"), "150", "first_name", "", "", "","","true","center"),
531
-			array(gettext("Last Name"), "150", "last_name", "", "", "","","true","center"),
532
-			array(gettext("Company"), "150", "company_name", "", "", "","","true","center"),
533
-			array(gettext("Email"), "170", "email", "", "", "","","true","center"),
534
-			array(gettext("Phone"), "150", "telephone_1", "", "", "","","true","center"),
535
-			array(gettext("Country"), "110", "country_id", "country", "countrycode", "get_field_name","","true","center"),
536
-			array(gettext("Status"), "110", "status", "status", "accounts", "get_status","","true","center"),
528
+			array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
529
+			array(gettext("Account"), "135", "number", "number", "accounts", "account_number_icon", "EDITABLE", "true", "left"),
530
+			array(gettext("First Name"), "150", "first_name", "", "", "", "", "true", "center"),
531
+			array(gettext("Last Name"), "150", "last_name", "", "", "", "", "true", "center"),
532
+			array(gettext("Company"), "150", "company_name", "", "", "", "", "true", "center"),
533
+			array(gettext("Email"), "170", "email", "", "", "", "", "true", "center"),
534
+			array(gettext("Phone"), "150", "telephone_1", "", "", "", "", "true", "center"),
535
+			array(gettext("Country"), "110", "country_id", "country", "countrycode", "get_field_name", "", "true", "center"),
536
+			array(gettext("Status"), "110", "status", "status", "accounts", "get_status", "", "true", "center"),
537 537
 			/*******************************************************************/
538 538
 			array("Action", "100", "", "", "", array(
539 539
 					"EDIT" => array("url" => "accounts/admin_edit/", "mode" => "single"),
@@ -545,24 +545,24 @@  discard block
 block discarded – undo
545 545
 
546 546
 	function build_account_list_for_customer() {
547 547
 	  $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
548
-	  $currency_id=$account_info['currency_id'];
549
-	  $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
548
+	  $currency_id = $account_info['currency_id'];
549
+	  $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
550 550
       
551 551
 	  // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
552 552
 	  $grid_field_arr = json_encode(array(
553
-		array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "","","","","false","center"),
554
-		array(gettext("Account"), "125", "number", "number", "accounts", "account_number_icon", "EDITABLE","true","left"),
555
-			array(gettext("First Name"), "95", "first_name", "", "", "","","true","center"),
556
-			array(gettext("Last Name"), "95", "last_name", "", "", "","","true","center"),
557
-			array(gettext("Company"), "85", "company_name", "", "", "","","true","center"),
558
-			array(gettext("Rate Group"), "85", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
559
-			array(gettext("Balance")." ($currency)", "100", "balance", "balance", "balance", "convert_to_currency_account","","true","right"),
560
-			array(gettext("Credit Limit")." ($currency)", "120", "credit_limit", "credit_limit", "credit_limit", "convert_to_currency_account","","true","right"),
561
-			array(gettext("First Used"), "80", "first_used", "", "", "","","true","center"),
562
-			array(gettext("Expiry Date"), "80", "expiry", "", "", "","","true","center"),
563
-			array("CC", "45", "maxchannels", "", "", "","","true","center"),
564
-			array(gettext("Status"), "90", "status", "status", "accounts", "get_status","","true","center"),
565
-			array(gettext("Created Date"), "90", "creation", "", "", "","","true","center"),
553
+		array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
554
+		array(gettext("Account"), "125", "number", "number", "accounts", "account_number_icon", "EDITABLE", "true", "left"),
555
+			array(gettext("First Name"), "95", "first_name", "", "", "", "", "true", "center"),
556
+			array(gettext("Last Name"), "95", "last_name", "", "", "", "", "true", "center"),
557
+			array(gettext("Company"), "85", "company_name", "", "", "", "", "true", "center"),
558
+			array(gettext("Rate Group"), "85", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
559
+			array(gettext("Balance")." ($currency)", "100", "balance", "balance", "balance", "convert_to_currency_account", "", "true", "right"),
560
+			array(gettext("Credit Limit")." ($currency)", "120", "credit_limit", "credit_limit", "credit_limit", "convert_to_currency_account", "", "true", "right"),
561
+			array(gettext("First Used"), "80", "first_used", "", "", "", "", "true", "center"),
562
+			array(gettext("Expiry Date"), "80", "expiry", "", "", "", "", "true", "center"),
563
+			array("CC", "45", "maxchannels", "", "", "", "", "true", "center"),
564
+			array(gettext("Status"), "90", "status", "status", "accounts", "get_status", "", "true", "center"),
565
+			array(gettext("Created Date"), "90", "creation", "", "", "", "", "true", "center"),
566 566
 			/************************************************************************/
567 567
 			array(gettext("Action"), "140", "", "", "", array("PAYMENT" => array("url" => "accounts/customer_payment_process_add/", "mode" => "single"),
568 568
 					"CALLERID" => array("url" => "accounts/customer_add_callerid/", "mode" => "popup"),
@@ -574,21 +574,21 @@  discard block
 block discarded – undo
574 574
 
575 575
 	function build_account_list_for_reseller() {
576 576
 	$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
577
-	$currency_id=$account_info['currency_id'];
578
-	$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
577
+	$currency_id = $account_info['currency_id'];
578
+	$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
579 579
 	
580 580
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
581
-		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
582
-			array(gettext("Account"), "105", "number", "", "", "", "EDITABLE","true","center"),
583
-			array(gettext("First Name"), "120", "first_name", "", "", "","","true","center"),
584
-			array(gettext("Last Name"), "115", "last_name", "", "", "","","true","center"),
585
-			array(gettext("Company"), "130", "company_name", "", "", "","","true","center"),
586
-			array(gettext("Rate Group"), "95", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
587
-			array(gettext("Account Type"), "107", "posttoexternal", "posttoexternal", "posttoexternal", "get_account_type","","true","center"),
588
-			array(gettext("Balance")." ($currency)", "100", "balance", "balance", "balance", "convert_to_currency","","true","right"),
589
-			array(gettext("Credit Limit")." ($currency)", "120", "credit_limit", "credit_limit", "credit_limit", "convert_to_currency","","true","right"),
590
-			array(gettext("Status"), "110", "status", "status", "accounts", "get_status","","true","center"),
591
-			array(gettext("Created Date"), "90", "creation", "", "", "","","true","center"),          
581
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
582
+			array(gettext("Account"), "105", "number", "", "", "", "EDITABLE", "true", "center"),
583
+			array(gettext("First Name"), "120", "first_name", "", "", "", "", "true", "center"),
584
+			array(gettext("Last Name"), "115", "last_name", "", "", "", "", "true", "center"),
585
+			array(gettext("Company"), "130", "company_name", "", "", "", "", "true", "center"),
586
+			array(gettext("Rate Group"), "95", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
587
+			array(gettext("Account Type"), "107", "posttoexternal", "posttoexternal", "posttoexternal", "get_account_type", "", "true", "center"),
588
+			array(gettext("Balance")." ($currency)", "100", "balance", "balance", "balance", "convert_to_currency", "", "true", "right"),
589
+			array(gettext("Credit Limit")." ($currency)", "120", "credit_limit", "credit_limit", "credit_limit", "convert_to_currency", "", "true", "right"),
590
+			array(gettext("Status"), "110", "status", "status", "accounts", "get_status", "", "true", "center"),
591
+			array(gettext("Created Date"), "90", "creation", "", "", "", "", "true", "center"),          
592 592
 			/**************************************************************/
593 593
 			array("Action", "139", "", "", "", array("PAYMENT" => array("url" => "accounts/customer_payment_process_add/", "mode" => "single"),
594 594
 					"CALLERID" => array("url" => "accounts/customer_add_callerid/", "mode" => 'popup'),
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 			 // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
609 609
 		$buttons_json = json_encode(array(
610 610
 			array(gettext("Create Customer"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add/"),
611
-			array(gettext("Mass Create"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_bulk_creation/", "popup","medium"),
611
+			array(gettext("Mass Create"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_bulk_creation/", "popup", "medium"),
612 612
 			$provider,
613 613
 			array(gettext("Export"), "btn btn-xing", " fa fa-download fa-lg", "button_action", "/accounts/customer_export_cdr_xls/", 'single'),
614 614
 			array(gettext("Delete"), "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/accounts/customer_selected_delete/")
@@ -636,23 +636,23 @@  discard block
 block discarded – undo
636 636
 
637 637
 	function build_ip_list_for_customer($accountid, $accountype) {
638 638
 		$grid_field_arr = json_encode(array(
639
-			array(gettext('Name'), "180", "name", "", "", "","","true","center"),
640
-			array(gettext('IP'), "180", "ip", "", "", "","","true","center"),
641
-			array(gettext('Prefix'), "180", "prefix", "", "", "","","true","center"),
642
-			array(gettext('Created Date'), "174", "created_date", "created_date", "created_date", "convert_GMT_to","","true","center"),
643
-			array(gettext('Modified Date'), "160", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
644
-			array(gettext('Action'), "150", "", "", "", array("DELETE" => array("url" => "accounts/" . $accountype . "_ipmap_action/delete/$accountid/$accountype/", "mode" => "single")))
639
+			array(gettext('Name'), "180", "name", "", "", "", "", "true", "center"),
640
+			array(gettext('IP'), "180", "ip", "", "", "", "", "true", "center"),
641
+			array(gettext('Prefix'), "180", "prefix", "", "", "", "", "true", "center"),
642
+			array(gettext('Created Date'), "174", "created_date", "created_date", "created_date", "convert_GMT_to", "", "true", "center"),
643
+			array(gettext('Modified Date'), "160", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
644
+			array(gettext('Action'), "150", "", "", "", array("DELETE" => array("url" => "accounts/".$accountype."_ipmap_action/delete/$accountid/$accountype/", "mode" => "single")))
645 645
 				));
646 646
 		return $grid_field_arr;
647 647
 	}
648 648
 
649 649
 	function build_animap_list_for_customer($accountid, $accounttype) {
650 650
 		$grid_field_arr = json_encode(array(
651
-			array(gettext("Caller ID"), "200", "number", "", "", "","","true","center"),
652
-			array(gettext("Status"), "180", "status", "status", "ani_map", "get_status_new","","true","center"),
653
-			array(gettext("Created Date"), "200", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
654
-			array(gettext("Modified Date"), "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
655
-			array(gettext("Action"), "200", "", "", "", array("DELETE" => array("url" => "accounts/" . $accounttype . "_animap_action/delete/$accountid/", "mode" => "single")))
651
+			array(gettext("Caller ID"), "200", "number", "", "", "", "", "true", "center"),
652
+			array(gettext("Status"), "180", "status", "status", "ani_map", "get_status_new", "", "true", "center"),
653
+			array(gettext("Created Date"), "200", "creation_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"),
654
+			array(gettext("Modified Date"), "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
655
+			array(gettext("Action"), "200", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_animap_action/delete/$accountid/", "mode" => "single")))
656 656
 				));
657 657
 		return $grid_field_arr;
658 658
 	}
@@ -668,13 +668,13 @@  discard block
 block discarded – undo
668 668
 
669 669
 	function set_block_pattern_action_buttons($id) {
670 670
 		$ret_url = '';
671
-		$ret_url .= '<a href="/did/delete/' . $id . '/" class="icon delete_image" title="Delete" onClick="return get_alert_msg();">&nbsp;</a>';
671
+		$ret_url .= '<a href="/did/delete/'.$id.'/" class="icon delete_image" title="Delete" onClick="return get_alert_msg();">&nbsp;</a>';
672 672
 		return $ret_url;
673 673
 	}
674 674
 
675 675
 	function build_animap_list() {
676 676
 		$grid_field_arr = json_encode(array(array("Caller ID", "180", "number", "", "", ""),
677
-			array(gettext("status"),"180","status","status","animap","get_status"),    
677
+			array(gettext("status"), "180", "status", "status", "animap", "get_status"),    
678 678
 			array(gettext("Action"), "130", "", "", "",
679 679
 				array(
680 680
 					"EDIT_ANIMAP" => array("url" => "accounts/callingcards_animap_list_edit/", "mode" => "single"),
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if (!defined('BASEPATH')) {
25 25
 	exit('No direct script access allowed');
26
+}
26 27
 
27 28
 class Accounts_form {
28 29
 	function __construct($library_name = '') {
@@ -279,8 +280,7 @@  discard block
 block discarded – undo
279 280
 			array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, 'reseller_id' => $loginid), 'multi'),
280 281
 		);
281 282
 
282
-}
283
-else{
283
+} else{
284 284
 			$form[gettext('Billing Information')] = array(
285 285
 			array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', array("name" => "pricelist_id", 'rules' => 'required'), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")),
286 286
             
@@ -442,8 +442,7 @@  discard block
 block discarded – undo
442 442
 			array('', 'HIDDEN', 'advance_search', '1', '', '', '')
443 443
 		);
444 444
         
445
-		}
446
-		else
445
+		} else
447 446
 		{
448 447
 		
449 448
 		$form['forms'] = array("", array('id' => "account_search"));
@@ -603,8 +602,9 @@  discard block
 block discarded – undo
603 602
 	function build_grid_buttons_customer() {
604 603
 		$logintype = $this->CI->session->userdata('userlevel_logintype');
605 604
 		$provider = null;
606
-		if ($logintype != 1)
607
-			$provider = array(gettext("Create Provider"), "btn btn-line-blue btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/provider_add/");
605
+		if ($logintype != 1) {
606
+					$provider = array(gettext("Create Provider"), "btn btn-line-blue btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/provider_add/");
607
+		}
608 608
 			 // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
609 609
 		$buttons_json = json_encode(array(
610 610
 			array(gettext("Create Customer"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add/"),
Please login to merge, or discard this patch.