Passed
Branch v3.5 (f0ef26)
by Samir
36:09
created
freeswitch/fs/index.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
 // ##############################################################################
23 23
 
24 24
 // Error handling
25
-define ( 'ENVIRONMENT', 'production' );
25
+define('ENVIRONMENT', 'production');
26 26
 
27
-if (defined ( 'ENVIRONMENT' )) {
27
+if (defined('ENVIRONMENT')) {
28 28
 	switch (ENVIRONMENT) {
29 29
 		case 'development' :
30
-			error_reporting ( E_ALL );
30
+			error_reporting(E_ALL);
31 31
 			break;
32 32
 		
33 33
 		case 'testing' :
34 34
 		case 'production' :
35
-			error_reporting ( 0 );
35
+			error_reporting(0);
36 36
 			break;
37 37
 		
38 38
 		default :
39
-			error_reporting ( E_ALL );
39
+			error_reporting(E_ALL);
40 40
 	}
41 41
 }
42 42
 
@@ -47,20 +47,20 @@  discard block
 block discarded – undo
47 47
 include ("lib/astpp.lib.php");
48 48
 
49 49
 // Define db object
50
-$db = new db ();
50
+$db = new db();
51 51
 
52 52
 // Get default configuration
53
-$lib = new lib ();
53
+$lib = new lib();
54 54
 
55
-$config = $lib->get_configurations ( $db );
55
+$config = $lib->get_configurations($db);
56 56
 // echo "<pre>";print_r($config);exit;
57 57
 // Define logger object
58
-$logger = new logger ( $lib );
58
+$logger = new logger($lib);
59 59
 // set_error_handler('xml_not_found');
60 60
 
61 61
 // Define file name
62
-$file = "astpp." . $_REQUEST ['section'] . ".php";
62
+$file = "astpp.".$_REQUEST ['section'].".php";
63 63
 
64 64
 // Include file
65
-include_once ("scripts/" . $file);
65
+include_once ("scripts/".$file);
66 66
 ?>
Please login to merge, or discard this patch.
web_interface/astpp/cron/cron.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,30 +2,30 @@  discard block
 block discarded – undo
2 2
 <?php
3 3
 // Run: php cron.php controller/method/
4 4
 // Block non-CLI calls
5
-define ( 'CRON', TRUE );
5
+define('CRON', TRUE);
6 6
 
7 7
 // Load CRON config
8 8
 require ('../application/config/cron.php');
9 9
 
10 10
 // Set CRON mode ( live or beta )
11
-define ( 'CRON_BETA_MODE', $config ['CRON_BETA_MODE'] );
11
+define('CRON_BETA_MODE', $config ['CRON_BETA_MODE']);
12 12
 
13 13
 // Set index.php location
14
-if (isset ( $config ['CRON_CI_INDEX'] ) && $config ['CRON_CI_INDEX'])
15
-	define ( 'CRON_CI_INDEX', $config ['CRON_CI_INDEX'] );
14
+if (isset ($config ['CRON_CI_INDEX']) && $config ['CRON_CI_INDEX'])
15
+	define('CRON_CI_INDEX', $config ['CRON_CI_INDEX']);
16 16
 else
17
-	define ( 'CRON_CI_INDEX', '../index.php' );
17
+	define('CRON_CI_INDEX', '../index.php');
18 18
 
19
-if (count ( $argv ) <= 2)
20
-	if (count ( $config ['argv'] )) {
19
+if (count($argv) <= 2)
20
+	if (count($config ['argv'])) {
21 21
 		$path = $argv [1];
22
-		unset ( $argv [1] );
22
+		unset ($argv [1]);
23 23
 		// $argv = array_merge($argv, $config["argv"][$path]);
24 24
 		$argv [0] = $argv [0];
25 25
 		$argv [1] = $config ["argv"] [$path];
26 26
 		$_SERVER ['argv'] = $argv;
27 27
 	} else
28
-		die ( 'Use: php cron.php controller/method' );
28
+		die ('Use: php cron.php controller/method');
29 29
 	
30 30
 	// Simulate an HTTP request
31 31
 $_SERVER ['PATH_INFO'] = $argv [1];
@@ -35,20 +35,20 @@  discard block
 block discarded – undo
35 35
 // print_r($_SERVER); exit;
36 36
 
37 37
 // Set run time limit
38
-set_time_limit ( $config ['CRON_TIME_LIMIT'] );
38
+set_time_limit($config ['CRON_TIME_LIMIT']);
39 39
 
40 40
 // Run CI and capture the output
41
-ob_start ();
41
+ob_start();
42 42
 
43 43
 // chdir( dirname( CRON_CI_INDEX ) );
44 44
 require (CRON_CI_INDEX); // main CI index.php file
45
-$output = ob_get_contents ();
45
+$output = ob_get_contents();
46 46
 
47 47
 if (CRON_FLUSH_BUFFERS === TRUE)
48
-	while ( @ob_end_flush () )
48
+	while (@ob_end_flush())
49 49
 		; // display buffer contents
50 50
 else
51
-	ob_end_clean ();
51
+	ob_end_clean();
52 52
 
53 53
 echo "\n";
54 54
 ?>
Please login to merge, or discard this patch.
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,21 +11,24 @@  discard block
 block discarded – undo
11 11
 define ( 'CRON_BETA_MODE', $config ['CRON_BETA_MODE'] );
12 12
 
13 13
 // Set index.php location
14
-if (isset ( $config ['CRON_CI_INDEX'] ) && $config ['CRON_CI_INDEX'])
14
+if (isset ( $config ['CRON_CI_INDEX'] ) && $config ['CRON_CI_INDEX']) {
15 15
 	define ( 'CRON_CI_INDEX', $config ['CRON_CI_INDEX'] );
16
-else
16
+} else {
17 17
 	define ( 'CRON_CI_INDEX', '../index.php' );
18
+}
18 19
 
19
-if (count ( $argv ) <= 2)
20
+if (count ( $argv ) <= 2) {
20 21
 	if (count ( $config ['argv'] )) {
21 22
 		$path = $argv [1];
23
+}
22 24
 		unset ( $argv [1] );
23 25
 		// $argv = array_merge($argv, $config["argv"][$path]);
24 26
 		$argv [0] = $argv [0];
25 27
 		$argv [1] = $config ["argv"] [$path];
26 28
 		$_SERVER ['argv'] = $argv;
27
-	} else
28
-		die ( 'Use: php cron.php controller/method' );
29
+	} else {
30
+			die ( 'Use: php cron.php controller/method' );
31
+	}
29 32
 	
30 33
 	// Simulate an HTTP request
31 34
 $_SERVER ['PATH_INFO'] = $argv [1];
@@ -44,11 +47,14 @@  discard block
 block discarded – undo
44 47
 require (CRON_CI_INDEX); // main CI index.php file
45 48
 $output = ob_get_contents ();
46 49
 
47
-if (CRON_FLUSH_BUFFERS === TRUE)
50
+if (CRON_FLUSH_BUFFERS === TRUE) {
48 51
 	while ( @ob_end_flush () )
49
-		; // display buffer contents
50
-else
52
+		;
53
+}
54
+// display buffer contents
55
+else {
51 56
 	ob_end_clean ();
57
+}
52 58
 
53 59
 echo "\n";
54 60
 ?>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/accounts/models/accounts_model.php 2 patches
Spacing   +299 added lines, -299 removed lines patch added patch discarded remove patch
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class Accounts_model extends CI_Model {
25 25
 	function Accounts_model() {
26
-		parent::__construct ();
26
+		parent::__construct();
27 27
 	}
28 28
 	function add_account($accountinfo) {
29
-		$account_data = $this->session->userdata ( "accountinfo" );
29
+		$account_data = $this->session->userdata("accountinfo");
30 30
 		$accountinfo ['reseller_id'] = ($account_data ['type'] == 1) ? $account_data ['id'] : 0;
31 31
 		// $accountinfo['maxchannels'] = ($accountinfo['type'] == 1 || $account_data['type'] == 2 || $account_data['type'] == -1 ) ? "0" : $accountinfo['maxchannels'];
32
-		unset ( $accountinfo ['action'] );
33
-		$sip_flag = isset ( $accountinfo ['sip_device_flag'] ) ? 1 : 0;
34
-		$opensip_flag = isset ( $accountinfo ['opensips_device_flag'] ) ? 1 : 0;
35
-		unset ( $accountinfo ['sip_device_flag'], $accountinfo ['opensips_device_flag'], $accountinfo ['tax_id'] );
32
+		unset ($accountinfo ['action']);
33
+		$sip_flag = isset ($accountinfo ['sip_device_flag']) ? 1 : 0;
34
+		$opensip_flag = isset ($accountinfo ['opensips_device_flag']) ? 1 : 0;
35
+		unset ($accountinfo ['sip_device_flag'], $accountinfo ['opensips_device_flag'], $accountinfo ['tax_id']);
36 36
 		
37 37
 		/* * ******************************** */
38
-		$accountinfo ['creation'] = gmdate ( 'Y-m-d H:i:s' );
39
-		$accountinfo ['expiry'] = gmdate ( 'Y-m-d H:i:s', strtotime ( '+20 years' ) );
38
+		$accountinfo ['creation'] = gmdate('Y-m-d H:i:s');
39
+		$accountinfo ['expiry'] = gmdate('Y-m-d H:i:s', strtotime('+20 years'));
40 40
 		/*
41 41
 		 * if(isset($accountinfo['is_recording'])){
42 42
 		 * $accountinfo['is_recording']=0;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		 * $accountinfo['allow_ip_management']=1;
50 50
 		 * }
51 51
 		 */
52
-		if (isset ( $accountinfo ['local_call'] )) {
52
+		if (isset ($accountinfo ['local_call'])) {
53 53
 			$accountinfo ['local_call'] = 0;
54 54
 		} else {
55 55
 			$accountinfo ['local_call'] = 1;
@@ -59,28 +59,28 @@  discard block
 block discarded – undo
59 59
 		} else {
60 60
 			$invoice_config = "";
61 61
 		}
62
-		unset ( $accountinfo ['invoice_config_flag'] );
63
-		$result = $this->db->insert ( 'accounts', $accountinfo );
64
-		$last_id = $this->db->insert_id ();
62
+		unset ($accountinfo ['invoice_config_flag']);
63
+		$result = $this->db->insert('accounts', $accountinfo);
64
+		$last_id = $this->db->insert_id();
65 65
 		/**
66 66
 		 * ASTPP 3.0
67 67
 		 * For Invoice Configuration
68 68
 		 */
69
-		if ($accountinfo ['type'] == 1 && isset ( $invoice_config ) && $invoice_config == "0") {
69
+		if ($accountinfo ['type'] == 1 && isset ($invoice_config) && $invoice_config == "0") {
70 70
 			if ($accountinfo ['country_id'] == NULL) {
71 71
 				$accountinfo ['country_id'] = "";
72 72
 			} else {
73
-				$data = $this->db_model->getSelect ( "country", "countrycode", array (
73
+				$data = $this->db_model->getSelect("country", "countrycode", array(
74 74
 						"id" => $accountinfo ['country_id'] 
75
-				) );
76
-				$data = $data->result_array ();
75
+				));
76
+				$data = $data->result_array();
77 77
 				$country_name = $data [0];
78 78
 			}
79 79
 			if ($accountinfo ['postal_code'] == NULL) {
80 80
 				$accountinfo ['postal_code'] = "";
81 81
 			}
82 82
 			
83
-			$invoice_config = array (
83
+			$invoice_config = array(
84 84
 					'accountid' => $last_id,
85 85
 					'company_name' => $accountinfo ['company_name'],
86 86
 					'address' => $accountinfo ['address_1'],
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 					'telephone' => $accountinfo ['telephone_1'],
92 92
 					'emailaddress' => $accountinfo ['email'] 
93 93
 			);
94
-			$this->db->where ( 'account_id', $accountinfo ['id'] );
95
-			$this->db->insert ( 'invoice_conf', $invoice_config );
94
+			$this->db->where('account_id', $accountinfo ['id']);
95
+			$this->db->insert('invoice_conf', $invoice_config);
96 96
 		}
97 97
 		if ($sip_flag == '1') {
98
-			$this->db->select ( 'id' );
99
-			$this->db->where ( 'name', 'default' );
100
-			$sipprofile_result = ( array ) $this->db->get ( 'sip_profiles' )->first_row ();
101
-			$free_switch_array = array (
98
+			$this->db->select('id');
99
+			$this->db->where('name', 'default');
100
+			$sipprofile_result = (array)$this->db->get('sip_profiles')->first_row();
101
+			$free_switch_array = array(
102 102
 					'fs_username' => $accountinfo ['number'],
103
-					'fs_password' => $this->common->decode ( $accountinfo ['password'] ),
103
+					'fs_password' => $this->common->decode($accountinfo ['password']),
104 104
 					'context' => 'default',
105 105
 					'effective_caller_id_name' => $accountinfo ['number'],
106 106
 					'effective_caller_id_number' => $accountinfo ['number'],
@@ -109,33 +109,33 @@  discard block
 block discarded – undo
109 109
 					'accountcode' => $last_id,
110 110
 					'status' => $accountinfo ['status'],
111 111
 					'voicemail_enabled' => "true",
112
-					'vm-password' => $this->common->decode ( $accountinfo ['password'] ),
112
+					'vm-password' => $this->common->decode($accountinfo ['password']),
113 113
 					'voicemail_mail_to' => $accountinfo ['email'],
114 114
 					'voicemail_attach_file' => "true",
115 115
 					'vm_keep_local_after_email' => "true",
116 116
 					"vm_send_all_message" => "true" 
117 117
 			);
118
-			$this->load->model ( 'freeswitch/freeswitch_model' );
119
-			$this->freeswitch_model->add_freeswith ( $free_switch_array );
118
+			$this->load->model('freeswitch/freeswitch_model');
119
+			$this->freeswitch_model->add_freeswith($free_switch_array);
120 120
 		}
121 121
 		if ($opensip_flag == 1) {
122
-			$opensips_array = array (
122
+			$opensips_array = array(
123 123
 					'username' => $accountinfo ['number'],
124 124
 					'domain' => common_model::$global_config ['system_config'] ['opensips_domain'],
125 125
 					'password' => $accountinfo ['password'],
126 126
 					'accountcode' => $accountinfo ['number'],
127 127
 					'pricelist_id' => $accountinfo ['pricelist_id'] 
128 128
 			);
129
-			$this->load->model ( 'opensips/opensips_model' );
130
-			$this->opensips_model->add_opensipsdevices ( $opensips_array );
129
+			$this->load->model('opensips/opensips_model');
130
+			$this->opensips_model->add_opensipsdevices($opensips_array);
131 131
 		}
132
-		$accountinfo ['confirm'] = base_url ();
132
+		$accountinfo ['confirm'] = base_url();
133 133
 		if ($accountinfo ['id'] == "") {
134 134
 			$accountinfo ['id'] = $last_id;
135 135
 		}
136
-		$accountinfo ['password'] = $this->common->decode ( $accountinfo ['password'] );
136
+		$accountinfo ['password'] = $this->common->decode($accountinfo ['password']);
137 137
 		
138
-		$this->common->mail_to_users ( 'email_add_user', $accountinfo );
138
+		$this->common->mail_to_users('email_add_user', $accountinfo);
139 139
 		return $last_id;
140 140
 	}
141 141
 	
@@ -144,27 +144,27 @@  discard block
 block discarded – undo
144 144
 	 * Reseller Batch Update
145 145
 	 */
146 146
 	function reseller_rates_batch_update($update_array) {
147
-		unset ( $update_array ['action'] );
147
+		unset ($update_array ['action']);
148 148
 		$update_array ['type'] = 1;
149
-		$date = gmdate ( "Y-m-d h:i:s" );
150
-		$this->db_model->build_search ( 'reseller_list_search' );
149
+		$date = gmdate("Y-m-d h:i:s");
150
+		$this->db_model->build_search('reseller_list_search');
151 151
 		if ($update_array ['type'] == 1) {
152
-			$this->db_model->build_batch_update_array ( $update_array );
153
-			$login_type = $this->session->userdata ( 'logintype' );
152
+			$this->db_model->build_batch_update_array($update_array);
153
+			$login_type = $this->session->userdata('logintype');
154 154
 			$reseller_info = $this->session->userdata ['accountinfo'];
155 155
 			if ($reseller_info ['type'] == 1) {
156
-				$this->db->where ( 'reseller_id', $reseller_info ['id'] );
156
+				$this->db->where('reseller_id', $reseller_info ['id']);
157 157
 			} else {
158
-				$this->db->where ( 'reseller_id', '0' );
158
+				$this->db->where('reseller_id', '0');
159 159
 			}
160
-			$this->db->where ( 'type', '1' );
161
-			$this->db->update ( "accounts" );
162
-			$this->db_model->build_search ( 'reseller_list_search' );
163
-			if (isset ( $update_array ['balance'] ['balance'] ) && $update_array ['balance'] ['balance'] != '') {
164
-				$search_flag = $this->db_model->build_search ( 'reseller_list_search' );
165
-				$account_data = $this->session->userdata ( "accountinfo" );
160
+			$this->db->where('type', '1');
161
+			$this->db->update("accounts");
162
+			$this->db_model->build_search('reseller_list_search');
163
+			if (isset ($update_array ['balance'] ['balance']) && $update_array ['balance'] ['balance'] != '') {
164
+				$search_flag = $this->db_model->build_search('reseller_list_search');
165
+				$account_data = $this->session->userdata("accountinfo");
166 166
 				if ($account_data ['type'] == 1) {
167
-					$where = array (
167
+					$where = array(
168 168
 							'type' => 1,
169 169
 							"balance" => $update_array ['balance'] ['balance'],
170 170
 							"reseller_id" => $account_data ['id'],
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 							'status' => '0' 
173 173
 					);
174 174
 				} else {
175
-					$where = array (
175
+					$where = array(
176 176
 							'type' => 1,
177 177
 							"balance" => $update_array ['balance'] ['balance'],
178 178
 							'deleted' => '0',
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 					);
181 181
 				}
182 182
 				
183
-				$this->db_model->build_search ( 'reseller_list_search' );
184
-				$query_pricelist = $this->db_model->getSelect ( "id,reseller_id,balance", "accounts", $where );
183
+				$this->db_model->build_search('reseller_list_search');
184
+				$query_pricelist = $this->db_model->getSelect("id,reseller_id,balance", "accounts", $where);
185 185
 				if ($query_pricelist->num_rows > 0) {
186 186
 					$description = '';
187 187
 					if ($update_array ['balance'] ['operator'] == '2') {
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 					if ($update_array ['balance'] ['operator'] == '4') {
194 194
 						$description .= "Reseller update descrise balance by admin";
195 195
 					}
196
-					foreach ( $query_pricelist->result_array () as $key => $reseller_payment ) {
197
-						if (! empty ( $reseller_payment ['reseller_id'] ) && $reseller_payment ['reseller_id'] != '') {
196
+					foreach ($query_pricelist->result_array() as $key => $reseller_payment) {
197
+						if ( ! empty ($reseller_payment ['reseller_id']) && $reseller_payment ['reseller_id'] != '') {
198 198
 							$payment_by = $reseller_payment ['reseller_id'];
199 199
 						} else {
200 200
 							$payment_by = '-1';
201 201
 						}
202
-						$insert_arr = array (
202
+						$insert_arr = array(
203 203
 								"accountid" => $reseller_payment ['id'],
204 204
 								"credit" => $update_array ['balance'] ['balance'],
205 205
 								'payment_mode' => 0,
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 								'payment_by' => $payment_by,
210 210
 								'reseller_id' => $reseller_payment ['reseller_id'] 
211 211
 						);
212
-						$this->db->insert ( "payments", $insert_arr );
212
+						$this->db->insert("payments", $insert_arr);
213 213
 					}
214 214
 				}
215 215
 			}
@@ -222,31 +222,31 @@  discard block
 block discarded – undo
222 222
 	 * Customer Batch Update
223 223
 	 */
224 224
 	function customer_rates_batch_update($update_array) {
225
-		unset ( $update_array ['action'] );
226
-		$date = gmdate ( "Y-m-d h:i:s" );
227
-		$this->db_model->build_search ( 'customer_list_search' );
225
+		unset ($update_array ['action']);
226
+		$date = gmdate("Y-m-d h:i:s");
227
+		$this->db_model->build_search('customer_list_search');
228 228
 		$reseller_info = $this->session->userdata ['accountinfo'];
229 229
 		if ($reseller_info ['type'] == 1) {
230
-			$this->db->where ( 'reseller_id', $reseller_info ['id'] );
230
+			$this->db->where('reseller_id', $reseller_info ['id']);
231 231
 		} else {
232
-			$this->db->where ( 'reseller_id', '0' );
233
-		}
234
-		$this->db_model->build_search ( 'customer_list_search' );
235
-		$this->db->where ( 'type !=', '1' );
236
-		$this->db_model->build_batch_update_array ( $update_array );
237
-		$this->db->update ( "accounts" );
238
-		if (isset ( $update_array ['balance'] ['balance'] ) && $update_array ['balance'] ['balance'] != '') {
239
-			$account_data = $this->session->userdata ( "accountinfo" );
232
+			$this->db->where('reseller_id', '0');
233
+		}
234
+		$this->db_model->build_search('customer_list_search');
235
+		$this->db->where('type !=', '1');
236
+		$this->db_model->build_batch_update_array($update_array);
237
+		$this->db->update("accounts");
238
+		if (isset ($update_array ['balance'] ['balance']) && $update_array ['balance'] ['balance'] != '') {
239
+			$account_data = $this->session->userdata("accountinfo");
240 240
 			
241 241
 			if ($account_data ['type'] == 1) {
242
-				$where = array (
242
+				$where = array(
243 243
 						'type' => 1,
244 244
 						"reseller_id" => $account_data ['id'],
245 245
 						'deleted' => '0',
246 246
 						'status' => '0' 
247 247
 				);
248 248
 			} else {
249
-				$where = array (
249
+				$where = array(
250 250
 						'type !=' => '-1',
251 251
 						"balance" => $update_array ['balance'] ['balance'],
252 252
 						'deleted' => '0',
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 				);
255 255
 			}
256 256
 			
257
-			$this->db_model->build_search ( 'customer_list_search' );
258
-			$query_pricelist = $this->db_model->getSelect ( "id,reseller_id,balance", "accounts", $where );
257
+			$this->db_model->build_search('customer_list_search');
258
+			$query_pricelist = $this->db_model->getSelect("id,reseller_id,balance", "accounts", $where);
259 259
 			if ($query_pricelist->num_rows > 0) {
260 260
 				$description = '';
261 261
 				if ($update_array ['balance'] ['operator'] == '2') {
@@ -267,13 +267,13 @@  discard block
 block discarded – undo
267 267
 				if ($update_array ['balance'] ['operator'] == '4') {
268 268
 					$description .= "Customer update descrise balance by admin";
269 269
 				}
270
-				foreach ( $query_pricelist->result_array () as $key => $customer_payment ) {
271
-					if (! empty ( $customer_payment ['reseller_id'] ) && $customer_payment ['reseller_id'] != '0') {
270
+				foreach ($query_pricelist->result_array() as $key => $customer_payment) {
271
+					if ( ! empty ($customer_payment ['reseller_id']) && $customer_payment ['reseller_id'] != '0') {
272 272
 						$payment_by = $customer_payment ['reseller_id'];
273 273
 					} else {
274 274
 						$payment_by = '-1';
275 275
 					}
276
-					$insert_arr = array (
276
+					$insert_arr = array(
277 277
 							"accountid" => $customer_payment ['id'],
278 278
 							"credit" => $update_array ['balance'] ['balance'],
279 279
 							'payment_mode' => 0,
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 							'payment_by' => $payment_by,
284 284
 							'reseller_id' => $customer_payment ['reseller_id'] 
285 285
 					);
286
-					$this->db->insert ( "payments", $insert_arr );
286
+					$this->db->insert("payments", $insert_arr);
287 287
 				}
288 288
 			}
289 289
 		}
@@ -292,15 +292,15 @@  discard block
 block discarded – undo
292 292
 	
293 293
 	/* * ************************************************************************ */
294 294
 	function edit_account($accountinfo, $edit_id) {
295
-		unset ( $accountinfo ['action'] );
296
-		unset ( $accountinfo ['onoffswitch'] );
297
-		$this->db->where ( 'id', $edit_id );
298
-		$result = $this->db->update ( 'accounts', $accountinfo );
295
+		unset ($accountinfo ['action']);
296
+		unset ($accountinfo ['onoffswitch']);
297
+		$this->db->where('id', $edit_id);
298
+		$result = $this->db->update('accounts', $accountinfo);
299 299
 		return true;
300 300
 	}
301 301
 	function bulk_insert_accounts($add_array) {
302
-		$logintype = $this->session->userdata ( 'logintype' );
303
-		$creation_limit = $this->get_max_limit ( $add_array );
302
+		$logintype = $this->session->userdata('logintype');
303
+		$creation_limit = $this->get_max_limit($add_array);
304 304
 		$count = $add_array ['count'];
305 305
 		$pin_flag = $add_array ['pin'];
306 306
 		
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		$prefix = $add_array ['prefix'];
310 310
 		$account_length = $add_array ['account_length'];
311 311
 		
312
-		$length = strlen ( $prefix );
312
+		$length = strlen($prefix);
313 313
 		if ($length != 0) {
314 314
 			$number_length = $account_length - $length;
315 315
 		} else {
@@ -318,47 +318,47 @@  discard block
 block discarded – undo
318 318
 		$pin_length = Common_model::$global_config ['system_config'] ['pinlength'];
319 319
 		// end
320 320
 		$pricelist_id = $add_array ['pricelist_id'] != '' ? $add_array ['pricelist_id'] : 0;
321
-		$number = $this->common->find_uniq_rendno_accno ( $number_length, 'number', 'accounts', $prefix, $count );
321
+		$number = $this->common->find_uniq_rendno_accno($number_length, 'number', 'accounts', $prefix, $count);
322 322
 		if ($pin_flag) {
323
-			$pin = $this->common->find_uniq_rendno_accno ( $pin_length, 'pin', 'accounts', '', $count );
323
+			$pin = $this->common->find_uniq_rendno_accno($pin_length, 'pin', 'accounts', '', $count);
324 324
 		}
325 325
 		
326 326
 		$sip_flag = false;
327 327
 		$opensip_flag = false;
328
-		if (isset ( $add_array ['sip_device_flag'] ) && common_model::$global_config ['system_config'] ['opensips'] == 1) {
328
+		if (isset ($add_array ['sip_device_flag']) && common_model::$global_config ['system_config'] ['opensips'] == 1) {
329 329
 			$sip_flag = true;
330 330
 		}
331
-		if (isset ( $add_array ['opensips_device_flag'] ) && common_model::$global_config ['system_config'] ['opensips'] == 0) {
331
+		if (isset ($add_array ['opensips_device_flag']) && common_model::$global_config ['system_config'] ['opensips'] == 0) {
332 332
 			$opensip_flag = true;
333 333
 		}
334
-		unset ( $add_array ['count'], $add_array ['pin'], $add_array ['account_length'], $add_array ['prefix'], $add_array ['sip_device_flag'], $add_array ['opensips_device_flag'] );
335
-		if (isset ( $add_array ['is_recording'] ) && $add_array ['is_recording'] != '') {
334
+		unset ($add_array ['count'], $add_array ['pin'], $add_array ['account_length'], $add_array ['prefix'], $add_array ['sip_device_flag'], $add_array ['opensips_device_flag']);
335
+		if (isset ($add_array ['is_recording']) && $add_array ['is_recording'] != '') {
336 336
 			$is_recording = 1;
337 337
 		} else {
338 338
 			$is_recording = 0;
339 339
 		}
340
-		if (isset ( $add_array ['allow_ip_management'] ) && $add_array ['allow_ip_management'] != '') {
340
+		if (isset ($add_array ['allow_ip_management']) && $add_array ['allow_ip_management'] != '') {
341 341
 			$allow_ip_management = 1;
342 342
 		} else {
343 343
 			$allow_ip_management = 0;
344 344
 		}
345
-		if (isset ( $add_array ['local_call'] ) && $add_array ['local_call'] != '') {
345
+		if (isset ($add_array ['local_call']) && $add_array ['local_call'] != '') {
346 346
 			$local_call = 1;
347 347
 		} else {
348 348
 			$local_call = 0;
349 349
 		}
350 350
 		if ($sip_flag) {
351
-			$query = $this->db_model->select ( "*", "sip_profiles", array (
351
+			$query = $this->db_model->select("*", "sip_profiles", array(
352 352
 					'status' => "0" 
353
-			), "id", "ASC", '1', '0' );
354
-			$sip_id = $query->result_array ();
353
+			), "id", "ASC", '1', '0');
354
+			$sip_id = $query->result_array();
355 355
 			$sip_profile_id = $sip_id [0] ['id'];
356
-			for($i = 0; $i < $count; $i ++) {
356
+			for ($i = 0; $i < $count; $i++) {
357 357
 				$acc_num = $number [$i];
358
-				$current_password = $this->common->generate_password ();
359
-				$insert_array = array (
358
+				$current_password = $this->common->generate_password();
359
+				$insert_array = array(
360 360
 						'number' => $acc_num,
361
-						'password' => $this->common->encode ( $current_password ),
361
+						'password' => $this->common->encode($current_password),
362 362
 						'pricelist_id' => $pricelist_id,
363 363
 						'reseller_id' => $add_array ['reseller_id'],
364 364
 						'status' => 0,
@@ -373,69 +373,69 @@  discard block
 block discarded – undo
373 373
 						'type' => 0,
374 374
 						'charge_per_min' => $add_array ['charge_per_min'],
375 375
 						'validfordays' => $add_array ['validfordays'],
376
-						"creation" => gmdate ( "Y-m-d H:i:s" ),
376
+						"creation" => gmdate("Y-m-d H:i:s"),
377 377
 						"maxchannels" => 0,
378 378
 						"sweep_id" => $add_array ['sweep_id'],
379 379
 						"local_call" => $local_call,
380 380
 						"invoice_day" => $add_array ['invoice_day'],
381 381
 						"allow_ip_management" => $allow_ip_management,
382 382
 						"is_recording" => $is_recording,
383
-						"expiry" => gmdate ( 'Y-m-d H:i:s', strtotime ( '+10 years' ) ) 
383
+						"expiry" => gmdate('Y-m-d H:i:s', strtotime('+10 years')) 
384 384
 				);
385 385
 				if ($pin_flag == 1) {
386 386
 					$insert_array ['pin'] = $pin [$i];
387 387
 				}
388
-				$this->db->insert ( 'accounts', $insert_array );
389
-				$last_id = $this->db->insert_id ();
388
+				$this->db->insert('accounts', $insert_array);
389
+				$last_id = $this->db->insert_id();
390 390
 				// balance update in invoices & payment table
391 391
 				
392 392
 				if ($add_array ['balance'] > 0 && $add_array ['posttoexternal'] == 0) {
393 393
 					
394
-					$post_array ["account_currency"] = $this->common->get_field_name ( 'currency', 'currency', $add_array ["currency_id"] );
394
+					$post_array ["account_currency"] = $this->common->get_field_name('currency', 'currency', $add_array ["currency_id"]);
395 395
 					$post_array ['id'] = $last_id;
396 396
 					$post_array ['accountid'] = $acc_num;
397 397
 					$post_array ['credit'] = $add_array ['balance'];
398 398
 					$post_array ['payment_type'] = 0;
399 399
 					$post_array ['notes'] = 'Initial Credit';
400 400
 					
401
-					$response = $this->account_process_payment ( $post_array, false );
401
+					$response = $this->account_process_payment($post_array, false);
402 402
 					
403
-					$accountinfo = $this->get_account_by_number ( $post_array ['id'] );
403
+					$accountinfo = $this->get_account_by_number($post_array ['id']);
404 404
 					if ($accountinfo ['reseller_id'] == 0) {
405
-						$where = array (
405
+						$where = array(
406 406
 								"accountid" => 1 
407 407
 						);
408 408
 					} else {
409
-						$where = array (
409
+						$where = array(
410 410
 								"accountid" => $accountinfo ['id'] 
411 411
 						);
412 412
 					}
413
-					$query = $this->db_model->getSelect ( "*", "invoice_conf", $where );
413
+					$query = $this->db_model->getSelect("*", "invoice_conf", $where);
414 414
 					if ($query->num_rows > 0) {
415
-						$invoice_conf = $query->result_array ();
415
+						$invoice_conf = $query->result_array();
416 416
 						$invoice_conf = $invoice_conf [0];
417 417
 					} else {
418
-						$query = $this->db_model->getSelect ( "*", "invoice_conf", array (
418
+						$query = $this->db_model->getSelect("*", "invoice_conf", array(
419 419
 								"accountid" => 1 
420
-						) );
421
-						$invoice_conf = $query->result_array ();
420
+						));
421
+						$invoice_conf = $query->result_array();
422 422
 						$invoice_conf = $invoice_conf [0];
423 423
 					}
424
-					$this->load->module ( 'accounts/accounts' );
425
-					$last_invoice_ID = $this->accounts->get_invoice_date ( "invoiceid", $accountinfo ["id"] );
424
+					$this->load->module('accounts/accounts');
425
+					$last_invoice_ID = $this->accounts->get_invoice_date("invoiceid", $accountinfo ["id"]);
426 426
 					$invoice_prefix = $invoice_conf ['invoice_prefix'];
427
-					$due_date = gmdate ( "Y-m-d H:i:s", strtotime ( gmdate ( "Y-m-d H:i:s" ) . " +" . $invoice_conf ['interval'] . " days" ) );
427
+					$due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoice_conf ['interval']." days"));
428 428
 					
429
-					$this->load->module ( 'invoices/invoices' );
430
-					$invoice_id = $this->invoices->invoices->generate_receipt ( $post_array ['id'], $post_array ['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date );
429
+					$this->load->module('invoices/invoices');
430
+					$invoice_id = $this->invoices->invoices->generate_receipt($post_array ['id'], $post_array ['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date);
431 431
 					
432
-					$account_balance = $this->common->get_field_name ( 'balance', 'accounts', $post_array ['id'] );
433
-					$insert_arr = array (
432
+					$account_balance = $this->common->get_field_name('balance', 'accounts', $post_array ['id']);
433
+					$insert_arr = array(
434 434
 							"accountid" => $post_array ['id'],
435
-							"description" => trim ( $post_array ['notes'] ),
435
+							"description" => trim($post_array ['notes']),
436 436
 							"debit" => '0',
437 437
 							"credit" => $post_array ['credit'],
438
-							"created_date" => gmdate ( "Y-m-d H:i:s" ),
438
+							"created_date" => gmdate("Y-m-d H:i:s"),
439 439
 							"invoiceid" => $invoice_id,
440 440
 							"reseller_id" => '0',
441 441
 							"item_type" => 'Refill',
@@ -443,43 +443,43 @@  discard block
 block discarded – undo
443 443
 							'before_balance' => $account_balance + $post_array ['credit'],
444 444
 							'after_balance' => $account_balance 
445 445
 					);
446
-					$this->db->insert ( "invoice_details", $insert_arr );
446
+					$this->db->insert("invoice_details", $insert_arr);
447 447
 				}
448 448
 				// /
449
-				$params_array = array (
449
+				$params_array = array(
450 450
 						'password' => $current_password,
451 451
 						"vm-enabled" => "true",
452
-						"vm-password" => rand ( 10000, 99999 ),
452
+						"vm-password" => rand(10000, 99999),
453 453
 						"vm-mailto" => "",
454 454
 						"vm-attach-file" => "false",
455 455
 						"vm-keep-local-after-email" => "true",
456 456
 						"vm-email-all-messages" => "false" 
457 457
 				);
458
-				$params_array_vars = array (
458
+				$params_array_vars = array(
459 459
 						'effective_caller_id_name' => $acc_num,
460 460
 						'effective_caller_id_number' => $acc_num,
461 461
 						'user_context' => 'default' 
462 462
 				);
463
-				$sip_device_array [$i] = array (
463
+				$sip_device_array [$i] = array(
464 464
 						'username' => $acc_num,
465 465
 						'sip_profile_id' => $sip_profile_id,
466 466
 						'reseller_id' => $add_array ['reseller_id'],
467 467
 						'accountid' => $last_id,
468
-						'dir_params' => json_encode ( $params_array ),
469
-						'dir_vars' => json_encode ( $params_array_vars ),
468
+						'dir_params' => json_encode($params_array),
469
+						'dir_vars' => json_encode($params_array_vars),
470 470
 						'status' => 0,
471
-						'creation_date' => gmdate ( "Y-m-d H:i:s" ) 
471
+						'creation_date' => gmdate("Y-m-d H:i:s") 
472 472
 				);
473 473
 			}
474
-			$this->db->insert_batch ( 'sip_devices', $sip_device_array );
474
+			$this->db->insert_batch('sip_devices', $sip_device_array);
475 475
 		} else {
476
-			for($i = 0; $i < $count; $i ++) {
476
+			for ($i = 0; $i < $count; $i++) {
477 477
 				$acc_num = $number [$i];
478 478
 				// $current_password = $password[$i];
479
-				$current_password = $this->common->generate_password ();
480
-				$insert_array = array (
479
+				$current_password = $this->common->generate_password();
480
+				$insert_array = array(
481 481
 						'number' => $acc_num,
482
-						'password' => $this->common->encode ( $current_password ),
482
+						'password' => $this->common->encode($current_password),
483 483
 						'pricelist_id' => $pricelist_id,
484 484
 						'reseller_id' => $add_array ['reseller_id'],
485 485
 						'status' => 0,
@@ -495,69 +495,69 @@  discard block
 block discarded – undo
495 495
 						'first_name' => $acc_num,
496 496
 						'type' => 0,
497 497
 						'validfordays' => $add_array ['validfordays'],
498
-						"creation" => gmdate ( "Y-m-d H:i:s" ),
498
+						"creation" => gmdate("Y-m-d H:i:s"),
499 499
 						"is_recording" => 0,
500 500
 						"maxchannels" => 0,
501 501
 						"sweep_id" => 2,
502
-						"invoice_day" => gmdate ( "d" ),
503
-						"expiry" => gmdate ( 'Y-m-d H:i:s', strtotime ( '+10 years' ) ) 
502
+						"invoice_day" => gmdate("d"),
503
+						"expiry" => gmdate('Y-m-d H:i:s', strtotime('+10 years')) 
504 504
 				)
505 505
 				;
506 506
 				if ($pin_flag == 1) {
507 507
 					$insert_array ['pin'] = $pin [$i];
508 508
 				}
509
-				$this->db->insert ( 'accounts', $insert_array );
510
-				$last_id = $this->db->insert_id ();
509
+				$this->db->insert('accounts', $insert_array);
510
+				$last_id = $this->db->insert_id();
511 511
 				
512 512
 				// balance update in invoices & payment table
513 513
 				
514 514
 				if ($add_array ['balance'] > 0) {
515 515
 					
516
-					$post_array ["account_currency"] = $this->common->get_field_name ( 'currency', 'currency', $add_array ["currency_id"] );
516
+					$post_array ["account_currency"] = $this->common->get_field_name('currency', 'currency', $add_array ["currency_id"]);
517 517
 					$post_array ['id'] = $last_id;
518 518
 					$post_array ['accountid'] = $acc_num;
519 519
 					$post_array ['credit'] = $add_array ['balance'];
520 520
 					$post_array ['payment_type'] = 0;
521 521
 					$post_array ['notes'] = '';
522 522
 					
523
-					$response = $this->account_process_payment ( $post_array, false );
523
+					$response = $this->account_process_payment($post_array, false);
524 524
 					
525
-					$accountinfo = $this->get_account_by_number ( $post_array ['id'] );
525
+					$accountinfo = $this->get_account_by_number($post_array ['id']);
526 526
 					if ($accountinfo ['reseller_id'] == 0) {
527
-						$where = array (
527
+						$where = array(
528 528
 								"accountid" => 1 
529 529
 						);
530 530
 					} else {
531
-						$where = array (
531
+						$where = array(
532 532
 								"accountid" => $accountinfo ['id'] 
533 533
 						);
534 534
 					}
535
-					$query = $this->db_model->getSelect ( "*", "invoice_conf", $where );
535
+					$query = $this->db_model->getSelect("*", "invoice_conf", $where);
536 536
 					if ($query->num_rows > 0) {
537
-						$invoice_conf = $query->result_array ();
537
+						$invoice_conf = $query->result_array();
538 538
 						$invoice_conf = $invoice_conf [0];
539 539
 					} else {
540
-						$query = $this->db_model->getSelect ( "*", "invoice_conf", array (
540
+						$query = $this->db_model->getSelect("*", "invoice_conf", array(
541 541
 								"accountid" => 1 
542
-						) );
543
-						$invoice_conf = $query->result_array ();
542
+						));
543
+						$invoice_conf = $query->result_array();
544 544
 						$invoice_conf = $invoice_conf [0];
545 545
 					}
546
-					$this->load->module ( 'accounts/accounts' );
547
-					$last_invoice_ID = $this->accounts->get_invoice_date ( "invoiceid", $accountinfo ["id"] );
546
+					$this->load->module('accounts/accounts');
547
+					$last_invoice_ID = $this->accounts->get_invoice_date("invoiceid", $accountinfo ["id"]);
548 548
 					$invoice_prefix = $invoice_conf ['invoice_prefix'];
549
-					$due_date = gmdate ( "Y-m-d H:i:s", strtotime ( gmdate ( "Y-m-d H:i:s" ) . " +" . $invoice_conf ['interval'] . " days" ) );
549
+					$due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoice_conf ['interval']." days"));
550 550
 					
551
-					$this->load->module ( 'invoices/invoices' );
552
-					$invoice_id = $this->invoices->invoices->generate_receipt ( $post_array ['id'], $post_array ['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date );
551
+					$this->load->module('invoices/invoices');
552
+					$invoice_id = $this->invoices->invoices->generate_receipt($post_array ['id'], $post_array ['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date);
553 553
 					
554
-					$account_balance = $this->common->get_field_name ( 'balance', 'accounts', $post_array ['id'] );
555
-					$insert_arr = array (
554
+					$account_balance = $this->common->get_field_name('balance', 'accounts', $post_array ['id']);
555
+					$insert_arr = array(
556 556
 							"accountid" => $post_array ['id'],
557
-							"description" => trim ( $post_array ['notes'] ),
557
+							"description" => trim($post_array ['notes']),
558 558
 							"debit" => '0',
559 559
 							"credit" => $post_array ['credit'],
560
-							"created_date" => gmdate ( "Y-m-d H:i:s" ),
560
+							"created_date" => gmdate("Y-m-d H:i:s"),
561 561
 							"invoiceid" => $invoice_id,
562 562
 							"reseller_id" => '0',
563 563
 							"item_type" => 'POSTCHARG',
@@ -565,18 +565,18 @@  discard block
 block discarded – undo
565 565
 							'before_balance' => $account_balance + $post_array ['credit'],
566 566
 							'after_balance' => $account_balance 
567 567
 					);
568
-					$this->db->insert ( "invoice_details", $insert_arr );
568
+					$this->db->insert("invoice_details", $insert_arr);
569 569
 				}
570 570
 				// /
571 571
 				if ($opensip_flag) {
572 572
 					$opensips_domain = common_model::$global_config ['system_config'] ['opensips_domain'];
573
-					$opensips_array [$i] = array (
573
+					$opensips_array [$i] = array(
574 574
 							'username' => $acc_num,
575 575
 							'domain' => $opensips_domain,
576 576
 							'password' => $current_password,
577 577
 							'accountcode' => $acc_num,
578 578
 							'reseller_id' => $add_array ['reseller_id'],
579
-							"creation_date" => gmdate ( "Y-m-d H:i:s" ),
579
+							"creation_date" => gmdate("Y-m-d H:i:s"),
580 580
 							"status" => 0 
581 581
 					);
582 582
 				}
@@ -584,57 +584,57 @@  discard block
 block discarded – undo
584 584
 			// $this->db->insert_batch('accounts', $insert_array);
585 585
 			if ($opensip_flag == 1) {
586 586
 				$db_config = Common_model::$global_config ['system_config'];
587
-				$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=";
588
-				$this->opensips_db = $this->load->database ( $opensipdsn, true );
589
-				$this->opensips_db->insert_batch ( "subscriber", $opensips_array );
587
+				$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=";
588
+				$this->opensips_db = $this->load->database($opensipdsn, true);
589
+				$this->opensips_db->insert_batch("subscriber", $opensips_array);
590 590
 			}
591 591
 		}
592 592
 		return TRUE;
593 593
 	}
594 594
 	function get_max_limit($add_array) {
595
-		$this->db->where ( 'deleted', '0' );
596
-		$this->db->where ( "length(number)", $add_array ['account_length'] );
597
-		$this->db->like ( 'number', $add_array ['prefix'], 'after' );
598
-		$this->db->select ( "count(id) as count" );
599
-		$this->db->from ( 'accounts' );
600
-		$result = $this->db->get ();
601
-		$result = $result->result_array ();
595
+		$this->db->where('deleted', '0');
596
+		$this->db->where("length(number)", $add_array ['account_length']);
597
+		$this->db->like('number', $add_array ['prefix'], 'after');
598
+		$this->db->select("count(id) as count");
599
+		$this->db->from('accounts');
600
+		$result = $this->db->get();
601
+		$result = $result->result_array();
602 602
 		$count = $result [0] ['count'];
603 603
 		$remaining_length = 0;
604
-		$remaining_length = $add_array ['account_length'] - strlen ( $add_array ['prefix'] );
605
-		$currentlength = pow ( 10, $remaining_length );
604
+		$remaining_length = $add_array ['account_length'] - strlen($add_array ['prefix']);
605
+		$currentlength = pow(10, $remaining_length);
606 606
 		$currentlength = $currentlength - $count;
607 607
 		return $currentlength;
608 608
 	}
609 609
 	function account_process_payment($data, $update_balance_flag = 'true') {
610 610
 		$data ['accountid'] = $data ['id'];
611
-		$accountdata = ( array ) $this->db->get_where ( 'accounts', array (
611
+		$accountdata = (array)$this->db->get_where('accounts', array(
612 612
 				"id" => $data ['accountid'] 
613
-		) )->first_row ();
614
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
613
+		))->first_row();
614
+		$accountinfo = $this->session->userdata('accountinfo');
615 615
 		$data ["payment_by"] = $accountdata ['reseller_id'] > 0 ? $accountdata ['reseller_id'] : '-1';
616 616
 		$data ['payment_mode'] = $data ['payment_type'];
617
-		unset ( $data ['action'], $data ['id'], $data ['account_currency'], $data ['payment_type'] );
618
-		if (isset ( $data ) && ! empty ( $accountdata )) {
617
+		unset ($data ['action'], $data ['id'], $data ['account_currency'], $data ['payment_type']);
618
+		if (isset ($data) && ! empty ($accountdata)) {
619 619
 			$data ['credit'] = $data ['credit'] == '' ? 0 : $data ['credit'];
620
-			$date = gmdate ( 'Y-m-d H:i:s' );
620
+			$date = gmdate('Y-m-d H:i:s');
621 621
 			if ($data ['payment_mode'] == 1) {
622 622
 				if ($update_balance_flag == 'true')
623
-					$balance = $this->update_balance ( $data ['credit'], $data ['accountid'], $data ['payment_mode'] );
624
-				$insert_arr = array (
623
+					$balance = $this->update_balance($data ['credit'], $data ['accountid'], $data ['payment_mode']);
624
+				$insert_arr = array(
625 625
 						"accountid" => $data ['accountid'],
626
-						"credit" => "-" . $data ['credit'],
626
+						"credit" => "-".$data ['credit'],
627 627
 						'payment_mode' => $data ['payment_mode'],
628 628
 						'type' => "SYSTEM",
629 629
 						"notes" => $data ['notes'],
630 630
 						"payment_date" => $date,
631 631
 						'payment_by' => $data ['payment_by'] 
632 632
 				);
633
-				$this->db->insert ( "payments", $insert_arr );
633
+				$this->db->insert("payments", $insert_arr);
634 634
 			} else {
635 635
 				if ($update_balance_flag == 'true')
636
-					$balance = $this->update_balance ( $data ['credit'], $data ['accountid'], $data ['payment_mode'] );
637
-				$insert_arr = array (
636
+					$balance = $this->update_balance($data ['credit'], $data ['accountid'], $data ['payment_mode']);
637
+				$insert_arr = array(
638 638
 						"accountid" => $data ['accountid'],
639 639
 						"credit" => $data ['credit'],
640 640
 						'payment_mode' => $data ['payment_mode'],
@@ -643,15 +643,15 @@  discard block
 block discarded – undo
643 643
 						"payment_date" => $date,
644 644
 						'payment_by' => $data ['payment_by'] 
645 645
 				);
646
-				$this->db->insert ( "payments", $insert_arr );
646
+				$this->db->insert("payments", $insert_arr);
647 647
 				$accountdata ['refill_amount'] = $data ['credit'];
648
-				$balance = $this->common->get_field_name ( 'balance', 'accounts', $data ['accountid'] );
648
+				$balance = $this->common->get_field_name('balance', 'accounts', $data ['accountid']);
649 649
 				$accountdata ['refill_amount_balance'] = $update_balance_flag == 'false' ? $data ['credit'] : $balance;
650 650
 				$current_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : '0';
651 651
 				if ($accountdata ['reseller_id'] == $current_id) {
652
-					$this->common->mail_to_users ( 'voip_account_refilled', $accountdata );
652
+					$this->common->mail_to_users('voip_account_refilled', $accountdata);
653 653
 				} else {
654
-					$this->common->mail_to_users ( 'voip_child_account_refilled', $accountdata );
654
+					$this->common->mail_to_users('voip_child_account_refilled', $accountdata);
655 655
 				}
656 656
 			}
657 657
 		}
@@ -660,163 +660,163 @@  discard block
 block discarded – undo
660 660
 	 * **************Completed*****************
661 661
 	 */
662 662
 	function get_admin_Account_list($flag, $start = 0, $limit = 0, $reseller_id = 0) {
663
-		$this->db_model->build_search ( 'admin_list_search' );
664
-		$where = "reseller_id =" . $reseller_id . " AND deleted =0 AND type in (2,4,-1)";
665
-		if ($this->session->userdata ( 'advance_search' ) == 1) {
666
-			$search = $this->session->userdata ( 'admin_list_search' );
663
+		$this->db_model->build_search('admin_list_search');
664
+		$where = "reseller_id =".$reseller_id." AND deleted =0 AND type in (2,4,-1)";
665
+		if ($this->session->userdata('advance_search') == 1) {
666
+			$search = $this->session->userdata('admin_list_search');
667 667
 			if ($search ['type'] == '') {
668
-				$this->db->where ( $where );
669
-				$this->db_model->build_search ( 'admin_list_search' );
668
+				$this->db->where($where);
669
+				$this->db_model->build_search('admin_list_search');
670 670
 			} else {
671
-				$this->db->where ( 'type', $search ['type'] );
671
+				$this->db->where('type', $search ['type']);
672 672
 			}
673 673
 		} else {
674
-			$this->db->where ( $where );
675
-			$this->db_model->build_search ( 'admin_list_search' );
674
+			$this->db->where($where);
675
+			$this->db_model->build_search('admin_list_search');
676 676
 		}
677 677
 		if ($flag) {
678
-			$this->db->limit ( $limit, $start );
678
+			$this->db->limit($limit, $start);
679 679
 		}
680
-		if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') {
681
-			$this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] );
680
+		if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') {
681
+			$this->db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']);
682 682
 		} else {
683
-			$this->db->order_by ( 'number', 'desc' );
683
+			$this->db->order_by('number', 'desc');
684 684
 		}
685
-		$result = $this->db->get ( 'accounts' );
685
+		$result = $this->db->get('accounts');
686 686
 		
687 687
 		if ($flag) {
688 688
 			return $result;
689 689
 		} else {
690
-			return $result->num_rows ();
690
+			return $result->num_rows();
691 691
 		}
692 692
 	}
693 693
 	function get_customer_Account_list($flag, $start = 0, $limit = 0, $export = false) {
694
-		$this->db_model->build_search ( 'customer_list_search' );
695
-		$accountinfo = $this->session->userdata ( "accountinfo" );
694
+		$this->db_model->build_search('customer_list_search');
695
+		$accountinfo = $this->session->userdata("accountinfo");
696 696
 		$reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
697
-		$where = array (
697
+		$where = array(
698 698
 				"deleted" => "0",
699 699
 				'reseller_id' => $reseller_id 
700 700
 		);
701
-		$this->db->select ( '*' );
701
+		$this->db->select('*');
702 702
 		$type = "type IN (0)";
703
-		$this->db->where ( $where );
704
-		if ($this->session->userdata ( 'logintype' ) == '-1' || $this->session->userdata ( 'logintype' ) == '2') {
703
+		$this->db->where($where);
704
+		if ($this->session->userdata('logintype') == '-1' || $this->session->userdata('logintype') == '2') {
705 705
 			$type = "type IN (0,3)";
706 706
 		} else {
707 707
 			$type = "type IN (0)";
708 708
 		}
709
-		$this->db->where ( $type );
709
+		$this->db->where($type);
710 710
 		if ($flag) {
711
-			if (! $export)
712
-				$this->db->limit ( $limit, $start );
711
+			if ( ! $export)
712
+				$this->db->limit($limit, $start);
713 713
 		}
714
-		if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') {
715
-			$this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] );
714
+		if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') {
715
+			$this->db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']);
716 716
 		} else {
717
-			$this->db->order_by ( 'number', 'desc' );
717
+			$this->db->order_by('number', 'desc');
718 718
 		}
719
-		$result = $this->db->get ( 'accounts' );
719
+		$result = $this->db->get('accounts');
720 720
 		if ($flag) {
721 721
 			return $result;
722 722
 		} else {
723
-			return $result->num_rows ();
723
+			return $result->num_rows();
724 724
 		}
725 725
 	}
726 726
 	function get_reseller_Account_list($flag, $start = 0, $limit = 0, $export = false) {
727
-		$this->db_model->build_search ( 'reseller_list_search' );
728
-		$where = array (
727
+		$this->db_model->build_search('reseller_list_search');
728
+		$where = array(
729 729
 				'reseller_id' => "0",
730 730
 				"deleted" => "0",
731 731
 				"type" => "1" 
732 732
 		);
733
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
733
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
734 734
 			$where ['reseller_id'] = $this->session->userdata ["accountinfo"] ['id'];
735 735
 		}
736 736
 		if ($flag) {
737
-			$query = $this->db_model->select ( "*", "accounts", $where, "number", "desc", $limit, $start );
737
+			$query = $this->db_model->select("*", "accounts", $where, "number", "desc", $limit, $start);
738 738
 		} else {
739
-			$query = $this->db_model->countQuery ( "*", "accounts", $where );
739
+			$query = $this->db_model->countQuery("*", "accounts", $where);
740 740
 		}
741 741
 		return $query;
742 742
 	}
743 743
 	function get_provider_Account_list($flag, $start = 0, $limit = 0) {
744
-		$this->db_model->build_search ( 'provider_list_search' );
745
-		$where = array (
744
+		$this->db_model->build_search('provider_list_search');
745
+		$where = array(
746 746
 				"deleted" => "0",
747 747
 				"type" => "3",
748 748
 				'reseller_id' => 0 
749 749
 		);
750
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
750
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
751 751
 			$where ['reseller_id'] = $this->session->userdata ["accountinfo"] ['id'];
752 752
 		}
753 753
 		if ($flag) {
754
-			$query = $this->db_model->select ( "*", "accounts", $where, "number", "desc", $limit, $start );
754
+			$query = $this->db_model->select("*", "accounts", $where, "number", "desc", $limit, $start);
755 755
 		} else {
756
-			$query = $this->db_model->countQuery ( "*", "accounts", $where );
756
+			$query = $this->db_model->countQuery("*", "accounts", $where);
757 757
 		}
758 758
 		return $query;
759 759
 	}
760 760
 	function remove_customer($id) {
761
-		$this->db->where ( "id", $id );
762
-		$this->db->where ( "type <>", "-1" );
763
-		$data = array (
761
+		$this->db->where("id", $id);
762
+		$this->db->where("type <>", "-1");
763
+		$data = array(
764 764
 				'deleted' => '1' 
765 765
 		);
766
-		$this->db->update ( "accounts", $data );
766
+		$this->db->update("accounts", $data);
767 767
 		return true;
768 768
 	}
769 769
 	function insert_block($data, $accountid) {
770
-		$data = explode ( ",", $data );
771
-		$tmp = array ();
772
-		if (! empty ( $data )) {
773
-			foreach ( $data as $key => $data_value ) {
770
+		$data = explode(",", $data);
771
+		$tmp = array();
772
+		if ( ! empty ($data)) {
773
+			foreach ($data as $key => $data_value) {
774 774
 				$tmp [$key] ["accountid"] = $accountid;
775
-				$result = $this->get_pattern_by_id ( $data_value );
775
+				$result = $this->get_pattern_by_id($data_value);
776 776
 				$tmp [$key] ["blocked_patterns"] = $result [0] ['pattern'];
777 777
 				$tmp [$key] ["destination"] = $result [0] ['comment'];
778 778
 			}
779
-			return $this->db->insert_batch ( "block_patterns", $tmp );
779
+			return $this->db->insert_batch("block_patterns", $tmp);
780 780
 		}
781 781
 	}
782 782
 	function get_pattern_by_id($pattern) {
783
-		$patterns = $this->db_model->getSelect ( "pattern,comment", "routes", array (
783
+		$patterns = $this->db_model->getSelect("pattern,comment", "routes", array(
784 784
 				"id" => $pattern 
785
-		) );
786
-		$patterns_value = $patterns->result_array ();
785
+		));
786
+		$patterns_value = $patterns->result_array();
787 787
 		return $patterns_value;
788 788
 	}
789 789
 	function get_callerid($account_id) {
790
-		$query = $this->db_model->getSelect ( "*", "accounts_callerid", array (
790
+		$query = $this->db_model->getSelect("*", "accounts_callerid", array(
791 791
 				"accountid" => $account_id 
792
-		) );
792
+		));
793 793
 		return $query;
794 794
 	}
795 795
 	function get_account_number($accountid) {
796
-		$query = $this->db_model->getSelect ( "number", "accounts", array (
796
+		$query = $this->db_model->getSelect("number", "accounts", array(
797 797
 				"id" => $accountid 
798
-		) );
799
-		if ($query->num_rows () > 0)
800
-			return $query->row_array ();
798
+		));
799
+		if ($query->num_rows() > 0)
800
+			return $query->row_array();
801 801
 		else
802 802
 			return false;
803 803
 	}
804 804
 	function add_callerid($data) {
805
-		unset ( $data ['action'], $data ['flag'] );
806
-		$data ['accountid'] = $this->common->get_field_name ( 'id', 'accounts', array (
805
+		unset ($data ['action'], $data ['flag']);
806
+		$data ['accountid'] = $this->common->get_field_name('id', 'accounts', array(
807 807
 				'number' => $data ['accountid'] 
808
-		) );
809
-		$this->db->insert ( 'accounts_callerid', $data );
808
+		));
809
+		$this->db->insert('accounts_callerid', $data);
810 810
 		return true;
811 811
 	}
812 812
 	function edit_callerid($data) {
813
-		unset ( $data ['action'] );
814
-		unset ( $data ['flag'] );
815
-		$data ['accountid'] = $this->common->get_field_name ( 'id', 'accounts', array (
813
+		unset ($data ['action']);
814
+		unset ($data ['flag']);
815
+		$data ['accountid'] = $this->common->get_field_name('id', 'accounts', array(
816 816
 				'number' => $data ['accountid'] 
817
-		) );
818
-		$this->db->where ( 'accountid', $data ['accountid'] );
819
-		$this->db->update ( 'accounts_callerid', $data );
817
+		));
818
+		$this->db->where('accountid', $data ['accountid']);
819
+		$this->db->update('accounts_callerid', $data);
820 820
 		return true;
821 821
 	}
822 822
 	
@@ -825,8 +825,8 @@  discard block
 block discarded – undo
825 825
 	 * for remove all account's taxes enteries from database.
826 826
 	 */
827 827
 	function remove_all_account_tax($account_tax) {
828
-		$this->db->where ( 'accountid', $account_tax );
829
-		$this->db->delete ( 'taxes_to_accounts' );
828
+		$this->db->where('accountid', $account_tax);
829
+		$this->db->delete('taxes_to_accounts');
830 830
 		return true;
831 831
 	}
832 832
 	
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 	 * this function use to insert data for add taxes to account.
836 836
 	 */
837 837
 	function add_account_tax($data) {
838
-		$this->db->insert ( 'taxes_to_accounts', $data );
838
+		$this->db->insert('taxes_to_accounts', $data);
839 839
 	}
840 840
 	
841 841
 	/**
@@ -844,10 +844,10 @@  discard block
 block discarded – undo
844 844
 	 * @account_id = account id
845 845
 	 */
846 846
 	function get_accounttax_by_id($account_id) {
847
-		$this->db->where ( "accountid", trim ( $account_id ) );
848
-		$query = $this->db->get ( "taxes_to_accounts" );
849
-		if ($query->num_rows () > 0)
850
-			return $query->result_array ();
847
+		$this->db->where("accountid", trim($account_id));
848
+		$query = $this->db->get("taxes_to_accounts");
849
+		if ($query->num_rows() > 0)
850
+			return $query->result_array();
851 851
 		else
852 852
 			return false;
853 853
 	}
@@ -858,100 +858,100 @@  discard block
 block discarded – undo
858 858
 	 * @acc_num = account number
859 859
 	 */
860 860
 	function check_account_num($acc_num) {
861
-		$this->db->select ( 'accountid' );
862
-		$this->db->where ( "number", $acc_num );
863
-		$query = $this->db->get ( "accounts" );
861
+		$this->db->select('accountid');
862
+		$this->db->where("number", $acc_num);
863
+		$query = $this->db->get("accounts");
864 864
 		
865
-		if ($query->num_rows () > 0)
866
-			return $query->row_array ();
865
+		if ($query->num_rows() > 0)
866
+			return $query->row_array();
867 867
 		else
868 868
 			return false;
869 869
 	}
870 870
 	function get_account_by_number($id) {
871
-		$this->db->where ( "id", $id );
872
-		$query = $this->db->get ( "accounts" );
871
+		$this->db->where("id", $id);
872
+		$query = $this->db->get("accounts");
873 873
 		
874
-		if ($query->num_rows () > 0)
875
-			return $query->row_array ();
874
+		if ($query->num_rows() > 0)
875
+			return $query->row_array();
876 876
 		else
877 877
 			return false;
878 878
 	}
879 879
 	function get_currency_by_id($currency_id) {
880
-		$query = $this->db_model->getSelect ( "*", 'currency', array (
880
+		$query = $this->db_model->getSelect("*", 'currency', array(
881 881
 				'id' => $currency_id 
882
-		) );
883
-		if ($query->num_rows () > 0)
884
-			return $query->row_array ();
882
+		));
883
+		if ($query->num_rows() > 0)
884
+			return $query->row_array();
885 885
 		else
886 886
 			return false;
887 887
 	}
888 888
 	function update_balance($amount, $accountid, $payment_type) {
889 889
 		if ($payment_type == 0) {
890
-			$query = "update accounts set balance =  IF(posttoexternal=1,balance-" . $amount . ",balance+" . $amount . ") where id ='" . $accountid . "'";
890
+			$query = "update accounts set balance =  IF(posttoexternal=1,balance-".$amount.",balance+".$amount.") where id ='".$accountid."'";
891 891
 			
892
-			return $this->db->query ( $query );
892
+			return $this->db->query($query);
893 893
 		}
894 894
 		if ($payment_type == 1) {
895
-			$query = "update accounts set balance =  IF(posttoexternal=1,balance+" . $amount . ",balance-" . $amount . ") where id ='" . $accountid . "'";
895
+			$query = "update accounts set balance =  IF(posttoexternal=1,balance+".$amount.",balance-".$amount.") where id ='".$accountid."'";
896 896
 			
897
-			return $this->db->query ( $query );
897
+			return $this->db->query($query);
898 898
 		}
899 899
 	}
900 900
 	function account_authentication($where_data, $id) {
901 901
 		if ($id != "") {
902
-			$this->db->where ( "id <>", $id );
902
+			$this->db->where("id <>", $id);
903 903
 		}
904
-		$this->db->where ( $where_data );
905
-		$this->db->from ( "accounts" );
906
-		$query = $this->db->count_all_results ();
904
+		$this->db->where($where_data);
905
+		$this->db->from("accounts");
906
+		$query = $this->db->count_all_results();
907 907
 		return $query;
908 908
 	}
909 909
 	function get_animap($flag, $start, $limit, $id) {
910
-		$where = array (
910
+		$where = array(
911 911
 				'accountid' => $id 
912 912
 		);
913 913
 		
914 914
 		if ($flag) {
915
-			$query = $this->db_model->select ( "*", "ani_map", $where, "number", "DESC", $limit, $start );
915
+			$query = $this->db_model->select("*", "ani_map", $where, "number", "DESC", $limit, $start);
916 916
 		} else {
917
-			$query = $this->db_model->countQuery ( "*", "ani_map", $where );
917
+			$query = $this->db_model->countQuery("*", "ani_map", $where);
918 918
 		}
919 919
 		return $query;
920 920
 	}
921 921
 	function add_animap($data) {
922
-		$this->db->insert ( 'ani_map', $data );
922
+		$this->db->insert('ani_map', $data);
923 923
 		return true;
924 924
 	}
925 925
 	function edit_animap($data, $id) {
926
-		$new_array = array (
926
+		$new_array = array(
927 927
 				'number' => $data ['number'],
928 928
 				'status' => $data ['status'] 
929 929
 		);
930
-		$this->db->where ( 'id', $id );
931
-		$this->db->update ( 'ani_map', $new_array );
930
+		$this->db->where('id', $id);
931
+		$this->db->update('ani_map', $new_array);
932 932
 		return true;
933 933
 	}
934 934
 	function remove_ani_map($id) {
935
-		$this->db->where ( 'id', $id );
936
-		$this->db->delete ( 'ani_map' );
935
+		$this->db->where('id', $id);
936
+		$this->db->delete('ani_map');
937 937
 		return true;
938 938
 	}
939 939
 	function animap_authentication($where_data, $id) {
940 940
 		if ($id != "") {
941
-			$this->db->where ( "id <>", $id );
941
+			$this->db->where("id <>", $id);
942 942
 		}
943
-		$this->db->where ( $where_data );
944
-		$this->db->from ( "ani_map" );
945
-		$query = $this->db->count_all_results ();
943
+		$this->db->where($where_data);
944
+		$this->db->from("ani_map");
945
+		$query = $this->db->count_all_results();
946 946
 		return $query;
947 947
 	}
948 948
 	function add_invoice_config($add_array) {
949
-		$result = $this->db->insert ( 'invoice_conf', $add_array );
949
+		$result = $this->db->insert('invoice_conf', $add_array);
950 950
 		return true;
951 951
 	}
952 952
 	function edit_invoice_config($add_array, $edit_id) {
953
-		$this->db->where ( 'id', $edit_id );
954
-		$result = $this->db->update ( 'invoice_conf', $add_array );
953
+		$this->db->where('id', $edit_id);
954
+		$result = $this->db->update('invoice_conf', $add_array);
955 955
 		return true;
956 956
 	}
957 957
 }
Please login to merge, or discard this patch.
Braces   +34 added lines, -26 removed lines patch added patch discarded remove patch
@@ -619,8 +619,9 @@  discard block
 block discarded – undo
619 619
 			$data ['credit'] = $data ['credit'] == '' ? 0 : $data ['credit'];
620 620
 			$date = gmdate ( 'Y-m-d H:i:s' );
621 621
 			if ($data ['payment_mode'] == 1) {
622
-				if ($update_balance_flag == 'true')
623
-					$balance = $this->update_balance ( $data ['credit'], $data ['accountid'], $data ['payment_mode'] );
622
+				if ($update_balance_flag == 'true') {
623
+									$balance = $this->update_balance ( $data ['credit'], $data ['accountid'], $data ['payment_mode'] );
624
+				}
624 625
 				$insert_arr = array (
625 626
 						"accountid" => $data ['accountid'],
626 627
 						"credit" => "-" . $data ['credit'],
@@ -632,8 +633,9 @@  discard block
 block discarded – undo
632 633
 				);
633 634
 				$this->db->insert ( "payments", $insert_arr );
634 635
 			} else {
635
-				if ($update_balance_flag == 'true')
636
-					$balance = $this->update_balance ( $data ['credit'], $data ['accountid'], $data ['payment_mode'] );
636
+				if ($update_balance_flag == 'true') {
637
+									$balance = $this->update_balance ( $data ['credit'], $data ['accountid'], $data ['payment_mode'] );
638
+				}
637 639
 				$insert_arr = array (
638 640
 						"accountid" => $data ['accountid'],
639 641
 						"credit" => $data ['credit'],
@@ -708,8 +710,9 @@  discard block
 block discarded – undo
708 710
 		}
709 711
 		$this->db->where ( $type );
710 712
 		if ($flag) {
711
-			if (! $export)
712
-				$this->db->limit ( $limit, $start );
713
+			if (! $export) {
714
+							$this->db->limit ( $limit, $start );
715
+			}
713 716
 		}
714 717
 		if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') {
715 718
 			$this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] );
@@ -796,10 +799,11 @@  discard block
 block discarded – undo
796 799
 		$query = $this->db_model->getSelect ( "number", "accounts", array (
797 800
 				"id" => $accountid 
798 801
 		) );
799
-		if ($query->num_rows () > 0)
800
-			return $query->row_array ();
801
-		else
802
-			return false;
802
+		if ($query->num_rows () > 0) {
803
+					return $query->row_array ();
804
+		} else {
805
+					return false;
806
+		}
803 807
 	}
804 808
 	function add_callerid($data) {
805 809
 		unset ( $data ['action'], $data ['flag'] );
@@ -846,10 +850,11 @@  discard block
 block discarded – undo
846 850
 	function get_accounttax_by_id($account_id) {
847 851
 		$this->db->where ( "accountid", trim ( $account_id ) );
848 852
 		$query = $this->db->get ( "taxes_to_accounts" );
849
-		if ($query->num_rows () > 0)
850
-			return $query->result_array ();
851
-		else
852
-			return false;
853
+		if ($query->num_rows () > 0) {
854
+					return $query->result_array ();
855
+		} else {
856
+					return false;
857
+		}
853 858
 	}
854 859
 	
855 860
 	/**
@@ -862,28 +867,31 @@  discard block
 block discarded – undo
862 867
 		$this->db->where ( "number", $acc_num );
863 868
 		$query = $this->db->get ( "accounts" );
864 869
 		
865
-		if ($query->num_rows () > 0)
866
-			return $query->row_array ();
867
-		else
868
-			return false;
870
+		if ($query->num_rows () > 0) {
871
+					return $query->row_array ();
872
+		} else {
873
+					return false;
874
+		}
869 875
 	}
870 876
 	function get_account_by_number($id) {
871 877
 		$this->db->where ( "id", $id );
872 878
 		$query = $this->db->get ( "accounts" );
873 879
 		
874
-		if ($query->num_rows () > 0)
875
-			return $query->row_array ();
876
-		else
877
-			return false;
880
+		if ($query->num_rows () > 0) {
881
+					return $query->row_array ();
882
+		} else {
883
+					return false;
884
+		}
878 885
 	}
879 886
 	function get_currency_by_id($currency_id) {
880 887
 		$query = $this->db_model->getSelect ( "*", 'currency', array (
881 888
 				'id' => $currency_id 
882 889
 		) );
883
-		if ($query->num_rows () > 0)
884
-			return $query->row_array ();
885
-		else
886
-			return false;
890
+		if ($query->num_rows () > 0) {
891
+					return $query->row_array ();
892
+		} else {
893
+					return false;
894
+		}
887 895
 	}
888 896
 	function update_balance($amount, $accountid, $payment_type) {
889 897
 		if ($payment_type == 0) {
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/accounts/controllers/accounts.php 2 patches
Spacing   +1180 added lines, -1180 removed lines patch added patch discarded remove patch
@@ -23,26 +23,26 @@  discard block
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class Accounts extends MX_Controller {
25 25
 	function Accounts() {
26
-		parent::__construct ();
27
-		$this->load->helper ( 'template_inheritance' );
26
+		parent::__construct();
27
+		$this->load->helper('template_inheritance');
28 28
 		
29
-		$this->load->library ( 'accounts_form' );
30
-		$this->load->library ( 'astpp/form' );
29
+		$this->load->library('accounts_form');
30
+		$this->load->library('astpp/form');
31 31
 		
32
-		$this->load->model ( 'common_model' );
33
-		$this->load->library ( 'session' );
34
-		$this->load->helper ( 'form' );
35
-		$this->load->model ( 'accounts_model' );
36
-		$this->load->model ( 'Astpp_common' );
37
-		$this->protected_pages = array (
32
+		$this->load->model('common_model');
33
+		$this->load->library('session');
34
+		$this->load->helper('form');
35
+		$this->load->model('accounts_model');
36
+		$this->load->model('Astpp_common');
37
+		$this->protected_pages = array(
38 38
 				'account_list' 
39 39
 		);
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
 	function customer_list() {
44
-		$data ['username'] = $this->session->userdata ( 'user_name' );
45
-		$data ['page_title'] = gettext ( 'Customers' );
44
+		$data ['username'] = $this->session->userdata('user_name');
45
+		$data ['page_title'] = gettext('Customers');
46 46
 		$data ['search_flag'] = true;
47 47
 		/**
48 48
 		 * ASTPP 3.0
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 		 */
51 51
 		$data ['batch_update_flag'] = true;
52 52
 		/* * *********************************** */
53
-		$this->session->set_userdata ( 'advance_search', 0 );
54
-		$data ['grid_fields'] = $this->accounts_form->build_account_list_for_customer ();
55
-		$data ["grid_buttons"] = $this->accounts_form->build_grid_buttons_customer ();
56
-		$data ['form_search'] = $this->form->build_serach_form ( $this->accounts_form->get_search_customer_form () );
53
+		$this->session->set_userdata('advance_search', 0);
54
+		$data ['grid_fields'] = $this->accounts_form->build_account_list_for_customer();
55
+		$data ["grid_buttons"] = $this->accounts_form->build_grid_buttons_customer();
56
+		$data ['form_search'] = $this->form->build_serach_form($this->accounts_form->get_search_customer_form());
57 57
 		/**
58 58
 		 * ASTPP 3.0
59 59
 		 * Customer Batch Update.
60 60
 		 */
61 61
 		
62
-		$data ['form_batch_update'] = $this->form->build_batchupdate_form ( $this->accounts_form->customer_batch_update_form () );
62
+		$data ['form_batch_update'] = $this->form->build_batchupdate_form($this->accounts_form->customer_batch_update_form());
63 63
 		/* * *****************************************************************************************8 */
64
-		$this->load->view ( 'view_accounts_list', $data );
64
+		$this->load->view('view_accounts_list', $data);
65 65
 	}
66 66
 	
67 67
 	/**
@@ -69,140 +69,140 @@  discard block
 block discarded – undo
69 69
 	 * Listing of Accounts table data through php function json_encode
70 70
 	 */
71 71
 	function customer_list_json() {
72
-		$json_data = array ();
73
-		$count_all = $this->accounts_model->get_customer_Account_list ( false );
74
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
72
+		$json_data = array();
73
+		$count_all = $this->accounts_model->get_customer_Account_list(false);
74
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
75 75
 		$json_data = $paging_data ["json_paging"];
76
-		$query = $this->accounts_model->get_customer_Account_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
77
-		$grid_fields = json_decode ( $this->accounts_form->build_account_list_for_customer () );
78
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
79
-		echo json_encode ( $json_data );
76
+		$query = $this->accounts_model->get_customer_Account_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
77
+		$grid_fields = json_decode($this->accounts_form->build_account_list_for_customer());
78
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
79
+		echo json_encode($json_data);
80 80
 	}
81 81
 	function customer_list_search() {
82
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
82
+		$ajax_search = $this->input->post('ajax_search', 0);
83 83
 		
84
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
85
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
86
-			$action = $this->input->post ();
87
-			unset ( $action ['action'] );
88
-			unset ( $action ['advance_search'] );
89
-			if (isset ( $action ['balance'] ['balance'] ) && $action ['balance'] ['balance'] != '') {
90
-				$action ['balance'] ['balance'] = $this->common_model->add_calculate_currency ( $action ['balance'] ['balance'], "", '', false, false );
84
+		if ($this->input->post('advance_search', TRUE) == 1) {
85
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
86
+			$action = $this->input->post();
87
+			unset ($action ['action']);
88
+			unset ($action ['advance_search']);
89
+			if (isset ($action ['balance'] ['balance']) && $action ['balance'] ['balance'] != '') {
90
+				$action ['balance'] ['balance'] = $this->common_model->add_calculate_currency($action ['balance'] ['balance'], "", '', false, false);
91 91
 			}
92
-			if (isset ( $action ['credit_limit'] ['credit_limit'] ) && $action ['credit_limit'] ['credit_limit'] != '') {
93
-				$action ['credit_limit'] ['credit_limit'] = $this->common_model->add_calculate_currency ( $action ['credit_limit'] ['credit_limit'], "", '', false, false );
92
+			if (isset ($action ['credit_limit'] ['credit_limit']) && $action ['credit_limit'] ['credit_limit'] != '') {
93
+				$action ['credit_limit'] ['credit_limit'] = $this->common_model->add_calculate_currency($action ['credit_limit'] ['credit_limit'], "", '', false, false);
94 94
 			}
95
-			$this->session->set_userdata ( 'customer_list_search', $action );
95
+			$this->session->set_userdata('customer_list_search', $action);
96 96
 		}
97 97
 		if (@$ajax_search != 1) {
98
-			redirect ( base_url () . 'accounts/customer_list/' );
98
+			redirect(base_url().'accounts/customer_list/');
99 99
 		}
100 100
 	}
101 101
 	function customer_list_clearsearchfilter() {
102
-		$this->session->set_userdata ( 'advance_search', 0 );
103
-		$this->session->set_userdata ( 'customer_list_search', "" );
102
+		$this->session->set_userdata('advance_search', 0);
103
+		$this->session->set_userdata('customer_list_search', "");
104 104
 	}
105 105
 	function customer_export_cdr_xls() {
106
-		$account_info = $accountinfo = $this->session->userdata ( 'accountinfo' );
106
+		$account_info = $accountinfo = $this->session->userdata('accountinfo');
107 107
 		$currency_id = $account_info ['currency_id'];
108
-		$currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id );
109
-		$query = $this->accounts_model->get_customer_Account_list ( true, '', '', true );
110
-		ob_clean ();
111
-		$customer_array [] = array (
112
-				gettext ( "Account" ),
113
-				gettext ( "First Name" ),
114
-				gettext ( "Last Name" ),
115
-				gettext ( "Company" ),
116
-				gettext ( "Rate Group" ),
117
-				gettext ( "Balance" ) . "(" . $currency . ")",
118
-				gettext ( "Credit Limit" ) . "(" . $currency . ")",
119
-				gettext ( "First Used" ),
120
-				gettext ( "Expiry Date" ),
121
-				gettext ( "CC" ),
122
-				gettext ( "Status" ),
123
-				gettext ( "Created Date" ) 
108
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
109
+		$query = $this->accounts_model->get_customer_Account_list(true, '', '', true);
110
+		ob_clean();
111
+		$customer_array [] = array(
112
+				gettext("Account"),
113
+				gettext("First Name"),
114
+				gettext("Last Name"),
115
+				gettext("Company"),
116
+				gettext("Rate Group"),
117
+				gettext("Balance")."(".$currency.")",
118
+				gettext("Credit Limit")."(".$currency.")",
119
+				gettext("First Used"),
120
+				gettext("Expiry Date"),
121
+				gettext("CC"),
122
+				gettext("Status"),
123
+				gettext("Created Date") 
124 124
 		);
125
-		if ($query->num_rows () > 0) {
125
+		if ($query->num_rows() > 0) {
126 126
 			
127
-			foreach ( $query->result_array () as $row ) {
128
-				$customer_array [] = array (
127
+			foreach ($query->result_array() as $row) {
128
+				$customer_array [] = array(
129 129
 						$row ['number'],
130 130
 						$row ['first_name'],
131 131
 						$row ['last_name'],
132 132
 						$row ['company_name'],
133
-						$this->common->get_field_name ( 'name', 'pricelists', $row ['pricelist_id'] ),
134
-						$this->common_model->calculate_currency_customer ( $row ['balance'] ),
135
-						$this->common_model->calculate_currency_customer ( $row ['credit_limit'] ),
133
+						$this->common->get_field_name('name', 'pricelists', $row ['pricelist_id']),
134
+						$this->common_model->calculate_currency_customer($row ['balance']),
135
+						$this->common_model->calculate_currency_customer($row ['credit_limit']),
136 136
 						$row ['first_used'],
137 137
 						$row ['expiry'],
138 138
 						$row ['maxchannels'],
139
-						$this->common->get_status ( 'export', '', $row ['status'] ),
139
+						$this->common->get_status('export', '', $row ['status']),
140 140
 						$row ['creation'] 
141 141
 				);
142 142
 			}
143 143
 		}
144
-		$this->load->helper ( 'csv' );
145
-		array_to_csv ( $customer_array, 'Customers_' . date ( "Y-m-d" ) . '.csv' );
144
+		$this->load->helper('csv');
145
+		array_to_csv($customer_array, 'Customers_'.date("Y-m-d").'.csv');
146 146
 	}
147 147
 	function provider_add() {
148
-		$this->customer_add ( 3 );
148
+		$this->customer_add(3);
149 149
 	}
150 150
 	function provider_edit($edit_id = '') {
151
-		$this->customer_edit ( $edit_id );
151
+		$this->customer_edit($edit_id);
152 152
 	}
153 153
 	function provider_save() {
154
-		$add_array = $this->input->post ();
155
-		$this->customer_save ( $add_array );
154
+		$add_array = $this->input->post();
155
+		$this->customer_save($add_array);
156 156
 	}
157 157
 	function customer_add($type = 0) {
158
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
159
-		$entity_type = strtolower ( $this->common->get_entity_type ( '', '', $type ) );
160
-		$data ['username'] = $this->session->userdata ( 'user_name' );
158
+		$accountinfo = $this->session->userdata('accountinfo');
159
+		$entity_type = strtolower($this->common->get_entity_type('', '', $type));
160
+		$data ['username'] = $this->session->userdata('user_name');
161 161
 		$data ['flag'] = 'create';
162
-		$data ['page_title'] = ($type = 3)?gettext ( 'Create Provider' ):gettext ( 'Create Customer' );
162
+		$data ['page_title'] = ($type = 3) ?gettext ('Create Provider') : gettext('Create Customer');
163 163
 		$data ['back_flag'] = true;
164 164
 		$data ['country_id'] = $accountinfo ['country_id'];
165 165
 		$data ['callingcard'] = Common_model::$global_config ['system_config'] ['pinlength'];
166 166
 		$data ['currency_id'] = $accountinfo ['currency_id'];
167 167
 		$data ['timezone_id'] = $accountinfo ['timezone_id'];
168
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->get_customer_form_fields ( $entity_type ), '' );
169
-		if (! $data ['timezone_id']) {
168
+		$data ['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_type), '');
169
+		if ( ! $data ['timezone_id']) {
170 170
 			$data ['timezone_id'] = 1;
171 171
 		}
172
-		if (! $data ['currency_id']) {
172
+		if ( ! $data ['currency_id']) {
173 173
 			$data ['currency_id'] = 1;
174 174
 		}
175
-		if (! $data ['country_id']) {
175
+		if ( ! $data ['country_id']) {
176 176
 			$data ['country_id'] = 1;
177 177
 		}
178 178
 		$data ['entity_name'] = $entity_type;
179
-		$this->load->view ( 'view_accounts_create', $data );
179
+		$this->load->view('view_accounts_create', $data);
180 180
 	}
181 181
 	function customer_edit($edit_id = '') {
182 182
 		// Get Account information from session.
183
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
183
+		$accountinfo = $this->session->userdata('accountinfo');
184 184
 		// Get Parent informartion
185 185
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
186
-		$where = array (
186
+		$where = array(
187 187
 				'id' => $edit_id,
188 188
 				"reseller_id" => $reseller_id 
189 189
 		);
190
-		$account = $this->db_model->getSelect ( "*", "accounts", $where );
190
+		$account = $this->db_model->getSelect("*", "accounts", $where);
191 191
 		if ($account->num_rows > 0) {
192
-			$account_data = ( array ) $account->first_row ();
193
-			$entity_name = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
194
-			$data ['page_title'] = gettext ( ucfirst ( $entity_name ) . " Profile" );
192
+			$account_data = (array)$account->first_row();
193
+			$entity_name = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
194
+			$data ['page_title'] = gettext(ucfirst($entity_name)." Profile");
195 195
 			$data ['invoice_date'] = $account_data ['invoice_day'];
196 196
 			$data ["account_data"] = $account_data;
197 197
 			$data ['callingcard'] = Common_model::$global_config ['system_config'] ['pinlength'];
198 198
 			$data ['entity_name'] = $entity_name;
199 199
 			// Purpose : Get assigned taxes value for customer
200
-			$taxes_data = $this->db_model->getSelect ( "group_concat(taxes_id) as taxes_id", "taxes_to_accounts", array (
200
+			$taxes_data = $this->db_model->getSelect("group_concat(taxes_id) as taxes_id", "taxes_to_accounts", array(
201 201
 					"accountid" => $edit_id 
202
-			) );
203
-			if (isset ( $taxes_data ) && $taxes_data->num_rows () > 0) {
204
-				$taxes_data = $taxes_data->result_array ();
205
-				$account_data ["tax_id"] = explode ( ",", $taxes_data [0] ['taxes_id'] );
202
+			));
203
+			if (isset ($taxes_data) && $taxes_data->num_rows() > 0) {
204
+				$taxes_data = $taxes_data->result_array();
205
+				$account_data ["tax_id"] = explode(",", $taxes_data [0] ['taxes_id']);
206 206
 			}
207 207
 			/*
208 208
 			 * ***
@@ -210,29 +210,29 @@  discard block
 block discarded – undo
210 210
 			 * Password decode
211 211
 			 * ****
212 212
 			 */
213
-			$account_data ['password'] = $this->common->decode ( $account_data ['password'] );
213
+			$account_data ['password'] = $this->common->decode($account_data ['password']);
214 214
 			/* * ********************** */
215
-			$data ['form'] = $this->form->build_form ( $this->accounts_form->get_customer_form_fields ( $entity_name, $edit_id ), $account_data );
215
+			$data ['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $edit_id), $account_data);
216 216
 			$data ['edit_id'] = $edit_id;
217
-			$this->load->view ( 'view_customer_details', $data );
217
+			$this->load->view('view_customer_details', $data);
218 218
 		} else {
219
-			redirect ( base_url () . 'accounts/customer_list/' );
219
+			redirect(base_url().'accounts/customer_list/');
220 220
 		}
221 221
 	}
222 222
 	function customer_save($add_array = false) {
223
-		$add_array = $this->input->post ();
224
-		$entity_name = strtolower ( $this->common->get_entity_type ( '', '', $add_array ['type'] ) );
223
+		$add_array = $this->input->post();
224
+		$entity_name = strtolower($this->common->get_entity_type('', '', $add_array ['type']));
225 225
 		$data ['country_id'] = $add_array ['country_id'];
226 226
 		$data ['timezone_id'] = $add_array ['timezone_id'];
227 227
 		$data ['currency_id'] = $add_array ['currency_id'];
228 228
 		$data ['entity_name'] = $entity_name;
229 229
 		$data ['callingcard'] = Common_model::$global_config ['system_config'] ['pinlength'];
230 230
 		$data ['edit_id'] = $add_array ['id'];
231
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->get_customer_form_fields ( $entity_name, $add_array ['id'] ), $add_array );
231
+		$data ['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $add_array ['id']), $add_array);
232 232
 		if ($add_array ['id'] != '') {
233
-			$data ['page_title'] = gettext ( 'Edit ' . $this->common->get_entity_type ( '', '', $add_array ['type'] ) );
234
-			if ($this->form_validation->run () == FALSE) {
235
-				$data ['validation_errors'] = validation_errors ();
233
+			$data ['page_title'] = gettext('Edit '.$this->common->get_entity_type('', '', $add_array ['type']));
234
+			if ($this->form_validation->run() == FALSE) {
235
+				$data ['validation_errors'] = validation_errors();
236 236
 			} else {
237 237
 				/*
238 238
 				 * ****
@@ -240,35 +240,35 @@  discard block
 block discarded – undo
240 240
 				 * Password encode
241 241
 				 * ****
242 242
 				 */
243
-				$add_array ['password'] = $this->common->encode ( $add_array ['password'] );
243
+				$add_array ['password'] = $this->common->encode($add_array ['password']);
244 244
 				/* * ****************** */
245
-				$add_array ['credit_limit'] = $this->common_model->add_calculate_currency ( $add_array ['credit_limit'], '', '', false, false );
245
+				$add_array ['credit_limit'] = $this->common_model->add_calculate_currency($add_array ['credit_limit'], '', '', false, false);
246 246
 				// Purpose : Get assigned taxes value for customer
247 247
 				
248
-				$query = $this->accounts_model->remove_all_account_tax ( $add_array ['id'] );
249
-				if (isset ( $add_array ['tax_id'] )) {
250
-					foreach ( $add_array ['tax_id'] as $key => $val ) {
251
-						$data1 = array (
248
+				$query = $this->accounts_model->remove_all_account_tax($add_array ['id']);
249
+				if (isset ($add_array ['tax_id'])) {
250
+					foreach ($add_array ['tax_id'] as $key => $val) {
251
+						$data1 = array(
252 252
 								'accountid' => $add_array ['id'],
253 253
 								'taxes_id' => $val 
254 254
 						);
255
-						$this->accounts_model->add_account_tax ( $data1 );
255
+						$this->accounts_model->add_account_tax($data1);
256 256
 					}
257
-					unset ( $add_array ['tax_id'] );
257
+					unset ($add_array ['tax_id']);
258 258
 				}
259 259
 				// Completed
260
-				unset ( $add_array ['posttoexternal'], $add_array ['number'], $add_array ['balance'] );
261
-				$this->accounts_model->edit_account ( $add_array, $add_array ['id'] );
262
-				$this->session->set_flashdata ( 'astpp_errormsg', ucfirst ( $entity_name ) . ' updated successfully!' );
263
-				redirect ( base_url () . 'accounts/customer_list/' );
260
+				unset ($add_array ['posttoexternal'], $add_array ['number'], $add_array ['balance']);
261
+				$this->accounts_model->edit_account($add_array, $add_array ['id']);
262
+				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name).' updated successfully!');
263
+				redirect(base_url().'accounts/customer_list/');
264 264
 				exit ();
265 265
 			}
266 266
 			$data ["account_data"] ["0"] = $add_array;
267
-			$this->load->view ( 'view_customer_details', $data );
267
+			$this->load->view('view_customer_details', $data);
268 268
 		} else {
269
-			$data ['page_title'] = gettext ( 'Create ' . $entity_name );
270
-			if ($this->form_validation->run () == FALSE) {
271
-				$data ['validation_errors'] = validation_errors ();
269
+			$data ['page_title'] = gettext('Create '.$entity_name);
270
+			if ($this->form_validation->run() == FALSE) {
271
+				$data ['validation_errors'] = validation_errors();
272 272
 			} else {
273 273
 				/*
274 274
 				 * ****
@@ -276,47 +276,47 @@  discard block
 block discarded – undo
276 276
 				 * Password encode
277 277
 				 * ****
278 278
 				 */
279
-				$add_array ['password'] = $this->common->encode ( $add_array ['password'] );
279
+				$add_array ['password'] = $this->common->encode($add_array ['password']);
280 280
 				/* * ****************** */
281
-				$add_array ['credit_limit'] = $this->common_model->add_calculate_currency ( $add_array ['credit_limit'], '', '', false, false );
282
-				$add_array ['balance'] = $this->common_model->add_calculate_currency ( $add_array ['balance'], '', '', false, false );
281
+				$add_array ['credit_limit'] = $this->common_model->add_calculate_currency($add_array ['credit_limit'], '', '', false, false);
282
+				$add_array ['balance'] = $this->common_model->add_calculate_currency($add_array ['balance'], '', '', false, false);
283 283
 				if ($add_array ['posttoexternal'] == 1) {
284 284
 					$add_array ['balance'] = 0;
285 285
 				}
286
-				$last_id = $this->accounts_model->add_account ( $add_array );
286
+				$last_id = $this->accounts_model->add_account($add_array);
287 287
 				
288 288
 				// Enter detail into invoices , invoices_details , payments
289 289
 				if ($add_array ['balance'] > 0 && $add_array ['posttoexternal'] == 0) {
290
-					$post_array ["account_currency"] = $this->common->get_field_name ( 'currency', 'currency', $add_array ["currency_id"] );
290
+					$post_array ["account_currency"] = $this->common->get_field_name('currency', 'currency', $add_array ["currency_id"]);
291 291
 					$post_array ['id'] = $last_id;
292 292
 					$post_array ['accountid'] = $add_array ['number'];
293 293
 					$post_array ['credit'] = $add_array ['balance'];
294 294
 					$post_array ['payment_type'] = 0;
295 295
 					$post_array ['notes'] = 'Initial Credit';
296
-					$response = $this->accounts_model->account_process_payment ( $post_array, 'false' );
297
-					$accountinfo = $this->accounts_model->get_account_by_number ( $post_array ['id'] );
296
+					$response = $this->accounts_model->account_process_payment($post_array, 'false');
297
+					$accountinfo = $this->accounts_model->get_account_by_number($post_array ['id']);
298 298
 					$reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
299
-					$where = "accountid IN ('" . $reseller_id . "','1')";
300
-					$this->db->where ( $where );
301
-					$this->db->select ( '*' );
302
-					$this->db->order_by ( 'accountid', 'desc' );
303
-					$this->db->limit ( 1 );
304
-					$invoiceconf = $this->db->get ( 'invoice_conf' );
305
-					$invoice_conf = ( array ) $invoiceconf->first_row ();
306
-					$last_invoice_ID = $this->get_invoice_date ( "invoiceid", $accountinfo ["id"] );
299
+					$where = "accountid IN ('".$reseller_id."','1')";
300
+					$this->db->where($where);
301
+					$this->db->select('*');
302
+					$this->db->order_by('accountid', 'desc');
303
+					$this->db->limit(1);
304
+					$invoiceconf = $this->db->get('invoice_conf');
305
+					$invoice_conf = (array)$invoiceconf->first_row();
306
+					$last_invoice_ID = $this->get_invoice_date("invoiceid", $accountinfo ["id"]);
307 307
 					$invoice_prefix = $invoice_conf ['invoice_prefix'];
308
-					$due_date = gmdate ( "Y-m-d H:i:s", strtotime ( gmdate ( "Y-m-d H:i:s" ) . " +" . $invoice_conf ['interval'] . " days" ) );
308
+					$due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoice_conf ['interval']." days"));
309 309
 					
310
-					$this->load->module ( 'invoices/invoices' );
311
-					$invoice_id = $this->invoices->invoices->generate_receipt ( $post_array ['id'], $post_array ['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date );
310
+					$this->load->module('invoices/invoices');
311
+					$invoice_id = $this->invoices->invoices->generate_receipt($post_array ['id'], $post_array ['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date);
312 312
 					
313
-					$account_balance = $this->common->get_field_name ( 'balance', 'accounts', $post_array ['id'] );
314
-					$insert_arr = array (
313
+					$account_balance = $this->common->get_field_name('balance', 'accounts', $post_array ['id']);
314
+					$insert_arr = array(
315 315
 							"accountid" => $post_array ['id'],
316
-							"description" => trim ( $post_array ['notes'] ),
316
+							"description" => trim($post_array ['notes']),
317 317
 							"debit" => '0',
318 318
 							"credit" => $post_array ['credit'],
319
-							"created_date" => gmdate ( "Y-m-d H:i:s" ),
319
+							"created_date" => gmdate("Y-m-d H:i:s"),
320 320
 							"invoiceid" => $invoice_id,
321 321
 							"reseller_id" => '0',
322 322
 							"item_type" => 'Refill',
@@ -324,267 +324,267 @@  discard block
 block discarded – undo
324 324
 							'before_balance' => 0,
325 325
 							'after_balance' => $account_balance 
326 326
 					);
327
-					$this->db->insert ( "invoice_details", $insert_arr );
327
+					$this->db->insert("invoice_details", $insert_arr);
328 328
 				}
329 329
 				// end
330
-				if (isset ( $add_array ['tax_id'] )) {
331
-					foreach ( $add_array ['tax_id'] as $key => $val ) {
332
-						$data1 = array (
330
+				if (isset ($add_array ['tax_id'])) {
331
+					foreach ($add_array ['tax_id'] as $key => $val) {
332
+						$data1 = array(
333 333
 								'accountid' => $last_id,
334 334
 								'taxes_id' => $val 
335 335
 						);
336
-						$this->accounts_model->add_account_tax ( $data1 );
336
+						$this->accounts_model->add_account_tax($data1);
337 337
 					}
338
-					unset ( $add_array ['tax_id'] );
338
+					unset ($add_array ['tax_id']);
339 339
 				}
340
-				$this->session->set_flashdata ( 'astpp_errormsg', ucfirst ( $entity_name ) . ' added successfully!' );
341
-				redirect ( base_url () . 'accounts/customer_list/' );
340
+				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name).' added successfully!');
341
+				redirect(base_url().'accounts/customer_list/');
342 342
 				exit ();
343 343
 			}
344
-			$this->load->view ( 'view_accounts_create', $data );
344
+			$this->load->view('view_accounts_create', $data);
345 345
 		}
346 346
 	}
347 347
 	function provider_speeddial($edit_id) {
348
-		$this->customer_speeddial ( $edit_id );
348
+		$this->customer_speeddial($edit_id);
349 349
 	}
350 350
 	function customer_speeddial($edit_id) {
351 351
 		// Get Account information from session.
352
-		$data ['page_title'] = gettext ( "Speed Dial" );
353
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
352
+		$data ['page_title'] = gettext("Speed Dial");
353
+		$accountinfo = $this->session->userdata('accountinfo');
354 354
 		// Get Parent informartion
355 355
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
356
-		$where = array (
356
+		$where = array(
357 357
 				'id' => $edit_id,
358 358
 				"reseller_id" => $reseller_id 
359 359
 		);
360
-		$account = $this->db_model->getSelect ( "*", "accounts", $where );
360
+		$account = $this->db_model->getSelect("*", "accounts", $where);
361 361
 		
362 362
 		if ($account->num_rows > 0) {
363
-			$account_data = ( array ) $account->first_row ();
364
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
365
-			$data ['page_title'] = gettext ( 'Speed Dial' );
363
+			$account_data = (array)$account->first_row();
364
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
365
+			$data ['page_title'] = gettext('Speed Dial');
366 366
 			$data ['accounttype'] = $accounttype;
367 367
 			$data ['invoice_date'] = $account_data ['invoice_day'];
368 368
 			$data ["account_data"] = $account_data;
369 369
 			$data ['edit_id'] = $edit_id;
370
-			$speeddial_res = $this->db->get_where ( "speed_dial", array (
370
+			$speeddial_res = $this->db->get_where("speed_dial", array(
371 371
 					"accountid" => $edit_id 
372
-			) );
373
-			$speeddial_info = array ();
374
-			if ($speeddial_res->num_rows () > 0) {
375
-				$speeddial_res = $speeddial_res->result_array ();
376
-				foreach ( $speeddial_res as $key => $value ) {
372
+			));
373
+			$speeddial_info = array();
374
+			if ($speeddial_res->num_rows() > 0) {
375
+				$speeddial_res = $speeddial_res->result_array();
376
+				foreach ($speeddial_res as $key => $value) {
377 377
 					$speeddial_info [$value ['speed_num']] = $value ['number'];
378 378
 				}
379 379
 			}
380 380
 			$data ['speeddial'] = $speeddial_info;
381
-			$data ['form'] = $this->form->build_form ( $this->accounts_form->get_customer_form_fields ( $accounttype, $edit_id ), $account_data );
382
-			$this->load->view ( 'view_customer_speed_dial', $data );
381
+			$data ['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($accounttype, $edit_id), $account_data);
382
+			$this->load->view('view_customer_speed_dial', $data);
383 383
 		} else {
384
-			redirect ( base_url () . 'accounts/customer_list/' );
384
+			redirect(base_url().'accounts/customer_list/');
385 385
 		}
386 386
 	}
387 387
 	function customer_speeddial_save($number, $accountid, $speed_num) {
388
-		$where = array (
388
+		$where = array(
389 389
 				"accountid" => $accountid 
390 390
 		);
391
-		$account = $this->db_model->getSelect ( "*", "speed_dial", $where );
392
-		if ($account->num_rows () == 0) {
393
-			for($i = 0; $i <= 9; $i ++) {
391
+		$account = $this->db_model->getSelect("*", "speed_dial", $where);
392
+		if ($account->num_rows() == 0) {
393
+			for ($i = 0; $i <= 9; $i++) {
394 394
 				$dest_number = $speed_num == $i ? $number : '';
395
-				$data [$i] = array (
395
+				$data [$i] = array(
396 396
 						"number" => $dest_number,
397 397
 						"speed_num" => $i,
398 398
 						'accountid' => $accountid 
399 399
 				);
400 400
 			}
401
-			$this->db->insert_batch ( 'speed_dial', $data );
401
+			$this->db->insert_batch('speed_dial', $data);
402 402
 		} else {
403
-			$updateinfo = array (
403
+			$updateinfo = array(
404 404
 					'number' => $number 
405 405
 			);
406
-			$this->db->where ( 'speed_num', $speed_num );
407
-			$this->db->where ( 'accountid', $accountid );
408
-			$result = $this->db->update ( 'speed_dial', $updateinfo );
406
+			$this->db->where('speed_num', $speed_num);
407
+			$this->db->where('accountid', $accountid);
408
+			$result = $this->db->update('speed_dial', $updateinfo);
409 409
 		}
410 410
 	}
411 411
 	function customer_speeddial_remove($accountid, $speed_num) {
412
-		$updateinfo = array (
412
+		$updateinfo = array(
413 413
 				'number' => '' 
414 414
 		);
415
-		$this->db->where ( 'speed_num', $speed_num );
416
-		$this->db->where ( 'accountid', $accountid );
417
-		$result = $this->db->update ( 'speed_dial', $updateinfo );
415
+		$this->db->where('speed_num', $speed_num);
416
+		$this->db->where('accountid', $accountid);
417
+		$result = $this->db->update('speed_dial', $updateinfo);
418 418
 	}
419 419
 	function provider_ipmap($edit_id) {
420
-		$this->customer_ipmap ( $edit_id );
420
+		$this->customer_ipmap($edit_id);
421 421
 	}
422 422
 	function customer_ipmap($edit_id) {
423
-		$data ['page_title'] = gettext ( "IP Settings" );
423
+		$data ['page_title'] = gettext("IP Settings");
424 424
 		$data ['add_form'] = true;
425 425
 		// Get Account information from session.
426
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
426
+		$accountinfo = $this->session->userdata('accountinfo');
427 427
 		// Get Parent informartion
428 428
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
429
-		$where = array (
429
+		$where = array(
430 430
 				'id' => $edit_id,
431 431
 				"reseller_id" => $reseller_id 
432 432
 		);
433
-		$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
433
+		$account_res = $this->db_model->getSelect("type", "accounts", $where);
434 434
 		if ($account_res->num_rows > 0) {
435
-			$account_data = ( array ) $account_res->first_row ();
436
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
437
-			$data ["grid_fields"] = $this->accounts_form->build_ip_list_for_customer ( $edit_id, $accounttype );
435
+			$account_data = (array)$account_res->first_row();
436
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
437
+			$data ["grid_fields"] = $this->accounts_form->build_ip_list_for_customer($edit_id, $accounttype);
438 438
 			$data ['edit_id'] = $edit_id;
439 439
 			$data ['accounttype'] = $accounttype;
440
-			$this->load->view ( 'view_customer_ipmap', $data );
440
+			$this->load->view('view_customer_ipmap', $data);
441 441
 		} else {
442
-			redirect ( base_url () . 'accounts/customer_list/' );
442
+			redirect(base_url().'accounts/customer_list/');
443 443
 			exit ();
444 444
 		}
445 445
 	}
446 446
 	function customer_ipmap_json($accountid, $accounttype) {
447
-		$json_data = array ();
448
-		$where = array (
447
+		$json_data = array();
448
+		$where = array(
449 449
 				"accountid" => $accountid 
450 450
 		);
451
-		$instant_search = $this->session->userdata ( 'left_panel_search_' . $accounttype . '_ipmap' );
452
-		$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;
453
-		if (! empty ( $like_str ))
454
-			$this->db->where ( $like_str );
455
-		$count_all = $this->db_model->countQuery ( "*", "ip_map", $where );
456
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
451
+		$instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_ipmap');
452
+		$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;
453
+		if ( ! empty ($like_str))
454
+			$this->db->where($like_str);
455
+		$count_all = $this->db_model->countQuery("*", "ip_map", $where);
456
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
457 457
 		$json_data = $paging_data ["json_paging"];
458
-		if (! empty ( $like_str ))
459
-			$this->db->where ( $like_str );
460
-		$query = $this->db_model->select ( "*", "ip_map", $where, "id", "ASC", $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"] );
461
-		$grid_fields = json_decode ( $this->accounts_form->build_ip_list_for_customer ( $accountid, $accounttype ) );
462
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
458
+		if ( ! empty ($like_str))
459
+			$this->db->where($like_str);
460
+		$query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"]);
461
+		$grid_fields = json_decode($this->accounts_form->build_ip_list_for_customer($accountid, $accounttype));
462
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
463 463
 		
464
-		echo json_encode ( $json_data );
464
+		echo json_encode($json_data);
465 465
 	}
466 466
 	function provider_ipmap_action($action, $accountid, $accounttype, $ipmapid = "") {
467
-		$this->customer_ipmap_action ( $action, $accountid, $accounttype, $ipmapid );
467
+		$this->customer_ipmap_action($action, $accountid, $accounttype, $ipmapid);
468 468
 	}
469 469
 	function customer_ipmap_action($action, $accountid, $accounttype, $ipmapid = "") {
470
-		$add_array = $this->input->post ();
470
+		$add_array = $this->input->post();
471 471
 		if ($action == "add") {
472 472
 			if ($add_array ['ip'] != "") {
473 473
 				$ip = $add_array ['ip'];
474
-				if (strpos ( $ip, '/' ) !== false) {
474
+				if (strpos($ip, '/') !== false) {
475 475
 					$add_array ['ip'] = $add_array ['ip'];
476 476
 				} else {
477
-					$add_array ['ip'] = $add_array ['ip'] . '/32';
477
+					$add_array ['ip'] = $add_array ['ip'].'/32';
478 478
 				}
479
-				$where = array (
480
-						"ip" => trim ( $add_array ['ip'] ),
481
-						"prefix" => trim ( $add_array ['prefix'] ) 
479
+				$where = array(
480
+						"ip" => trim($add_array ['ip']),
481
+						"prefix" => trim($add_array ['prefix']) 
482 482
 				);
483
-				$getdata = $this->db_model->countQuery ( "*", "ip_map", $where );
483
+				$getdata = $this->db_model->countQuery("*", "ip_map", $where);
484 484
 				if ($getdata > 0) {
485
-					$this->session->set_flashdata ( 'astpp_notification', 'IP already exist in system.' );
485
+					$this->session->set_flashdata('astpp_notification', 'IP already exist in system.');
486 486
 				} else {
487 487
 					if ($accounttype == "provider") {
488 488
 						$add_array ['pricelist_id'] = 0;
489 489
 					}
490
-					unset ( $add_array ['action'] );
490
+					unset ($add_array ['action']);
491 491
 					$add_array ['context'] = 'default';
492 492
 					$add_array ['accountid'] = $accountid;
493
-					$ip_flag = $this->db->insert ( "ip_map", $add_array );
493
+					$ip_flag = $this->db->insert("ip_map", $add_array);
494 494
 					if ($ip_flag) {
495
-						$this->load->library ( 'freeswitch_lib' );
496
-						$this->load->module ( 'freeswitch/freeswitch' );
495
+						$this->load->library('freeswitch_lib');
496
+						$this->load->module('freeswitch/freeswitch');
497 497
 						$command = "api reloadacl";
498
-						$response = $this->freeswitch_model->reload_freeswitch ( $command );
499
-						$this->session->set_userdata ( 'astpp_notification', $response );
498
+						$response = $this->freeswitch_model->reload_freeswitch($command);
499
+						$this->session->set_userdata('astpp_notification', $response);
500 500
 					}
501
-					$this->session->set_flashdata ( 'astpp_errormsg', 'IP added sucessfully.' );
501
+					$this->session->set_flashdata('astpp_errormsg', 'IP added sucessfully.');
502 502
 				}
503 503
 			}
504 504
 		}
505 505
 		if ($action == "delete") {
506
-			$ip_flag = $this->db_model->delete ( "ip_map", array (
506
+			$ip_flag = $this->db_model->delete("ip_map", array(
507 507
 					"id" => $ipmapid 
508
-			) );
508
+			));
509 509
 			if ($ip_flag) {
510
-				$this->load->library ( 'freeswitch_lib' );
511
-				$this->load->model ( "freeswitch_model" );
510
+				$this->load->library('freeswitch_lib');
511
+				$this->load->model("freeswitch_model");
512 512
 				$command = "api reloadacl";
513
-				$this->freeswitch_model->reload_freeswitch ( $command );
513
+				$this->freeswitch_model->reload_freeswitch($command);
514 514
 			}
515
-			$this->session->set_flashdata ( 'astpp_notification', 'IP removed sucessfully.' );
515
+			$this->session->set_flashdata('astpp_notification', 'IP removed sucessfully.');
516 516
 		}
517
-		redirect ( base_url () . "accounts/" . $accounttype . "_ipmap/" . $accountid . "/" );
517
+		redirect(base_url()."accounts/".$accounttype."_ipmap/".$accountid."/");
518 518
 	}
519 519
 	
520 520
 	// This function using for provider t
521 521
 	function provider_animap($edit_id) {
522
-		$this->customer_animap ( $edit_id, 'provider' );
522
+		$this->customer_animap($edit_id, 'provider');
523 523
 	}
524 524
 	
525 525
 	// This function using for showing data of customer/provider CallerID Tab
526 526
 	function customer_animap($edit_id, $entity_type = 'customer') {
527 527
 		// Get Account information from session.
528
-		$data ['page_title'] = gettext ( "Caller ID" );
529
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
528
+		$data ['page_title'] = gettext("Caller ID");
529
+		$accountinfo = $this->session->userdata('accountinfo');
530 530
 		// Get Parent informartion
531 531
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
532
-		$where = array (
532
+		$where = array(
533 533
 				'id' => $edit_id,
534 534
 				"reseller_id" => $reseller_id 
535 535
 		);
536
-		$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
536
+		$account_res = $this->db_model->getSelect("type", "accounts", $where);
537 537
 		if ($account_res->num_rows > 0) {
538
-			$account_data = ( array ) $account_res->first_row ();
539
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
540
-			$data ["grid_fields"] = $this->accounts_form->build_animap_list_for_customer ( $edit_id, $accounttype );
538
+			$account_data = (array)$account_res->first_row();
539
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
540
+			$data ["grid_fields"] = $this->accounts_form->build_animap_list_for_customer($edit_id, $accounttype);
541 541
 			$data ['edit_id'] = $edit_id;
542 542
 			$data ['accounttype'] = $accounttype;
543
-			$this->load->view ( 'view_customer_animap', $data );
543
+			$this->load->view('view_customer_animap', $data);
544 544
 		} else {
545
-			redirect ( base_url () . 'accounts/customer_list/' );
545
+			redirect(base_url().'accounts/customer_list/');
546 546
 			exit ();
547 547
 		}
548 548
 	}
549 549
 	function customer_animap_json($accountid, $accounttype) {
550
-		$json_data = array ();
551
-		$instant_search = $this->session->userdata ( 'left_panel_search_' . $accounttype . '_animap' );
552
-		$like_str = ! empty ( $instant_search ) ? "(number like '%$instant_search%'  OR  creation_date like '%$instant_search%' )" : null;
553
-		if (! empty ( $like_str ))
554
-			$this->db->where ( $like_str );
555
-		$where = array (
550
+		$json_data = array();
551
+		$instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_animap');
552
+		$like_str = ! empty ($instant_search) ? "(number like '%$instant_search%'  OR  creation_date like '%$instant_search%' )" : null;
553
+		if ( ! empty ($like_str))
554
+			$this->db->where($like_str);
555
+		$where = array(
556 556
 				"accountid" => $accountid 
557 557
 		);
558
-		$count_all = $this->db_model->countQuery ( "*", "ani_map", $where );
558
+		$count_all = $this->db_model->countQuery("*", "ani_map", $where);
559 559
 		
560
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
560
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
561 561
 		$json_data = $paging_data ["json_paging"];
562
-		if (! empty ( $like_str ))
563
-			$this->db->where ( $like_str );
564
-		$query = $this->db_model->select ( "*", "ani_map", $where, "id", "ASC", $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"] );
562
+		if ( ! empty ($like_str))
563
+			$this->db->where($like_str);
564
+		$query = $this->db_model->select("*", "ani_map", $where, "id", "ASC", $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"]);
565 565
 		
566
-		$grid_fields = json_decode ( $this->accounts_form->build_animap_list_for_customer ( $accountid, $accounttype ) );
567
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
566
+		$grid_fields = json_decode($this->accounts_form->build_animap_list_for_customer($accountid, $accounttype));
567
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
568 568
 		
569
-		echo json_encode ( $json_data );
569
+		echo json_encode($json_data);
570 570
 	}
571 571
 	function provider_animap_action($action, $accountid, $aniid = "") {
572
-		$this->customer_animap_action ( $action, $accountid, $aniid );
572
+		$this->customer_animap_action($action, $accountid, $aniid);
573 573
 	}
574 574
 	
575 575
 	// This function using for customer/provider callerID add/delete
576 576
 	function customer_animap_action($action, $accountid, $aniid = "") {
577
-		$entity_type = $this->common->get_field_name ( 'type', 'accounts', array (
577
+		$entity_type = $this->common->get_field_name('type', 'accounts', array(
578 578
 				'id' => $accountid 
579
-		) );
580
-		$entity_type = strtolower ( $this->common->get_entity_type ( '', '', $entity_type ) );
581
-		$url = "accounts/" . $entity_type . "_animap/$accountid/";
579
+		));
580
+		$entity_type = strtolower($this->common->get_entity_type('', '', $entity_type));
581
+		$url = "accounts/".$entity_type."_animap/$accountid/";
582 582
 		if ($action == "add") {
583
-			$ani = $this->input->post ();
584
-			$this->db->where ( 'number', $ani ['number'] );
585
-			$this->db->select ( 'count(id) as count' );
586
-			$cnt_result = $this->db->get ( 'ani_map' );
587
-			$cnt_result = $cnt_result->result_array ();
583
+			$ani = $this->input->post();
584
+			$this->db->where('number', $ani ['number']);
585
+			$this->db->select('count(id) as count');
586
+			$cnt_result = $this->db->get('ani_map');
587
+			$cnt_result = $cnt_result->result_array();
588 588
 			$count = $cnt_result [0] ['count'];
589 589
 			if ($count == 0) {
590 590
 				if ($ani ['number'] != "") {
@@ -592,249 +592,249 @@  discard block
 block discarded – undo
592 592
 					 * ASTPP 3.0
593 593
 					 * Add creation field
594 594
 					 */
595
-					$insert_arr = array (
596
-							'creation_date' => gmdate ( 'Y-m-d H:i:s' ),
597
-							"number" => $this->input->post ( 'number' ),
595
+					$insert_arr = array(
596
+							'creation_date' => gmdate('Y-m-d H:i:s'),
597
+							"number" => $this->input->post('number'),
598 598
 							"accountid" => $accountid,
599 599
 							"context" => "default" 
600 600
 					);
601 601
 					/* * *********************************** */
602
-					$this->db->insert ( "ani_map", $insert_arr );
603
-					$this->session->set_flashdata ( 'astpp_errormsg', 'Caller ID added successfully!' );
602
+					$this->db->insert("ani_map", $insert_arr);
603
+					$this->session->set_flashdata('astpp_errormsg', 'Caller ID added successfully!');
604 604
 				} else {
605
-					$this->session->set_flashdata ( 'astpp_notification', 'Please Enter Caller ID value.' );
605
+					$this->session->set_flashdata('astpp_notification', 'Please Enter Caller ID value.');
606 606
 				}
607 607
 			} else {
608
-				$this->session->set_flashdata ( 'astpp_notification', ' Caller ID already Exists.' );
608
+				$this->session->set_flashdata('astpp_notification', ' Caller ID already Exists.');
609 609
 			}
610 610
 		}
611 611
 		if ($action == "delete") {
612
-			$this->session->set_flashdata ( 'astpp_notification', 'Caller ID removed sucessfully!' );
613
-			$this->db_model->delete ( "ani_map", array (
612
+			$this->session->set_flashdata('astpp_notification', 'Caller ID removed sucessfully!');
613
+			$this->db_model->delete("ani_map", array(
614 614
 					"id" => $aniid 
615
-			) );
615
+			));
616 616
 		}
617
-		redirect ( base_url () . $url );
617
+		redirect(base_url().$url);
618 618
 	}
619 619
 	
620 620
 	// This function using by Customer/Provider edit tab
621 621
 	function customer_details_json($module, $accountid) {
622
-		$entity_type = $this->common->get_field_name ( 'type', 'accounts', array (
622
+		$entity_type = $this->common->get_field_name('type', 'accounts', array(
623 623
 				'id' => $accountid 
624
-		) );
625
-		$entity_type = strtolower ( $this->common->get_entity_type ( '', '', $entity_type ) );
624
+		));
625
+		$entity_type = strtolower($this->common->get_entity_type('', '', $entity_type));
626 626
 		if ($module == "pattern") {
627
-			$this->load->module ( 'rates/rates' );
628
-			$this->rates->customer_block_pattern_list ( $accountid, $entity_type );
627
+			$this->load->module('rates/rates');
628
+			$this->rates->customer_block_pattern_list($accountid, $entity_type);
629 629
 		}
630 630
 		if ($module == "freeswitch") {
631
-			$this->load->module ( 'freeswitch/freeswitch' );
632
-			$this->freeswitch->customer_fssipdevices_json ( $accountid, $entity_type );
631
+			$this->load->module('freeswitch/freeswitch');
632
+			$this->freeswitch->customer_fssipdevices_json($accountid, $entity_type);
633 633
 		}
634 634
 		if ($module == "did") {
635
-			$this->load->module ( 'did/did' );
636
-			$this->did->customer_did ( $accountid, $entity_type );
635
+			$this->load->module('did/did');
636
+			$this->did->customer_did($accountid, $entity_type);
637 637
 		}
638 638
 		if ($module == "invoices") {
639
-			$this->load->module ( 'invoices/invoices' );
640
-			$this->invoices->customer_invoices ( $accountid, $entity_type, false );
639
+			$this->load->module('invoices/invoices');
640
+			$this->invoices->customer_invoices($accountid, $entity_type, false);
641 641
 		}
642 642
 		if ($module == "subscription") {
643
-			$this->load->module ( 'charges/charges' );
644
-			$this->charges->customer_charge_list ( $accountid, $entity_type );
643
+			$this->load->module('charges/charges');
644
+			$this->charges->customer_charge_list($accountid, $entity_type);
645 645
 		}
646 646
 		if ($module == "cdrs") {
647
-			$this->load->module ( 'reports/reports' );
648
-			$this->reports->customer_cdrreport ( $accountid, $entity_type );
647
+			$this->load->module('reports/reports');
648
+			$this->reports->customer_cdrreport($accountid, $entity_type);
649 649
 		}
650 650
 		if ($module == "charges") {
651
-			$this->load->module ( 'reports/reports' );
652
-			$this->reports->customer_charge_history ( $accountid, $entity_type );
651
+			$this->load->module('reports/reports');
652
+			$this->reports->customer_charge_history($accountid, $entity_type);
653 653
 		}
654 654
 		if ($module == "refill") {
655
-			$this->load->module ( 'reports/reports' );
656
-			$this->reports->customer_refillreport ( $accountid, $entity_type );
655
+			$this->load->module('reports/reports');
656
+			$this->reports->customer_refillreport($accountid, $entity_type);
657 657
 		}
658 658
 		if ($module == "emailhistory") {
659
-			$this->load->module ( 'email/email' );
660
-			$this->email->customer_mail_record ( $accountid, $entity_type );
659
+			$this->load->module('email/email');
660
+			$this->email->customer_mail_record($accountid, $entity_type);
661 661
 		}
662 662
 		if ($module == "opensips") {
663
-			$this->load->module ( 'opensips/opensips' );
664
-			$this->opensips->customer_opensips_json ( $accountid, $entity_type );
663
+			$this->load->module('opensips/opensips');
664
+			$this->opensips->customer_opensips_json($accountid, $entity_type);
665 665
 		}
666 666
 	}
667 667
 	function customer_details_search($module_name) {
668
-		$action = $this->input->post ();
669
-		$this->session->set_userdata ( 'left_panel_search_' . $module_name, "" );
670
-		if (! empty ( $action ['left_panel_search'] )) {
671
-			$this->session->set_userdata ( 'left_panel_search_' . $module_name, $action ['left_panel_search'] );
668
+		$action = $this->input->post();
669
+		$this->session->set_userdata('left_panel_search_'.$module_name, "");
670
+		if ( ! empty ($action ['left_panel_search'])) {
671
+			$this->session->set_userdata('left_panel_search_'.$module_name, $action ['left_panel_search']);
672 672
 		}
673 673
 	}
674 674
 	function provider_sipdevices($edit_id) {
675
-		$this->customer_sipdevices ( $edit_id );
675
+		$this->customer_sipdevices($edit_id);
676 676
 	}
677 677
 	function customer_sipdevices($edit_id) {
678
-		$data ['page_title'] = gettext ( "SIP Devices" );
678
+		$data ['page_title'] = gettext("SIP Devices");
679 679
 		// Get Account information from session.
680
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
680
+		$accountinfo = $this->session->userdata('accountinfo');
681 681
 		// Get Parent informartion
682 682
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
683
-		$where = array (
683
+		$where = array(
684 684
 				'id' => $edit_id,
685 685
 				"reseller_id" => $reseller_id 
686 686
 		);
687
-		$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
687
+		$account_res = $this->db_model->getSelect("type", "accounts", $where);
688 688
 		if ($account_res->num_rows > 0) {
689
-			$account_data = ( array ) $account_res->first_row ();
690
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
691
-			$this->load->module ( 'freeswitch/freeswitch' );
692
-			$data ["grid_buttons"] = $this->freeswitch->freeswitch_form->fsdevices_build_grid_buttons ( $edit_id, $accounttype );
693
-			$data ['grid_fields'] = $this->freeswitch->freeswitch_form->build_devices_list_for_customer ();
689
+			$account_data = (array)$account_res->first_row();
690
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
691
+			$this->load->module('freeswitch/freeswitch');
692
+			$data ["grid_buttons"] = $this->freeswitch->freeswitch_form->fsdevices_build_grid_buttons($edit_id, $accounttype);
693
+			$data ['grid_fields'] = $this->freeswitch->freeswitch_form->build_devices_list_for_customer();
694 694
 			$data ['edit_id'] = $edit_id;
695 695
 			$data ['accounttype'] = $accounttype;
696
-			$this->load->view ( 'view_customer_sipdevices', $data );
696
+			$this->load->view('view_customer_sipdevices', $data);
697 697
 		} else {
698
-			redirect ( base_url () . 'accounts/customer_list/' );
698
+			redirect(base_url().'accounts/customer_list/');
699 699
 			exit ();
700 700
 		}
701 701
 	}
702 702
 	function provider_fssipdevices_action($action, $id, $accountid) {
703
-		$this->customer_fssipdevices_action ( $action, $id, $accountid );
703
+		$this->customer_fssipdevices_action($action, $id, $accountid);
704 704
 	}
705 705
 	function customer_fssipdevices_action($action, $id, $accountid) {
706
-		$entity_type = $this->common->get_field_name ( 'type', 'accounts', array (
706
+		$entity_type = $this->common->get_field_name('type', 'accounts', array(
707 707
 				'id' => $accountid 
708
-		) );
709
-		$entity_type = strtolower ( $this->common->get_entity_type ( '', '', $entity_type ) );
710
-		$this->load->module ( 'freeswitch/freeswitch' );
708
+		));
709
+		$entity_type = strtolower($this->common->get_entity_type('', '', $entity_type));
710
+		$this->load->module('freeswitch/freeswitch');
711 711
 		if ($action == "delete") {
712
-			$this->freeswitch->freeswitch_model->delete_freeswith_devices ( $id );
713
-			$this->session->set_flashdata ( 'astpp_notification', 'Sip Device removed successfully!' );
714
-			redirect ( base_url () . "accounts/" . $entity_type . "_sipdevices/$accountid/" );
712
+			$this->freeswitch->freeswitch_model->delete_freeswith_devices($id);
713
+			$this->session->set_flashdata('astpp_notification', 'Sip Device removed successfully!');
714
+			redirect(base_url()."accounts/".$entity_type."_sipdevices/$accountid/");
715 715
 		}
716 716
 		if ($action == "edit") {
717
-			$this->freeswitch->customer_fssipdevices_edit ( $id, $accountid );
718
-			$this->session->set_flashdata ( 'astpp_errormsg', 'Sip updated successfully!' );
717
+			$this->freeswitch->customer_fssipdevices_edit($id, $accountid);
718
+			$this->session->set_flashdata('astpp_errormsg', 'Sip updated successfully!');
719 719
 		}
720 720
 	}
721 721
 	function provider_opensips($edit_id) {
722
-		$this->customer_opensips ( $edit_id );
722
+		$this->customer_opensips($edit_id);
723 723
 	}
724 724
 	function customer_opensips($edit_id) {
725
-		$data ['page_title'] = gettext ( "Opensips Devices" );
725
+		$data ['page_title'] = gettext("Opensips Devices");
726 726
 		// Get Account information from session.
727
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
727
+		$accountinfo = $this->session->userdata('accountinfo');
728 728
 		// Get Parent informartion
729 729
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
730
-		$where = array (
730
+		$where = array(
731 731
 				'id' => $edit_id,
732 732
 				"reseller_id" => $reseller_id 
733 733
 		);
734
-		$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
734
+		$account_res = $this->db_model->getSelect("type", "accounts", $where);
735 735
 		if ($account_res->num_rows > 0) {
736
-			$account_data = ( array ) $account_res->first_row ();
737
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
738
-			$this->load->module ( 'freeswitch/freeswitch' );
739
-			$this->load->module ( 'opensips/opensips' );
740
-			$data ["grid_buttons"] = $this->opensips->opensips_form->opensips_customer_build_grid_buttons ( $edit_id );
741
-			$data ['grid_fields'] = $this->opensips->opensips_form->opensips_customer_build_opensips_list ( $edit_id );
736
+			$account_data = (array)$account_res->first_row();
737
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
738
+			$this->load->module('freeswitch/freeswitch');
739
+			$this->load->module('opensips/opensips');
740
+			$data ["grid_buttons"] = $this->opensips->opensips_form->opensips_customer_build_grid_buttons($edit_id);
741
+			$data ['grid_fields'] = $this->opensips->opensips_form->opensips_customer_build_opensips_list($edit_id);
742 742
 			$data ['edit_id'] = $edit_id;
743 743
 			$data ['accounttype'] = $accounttype;
744
-			$this->load->view ( 'view_customer_opensips_devices', $data );
744
+			$this->load->view('view_customer_opensips_devices', $data);
745 745
 		} else {
746
-			redirect ( base_url () . 'accounts/customer_list/' );
746
+			redirect(base_url().'accounts/customer_list/');
747 747
 			exit ();
748 748
 		}
749 749
 	}
750 750
 	function customer_opensips_action($action, $accountid, $id) {
751
-		$entity_type = $this->common->get_field_name ( 'type', 'accounts', array (
751
+		$entity_type = $this->common->get_field_name('type', 'accounts', array(
752 752
 				'id' => $accountid 
753
-		) );
754
-		$entity_type = strtolower ( $this->common->get_entity_type ( '', '', $entity_type ) );
755
-		$url = "accounts/" . $entity_type . "_opensips/$accountid/";
756
-		$this->load->module ( 'opensips/opensips' );
753
+		));
754
+		$entity_type = strtolower($this->common->get_entity_type('', '', $entity_type));
755
+		$url = "accounts/".$entity_type."_opensips/$accountid/";
756
+		$this->load->module('opensips/opensips');
757 757
 		if ($action == "delete") {
758
-			$this->opensips->opensips_model->remove_opensips ( $id );
759
-			$this->session->set_flashdata ( 'astpp_notification', 'Opensips removed successfully!' );
760
-			redirect ( base_url () . $url );
758
+			$this->opensips->opensips_model->remove_opensips($id);
759
+			$this->session->set_flashdata('astpp_notification', 'Opensips removed successfully!');
760
+			redirect(base_url().$url);
761 761
 		}
762 762
 		if ($action == "edit") {
763
-			$this->opensips->customer_opensips_edit ( $accountid, $id );
764
-			$this->session->set_flashdata ( 'astpp_errormsg', 'Opensips updated successfully!' );
763
+			$this->opensips->customer_opensips_edit($accountid, $id);
764
+			$this->session->set_flashdata('astpp_errormsg', 'Opensips updated successfully!');
765 765
 		}
766 766
 	}
767 767
 	function provider_charges($edit_id) {
768
-		$this->customer_charges ( $edit_id );
768
+		$this->customer_charges($edit_id);
769 769
 	}
770 770
 	function reseller_charges($edit_id) {
771
-		$this->customer_charges ( $edit_id );
771
+		$this->customer_charges($edit_id);
772 772
 	}
773 773
 	function customer_charges($edit_id) {
774
-		$data ['page_title'] = gettext ( "Charges History" );
774
+		$data ['page_title'] = gettext("Charges History");
775 775
 		// Get Account information from session.
776
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
776
+		$accountinfo = $this->session->userdata('accountinfo');
777 777
 		// Get Parent informartion
778 778
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
779
-		$where = array (
779
+		$where = array(
780 780
 				'id' => $edit_id,
781 781
 				"reseller_id" => $reseller_id 
782 782
 		);
783
-		$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
783
+		$account_res = $this->db_model->getSelect("type", "accounts", $where);
784 784
 		if ($account_res->num_rows > 0) {
785
-			$account_data = ( array ) $account_res->first_row ();
786
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
787
-			$data ['chargelist'] = form_dropdown ( 'applayable_charge', $this->Astpp_common->list_applyable_charges ( $edit_id ), '' );
788
-			$this->load->module ( 'reports/reports' );
789
-			$data ['grid_fields'] = $this->reports->reports_form->build_charge_list_for_customer ( $edit_id, $accounttype );
785
+			$account_data = (array)$account_res->first_row();
786
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
787
+			$data ['chargelist'] = form_dropdown('applayable_charge', $this->Astpp_common->list_applyable_charges($edit_id), '');
788
+			$this->load->module('reports/reports');
789
+			$data ['grid_fields'] = $this->reports->reports_form->build_charge_list_for_customer($edit_id, $accounttype);
790 790
 			$data ['edit_id'] = $edit_id;
791 791
 			$data ['accounttype'] = $accounttype;
792
-			$this->load->view ( 'view_customer_charges', $data );
792
+			$this->load->view('view_customer_charges', $data);
793 793
 		} else {
794
-			redirect ( base_url () . 'accounts/customer_list/' );
794
+			redirect(base_url().'accounts/customer_list/');
795 795
 			exit ();
796 796
 		}
797 797
 	}
798 798
 	function provider_subscription($edit_id) {
799
-		$this->customer_subscription ( $edit_id );
799
+		$this->customer_subscription($edit_id);
800 800
 	}
801 801
 	function reseller_subscription($edit_id) {
802
-		$this->customer_subscription ( $edit_id );
802
+		$this->customer_subscription($edit_id);
803 803
 	}
804 804
 	function customer_subscription($edit_id) {
805
-		$data ['page_title'] = gettext ( "Subscription" );
805
+		$data ['page_title'] = gettext("Subscription");
806 806
 		// Get Account information from session.
807
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
807
+		$accountinfo = $this->session->userdata('accountinfo');
808 808
 		// Get Parent informartion
809 809
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
810
-		$where = array (
810
+		$where = array(
811 811
 				'id' => $edit_id,
812 812
 				"reseller_id" => $reseller_id 
813 813
 		);
814
-		$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
814
+		$account_res = $this->db_model->getSelect("type", "accounts", $where);
815 815
 		if ($account_res->num_rows > 0) {
816
-			$account_data = ( array ) $account_res->first_row ();
817
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
818
-			$data ['chargelist'] = form_dropdown_all ( array (
816
+			$account_data = (array)$account_res->first_row();
817
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
818
+			$data ['chargelist'] = form_dropdown_all(array(
819 819
 					"name" => 'applayable_charge',
820 820
 					'id' => 'applayable_charge',
821 821
 					'class' => "" 
822
-			), $this->Astpp_common->list_applyable_charges ( $edit_id ), '' );
823
-			$this->load->module ( 'charges/charges' );
824
-			$data ['grid_fields'] = $this->charges->charges_form->build_charges_list_for_customer ( $edit_id, $accounttype );
822
+			), $this->Astpp_common->list_applyable_charges($edit_id), '');
823
+			$this->load->module('charges/charges');
824
+			$data ['grid_fields'] = $this->charges->charges_form->build_charges_list_for_customer($edit_id, $accounttype);
825 825
 			$data ['edit_id'] = $edit_id;
826 826
 			$data ['accounttype'] = $accounttype;
827
-			$this->load->view ( 'view_customer_subscriptions', $data );
827
+			$this->load->view('view_customer_subscriptions', $data);
828 828
 		} else {
829
-			redirect ( base_url () . 'accounts/customer_list/' );
829
+			redirect(base_url().'accounts/customer_list/');
830 830
 			exit ();
831 831
 		}
832 832
 	}
833 833
 	function reseller_subscription_action($action, $accountid, $accounttype, $chargeid = "") {
834
-		$this->customer_subscription_action ( $action, $accountid, $accounttype, $chargeid );
834
+		$this->customer_subscription_action($action, $accountid, $accounttype, $chargeid);
835 835
 	}
836 836
 	function provider_subscription_action($action, $accountid, $accounttype, $chargeid = "") {
837
-		$this->customer_subscription_action ( $action, $accountid, $accounttype, $chargeid );
837
+		$this->customer_subscription_action($action, $accountid, $accounttype, $chargeid);
838 838
 	}
839 839
 	
840 840
 	// /*ASTPP_invoice_changes_05_05_start*/
@@ -844,305 +844,305 @@  discard block
 block discarded – undo
844 844
 		 * ASTPP 3.0
845 845
 		 * For Email Broadcast when Subscription Add - Delete
846 846
 		 */
847
-		$accountinfo = $this->db_model->getSelect ( "*", "accounts", array (
847
+		$accountinfo = $this->db_model->getSelect("*", "accounts", array(
848 848
 				"id" => $accountid 
849
-		) );
850
-		$accountinfo = ( array ) $accountinfo->first_row ();
849
+		));
850
+		$accountinfo = (array)$accountinfo->first_row();
851 851
 		/* * ****************************** */
852 852
 		if ($action == "add") {
853
-			$charge_id = $this->input->post ( "applayable_charge", true );
853
+			$charge_id = $this->input->post("applayable_charge", true);
854 854
 			if ($charge_id != "") {
855
-				$insert_arr = array (
855
+				$insert_arr = array(
856 856
 						"charge_id" => $charge_id,
857 857
 						"accountid" => $accountid,
858
-						"assign_date" => gmdate ( "Y-m-d H:i:s" ) 
858
+						"assign_date" => gmdate("Y-m-d H:i:s") 
859 859
 				);
860
-				$this->db->insert ( "charge_to_account", $insert_arr );
861
-				require_once (APPPATH . 'controllers/ProcessCharges.php');
862
-				$ProcessCharges = new ProcessCharges ();
863
-				$Params = array (
860
+				$this->db->insert("charge_to_account", $insert_arr);
861
+				require_once (APPPATH.'controllers/ProcessCharges.php');
862
+				$ProcessCharges = new ProcessCharges();
863
+				$Params = array(
864 864
 						"ChargeID" => $charge_id,
865 865
 						"AccountInfo" => $accountinfo 
866 866
 				);
867
-				$ProcessCharges->BillAccountCharges ( "ACCOUNTSUBSCRIPTION", $Params );
867
+				$ProcessCharges->BillAccountCharges("ACCOUNTSUBSCRIPTION", $Params);
868 868
 				
869
-				$this->session->set_flashdata ( 'astpp_errormsg', 'Subscripton Added Sucessfully.' );
869
+				$this->session->set_flashdata('astpp_errormsg', 'Subscripton Added Sucessfully.');
870 870
 				$template_name = 'add_subscription';
871 871
 			}
872 872
 		}
873 873
 		if ($action == "delete") {
874 874
 			
875
-			require_once (APPPATH . 'controllers/ProcessCharges.php');
876
-			$ProcessCharges = new ProcessCharges ();
875
+			require_once (APPPATH.'controllers/ProcessCharges.php');
876
+			$ProcessCharges = new ProcessCharges();
877 877
 			
878
-			$Params = array (
878
+			$Params = array(
879 879
 					"ChargeID" => $chargeid,
880 880
 					"AccountInfo" => $accountinfo 
881 881
 			);
882
-			$ProcessCharges->BillAccountCharges ( "ACCOUNTSUBSCRIPTION", $Params );
882
+			$ProcessCharges->BillAccountCharges("ACCOUNTSUBSCRIPTION", $Params);
883 883
 			
884
-			$this->db_model->delete ( "charge_to_account", array (
884
+			$this->db_model->delete("charge_to_account", array(
885 885
 					"id" => $chargeid 
886
-			) );
887
-			$this->session->set_flashdata ( 'astpp_notification', 'Subscription Removed Sucessfully.' );
886
+			));
887
+			$this->session->set_flashdata('astpp_notification', 'Subscription Removed Sucessfully.');
888 888
 			$template_name = 'remove_subscription';
889 889
 		}
890 890
 		/**
891 891
 		 * ASTPP 3.0
892 892
 		 * For Email Broadcast when Subscription Delete
893 893
 		 */
894
-		$this->common->mail_to_users ( $template_name, $accountinfo );
894
+		$this->common->mail_to_users($template_name, $accountinfo);
895 895
 		/* * ********************************* */
896
-		redirect ( base_url () . "accounts/" . $accounttype . "_subscription/$accountid/" );
896
+		redirect(base_url()."accounts/".$accounttype."_subscription/$accountid/");
897 897
 	}
898 898
 	// END
899 899
 	function provider_dids($edit_id) {
900
-		$this->customer_dids ( $edit_id );
900
+		$this->customer_dids($edit_id);
901 901
 	}
902 902
 	function customer_dids($edit_id) {
903
-		$data ['page_title'] = gettext ( "DID" );
903
+		$data ['page_title'] = gettext("DID");
904 904
 		// Get Account information from session.
905
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
905
+		$accountinfo = $this->session->userdata('accountinfo');
906 906
 		// Get Parent informartion
907 907
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
908
-		$where = array (
908
+		$where = array(
909 909
 				'id' => $edit_id,
910 910
 				"reseller_id" => $reseller_id 
911 911
 		);
912
-		$account_res = $this->db_model->getSelect ( "type,country_id", "accounts", $where );
912
+		$account_res = $this->db_model->getSelect("type,country_id", "accounts", $where);
913 913
 		if ($account_res->num_rows > 0) {
914
-			$account_data = ( array ) $account_res->first_row ();
915
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
916
-			$this->load->module ( 'did/did' );
917
-			$data ['grid_fields'] = $this->did->did_form->build_did_list_for_customer ( $edit_id, $accounttype );
914
+			$account_data = (array)$account_res->first_row();
915
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
916
+			$this->load->module('did/did');
917
+			$data ['grid_fields'] = $this->did->did_form->build_did_list_for_customer($edit_id, $accounttype);
918 918
 			$data ['edit_id'] = $edit_id;
919 919
 			$data ['accounttype'] = $accounttype;
920
-			$result_did_final = array ();
921
-			$did_info = array (
920
+			$result_did_final = array();
921
+			$did_info = array(
922 922
 					"name" => "free_didlist",
923 923
 					"id" => "free_didlist",
924 924
 					"class" => "free_didlist" 
925 925
 			);
926
-			$data ['didlist'] = form_dropdown_all ( $did_info, $result_did_final, '' );
926
+			$data ['didlist'] = form_dropdown_all($did_info, $result_did_final, '');
927 927
 			$data ['country_id'] = $account_data ['country_id'];
928
-			$this->load->view ( 'view_customer_dids', $data );
928
+			$this->load->view('view_customer_dids', $data);
929 929
 		} else {
930
-			redirect ( base_url () . 'accounts/customer_list/' );
930
+			redirect(base_url().'accounts/customer_list/');
931 931
 			exit ();
932 932
 		}
933 933
 	}
934 934
 	function provider_dids_action($action, $accountid, $accounttype, $did_id = "") {
935
-		$this->customer_dids_action ( $action, $accountid, $accounttype, $did_id );
935
+		$this->customer_dids_action($action, $accountid, $accounttype, $did_id);
936 936
 	}
937 937
 	function reseller_dids_action($action, $accountid, $accounttype, $did_id = "") {
938
-		$this->customer_dids_action ( $action, $accountid, $accounttype, $did_id );
938
+		$this->customer_dids_action($action, $accountid, $accounttype, $did_id);
939 939
 	}
940 940
 	
941 941
 	// /*ASTPP_invoice_changes_05_05_start*/
942 942
 	function customer_dids_action($action, $accountid, $accounttype, $did_id = "") {
943 943
 		// Get account information from session.
944
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
944
+		$accountinfo = $this->session->userdata('accountinfo');
945 945
 		// Get Parent informartion
946 946
 		$reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
947
-		$did_id = empty ( $did_id ) ? $this->input->post ( "free_didlist", true ) : $did_id;
947
+		$did_id = empty ($did_id) ? $this->input->post("free_didlist", true) : $did_id;
948 948
 		if ($did_id != "") {
949
-			$account_arr = ( array ) $this->db->get_where ( "accounts", array (
949
+			$account_arr = (array)$this->db->get_where("accounts", array(
950 950
 					"id" => $accountid 
951
-			) )->first_row ();
952
-			$did_arr = ( array ) $this->db->get_where ( "dids", array (
951
+			))->first_row();
952
+			$did_arr = (array)$this->db->get_where("dids", array(
953 953
 					"id" => $did_id 
954
-			) )->first_row ();
954
+			))->first_row();
955 955
 			$field_name = $account_arr ['type'] == 1 ? "parent_id" : 'accountid';
956 956
 			if ($action == "add") {
957 957
 				if ($did_arr ['accountid'] == 0 && $did_arr ['parent_id'] == $reseller_id) {
958 958
 					if ($accountinfo ['type'] == 1) {
959 959
 						// for getting reseller setup price if reseller customer purchase
960
-						$reseller_pricing_query = $this->db_model->getSelect ( "*", "reseller_pricing", array (
960
+						$reseller_pricing_query = $this->db_model->getSelect("*", "reseller_pricing", array(
961 961
 								"note" => $did_arr ['number'],
962 962
 								'reseller_id' => $reseller_id 
963
-						) );
964
-						if ($reseller_pricing_query->num_rows () > 0) {
965
-							$reseller_pricing = ( array ) $reseller_pricing_query->first_row ();
966
-							$did_arr = array_merge ( $did_arr, $reseller_pricing );
963
+						));
964
+						if ($reseller_pricing_query->num_rows() > 0) {
965
+							$reseller_pricing = (array)$reseller_pricing_query->first_row();
966
+							$did_arr = array_merge($did_arr, $reseller_pricing);
967 967
 						}
968 968
 					}
969
-					$available_bal = $this->db_model->get_available_bal ( $account_arr );
969
+					$available_bal = $this->db_model->get_available_bal($account_arr);
970 970
 					if ($available_bal >= $did_arr ['setup']) {
971
-						$available_bal = $this->db_model->update_balance ( $did_arr ['setup'], $accountid, "debit" );
972
-						$this->db_model->update ( "dids", array (
971
+						$available_bal = $this->db_model->update_balance($did_arr ['setup'], $accountid, "debit");
972
+						$this->db_model->update("dids", array(
973 973
 								$field_name => $accountid,
974
-								"assign_date" => gmdate ( "Y-m-d H:i:s" ) 
975
-						), array (
974
+								"assign_date" => gmdate("Y-m-d H:i:s") 
975
+						), array(
976 976
 								"id" => $did_id 
977
-						) );
977
+						));
978 978
 						if ($account_arr ['type'] == 1) {
979
-							$this->load->module ( 'did/did' );
980
-							$this->did->did_model->insert_reseller_pricing ( $account_arr, $did_arr );
979
+							$this->load->module('did/did');
980
+							$this->did->did_model->insert_reseller_pricing($account_arr, $did_arr);
981 981
 						}
982
-						$this->common->add_invoice_details ( $account_arr, "DIDCHRG", $did_arr ['setup'], $did_arr ['number'] );
983
-						require_once (APPPATH . 'controllers/ProcessCharges.php');
984
-						$ProcessCharges = new ProcessCharges ();
985
-						$Params = array (
982
+						$this->common->add_invoice_details($account_arr, "DIDCHRG", $did_arr ['setup'], $did_arr ['number']);
983
+						require_once (APPPATH.'controllers/ProcessCharges.php');
984
+						$ProcessCharges = new ProcessCharges();
985
+						$Params = array(
986 986
 								"DIDid" => $did_id 
987 987
 						);
988
-						$ProcessCharges->BillAccountCharges ( "DIDs", $Params );
988
+						$ProcessCharges->BillAccountCharges("DIDs", $Params);
989 989
 						
990 990
 						$account_arr ['did_number'] = $did_arr ['number'];
991
-						$account_arr ['did_country_id'] = $this->common->get_field_name ( 'country', 'countrycode', $did_arr ['country_id'] );
992
-						$account_arr ['did_setup'] = $this->common_model->to_calculate_currency ( $did_arr ['setup'], "", '', true, true );
993
-						$account_arr ['did_monthlycost'] = $this->common_model->to_calculate_currency ( $did_arr ['monthlycost'], "", '', true, true );
991
+						$account_arr ['did_country_id'] = $this->common->get_field_name('country', 'countrycode', $did_arr ['country_id']);
992
+						$account_arr ['did_setup'] = $this->common_model->to_calculate_currency($did_arr ['setup'], "", '', true, true);
993
+						$account_arr ['did_monthlycost'] = $this->common_model->to_calculate_currency($did_arr ['monthlycost'], "", '', true, true);
994 994
 						$account_arr ['did_maxchannels'] = $did_arr ['maxchannels'];
995 995
 						
996
-						$this->common->mail_to_users ( 'email_add_did', $account_arr );
997
-						$this->session->set_flashdata ( 'astpp_errormsg', 'DID Purchased Successfully.' );
996
+						$this->common->mail_to_users('email_add_did', $account_arr);
997
+						$this->session->set_flashdata('astpp_errormsg', 'DID Purchased Successfully.');
998 998
 					} else {
999
-						$this->session->set_flashdata ( 'astpp_notification', 'Insuffiecient fund to purchase this DID' );
999
+						$this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this DID');
1000 1000
 					}
1001 1001
 				} else {
1002
-					$this->session->set_flashdata ( 'astpp_notification', 'This DID already purchased by someone.' );
1002
+					$this->session->set_flashdata('astpp_notification', 'This DID already purchased by someone.');
1003 1003
 				}
1004 1004
 			}
1005 1005
 			if ($action == "delete") {
1006
-				$data = array (
1006
+				$data = array(
1007 1007
 						"accountid" => "0",
1008 1008
 						"assign_date" => "0000-00-00 00:00:00",
1009 1009
 						"charge_upto" => "0000-00-00 00:00:00" 
1010 1010
 				);
1011 1011
 				if ($accounttype == 'reseller') {
1012
-					$data = array (
1012
+					$data = array(
1013 1013
 							"accountid" => "0",
1014 1014
 							"parent_id" => $reseller_id,
1015 1015
 							"assign_date" => "0000-00-00 00:00:00",
1016 1016
 							"charge_upto" => "0000-00-00 00:00:00" 
1017 1017
 					);
1018 1018
 				}
1019
-				$this->db_model->update ( "dids", $data, array (
1019
+				$this->db_model->update("dids", $data, array(
1020 1020
 						"id" => $did_id 
1021
-				) );
1021
+				));
1022 1022
 				if ($accounttype == 'reseller') {
1023
-					$this->db->where ( 'reseller_id', $account_arr ['id'] );
1024
-					$this->db->where ( 'note', $did_arr ['number'] );
1025
-					$this->db->delete ( 'reseller_pricing' );
1023
+					$this->db->where('reseller_id', $account_arr ['id']);
1024
+					$this->db->where('note', $did_arr ['number']);
1025
+					$this->db->delete('reseller_pricing');
1026 1026
 				}
1027
-				require_once (APPPATH . 'controllers/ProcessCharges.php');
1028
-				$ProcessCharges = new ProcessCharges ();
1029
-				$Params = array (
1027
+				require_once (APPPATH.'controllers/ProcessCharges.php');
1028
+				$ProcessCharges = new ProcessCharges();
1029
+				$Params = array(
1030 1030
 						"DIDid" => $did_id 
1031 1031
 				);
1032
-				$ProcessCharges->BillAccountCharges ( "DIDs", $Params );
1032
+				$ProcessCharges->BillAccountCharges("DIDs", $Params);
1033 1033
 				
1034 1034
 				$account_arr ['did_number'] = $did_arr ['number'];
1035
-				$this->common->mail_to_users ( 'email_remove_did', $account_arr );
1036
-				$this->session->set_flashdata ( 'astpp_notification', 'Did Removed Successfully.' );
1035
+				$this->common->mail_to_users('email_remove_did', $account_arr);
1036
+				$this->session->set_flashdata('astpp_notification', 'Did Removed Successfully.');
1037 1037
 			}
1038 1038
 		}
1039
-		redirect ( base_url () . "accounts/" . $accounttype . "_dids/$accountid/" );
1039
+		redirect(base_url()."accounts/".$accounttype."_dids/$accountid/");
1040 1040
 	}
1041 1041
 	// END
1042 1042
 	function provider_invoices($edit_id) {
1043
-		$this->customer_invoices ( $edit_id );
1043
+		$this->customer_invoices($edit_id);
1044 1044
 	}
1045 1045
 	function reseller_invoices($edit_id) {
1046
-		$this->customer_invoices ( $edit_id );
1046
+		$this->customer_invoices($edit_id);
1047 1047
 	}
1048 1048
 	function customer_invoices($edit_id) {
1049
-		$data ['page_title'] = gettext ( "Invoice" );
1049
+		$data ['page_title'] = gettext("Invoice");
1050 1050
 		// Get Account information from session.
1051
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
1051
+		$accountinfo = $this->session->userdata('accountinfo');
1052 1052
 		// Get Parent informartion
1053 1053
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
1054
-		$where = array (
1054
+		$where = array(
1055 1055
 				'id' => $edit_id,
1056 1056
 				"reseller_id" => $reseller_id 
1057 1057
 		);
1058
-		$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
1058
+		$account_res = $this->db_model->getSelect("type", "accounts", $where);
1059 1059
 		if ($account_res->num_rows > 0) {
1060
-			$account_data = ( array ) $account_res->first_row ();
1061
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
1062
-			$this->load->module ( 'invoices/invoices' );
1063
-			$data ['grid_fields'] = $this->invoices->invoices_form->build_invoices_list_for_customer_admin ( false );
1060
+			$account_data = (array)$account_res->first_row();
1061
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
1062
+			$this->load->module('invoices/invoices');
1063
+			$data ['grid_fields'] = $this->invoices->invoices_form->build_invoices_list_for_customer_admin(false);
1064 1064
 			$data ['edit_id'] = $edit_id;
1065 1065
 			$data ['accounttype'] = $accounttype;
1066
-			$this->load->view ( 'view_customer_invoices', $data );
1066
+			$this->load->view('view_customer_invoices', $data);
1067 1067
 		} else {
1068
-			redirect ( base_url () . 'accounts/customer_list/' );
1068
+			redirect(base_url().'accounts/customer_list/');
1069 1069
 			exit ();
1070 1070
 		}
1071 1071
 	}
1072 1072
 	function provider_blocked_prefixes($edit_id) {
1073
-		$this->customer_blocked_prefixes ( $edit_id );
1073
+		$this->customer_blocked_prefixes($edit_id);
1074 1074
 	}
1075 1075
 	function customer_blocked_prefixes($edit_id) {
1076
-		$data ['page_title'] = gettext ( "Blocked Codes" );
1076
+		$data ['page_title'] = gettext("Blocked Codes");
1077 1077
 		// Get Account information from session.
1078
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
1078
+		$accountinfo = $this->session->userdata('accountinfo');
1079 1079
 		// Get Parent informartion
1080 1080
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
1081
-		$where = array (
1081
+		$where = array(
1082 1082
 				'id' => $edit_id,
1083 1083
 				"reseller_id" => $reseller_id 
1084 1084
 		);
1085
-		$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
1085
+		$account_res = $this->db_model->getSelect("type", "accounts", $where);
1086 1086
 		if ($account_res->num_rows > 0) {
1087
-			$account_data = ( array ) $account_res->first_row ();
1088
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
1089
-			$this->load->module ( 'rates/rates' );
1090
-			$data ['grid_fields'] = $this->rates->rates_form->build_pattern_list_for_customer ( $edit_id, $accounttype );
1091
-			$data ['grid_buttons'] = $this->rates->rates_form->set_pattern_grid_buttons ( $edit_id );
1087
+			$account_data = (array)$account_res->first_row();
1088
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
1089
+			$this->load->module('rates/rates');
1090
+			$data ['grid_fields'] = $this->rates->rates_form->build_pattern_list_for_customer($edit_id, $accounttype);
1091
+			$data ['grid_buttons'] = $this->rates->rates_form->set_pattern_grid_buttons($edit_id);
1092 1092
 			$data ['edit_id'] = $edit_id;
1093 1093
 			$data ['accounttype'] = $accounttype;
1094
-			$this->load->view ( 'view_customer_blocked_prefixes', $data );
1094
+			$this->load->view('view_customer_blocked_prefixes', $data);
1095 1095
 		} else {
1096
-			redirect ( base_url () . 'accounts/customer_list/' );
1096
+			redirect(base_url().'accounts/customer_list/');
1097 1097
 			exit ();
1098 1098
 		}
1099 1099
 	}
1100 1100
 	function customer_add_blockpatterns($accountid) {
1101
-		$data ['username'] = $this->session->userdata ( 'user_name' );
1102
-		$data ['page_title'] = gettext ( 'Unblocked Codes' );
1103
-		$this->session->set_userdata ( 'advance_search', 0 );
1104
-		$this->load->module ( 'rates/rates' );
1105
-		$data ['patters_grid_fields'] = $this->rates->rates_form->build_block_pattern_list_for_customer ();
1101
+		$data ['username'] = $this->session->userdata('user_name');
1102
+		$data ['page_title'] = gettext('Unblocked Codes');
1103
+		$this->session->set_userdata('advance_search', 0);
1104
+		$this->load->module('rates/rates');
1105
+		$data ['patters_grid_fields'] = $this->rates->rates_form->build_block_pattern_list_for_customer();
1106 1106
 		$data ["accountid"] = $accountid;
1107
-		$this->load->view ( 'view_block_prefix_list', $data );
1107
+		$this->load->view('view_block_prefix_list', $data);
1108 1108
 	}
1109 1109
 	function customer_add_blockpatterns_json($accountid) {
1110
-		$this->load->module ( 'rates/rates' );
1111
-		$json_data = array ();
1112
-		$count_all = $this->rates_model->getunblocked_pattern_list ( $accountid, false );
1113
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
1110
+		$this->load->module('rates/rates');
1111
+		$json_data = array();
1112
+		$count_all = $this->rates_model->getunblocked_pattern_list($accountid, false);
1113
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
1114 1114
 		$json_data = $paging_data ["json_paging"];
1115 1115
 		
1116
-		$query = $this->rates->rates_model->getunblocked_pattern_list ( $accountid, true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
1117
-		$grid_fields = json_decode ( $this->rates->rates_form->build_block_pattern_list_for_customer () );
1118
-		$json_data ['rows'] = $this->rates->form->build_grid ( $query, $grid_fields );
1119
-		echo json_encode ( $json_data );
1116
+		$query = $this->rates->rates_model->getunblocked_pattern_list($accountid, true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
1117
+		$grid_fields = json_decode($this->rates->rates_form->build_block_pattern_list_for_customer());
1118
+		$json_data ['rows'] = $this->rates->form->build_grid($query, $grid_fields);
1119
+		echo json_encode($json_data);
1120 1120
 	}
1121 1121
 	function customer_block_prefix($accountid) {
1122
-		$result = $this->accounts_model->insert_block ( $this->input->post ( 'prefixies', true ), $accountid );
1122
+		$result = $this->accounts_model->insert_block($this->input->post('prefixies', true), $accountid);
1123 1123
 		echo $result;
1124 1124
 		exit ();
1125 1125
 	}
1126 1126
 	function provider_delete_block_pattern($accountid, $patternid) {
1127
-		$this->customer_delete_block_pattern ( $accountid, $patternid );
1127
+		$this->customer_delete_block_pattern($accountid, $patternid);
1128 1128
 	}
1129 1129
 	function customer_delete_block_pattern($accountid, $patternid) {
1130
-		$entity_type = $this->common->get_field_name ( 'type', 'accounts', array (
1130
+		$entity_type = $this->common->get_field_name('type', 'accounts', array(
1131 1131
 				'id' => $accountid 
1132
-		) );
1133
-		$entity_type = strtolower ( $this->common->get_entity_type ( '', '', $entity_type ) );
1134
-		$url = "accounts/" . $entity_type . "_blocked_prefixes/$accountid";
1135
-		$this->db_model->delete ( "block_patterns", array (
1132
+		));
1133
+		$entity_type = strtolower($this->common->get_entity_type('', '', $entity_type));
1134
+		$url = "accounts/".$entity_type."_blocked_prefixes/$accountid";
1135
+		$this->db_model->delete("block_patterns", array(
1136 1136
 				"id" => $patternid 
1137
-		) );
1138
-		$this->session->set_flashdata ( 'astpp_notification', 'Block Code Removed Sucessfully!' );
1137
+		));
1138
+		$this->session->set_flashdata('astpp_notification', 'Block Code Removed Sucessfully!');
1139 1139
 		
1140
-		redirect ( base_url () . $url );
1140
+		redirect(base_url().$url);
1141 1141
 	}
1142 1142
 	function customer_blockedprefixes_delete_multiple() {
1143
-		$ids = $this->input->post ( "selected_ids", true );
1143
+		$ids = $this->input->post("selected_ids", true);
1144 1144
 		$where = "id IN ($ids)";
1145
-		$this->db->delete ( "block_patterns", $where );
1145
+		$this->db->delete("block_patterns", $where);
1146 1146
 		echo TRUE;
1147 1147
 	}
1148 1148
 	
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
 	 * Using function using for provider cdrs tab
1152 1152
 	 */
1153 1153
 	function provider_cdrs($edit_id) {
1154
-		$this->customer_cdrs ( $edit_id );
1154
+		$this->customer_cdrs($edit_id);
1155 1155
 	}
1156 1156
 	
1157 1157
 	/* * ************************************************ */
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 	 * Using function using for reseller cdrs tab
1161 1161
 	 */
1162 1162
 	function reseller_cdrs($edit_id) {
1163
-		$this->customer_cdrs ( $edit_id );
1163
+		$this->customer_cdrs($edit_id);
1164 1164
 	}
1165 1165
 	
1166 1166
 	/* * ************************************************ */
@@ -1169,26 +1169,26 @@  discard block
 block discarded – undo
1169 1169
 	 * Using function using for customer cdrs tab
1170 1170
 	 */
1171 1171
 	function customer_cdrs($edit_id) {
1172
-		$data ['page_title'] = gettext ( "CDRs" );
1172
+		$data ['page_title'] = gettext("CDRs");
1173 1173
 		// Get Account information from session.
1174
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
1174
+		$accountinfo = $this->session->userdata('accountinfo');
1175 1175
 		// Get Parent informartion
1176 1176
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
1177
-		$where = array (
1177
+		$where = array(
1178 1178
 				'id' => $edit_id,
1179 1179
 				"reseller_id" => $reseller_id 
1180 1180
 		);
1181
-		$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
1181
+		$account_res = $this->db_model->getSelect("type", "accounts", $where);
1182 1182
 		if ($account_res->num_rows > 0) {
1183
-			$account_data = ( array ) $account_res->first_row ();
1184
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
1185
-			$this->load->module ( 'reports/reports' );
1186
-			$data ['grid_fields'] = $this->reports->reports_form->build_report_list_for_user ( $accounttype );
1183
+			$account_data = (array)$account_res->first_row();
1184
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
1185
+			$this->load->module('reports/reports');
1186
+			$data ['grid_fields'] = $this->reports->reports_form->build_report_list_for_user($accounttype);
1187 1187
 			$data ['edit_id'] = $edit_id;
1188 1188
 			$data ['accounttype'] = $accounttype;
1189
-			$this->load->view ( 'view_customer_cdrs_list', $data );
1189
+			$this->load->view('view_customer_cdrs_list', $data);
1190 1190
 		} else {
1191
-			redirect ( base_url () . 'accounts/customer_list/' );
1191
+			redirect(base_url().'accounts/customer_list/');
1192 1192
 			exit ();
1193 1193
 		}
1194 1194
 	}
@@ -1199,32 +1199,32 @@  discard block
 block discarded – undo
1199 1199
 	 * Using for provider refillreporttab.
1200 1200
 	 */
1201 1201
 	function reseller_packages($edit_id) {
1202
-		$data ['page_title'] = gettext ( "Packages" );
1203
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
1202
+		$data ['page_title'] = gettext("Packages");
1203
+		$accountinfo = $this->session->userdata('accountinfo');
1204 1204
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
1205
-		$where = array (
1205
+		$where = array(
1206 1206
 				'id' => $edit_id,
1207 1207
 				"reseller_id" => $reseller_id 
1208 1208
 		);
1209
-		$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
1209
+		$account_res = $this->db_model->getSelect("type", "accounts", $where);
1210 1210
 		if ($account_res->num_rows > 0) {
1211
-			$account_data = ( array ) $account_res->first_row ();
1212
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
1213
-			$this->load->module ( 'package/package' );
1214
-			$data ['grid_fields'] = $this->package->package_form->build_package_list_for_reseller ();
1211
+			$account_data = (array)$account_res->first_row();
1212
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
1213
+			$this->load->module('package/package');
1214
+			$data ['grid_fields'] = $this->package->package_form->build_package_list_for_reseller();
1215 1215
 			$data ['edit_id'] = $edit_id;
1216 1216
 			$data ['accounttype'] = $accounttype;
1217
-			$this->load->view ( 'view_reseller_package_list', $data );
1217
+			$this->load->view('view_reseller_package_list', $data);
1218 1218
 		} else {
1219
-			redirect ( base_url () . 'accounts/reseller_list/' );
1219
+			redirect(base_url().'accounts/reseller_list/');
1220 1220
 			exit ();
1221 1221
 		}
1222 1222
 	}
1223 1223
 	function reseller_refillreport($edit_id) {
1224
-		$this->customer_refillreport ( $edit_id );
1224
+		$this->customer_refillreport($edit_id);
1225 1225
 	}
1226 1226
 	function provider_refillreport($edit_id) {
1227
-		$this->customer_refillreport ( $edit_id );
1227
+		$this->customer_refillreport($edit_id);
1228 1228
 	}
1229 1229
 	
1230 1230
 	/* * ***************************************** */
@@ -1233,26 +1233,26 @@  discard block
 block discarded – undo
1233 1233
 	 * Using for customer refill report tab.
1234 1234
 	 */
1235 1235
 	function customer_refillreport($edit_id) {
1236
-		$data ['page_title'] = gettext ( "Refill Report" );
1236
+		$data ['page_title'] = gettext("Refill Report");
1237 1237
 		// Get Account information from session.
1238
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
1238
+		$accountinfo = $this->session->userdata('accountinfo');
1239 1239
 		// Get Parent informartion
1240 1240
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
1241
-		$where = array (
1241
+		$where = array(
1242 1242
 				'id' => $edit_id,
1243 1243
 				"reseller_id" => $reseller_id 
1244 1244
 		);
1245
-		$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
1245
+		$account_res = $this->db_model->getSelect("type", "accounts", $where);
1246 1246
 		if ($account_res->num_rows > 0) {
1247
-			$account_data = ( array ) $account_res->first_row ();
1248
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
1249
-			$this->load->module ( 'reports/reports' );
1250
-			$data ['grid_fields'] = $this->reports->reports_form->build_refillreport_for_customer ();
1247
+			$account_data = (array)$account_res->first_row();
1248
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
1249
+			$this->load->module('reports/reports');
1250
+			$data ['grid_fields'] = $this->reports->reports_form->build_refillreport_for_customer();
1251 1251
 			$data ['edit_id'] = $edit_id;
1252 1252
 			$data ['accounttype'] = $accounttype;
1253
-			$this->load->view ( 'view_customer_refill_report', $data );
1253
+			$this->load->view('view_customer_refill_report', $data);
1254 1254
 		} else {
1255
-			redirect ( base_url () . 'accounts/customer_list/' );
1255
+			redirect(base_url().'accounts/customer_list/');
1256 1256
 			exit ();
1257 1257
 		}
1258 1258
 	}
@@ -1263,10 +1263,10 @@  discard block
 block discarded – undo
1263 1263
 	 * Using for provider email history tab.
1264 1264
 	 */
1265 1265
 	function reseller_emailhistory($edit_id) {
1266
-		$this->customer_emailhistory ( $edit_id );
1266
+		$this->customer_emailhistory($edit_id);
1267 1267
 	}
1268 1268
 	function provider_emailhistory($edit_id) {
1269
-		$this->customer_emailhistory ( $edit_id );
1269
+		$this->customer_emailhistory($edit_id);
1270 1270
 	}
1271 1271
 	
1272 1272
 	/* * ***************************************** */
@@ -1275,26 +1275,26 @@  discard block
 block discarded – undo
1275 1275
 	 * Using for customer email history tab.
1276 1276
 	 */
1277 1277
 	function customer_emailhistory($edit_id) {
1278
-		$data ['page_title'] = gettext ( "Emails" );
1278
+		$data ['page_title'] = gettext("Emails");
1279 1279
 		// Get Account information from session.
1280
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
1280
+		$accountinfo = $this->session->userdata('accountinfo');
1281 1281
 		// Get Parent informartion
1282 1282
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
1283
-		$where = array (
1283
+		$where = array(
1284 1284
 				'id' => $edit_id,
1285 1285
 				"reseller_id" => $reseller_id 
1286 1286
 		);
1287
-		$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
1287
+		$account_res = $this->db_model->getSelect("type", "accounts", $where);
1288 1288
 		if ($account_res->num_rows > 0) {
1289
-			$account_data = ( array ) $account_res->first_row ();
1290
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
1291
-			$this->load->module ( 'email/email' );
1292
-			$data ['grid_fields'] = $this->email->email_form->build_list_for_email_customer ( $edit_id, $accounttype );
1289
+			$account_data = (array)$account_res->first_row();
1290
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
1291
+			$this->load->module('email/email');
1292
+			$data ['grid_fields'] = $this->email->email_form->build_list_for_email_customer($edit_id, $accounttype);
1293 1293
 			$data ['edit_id'] = $edit_id;
1294 1294
 			$data ['accounttype'] = $accounttype;
1295
-			$this->load->view ( 'view_customer_email_history', $data );
1295
+			$this->load->view('view_customer_email_history', $data);
1296 1296
 		} else {
1297
-			redirect ( base_url () . 'accounts/customer_list/' );
1297
+			redirect(base_url().'accounts/customer_list/');
1298 1298
 			exit ();
1299 1299
 		}
1300 1300
 	}
@@ -1305,10 +1305,10 @@  discard block
 block discarded – undo
1305 1305
 	 * Using for provider Alert threshold history tab.
1306 1306
 	 */
1307 1307
 	function reseller_alert_threshold($edit_id) {
1308
-		$this->customer_alert_threshold ( $edit_id );
1308
+		$this->customer_alert_threshold($edit_id);
1309 1309
 	}
1310 1310
 	function provider_alert_threshold($edit_id) {
1311
-		$this->customer_alert_threshold ( $edit_id );
1311
+		$this->customer_alert_threshold($edit_id);
1312 1312
 	}
1313 1313
 	
1314 1314
 	/* * *********************************************** */
@@ -1317,138 +1317,138 @@  discard block
 block discarded – undo
1317 1317
 	 * Using for customer Alert threshold history tab.
1318 1318
 	 */
1319 1319
 	function customer_alert_threshold($edit_id) {
1320
-		$data ['page_title'] = gettext ( "Alert Threshold" );
1320
+		$data ['page_title'] = gettext("Alert Threshold");
1321 1321
 		// Get Account information from session.
1322
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
1322
+		$accountinfo = $this->session->userdata('accountinfo');
1323 1323
 		// Get Parent informartion
1324 1324
 		$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
1325
-		$where = array (
1325
+		$where = array(
1326 1326
 				'id' => $edit_id,
1327 1327
 				"reseller_id" => $reseller_id 
1328 1328
 		);
1329
-		$account_res = $this->db_model->getSelect ( "notify_credit_limit,notify_flag,notify_email,type,id", "accounts", $where );
1329
+		$account_res = $this->db_model->getSelect("notify_credit_limit,notify_flag,notify_email,type,id", "accounts", $where);
1330 1330
 		if ($account_res->num_rows > 0) {
1331
-			$account_data = ( array ) $account_res->first_row ();
1332
-			$accounttype = strtolower ( $this->common->get_entity_type ( '', '', $account_data ['type'] ) );
1333
-			unset ( $account_data ['type'] );
1334
-			$data ['form'] = $this->form->build_form ( $this->accounts_form->customer_alert_threshold ( $accounttype ), $account_data );
1331
+			$account_data = (array)$account_res->first_row();
1332
+			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data ['type']));
1333
+			unset ($account_data ['type']);
1334
+			$data ['form'] = $this->form->build_form($this->accounts_form->customer_alert_threshold($accounttype), $account_data);
1335 1335
 			$data ['edit_id'] = $edit_id;
1336 1336
 			$data ['accounttype'] = $accounttype;
1337
-			$this->load->view ( 'view_customer_alert_threshold', $data );
1337
+			$this->load->view('view_customer_alert_threshold', $data);
1338 1338
 		} else {
1339
-			redirect ( base_url () . 'accounts/customer_list/' );
1339
+			redirect(base_url().'accounts/customer_list/');
1340 1340
 			exit ();
1341 1341
 		}
1342 1342
 	}
1343 1343
 	function reseller_alert_threshold_save($entity_type) {
1344
-		$this->customer_alert_threshold_save ( $entity_type );
1344
+		$this->customer_alert_threshold_save($entity_type);
1345 1345
 	}
1346 1346
 	function provider_alert_threshold_save($entity_type) {
1347
-		$this->customer_alert_threshold_save ( $entity_type );
1347
+		$this->customer_alert_threshold_save($entity_type);
1348 1348
 	}
1349 1349
 	function customer_alert_threshold_save($entity_type) {
1350
-		$add_array = $this->input->post ();
1351
-		if (isset ( $add_array ['id'] ) && ! empty ( $add_array ['id'] )) {
1352
-			$data ['page_title'] = gettext ( "Alert Threshold" );
1353
-			$data ['form'] = $this->form->build_form ( $this->accounts_form->customer_alert_threshold ( $entity_type ), $add_array );
1350
+		$add_array = $this->input->post();
1351
+		if (isset ($add_array ['id']) && ! empty ($add_array ['id'])) {
1352
+			$data ['page_title'] = gettext("Alert Threshold");
1353
+			$data ['form'] = $this->form->build_form($this->accounts_form->customer_alert_threshold($entity_type), $add_array);
1354 1354
 			$data ['edit_id'] = $add_array ['id'];
1355 1355
 			$data ['accounttype'] = $entity_type;
1356 1356
 			// Get Account information from session.
1357
-			$accountinfo = $this->session->userdata ( 'accountinfo' );
1357
+			$accountinfo = $this->session->userdata('accountinfo');
1358 1358
 			// Get Parent informartion
1359 1359
 			$reseller_id = ($accountinfo ['type'] == 1 || $accountinfo ['type'] == 5) ? $accountinfo ['id'] : 0;
1360
-			$where = array (
1360
+			$where = array(
1361 1361
 					'id' => $add_array ['id'],
1362 1362
 					"reseller_id" => $reseller_id 
1363 1363
 			);
1364
-			$account_res = $this->db_model->getSelect ( "type", "accounts", $where );
1364
+			$account_res = $this->db_model->getSelect("type", "accounts", $where);
1365 1365
 			if ($account_res->num_rows > 0) {
1366
-				if ($this->form_validation->run () == FALSE) {
1367
-					$data ['validation_errors'] = validation_errors ();
1366
+				if ($this->form_validation->run() == FALSE) {
1367
+					$data ['validation_errors'] = validation_errors();
1368 1368
 				} else {
1369
-					$this->db->where ( 'id', $add_array ['id'] );
1369
+					$this->db->where('id', $add_array ['id']);
1370 1370
 					$id = $add_array ['id'];
1371
-					unset ( $add_array ['id'], $add_array ['action'] );
1372
-					$this->db->update ( 'accounts', $add_array );
1373
-					$this->session->set_flashdata ( 'astpp_errormsg', 'Alert threshold updated successfully!' );
1374
-					redirect ( base_url () . 'accounts/' . $entity_type . '_alert_threshold/' . $id . "/" );
1371
+					unset ($add_array ['id'], $add_array ['action']);
1372
+					$this->db->update('accounts', $add_array);
1373
+					$this->session->set_flashdata('astpp_errormsg', 'Alert threshold updated successfully!');
1374
+					redirect(base_url().'accounts/'.$entity_type.'_alert_threshold/'.$id."/");
1375 1375
 					exit ();
1376 1376
 				}
1377 1377
 			} else {
1378
-				redirect ( base_url () . 'accounts/' . $entity_type . '_list/' );
1378
+				redirect(base_url().'accounts/'.$entity_type.'_list/');
1379 1379
 				exit ();
1380 1380
 			}
1381
-			$this->load->view ( 'view_customer_alert_threshold', $data );
1381
+			$this->load->view('view_customer_alert_threshold', $data);
1382 1382
 		} else {
1383
-			redirect ( base_url () . 'accounts/customer_list/' );
1383
+			redirect(base_url().'accounts/customer_list/');
1384 1384
 			exit ();
1385 1385
 		}
1386 1386
 	}
1387 1387
 	function customer_bulk_creation() {
1388 1388
 		$type = 0;
1389
-		$data ['entity_name'] = strtolower ( $this->common->get_entity_type ( '', '', $type ) );
1390
-		$data ['page_title'] = gettext ( 'Mass Customer' );
1389
+		$data ['entity_name'] = strtolower($this->common->get_entity_type('', '', $type));
1390
+		$data ['page_title'] = gettext('Mass Customer');
1391 1391
 		$data ['country_id'] = Common_model::$global_config ['system_config'] ['country'];
1392
-		$data ['currency_id'] = $this->common->get_field_name ( 'id', 'currency', array (
1392
+		$data ['currency_id'] = $this->common->get_field_name('id', 'currency', array(
1393 1393
 				'currency' => Common_model::$global_config ['system_config'] ['base_currency'] 
1394
-		) );
1394
+		));
1395 1395
 		$data ['timezone_id'] = Common_model::$global_config ['system_config'] ['default_timezone'];
1396
-		if (! $data ['timezone_id']) {
1396
+		if ( ! $data ['timezone_id']) {
1397 1397
 			$data ['timezone_id'] = 1;
1398 1398
 		}
1399
-		if (! $data ['currency_id']) {
1399
+		if ( ! $data ['currency_id']) {
1400 1400
 			$data ['currency_id'] = 1;
1401 1401
 		}
1402
-		if (! $data ['country_id']) {
1402
+		if ( ! $data ['country_id']) {
1403 1403
 			$data ['country_id'] = 1;
1404 1404
 		}
1405
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->customer_bulk_generate_form (), '' );
1406
-		$this->load->view ( 'view_bulk_account_creation', $data );
1405
+		$data ['form'] = $this->form->build_form($this->accounts_form->customer_bulk_generate_form(), '');
1406
+		$this->load->view('view_bulk_account_creation', $data);
1407 1407
 	}
1408 1408
 	function customer_bulk_save() {
1409
-		$data ['page_title'] = gettext ( 'Create Bulk Customer' );
1410
-		$add_array = $this->input->post ();
1411
-		if (! empty ( $add_array ) && isset ( $add_array )) {
1412
-			$currentlength = $this->accounts_model->get_max_limit ( $add_array );
1413
-			$account_data = $this->session->userdata ( "accountinfo" );
1409
+		$data ['page_title'] = gettext('Create Bulk Customer');
1410
+		$add_array = $this->input->post();
1411
+		if ( ! empty ($add_array) && isset ($add_array)) {
1412
+			$currentlength = $this->accounts_model->get_max_limit($add_array);
1413
+			$account_data = $this->session->userdata("accountinfo");
1414 1414
 			$add_array ['reseller_id'] = $account_data ['type'] == 1 ? $account_data ['id'] : 0;
1415
-			$data ['form'] = $this->form->build_form ( $this->accounts_form->customer_bulk_generate_form (), $add_array );
1416
-			if ($this->form_validation->run () == FALSE) {
1417
-				$data ['validation_errors'] = validation_errors ();
1415
+			$data ['form'] = $this->form->build_form($this->accounts_form->customer_bulk_generate_form(), $add_array);
1416
+			if ($this->form_validation->run() == FALSE) {
1417
+				$data ['validation_errors'] = validation_errors();
1418 1418
 				echo $data ['validation_errors'];
1419 1419
 				exit ();
1420 1420
 			}
1421 1421
 			if ($currentlength <= 0) {
1422
-				echo json_encode ( array (
1422
+				echo json_encode(array(
1423 1423
 						"prefix_error" => "Your Account Limit has been reached.Please Change Your Prefix." 
1424
-				) );
1424
+				));
1425 1425
 				exit ();
1426 1426
 			}
1427
-			if ($add_array ['account_length'] <= strlen ( $add_array ['prefix'] )) {
1428
-				echo json_encode ( array (
1427
+			if ($add_array ['account_length'] <= strlen($add_array ['prefix'])) {
1428
+				echo json_encode(array(
1429 1429
 						"account_length_error" => "Please Enter Proper Account Length." 
1430
-				) );
1430
+				));
1431 1431
 				exit ();
1432 1432
 			}
1433 1433
 			if ($currentlength > 0 && $add_array ['count'] > $currentlength) {
1434
-				echo json_encode ( array (
1435
-						"count_error" => "You Can Create Maximum " . $currentlength . " accounts with " . $add_array ['prefix'] . " prefix" 
1436
-				) );
1434
+				echo json_encode(array(
1435
+						"count_error" => "You Can Create Maximum ".$currentlength." accounts with ".$add_array ['prefix']." prefix" 
1436
+				));
1437 1437
 				exit ();
1438 1438
 			} else {
1439
-				$this->accounts_model->bulk_insert_accounts ( $add_array );
1440
-				echo json_encode ( array (
1439
+				$this->accounts_model->bulk_insert_accounts($add_array);
1440
+				echo json_encode(array(
1441 1441
 						"SUCCESS" => "Bulk customer generate successfully!" 
1442
-				) );
1442
+				));
1443 1443
 				exit ();
1444 1444
 			}
1445 1445
 		} else {
1446
-			redirect ( base_url () . "accounts/customer_list/" );
1446
+			redirect(base_url()."accounts/customer_list/");
1447 1447
 		}
1448 1448
 	}
1449 1449
 	function customer_invoice_option($value = false) {
1450
-		$sweepid = $this->input->post ( "sweepid", true );
1451
-		$invoice_dropdown = $this->common->set_invoice_option ( $sweepid, "", "", $value );
1450
+		$sweepid = $this->input->post("sweepid", true);
1451
+		$invoice_dropdown = $this->common->set_invoice_option($sweepid, "", "", $value);
1452 1452
 		echo $invoice_dropdown;
1453 1453
 	}
1454 1454
 	
@@ -1460,105 +1460,105 @@  discard block
 block discarded – undo
1460 1460
 	 */
1461 1461
 	function customer_did_country() {
1462 1462
 		$country_id = $_POST ['country_id'];
1463
-		$accountid = $this->input->post ( 'accountid', true );
1464
-		$accountinfo = $this->session->userdata ( "accountinfo" );
1465
-		$entity_info = ( array ) $this->db->get_where ( 'accounts', array (
1463
+		$accountid = $this->input->post('accountid', true);
1464
+		$accountinfo = $this->session->userdata("accountinfo");
1465
+		$entity_info = (array)$this->db->get_where('accounts', array(
1466 1466
 				"id" => $accountid 
1467
-		) )->first_row ();
1467
+		))->first_row();
1468 1468
 		$reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0;
1469 1469
 		if ($entity_info ['reseller_id'] > 0) {
1470 1470
 			$parent_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : $accountinfo ['reseller_id'];
1471
-			$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;
1472
-			$did_list = $this->db->query ( $query );
1471
+			$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;
1472
+			$did_list = $this->db->query($query);
1473 1473
 		} else {
1474
-			$did_list = $this->db_model->getSelect ( "id,number,setup,monthlycost", "dids", array (
1474
+			$did_list = $this->db_model->getSelect("id,number,setup,monthlycost", "dids", array(
1475 1475
 					'country_id' => $country_id,
1476 1476
 					'accountid' => '0',
1477 1477
 					'parent_id' => $reseller_id 
1478
-			) );
1478
+			));
1479 1479
 		}
1480
-		$did_arr = array ();
1480
+		$did_arr = array();
1481 1481
 		if ($did_list->num_rows > 0) {
1482
-			$did_data = $did_list->result_array ();
1483
-			foreach ( $did_data as $key => $value ) {
1484
-				$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 ) . ")";
1482
+			$did_data = $did_list->result_array();
1483
+			foreach ($did_data as $key => $value) {
1484
+				$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).")";
1485 1485
 			}
1486 1486
 		}
1487
-		$did_info = array (
1487
+		$did_info = array(
1488 1488
 				"name" => "free_didlist",
1489 1489
 				"id" => "free_didlist",
1490 1490
 				"class" => "free_didlist" 
1491 1491
 		);
1492
-		echo form_dropdown_all ( $did_info, $did_arr, '' );
1492
+		echo form_dropdown_all($did_info, $did_arr, '');
1493 1493
 		exit ();
1494 1494
 	}
1495 1495
 	
1496 1496
 	/* * ************************************************************** */
1497 1497
 	function customer_payment_process_add($id = '') {
1498
-		$account = $this->accounts_model->get_account_by_number ( $id );
1499
-		$currency = $this->accounts_model->get_currency_by_id ( $account ['currency_id'] );
1500
-		$data ['username'] = $this->session->userdata ( 'user_name' );
1501
-		$data ['page_title'] = gettext ( '​Refill Process' );
1502
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->get_customer_payment_fields ( $currency ['currency'], $account ['number'], $currency ['currency'], $id ), '' );
1503
-		$this->load->view ( 'view_accounts_process_payment', $data );
1498
+		$account = $this->accounts_model->get_account_by_number($id);
1499
+		$currency = $this->accounts_model->get_currency_by_id($account ['currency_id']);
1500
+		$data ['username'] = $this->session->userdata('user_name');
1501
+		$data ['page_title'] = gettext('​Refill Process');
1502
+		$data ['form'] = $this->form->build_form($this->accounts_form->get_customer_payment_fields($currency ['currency'], $account ['number'], $currency ['currency'], $id), '');
1503
+		$this->load->view('view_accounts_process_payment', $data);
1504 1504
 	}
1505 1505
 	function customer_payment_save($id = '') {
1506
-		$post_array = $this->input->post ();
1507
-		$data ['username'] = $this->session->userdata ( 'user_name' );
1508
-		$data ['page_title'] = gettext ( 'Process Payment' );
1509
-		$account = $this->accounts_model->get_account_by_number ( $post_array ['id'] );
1510
-		$currency = $this->accounts_model->get_currency_by_id ( $account ['currency_id'] );
1511
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->get_customer_payment_fields ( $currency ['currency'], $account ['number'], $currency ['currency'], $id ), '' );
1512
-		if ($this->form_validation->run () == FALSE) {
1513
-			$data ['validation_errors'] = validation_errors ();
1506
+		$post_array = $this->input->post();
1507
+		$data ['username'] = $this->session->userdata('user_name');
1508
+		$data ['page_title'] = gettext('Process Payment');
1509
+		$account = $this->accounts_model->get_account_by_number($post_array ['id']);
1510
+		$currency = $this->accounts_model->get_currency_by_id($account ['currency_id']);
1511
+		$data ['form'] = $this->form->build_form($this->accounts_form->get_customer_payment_fields($currency ['currency'], $account ['number'], $currency ['currency'], $id), '');
1512
+		if ($this->form_validation->run() == FALSE) {
1513
+			$data ['validation_errors'] = validation_errors();
1514 1514
 			echo $data ['validation_errors'];
1515 1515
 			exit ();
1516 1516
 		} else {
1517
-			$post_array ['credit'] = $this->common_model->add_calculate_currency ( $post_array ['credit'], "", '', false, false );
1518
-			$logintype = $this->session->userdata ( 'logintype' );
1519
-			$username = $this->session->userdata ( 'username' );
1520
-			$login_user_data = $this->session->userdata ( "accountinfo" );
1521
-			$accountinfo = $this->accounts_model->get_account_by_number ( $post_array ['id'] );
1517
+			$post_array ['credit'] = $this->common_model->add_calculate_currency($post_array ['credit'], "", '', false, false);
1518
+			$logintype = $this->session->userdata('logintype');
1519
+			$username = $this->session->userdata('username');
1520
+			$login_user_data = $this->session->userdata("accountinfo");
1521
+			$accountinfo = $this->accounts_model->get_account_by_number($post_array ['id']);
1522 1522
 			if ($accountinfo ['reseller_id'] == 0) {
1523
-				$where = array (
1523
+				$where = array(
1524 1524
 						"accountid" => 1 
1525 1525
 				);
1526 1526
 			} else {
1527
-				$where = array (
1527
+				$where = array(
1528 1528
 						"accountid" => $accountinfo ['id'] 
1529 1529
 				);
1530 1530
 			}
1531
-			$query = $this->db_model->getSelect ( "*", "invoice_conf", $where );
1531
+			$query = $this->db_model->getSelect("*", "invoice_conf", $where);
1532 1532
 			if ($query->num_rows > 0) {
1533
-				$invoice_conf = $query->result_array ();
1533
+				$invoice_conf = $query->result_array();
1534 1534
 				$invoice_conf = $invoice_conf [0];
1535 1535
 			} else {
1536
-				$query = $this->db_model->getSelect ( "*", "invoice_conf", array (
1536
+				$query = $this->db_model->getSelect("*", "invoice_conf", array(
1537 1537
 						"accountid" => 1 
1538
-				) );
1539
-				$invoice_conf = $query->result_array ();
1538
+				));
1539
+				$invoice_conf = $query->result_array();
1540 1540
 				$invoice_conf = $invoice_conf [0];
1541 1541
 			}
1542
-			$last_invoice_ID = $this->get_invoice_date ( "invoiceid", $accountinfo ["id"] );
1542
+			$last_invoice_ID = $this->get_invoice_date("invoiceid", $accountinfo ["id"]);
1543 1543
 			$invoice_prefix = $invoice_conf ['invoice_prefix'];
1544
-			$due_date = gmdate ( "Y-m-d H:i:s", strtotime ( gmdate ( "Y-m-d H:i:s" ) . " +" . $invoice_conf ['interval'] . " days" ) );
1545
-			$response = $this->accounts_model->account_process_payment ( $post_array );
1544
+			$due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoice_conf ['interval']." days"));
1545
+			$response = $this->accounts_model->account_process_payment($post_array);
1546 1546
 			
1547 1547
 			if ($post_array ['payment_type'] == 1) {
1548
-				$this->load->module ( 'invoices/invoices' );
1549
-				$invoice_id = $this->invoices->invoices->generate_receipt ( $post_array ['id'], $post_array ['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date );
1550
-				$this->db->select ( 'balance,credit_limit,posttoexternal' );
1551
-				$this->db->where ( 'id', $post_array ['id'] );
1552
-				$this->db->from ( 'accounts' );
1553
-				$account_balance_info = ( array ) $this->db->get ()->first_row ();
1548
+				$this->load->module('invoices/invoices');
1549
+				$invoice_id = $this->invoices->invoices->generate_receipt($post_array ['id'], $post_array ['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date);
1550
+				$this->db->select('balance,credit_limit,posttoexternal');
1551
+				$this->db->where('id', $post_array ['id']);
1552
+				$this->db->from('accounts');
1553
+				$account_balance_info = (array)$this->db->get()->first_row();
1554 1554
 				$account_balance = $account_balance_info ['posttoexternal'] == 1 ? $account_balance_info ['credit_limit'] - ($account_balance_info ['balance']) : $account_balance_info ['balance'];
1555 1555
 				
1556
-				$insert_arr = array (
1556
+				$insert_arr = array(
1557 1557
 						"accountid" => $post_array ['id'],
1558
-						"description" => trim ( $post_array ['notes'] ),
1558
+						"description" => trim($post_array ['notes']),
1559 1559
 						"debit" => $post_array ['credit'],
1560 1560
 						"credit" => '0',
1561
-						"created_date" => gmdate ( "Y-m-d H:i:s" ),
1561
+						"created_date" => gmdate("Y-m-d H:i:s"),
1562 1562
 						"invoiceid" => $invoice_id,
1563 1563
 						"reseller_id" => '0',
1564 1564
 						"item_type" => 'POSTCHARG',
@@ -1566,21 +1566,21 @@  discard block
 block discarded – undo
1566 1566
 						'before_balance' => $account_balance + $post_array ['credit'],
1567 1567
 						'after_balance' => $account_balance 
1568 1568
 				);
1569
-				$this->db->insert ( "invoice_details", $insert_arr );
1569
+				$this->db->insert("invoice_details", $insert_arr);
1570 1570
 			} else {
1571
-				$this->load->module ( 'invoices/invoices' );
1572
-				$invoice_id = $this->invoices->invoices->generate_receipt ( $post_array ['id'], $post_array ['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date );
1573
-				$this->db->select ( 'balance,credit_limit,posttoexternal' );
1574
-				$this->db->where ( 'id', $post_array ['id'] );
1575
-				$this->db->from ( 'accounts' );
1576
-				$account_balance_info = ( array ) $this->db->get ()->first_row ();
1571
+				$this->load->module('invoices/invoices');
1572
+				$invoice_id = $this->invoices->invoices->generate_receipt($post_array ['id'], $post_array ['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date);
1573
+				$this->db->select('balance,credit_limit,posttoexternal');
1574
+				$this->db->where('id', $post_array ['id']);
1575
+				$this->db->from('accounts');
1576
+				$account_balance_info = (array)$this->db->get()->first_row();
1577 1577
 				$account_balance = $account_balance_info ['posttoexternal'] == 1 ? $account_balance_info ['credit_limit'] - ($account_balance_info ['balance']) : $account_balance_info ['balance'];
1578
-				$insert_arr = array (
1578
+				$insert_arr = array(
1579 1579
 						"accountid" => $post_array ['id'],
1580
-						"description" => trim ( $post_array ['notes'] ),
1580
+						"description" => trim($post_array ['notes']),
1581 1581
 						"debit" => 0,
1582 1582
 						"credit" => $post_array ['credit'],
1583
-						"created_date" => gmdate ( "Y-m-d H:i:s" ),
1583
+						"created_date" => gmdate("Y-m-d H:i:s"),
1584 1584
 						"invoiceid" => $invoice_id,
1585 1585
 						"reseller_id" => $accountinfo ['reseller_id'],
1586 1586
 						"item_type" => 'Refill',
@@ -1588,11 +1588,11 @@  discard block
 block discarded – undo
1588 1588
 						'before_balance' => $account_balance - $post_array ['credit'],
1589 1589
 						'after_balance' => $account_balance 
1590 1590
 				);
1591
-				$this->db->insert ( "invoice_details", $insert_arr );
1591
+				$this->db->insert("invoice_details", $insert_arr);
1592 1592
 				if ($login_user_data ['type'] == 1) {
1593
-					$reseller_ids = $this->common->get_parent_info ( $login_user_data ['id'], 0 );
1594
-					$reseller_ids = rtrim ( $reseller_ids, "," );
1595
-					$reseller_arr = explode ( ",", $reseller_ids );
1593
+					$reseller_ids = $this->common->get_parent_info($login_user_data ['id'], 0);
1594
+					$reseller_ids = rtrim($reseller_ids, ",");
1595
+					$reseller_arr = explode(",", $reseller_ids);
1596 1596
 					/*
1597 1597
 					 * if(!empty($reseller_arr)){
1598 1598
 					 * $custom_array=$post_array;
@@ -1625,13 +1625,13 @@  discard block
 block discarded – undo
1625 1625
 			/**
1626 1626
 			 * ********************************************************************************************
1627 1627
 			 */
1628
-			echo json_encode ( array (
1628
+			echo json_encode(array(
1629 1629
 					"SUCCESS" => $message 
1630
-			) );
1630
+			));
1631 1631
 			exit ();
1632 1632
 			// }
1633 1633
 		}
1634
-		$this->load->view ( 'view_accounts_process_payment', $data );
1634
+		$this->load->view('view_accounts_process_payment', $data);
1635 1635
 	}
1636 1636
 	
1637 1637
 	/**
@@ -1639,9 +1639,9 @@  discard block
 block discarded – undo
1639 1639
 	 * @param string $select        	
1640 1640
 	 */
1641 1641
 	function get_invoice_date($select, $accountid) {
1642
-		$query = $this->db_model->select ( $select, "invoices", '', "id", "DESC", "1", "0" );
1642
+		$query = $this->db_model->select($select, "invoices", '', "id", "DESC", "1", "0");
1643 1643
 		if ($query->num_rows > 0) {
1644
-			$invoiceid = $query->result_array ();
1644
+			$invoiceid = $query->result_array();
1645 1645
 			$invoice_date = $invoiceid [0] [$select];
1646 1646
 			return $invoice_date;
1647 1647
 		}
@@ -1657,12 +1657,12 @@  discard block
 block discarded – undo
1657 1657
 	 * @account_number: Account No
1658 1658
 	 */
1659 1659
 	function customer_add_callerid($id = "") {
1660
-		$data ['username'] = $this->session->userdata ( 'user_name' );
1661
-		$data ['page_title'] = gettext ( '​Force Caller Id' );
1662
-		$account_num = $this->accounts_model->get_account_number ( $id );
1663
-		$result = $this->accounts_model->get_callerid ( $id );
1664
-		if ($result->num_rows () > 0) {
1665
-			foreach ( $result->result_array () as $values ) {
1660
+		$data ['username'] = $this->session->userdata('user_name');
1661
+		$data ['page_title'] = gettext('​Force Caller Id');
1662
+		$account_num = $this->accounts_model->get_account_number($id);
1663
+		$result = $this->accounts_model->get_callerid($id);
1664
+		if ($result->num_rows() > 0) {
1665
+			foreach ($result->result_array() as $values) {
1666 1666
 				$data ['accountid'] = $values ['accountid'];
1667 1667
 				$data ['callerid_name'] = $values ['callerid_name'];
1668 1668
 				$data ['callerid_number'] = $values ['callerid_number'];
@@ -1677,80 +1677,80 @@  discard block
 block discarded – undo
1677 1677
 			$data ['flag'] = '0';
1678 1678
 		}
1679 1679
 		$data ['accountid'] = $account_num ['number'];
1680
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->get_customer_callerid_fields (), $data );
1681
-		$post_array = $this->input->post ();
1680
+		$data ['form'] = $this->form->build_form($this->accounts_form->get_customer_callerid_fields(), $data);
1681
+		$post_array = $this->input->post();
1682 1682
 		
1683
-		if (! empty ( $post_array )) {
1684
-			if ($this->form_validation->run () == FALSE) {
1685
-				$data ['validation_errors'] = validation_errors ();
1683
+		if ( ! empty ($post_array)) {
1684
+			if ($this->form_validation->run() == FALSE) {
1685
+				$data ['validation_errors'] = validation_errors();
1686 1686
 				echo $data ['validation_errors'];
1687 1687
 				exit ();
1688 1688
 			} else {
1689 1689
 				if ($post_array ['flag'] == '1') {
1690
-					$this->accounts_model->edit_callerid ( $post_array );
1691
-					echo json_encode ( array (
1690
+					$this->accounts_model->edit_callerid($post_array);
1691
+					echo json_encode(array(
1692 1692
 							"SUCCESS" => "Account callerID updated successfully!" 
1693
-					) );
1693
+					));
1694 1694
 					exit ();
1695 1695
 				} else {
1696
-					$this->accounts_model->add_callerid ( $post_array );
1697
-					echo json_encode ( array (
1696
+					$this->accounts_model->add_callerid($post_array);
1697
+					echo json_encode(array(
1698 1698
 							"SUCCESS" => "Account callerID added successfully!" 
1699
-					) );
1699
+					));
1700 1700
 					exit ();
1701 1701
 				}
1702 1702
 			}
1703 1703
 		}
1704
-		$this->load->view ( 'view_accounts_add_callerid', $data );
1704
+		$this->load->view('view_accounts_add_callerid', $data);
1705 1705
 	}
1706 1706
 	function reseller_add($type = "") {
1707
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
1708
-		$data ['username'] = $this->session->userdata ( 'user_name' );
1707
+		$accountinfo = $this->session->userdata('accountinfo');
1708
+		$data ['username'] = $this->session->userdata('user_name');
1709 1709
 		$data ['flag'] = 'create';
1710
-		$data ['page_title'] = gettext ( 'Create Reseller' );
1710
+		$data ['page_title'] = gettext('Create Reseller');
1711 1711
 		$data ['back_flag'] = true;
1712
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->get_form_reseller_fields (), '' );
1712
+		$data ['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields(), '');
1713 1713
 		$data ['country_id'] = $accountinfo ['country_id'];
1714 1714
 		$data ['currency_id'] = $accountinfo ['currency_id'];
1715 1715
 		$data ['timezone_id'] = $accountinfo ['timezone_id'];
1716
-		if (! $data ['timezone_id']) {
1716
+		if ( ! $data ['timezone_id']) {
1717 1717
 			$data ['timezone_id'] = 1;
1718 1718
 		}
1719
-		if (! $data ['currency_id']) {
1719
+		if ( ! $data ['currency_id']) {
1720 1720
 			$data ['currency_id'] = 1;
1721 1721
 		}
1722
-		if (! $data ['country_id']) {
1722
+		if ( ! $data ['country_id']) {
1723 1723
 			$data ['country_id'] = 1;
1724 1724
 		}
1725 1725
 		
1726
-		$this->load->view ( 'view_accounts_create', $data );
1726
+		$this->load->view('view_accounts_create', $data);
1727 1727
 	}
1728 1728
 	function reseller_edit($edit_id = '') {
1729
-		$data ['page_title'] = gettext ( 'Edit Reseller' );
1730
-		$where = array (
1729
+		$data ['page_title'] = gettext('Edit Reseller');
1730
+		$where = array(
1731 1731
 				'id' => $edit_id 
1732 1732
 		);
1733
-		$account = $this->db_model->getSelect ( "*", "accounts", $where );
1734
-		$data ["account_data"] = $account->result_array ();
1735
-		$acc_data = $this->session->userdata ( "accountinfo" );
1736
-		foreach ( $account->result_array () as $key => $value ) {
1733
+		$account = $this->db_model->getSelect("*", "accounts", $where);
1734
+		$data ["account_data"] = $account->result_array();
1735
+		$acc_data = $this->session->userdata("accountinfo");
1736
+		foreach ($account->result_array() as $key => $value) {
1737 1737
 			$edit_data = $value;
1738 1738
 		}
1739
-		$taxes_data = $this->db_model->getSelect ( "group_concat(taxes_id) as taxes_id", "taxes_to_accounts", array (
1739
+		$taxes_data = $this->db_model->getSelect("group_concat(taxes_id) as taxes_id", "taxes_to_accounts", array(
1740 1740
 				"accountid" => $edit_id 
1741
-		) );
1742
-		if (isset ( $taxes_data ) && $taxes_data->num_rows () > 0) {
1743
-			$taxes_data = $taxes_data->result_array ();
1744
-			$edit_data ["tax_id"] = explode ( ",", $taxes_data [0] ['taxes_id'] );
1741
+		));
1742
+		if (isset ($taxes_data) && $taxes_data->num_rows() > 0) {
1743
+			$taxes_data = $taxes_data->result_array();
1744
+			$edit_data ["tax_id"] = explode(",", $taxes_data [0] ['taxes_id']);
1745 1745
 		}
1746 1746
 		
1747 1747
 		/**
1748 1748
 		 * ASTPP 3.0
1749 1749
 		 * Add For Signup module
1750 1750
 		 */
1751
-		$encrypted_string = $this->common->encode ( $edit_data ['id'] );
1752
-		$encrypt = $this->common->encode_params ( $encrypted_string );
1753
-		$edit_data ['registration_url'] = base_url () . "signup/" . $encrypt;
1751
+		$encrypted_string = $this->common->encode($edit_data ['id']);
1752
+		$encrypt = $this->common->encode_params($encrypted_string);
1753
+		$edit_data ['registration_url'] = base_url()."signup/".$encrypt;
1754 1754
 		/* * *********************************************************** */
1755 1755
 		/*
1756 1756
 		 * ***
@@ -1758,31 +1758,31 @@  discard block
 block discarded – undo
1758 1758
 		 * Password decode
1759 1759
 		 * ****
1760 1760
 		 */
1761
-		$edit_data ['password'] = $this->common->decode ( $edit_data ['password'] );
1762
-		$edit_data ['credit_limit'] = $this->common_model->calculate_currency ( ($edit_data ['credit_limit']), '', '', true, false );
1763
-		$entity_name = strtolower ( $this->common->get_entity_type ( '', '', $edit_data ['type'] ) );
1761
+		$edit_data ['password'] = $this->common->decode($edit_data ['password']);
1762
+		$edit_data ['credit_limit'] = $this->common_model->calculate_currency(($edit_data ['credit_limit']), '', '', true, false);
1763
+		$entity_name = strtolower($this->common->get_entity_type('', '', $edit_data ['type']));
1764 1764
 		$data ['edit_id'] = $edit_id;
1765
-		$data ['page_title'] = gettext ( ucfirst ( $entity_name ) . " Profile" );
1765
+		$data ['page_title'] = gettext(ucfirst($entity_name)." Profile");
1766 1766
 		$data ['entity_name'] = $entity_name;
1767 1767
 		/* * ********************** */
1768
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->get_form_reseller_fields ( $edit_id ), $edit_data );
1769
-		$this->load->view ( 'view_reseller_details', $data );
1768
+		$data ['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields($edit_id), $edit_data);
1769
+		$this->load->view('view_reseller_details', $data);
1770 1770
 	}
1771 1771
 	
1772 1772
 	/* * *********************************************************** */
1773 1773
 	function reseller_save() {
1774
-		$add_array = $this->input->post ();
1775
-		$entity_name = strtolower ( $this->common->get_entity_type ( '', '', $add_array ['type'] ) );
1774
+		$add_array = $this->input->post();
1775
+		$entity_name = strtolower($this->common->get_entity_type('', '', $add_array ['type']));
1776 1776
 		$data ['country_id'] = $add_array ['country_id'];
1777 1777
 		$data ['timezone_id'] = $add_array ['timezone_id'];
1778 1778
 		$data ['currency_id'] = $add_array ['currency_id'];
1779 1779
 		$data ['entity_name'] = $entity_name;
1780 1780
 		$data ['edit_id'] = $add_array ['id'];
1781
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->get_form_reseller_fields ( $add_array ['id'] ), $add_array );
1781
+		$data ['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields($add_array ['id']), $add_array);
1782 1782
 		if ($add_array ['id'] != '') {
1783
-			$data ['page_title'] = gettext ( 'Edit Reseller' );
1784
-			if ($this->form_validation->run () == FALSE) {
1785
-				$data ['validation_errors'] = validation_errors ();
1783
+			$data ['page_title'] = gettext('Edit Reseller');
1784
+			if ($this->form_validation->run() == FALSE) {
1785
+				$data ['validation_errors'] = validation_errors();
1786 1786
 			} else {
1787 1787
 				/*
1788 1788
 				 * ****
@@ -1790,51 +1790,51 @@  discard block
 block discarded – undo
1790 1790
 				 * Password encode
1791 1791
 				 * ****
1792 1792
 				 */
1793
-				$add_array ['password'] = $this->common->encode ( $add_array ['password'] );
1793
+				$add_array ['password'] = $this->common->encode($add_array ['password']);
1794 1794
 				/* * ****************** */
1795
-				$add_array ['credit_limit'] = $this->common_model->add_calculate_currency ( $add_array ['credit_limit'], '', '', false, false );
1796
-				$query = $this->accounts_model->remove_all_account_tax ( $add_array ['id'] );
1797
-				if (isset ( $add_array ['tax_id'] )) {
1798
-					foreach ( $add_array ['tax_id'] as $key => $val ) {
1799
-						$data1 = array (
1795
+				$add_array ['credit_limit'] = $this->common_model->add_calculate_currency($add_array ['credit_limit'], '', '', false, false);
1796
+				$query = $this->accounts_model->remove_all_account_tax($add_array ['id']);
1797
+				if (isset ($add_array ['tax_id'])) {
1798
+					foreach ($add_array ['tax_id'] as $key => $val) {
1799
+						$data1 = array(
1800 1800
 								'accountid' => $add_array ['id'],
1801 1801
 								'taxes_id' => $val 
1802 1802
 						);
1803
-						$this->accounts_model->add_account_tax ( $data1 );
1803
+						$this->accounts_model->add_account_tax($data1);
1804 1804
 					}
1805
-					unset ( $add_array ['tax_id'] );
1805
+					unset ($add_array ['tax_id']);
1806 1806
 				}
1807
-				unset ( $add_array ['number'], $add_array ['registration_url'] );
1808
-				$this->accounts_model->edit_account ( $add_array, $add_array ['id'] );
1809
-				$this->session->set_flashdata ( 'astpp_errormsg', 'Reseller updated successfully!' );
1807
+				unset ($add_array ['number'], $add_array ['registration_url']);
1808
+				$this->accounts_model->edit_account($add_array, $add_array ['id']);
1809
+				$this->session->set_flashdata('astpp_errormsg', 'Reseller updated successfully!');
1810 1810
 				
1811
-				redirect ( base_url () . 'accounts/reseller_list/' );
1811
+				redirect(base_url().'accounts/reseller_list/');
1812 1812
 				exit ();
1813 1813
 			}
1814 1814
 			$data ["account_data"] ["0"] = $add_array;
1815 1815
 			$edit_id = $add_array ["id"];
1816
-			$data ['chargelist'] = form_dropdown ( 'applayable_charge', $this->Astpp_common->list_applyable_charges ( $edit_id ), '' );
1816
+			$data ['chargelist'] = form_dropdown('applayable_charge', $this->Astpp_common->list_applyable_charges($edit_id), '');
1817 1817
 			
1818
-			$this->load->module ( 'charges/charges' );
1819
-			$data ['charges_grid_field'] = $this->charges->charges_form->build_charges_list_for_customer ( $edit_id, "reseller" );
1818
+			$this->load->module('charges/charges');
1819
+			$data ['charges_grid_field'] = $this->charges->charges_form->build_charges_list_for_customer($edit_id, "reseller");
1820 1820
 			
1821
-			$data ["sipiax_grid_field"] = json_decode ( $this->accounts_form->build_sipiax_list_for_customer () );
1821
+			$data ["sipiax_grid_field"] = json_decode($this->accounts_form->build_sipiax_list_for_customer());
1822 1822
 			
1823
-			$this->load->module ( 'did/did' );
1824
-			$data ['did_grid_fields'] = $this->did->did_form->build_did_list_for_customer ( $edit_id, "reseller" );
1825
-			$data ['didlist'] = form_dropdown ( 'free_did_list', $this->db_model->build_dropdown ( "id,number", "dids", "accountid", "0" ), '' );
1823
+			$this->load->module('did/did');
1824
+			$data ['did_grid_fields'] = $this->did->did_form->build_did_list_for_customer($edit_id, "reseller");
1825
+			$data ['didlist'] = form_dropdown('free_did_list', $this->db_model->build_dropdown("id,number", "dids", "accountid", "0"), '');
1826 1826
 			
1827
-			$this->load->module ( 'invoices/invoices' );
1828
-			$data ['invoice_grid_fields'] = $this->invoices->invoices_form->build_invoices_list_for_admin ();
1827
+			$this->load->module('invoices/invoices');
1828
+			$data ['invoice_grid_fields'] = $this->invoices->invoices_form->build_invoices_list_for_admin();
1829 1829
 			
1830
-			$this->load->module ( 'reports/reports' );
1831
-			$data ['cdrs_grid_fields'] = $this->reports->reports_form->build_report_list_for_user ();
1832
-			$this->load->view ( 'view_reseller_details', $data );
1830
+			$this->load->module('reports/reports');
1831
+			$data ['cdrs_grid_fields'] = $this->reports->reports_form->build_report_list_for_user();
1832
+			$this->load->view('view_reseller_details', $data);
1833 1833
 		} else {
1834 1834
 			
1835
-			$data ['page_title'] = gettext ( 'Create Reseller' );
1836
-			if ($this->form_validation->run () == FALSE) {
1837
-				$data ['validation_errors'] = validation_errors ();
1835
+			$data ['page_title'] = gettext('Create Reseller');
1836
+			if ($this->form_validation->run() == FALSE) {
1837
+				$data ['validation_errors'] = validation_errors();
1838 1838
 			} else {
1839 1839
 				/*
1840 1840
 				 * ****
@@ -1842,89 +1842,89 @@  discard block
 block discarded – undo
1842 1842
 				 * Password encode
1843 1843
 				 * ****
1844 1844
 				 */
1845
-				$add_array ['password'] = $this->common->encode ( $add_array ['password'] );
1845
+				$add_array ['password'] = $this->common->encode($add_array ['password']);
1846 1846
 				/* * ****************** */
1847
-				$add_array ['credit_limit'] = $this->common_model->add_calculate_currency ( $add_array ['credit_limit'], '', '', false, false );
1848
-				$last_id = $this->accounts_model->add_account ( $add_array );
1849
-				if (isset ( $add_array ['tax_id'] )) {
1850
-					foreach ( $add_array ['tax_id'] as $key => $val ) {
1851
-						$data1 = array (
1847
+				$add_array ['credit_limit'] = $this->common_model->add_calculate_currency($add_array ['credit_limit'], '', '', false, false);
1848
+				$last_id = $this->accounts_model->add_account($add_array);
1849
+				if (isset ($add_array ['tax_id'])) {
1850
+					foreach ($add_array ['tax_id'] as $key => $val) {
1851
+						$data1 = array(
1852 1852
 								'accountid' => $last_id,
1853 1853
 								'taxes_id' => $val 
1854 1854
 						);
1855
-						$this->accounts_model->add_account_tax ( $data1 );
1855
+						$this->accounts_model->add_account_tax($data1);
1856 1856
 					}
1857
-					unset ( $add_array ['tax_id'] );
1857
+					unset ($add_array ['tax_id']);
1858 1858
 				}
1859
-				$this->session->set_flashdata ( 'astpp_errormsg', 'Reseller added successfully!' );
1860
-				redirect ( base_url () . 'accounts/reseller_list/' );
1859
+				$this->session->set_flashdata('astpp_errormsg', 'Reseller added successfully!');
1860
+				redirect(base_url().'accounts/reseller_list/');
1861 1861
 				exit ();
1862 1862
 			}
1863
-			$this->load->view ( 'view_accounts_create', $data );
1863
+			$this->load->view('view_accounts_create', $data);
1864 1864
 		}
1865 1865
 	}
1866 1866
 	function reseller_dids($edit_id) {
1867
-		$this->customer_dids ( $edit_id );
1867
+		$this->customer_dids($edit_id);
1868 1868
 	}
1869 1869
 	function customer_generate_password() {
1870
-		echo $this->common->generate_password ();
1870
+		echo $this->common->generate_password();
1871 1871
 	}
1872 1872
 	function customer_generate_number($digit = '') {
1873
-		echo $this->common->find_uniq_rendno_customer ( common_model::$global_config ['system_config'] ['cardlength'], 'number', 'accounts' );
1873
+		echo $this->common->find_uniq_rendno_customer(common_model::$global_config ['system_config'] ['cardlength'], 'number', 'accounts');
1874 1874
 		// end
1875 1875
 		// echo $this->common->find_uniq_rendno($digit, 'number', 'accounts');
1876 1876
 	}
1877 1877
 	function admin_add($type = 2) {
1878
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
1879
-		$entity_type = strtolower ( $this->common->get_entity_type ( '', '', $type ) );
1880
-		$entitytype = str_replace ( ' ', '', $entity_type );
1881
-		$data ['username'] = $this->session->userdata ( 'user_name' );
1878
+		$accountinfo = $this->session->userdata('accountinfo');
1879
+		$entity_type = strtolower($this->common->get_entity_type('', '', $type));
1880
+		$entitytype = str_replace(' ', '', $entity_type);
1881
+		$data ['username'] = $this->session->userdata('user_name');
1882 1882
 		$data ['flag'] = 'create';
1883
-		$data ['page_title'] = gettext ( 'Create ' . ucfirst ( $entity_type ) );
1883
+		$data ['page_title'] = gettext('Create '.ucfirst($entity_type));
1884 1884
 		$data ['back_flag'] = true;
1885
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->get_form_admin_fields ( $entitytype ), '' );
1885
+		$data ['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype), '');
1886 1886
 		$data ['country_id'] = $accountinfo ['country_id'];
1887 1887
 		$data ['currency_id'] = $accountinfo ['currency_id'];
1888 1888
 		$data ['timezone_id'] = $accountinfo ['timezone_id'];
1889
-		if (! $data ['timezone_id']) {
1889
+		if ( ! $data ['timezone_id']) {
1890 1890
 			$data ['timezone_id'] = 1;
1891 1891
 		}
1892
-		if (! $data ['currency_id']) {
1892
+		if ( ! $data ['currency_id']) {
1893 1893
 			$data ['currency_id'] = 1;
1894 1894
 		}
1895
-		if (! $data ['country_id']) {
1895
+		if ( ! $data ['country_id']) {
1896 1896
 			$data ['country_id'] = 1;
1897 1897
 		}
1898 1898
 		$data ['entity_name'] = $entity_type;
1899
-		$this->load->view ( 'view_accounts_create', $data );
1899
+		$this->load->view('view_accounts_create', $data);
1900 1900
 	}
1901 1901
 	function admin_edit($edit_id = '') {
1902 1902
 		$data ['back_flag'] = true;
1903
-		$accountinfo = ( array ) $this->db->get_where ( 'accounts', array (
1903
+		$accountinfo = (array)$this->db->get_where('accounts', array(
1904 1904
 				"id" => $edit_id 
1905
-		) )->first_row ();
1905
+		))->first_row();
1906 1906
 		$type = $accountinfo ['type'] == - 1 ? 2 : $accountinfo ['type'];
1907
-		$entity_type = strtolower ( $this->common->get_entity_type ( '', '', $type ) );
1908
-		$entitytype = str_replace ( ' ', '', $entity_type );
1909
-		$accountinfo ['password'] = $this->common->decode ( $accountinfo ['password'] );
1910
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->get_form_admin_fields ( $entitytype, $edit_id ), $accountinfo );
1911
-		$data ['page_title'] = gettext ( 'Edit ' . ucfirst ( $entity_type ) );
1912
-		$this->load->view ( 'view_admin_details', $data );
1907
+		$entity_type = strtolower($this->common->get_entity_type('', '', $type));
1908
+		$entitytype = str_replace(' ', '', $entity_type);
1909
+		$accountinfo ['password'] = $this->common->decode($accountinfo ['password']);
1910
+		$data ['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype, $edit_id), $accountinfo);
1911
+		$data ['page_title'] = gettext('Edit '.ucfirst($entity_type));
1912
+		$this->load->view('view_admin_details', $data);
1913 1913
 	}
1914 1914
 	function admin_save($add_array = false) {
1915
-		$add_array = $this->input->post ();
1916
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
1915
+		$add_array = $this->input->post();
1916
+		$accountinfo = $this->session->userdata('accountinfo');
1917 1917
 		$type = $add_array ['type'] == - 1 ? 2 : $add_array ['type'];
1918
-		$entity_type = strtolower ( $this->common->get_entity_type ( '', '', $type ) );
1919
-		$entitytype = str_replace ( ' ', '', $entity_type );
1920
-		$data ['username'] = $this->session->userdata ( 'user_name' );
1918
+		$entity_type = strtolower($this->common->get_entity_type('', '', $type));
1919
+		$entitytype = str_replace(' ', '', $entity_type);
1920
+		$data ['username'] = $this->session->userdata('user_name');
1921 1921
 		$data ['flag'] = 'create';
1922
-		$data ['page_title'] = gettext ( 'Create ' . $entity_type );
1923
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->get_form_admin_fields ( $entitytype, $add_array ['id'] ), $add_array );
1922
+		$data ['page_title'] = gettext('Create '.$entity_type);
1923
+		$data ['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype, $add_array ['id']), $add_array);
1924 1924
 		if ($add_array ['id'] != '') {
1925
-			$data ['page_title'] = gettext ( 'Edit ' . $entity_type );
1926
-			if ($this->form_validation->run () == FALSE) {
1927
-				$data ['validation_errors'] = validation_errors ();
1925
+			$data ['page_title'] = gettext('Edit '.$entity_type);
1926
+			if ($this->form_validation->run() == FALSE) {
1927
+				$data ['validation_errors'] = validation_errors();
1928 1928
 			} else {
1929 1929
 				/*
1930 1930
 				 * ****
@@ -1932,95 +1932,95 @@  discard block
 block discarded – undo
1932 1932
 				 * Password encode
1933 1933
 				 * ****
1934 1934
 				 */
1935
-				$add_array ['password'] = $this->common->encode ( $add_array ['password'] );
1935
+				$add_array ['password'] = $this->common->encode($add_array ['password']);
1936 1936
 				/* * ****************** */
1937
-				$add_array ['credit_limit'] = $this->common_model->add_calculate_currency ( $add_array ['credit_limit'], '', '', false, false );
1938
-				$query = $this->accounts_model->remove_all_account_tax ( $add_array ['id'] );
1939
-				if (isset ( $add_array ['tax_id'] )) {
1940
-					foreach ( $add_array ['tax_id'] as $key => $val ) {
1941
-						$data1 = array (
1937
+				$add_array ['credit_limit'] = $this->common_model->add_calculate_currency($add_array ['credit_limit'], '', '', false, false);
1938
+				$query = $this->accounts_model->remove_all_account_tax($add_array ['id']);
1939
+				if (isset ($add_array ['tax_id'])) {
1940
+					foreach ($add_array ['tax_id'] as $key => $val) {
1941
+						$data1 = array(
1942 1942
 								'accountid' => $add_array ['id'],
1943 1943
 								'taxes_id' => $val 
1944 1944
 						);
1945
-						$this->accounts_model->add_account_tax ( $data1 );
1945
+						$this->accounts_model->add_account_tax($data1);
1946 1946
 					}
1947
-					unset ( $add_array ['tax_id'] );
1947
+					unset ($add_array ['tax_id']);
1948 1948
 				}
1949
-				unset ( $add_array ['number'] );
1950
-				$this->accounts_model->edit_account ( $add_array, $add_array ['id'] );
1949
+				unset ($add_array ['number']);
1950
+				$this->accounts_model->edit_account($add_array, $add_array ['id']);
1951 1951
 				if ($add_array ['id'] == $accountinfo ['id']) {
1952
-					$result = $this->db->get_where ( 'accounts', array (
1952
+					$result = $this->db->get_where('accounts', array(
1953 1953
 							'id' => $add_array ['id'] 
1954
-					) );
1955
-					$result = $result->result_array ();
1956
-					$this->session->set_userdata ( 'accountinfo', $result [0] );
1954
+					));
1955
+					$result = $result->result_array();
1956
+					$this->session->set_userdata('accountinfo', $result [0]);
1957 1957
 				}
1958
-				$this->session->set_flashdata ( 'astpp_errormsg', ucfirst ( $entity_type ) . ' updated successfully!' );
1959
-				redirect ( base_url () . 'accounts/admin_list/' );
1958
+				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type).' updated successfully!');
1959
+				redirect(base_url().'accounts/admin_list/');
1960 1960
 				exit ();
1961 1961
 			}
1962
-			$this->load->view ( 'view_admin_details', $data );
1962
+			$this->load->view('view_admin_details', $data);
1963 1963
 		} else {
1964
-			$data ['page_title'] = gettext ( 'Create ' . ucfirst ( $entity_type ) );
1965
-			if ($this->form_validation->run () == FALSE) {
1966
-				$data ['validation_errors'] = validation_errors ();
1964
+			$data ['page_title'] = gettext('Create '.ucfirst($entity_type));
1965
+			if ($this->form_validation->run() == FALSE) {
1966
+				$data ['validation_errors'] = validation_errors();
1967 1967
 			} else {
1968
-				$add_array ['password'] = $this->common->encode ( $add_array ['password'] );
1969
-				$last_id = $this->accounts_model->add_account ( $add_array );
1970
-				if (isset ( $add_array ['tax_id'] )) {
1971
-					foreach ( $add_array ['tax_id'] as $key => $val ) {
1972
-						$data1 = array (
1968
+				$add_array ['password'] = $this->common->encode($add_array ['password']);
1969
+				$last_id = $this->accounts_model->add_account($add_array);
1970
+				if (isset ($add_array ['tax_id'])) {
1971
+					foreach ($add_array ['tax_id'] as $key => $val) {
1972
+						$data1 = array(
1973 1973
 								'accountid' => $last_id,
1974 1974
 								'taxes_id' => $val 
1975 1975
 						);
1976
-						$this->accounts_model->add_account_tax ( $data1 );
1976
+						$this->accounts_model->add_account_tax($data1);
1977 1977
 					}
1978
-					unset ( $add_array ['tax_id'] );
1978
+					unset ($add_array ['tax_id']);
1979 1979
 				}
1980
-				$add_array ['credit_limit'] = $this->common_model->add_calculate_currency ( $add_array ['credit_limit'], '', '', false, false );
1980
+				$add_array ['credit_limit'] = $this->common_model->add_calculate_currency($add_array ['credit_limit'], '', '', false, false);
1981 1981
 				
1982
-				$this->session->set_flashdata ( 'astpp_errormsg', ucfirst ( $entity_type ) . ' added successfully!' );
1983
-				redirect ( base_url () . 'accounts/admin_list/' );
1982
+				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type).' added successfully!');
1983
+				redirect(base_url().'accounts/admin_list/');
1984 1984
 				exit ();
1985 1985
 			}
1986
-			$this->load->view ( 'view_accounts_create', $data );
1986
+			$this->load->view('view_accounts_create', $data);
1987 1987
 		}
1988 1988
 	}
1989 1989
 	function subadmin_add($type = "") {
1990
-		$this->admin_add ( 4 );
1990
+		$this->admin_add(4);
1991 1991
 	}
1992 1992
 	function subadmin_edit($edit_id = '') {
1993
-		$this->admin_edit ( $edit_id );
1993
+		$this->admin_edit($edit_id);
1994 1994
 	}
1995 1995
 	function subadmin_save() {
1996
-		$add_array = $this->input->post ();
1997
-		$this->admin_save ( $add_array );
1996
+		$add_array = $this->input->post();
1997
+		$this->admin_save($add_array);
1998 1998
 	}
1999 1999
 	function chargelist_json($accountid) {
2000
-		$json_data = array ();
2001
-		$sweeplist = $this->common_model->get_sweep_list ();
2000
+		$json_data = array();
2001
+		$sweeplist = $this->common_model->get_sweep_list();
2002 2002
 		
2003 2003
 		$select = "charges.description,charges.charge,charges.sweep";
2004 2004
 		$table = "charges";
2005
-		$jionTable = array (
2005
+		$jionTable = array(
2006 2006
 				'charge_to_account',
2007 2007
 				'accounts' 
2008 2008
 		);
2009
-		$jionCondition = array (
2009
+		$jionCondition = array(
2010 2010
 				'charges.id = charge_to_account.charge_id',
2011 2011
 				'accounts.number = charge_to_account.cardnum' 
2012 2012
 		);
2013
-		$type = array (
2013
+		$type = array(
2014 2014
 				'left',
2015 2015
 				'inner' 
2016 2016
 		);
2017
-		$where = array (
2017
+		$where = array(
2018 2018
 				'accounts.accountid' => $accountid 
2019 2019
 		);
2020 2020
 		$order_type = 'charges.id';
2021 2021
 		$order_by = "ASC";
2022 2022
 		
2023
-		$account_charge_count = $this->db_model->getCountWithJion ( $table, $select, $where, $jionTable, $jionCondition, $type );
2023
+		$account_charge_count = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type);
2024 2024
 		
2025 2025
 		$count_all = $account_charge_count;
2026 2026
 		$config ['total_rows'] = $count_all;
@@ -2035,11 +2035,11 @@  discard block
 block discarded – undo
2035 2035
 		if ($start < 0)
2036 2036
 			$start = 0;
2037 2037
 		
2038
-		$account_charge_list = $this->db_model->getAllJionQuery ( $table, $select, $where, $jionTable, $jionCondition, $type, $perpage, $start, $order_by, $order_type, "" );
2038
+		$account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $perpage, $start, $order_by, $order_type, "");
2039 2039
 		if ($account_charge_list->num_rows > 0) {
2040
-			foreach ( $account_charge_list->result () as $key => $charges_value ) {
2041
-				$json_data ['rows'] [] = array (
2042
-						'cell' => array (
2040
+			foreach ($account_charge_list->result() as $key => $charges_value) {
2041
+				$json_data ['rows'] [] = array(
2042
+						'cell' => array(
2043 2043
 								$charges_value->description,
2044 2044
 								$charges_value->charge,
2045 2045
 								$sweeplist [$charges_value->sweep] 
@@ -2047,18 +2047,18 @@  discard block
 block discarded – undo
2047 2047
 				);
2048 2048
 			}
2049 2049
 		}
2050
-		echo json_encode ( $json_data );
2050
+		echo json_encode($json_data);
2051 2051
 	}
2052 2052
 	function admin_list() {
2053
-		$data ['username'] = $this->session->userdata ( 'user_name' );
2054
-		$data ['page_title'] = gettext ( 'Admins' );
2053
+		$data ['username'] = $this->session->userdata('user_name');
2054
+		$data ['page_title'] = gettext('Admins');
2055 2055
 		$data ['search_flag'] = true;
2056 2056
 		$data ['cur_menu_no'] = 1;
2057
-		$this->session->set_userdata ( 'advance_search', 0 );
2058
-		$data ['grid_fields'] = $this->accounts_form->build_account_list_for_admin ();
2059
-		$data ["grid_buttons"] = $this->accounts_form->build_grid_buttons_admin ();
2060
-		$data ['form_search'] = $this->form->build_serach_form ( $this->accounts_form->get_admin_search_form () );
2061
-		$this->load->view ( 'view_accounts_list', $data );
2057
+		$this->session->set_userdata('advance_search', 0);
2058
+		$data ['grid_fields'] = $this->accounts_form->build_account_list_for_admin();
2059
+		$data ["grid_buttons"] = $this->accounts_form->build_grid_buttons_admin();
2060
+		$data ['form_search'] = $this->form->build_serach_form($this->accounts_form->get_admin_search_form());
2061
+		$this->load->view('view_accounts_list', $data);
2062 2062
 	}
2063 2063
 	
2064 2064
 	/**
@@ -2066,18 +2066,18 @@  discard block
 block discarded – undo
2066 2066
 	 * Listing of Accounts table data through php function json_encode
2067 2067
 	 */
2068 2068
 	function admin_list_json() {
2069
-		$json_data = array ();
2070
-		$account_data = $this->session->userdata ( "accountinfo" );
2069
+		$json_data = array();
2070
+		$account_data = $this->session->userdata("accountinfo");
2071 2071
 		$reseller_id = $account_data ['type'] == 1 ? $account_data ['id'] : 0;
2072
-		$count_all = $this->accounts_model->get_admin_Account_list ( false, '', '', $reseller_id );
2073
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
2072
+		$count_all = $this->accounts_model->get_admin_Account_list(false, '', '', $reseller_id);
2073
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
2074 2074
 		$json_data = $paging_data ["json_paging"];
2075 2075
 		
2076
-		$query = $this->accounts_model->get_admin_Account_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $reseller_id );
2077
-		$grid_fields = json_decode ( $this->accounts_form->build_account_list_for_admin () );
2078
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
2076
+		$query = $this->accounts_model->get_admin_Account_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $reseller_id);
2077
+		$grid_fields = json_decode($this->accounts_form->build_account_list_for_admin());
2078
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
2079 2079
 		
2080
-		echo json_encode ( $json_data );
2080
+		echo json_encode($json_data);
2081 2081
 	}
2082 2082
 	
2083 2083
 	/**
@@ -2085,18 +2085,18 @@  discard block
 block discarded – undo
2085 2085
 	 * Customer Batch Update.
2086 2086
 	 */
2087 2087
 	function customer_batch_update() {
2088
-		$batch_update_arr = $this->input->post ();
2089
-		$result = $this->accounts_model->customer_rates_batch_update ( $batch_update_arr );
2090
-		echo json_encode ( array (
2088
+		$batch_update_arr = $this->input->post();
2089
+		$result = $this->accounts_model->customer_rates_batch_update($batch_update_arr);
2090
+		echo json_encode(array(
2091 2091
 				"SUCCESS" => "Customer batch updated successfully!" 
2092
-		) );
2092
+		));
2093 2093
 		exit ();
2094 2094
 	}
2095 2095
 	
2096 2096
 	/* * ********************************************************************* */
2097 2097
 	function reseller_list() {
2098
-		$data ['username'] = $this->session->userdata ( 'user_name' );
2099
-		$data ['page_title'] = gettext ( 'Resellers' );
2098
+		$data ['username'] = $this->session->userdata('user_name');
2099
+		$data ['page_title'] = gettext('Resellers');
2100 2100
 		$data ['search_flag'] = true;
2101 2101
 		/**
2102 2102
 		 * ASTPP 3.0
@@ -2104,13 +2104,13 @@  discard block
 block discarded – undo
2104 2104
 		 */
2105 2105
 		$data ['batch_update_flag'] = true;
2106 2106
 		/* * *************************************** */
2107
-		$this->session->set_userdata ( 'advance_search', 0 );
2108
-		$data ['grid_fields'] = $this->accounts_form->build_account_list_for_reseller ();
2109
-		$data ["grid_buttons"] = $this->accounts_form->build_grid_buttons_reseller ();
2110
-		$data ['form_search'] = $this->form->build_serach_form ( $this->accounts_form->get_reseller_search_form () );
2111
-		$data ['form_batch_update'] = $this->form->build_batchupdate_form ( $this->accounts_form->reseller_batch_update_form () );
2107
+		$this->session->set_userdata('advance_search', 0);
2108
+		$data ['grid_fields'] = $this->accounts_form->build_account_list_for_reseller();
2109
+		$data ["grid_buttons"] = $this->accounts_form->build_grid_buttons_reseller();
2110
+		$data ['form_search'] = $this->form->build_serach_form($this->accounts_form->get_reseller_search_form());
2111
+		$data ['form_batch_update'] = $this->form->build_batchupdate_form($this->accounts_form->reseller_batch_update_form());
2112 2112
 		/* * ************************************************************************************************************ */
2113
-		$this->load->view ( 'view_accounts_list', $data );
2113
+		$this->load->view('view_accounts_list', $data);
2114 2114
 	}
2115 2115
 	
2116 2116
 	/**
@@ -2118,335 +2118,335 @@  discard block
 block discarded – undo
2118 2118
 	 * Listing of Accounts table data through php function json_encode
2119 2119
 	 */
2120 2120
 	function reseller_list_json() {
2121
-		$json_data = array ();
2122
-		$count_all = $this->accounts_model->get_reseller_Account_list ( false );
2123
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
2121
+		$json_data = array();
2122
+		$count_all = $this->accounts_model->get_reseller_Account_list(false);
2123
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
2124 2124
 		$json_data = $paging_data ["json_paging"];
2125 2125
 		
2126
-		$query = $this->accounts_model->get_reseller_Account_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
2127
-		$grid_fields = json_decode ( $this->accounts_form->build_account_list_for_reseller () );
2128
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
2126
+		$query = $this->accounts_model->get_reseller_Account_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
2127
+		$grid_fields = json_decode($this->accounts_form->build_account_list_for_reseller());
2128
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
2129 2129
 		
2130
-		echo json_encode ( $json_data );
2130
+		echo json_encode($json_data);
2131 2131
 	}
2132 2132
 	function reseller_list_search() {
2133
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
2134
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
2135
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
2136
-			$action = $this->input->post ();
2137
-			unset ( $action ['action'] );
2138
-			unset ( $action ['advance_search'] );
2139
-			if (isset ( $action ['balance'] ['balance'] ) && $action ['balance'] ['balance'] != '') {
2140
-				$action ['balance'] ['balance'] = $this->common_model->add_calculate_currency ( $action ['balance'] ['balance'], "", '', true, false );
2133
+		$ajax_search = $this->input->post('ajax_search', 0);
2134
+		if ($this->input->post('advance_search', TRUE) == 1) {
2135
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
2136
+			$action = $this->input->post();
2137
+			unset ($action ['action']);
2138
+			unset ($action ['advance_search']);
2139
+			if (isset ($action ['balance'] ['balance']) && $action ['balance'] ['balance'] != '') {
2140
+				$action ['balance'] ['balance'] = $this->common_model->add_calculate_currency($action ['balance'] ['balance'], "", '', true, false);
2141 2141
 			}
2142
-			if (isset ( $action ['credit_limit'] ['credit_limit'] ) && $action ['credit_limit'] ['credit_limit'] != '') {
2143
-				$action ['credit_limit'] ['credit_limit'] = $this->common_model->add_calculate_currency ( $action ['credit_limit'] ['credit_limit'], "", '', true, false );
2142
+			if (isset ($action ['credit_limit'] ['credit_limit']) && $action ['credit_limit'] ['credit_limit'] != '') {
2143
+				$action ['credit_limit'] ['credit_limit'] = $this->common_model->add_calculate_currency($action ['credit_limit'] ['credit_limit'], "", '', true, false);
2144 2144
 			}
2145
-			$this->session->set_userdata ( 'reseller_list_search', $action );
2145
+			$this->session->set_userdata('reseller_list_search', $action);
2146 2146
 		}
2147 2147
 		if (@$ajax_search != 1) {
2148
-			redirect ( base_url () . 'accounts/reseller_list/' );
2148
+			redirect(base_url().'accounts/reseller_list/');
2149 2149
 		}
2150 2150
 	}
2151 2151
 	function reseller_batch_update() {
2152
-		$batch_update_arr = $this->input->post ();
2153
-		$result = $this->accounts_model->reseller_rates_batch_update ( $batch_update_arr );
2154
-		echo json_encode ( array (
2152
+		$batch_update_arr = $this->input->post();
2153
+		$result = $this->accounts_model->reseller_rates_batch_update($batch_update_arr);
2154
+		echo json_encode(array(
2155 2155
 				"SUCCESS" => "Reseller batch updated successfully!" 
2156
-		) );
2156
+		));
2157 2157
 		exit ();
2158 2158
 	}
2159 2159
 	function admin_list_clearsearchfilter() {
2160
-		$this->session->set_userdata ( 'advance_search', 0 );
2161
-		$this->session->set_userdata ( 'admin_list_search', "" );
2160
+		$this->session->set_userdata('advance_search', 0);
2161
+		$this->session->set_userdata('admin_list_search', "");
2162 2162
 	}
2163 2163
 	function admin_list_search() {
2164
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
2165
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
2166
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
2167
-			$action = $this->input->post ();
2168
-			unset ( $action ['action'] );
2169
-			unset ( $action ['advance_search'] );
2170
-			$this->session->set_userdata ( 'admin_list_search', $action );
2164
+		$ajax_search = $this->input->post('ajax_search', 0);
2165
+		if ($this->input->post('advance_search', TRUE) == 1) {
2166
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
2167
+			$action = $this->input->post();
2168
+			unset ($action ['action']);
2169
+			unset ($action ['advance_search']);
2170
+			$this->session->set_userdata('admin_list_search', $action);
2171 2171
 		}
2172 2172
 		if (@$ajax_search != 1) {
2173
-			redirect ( base_url () . 'accounts/admin_list/' );
2173
+			redirect(base_url().'accounts/admin_list/');
2174 2174
 		}
2175 2175
 	}
2176 2176
 	function reseller_list_clearsearchfilter() {
2177
-		$this->session->set_userdata ( 'advance_search', 0 );
2178
-		$this->session->set_userdata ( 'reseller_list_search', "" );
2177
+		$this->session->set_userdata('advance_search', 0);
2178
+		$this->session->set_userdata('reseller_list_search', "");
2179 2179
 	}
2180 2180
 	function customer_delete($id) {
2181
-		$this->common->customer_delete_dependencies ( $id );
2182
-		$this->session->set_flashdata ( 'astpp_notification', 'Customer removed successfully!' );
2183
-		redirect ( base_url () . 'accounts/customer_list/' );
2181
+		$this->common->customer_delete_dependencies($id);
2182
+		$this->session->set_flashdata('astpp_notification', 'Customer removed successfully!');
2183
+		redirect(base_url().'accounts/customer_list/');
2184 2184
 	}
2185 2185
 	function reseller_delete($id) {
2186
-		$this->common->subreseller_list ( $id );
2187
-		$this->session->set_flashdata ( 'astpp_notification', 'Reseller removed successfully!' );
2188
-		redirect ( base_url () . 'accounts/reseller_list/' );
2186
+		$this->common->subreseller_list($id);
2187
+		$this->session->set_flashdata('astpp_notification', 'Reseller removed successfully!');
2188
+		redirect(base_url().'accounts/reseller_list/');
2189 2189
 	}
2190 2190
 	function free_customer_did($accountid) {
2191
-		$this->db->where ( array (
2191
+		$this->db->where(array(
2192 2192
 				"accountid" => $accountid 
2193
-		) );
2194
-		$this->db->update ( "dids", array (
2193
+		));
2194
+		$this->db->update("dids", array(
2195 2195
 				'accountid' => "0" 
2196
-		) );
2196
+		));
2197 2197
 		return true;
2198 2198
 	}
2199 2199
 	function free_ani_map($accountid) {
2200
-		$this->db->where ( array (
2200
+		$this->db->where(array(
2201 2201
 				"accountid" => $accountid 
2202
-		) );
2203
-		$this->db->delete ( 'ani_map' );
2202
+		));
2203
+		$this->db->delete('ani_map');
2204 2204
 		return true;
2205 2205
 	}
2206 2206
 	function free_reseller_did($ids) {
2207
-		$accountinfo = $this->session->userdata ( 'accountinfo' );
2207
+		$accountinfo = $this->session->userdata('accountinfo');
2208 2208
 		$reseller_id = $accountinfo ['type'] != 1 ? 0 : $accountinfo ['id'];
2209
-		$data = array (
2209
+		$data = array(
2210 2210
 				'parent_id' => $reseller_id,
2211 2211
 				'accountid' => 0 
2212 2212
 		);
2213 2213
 		$where = "parent_id IN ($ids)";
2214
-		$this->db->where ( $where );
2215
-		$this->db->update ( 'dids', $data );
2214
+		$this->db->where($where);
2215
+		$this->db->update('dids', $data);
2216 2216
 		$where = "reseller_id IN ($ids)";
2217
-		$this->db->where ( $where );
2218
-		$this->db->delete ( 'reseller_pricing' );
2217
+		$this->db->where($where);
2218
+		$this->db->delete('reseller_pricing');
2219 2219
 		return true;
2220 2220
 	}
2221 2221
 	function provider_delete($id) {
2222
-		$this->accounts_model->remove_customer ( $id );
2223
-		$this->session->set_flashdata ( 'astpp_notification', 'Provider removed successfully!' );
2224
-		redirect ( base_url () . 'accounts/customer_list/' );
2222
+		$this->accounts_model->remove_customer($id);
2223
+		$this->session->set_flashdata('astpp_notification', 'Provider removed successfully!');
2224
+		redirect(base_url().'accounts/customer_list/');
2225 2225
 	}
2226 2226
 	function admin_delete($id) {
2227
-		$this->accounts_model->remove_customer ( $id );
2228
-		$this->session->set_flashdata ( 'astpp_notification', 'Admin removed successfully!' );
2229
-		redirect ( base_url () . 'accounts/admin_list/' );
2227
+		$this->accounts_model->remove_customer($id);
2228
+		$this->session->set_flashdata('astpp_notification', 'Admin removed successfully!');
2229
+		redirect(base_url().'accounts/admin_list/');
2230 2230
 	}
2231 2231
 	function subadmin_delete($id) {
2232
-		$this->accounts_model->remove_customer ( $id );
2233
-		$this->session->set_flashdata ( 'astpp_notification', 'Sub admin removed successfully!' );
2234
-		redirect ( base_url () . 'accounts/admin_list/' );
2232
+		$this->accounts_model->remove_customer($id);
2233
+		$this->session->set_flashdata('astpp_notification', 'Sub admin removed successfully!');
2234
+		redirect(base_url().'accounts/admin_list/');
2235 2235
 	}
2236 2236
 	function reseller_details_json($module, $accountid) {
2237 2237
 		if ($module == "did") {
2238
-			$this->load->module ( 'did/did' );
2239
-			$this->did->reseller_did ( $accountid, "reseller" );
2238
+			$this->load->module('did/did');
2239
+			$this->did->reseller_did($accountid, "reseller");
2240 2240
 		}
2241 2241
 		if ($module == "invoices") {
2242
-			$this->load->module ( 'invoices/invoices' );
2243
-			$this->invoices->customer_invoices ( $accountid, "reseller" );
2242
+			$this->load->module('invoices/invoices');
2243
+			$this->invoices->customer_invoices($accountid, "reseller");
2244 2244
 		}
2245 2245
 		if ($module == "charges") {
2246
-			$this->load->module ( 'charges/charges' );
2247
-			$this->charges->customer_charge_list ( $accountid, "reseller" );
2246
+			$this->load->module('charges/charges');
2247
+			$this->charges->customer_charge_list($accountid, "reseller");
2248 2248
 		}
2249 2249
 		if ($module == 'packages') {
2250
-			$this->load->module ( 'package/package' );
2251
-			$this->package->package_list_reseller ( $accountid, "reseller" );
2250
+			$this->load->module('package/package');
2251
+			$this->package->package_list_reseller($accountid, "reseller");
2252 2252
 		}
2253 2253
 	}
2254 2254
 	function provider_details_json($module, $accountid) {
2255 2255
 		if ($module == "invoices") {
2256
-			$this->load->module ( 'invoices/invoices' );
2257
-			$this->invoices->customer_invoices ( $accountid );
2256
+			$this->load->module('invoices/invoices');
2257
+			$this->invoices->customer_invoices($accountid);
2258 2258
 		}
2259 2259
 	}
2260 2260
 	function customer_add_postcharges($accounttype, $accountid) {
2261
-		$charge = $this->input->post ( "amount", true );
2261
+		$charge = $this->input->post("amount", true);
2262 2262
 		if ($charge != "") {
2263
-			$charge = $this->common_model->add_calculate_currency ( $charge, "", '', false, false );
2264
-			$date = date ( 'Y-m-d H:i:s' );
2265
-			$insert_arr = array (
2263
+			$charge = $this->common_model->add_calculate_currency($charge, "", '', false, false);
2264
+			$date = date('Y-m-d H:i:s');
2265
+			$insert_arr = array(
2266 2266
 					"accountid" => $accountid,
2267
-					"description" => $this->input->post ( "desc", true ),
2267
+					"description" => $this->input->post("desc", true),
2268 2268
 					"created_date" => $date,
2269 2269
 					"debit" => $charge,
2270 2270
 					"charge_type" => "post_charge" 
2271 2271
 			);
2272
-			$this->db->insert ( "invoice_item", $insert_arr );
2272
+			$this->db->insert("invoice_item", $insert_arr);
2273 2273
 			
2274
-			$this->accounts_model->update_balance ( $charge, $accountid, "debit" );
2275
-			redirect ( base_url () . "accounts/" . $accounttype . "_edit/$accountid#packages" );
2274
+			$this->accounts_model->update_balance($charge, $accountid, "debit");
2275
+			redirect(base_url()."accounts/".$accounttype."_edit/$accountid#packages");
2276 2276
 		} else {
2277
-			redirect ( base_url () . "accounts/" . $accounttype . "_edit/$accountid#packages" );
2277
+			redirect(base_url()."accounts/".$accounttype."_edit/$accountid#packages");
2278 2278
 		}
2279 2279
 	}
2280 2280
 	function reseller_did_action($action, $accountid, $accounttype, $did_id = "") {
2281 2281
 		if ($action == "add") {
2282
-			$did_id = $this->input->post ( "free_did_list", true );
2282
+			$did_id = $this->input->post("free_did_list", true);
2283 2283
 			if ($did_id != "") {
2284
-				$account_query = $this->db_model->getSelect ( "*", "accounts", array (
2284
+				$account_query = $this->db_model->getSelect("*", "accounts", array(
2285 2285
 						"id" => $accountid 
2286
-				) );
2286
+				));
2287 2287
 				
2288
-				$account_arr = $account_query->result_array ();
2288
+				$account_arr = $account_query->result_array();
2289 2289
 				$idofaccount = $accountid;
2290
-				$this->db_model->update ( "dids", array (
2290
+				$this->db_model->update("dids", array(
2291 2291
 						"parent_id" => $accountid,
2292
-						'assign_date' => gmdate ( 'Y-m-d H:i:s' ) 
2293
-				), array (
2292
+						'assign_date' => gmdate('Y-m-d H:i:s') 
2293
+				), array(
2294 2294
 						"id" => $did_id 
2295
-				) );
2295
+				));
2296 2296
 				$accountid = $idofaccount;
2297
-				$this->load->module ( 'did/did' );
2298
-				$this->did->did_model->add_reseller_pricing ( $accountid, $did_id );
2297
+				$this->load->module('did/did');
2298
+				$this->did->did_model->add_reseller_pricing($accountid, $did_id);
2299 2299
 				
2300
-				$this->session->set_flashdata ( 'astpp_errormsg', 'DID added successfully.' );
2301
-				redirect ( base_url () . "accounts/" . $accounttype . "_edit/$accountid#did" );
2300
+				$this->session->set_flashdata('astpp_errormsg', 'DID added successfully.');
2301
+				redirect(base_url()."accounts/".$accounttype."_edit/$accountid#did");
2302 2302
 			} else {
2303
-				redirect ( base_url () . "accounts/" . $accounttype . "_edit/$accountid#did" );
2303
+				redirect(base_url()."accounts/".$accounttype."_edit/$accountid#did");
2304 2304
 			}
2305 2305
 		}
2306 2306
 		if ($action == "delete") {
2307
-			$this->db->where ( 'id', $did_id );
2308
-			$this->db->select ( 'note' );
2309
-			$pricing_res = $this->db->get ( 'reseller_pricing' );
2310
-			if ($pricing_res->num_rows () > 0) {
2311
-				$pricing_res = $pricing_res->result_array ();
2307
+			$this->db->where('id', $did_id);
2308
+			$this->db->select('note');
2309
+			$pricing_res = $this->db->get('reseller_pricing');
2310
+			if ($pricing_res->num_rows() > 0) {
2311
+				$pricing_res = $pricing_res->result_array();
2312 2312
 				$did_number = $pricing_res [0] ['note'];
2313
-				$accountinfo = $this->session->userdata ( 'accountinfo' );
2313
+				$accountinfo = $this->session->userdata('accountinfo');
2314 2314
 				if ($this->session->userdata ['userlevel_logintype'] == - 1) {
2315 2315
 					$parent_id = 0;
2316 2316
 				} else {
2317 2317
 					$parent_id = $this->session->userdata ['accountinfo'] ['id'];
2318 2318
 				}
2319 2319
 				
2320
-				$reseller_ids = $this->common->subreseller_list ( $accountinfo ['id'] );
2320
+				$reseller_ids = $this->common->subreseller_list($accountinfo ['id']);
2321 2321
 				$pricing_where = "parent_id = $parent_id AND note = $did_number";
2322
-				$this->db->where ( $pricing_where );
2323
-				$this->db->delete ( 'reseller_pricing' );
2322
+				$this->db->where($pricing_where);
2323
+				$this->db->delete('reseller_pricing');
2324 2324
 				$dids_where = "parent_id IN ($reseller_ids) AND number = $did_number";
2325
-				$this->db->where ( $dids_where );
2326
-				$data = array (
2325
+				$this->db->where($dids_where);
2326
+				$data = array(
2327 2327
 						'accountid' => 0,
2328 2328
 						'parent_id' => $accountinfo ['id'] 
2329 2329
 				);
2330
-				$this->db->update ( 'dids', $data );
2331
-				$this->session->set_flashdata ( 'astpp_notification', 'DID removed successfully.' );
2330
+				$this->db->update('dids', $data);
2331
+				$this->session->set_flashdata('astpp_notification', 'DID removed successfully.');
2332 2332
 			} else {
2333
-				$this->session->set_flashdata ( 'astpp_notification', 'DID already removed before.' );
2333
+				$this->session->set_flashdata('astpp_notification', 'DID already removed before.');
2334 2334
 			}
2335
-			redirect ( base_url () . "accounts/" . $accounttype . "_edit/$accountid#did" );
2335
+			redirect(base_url()."accounts/".$accounttype."_edit/$accountid#did");
2336 2336
 		}
2337 2337
 	}
2338 2338
 	function customer_selected_delete() {
2339
-		$ids = $this->input->post ( "selected_ids", true );
2340
-		$customer_ids = explode ( ",", $ids );
2341
-		foreach ( $customer_ids as $customer_id ) {
2342
-			$customer_id = str_replace ( "'", "", $customer_id );
2343
-			$this->common->customer_delete_dependencies ( $customer_id );
2339
+		$ids = $this->input->post("selected_ids", true);
2340
+		$customer_ids = explode(",", $ids);
2341
+		foreach ($customer_ids as $customer_id) {
2342
+			$customer_id = str_replace("'", "", $customer_id);
2343
+			$this->common->customer_delete_dependencies($customer_id);
2344 2344
 		}
2345 2345
 		echo TRUE;
2346 2346
 	}
2347 2347
 	function reseller_selected_delete() {
2348
-		$ids = $this->input->post ( "selected_ids", true );
2349
-		$id_arr = explode ( ',', $ids );
2350
-		foreach ( $id_arr as $data ) {
2351
-			$data = str_replace ( "'", "", $data );
2352
-			$this->common->subreseller_list ( $data );
2348
+		$ids = $this->input->post("selected_ids", true);
2349
+		$id_arr = explode(',', $ids);
2350
+		foreach ($id_arr as $data) {
2351
+			$data = str_replace("'", "", $data);
2352
+			$this->common->subreseller_list($data);
2353 2353
 		}
2354 2354
 		echo TRUE;
2355 2355
 	}
2356 2356
 	function callshop_selected_delete() {
2357
-		echo $this->delete_multiple ();
2357
+		echo $this->delete_multiple();
2358 2358
 	}
2359 2359
 	function provider_selected_delete() {
2360
-		echo $this->delete_multiple ();
2360
+		echo $this->delete_multiple();
2361 2361
 	}
2362 2362
 	function subadmin_selected_delete() {
2363
-		echo $this->delete_multiple ();
2363
+		echo $this->delete_multiple();
2364 2364
 	}
2365 2365
 	function admin_selected_delete() {
2366
-		echo $this->delete_multiple ();
2366
+		echo $this->delete_multiple();
2367 2367
 	}
2368 2368
 	function delete_multiple() {
2369
-		$ids = $this->input->post ( "selected_ids", true );
2369
+		$ids = $this->input->post("selected_ids", true);
2370 2370
 		$where = "id IN ($ids)";
2371
-		$data = array (
2371
+		$data = array(
2372 2372
 				'deleted' => 1 
2373 2373
 		);
2374
-		$this->db->where ( $where );
2375
-		$this->db->where ( 'type <>', '-1' );
2376
-		$this->db->update ( "accounts", $data );
2374
+		$this->db->where($where);
2375
+		$this->db->where('type <>', '-1');
2376
+		$this->db->update("accounts", $data);
2377 2377
 		echo TRUE;
2378 2378
 	}
2379 2379
 	function customer_account_taxes($action = false, $id = false) {
2380
-		$data ['username'] = $this->session->userdata ( 'user_name' );
2381
-		$data ['page_title'] = gettext ( 'Account Taxes' );
2380
+		$data ['username'] = $this->session->userdata('user_name');
2381
+		$data ['page_title'] = gettext('Account Taxes');
2382 2382
 		
2383 2383
 		if ($action == false)
2384 2384
 			$action = "list";
2385 2385
 		
2386 2386
 		if ($action == 'list') {
2387
-			$this->load->view ( 'view_account_taxes_list', $data );
2387
+			$this->load->view('view_account_taxes_list', $data);
2388 2388
 		} elseif ($action == 'add') {
2389 2389
 			
2390
-			if (($this->input->post ())) {
2391
-				$post_array = $this->input->post ();
2392
-				$query = $this->accounts_model->remove_all_account_tax ( $post_array ['account_id'] );
2390
+			if (($this->input->post())) {
2391
+				$post_array = $this->input->post();
2392
+				$query = $this->accounts_model->remove_all_account_tax($post_array ['account_id']);
2393 2393
 				
2394
-				foreach ( $post_array as $key => $value ) {
2395
-					$id = explode ( "_", $key );
2394
+				foreach ($post_array as $key => $value) {
2395
+					$id = explode("_", $key);
2396 2396
 					if ($id [0] == 'tax') {
2397
-						$data = array (
2397
+						$data = array(
2398 2398
 								'accountid' => $post_array ['account_id'],
2399 2399
 								'taxes_id' => $post_array [$key] 
2400 2400
 						);
2401
-						$this->accounts_model->add_account_tax ( $data );
2401
+						$this->accounts_model->add_account_tax($data);
2402 2402
 					}
2403 2403
 				}
2404
-				$this->session->set_flashdata ( 'astpp_errormsg', 'Account tax added successfully!' );
2405
-				redirect ( base_url () . 'accounts/customer_list/' );
2404
+				$this->session->set_flashdata('astpp_errormsg', 'Account tax added successfully!');
2405
+				redirect(base_url().'accounts/customer_list/');
2406 2406
 			}
2407
-			$data ['id'] = array ();
2408
-			$data ['taxesList'] = $this->common_model->get_list_taxes ();
2409
-			$this->load->view ( 'view_accounting_taxes_add', $data );
2407
+			$data ['id'] = array();
2408
+			$data ['taxesList'] = $this->common_model->get_list_taxes();
2409
+			$this->load->view('view_accounting_taxes_add', $data);
2410 2410
 		} elseif ($action == 'edit') {
2411
-			$taxes_id = $this->accounts_model->get_accounttax_by_id ( $id );
2412
-			$account_num = $this->accounts_model->get_account_number ( $id );
2411
+			$taxes_id = $this->accounts_model->get_accounttax_by_id($id);
2412
+			$account_num = $this->accounts_model->get_account_number($id);
2413 2413
 			$data ['accountnum'] = $account_num ['number'];
2414 2414
 			$data ['account_id'] = $id;
2415
-			for($i = 0; $i < count ( $taxes_id ); $i ++) {
2415
+			for ($i = 0; $i < count($taxes_id); $i++) {
2416 2416
 				$tax_ids [] = $taxes_id [$i] ['taxes_id'];
2417 2417
 			}
2418 2418
 			$data ['tax_ids'] = $tax_ids;
2419 2419
 			
2420 2420
 			$data ['tax_id'] = $taxes_id;
2421 2421
 			
2422
-			if (($this->input->post ())) {
2423
-				$post_array = $this->input->post ();
2424
-				$accountinfo = $this->accounts_model->get_account_by_number ( $post_array ['account_id'] );
2425
-				$query = $this->accounts_model->remove_all_account_tax ( $post_array ['account_id'] );
2426
-				foreach ( $post_array as $key => $value ) {
2427
-					$id = explode ( "_", $key );
2422
+			if (($this->input->post())) {
2423
+				$post_array = $this->input->post();
2424
+				$accountinfo = $this->accounts_model->get_account_by_number($post_array ['account_id']);
2425
+				$query = $this->accounts_model->remove_all_account_tax($post_array ['account_id']);
2426
+				foreach ($post_array as $key => $value) {
2427
+					$id = explode("_", $key);
2428 2428
 					if ($id [0] == 'tax') {
2429
-						$data = array (
2429
+						$data = array(
2430 2430
 								'accountid' => $post_array ['account_id'],
2431 2431
 								'taxes_id' => $post_array [$key] 
2432 2432
 						);
2433
-						$this->accounts_model->add_account_tax ( $data );
2433
+						$this->accounts_model->add_account_tax($data);
2434 2434
 					}
2435 2435
 				}
2436 2436
 				if ($accountinfo ['type'] == '0') {
2437
-					$link = base_url () . '/accounts/customer_list/';
2437
+					$link = base_url().'/accounts/customer_list/';
2438 2438
 				} else {
2439
-					$link = base_url () . '/accounts/reseller_list/';
2439
+					$link = base_url().'/accounts/reseller_list/';
2440 2440
 				}
2441
-				$this->session->set_flashdata ( 'astpp_errormsg', 'Account tax added successfully!' );
2442
-				redirect ( $link );
2441
+				$this->session->set_flashdata('astpp_errormsg', 'Account tax added successfully!');
2442
+				redirect($link);
2443 2443
 			}
2444
-			$data ['taxesList'] = $this->common_model->get_list_taxes ();
2445
-			$this->load->view ( 'view_accounting_taxes_add', $data );
2444
+			$data ['taxesList'] = $this->common_model->get_list_taxes();
2445
+			$this->load->view('view_accounting_taxes_add', $data);
2446 2446
 		} elseif ($action == 'delete') {
2447
-			$this->accounting_model->remove_account_tax ( $id );
2448
-			$this->session->set_flashdata ( 'astpp_notification', 'Account tax removed successfully!' );
2449
-			redirect ( base_url () . 'accounting/account_taxes/' );
2447
+			$this->accounting_model->remove_account_tax($id);
2448
+			$this->session->set_flashdata('astpp_notification', 'Account tax removed successfully!');
2449
+			redirect(base_url().'accounting/account_taxes/');
2450 2450
 		}
2451 2451
 	}
2452 2452
 	
@@ -2457,19 +2457,19 @@  discard block
 block discarded – undo
2457 2457
 	 */
2458 2458
 	function valid_account_tax() {
2459 2459
 		$tax_id = '';
2460
-		if (! empty ( $_POST ['username'] )) {
2460
+		if ( ! empty ($_POST ['username'])) {
2461 2461
 			
2462
-			$account_num = mysql_real_escape_string ( $_POST ['username'] );
2463
-			$row = $this->accounts_model->check_account_num ( $account_num );
2464
-			if (isset ( $row ['accountid'] ) && $row ['accountid'] != '') {
2465
-				$taxes_id = $this->accounts_model->get_accounttax_by_id ( $row ['accountid'] );
2462
+			$account_num = mysql_real_escape_string($_POST ['username']);
2463
+			$row = $this->accounts_model->check_account_num($account_num);
2464
+			if (isset ($row ['accountid']) && $row ['accountid'] != '') {
2465
+				$taxes_id = $this->accounts_model->get_accounttax_by_id($row ['accountid']);
2466 2466
 				if ($taxes_id) {
2467
-					foreach ( $taxes_id as $id ) {
2468
-						$tax_id .= $id ['taxes_id'] . ",";
2467
+					foreach ($taxes_id as $id) {
2468
+						$tax_id .= $id ['taxes_id'].",";
2469 2469
 					}
2470 2470
 					
2471
-					$tax_id = rtrim ( $tax_id, "," );
2472
-					echo $row ['accountid'] . ',' . $tax_id;
2471
+					$tax_id = rtrim($tax_id, ",");
2472
+					echo $row ['accountid'].','.$tax_id;
2473 2473
 				} else {
2474 2474
 					echo $row ['accountid'];
2475 2475
 				}
@@ -2477,40 +2477,40 @@  discard block
 block discarded – undo
2477 2477
 		}
2478 2478
 	}
2479 2479
 	function reseller_edit_account() {
2480
-		$account_data = $this->session->userdata ( "accountinfo" );
2480
+		$account_data = $this->session->userdata("accountinfo");
2481 2481
 		
2482
-		$add_array = $this->input->post ();
2483
-		$data ['form'] = $this->form->build_form ( $this->accounts_form->get_reseller_own_form_fields (), $add_array );
2482
+		$add_array = $this->input->post();
2483
+		$data ['form'] = $this->form->build_form($this->accounts_form->get_reseller_own_form_fields(), $add_array);
2484 2484
 		if ($add_array ['id'] != '') {
2485
-			$data ['page_title'] = gettext ( 'Edit Reseller' );
2486
-			if ($this->form_validation->run () == FALSE) {
2487
-				$data ['validation_errors'] = validation_errors ();
2485
+			$data ['page_title'] = gettext('Edit Reseller');
2486
+			if ($this->form_validation->run() == FALSE) {
2487
+				$data ['validation_errors'] = validation_errors();
2488 2488
 			} else {
2489
-				$this->accounts_model->edit_account ( $add_array, $add_array ['id'] );
2490
-				$accountinfo = $this->session->userdata ( 'accountinfo' );
2489
+				$this->accounts_model->edit_account($add_array, $add_array ['id']);
2490
+				$accountinfo = $this->session->userdata('accountinfo');
2491 2491
 				if ($add_array ['id'] == $accountinfo ['id']) {
2492
-					$result = $this->db->get_where ( 'accounts', array (
2492
+					$result = $this->db->get_where('accounts', array(
2493 2493
 							'id' => $add_array ['id'] 
2494
-					) );
2495
-					$result = $result->result_array ();
2496
-					$this->session->set_userdata ( 'accountinfo', $result [0] );
2494
+					));
2495
+					$result = $result->result_array();
2496
+					$this->session->set_userdata('accountinfo', $result [0]);
2497 2497
 				}
2498
-				$this->session->set_flashdata ( 'astpp_errormsg', 'Reseller updated successfully!' );
2499
-				redirect ( base_url () . '/dashboard/' );
2498
+				$this->session->set_flashdata('astpp_errormsg', 'Reseller updated successfully!');
2499
+				redirect(base_url().'/dashboard/');
2500 2500
 			}
2501
-			$this->load->view ( 'view_reseller_edit_details_own', $data );
2501
+			$this->load->view('view_reseller_edit_details_own', $data);
2502 2502
 		} else {
2503
-			$data ['page_title'] = gettext ( 'Edit Reseller' );
2504
-			$where = array (
2503
+			$data ['page_title'] = gettext('Edit Reseller');
2504
+			$where = array(
2505 2505
 					'id' => $account_data ["id"] 
2506 2506
 			);
2507
-			$account = $this->db_model->getSelect ( "*", "accounts", $where );
2508
-			$data ["account_data"] = $account->result_array ();
2509
-			foreach ( $account->result_array () as $key => $value ) {
2507
+			$account = $this->db_model->getSelect("*", "accounts", $where);
2508
+			$data ["account_data"] = $account->result_array();
2509
+			foreach ($account->result_array() as $key => $value) {
2510 2510
 				$editable_data = $value;
2511 2511
 			}
2512
-			$data ['form'] = $this->form->build_form ( $this->accounts_form->get_reseller_own_form_fields (), $editable_data );
2513
-			$this->load->view ( 'view_reseller_edit_details_own', $data );
2512
+			$data ['form'] = $this->form->build_form($this->accounts_form->get_reseller_own_form_fields(), $editable_data);
2513
+			$this->load->view('view_reseller_edit_details_own', $data);
2514 2514
 		}
2515 2515
 	}
2516 2516
 	/**
@@ -2520,52 +2520,52 @@  discard block
 block discarded – undo
2520 2520
 	 */
2521 2521
 	function customer_animap_list($id = '') {
2522 2522
 		$data ['animap_id'] = $id;
2523
-		$data ['username'] = $this->session->userdata ( 'user_name' );
2524
-		$data ['page_title'] = gettext ( "Caller Id List" );
2525
-		$this->session->set_userdata ( 'animap_search', 0 );
2526
-		$data ['grid_fields'] = $this->accounts_form->build_animap_list ();
2527
-		$data ["grid_buttons"] = $this->accounts_form->build_grid_buttons_destination ();
2528
-		$this->load->view ( 'view_ani_map', $data );
2523
+		$data ['username'] = $this->session->userdata('user_name');
2524
+		$data ['page_title'] = gettext("Caller Id List");
2525
+		$this->session->set_userdata('animap_search', 0);
2526
+		$data ['grid_fields'] = $this->accounts_form->build_animap_list();
2527
+		$data ["grid_buttons"] = $this->accounts_form->build_grid_buttons_destination();
2528
+		$this->load->view('view_ani_map', $data);
2529 2529
 	}
2530 2530
 	function customer_animap_list_json($id = '') {
2531
-		$json_data = array ();
2532
-		$count_all = $this->accounts_model->get_animap ( false, '', '', $id );
2531
+		$json_data = array();
2532
+		$count_all = $this->accounts_model->get_animap(false, '', '', $id);
2533 2533
 		$data ['callingcard_id'] = $id;
2534
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
2534
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
2535 2535
 		$json_data = $paging_data ["json_paging"];
2536
-		$query = $this->accounts_model->get_animap ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $id );
2537
-		$grid_fields = json_decode ( $this->accounts_form->build_animap_list () );
2538
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
2539
-		echo json_encode ( $json_data );
2536
+		$query = $this->accounts_model->get_animap(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"], $id);
2537
+		$grid_fields = json_decode($this->accounts_form->build_animap_list());
2538
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
2539
+		echo json_encode($json_data);
2540 2540
 		exit ();
2541 2541
 	}
2542 2542
 	function customer_animap_list_action($id = '') {
2543
-		$add_array = $this->input->post ();
2544
-		$add_array ['id'] = trim ( $add_array ['id'] );
2545
-		$add_array ['number'] = trim ( $add_array ['number'] );
2546
-		if (isset ( $add_array ['id'] ) && $add_array ['id'] != '') {
2547
-			$add_array ['id'] = trim ( $add_array ['id'] );
2543
+		$add_array = $this->input->post();
2544
+		$add_array ['id'] = trim($add_array ['id']);
2545
+		$add_array ['number'] = trim($add_array ['number']);
2546
+		if (isset ($add_array ['id']) && $add_array ['id'] != '') {
2547
+			$add_array ['id'] = trim($add_array ['id']);
2548 2548
 			$id = $add_array ['id'];
2549 2549
 		}
2550
-		$where = array (
2550
+		$where = array(
2551 2551
 				"number" => $add_array ['number'] 
2552 2552
 		);
2553
-		$pro = $this->accounts_model->animap_authentication ( $where, $id );
2553
+		$pro = $this->accounts_model->animap_authentication($where, $id);
2554 2554
 		if ($pro > 0) {
2555 2555
 			echo "2";
2556 2556
 			exit ();
2557 2557
 		}
2558
-		if (isset ( $add_array ['number'] ) && ! empty ( $add_array ['number'] )) {
2559
-			if (isset ( $add_array ['id'] ) && $add_array ['id'] != '') {
2560
-				unset ( $add_array ['animap_id'] );
2561
-				$response = $this->accounts_model->edit_animap ( $add_array, $add_array ['id'] );
2558
+		if (isset ($add_array ['number']) && ! empty ($add_array ['number'])) {
2559
+			if (isset ($add_array ['id']) && $add_array ['id'] != '') {
2560
+				unset ($add_array ['animap_id']);
2561
+				$response = $this->accounts_model->edit_animap($add_array, $add_array ['id']);
2562 2562
 				echo "1";
2563 2563
 				exit ();
2564 2564
 			} else {
2565 2565
 				$add_array ['context'] = "default";
2566
-				unset ( $add_array ['animap_id'] );
2566
+				unset ($add_array ['animap_id']);
2567 2567
 				$add_array ['accountid'] = $id;
2568
-				$response = $this->accounts_model->add_animap ( $add_array );
2568
+				$response = $this->accounts_model->add_animap($add_array);
2569 2569
 				echo "0";
2570 2570
 				exit ();
2571 2571
 			}
@@ -2575,88 +2575,88 @@  discard block
 block discarded – undo
2575 2575
 		}
2576 2576
 	}
2577 2577
 	function customer_animap_list_remove($id) {
2578
-		$this->accounts_model->remove_ani_map ( $id );
2578
+		$this->accounts_model->remove_ani_map($id);
2579 2579
 		echo "1";
2580 2580
 		exit ();
2581 2581
 	}
2582 2582
 	function customer_animap_list_edit($id) {
2583
-		$where = array (
2583
+		$where = array(
2584 2584
 				'id' => $id 
2585 2585
 		);
2586
-		$account = $this->db_model->getSelect ( "*", "ani_map", $where );
2587
-		foreach ( $account->result_array () as $key => $value ) {
2586
+		$account = $this->db_model->getSelect("*", "ani_map", $where);
2587
+		foreach ($account->result_array() as $key => $value) {
2588 2588
 			$edit_data = $value;
2589 2589
 		}
2590 2590
 		$value_edit = '';
2591
-		foreach ( $edit_data as $key => $value ) {
2592
-			$value_edit .= $value . ",";
2591
+		foreach ($edit_data as $key => $value) {
2592
+			$value_edit .= $value.",";
2593 2593
 		}
2594
-		echo rtrim ( $value_edit, ',' );
2594
+		echo rtrim($value_edit, ',');
2595 2595
 		exit ();
2596 2596
 	}
2597 2597
 	function provider_edit_account() {
2598
-		$this->customer_edit_account ();
2598
+		$this->customer_edit_account();
2599 2599
 	}
2600 2600
 	function customer_show_password($id) {
2601
-		$account = $this->db_model->getSelect ( "password", "accounts", array (
2601
+		$account = $this->db_model->getSelect("password", "accounts", array(
2602 2602
 				'id' => $id 
2603
-		) );
2604
-		$account_data = $account->result_array ();
2605
-		$password = $this->common->decode ( $account_data [0] ['password'] );
2603
+		));
2604
+		$account_data = $account->result_array();
2605
+		$password = $this->common->decode($account_data [0] ['password']);
2606 2606
 		echo $password;
2607 2607
 	}
2608 2608
 	function reseller_export_cdr_xls() {
2609
-		$account_info = $accountinfo = $this->session->userdata ( 'accountinfo' );
2609
+		$account_info = $accountinfo = $this->session->userdata('accountinfo');
2610 2610
 		$currency_id = $account_info ['currency_id'];
2611
-		$currency = $this->common->get_field_name ( 'currency', 'currency', $currency_id );
2612
-		ob_clean ();
2613
-		$query = $this->accounts_model->get_reseller_Account_list ( true, '', '', true );
2614
-		$customer_array [] = array (
2615
-				gettext ( "Account" ),
2616
-				gettext ( "First Name" ),
2617
-				gettext ( "Last Name" ),
2618
-				gettext ( "Company" ),
2619
-				gettext ( "Rate Group" ),
2620
-				gettext ( "Account Type" ),
2621
-				gettext ( "Balance" ) . "(" . $currency . ")",
2622
-				gettext ( "Credit Limit" ) . "(" . $currency . ")",
2623
-				gettext ( "Status" ),
2624
-				gettext ( "Created Date" ) 
2611
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
2612
+		ob_clean();
2613
+		$query = $this->accounts_model->get_reseller_Account_list(true, '', '', true);
2614
+		$customer_array [] = array(
2615
+				gettext("Account"),
2616
+				gettext("First Name"),
2617
+				gettext("Last Name"),
2618
+				gettext("Company"),
2619
+				gettext("Rate Group"),
2620
+				gettext("Account Type"),
2621
+				gettext("Balance")."(".$currency.")",
2622
+				gettext("Credit Limit")."(".$currency.")",
2623
+				gettext("Status"),
2624
+				gettext("Created Date") 
2625 2625
 		);
2626
-		if ($query->num_rows () > 0) {
2626
+		if ($query->num_rows() > 0) {
2627 2627
 			
2628
-			foreach ( $query->result_array () as $row ) {
2629
-				$customer_array [] = array (
2628
+			foreach ($query->result_array() as $row) {
2629
+				$customer_array [] = array(
2630 2630
 						$row ['number'],
2631 2631
 						$row ['first_name'],
2632 2632
 						$row ['last_name'],
2633 2633
 						$row ['company_name'],
2634
-						$this->common->get_field_name ( 'name', 'pricelists', $row ['pricelist_id'] ),
2635
-						$this->common->get_account_type ( '', '', $row ['posttoexternal'] ),
2636
-						$this->common_model->calculate_currency ( $row ['balance'], false, false ),
2637
-						$this->common_model->calculate_currency ( $row ['credit_limit'], false, false ),
2638
-						$this->common->get_status ( 'export', '', $row ['status'] ),
2634
+						$this->common->get_field_name('name', 'pricelists', $row ['pricelist_id']),
2635
+						$this->common->get_account_type('', '', $row ['posttoexternal']),
2636
+						$this->common_model->calculate_currency($row ['balance'], false, false),
2637
+						$this->common_model->calculate_currency($row ['credit_limit'], false, false),
2638
+						$this->common->get_status('export', '', $row ['status']),
2639 2639
 						$row ['creation'] 
2640 2640
 				);
2641 2641
 			}
2642 2642
 		}
2643 2643
 		
2644
-		$this->load->helper ( 'csv' );
2645
-		array_to_csv ( $customer_array, 'Resellers_' . date ( "Y-m-d" ) . '.csv' );
2644
+		$this->load->helper('csv');
2645
+		array_to_csv($customer_array, 'Resellers_'.date("Y-m-d").'.csv');
2646 2646
 	}
2647 2647
 	function customer_validate_ip() {
2648
-		$add_array = $this->input->post ();
2649
-		if (! empty ( $add_array )) {
2648
+		$add_array = $this->input->post();
2649
+		if ( ! empty ($add_array)) {
2650 2650
 			$ip = $add_array ['ip'];
2651
-			if (strpos ( $ip, '/' ) !== false) {
2651
+			if (strpos($ip, '/') !== false) {
2652 2652
 				$add_array ['ip'] = $add_array ['ip'];
2653 2653
 			} else {
2654
-				$add_array ['ip'] = $add_array ['ip'] . '/32';
2654
+				$add_array ['ip'] = $add_array ['ip'].'/32';
2655 2655
 			}
2656
-			$this->db->where ( 'ip', $add_array ['ip'] );
2657
-			$this->db->where ( 'prefix', $add_array ['prefix'] );
2658
-			$this->db->select ( 'count(ip) as count' );
2659
-			$ip_map_result = ( array ) $this->db->get ( 'ip_map' )->first_row ();
2656
+			$this->db->where('ip', $add_array ['ip']);
2657
+			$this->db->where('prefix', $add_array ['prefix']);
2658
+			$this->db->select('count(ip) as count');
2659
+			$ip_map_result = (array)$this->db->get('ip_map')->first_row();
2660 2660
 			if ($ip_map_result ['count'] > 0) {
2661 2661
 				echo 'FALSE';
2662 2662
 			} else {
@@ -2667,79 +2667,79 @@  discard block
 block discarded – undo
2667 2667
 		}
2668 2668
 	}
2669 2669
 	function reseller_invoice_config($id = '') {
2670
-		$data ['page_title'] = gettext ( 'Company Profile' );
2671
-		$accountinfo = $this->session->userdata ( "accountinfo" );
2672
-		$add_array = $this->input->post ();
2670
+		$data ['page_title'] = gettext('Company Profile');
2671
+		$accountinfo = $this->session->userdata("accountinfo");
2672
+		$add_array = $this->input->post();
2673 2673
 		$data ["account_data"] = $add_array;
2674
-		if (isset ( $add_array ['submit'] )) {
2674
+		if (isset ($add_array ['submit'])) {
2675 2675
 			if ($_FILES ['file'] ['name'] == '') {
2676
-				$this->load->module ( 'invoices/invoices' );
2677
-				$this->load->model ( "invoices_model" );
2678
-				$invoiceconf = $this->invoices_model->get_invoiceconf ();
2676
+				$this->load->module('invoices/invoices');
2677
+				$this->load->model("invoices_model");
2678
+				$invoiceconf = $this->invoices_model->get_invoiceconf();
2679 2679
 				$file_name = ($invoiceconf ['logo'] != '') ? $invoiceconf ['logo'] : '';
2680 2680
 			}
2681
-			if (isset ( $_FILES ['file'] ['name'] ) && $_FILES ['file'] ['name'] != '') {
2681
+			if (isset ($_FILES ['file'] ['name']) && $_FILES ['file'] ['name'] != '') {
2682 2682
 				$files = $_FILES ['file'];
2683 2683
 				if ($files ['size'] < 0) {
2684
-					$this->session->set_flashdata ( 'astpp_notification', 'PLease upload maximum file' );
2685
-					redirect ( base_url () . "accounts/reseller_invoice_config/" . $add_array ['accountid'] . "/" );
2684
+					$this->session->set_flashdata('astpp_notification', 'PLease upload maximum file');
2685
+					redirect(base_url()."accounts/reseller_invoice_config/".$add_array ['accountid']."/");
2686 2686
 				}
2687 2687
 				$file = $_FILES ['file'];
2688 2688
 				$uploadedFile = $file ["tmp_name"];
2689 2689
 				$file_name = $file ['name'];
2690 2690
 				$file_type = $file ['type'];
2691 2691
 				if ($file_type == 'image/jpg' || $file_type == 'image/png' || $file_type == 'image/jpeg') {
2692
-					$dir_path = FCPATH . "upload/";
2693
-					$path = $dir_path . $add_array ['accountid'] . "_" . $file ['name'];
2694
-					if (move_uploaded_file ( $uploadedFile, $path )) {
2695
-						$this->session->set_flashdata ( 'astpp_errormsg', gettext ( 'files added successfully!' ) );
2692
+					$dir_path = FCPATH."upload/";
2693
+					$path = $dir_path.$add_array ['accountid']."_".$file ['name'];
2694
+					if (move_uploaded_file($uploadedFile, $path)) {
2695
+						$this->session->set_flashdata('astpp_errormsg', gettext('files added successfully!'));
2696 2696
 					} else {
2697
-						$this->session->set_flashdata ( 'astpp_notification', "File Uploading Fail Please Try Again" );
2698
-						redirect ( base_url () . "accounts/reseller_invoice_config/" . $add_array ['accountid'] . "/" );
2697
+						$this->session->set_flashdata('astpp_notification', "File Uploading Fail Please Try Again");
2698
+						redirect(base_url()."accounts/reseller_invoice_config/".$add_array ['accountid']."/");
2699 2699
 					}
2700 2700
 				} else {
2701
-					$this->session->set_flashdata ( 'astpp_notification', 'Please upload only image!' );
2702
-					redirect ( base_url () . "accounts/reseller_invoice_config/" . $add_array ['accountid'] . "/" );
2701
+					$this->session->set_flashdata('astpp_notification', 'Please upload only image!');
2702
+					redirect(base_url()."accounts/reseller_invoice_config/".$add_array ['accountid']."/");
2703 2703
 				}
2704 2704
 			}
2705 2705
 			$add_array ['logo'] = $file_name;
2706
-			unset ( $add_array ['submit'] );
2706
+			unset ($add_array ['submit']);
2707 2707
 			if ($add_array ['id'] == '') {
2708
-				$this->accounts_model->add_invoice_config ( $add_array );
2708
+				$this->accounts_model->add_invoice_config($add_array);
2709 2709
 			} else {
2710
-				$this->accounts_model->edit_invoice_config ( $add_array, $add_array ['id'] );
2710
+				$this->accounts_model->edit_invoice_config($add_array, $add_array ['id']);
2711 2711
 			}
2712
-			$this->session->set_flashdata ( 'astpp_errormsg', 'Invoice config updated successfully!' );
2713
-			redirect ( base_url () . "accounts/reseller_invoice_config/" . $add_array ['accountid'] . "/" );
2712
+			$this->session->set_flashdata('astpp_errormsg', 'Invoice config updated successfully!');
2713
+			redirect(base_url()."accounts/reseller_invoice_config/".$add_array ['accountid']."/");
2714 2714
 		} else {
2715
-			$data ["account_data"] = ( array ) $this->db->get_where ( 'invoice_conf', array (
2715
+			$data ["account_data"] = (array)$this->db->get_where('invoice_conf', array(
2716 2716
 					"accountid" => $id 
2717
-			) )->first_row ();
2717
+			))->first_row();
2718 2718
 			$data ["accounttype"] = 'Reseller';
2719 2719
 			$data ["edit_id"] = $id;
2720
-			if (isset ( $data ["account_data"] ['logo'] )) {
2721
-				$data ["account_data"] ['file'] = $id . "_" . $data ["account_data"] ['logo'];
2720
+			if (isset ($data ["account_data"] ['logo'])) {
2721
+				$data ["account_data"] ['file'] = $id."_".$data ["account_data"] ['logo'];
2722 2722
 			}
2723
-			$this->load->view ( 'view_reseller_invoices_config', $data );
2723
+			$this->load->view('view_reseller_invoices_config', $data);
2724 2724
 		}
2725 2725
 	}
2726 2726
 	function reseller_invoice_logo_delete($accountid) {
2727
-		$invoiceconf = $this->db_model->getSelect ( "*", "invoice_conf", array (
2727
+		$invoiceconf = $this->db_model->getSelect("*", "invoice_conf", array(
2728 2728
 				"accountid" => $accountid 
2729
-		) );
2730
-		$result = $invoiceconf->result_array ();
2729
+		));
2730
+		$result = $invoiceconf->result_array();
2731 2731
 		$logo = $result [0] ['logo'];
2732
-		$post_arr = array (
2732
+		$post_arr = array(
2733 2733
 				'logo' => '' 
2734 2734
 		);
2735
-		$where_arr = array (
2735
+		$where_arr = array(
2736 2736
 				'logo' => $logo 
2737 2737
 		);
2738
-		$this->db->where ( $where_arr );
2739
-		$this->db->update ( 'invoice_conf', $post_arr );
2738
+		$this->db->where($where_arr);
2739
+		$this->db->update('invoice_conf', $post_arr);
2740 2740
 	}
2741 2741
 	function customer_global_grid_list() {
2742
-		echo gettext ( $_POST ['display'] );
2742
+		echo gettext($_POST ['display']);
2743 2743
 	}
2744 2744
 }
2745 2745
 ?>
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
 		$this->protected_pages = array (
38 38
 				'account_list' 
39 39
 		);
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
 	function customer_list() {
44 45
 		$data ['username'] = $this->session->userdata ( 'user_name' );
@@ -450,13 +451,15 @@  discard block
 block discarded – undo
450 451
 		);
451 452
 		$instant_search = $this->session->userdata ( 'left_panel_search_' . $accounttype . '_ipmap' );
452 453
 		$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;
453
-		if (! empty ( $like_str ))
454
-			$this->db->where ( $like_str );
454
+		if (! empty ( $like_str )) {
455
+					$this->db->where ( $like_str );
456
+		}
455 457
 		$count_all = $this->db_model->countQuery ( "*", "ip_map", $where );
456 458
 		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
457 459
 		$json_data = $paging_data ["json_paging"];
458
-		if (! empty ( $like_str ))
459
-			$this->db->where ( $like_str );
460
+		if (! empty ( $like_str )) {
461
+					$this->db->where ( $like_str );
462
+		}
460 463
 		$query = $this->db_model->select ( "*", "ip_map", $where, "id", "ASC", $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"] );
461 464
 		$grid_fields = json_decode ( $this->accounts_form->build_ip_list_for_customer ( $accountid, $accounttype ) );
462 465
 		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
@@ -550,8 +553,9 @@  discard block
 block discarded – undo
550 553
 		$json_data = array ();
551 554
 		$instant_search = $this->session->userdata ( 'left_panel_search_' . $accounttype . '_animap' );
552 555
 		$like_str = ! empty ( $instant_search ) ? "(number like '%$instant_search%'  OR  creation_date like '%$instant_search%' )" : null;
553
-		if (! empty ( $like_str ))
554
-			$this->db->where ( $like_str );
556
+		if (! empty ( $like_str )) {
557
+					$this->db->where ( $like_str );
558
+		}
555 559
 		$where = array (
556 560
 				"accountid" => $accountid 
557 561
 		);
@@ -559,8 +563,9 @@  discard block
 block discarded – undo
559 563
 		
560 564
 		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
561 565
 		$json_data = $paging_data ["json_paging"];
562
-		if (! empty ( $like_str ))
563
-			$this->db->where ( $like_str );
566
+		if (! empty ( $like_str )) {
567
+					$this->db->where ( $like_str );
568
+		}
564 569
 		$query = $this->db_model->select ( "*", "ani_map", $where, "id", "ASC", $paging_data ["paging"] ["page_no"], $paging_data ["paging"] ["start"] );
565 570
 		
566 571
 		$grid_fields = json_decode ( $this->accounts_form->build_animap_list_for_customer ( $accountid, $accounttype ) );
@@ -2032,8 +2037,9 @@  discard block
 block discarded – undo
2032 2037
 		$json_data ['total'] = $config ['total_rows'];
2033 2038
 		$perpage = $config ['per_page'];
2034 2039
 		$start = ($page_no - 1) * $perpage;
2035
-		if ($start < 0)
2036
-			$start = 0;
2040
+		if ($start < 0) {
2041
+					$start = 0;
2042
+		}
2037 2043
 		
2038 2044
 		$account_charge_list = $this->db_model->getAllJionQuery ( $table, $select, $where, $jionTable, $jionCondition, $type, $perpage, $start, $order_by, $order_type, "" );
2039 2045
 		if ($account_charge_list->num_rows > 0) {
@@ -2380,8 +2386,9 @@  discard block
 block discarded – undo
2380 2386
 		$data ['username'] = $this->session->userdata ( 'user_name' );
2381 2387
 		$data ['page_title'] = gettext ( 'Account Taxes' );
2382 2388
 		
2383
-		if ($action == false)
2384
-			$action = "list";
2389
+		if ($action == false) {
2390
+					$action = "list";
2391
+		}
2385 2392
 		
2386 2393
 		if ($action == 'list') {
2387 2394
 			$this->load->view ( 'view_account_taxes_list', $data );
Please login to merge, or discard this patch.
astpp/application/modules/accounts/libraries/accounts_form.php 2 patches
Spacing   +884 added lines, -884 removed lines patch added patch discarded remove patch
@@ -20,34 +20,34 @@  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' ))
24
-	exit ( 'No direct script access allowed' );
23
+if ( ! defined('BASEPATH'))
24
+	exit ('No direct script access allowed');
25 25
 class Accounts_form {
26 26
 	function __construct($library_name = '') {
27
-		$this->CI = & get_instance ();
27
+		$this->CI = & get_instance();
28 28
 	}
29 29
 	function get_customer_form_fields($entity_type = false, $id = false) {
30
-		$expiry_date = gmdate ( 'Y-m-d H:i:s', strtotime ( '+10 years' ) );
30
+		$expiry_date = gmdate('Y-m-d H:i:s', strtotime('+10 years'));
31 31
 		$readable = FALSE;
32 32
 		$type = $entity_type == 'customer' ? 0 : 3;
33
-		$uname = $this->CI->common->find_uniq_rendno_customer ( common_model::$global_config ['system_config'] ['cardlength'], 'number', 'accounts' );
33
+		$uname = $this->CI->common->find_uniq_rendno_customer(common_model::$global_config ['system_config'] ['cardlength'], 'number', 'accounts');
34 34
 		$pin = Common_model::$global_config ['system_config'] ['pinlength'];
35
-		$pin_number = $this->CI->common->find_uniq_rendno ( $pin, 'pin', 'accounts' );
36
-		$uname_user = $this->CI->common->find_uniq_rendno ( '10', 'number', 'accounts' );
37
-		$password = $this->CI->common->generate_password ();
38
-		$logintype = $this->CI->session->userdata ( 'logintype' );
35
+		$pin_number = $this->CI->common->find_uniq_rendno($pin, 'pin', 'accounts');
36
+		$uname_user = $this->CI->common->find_uniq_rendno('10', 'number', 'accounts');
37
+		$password = $this->CI->common->generate_password();
38
+		$logintype = $this->CI->session->userdata('logintype');
39 39
 		if ($logintype == 1 || $logintype == 5) {
40
-			$account_data = $this->CI->session->userdata ( "accountinfo" );
40
+			$account_data = $this->CI->session->userdata("accountinfo");
41 41
 			$loginid = $account_data ['id'];
42 42
 		} else {
43 43
 			$loginid = "0";
44 44
 		}
45 45
 		$sip_device = null;
46 46
 		$opensips_device = null;
47
-		if (! $entity_type) {
47
+		if ( ! $entity_type) {
48 48
 			$entity_type = 'customer';
49 49
 		}
50
-		$params = array (
50
+		$params = array(
51 51
 				'name' => 'number',
52 52
 				'value' => $uname,
53 53
 				'size' => '20',
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 		
59 59
 		if ($id > 0) {
60 60
 			$readable = 'disabled';
61
-			$val = 'accounts.email.' . $id;
62
-			$account_val = 'accounts.number.' . $id;
63
-			$password = array (
61
+			$val = 'accounts.email.'.$id;
62
+			$account_val = 'accounts.number.'.$id;
63
+			$password = array(
64 64
 					'Password',
65 65
 					'PASSWORD',
66
-					array (
66
+					array(
67 67
 							'name' => 'password',
68 68
 							'id' => 'password_show',
69 69
 							'onmouseover' => 'seetext(password_show)',
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 					'tOOL TIP',
76 76
 					'' 
77 77
 			);
78
-			$balance = array (
78
+			$balance = array(
79 79
 					'Balance',
80 80
 					'INPUT',
81
-					array (
81
+					array(
82 82
 							'name' => 'balance',
83 83
 							'size' => '20',
84 84
 							'readonly' => true,
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 					'tOOL TIP',
89 89
 					'' 
90 90
 			);
91
-			$account = array (
91
+			$account = array(
92 92
 					'Account',
93 93
 					'INPUT',
94 94
 					$params,
95
-					'required|integer|greater_than[0]|is_unique[' . $account_val . ']',
95
+					'required|integer|greater_than[0]|is_unique['.$account_val.']',
96 96
 					'tOOL TIP',
97 97
 					'' 
98 98
 			);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 			$val = 'accounts.email';
102 102
 			$account_val = 'accounts.number';
103 103
 			if (common_model::$global_config ['system_config'] ['opensips'] == 0) {
104
-				$sip_device = array (
104
+				$sip_device = array(
105 105
 						'Create Opensips Device',
106 106
 						'opensips_device_flag',
107 107
 						'SELECT',
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 						'set_prorate' 
116 116
 				);
117 117
 			} else {
118
-				$sip_device = array (
118
+				$sip_device = array(
119 119
 						'Create SIP Device',
120 120
 						'sip_device_flag',
121 121
 						'SELECT',
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
 						'set_prorate' 
130 130
 				);
131 131
 			}
132
-			$account = array (
132
+			$account = array(
133 133
 					'Account',
134 134
 					'INPUT',
135 135
 					$params,
136
-					'required|integer|greater_than[0]|is_unique[' . $account_val . ']',
136
+					'required|integer|greater_than[0]|is_unique['.$account_val.']',
137 137
 					'tOOL TIP',
138 138
 					'',
139 139
 					'<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>' 
140 140
 			);
141
-			$password = array (
141
+			$password = array(
142 142
 					'Password',
143 143
 					'INPUT',
144
-					array (
144
+					array(
145 145
 							'name' => 'password',
146 146
 							'value' => $password,
147 147
 							'size' => '20',
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 					'',
154 154
 					'<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>' 
155 155
 			);
156
-			$balance = array (
156
+			$balance = array(
157 157
 					'Balance',
158 158
 					'INPUT',
159
-					array (
159
+					array(
160 160
 							'name' => 'balance',
161 161
 							'size' => '20',
162 162
 							'class' => "text field medium" 
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 					'' 
167 167
 			);
168 168
 		}
169
-		$pin = array (
169
+		$pin = array(
170 170
 				'Pin',
171 171
 				'INPUT',
172
-				array (
172
+				array(
173 173
 						'name' => 'pin',
174 174
 						'value' => $pin_number,
175 175
 						'size' => '20',
@@ -181,18 +181,18 @@  discard block
 block discarded – undo
181 181
 				'',
182 182
 				'<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>' 
183 183
 		);
184
-		$form ['forms'] = array (
185
-				base_url () . 'accounts/' . $entity_type . '_save/' . $id . "/",
186
-				array (
184
+		$form ['forms'] = array(
185
+				base_url().'accounts/'.$entity_type.'_save/'.$id."/",
186
+				array(
187 187
 						"id" => "customer_form",
188 188
 						"name" => "customer_form" 
189 189
 				) 
190 190
 		);
191
-		$form [gettext ( 'Account Profile' )] = array (
192
-				array (
191
+		$form [gettext('Account Profile')] = array(
192
+				array(
193 193
 						'',
194 194
 						'HIDDEN',
195
-						array (
195
+						array(
196 196
 								'name' => 'id' 
197 197
 						),
198 198
 						'',
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
 						'',
201 201
 						'' 
202 202
 				),
203
-				array (
203
+				array(
204 204
 						'',
205 205
 						'HIDDEN',
206
-						array (
206
+						array(
207 207
 								'name' => 'type',
208 208
 								'value' => $type 
209 209
 						),
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 				$account,
215 215
 				$password,
216 216
 				$pin,
217
-				array (
218
-						gettext ( 'First Name' ),
217
+				array(
218
+						gettext('First Name'),
219 219
 						'INPUT',
220
-						array (
220
+						array(
221 221
 								'name' => 'first_name',
222 222
 								'id' => 'first_name',
223 223
 								'size' => '15',
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
 						'tOOL TIP',
228 228
 						'' 
229 229
 				),
230
-				array (
231
-						gettext ( 'Last Name' ),
230
+				array(
231
+						gettext('Last Name'),
232 232
 						'INPUT',
233
-						array (
233
+						array(
234 234
 								'name' => 'last_name',
235 235
 								'size' => '15',
236 236
 								'class' => "text field medium" 
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 						'tOOL TIP',
240 240
 						'' 
241 241
 				),
242
-				array (
243
-						gettext ( 'Company' ),
242
+				array(
243
+						gettext('Company'),
244 244
 						'INPUT',
245
-						array (
245
+						array(
246 246
 								'name' => 'company_name',
247 247
 								'size' => '15',
248 248
 								'class' => 'text field medium' 
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
 						'tOOL TIP',
252 252
 						'' 
253 253
 				),
254
-				array (
255
-						gettext ( 'Phone' ),
254
+				array(
255
+						gettext('Phone'),
256 256
 						'INPUT',
257
-						array (
257
+						array(
258 258
 								'name' => 'telephone_1',
259 259
 								'size' => '15',
260 260
 								'class' => "text field medium" 
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 						'tOOL TIP',
264 264
 						'' 
265 265
 				),
266
-				array (
267
-						gettext ( 'Mobile' ),
266
+				array(
267
+						gettext('Mobile'),
268 268
 						'INPUT',
269
-						array (
269
+						array(
270 270
 								'name' => 'telephone_2',
271 271
 								'size' => '15',
272 272
 								'class' => "text field medium" 
@@ -275,22 +275,22 @@  discard block
 block discarded – undo
275 275
 						'tOOL TIP',
276 276
 						'' 
277 277
 				),
278
-				array (
279
-						gettext ( 'Email' ),
278
+				array(
279
+						gettext('Email'),
280 280
 						'INPUT',
281
-						array (
281
+						array(
282 282
 								'name' => 'email',
283 283
 								'size' => '50',
284 284
 								'class' => "text field medium" 
285 285
 						),
286
-						'required|valid_email|is_unique[' . $val . ']',
286
+						'required|valid_email|is_unique['.$val.']',
287 287
 						'tOOL TIP',
288 288
 						'' 
289 289
 				),
290
-				array (
291
-						gettext ( 'Address 1' ),
290
+				array(
291
+						gettext('Address 1'),
292 292
 						'INPUT',
293
-						array (
293
+						array(
294 294
 								'name' => 'address_1',
295 295
 								'size' => '15',
296 296
 								'class' => "text field medium" 
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 						'tOOL TIP',
300 300
 						'' 
301 301
 				),
302
-				array (
303
-						gettext ( 'Address 2' ),
302
+				array(
303
+						gettext('Address 2'),
304 304
 						'INPUT',
305
-						array (
305
+						array(
306 306
 								'name' => 'address_2',
307 307
 								'size' => '15',
308 308
 								'class' => "text field medium" 
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 						'tOOL TIP',
312 312
 						'' 
313 313
 				),
314
-				array (
315
-						gettext ( 'City' ),
314
+				array(
315
+						gettext('City'),
316 316
 						'INPUT',
317
-						array (
317
+						array(
318 318
 								'name' => 'city',
319 319
 								'size' => '20',
320 320
 								'class' => "text field medium" 
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
 						'tOOL TIP',
324 324
 						'' 
325 325
 				),
326
-				array (
327
-						gettext ( 'Province/State' ),
326
+				array(
327
+						gettext('Province/State'),
328 328
 						'INPUT',
329
-						array (
329
+						array(
330 330
 								'name' => 'province',
331 331
 								'size' => '15',
332 332
 								'class' => "text field medium" 
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 						'tOOL TIP',
336 336
 						'' 
337 337
 				),
338
-				array (
339
-						gettext ( 'Zip/Postal Code' ),
338
+				array(
339
+						gettext('Zip/Postal Code'),
340 340
 						'INPUT',
341
-						array (
341
+						array(
342 342
 								'name' => 'postal_code',
343 343
 								'size' => '15',
344 344
 								'class' => "text field medium" 
@@ -347,15 +347,15 @@  discard block
 block discarded – undo
347 347
 						'tOOL TIP',
348 348
 						'' 
349 349
 				),
350
-				array (
351
-						gettext ( 'Country' ),
352
-						array (
350
+				array(
351
+						gettext('Country'),
352
+						array(
353 353
 								'name' => 'country_id',
354 354
 								'class' => 'country_id' 
355 355
 						),
356 356
 						'SELECT',
357 357
 						'',
358
-						array (
358
+						array(
359 359
 								"name" => "country_id",
360 360
 								"rules" => "required" 
361 361
 						),
@@ -368,15 +368,15 @@  discard block
 block discarded – undo
368 368
 						'',
369 369
 						'' 
370 370
 				),
371
-				array (
372
-						gettext ( 'Timezone' ),
373
-						array (
371
+				array(
372
+						gettext('Timezone'),
373
+						array(
374 374
 								'name' => 'timezone_id',
375 375
 								'class' => 'timezone_id' 
376 376
 						),
377 377
 						'SELECT',
378 378
 						'',
379
-						array (
379
+						array(
380 380
 								"name" => "timezone_id",
381 381
 								"rules" => "required" 
382 382
 						),
@@ -389,15 +389,15 @@  discard block
 block discarded – undo
389 389
 						'',
390 390
 						'' 
391 391
 				),
392
-				array (
393
-						gettext ( 'Currency' ),
394
-						array (
392
+				array(
393
+						gettext('Currency'),
394
+						array(
395 395
 								'name' => 'currency_id',
396 396
 								'class' => 'currency_id' 
397 397
 						),
398 398
 						'SELECT',
399 399
 						'',
400
-						array (
400
+						array(
401 401
 								"name" => "currency_id",
402 402
 								"rules" => "required" 
403 403
 						),
@@ -408,13 +408,13 @@  discard block
 block discarded – undo
408 408
 						'currency',
409 409
 						'build_concat_dropdown',
410 410
 						'',
411
-						array () 
411
+						array() 
412 412
 				) 
413 413
 		);
414 414
 		
415
-		$form [gettext ( 'Account Settings' )] = array (
416
-				array (
417
-						gettext ( 'Status' ),
415
+		$form [gettext('Account Settings')] = array(
416
+				array(
417
+						gettext('Status'),
418 418
 						'status',
419 419
 						'SELECT',
420 420
 						'',
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 						'',
427 427
 						'set_status' 
428 428
 				),
429
-				array (
430
-						gettext ( 'Allow Recording' ),
429
+				array(
430
+						gettext('Allow Recording'),
431 431
 						'is_recording',
432 432
 						'SELECT',
433 433
 						'',
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
 						'',
440 440
 						'custom_status_recording' 
441 441
 				),
442
-				array (
443
-						gettext ( 'Allow IP Management' ),
442
+				array(
443
+						gettext('Allow IP Management'),
444 444
 						'allow_ip_management',
445 445
 						'SELECT',
446 446
 						'',
@@ -453,10 +453,10 @@  discard block
 block discarded – undo
453 453
 						'custom_status' 
454 454
 				),
455 455
 				$sip_device,
456
-				array (
457
-						gettext ( 'Number Translation' ),
456
+				array(
457
+						gettext('Number Translation'),
458 458
 						'INPUT',
459
-						array (
459
+						array(
460 460
 								'name' => 'dialed_modify',
461 461
 								'size' => '20',
462 462
 								'class' => "text field medium" 
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
 				),
468 468
 				
469 469
 				// Added caller id translation code.
470
-				array (
471
-						gettext ( 'OUT Callerid Translation' ),
470
+				array(
471
+						gettext('OUT Callerid Translation'),
472 472
 						'INPUT',
473
-						array (
473
+						array(
474 474
 								'name' => 'std_cid_translation',
475 475
 								'size' => '20',
476 476
 								'class' => "text field medium" 
@@ -479,10 +479,10 @@  discard block
 block discarded – undo
479 479
 						'tOOL TIP',
480 480
 						'' 
481 481
 				),
482
-				array (
483
-						gettext ( 'IN Callerid Translation' ),
482
+				array(
483
+						gettext('IN Callerid Translation'),
484 484
 						'INPUT',
485
-						array (
485
+						array(
486 486
 								'name' => 'did_cid_translation',
487 487
 								'size' => '20',
488 488
 								'class' => "text field medium" 
@@ -492,10 +492,10 @@  discard block
 block discarded – undo
492 492
 						'' 
493 493
 				),
494 494
 				
495
-				array (
496
-						gettext ( 'Concurrent Calls' ),
495
+				array(
496
+						gettext('Concurrent Calls'),
497 497
 						'INPUT',
498
-						array (
498
+						array(
499 499
 								'name' => 'maxchannels',
500 500
 								'size' => '20',
501 501
 								'class' => "text field medium" 
@@ -504,10 +504,10 @@  discard block
 block discarded – undo
504 504
 						'tOOL TIP',
505 505
 						'' 
506 506
 				),
507
-				array (
508
-						gettext ( 'Interval' ),
507
+				array(
508
+						gettext('Interval'),
509 509
 						'INPUT',
510
-						array (
510
+						array(
511 511
 								'name' => 'interval',
512 512
 								'size' => '20',
513 513
 								'class' => "text field medium" 
@@ -516,10 +516,10 @@  discard block
 block discarded – undo
516 516
 						'tOOL TIP',
517 517
 						'' 
518 518
 				),
519
-				array (
520
-						gettext ( 'First Used' ),
519
+				array(
520
+						gettext('First Used'),
521 521
 						'INPUT',
522
-						array (
522
+						array(
523 523
 								'name' => 'first_used',
524 524
 								'size' => '20',
525 525
 								'readonly' => true,
@@ -530,10 +530,10 @@  discard block
 block discarded – undo
530 530
 						'tOOL TIP',
531 531
 						'' 
532 532
 				),
533
-				array (
534
-						gettext ( 'Account Valid Days' ),
533
+				array(
534
+						gettext('Account Valid Days'),
535 535
 						'INPUT',
536
-						array (
536
+						array(
537 537
 								'name' => 'validfordays',
538 538
 								'size' => '20',
539 539
 								'class' => "text field medium" 
@@ -542,10 +542,10 @@  discard block
 block discarded – undo
542 542
 						'tOOL TIP',
543 543
 						'' 
544 544
 				),
545
-				array (
546
-						gettext ( 'Expiry Date' ),
545
+				array(
546
+						gettext('Expiry Date'),
547 547
 						'INPUT',
548
-						array (
548
+						array(
549 549
 								'name' => 'expiry',
550 550
 								'size' => '20',
551 551
 								'class' => "text field medium",
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 				) 
559 559
 		);
560 560
 		
561
-		$form [gettext ( 'Billing Settings' )] = array (
562
-				array (
563
-						gettext ( 'Rate Group' ),
561
+		$form [gettext('Billing Settings')] = array(
562
+				array(
563
+						gettext('Rate Group'),
564 564
 						'pricelist_id',
565 565
 						'SELECT',
566 566
 						'',
567
-						array (
567
+						array(
568 568
 								"name" => "pricelist_id",
569 569
 								"rules" => "dropdown" 
570 570
 						),
@@ -575,14 +575,14 @@  discard block
 block discarded – undo
575 575
 						'pricelists',
576 576
 						'build_dropdown',
577 577
 						'where_arr',
578
-						array (
578
+						array(
579 579
 								"status" => "0",
580 580
 								"reseller_id" => $loginid 
581 581
 						) 
582 582
 				),
583
-				array (
584
-						gettext ( 'Account Type' ),
585
-						array (
583
+				array(
584
+						gettext('Account Type'),
585
+						array(
586 586
 								'name' => 'posttoexternal',
587 587
 								'disabled' => $readable,
588 588
 								'class' => 'posttoexternal',
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
 						'',
599 599
 						'set_account_type' 
600 600
 				),
601
-				array (
602
-						gettext ( 'Billing Schedule' ),
603
-						array (
601
+				array(
602
+						gettext('Billing Schedule'),
603
+						array(
604 604
 								'name' => 'sweep_id',
605 605
 								'class' => 'sweep_id',
606 606
 								'id' => 'sweep_id' 
@@ -617,9 +617,9 @@  discard block
 block discarded – undo
617 617
 						'',
618 618
 						'' 
619 619
 				),
620
-				array (
621
-						gettext ( 'Billing Day' ),
622
-						array (
620
+				array(
621
+						gettext('Billing Day'),
622
+						array(
623 623
 								"name" => 'invoice_day',
624 624
 								"class" => "invoice_day" 
625 625
 						),
@@ -634,10 +634,10 @@  discard block
 block discarded – undo
634 634
 						'set_invoice_option' 
635 635
 				),
636 636
 				$balance,
637
-				array (
638
-						gettext ( 'Credit Limit' ),
637
+				array(
638
+						gettext('Credit Limit'),
639 639
 						'INPUT',
640
-						array (
640
+						array(
641 641
 								'name' => 'credit_limit',
642 642
 								'size' => '20',
643 643
 								'class' => "text field medium" 
@@ -646,8 +646,8 @@  discard block
 block discarded – undo
646 646
 						'tOOL TIP',
647 647
 						'' 
648 648
 				),
649
-				array (
650
-						gettext ( 'Allow Local Calls' ),
649
+				array(
650
+						gettext('Allow Local Calls'),
651 651
 						'local_call',
652 652
 						'SELECT',
653 653
 						'',
@@ -659,10 +659,10 @@  discard block
 block discarded – undo
659 659
 						'',
660 660
 						'custom_status' 
661 661
 				),
662
-				array (
663
-						gettext ( 'LC Charge / Min' ),
662
+				array(
663
+						gettext('LC Charge / Min'),
664 664
 						'INPUT',
665
-						array (
665
+						array(
666 666
 								'name' => 'charge_per_min',
667 667
 								'size' => '20',
668 668
 								'class' => "text field medium" 
@@ -671,8 +671,8 @@  discard block
 block discarded – undo
671 671
 						'tOOL TIP',
672 672
 						'' 
673 673
 				),
674
-				array (
675
-						gettext ( 'Tax' ),
674
+				array(
675
+						gettext('Tax'),
676 676
 						'tax_id',
677 677
 						'SELECT',
678 678
 						'',
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 						'taxes',
685 685
 						'build_dropdown',
686 686
 						'where_arr',
687
-						array (
687
+						array(
688 688
 								'status' => 0,
689 689
 								"reseller_id" => $loginid 
690 690
 						),
@@ -692,11 +692,11 @@  discard block
 block discarded – undo
692 692
 				) 
693 693
 		);
694 694
 		if ($id == 0) {
695
-			$form [gettext ( 'Alert Threshold' )] = array (
696
-					array (
695
+			$form [gettext('Alert Threshold')] = array(
696
+					array(
697 697
 							'',
698 698
 							'HIDDEN',
699
-							array (
699
+							array(
700 700
 									'name' => 'id' 
701 701
 							),
702 702
 							'',
@@ -704,8 +704,8 @@  discard block
 block discarded – undo
704 704
 							'',
705 705
 							'' 
706 706
 					),
707
-					array (
708
-							gettext ( 'Email Alerts ?' ),
707
+					array(
708
+							gettext('Email Alerts ?'),
709 709
 							'notify_flag',
710 710
 							'SELECT',
711 711
 							'',
@@ -717,10 +717,10 @@  discard block
 block discarded – undo
717 717
 							'',
718 718
 							'custom_status' 
719 719
 					),
720
-					array (
721
-							gettext ( 'Balance Below' ),
720
+					array(
721
+							gettext('Balance Below'),
722 722
 							'INPUT',
723
-							array (
723
+							array(
724 724
 									'name' => 'notify_credit_limit',
725 725
 									'size' => '20',
726 726
 									'class' => "text field medium" 
@@ -729,10 +729,10 @@  discard block
 block discarded – undo
729 729
 							'tOOL TIP',
730 730
 							'' 
731 731
 					),
732
-					array (
733
-							gettext ( 'Email' ),
732
+					array(
733
+							gettext('Email'),
734 734
 							'INPUT',
735
-							array (
735
+							array(
736 736
 									'name' => 'notify_email',
737 737
 									'size' => '50',
738 738
 									'class' => "text field medium" 
@@ -743,39 +743,39 @@  discard block
 block discarded – undo
743 743
 					) 
744 744
 			);
745 745
 		}
746
-		$form ['button_save'] = array (
746
+		$form ['button_save'] = array(
747 747
 				'name' => 'action',
748
-				'content' => gettext ( 'Save' ),
748
+				'content' => gettext('Save'),
749 749
 				'value' => 'save',
750 750
 				'type' => 'submit',
751 751
 				'class' => 'btn btn-line-parrot' 
752 752
 		);
753
-		$form ['button_cancel'] = array (
753
+		$form ['button_cancel'] = array(
754 754
 				'name' => 'action',
755
-				'content' => gettext ( 'Cancel' ),
755
+				'content' => gettext('Cancel'),
756 756
 				'value' => 'cancel',
757 757
 				'type' => 'button',
758 758
 				'class' => 'btn btn-line-sky margin-x-10',
759 759
 				'onclick' => 'return redirect_page(\'/accounts/customer_list/\')' 
760 760
 		);
761 761
 		if ($id > 0) {
762
-			unset ( $form [gettext ( 'Account Settings' )] [3] );
762
+			unset ($form [gettext('Account Settings')] [3]);
763 763
 		}
764 764
 		return $form;
765 765
 	}
766 766
 	function customer_alert_threshold($entity_type) {
767
-		$form ['forms'] = array (
768
-				base_url () . 'accounts/' . $entity_type . '_alert_threshold_save/' . $entity_type . "/",
769
-				array (
767
+		$form ['forms'] = array(
768
+				base_url().'accounts/'.$entity_type.'_alert_threshold_save/'.$entity_type."/",
769
+				array(
770 770
 						"id" => "customer_alert_threshold",
771 771
 						"name" => "customer_alert_threshold" 
772 772
 				) 
773 773
 		);
774
-		$form [gettext ( 'Alert Threshold' )] = array (
775
-				array (
774
+		$form [gettext('Alert Threshold')] = array(
775
+				array(
776 776
 						'',
777 777
 						'HIDDEN',
778
-						array (
778
+						array(
779 779
 								'name' => 'id' 
780 780
 						),
781 781
 						'',
@@ -783,8 +783,8 @@  discard block
 block discarded – undo
783 783
 						'',
784 784
 						'' 
785 785
 				),
786
-				array (
787
-						gettext ( 'Email Alerts ?' ),
786
+				array(
787
+						gettext('Email Alerts ?'),
788 788
 						'notify_flag',
789 789
 						'SELECT',
790 790
 						'',
@@ -796,10 +796,10 @@  discard block
 block discarded – undo
796 796
 						'',
797 797
 						'custom_status' 
798 798
 				),
799
-				array (
800
-						gettext ( 'Balance Below' ),
799
+				array(
800
+						gettext('Balance Below'),
801 801
 						'INPUT',
802
-						array (
802
+						array(
803 803
 								'name' => 'notify_credit_limit',
804 804
 								'size' => '20',
805 805
 								'class' => "text field medium" 
@@ -808,10 +808,10 @@  discard block
 block discarded – undo
808 808
 						'tOOL TIP',
809 809
 						'' 
810 810
 				),
811
-				array (
812
-						gettext ( 'Email' ),
811
+				array(
812
+						gettext('Email'),
813 813
 						'INPUT',
814
-						array (
814
+						array(
815 815
 								'name' => 'notify_email',
816 816
 								'size' => '50',
817 817
 								'class' => "text field medium" 
@@ -821,9 +821,9 @@  discard block
 block discarded – undo
821 821
 						'' 
822 822
 				) 
823 823
 		);
824
-		$form ['button_save'] = array (
824
+		$form ['button_save'] = array(
825 825
 				'name' => 'action',
826
-				'content' => gettext ( 'Save' ),
826
+				'content' => gettext('Save'),
827 827
 				'value' => 'save',
828 828
 				'type' => 'submit',
829 829
 				'class' => 'btn btn-line-parrot' 
@@ -831,17 +831,17 @@  discard block
 block discarded – undo
831 831
 		return $form;
832 832
 	}
833 833
 	function customer_bulk_generate_form() {
834
-		$logintype = $this->CI->session->userdata ( 'logintype' );
834
+		$logintype = $this->CI->session->userdata('logintype');
835 835
 		$sip_device = null;
836 836
 		$opensips_device = null;
837 837
 		if ($logintype == 5) {
838
-			$account_data = $this->CI->session->userdata ( "accountinfo" );
838
+			$account_data = $this->CI->session->userdata("accountinfo");
839 839
 			$loginid = $account_data ['id'];
840 840
 		} else {
841 841
 			$loginid = "0";
842 842
 			if (common_model::$global_config ['system_config'] ['opensips'] == 0) {
843
-				$opensips_device = array (
844
-						gettext ( 'Create Opensips Device' ),
843
+				$opensips_device = array(
844
+						gettext('Create Opensips Device'),
845 845
 						'opensips_device_flag',
846 846
 						'SELECT',
847 847
 						'',
@@ -854,8 +854,8 @@  discard block
 block discarded – undo
854 854
 						'custom_status' 
855 855
 				);
856 856
 			} else {
857
-				$sip_device = array (
858
-						gettext ( 'Create SIP Device' ),
857
+				$sip_device = array(
858
+						gettext('Create SIP Device'),
859 859
 						'sip_device_flag',
860 860
 						'SELECT',
861 861
 						'',
@@ -869,18 +869,18 @@  discard block
 block discarded – undo
869 869
 				);
870 870
 			}
871 871
 		}
872
-		$form ['forms'] = array (
873
-				base_url () . 'accounts/customer_bulk_save/',
874
-				array (
872
+		$form ['forms'] = array(
873
+				base_url().'accounts/customer_bulk_save/',
874
+				array(
875 875
 						"id" => "customer_bulk_form",
876 876
 						"name" => "customer_bulk_form" 
877 877
 				) 
878 878
 		);
879
-		$form [gettext ( 'General Details' )] = array (
880
-				array (
881
-						gettext ( 'Account Count' ),
879
+		$form [gettext('General Details')] = array(
880
+				array(
881
+						gettext('Account Count'),
882 882
 						'INPUT',
883
-						array (
883
+						array(
884 884
 								'name' => 'count',
885 885
 								'size' => '20',
886 886
 								'class' => "text field medium" 
@@ -889,10 +889,10 @@  discard block
 block discarded – undo
889 889
 						'tOOL TIP',
890 890
 						'' 
891 891
 				),
892
-				array (
893
-						gettext ( 'Start Prefix' ),
892
+				array(
893
+						gettext('Start Prefix'),
894 894
 						'INPUT',
895
-						array (
895
+						array(
896 896
 								'name' => 'prefix',
897 897
 								'size' => '20',
898 898
 								'class' => "text field medium" 
@@ -901,10 +901,10 @@  discard block
 block discarded – undo
901 901
 						'tOOL TIP',
902 902
 						'' 
903 903
 				),
904
-				array (
905
-						gettext ( 'Acc. Number Length' ),
904
+				array(
905
+						gettext('Acc. Number Length'),
906 906
 						'INPUT',
907
-						array (
907
+						array(
908 908
 								'name' => 'account_length',
909 909
 								'size' => '20',
910 910
 								'class' => "text field medium" 
@@ -913,10 +913,10 @@  discard block
 block discarded – undo
913 913
 						'tOOL TIP',
914 914
 						'' 
915 915
 				),
916
-				array (
917
-						gettext ( 'Company' ),
916
+				array(
917
+						gettext('Company'),
918 918
 						'INPUT',
919
-						array (
919
+						array(
920 920
 								'name' => 'company_name',
921 921
 								'size' => '15',
922 922
 								'class' => 'text field medium' 
@@ -925,15 +925,15 @@  discard block
 block discarded – undo
925 925
 						'tOOL TIP',
926 926
 						'' 
927 927
 				),
928
-				array (
929
-						gettext ( 'Country' ),
930
-						array (
928
+				array(
929
+						gettext('Country'),
930
+						array(
931 931
 								'name' => 'country_id',
932 932
 								'class' => 'country_id' 
933 933
 						),
934 934
 						'SELECT',
935 935
 						'',
936
-						array (
936
+						array(
937 937
 								"name" => "country_id",
938 938
 								"rules" => "required" 
939 939
 						),
@@ -946,15 +946,15 @@  discard block
 block discarded – undo
946 946
 						'',
947 947
 						'' 
948 948
 				),
949
-				array (
950
-						gettext ( 'Timezone' ),
951
-						array (
949
+				array(
950
+						gettext('Timezone'),
951
+						array(
952 952
 								'name' => 'timezone_id',
953 953
 								'class' => 'timezone_id' 
954 954
 						),
955 955
 						'SELECT',
956 956
 						'',
957
-						array (
957
+						array(
958 958
 								"name" => "timezone_id",
959 959
 								"rules" => "required" 
960 960
 						),
@@ -967,8 +967,8 @@  discard block
 block discarded – undo
967 967
 						'',
968 968
 						'' 
969 969
 				),
970
-				array (
971
-						gettext ( 'Generate Pin' ),
970
+				array(
971
+						gettext('Generate Pin'),
972 972
 						'pin',
973 973
 						'SELECT',
974 974
 						'',
@@ -980,8 +980,8 @@  discard block
 block discarded – undo
980 980
 						'',
981 981
 						'set_pin_allow_customer' 
982 982
 				),
983
-				array (
984
-						gettext ( 'Allow Recording' ),
983
+				array(
984
+						gettext('Allow Recording'),
985 985
 						'is_recording',
986 986
 						'SELECT',
987 987
 						'',
@@ -993,8 +993,8 @@  discard block
 block discarded – undo
993 993
 						'',
994 994
 						'custom_status_recording' 
995 995
 				),
996
-				array (
997
-						gettext ( 'Allow IP Management' ),
996
+				array(
997
+						gettext('Allow IP Management'),
998 998
 						'allow_ip_management',
999 999
 						'SELECT',
1000 1000
 						'',
@@ -1009,10 +1009,10 @@  discard block
 block discarded – undo
1009 1009
 				$sip_device,
1010 1010
 				$opensips_device 
1011 1011
 		);
1012
-		$form [gettext ( 'Default Settings' )] = array (
1013
-				array (
1014
-						gettext ( 'Rate Group' ),
1015
-						array (
1012
+		$form [gettext('Default Settings')] = array(
1013
+				array(
1014
+						gettext('Rate Group'),
1015
+						array(
1016 1016
 								'name' => 'pricelist_id',
1017 1017
 								'class' => 'pricelist_id' 
1018 1018
 						),
@@ -1026,13 +1026,13 @@  discard block
 block discarded – undo
1026 1026
 						'pricelists',
1027 1027
 						'build_dropdown',
1028 1028
 						'where_arr',
1029
-						array (
1029
+						array(
1030 1030
 								"status" => "0",
1031 1031
 								"reseller_id" => $loginid 
1032 1032
 						) 
1033 1033
 				),
1034
-				array (
1035
-						gettext ( 'Account Type' ),
1034
+				array(
1035
+						gettext('Account Type'),
1036 1036
 						'posttoexternal',
1037 1037
 						'SELECT',
1038 1038
 						'',
@@ -1044,9 +1044,9 @@  discard block
 block discarded – undo
1044 1044
 						'',
1045 1045
 						'set_account_type' 
1046 1046
 				),
1047
-				array (
1048
-						gettext ( 'Billing Schedule' ),
1049
-						array (
1047
+				array(
1048
+						gettext('Billing Schedule'),
1049
+						array(
1050 1050
 								'name' => 'sweep_id',
1051 1051
 								'id' => 'sweep_id',
1052 1052
 								'class' => 'sweep_id' 
@@ -1063,9 +1063,9 @@  discard block
 block discarded – undo
1063 1063
 						'',
1064 1064
 						'' 
1065 1065
 				),
1066
-				array (
1067
-						gettext ( 'Billing Day' ),
1068
-						array (
1066
+				array(
1067
+						gettext('Billing Day'),
1068
+						array(
1069 1069
 								"name" => 'invoice_day',
1070 1070
 								"class" => "invoice_day" 
1071 1071
 						),
@@ -1079,15 +1079,15 @@  discard block
 block discarded – undo
1079 1079
 						'',
1080 1080
 						'set_invoice_option' 
1081 1081
 				),
1082
-				array (
1083
-						gettext ( 'Currency' ),
1084
-						array (
1082
+				array(
1083
+						gettext('Currency'),
1084
+						array(
1085 1085
 								'name' => 'currency_id',
1086 1086
 								'class' => 'currency_id' 
1087 1087
 						),
1088 1088
 						'SELECT',
1089 1089
 						'',
1090
-						array (
1090
+						array(
1091 1091
 								"name" => "currency_id",
1092 1092
 								"rules" => "required" 
1093 1093
 						),
@@ -1098,12 +1098,12 @@  discard block
 block discarded – undo
1098 1098
 						'currency',
1099 1099
 						'build_concat_dropdown',
1100 1100
 						'',
1101
-						array () 
1101
+						array() 
1102 1102
 				),
1103
-				array (
1104
-						gettext ( 'Balance' ),
1103
+				array(
1104
+						gettext('Balance'),
1105 1105
 						'INPUT',
1106
-						array (
1106
+						array(
1107 1107
 								'name' => 'balance',
1108 1108
 								'size' => '20',
1109 1109
 								'class' => "text field medium" 
@@ -1112,10 +1112,10 @@  discard block
 block discarded – undo
1112 1112
 						'tOOL TIP',
1113 1113
 						'' 
1114 1114
 				),
1115
-				array (
1116
-						gettext ( 'Credit Limit' ),
1115
+				array(
1116
+						gettext('Credit Limit'),
1117 1117
 						'INPUT',
1118
-						array (
1118
+						array(
1119 1119
 								'name' => 'credit_limit',
1120 1120
 								'size' => '20',
1121 1121
 								'class' => "text field medium" 
@@ -1124,10 +1124,10 @@  discard block
 block discarded – undo
1124 1124
 						'tOOL TIP',
1125 1125
 						'' 
1126 1126
 				),
1127
-				array (
1128
-						gettext ( 'Valid Days' ),
1127
+				array(
1128
+						gettext('Valid Days'),
1129 1129
 						'INPUT',
1130
-						array (
1130
+						array(
1131 1131
 								'name' => 'validfordays',
1132 1132
 								'size' => '20',
1133 1133
 								'class' => "text field medium" 
@@ -1136,8 +1136,8 @@  discard block
 block discarded – undo
1136 1136
 						'tOOL TIP',
1137 1137
 						'' 
1138 1138
 				),
1139
-				array (
1140
-						gettext ( 'Allow Local Calls' ),
1139
+				array(
1140
+						gettext('Allow Local Calls'),
1141 1141
 						'local_call',
1142 1142
 						'SELECT',
1143 1143
 						'',
@@ -1149,10 +1149,10 @@  discard block
 block discarded – undo
1149 1149
 						'',
1150 1150
 						'custom_status' 
1151 1151
 				),
1152
-				array (
1153
-						gettext ( 'LC Charge / Min' ),
1152
+				array(
1153
+						gettext('LC Charge / Min'),
1154 1154
 						'INPUT',
1155
-						array (
1155
+						array(
1156 1156
 								'name' => 'charge_per_min',
1157 1157
 								'size' => '20',
1158 1158
 								'class' => "text field medium" 
@@ -1162,17 +1162,17 @@  discard block
 block discarded – undo
1162 1162
 						'' 
1163 1163
 				) 
1164 1164
 		);
1165
-		$form ['button_save'] = array (
1165
+		$form ['button_save'] = array(
1166 1166
 				'name' => 'action',
1167
-				'content' => gettext ( 'Save' ),
1167
+				'content' => gettext('Save'),
1168 1168
 				'value' => 'save',
1169 1169
 				'id' => 'submit',
1170 1170
 				'type' => 'button',
1171 1171
 				'class' => 'btn btn-line-parrot' 
1172 1172
 		);
1173
-		$form ['button_cancel'] = array (
1173
+		$form ['button_cancel'] = array(
1174 1174
 				'name' => 'action',
1175
-				'content' => gettext ( 'Close' ),
1175
+				'content' => gettext('Close'),
1176 1176
 				'value' => 'cancel',
1177 1177
 				'type' => 'button',
1178 1178
 				'class' => 'btn btn-line-sky margin-x-10',
@@ -1181,17 +1181,17 @@  discard block
 block discarded – undo
1181 1181
 		return $form;
1182 1182
 	}
1183 1183
 	function get_customer_callerid_fields() {
1184
-		$form ['forms'] = array (
1185
-				base_url () . 'accounts/customer_add_callerid/',
1186
-				array (
1184
+		$form ['forms'] = array(
1185
+				base_url().'accounts/customer_add_callerid/',
1186
+				array(
1187 1187
 						"id" => "callerid_form" 
1188 1188
 				) 
1189 1189
 		);
1190
-		$form [gettext ( 'Information' )] = array (
1191
-				array (
1190
+		$form [gettext('Information')] = array(
1191
+				array(
1192 1192
 						'',
1193 1193
 						'HIDDEN',
1194
-						array (
1194
+						array(
1195 1195
 								'name' => 'flag' 
1196 1196
 						),
1197 1197
 						'',
@@ -1199,10 +1199,10 @@  discard block
 block discarded – undo
1199 1199
 						'',
1200 1200
 						'' 
1201 1201
 				),
1202
-				array (
1203
-						gettext ( 'Account' ),
1202
+				array(
1203
+						gettext('Account'),
1204 1204
 						'INPUT',
1205
-						array (
1205
+						array(
1206 1206
 								'name' => 'accountid',
1207 1207
 								'size' => '20',
1208 1208
 								'readonly' => true,
@@ -1212,8 +1212,8 @@  discard block
 block discarded – undo
1212 1212
 						'tOOL TIP',
1213 1213
 						'Please Enter account number' 
1214 1214
 				),
1215
-				array (
1216
-						gettext ( 'Enable' ),
1215
+				array(
1216
+						gettext('Enable'),
1217 1217
 						'status',
1218 1218
 						'SELECT',
1219 1219
 						'',
@@ -1225,10 +1225,10 @@  discard block
 block discarded – undo
1225 1225
 						'',
1226 1226
 						'custom_status' 
1227 1227
 				),
1228
-				array (
1229
-						gettext ( 'Caller Id Name' ),
1228
+				array(
1229
+						gettext('Caller Id Name'),
1230 1230
 						'INPUT',
1231
-						array (
1231
+						array(
1232 1232
 								'name' => 'callerid_name',
1233 1233
 								'size' => '20',
1234 1234
 								'class' => "text field medium" 
@@ -1237,10 +1237,10 @@  discard block
 block discarded – undo
1237 1237
 						'tOOL TIP',
1238 1238
 						'' 
1239 1239
 				),
1240
-				array (
1241
-						gettext ( 'Caller Id Number' ),
1240
+				array(
1241
+						gettext('Caller Id Number'),
1242 1242
 						'INPUT',
1243
-						array (
1243
+						array(
1244 1244
 								'name' => 'callerid_number',
1245 1245
 								'size' => '20',
1246 1246
 								'class' => "text field medium" 
@@ -1250,17 +1250,17 @@  discard block
 block discarded – undo
1250 1250
 						'' 
1251 1251
 				) 
1252 1252
 		);
1253
-		$form ['button_save'] = array (
1253
+		$form ['button_save'] = array(
1254 1254
 				'name' => 'action',
1255
-				'content' => gettext ( 'Save' ),
1255
+				'content' => gettext('Save'),
1256 1256
 				'value' => 'save',
1257 1257
 				"id" => "submit",
1258 1258
 				'type' => 'button',
1259 1259
 				'class' => 'btn btn-line-parrot' 
1260 1260
 		);
1261
-		$form ['button_cancel'] = array (
1261
+		$form ['button_cancel'] = array(
1262 1262
 				'name' => 'action',
1263
-				'content' => gettext ( 'Close' ),
1263
+				'content' => gettext('Close'),
1264 1264
 				'value' => 'cancel',
1265 1265
 				'type' => 'button',
1266 1266
 				'class' => 'btn btn-line-sky margin-x-10',
@@ -1269,19 +1269,19 @@  discard block
 block discarded – undo
1269 1269
 		return $form;
1270 1270
 	}
1271 1271
 	function get_customer_payment_fields($currency, $number, $currency_id, $id) {
1272
-		$form ['forms'] = array (
1273
-				base_url () . 'accounts/customer_payment_save/',
1274
-				array (
1272
+		$form ['forms'] = array(
1273
+				base_url().'accounts/customer_payment_save/',
1274
+				array(
1275 1275
 						'id' => 'acccount_charges_form',
1276 1276
 						'method' => 'POST',
1277 1277
 						'name' => 'acccount_charges_form' 
1278 1278
 				) 
1279 1279
 		);
1280
-		$form ['​Refill information'] = array (
1281
-				array (
1280
+		$form ['​Refill information'] = array(
1281
+				array(
1282 1282
 						'',
1283 1283
 						'HIDDEN',
1284
-						array (
1284
+						array(
1285 1285
 								'name' => 'id',
1286 1286
 								'value' => $id 
1287 1287
 						),
@@ -1290,10 +1290,10 @@  discard block
 block discarded – undo
1290 1290
 						'',
1291 1291
 						'' 
1292 1292
 				),
1293
-				array (
1293
+				array(
1294 1294
 						'',
1295 1295
 						'HIDDEN',
1296
-						array (
1296
+						array(
1297 1297
 								'name' => 'account_currency',
1298 1298
 								'value' => $currency_id 
1299 1299
 						),
@@ -1301,10 +1301,10 @@  discard block
 block discarded – undo
1301 1301
 						'',
1302 1302
 						'' 
1303 1303
 				),
1304
-				array (
1305
-						gettext ( 'Account' ),
1304
+				array(
1305
+						gettext('Account'),
1306 1306
 						'INPUT',
1307
-						array (
1307
+						array(
1308 1308
 								'name' => 'accountid',
1309 1309
 								'size' => '20',
1310 1310
 								'value' => $number,
@@ -1315,10 +1315,10 @@  discard block
 block discarded – undo
1315 1315
 						'tOOL TIP',
1316 1316
 						'Please Enter account number' 
1317 1317
 				),
1318
-				array (
1319
-						gettext ( 'Amount' ) . "(" . $currency . ")",
1318
+				array(
1319
+						gettext('Amount')."(".$currency.")",
1320 1320
 						'INPUT',
1321
-						array (
1321
+						array(
1322 1322
 								'name' => 'credit',
1323 1323
 								'size' => '20',
1324 1324
 								'class' => "text col-md-5 field medium" 
@@ -1327,8 +1327,8 @@  discard block
 block discarded – undo
1327 1327
 						'tOOL TIP',
1328 1328
 						'' 
1329 1329
 				),
1330
-				array (
1331
-						gettext ( 'Type' ),
1330
+				array(
1331
+						gettext('Type'),
1332 1332
 						'payment_type',
1333 1333
 						'SELECT',
1334 1334
 						'',
@@ -1340,10 +1340,10 @@  discard block
 block discarded – undo
1340 1340
 						'',
1341 1341
 						'set_payment_type' 
1342 1342
 				),
1343
-				array (
1344
-						gettext ( 'Note' ),
1343
+				array(
1344
+						gettext('Note'),
1345 1345
 						'TEXTAREA',
1346
-						array (
1346
+						array(
1347 1347
 								'name' => 'notes',
1348 1348
 								'size' => '20',
1349 1349
 								'cols' => '50',
@@ -1357,17 +1357,17 @@  discard block
 block discarded – undo
1357 1357
 				) 
1358 1358
 		);
1359 1359
 		/* *************************************** */
1360
-		$form ['button_save'] = array (
1360
+		$form ['button_save'] = array(
1361 1361
 				'name' => 'action',
1362
-				'content' => gettext ( 'Process' ),
1362
+				'content' => gettext('Process'),
1363 1363
 				'value' => 'save',
1364 1364
 				'id' => "submit",
1365 1365
 				'type' => 'button',
1366 1366
 				'class' => 'btn btn-line-parrot' 
1367 1367
 		);
1368
-		$form ['button_cancel'] = array (
1368
+		$form ['button_cancel'] = array(
1369 1369
 				'name' => 'action',
1370
-				'content' => gettext ( 'Close' ),
1370
+				'content' => gettext('Close'),
1371 1371
 				'value' => 'cancel',
1372 1372
 				'type' => 'button',
1373 1373
 				'class' => 'btn btn-line-sky margin-x-10',
@@ -1379,10 +1379,10 @@  discard block
 block discarded – undo
1379 1379
 		$readable = false;
1380 1380
 		$invoice_config = null;
1381 1381
 		$concurrent_calls = null;
1382
-		$logintype = $this->CI->session->userdata ( 'logintype' );
1383
-		$uname = $this->CI->common->find_uniq_rendno ( common_model::$global_config ['system_config'] ['cardlength'], 'number', 'accounts' );
1384
-		$password = $this->CI->common->generate_password ();
1385
-		$params = array (
1382
+		$logintype = $this->CI->session->userdata('logintype');
1383
+		$uname = $this->CI->common->find_uniq_rendno(common_model::$global_config ['system_config'] ['cardlength'], 'number', 'accounts');
1384
+		$password = $this->CI->common->generate_password();
1385
+		$params = array(
1386 1386
 				'name' => 'number',
1387 1387
 				'value' => $uname,
1388 1388
 				'size' => '20',
@@ -1391,19 +1391,19 @@  discard block
 block discarded – undo
1391 1391
 				'readonly' => true 
1392 1392
 		);
1393 1393
 		if ($logintype == 1 || $logintype == 5) {
1394
-			$account_data = $this->CI->session->userdata ( "accountinfo" );
1394
+			$account_data = $this->CI->session->userdata("accountinfo");
1395 1395
 			$loginid = $account_data ['id'];
1396 1396
 		} else {
1397 1397
 			$loginid = "0";
1398 1398
 		}
1399 1399
 		if ($id > 0) {
1400
-			$val = 'accounts.email.' . $id;
1401
-			$account_val = 'accounts.number.' . $id;
1400
+			$val = 'accounts.email.'.$id;
1401
+			$account_val = 'accounts.number.'.$id;
1402 1402
 			$readable = 'disabled';
1403
-			$password = array (
1403
+			$password = array(
1404 1404
 					'Password',
1405 1405
 					'PASSWORD',
1406
-					array (
1406
+					array(
1407 1407
 							'name' => 'password',
1408 1408
 							'id' => 'password_show',
1409 1409
 							'onmouseover' => 'seetext(password_show)',
@@ -1415,10 +1415,10 @@  discard block
 block discarded – undo
1415 1415
 					'tOOL TIP',
1416 1416
 					'' 
1417 1417
 			);
1418
-			$concurrent_calls = array (
1418
+			$concurrent_calls = array(
1419 1419
 					'Concurrent Calls',
1420 1420
 					'INPUT',
1421
-					array (
1421
+					array(
1422 1422
 							'name' => 'maxchannels',
1423 1423
 							'size' => '20',
1424 1424
 							'class' => "text field medium" 
@@ -1427,18 +1427,18 @@  discard block
 block discarded – undo
1427 1427
 					'tOOL TIP',
1428 1428
 					'' 
1429 1429
 			);
1430
-			$account = array (
1430
+			$account = array(
1431 1431
 					'Account',
1432 1432
 					'INPUT',
1433 1433
 					$params,
1434
-					'required|integer|greater_than[0]|is_unique[' . $account_val . ']',
1434
+					'required|integer|greater_than[0]|is_unique['.$account_val.']',
1435 1435
 					'tOOL TIP',
1436 1436
 					'' 
1437 1437
 			);
1438 1438
 		} else {
1439 1439
 			$val = 'accounts.email';
1440 1440
 			$account_val = 'accounts.number';
1441
-			$invoice_config = array (
1441
+			$invoice_config = array(
1442 1442
 					'Use same credential for Invoice Config',
1443 1443
 					'invoice_config_flag',
1444 1444
 					'SELECT',
@@ -1451,10 +1451,10 @@  discard block
 block discarded – undo
1451 1451
 					'',
1452 1452
 					'set_prorate' 
1453 1453
 			);
1454
-			$password = array (
1454
+			$password = array(
1455 1455
 					'Password',
1456 1456
 					'INPUT',
1457
-					array (
1457
+					array(
1458 1458
 							'name' => 'password',
1459 1459
 							'value' => $password,
1460 1460
 							'size' => '20',
@@ -1466,21 +1466,21 @@  discard block
 block discarded – undo
1466 1466
 					'',
1467 1467
 					'<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>' 
1468 1468
 			);
1469
-			$account = array (
1469
+			$account = array(
1470 1470
 					'Account',
1471 1471
 					'INPUT',
1472 1472
 					$params,
1473
-					'required|integer|greater_than[0]|is_unique[' . $account_val . ']',
1473
+					'required|integer|greater_than[0]|is_unique['.$account_val.']',
1474 1474
 					'tOOL TIP',
1475 1475
 					'',
1476 1476
 					'<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>' 
1477 1477
 			);
1478 1478
 		}
1479 1479
 		if ($id == "") {
1480
-			$reg_url = array (
1480
+			$reg_url = array(
1481 1481
 					'',
1482 1482
 					'HIDDEN',
1483
-					array (
1483
+					array(
1484 1484
 							'name' => 'id' 
1485 1485
 					),
1486 1486
 					'',
@@ -1489,10 +1489,10 @@  discard block
 block discarded – undo
1489 1489
 					'' 
1490 1490
 			);
1491 1491
 		} else {
1492
-			$reg_url = array (
1492
+			$reg_url = array(
1493 1493
 					'Registration URL',
1494 1494
 					'INPUT',
1495
-					array (
1495
+					array(
1496 1496
 							'name' => 'registration_url',
1497 1497
 							'size' => '20',
1498 1498
 							'readonly' => true,
@@ -1503,18 +1503,18 @@  discard block
 block discarded – undo
1503 1503
 			);
1504 1504
 		}
1505 1505
 		/* * ****************************************************************** */
1506
-		$form ['forms'] = array (
1507
-				base_url () . 'accounts/reseller_save/',
1508
-				array (
1506
+		$form ['forms'] = array(
1507
+				base_url().'accounts/reseller_save/',
1508
+				array(
1509 1509
 						"id" => "reseller_form",
1510 1510
 						"name" => "reseller_form" 
1511 1511
 				) 
1512 1512
 		);
1513
-		$form ['Client Panel Access'] = array (
1514
-				array (
1513
+		$form ['Client Panel Access'] = array(
1514
+				array(
1515 1515
 						'',
1516 1516
 						'HIDDEN',
1517
-						array (
1517
+						array(
1518 1518
 								'name' => 'id' 
1519 1519
 						),
1520 1520
 						'',
@@ -1522,10 +1522,10 @@  discard block
 block discarded – undo
1522 1522
 						'',
1523 1523
 						'' 
1524 1524
 				),
1525
-				array (
1525
+				array(
1526 1526
 						'',
1527 1527
 						'HIDDEN',
1528
-						array (
1528
+						array(
1529 1529
 								'name' => 'type',
1530 1530
 								'value' => '1' 
1531 1531
 						),
@@ -1539,13 +1539,13 @@  discard block
 block discarded – undo
1539 1539
 		);
1540 1540
 		if ($id > 0) {
1541 1541
 			
1542
-			$form [gettext ( 'Billing Information' )] = array (
1543
-					array (
1544
-							gettext ( 'Rate Group' ),
1542
+			$form [gettext('Billing Information')] = array(
1543
+					array(
1544
+							gettext('Rate Group'),
1545 1545
 							'pricelist_id',
1546 1546
 							'SELECT',
1547 1547
 							'',
1548
-							array (
1548
+							array(
1549 1549
 									"name" => "pricelist_id",
1550 1550
 									'rules' => 'required' 
1551 1551
 							),
@@ -1556,15 +1556,15 @@  discard block
 block discarded – undo
1556 1556
 							'pricelists',
1557 1557
 							'build_dropdown',
1558 1558
 							'where_arr',
1559
-							array (
1559
+							array(
1560 1560
 									"status" => "0",
1561 1561
 									"reseller_id" => "0" 
1562 1562
 							) 
1563 1563
 					),
1564 1564
 					$concurrent_calls,
1565
-					array (
1566
-							gettext ( 'Billing Schedule' ),
1567
-							array (
1565
+					array(
1566
+							gettext('Billing Schedule'),
1567
+							array(
1568 1568
 									'name' => 'sweep_id',
1569 1569
 									'class' => 'sweep_id' 
1570 1570
 							),
@@ -1580,9 +1580,9 @@  discard block
 block discarded – undo
1580 1580
 							'',
1581 1581
 							'' 
1582 1582
 					),
1583
-					array (
1584
-							gettext ( 'Billing Day' ),
1585
-							array (
1583
+					array(
1584
+							gettext('Billing Day'),
1585
+							array(
1586 1586
 									"name" => 'invoice_day',
1587 1587
 									"class" => "invoice_day" 
1588 1588
 							),
@@ -1596,15 +1596,15 @@  discard block
 block discarded – undo
1596 1596
 							'',
1597 1597
 							'set_invoice_option' 
1598 1598
 					),
1599
-					array (
1600
-							gettext ( 'Currency' ),
1601
-							array (
1599
+					array(
1600
+							gettext('Currency'),
1601
+							array(
1602 1602
 									'name' => 'currency_id',
1603 1603
 									'class' => 'currency_id' 
1604 1604
 							),
1605 1605
 							'SELECT',
1606 1606
 							'',
1607
-							array (
1607
+							array(
1608 1608
 									"name" => "currency_id",
1609 1609
 									"rules" => "required" 
1610 1610
 							),
@@ -1615,11 +1615,11 @@  discard block
 block discarded – undo
1615 1615
 							'currency',
1616 1616
 							'build_concat_dropdown',
1617 1617
 							'',
1618
-							array () 
1618
+							array() 
1619 1619
 					),
1620
-					array (
1621
-							gettext ( 'Account Type' ),
1622
-							array (
1620
+					array(
1621
+							gettext('Account Type'),
1622
+							array(
1623 1623
 									'name' => 'posttoexternal',
1624 1624
 									'disabled' => $readable,
1625 1625
 									'class' => 'posttoexternal',
@@ -1635,10 +1635,10 @@  discard block
 block discarded – undo
1635 1635
 							'',
1636 1636
 							'set_account_type' 
1637 1637
 					),
1638
-					array (
1639
-							gettext ( 'Credit Limit' ),
1638
+					array(
1639
+							gettext('Credit Limit'),
1640 1640
 							'INPUT',
1641
-							array (
1641
+							array(
1642 1642
 									'name' => 'credit_limit',
1643 1643
 									'size' => '20',
1644 1644
 									'class' => "text field medium" 
@@ -1647,8 +1647,8 @@  discard block
 block discarded – undo
1647 1647
 							'tOOL TIP',
1648 1648
 							'' 
1649 1649
 					),
1650
-					array (
1651
-							gettext ( 'Tax' ),
1650
+					array(
1651
+							gettext('Tax'),
1652 1652
 							'tax_id',
1653 1653
 							'SELECT',
1654 1654
 							'',
@@ -1660,7 +1660,7 @@  discard block
 block discarded – undo
1660 1660
 							'taxes',
1661 1661
 							'build_dropdown',
1662 1662
 							'where_arr',
1663
-							array (
1663
+							array(
1664 1664
 									'status' => 0,
1665 1665
 									'reseller_id' => $loginid 
1666 1666
 							),
@@ -1668,13 +1668,13 @@  discard block
 block discarded – undo
1668 1668
 					) 
1669 1669
 			);
1670 1670
 		} else {
1671
-			$form [gettext ( 'Billing Information' )] = array (
1672
-					array (
1673
-							gettext ( 'Rate Group' ),
1671
+			$form [gettext('Billing Information')] = array(
1672
+					array(
1673
+							gettext('Rate Group'),
1674 1674
 							'pricelist_id',
1675 1675
 							'SELECT',
1676 1676
 							'',
1677
-							array (
1677
+							array(
1678 1678
 									"name" => "pricelist_id",
1679 1679
 									'rules' => 'required' 
1680 1680
 							),
@@ -1685,15 +1685,15 @@  discard block
 block discarded – undo
1685 1685
 							'pricelists',
1686 1686
 							'build_dropdown',
1687 1687
 							'where_arr',
1688
-							array (
1688
+							array(
1689 1689
 									"status" => "0",
1690 1690
 									"reseller_id" => "0" 
1691 1691
 							) 
1692 1692
 					),
1693 1693
 					
1694
-					array (
1695
-							gettext ( 'Billing Schedule' ),
1696
-							array (
1694
+					array(
1695
+							gettext('Billing Schedule'),
1696
+							array(
1697 1697
 									'name' => 'sweep_id',
1698 1698
 									'class' => 'sweep_id' 
1699 1699
 							),
@@ -1709,9 +1709,9 @@  discard block
 block discarded – undo
1709 1709
 							'',
1710 1710
 							'' 
1711 1711
 					),
1712
-					array (
1713
-							gettext ( 'Billing Day' ),
1714
-							array (
1712
+					array(
1713
+							gettext('Billing Day'),
1714
+							array(
1715 1715
 									"name" => 'invoice_day',
1716 1716
 									"class" => "invoice_day" 
1717 1717
 							),
@@ -1725,15 +1725,15 @@  discard block
 block discarded – undo
1725 1725
 							'',
1726 1726
 							'set_invoice_option' 
1727 1727
 					),
1728
-					array (
1729
-							gettext ( 'Currency' ),
1730
-							array (
1728
+					array(
1729
+							gettext('Currency'),
1730
+							array(
1731 1731
 									'name' => 'currency_id',
1732 1732
 									'class' => 'currency_id' 
1733 1733
 							),
1734 1734
 							'SELECT',
1735 1735
 							'',
1736
-							array (
1736
+							array(
1737 1737
 									"name" => "currency_id",
1738 1738
 									"rules" => "required" 
1739 1739
 							),
@@ -1744,11 +1744,11 @@  discard block
 block discarded – undo
1744 1744
 							'currency',
1745 1745
 							'build_concat_dropdown',
1746 1746
 							'',
1747
-							array () 
1747
+							array() 
1748 1748
 					),
1749
-					array (
1750
-							gettext ( 'Account Type' ),
1751
-							array (
1749
+					array(
1750
+							gettext('Account Type'),
1751
+							array(
1752 1752
 									'name' => 'posttoexternal',
1753 1753
 									'disabled' => $readable,
1754 1754
 									'class' => 'posttoexternal',
@@ -1764,10 +1764,10 @@  discard block
 block discarded – undo
1764 1764
 							'',
1765 1765
 							'set_account_type' 
1766 1766
 					),
1767
-					array (
1768
-							gettext ( 'Credit Limit' ),
1767
+					array(
1768
+							gettext('Credit Limit'),
1769 1769
 							'INPUT',
1770
-							array (
1770
+							array(
1771 1771
 									'name' => 'credit_limit',
1772 1772
 									'size' => '20',
1773 1773
 									'class' => "text field medium" 
@@ -1776,8 +1776,8 @@  discard block
 block discarded – undo
1776 1776
 							'tOOL TIP',
1777 1777
 							'' 
1778 1778
 					),
1779
-					array (
1780
-							gettext ( 'Tax' ),
1779
+					array(
1780
+							gettext('Tax'),
1781 1781
 							'tax_id',
1782 1782
 							'SELECT',
1783 1783
 							'',
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
 							'taxes',
1790 1790
 							'build_dropdown',
1791 1791
 							'where_arr',
1792
-							array (
1792
+							array(
1793 1793
 									'status' => 0,
1794 1794
 									'reseller_id' => $loginid 
1795 1795
 							),
@@ -1798,11 +1798,11 @@  discard block
 block discarded – undo
1798 1798
 					$invoice_config 
1799 1799
 			);
1800 1800
 		}
1801
-		$form [gettext ( 'Reseller Profile' )] = array (
1802
-				array (
1803
-						gettext ( 'First Name' ),
1801
+		$form [gettext('Reseller Profile')] = array(
1802
+				array(
1803
+						gettext('First Name'),
1804 1804
 						'INPUT',
1805
-						array (
1805
+						array(
1806 1806
 								'name' => 'first_name',
1807 1807
 								'id' => 'first_name',
1808 1808
 								'size' => '50',
@@ -1812,10 +1812,10 @@  discard block
 block discarded – undo
1812 1812
 						'tOOL TIP',
1813 1813
 						'' 
1814 1814
 				),
1815
-				array (
1816
-						gettext ( 'Last Name' ),
1815
+				array(
1816
+						gettext('Last Name'),
1817 1817
 						'INPUT',
1818
-						array (
1818
+						array(
1819 1819
 								'name' => 'last_name',
1820 1820
 								'size' => '15',
1821 1821
 								'class' => "text field medium" 
@@ -1824,10 +1824,10 @@  discard block
 block discarded – undo
1824 1824
 						'tOOL TIP',
1825 1825
 						'' 
1826 1826
 				),
1827
-				array (
1828
-						gettext ( 'Company' ),
1827
+				array(
1828
+						gettext('Company'),
1829 1829
 						'INPUT',
1830
-						array (
1830
+						array(
1831 1831
 								'name' => 'company_name',
1832 1832
 								'size' => '50',
1833 1833
 								'class' => 'text field medium' 
@@ -1836,10 +1836,10 @@  discard block
 block discarded – undo
1836 1836
 						'tOOL TIP',
1837 1837
 						'' 
1838 1838
 				),
1839
-				array (
1840
-						gettext ( 'Telephone 1' ),
1839
+				array(
1840
+						gettext('Telephone 1'),
1841 1841
 						'INPUT',
1842
-						array (
1842
+						array(
1843 1843
 								'name' => 'telephone_1',
1844 1844
 								'size' => '15',
1845 1845
 								'class' => "text field medium" 
@@ -1848,10 +1848,10 @@  discard block
 block discarded – undo
1848 1848
 						'tOOL TIP',
1849 1849
 						'' 
1850 1850
 				),
1851
-				array (
1852
-						gettext ( 'Telephone 2' ),
1851
+				array(
1852
+						gettext('Telephone 2'),
1853 1853
 						'INPUT',
1854
-						array (
1854
+						array(
1855 1855
 								'name' => 'telephone_2',
1856 1856
 								'size' => '15',
1857 1857
 								'class' => "text field medium" 
@@ -1860,22 +1860,22 @@  discard block
 block discarded – undo
1860 1860
 						'tOOL TIP',
1861 1861
 						'' 
1862 1862
 				),
1863
-				array (
1864
-						gettext ( 'Email' ),
1863
+				array(
1864
+						gettext('Email'),
1865 1865
 						'INPUT',
1866
-						array (
1866
+						array(
1867 1867
 								'name' => 'email',
1868 1868
 								'size' => '50',
1869 1869
 								'class' => "text field medium" 
1870 1870
 						),
1871
-						'required|valid_email|is_unique[' . $val . ']',
1871
+						'required|valid_email|is_unique['.$val.']',
1872 1872
 						'tOOL TIP',
1873 1873
 						'' 
1874 1874
 				),
1875
-				array (
1876
-						gettext ( 'Address 1' ),
1875
+				array(
1876
+						gettext('Address 1'),
1877 1877
 						'INPUT',
1878
-						array (
1878
+						array(
1879 1879
 								'name' => 'address_1',
1880 1880
 								'size' => '15',
1881 1881
 								'class' => "text field medium" 
@@ -1884,10 +1884,10 @@  discard block
 block discarded – undo
1884 1884
 						'tOOL TIP',
1885 1885
 						'' 
1886 1886
 				),
1887
-				array (
1888
-						gettext ( 'Address 2' ),
1887
+				array(
1888
+						gettext('Address 2'),
1889 1889
 						'INPUT',
1890
-						array (
1890
+						array(
1891 1891
 								'name' => 'address_2',
1892 1892
 								'size' => '15',
1893 1893
 								'class' => "text field medium" 
@@ -1896,10 +1896,10 @@  discard block
 block discarded – undo
1896 1896
 						'tOOL TIP',
1897 1897
 						'' 
1898 1898
 				),
1899
-				array (
1900
-						gettext ( 'City' ),
1899
+				array(
1900
+						gettext('City'),
1901 1901
 						'INPUT',
1902
-						array (
1902
+						array(
1903 1903
 								'name' => 'city',
1904 1904
 								'size' => '20',
1905 1905
 								'class' => "text field medium" 
@@ -1908,10 +1908,10 @@  discard block
 block discarded – undo
1908 1908
 						'tOOL TIP',
1909 1909
 						'' 
1910 1910
 				),
1911
-				array (
1912
-						gettext ( 'Province/State' ),
1911
+				array(
1912
+						gettext('Province/State'),
1913 1913
 						'INPUT',
1914
-						array (
1914
+						array(
1915 1915
 								'name' => 'province',
1916 1916
 								'size' => '15',
1917 1917
 								'class' => "text field medium" 
@@ -1920,10 +1920,10 @@  discard block
 block discarded – undo
1920 1920
 						'tOOL TIP',
1921 1921
 						'' 
1922 1922
 				),
1923
-				array (
1924
-						gettext ( 'Zip/Postal Code' ),
1923
+				array(
1924
+						gettext('Zip/Postal Code'),
1925 1925
 						'INPUT',
1926
-						array (
1926
+						array(
1927 1927
 								'name' => 'postal_code',
1928 1928
 								'size' => '15',
1929 1929
 								'class' => "text field medium" 
@@ -1932,15 +1932,15 @@  discard block
 block discarded – undo
1932 1932
 						'tOOL TIP',
1933 1933
 						'' 
1934 1934
 				),
1935
-				array (
1936
-						gettext ( 'Country' ),
1937
-						array (
1935
+				array(
1936
+						gettext('Country'),
1937
+						array(
1938 1938
 								'name' => 'country_id',
1939 1939
 								'class' => 'country_id' 
1940 1940
 						),
1941 1941
 						'SELECT',
1942 1942
 						'',
1943
-						array (
1943
+						array(
1944 1944
 								"name" => "country_id",
1945 1945
 								"rules" => "required" 
1946 1946
 						),
@@ -1953,15 +1953,15 @@  discard block
 block discarded – undo
1953 1953
 						'',
1954 1954
 						'' 
1955 1955
 				),
1956
-				array (
1957
-						gettext ( 'Timezone' ),
1958
-						array (
1956
+				array(
1957
+						gettext('Timezone'),
1958
+						array(
1959 1959
 								'name' => 'timezone_id',
1960 1960
 								'class' => 'timezone_id' 
1961 1961
 						),
1962 1962
 						'SELECT',
1963 1963
 						'',
1964
-						array (
1964
+						array(
1965 1965
 								"name" => "timezone_id",
1966 1966
 								"rules" => "required" 
1967 1967
 						),
@@ -1974,8 +1974,8 @@  discard block
 block discarded – undo
1974 1974
 						'',
1975 1975
 						'' 
1976 1976
 				),
1977
-				array (
1978
-						gettext ( 'Account Status' ),
1977
+				array(
1978
+						gettext('Account Status'),
1979 1979
 						'status',
1980 1980
 						'SELECT',
1981 1981
 						'',
@@ -1989,8 +1989,8 @@  discard block
 block discarded – undo
1989 1989
 				) 
1990 1990
 		);
1991 1991
 		if ($id == 0) {
1992
-			$form [gettext ( 'Alert Threshold' )] = array (
1993
-					array (
1992
+			$form [gettext('Alert Threshold')] = array(
1993
+					array(
1994 1994
 							'Email Alert?',
1995 1995
 							'notify_flag',
1996 1996
 							'SELECT',
@@ -2003,10 +2003,10 @@  discard block
 block discarded – undo
2003 2003
 							'',
2004 2004
 							'custom_status' 
2005 2005
 					),
2006
-					array (
2007
-							gettext ( 'Balance Below' ),
2006
+					array(
2007
+							gettext('Balance Below'),
2008 2008
 							'INPUT',
2009
-							array (
2009
+							array(
2010 2010
 									'name' => 'notify_credit_limit',
2011 2011
 									'size' => '20',
2012 2012
 									'class' => "text field medium" 
@@ -2015,10 +2015,10 @@  discard block
 block discarded – undo
2015 2015
 							'tOOL TIP',
2016 2016
 							'' 
2017 2017
 					),
2018
-					array (
2019
-							gettext ( 'Email' ),
2018
+					array(
2019
+							gettext('Email'),
2020 2020
 							'INPUT',
2021
-							array (
2021
+							array(
2022 2022
 									'name' => 'notify_email',
2023 2023
 									'size' => '50',
2024 2024
 									'class' => "text field medium" 
@@ -2029,17 +2029,17 @@  discard block
 block discarded – undo
2029 2029
 					) 
2030 2030
 			);
2031 2031
 		}
2032
-		$form ['button_cancel'] = array (
2032
+		$form ['button_cancel'] = array(
2033 2033
 				'name' => 'action',
2034
-				'content' => gettext ( 'Cancel' ),
2034
+				'content' => gettext('Cancel'),
2035 2035
 				'value' => 'cancel',
2036 2036
 				'type' => 'button',
2037 2037
 				'class' => 'btn btn-line-sky margin-x-10',
2038 2038
 				'onclick' => 'return redirect_page(\'/accounts/reseller_list/\')' 
2039 2039
 		);
2040
-		$form ['button_save'] = array (
2040
+		$form ['button_save'] = array(
2041 2041
 				'name' => 'action',
2042
-				'content' => gettext ( 'Save' ),
2042
+				'content' => gettext('Save'),
2043 2043
 				'value' => 'save',
2044 2044
 				'type' => 'submit',
2045 2045
 				'class' => 'btn btn-line-parrot' 
@@ -2047,8 +2047,8 @@  discard block
 block discarded – undo
2047 2047
 		return $form;
2048 2048
 	}
2049 2049
 	function get_form_admin_fields($entity_type = '', $id = false) {
2050
-		$uname = $this->CI->common->find_uniq_rendno ( common_model::$global_config ['system_config'] ['cardlength'], 'number', 'accounts' );
2051
-		$params = array (
2050
+		$uname = $this->CI->common->find_uniq_rendno(common_model::$global_config ['system_config'] ['cardlength'], 'number', 'accounts');
2051
+		$params = array(
2052 2052
 				'name' => 'number',
2053 2053
 				'value' => $uname,
2054 2054
 				'size' => '20',
@@ -2057,12 +2057,12 @@  discard block
 block discarded – undo
2057 2057
 				'readonly' => true 
2058 2058
 		);
2059 2059
 		if ($id > 0) {
2060
-			$val = 'accounts.email.' . $id;
2061
-			$account_val = 'accounts.number.' . $id;
2062
-			$password = array (
2060
+			$val = 'accounts.email.'.$id;
2061
+			$account_val = 'accounts.number.'.$id;
2062
+			$password = array(
2063 2063
 					'Password',
2064 2064
 					'PASSWORD',
2065
-					array (
2065
+					array(
2066 2066
 							'name' => 'password',
2067 2067
 							'id' => 'password_show',
2068 2068
 							'onmouseover' => 'seetext(password_show)',
@@ -2074,17 +2074,17 @@  discard block
 block discarded – undo
2074 2074
 					'tOOL TIP',
2075 2075
 					'' 
2076 2076
 			);
2077
-			$account = array (
2077
+			$account = array(
2078 2078
 					'Account',
2079 2079
 					'INPUT',
2080 2080
 					$params,
2081
-					'required|is_unique[' . $account_val . ']',
2081
+					'required|is_unique['.$account_val.']',
2082 2082
 					'tOOL TIP',
2083 2083
 					'' 
2084 2084
 			);
2085 2085
 			if ($entity_type == 'subadmin') {
2086
-				$account_status = array (
2087
-						gettext ( 'Account Status' ),
2086
+				$account_status = array(
2087
+						gettext('Account Status'),
2088 2088
 						'status',
2089 2089
 						'SELECT',
2090 2090
 						'',
@@ -2102,11 +2102,11 @@  discard block
 block discarded – undo
2102 2102
 		} else {
2103 2103
 			$val = 'accounts.email';
2104 2104
 			$account_val = 'accounts.number';
2105
-			$password = $this->CI->common->generate_password ();
2106
-			$password = array (
2105
+			$password = $this->CI->common->generate_password();
2106
+			$password = array(
2107 2107
 					'Password',
2108 2108
 					'INPUT',
2109
-					array (
2109
+					array(
2110 2110
 							'name' => 'password',
2111 2111
 							'value' => $password,
2112 2112
 							'size' => '20',
@@ -2118,17 +2118,17 @@  discard block
 block discarded – undo
2118 2118
 					'',
2119 2119
 					'<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>' 
2120 2120
 			);
2121
-			$account = array (
2121
+			$account = array(
2122 2122
 					'Account',
2123 2123
 					'INPUT',
2124 2124
 					$params,
2125
-					'required|is_unique[' . $account_val . ']',
2125
+					'required|is_unique['.$account_val.']',
2126 2126
 					'tOOL TIP',
2127 2127
 					'',
2128 2128
 					'<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>' 
2129 2129
 			);
2130
-			$account_status = array (
2131
-					gettext ( 'Account Status' ),
2130
+			$account_status = array(
2131
+					gettext('Account Status'),
2132 2132
 					'status',
2133 2133
 					'SELECT',
2134 2134
 					'',
@@ -2144,18 +2144,18 @@  discard block
 block discarded – undo
2144 2144
 		}
2145 2145
 		
2146 2146
 		$type = $entity_type == 'admin' ? 2 : 4;
2147
-		$form ['forms'] = array (
2148
-				base_url () . 'accounts/' . $entity_type . '_save/',
2149
-				array (
2147
+		$form ['forms'] = array(
2148
+				base_url().'accounts/'.$entity_type.'_save/',
2149
+				array(
2150 2150
 						"id" => "admin_form",
2151 2151
 						"name" => "admin_form" 
2152 2152
 				) 
2153 2153
 		);
2154
-		$form ['Client Panel Access'] = array (
2155
-				array (
2154
+		$form ['Client Panel Access'] = array(
2155
+				array(
2156 2156
 						'',
2157 2157
 						'HIDDEN',
2158
-						array (
2158
+						array(
2159 2159
 								'name' => 'id' 
2160 2160
 						),
2161 2161
 						'',
@@ -2163,10 +2163,10 @@  discard block
 block discarded – undo
2163 2163
 						'',
2164 2164
 						'' 
2165 2165
 				),
2166
-				array (
2166
+				array(
2167 2167
 						'',
2168 2168
 						'HIDDEN',
2169
-						array (
2169
+						array(
2170 2170
 								'name' => 'type',
2171 2171
 								'value' => $type 
2172 2172
 						),
@@ -2178,11 +2178,11 @@  discard block
 block discarded – undo
2178 2178
 				$password,
2179 2179
 				/*                 * ********************* */
2180 2180
 		);
2181
-		$form [gettext ( $entity_type . ' Profile' )] = array (
2182
-				array (
2183
-						gettext ( 'First Name' ),
2181
+		$form [gettext($entity_type.' Profile')] = array(
2182
+				array(
2183
+						gettext('First Name'),
2184 2184
 						'INPUT',
2185
-						array (
2185
+						array(
2186 2186
 								'name' => 'first_name',
2187 2187
 								'id' => 'first_name',
2188 2188
 								'size' => '15',
@@ -2193,10 +2193,10 @@  discard block
 block discarded – undo
2193 2193
 						'tOOL TIP',
2194 2194
 						'Please Enter account number' 
2195 2195
 				),
2196
-				array (
2197
-						gettext ( 'Last Name' ),
2196
+				array(
2197
+						gettext('Last Name'),
2198 2198
 						'INPUT',
2199
-						array (
2199
+						array(
2200 2200
 								'name' => 'last_name',
2201 2201
 								'size' => '15',
2202 2202
 								'class' => "text field medium" 
@@ -2205,10 +2205,10 @@  discard block
 block discarded – undo
2205 2205
 						'tOOL TIP',
2206 2206
 						'Please Enter Password' 
2207 2207
 				),
2208
-				array (
2209
-						gettext ( 'Company' ),
2208
+				array(
2209
+						gettext('Company'),
2210 2210
 						'INPUT',
2211
-						array (
2211
+						array(
2212 2212
 								'name' => 'company_name',
2213 2213
 								'size' => '15',
2214 2214
 								'class' => 'text field medium' 
@@ -2217,10 +2217,10 @@  discard block
 block discarded – undo
2217 2217
 						'tOOL TIP',
2218 2218
 						'' 
2219 2219
 				),
2220
-				array (
2221
-						gettext ( 'Telephone 1' ),
2220
+				array(
2221
+						gettext('Telephone 1'),
2222 2222
 						'INPUT',
2223
-						array (
2223
+						array(
2224 2224
 								'name' => 'telephone_1',
2225 2225
 								'size' => '15',
2226 2226
 								'class' => "text field medium" 
@@ -2229,10 +2229,10 @@  discard block
 block discarded – undo
2229 2229
 						'tOOL TIP',
2230 2230
 						'Please Enter Password' 
2231 2231
 				),
2232
-				array (
2233
-						gettext ( 'Telephone 2' ),
2232
+				array(
2233
+						gettext('Telephone 2'),
2234 2234
 						'INPUT',
2235
-						array (
2235
+						array(
2236 2236
 								'name' => 'telephone_2',
2237 2237
 								'size' => '15',
2238 2238
 								'class' => "text field medium" 
@@ -2241,22 +2241,22 @@  discard block
 block discarded – undo
2241 2241
 						'tOOL TIP',
2242 2242
 						'Please Enter Password' 
2243 2243
 				),
2244
-				array (
2245
-						gettext ( 'Email' ),
2244
+				array(
2245
+						gettext('Email'),
2246 2246
 						'INPUT',
2247
-						array (
2247
+						array(
2248 2248
 								'name' => 'email',
2249 2249
 								'size' => '50',
2250 2250
 								'class' => "text field medium" 
2251 2251
 						),
2252
-						'required|valid_email|is_unique[' . $val . ']',
2252
+						'required|valid_email|is_unique['.$val.']',
2253 2253
 						'tOOL TIP',
2254 2254
 						'' 
2255 2255
 				),
2256
-				array (
2257
-						gettext ( 'Address 1' ),
2256
+				array(
2257
+						gettext('Address 1'),
2258 2258
 						'INPUT',
2259
-						array (
2259
+						array(
2260 2260
 								'name' => 'address_1',
2261 2261
 								'size' => '15',
2262 2262
 								'class' => "text field medium" 
@@ -2265,10 +2265,10 @@  discard block
 block discarded – undo
2265 2265
 						'tOOL TIP',
2266 2266
 						'Please Enter Password' 
2267 2267
 				),
2268
-				array (
2269
-						gettext ( 'Address 2' ),
2268
+				array(
2269
+						gettext('Address 2'),
2270 2270
 						'INPUT',
2271
-						array (
2271
+						array(
2272 2272
 								'name' => 'address_2',
2273 2273
 								'size' => '15',
2274 2274
 								'class' => "text field medium" 
@@ -2277,10 +2277,10 @@  discard block
 block discarded – undo
2277 2277
 						'tOOL TIP',
2278 2278
 						'Please Enter Password' 
2279 2279
 				),
2280
-				array (
2281
-						gettext ( 'City' ),
2280
+				array(
2281
+						gettext('City'),
2282 2282
 						'INPUT',
2283
-						array (
2283
+						array(
2284 2284
 								'name' => 'city',
2285 2285
 								'size' => '20',
2286 2286
 								'class' => "text field medium" 
@@ -2289,10 +2289,10 @@  discard block
 block discarded – undo
2289 2289
 						'tOOL TIP',
2290 2290
 						'Please Enter Password' 
2291 2291
 				),
2292
-				array (
2293
-						gettext ( 'Province/State' ),
2292
+				array(
2293
+						gettext('Province/State'),
2294 2294
 						'INPUT',
2295
-						array (
2295
+						array(
2296 2296
 								'name' => 'province',
2297 2297
 								'size' => '15',
2298 2298
 								'class' => "text field medium" 
@@ -2301,10 +2301,10 @@  discard block
 block discarded – undo
2301 2301
 						'tOOL TIP',
2302 2302
 						'Please Enter Password' 
2303 2303
 				),
2304
-				array (
2305
-						gettext ( 'Zip/Postal Code' ),
2304
+				array(
2305
+						gettext('Zip/Postal Code'),
2306 2306
 						'INPUT',
2307
-						array (
2307
+						array(
2308 2308
 								'name' => 'postal_code',
2309 2309
 								'size' => '15',
2310 2310
 								'class' => "text field medium" 
@@ -2313,9 +2313,9 @@  discard block
 block discarded – undo
2313 2313
 						'tOOL TIP',
2314 2314
 						'Please Enter Password' 
2315 2315
 				),
2316
-				array (
2317
-						gettext ( 'Country' ),
2318
-						array (
2316
+				array(
2317
+						gettext('Country'),
2318
+						array(
2319 2319
 								'name' => 'country_id',
2320 2320
 								'class' => 'country_id' 
2321 2321
 						),
@@ -2331,9 +2331,9 @@  discard block
 block discarded – undo
2331 2331
 						'',
2332 2332
 						'' 
2333 2333
 				),
2334
-				array (
2335
-						gettext ( 'Timezone' ),
2336
-						array (
2334
+				array(
2335
+						gettext('Timezone'),
2336
+						array(
2337 2337
 								'name' => 'timezone_id',
2338 2338
 								'class' => 'timezone_id' 
2339 2339
 						),
@@ -2350,9 +2350,9 @@  discard block
 block discarded – undo
2350 2350
 						'' 
2351 2351
 				),
2352 2352
 				$account_status,
2353
-				array (
2354
-						gettext ( 'Currency' ),
2355
-						array (
2353
+				array(
2354
+						gettext('Currency'),
2355
+						array(
2356 2356
 								'name' => 'currency_id',
2357 2357
 								'class' => 'currency_id' 
2358 2358
 						),
@@ -2366,21 +2366,21 @@  discard block
 block discarded – undo
2366 2366
 						'currency',
2367 2367
 						'build_concat_dropdown',
2368 2368
 						'',
2369
-						array () 
2369
+						array() 
2370 2370
 				) 
2371 2371
 		);
2372 2372
 		
2373
-		$form ['button_cancel'] = array (
2373
+		$form ['button_cancel'] = array(
2374 2374
 				'name' => 'action',
2375
-				'content' => gettext ( 'Cancel' ),
2375
+				'content' => gettext('Cancel'),
2376 2376
 				'value' => 'cancel',
2377 2377
 				'type' => 'button',
2378 2378
 				'class' => 'btn btn-line-sky margin-x-10',
2379 2379
 				'onclick' => 'return redirect_page(\'/accounts/admin_list/\')' 
2380 2380
 		);
2381
-		$form ['button_save'] = array (
2381
+		$form ['button_save'] = array(
2382 2382
 				'name' => 'action',
2383
-				'content' => gettext ( 'Save' ),
2383
+				'content' => gettext('Save'),
2384 2384
 				'value' => 'save',
2385 2385
 				'type' => 'submit',
2386 2386
 				'class' => 'btn btn-line-parrot' 
@@ -2393,9 +2393,9 @@  discard block
 block discarded – undo
2393 2393
 	 * Reseller Batch Update
2394 2394
 	 */
2395 2395
 	function reseller_batch_update_form() {
2396
-		$status = array (
2396
+		$status = array(
2397 2397
 				'Status',
2398
-				array (
2398
+				array(
2399 2399
 						'name' => 'status[status]',
2400 2400
 						'id' => 'status' 
2401 2401
 				),
@@ -2410,22 +2410,22 @@  discard block
 block discarded – undo
2410 2410
 				'set_status',
2411 2411
 				'',
2412 2412
 				'',
2413
-				array (
2413
+				array(
2414 2414
 						'name' => 'status[operator]',
2415 2415
 						'class' => 'update_drp' 
2416 2416
 				),
2417 2417
 				'update_drp_type' 
2418 2418
 		);
2419
-		$form ['forms'] = array (
2419
+		$form ['forms'] = array(
2420 2420
 				"accounts/reseller_batch_update/",
2421
-				array (
2421
+				array(
2422 2422
 						'id' => "reseller_batch_update" 
2423 2423
 				) 
2424 2424
 		);
2425
-		$form [gettext ( 'Batch Update' )] = array (
2426
-				array (
2427
-						gettext ( 'Rate Group' ),
2428
-						array (
2425
+		$form [gettext('Batch Update')] = array(
2426
+				array(
2427
+						gettext('Rate Group'),
2428
+						array(
2429 2429
 								'name' => 'pricelist_id[pricelist_id]',
2430 2430
 								'id' => 'pricelist_id' 
2431 2431
 						),
@@ -2439,20 +2439,20 @@  discard block
 block discarded – undo
2439 2439
 						'pricelists',
2440 2440
 						'build_dropdown',
2441 2441
 						'where_arr',
2442
-						array (
2442
+						array(
2443 2443
 								"status" => "0",
2444 2444
 								"reseller_id" => "0" 
2445 2445
 						),
2446
-						array (
2446
+						array(
2447 2447
 								'name' => 'pricelist_id[operator]',
2448 2448
 								'class' => 'update_drp' 
2449 2449
 						),
2450 2450
 						'update_drp_type' 
2451 2451
 				),
2452
-				array (
2453
-						gettext ( 'Balance' ),
2452
+				array(
2453
+						gettext('Balance'),
2454 2454
 						'INPUT',
2455
-						array (
2455
+						array(
2456 2456
 								'name' => 'balance[balance]',
2457 2457
 								'id' => 'balance',
2458 2458
 								'value' => '',
@@ -2462,7 +2462,7 @@  discard block
 block discarded – undo
2462 2462
 						'',
2463 2463
 						'Tool tips info',
2464 2464
 						'1',
2465
-						array (
2465
+						array(
2466 2466
 								'name' => 'balance[operator]',
2467 2467
 								'class' => 'update_drp' 
2468 2468
 						),
@@ -2475,18 +2475,18 @@  discard block
 block discarded – undo
2475 2475
 				
2476 2476
 				$status 
2477 2477
 		);
2478
-		$form ['button_search'] = array (
2478
+		$form ['button_search'] = array(
2479 2479
 				'name' => 'action',
2480 2480
 				'id' => "batch_update_btn",
2481
-				'content' => gettext ( 'Update' ),
2481
+				'content' => gettext('Update'),
2482 2482
 				'value' => 'save',
2483 2483
 				'type' => 'button',
2484 2484
 				'class' => 'btn btn-line-parrot pull-right' 
2485 2485
 		);
2486
-		$form ['button_reset'] = array (
2486
+		$form ['button_reset'] = array(
2487 2487
 				'name' => 'action',
2488 2488
 				'id' => "id_batch_reset",
2489
-				'content' => gettext ( 'Clear' ),
2489
+				'content' => gettext('Clear'),
2490 2490
 				'value' => 'cancel',
2491 2491
 				'type' => 'reset',
2492 2492
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -2502,9 +2502,9 @@  discard block
 block discarded – undo
2502 2502
 	 * Customer Batch Update
2503 2503
 	 */
2504 2504
 	function customer_batch_update_form() {
2505
-		$status = array (
2505
+		$status = array(
2506 2506
 				'Status',
2507
-				array (
2507
+				array(
2508 2508
 						'name' => 'status[status]',
2509 2509
 						'id' => 'status' 
2510 2510
 				),
@@ -2519,22 +2519,22 @@  discard block
 block discarded – undo
2519 2519
 				'set_status',
2520 2520
 				'',
2521 2521
 				'',
2522
-				array (
2522
+				array(
2523 2523
 						'name' => 'status[operator]',
2524 2524
 						'class' => 'update_drp' 
2525 2525
 				),
2526 2526
 				'update_drp_type' 
2527 2527
 		);
2528
-		$form ['forms'] = array (
2528
+		$form ['forms'] = array(
2529 2529
 				"accounts/customer_batch_update/",
2530
-				array (
2530
+				array(
2531 2531
 						'id' => "reseller_batch_update" 
2532 2532
 				) 
2533 2533
 		);
2534
-		$form [gettext ( 'Batch Update' )] = array (
2535
-				array (
2536
-						gettext ( 'Rate Group' ),
2537
-						array (
2534
+		$form [gettext('Batch Update')] = array(
2535
+				array(
2536
+						gettext('Rate Group'),
2537
+						array(
2538 2538
 								'name' => 'pricelist_id[pricelist_id]',
2539 2539
 								'id' => 'pricelist_id' 
2540 2540
 						),
@@ -2548,20 +2548,20 @@  discard block
 block discarded – undo
2548 2548
 						'pricelists',
2549 2549
 						'build_dropdown',
2550 2550
 						'where_arr',
2551
-						array (
2551
+						array(
2552 2552
 								"status" => "0",
2553 2553
 								"reseller_id" => "0" 
2554 2554
 						),
2555
-						array (
2555
+						array(
2556 2556
 								'name' => 'pricelist_id[operator]',
2557 2557
 								'class' => 'update_drp' 
2558 2558
 						),
2559 2559
 						'update_drp_type' 
2560 2560
 				),
2561
-				array (
2562
-						gettext ( 'Balance' ),
2561
+				array(
2562
+						gettext('Balance'),
2563 2563
 						'INPUT',
2564
-						array (
2564
+						array(
2565 2565
 								'name' => 'balance[balance]',
2566 2566
 								'id' => 'balance',
2567 2567
 								'value' => '',
@@ -2571,7 +2571,7 @@  discard block
 block discarded – undo
2571 2571
 						'',
2572 2572
 						'Tool tips info',
2573 2573
 						'1',
2574
-						array (
2574
+						array(
2575 2575
 								'name' => 'balance[operator]',
2576 2576
 								'class' => 'update_drp' 
2577 2577
 						),
@@ -2583,18 +2583,18 @@  discard block
 block discarded – undo
2583 2583
 				),
2584 2584
 				$status 
2585 2585
 		);
2586
-		$form ['button_search'] = array (
2586
+		$form ['button_search'] = array(
2587 2587
 				'name' => 'action',
2588 2588
 				'id' => "batch_update_btn",
2589
-				'content' => gettext ( 'Update' ),
2589
+				'content' => gettext('Update'),
2590 2590
 				'value' => 'save',
2591 2591
 				'type' => 'button',
2592 2592
 				'class' => 'btn btn-line-parrot pull-right' 
2593 2593
 		);
2594
-		$form ['button_reset'] = array (
2594
+		$form ['button_reset'] = array(
2595 2595
 				'name' => 'action',
2596 2596
 				'id' => "id_batch_reset",
2597
-				'content' => gettext ( 'Clear' ),
2597
+				'content' => gettext('Clear'),
2598 2598
 				'value' => 'cancel',
2599 2599
 				'type' => 'reset',
2600 2600
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -2605,19 +2605,19 @@  discard block
 block discarded – undo
2605 2605
 	
2606 2606
 	/* * ***************************************************************************************************************************** */
2607 2607
 	function get_search_customer_form() {
2608
-		$logintype = $this->CI->session->userdata ( 'userlevel_logintype' );
2608
+		$logintype = $this->CI->session->userdata('userlevel_logintype');
2609 2609
 		if ($logintype != 1) {
2610
-			$form ['forms'] = array (
2610
+			$form ['forms'] = array(
2611 2611
 					"",
2612
-					array (
2612
+					array(
2613 2613
 							'id' => "account_search" 
2614 2614
 					) 
2615 2615
 			);
2616
-			$form [gettext ( 'Search' )] = array (
2617
-					array (
2618
-							gettext ( 'Account' ),
2616
+			$form [gettext('Search')] = array(
2617
+					array(
2618
+							gettext('Account'),
2619 2619
 							'INPUT',
2620
-							array (
2620
+							array(
2621 2621
 									'name' => 'number[number]',
2622 2622
 									'',
2623 2623
 									'size' => '20',
@@ -2633,10 +2633,10 @@  discard block
 block discarded – undo
2633 2633
 							'search_string_type',
2634 2634
 							'' 
2635 2635
 					),
2636
-					array (
2637
-							gettext ( 'First Name' ),
2636
+					array(
2637
+							gettext('First Name'),
2638 2638
 							'INPUT',
2639
-							array (
2639
+							array(
2640 2640
 									'name' => 'first_name[first_name]',
2641 2641
 									'',
2642 2642
 									'id' => 'first_name',
@@ -2653,10 +2653,10 @@  discard block
 block discarded – undo
2653 2653
 							'search_string_type',
2654 2654
 							'' 
2655 2655
 					),
2656
-					array (
2657
-							gettext ( 'Last Name' ),
2656
+					array(
2657
+							gettext('Last Name'),
2658 2658
 							'INPUT',
2659
-							array (
2659
+							array(
2660 2660
 									'name' => 'last_name[last_name]',
2661 2661
 									'value' => '',
2662 2662
 									'size' => '20',
@@ -2672,10 +2672,10 @@  discard block
 block discarded – undo
2672 2672
 							'search_string_type',
2673 2673
 							'' 
2674 2674
 					),
2675
-					array (
2676
-							gettext ( 'Company' ),
2675
+					array(
2676
+							gettext('Company'),
2677 2677
 							'INPUT',
2678
-							array (
2678
+							array(
2679 2679
 									'name' => 'company_name[company_name]',
2680 2680
 									'value' => '',
2681 2681
 									'size' => '20',
@@ -2691,10 +2691,10 @@  discard block
 block discarded – undo
2691 2691
 							'search_string_type',
2692 2692
 							'' 
2693 2693
 					),
2694
-					array (
2694
+					array(
2695 2695
 							'CC',
2696 2696
 							'INPUT',
2697
-							array (
2697
+							array(
2698 2698
 									'name' => 'maxchannels[maxchannels]',
2699 2699
 									'value' => '',
2700 2700
 									'size' => '20',
@@ -2710,10 +2710,10 @@  discard block
 block discarded – undo
2710 2710
 							'search_int_type' 
2711 2711
 					),
2712 2712
 					
2713
-					array (
2714
-							gettext ( 'Balance' ),
2713
+					array(
2714
+							gettext('Balance'),
2715 2715
 							'INPUT',
2716
-							array (
2716
+							array(
2717 2717
 									'name' => 'balance[balance]',
2718 2718
 									'value' => '',
2719 2719
 									'size' => '20',
@@ -2729,10 +2729,10 @@  discard block
 block discarded – undo
2729 2729
 							'search_int_type',
2730 2730
 							'' 
2731 2731
 					),
2732
-					array (
2733
-							gettext ( 'Credit Limit' ),
2732
+					array(
2733
+							gettext('Credit Limit'),
2734 2734
 							'INPUT',
2735
-							array (
2735
+							array(
2736 2736
 									'name' => 'credit_limit[credit_limit]',
2737 2737
 									'value' => '',
2738 2738
 									'size' => '20',
@@ -2748,10 +2748,10 @@  discard block
 block discarded – undo
2748 2748
 							'search_int_type',
2749 2749
 							'' 
2750 2750
 					),
2751
-					array (
2752
-							gettext ( 'Email' ),
2751
+					array(
2752
+							gettext('Email'),
2753 2753
 							'INPUT',
2754
-							array (
2754
+							array(
2755 2755
 									'name' => 'email[email]',
2756 2756
 									'value' => '',
2757 2757
 									'size' => '20',
@@ -2767,10 +2767,10 @@  discard block
 block discarded – undo
2767 2767
 							'search_string_type',
2768 2768
 							'' 
2769 2769
 					),
2770
-					array (
2771
-							gettext ( 'First Used' ),
2770
+					array(
2771
+							gettext('First Used'),
2772 2772
 							'INPUT',
2773
-							array (
2773
+							array(
2774 2774
 									'name' => 'first_used[0]',
2775 2775
 									'',
2776 2776
 									'size' => '20',
@@ -2782,10 +2782,10 @@  discard block
 block discarded – undo
2782 2782
 							'',
2783 2783
 							'first_used[first_used-date]' 
2784 2784
 					),
2785
-					array (
2786
-							gettext ( 'Expiry Date' ),
2785
+					array(
2786
+							gettext('Expiry Date'),
2787 2787
 							'INPUT',
2788
-							array (
2788
+							array(
2789 2789
 									'name' => 'expiry[0]',
2790 2790
 									'id' => 'expiry',
2791 2791
 									'size' => '20',
@@ -2796,8 +2796,8 @@  discard block
 block discarded – undo
2796 2796
 							'',
2797 2797
 							'expiry[expiry-date]' 
2798 2798
 					),
2799
-					array (
2800
-							gettext ( 'Rate Group' ),
2799
+					array(
2800
+							gettext('Rate Group'),
2801 2801
 							'pricelist_id',
2802 2802
 							'SELECT',
2803 2803
 							'',
@@ -2809,13 +2809,13 @@  discard block
 block discarded – undo
2809 2809
 							'pricelists',
2810 2810
 							'build_dropdown',
2811 2811
 							'where_arr',
2812
-							array (
2812
+							array(
2813 2813
 									"status" => "0",
2814 2814
 									"reseller_id" => "0" 
2815 2815
 							) 
2816 2816
 					),
2817
-					array (
2818
-							gettext ( 'Status' ),
2817
+					array(
2818
+							gettext('Status'),
2819 2819
 							'status',
2820 2820
 							'SELECT',
2821 2821
 							'',
@@ -2827,10 +2827,10 @@  discard block
 block discarded – undo
2827 2827
 							'',
2828 2828
 							'set_search_status' 
2829 2829
 					),
2830
-					array (
2831
-							gettext ( 'Created Date' ),
2830
+					array(
2831
+							gettext('Created Date'),
2832 2832
 							'INPUT',
2833
-							array (
2833
+							array(
2834 2834
 									'name' => 'creation[0]',
2835 2835
 									'',
2836 2836
 									'size' => '20',
@@ -2842,8 +2842,8 @@  discard block
 block discarded – undo
2842 2842
 							'',
2843 2843
 							'creation[creation-date]' 
2844 2844
 					),
2845
-					array (
2846
-							gettext ( 'Entity Type' ),
2845
+					array(
2846
+							gettext('Entity Type'),
2847 2847
 							'type',
2848 2848
 							'SELECT',
2849 2849
 							'',
@@ -2855,8 +2855,8 @@  discard block
 block discarded – undo
2855 2855
 							'',
2856 2856
 							'set_entity_type_customer' 
2857 2857
 					),
2858
-					array (
2859
-							gettext ( 'Account Type' ),
2858
+					array(
2859
+							gettext('Account Type'),
2860 2860
 							'posttoexternal',
2861 2861
 							'SELECT',
2862 2862
 							'',
@@ -2868,8 +2868,8 @@  discard block
 block discarded – undo
2868 2868
 							'',
2869 2869
 							'set_account_type_search' 
2870 2870
 					),
2871
-					array (
2872
-							gettext ( 'Billing Cycle' ),
2871
+					array(
2872
+							gettext('Billing Cycle'),
2873 2873
 							'sweep_id',
2874 2874
 							'SELECT',
2875 2875
 							'',
@@ -2881,7 +2881,7 @@  discard block
 block discarded – undo
2881 2881
 							'',
2882 2882
 							'set_Billing_Schedule_status' 
2883 2883
 					),
2884
-					array (
2884
+					array(
2885 2885
 							'',
2886 2886
 							'HIDDEN',
2887 2887
 							'ajax_search',
@@ -2890,7 +2890,7 @@  discard block
 block discarded – undo
2890 2890
 							'',
2891 2891
 							'' 
2892 2892
 					),
2893
-					array (
2893
+					array(
2894 2894
 							'',
2895 2895
 							'HIDDEN',
2896 2896
 							'advance_search',
@@ -2902,17 +2902,17 @@  discard block
 block discarded – undo
2902 2902
 			);
2903 2903
 		} else {
2904 2904
 			
2905
-			$form ['forms'] = array (
2905
+			$form ['forms'] = array(
2906 2906
 					"",
2907
-					array (
2907
+					array(
2908 2908
 							'id' => "account_search" 
2909 2909
 					) 
2910 2910
 			);
2911
-			$form [gettext ( 'Search' )] = array (
2912
-					array (
2913
-							gettext ( 'Account' ),
2911
+			$form [gettext('Search')] = array(
2912
+					array(
2913
+							gettext('Account'),
2914 2914
 							'INPUT',
2915
-							array (
2915
+							array(
2916 2916
 									'name' => 'number[number]',
2917 2917
 									'',
2918 2918
 									'size' => '20',
@@ -2928,10 +2928,10 @@  discard block
 block discarded – undo
2928 2928
 							'search_string_type',
2929 2929
 							'' 
2930 2930
 					),
2931
-					array (
2932
-							gettext ( 'First Name' ),
2931
+					array(
2932
+							gettext('First Name'),
2933 2933
 							'INPUT',
2934
-							array (
2934
+							array(
2935 2935
 									'name' => 'first_name[first_name]',
2936 2936
 									'',
2937 2937
 									'id' => 'first_name',
@@ -2948,10 +2948,10 @@  discard block
 block discarded – undo
2948 2948
 							'search_string_type',
2949 2949
 							'' 
2950 2950
 					),
2951
-					array (
2952
-							gettext ( 'Last Name' ),
2951
+					array(
2952
+							gettext('Last Name'),
2953 2953
 							'INPUT',
2954
-							array (
2954
+							array(
2955 2955
 									'name' => 'last_name[last_name]',
2956 2956
 									'value' => '',
2957 2957
 									'size' => '20',
@@ -2967,10 +2967,10 @@  discard block
 block discarded – undo
2967 2967
 							'search_string_type',
2968 2968
 							'' 
2969 2969
 					),
2970
-					array (
2971
-							gettext ( 'Company' ),
2970
+					array(
2971
+							gettext('Company'),
2972 2972
 							'INPUT',
2973
-							array (
2973
+							array(
2974 2974
 									'name' => 'company_name[company_name]',
2975 2975
 									'value' => '',
2976 2976
 									'size' => '20',
@@ -2986,8 +2986,8 @@  discard block
 block discarded – undo
2986 2986
 							'search_string_type',
2987 2987
 							'' 
2988 2988
 					),
2989
-					array (
2990
-							gettext ( 'Rate Group' ),
2989
+					array(
2990
+							gettext('Rate Group'),
2991 2991
 							'pricelist_id',
2992 2992
 							'SELECT',
2993 2993
 							'',
@@ -2999,15 +2999,15 @@  discard block
 block discarded – undo
2999 2999
 							'pricelists',
3000 3000
 							'build_dropdown',
3001 3001
 							'where_arr',
3002
-							array (
3002
+							array(
3003 3003
 									"status" => "0",
3004 3004
 									"reseller_id" => "0" 
3005 3005
 							) 
3006 3006
 					),
3007
-					array (
3008
-							gettext ( 'Balance' ),
3007
+					array(
3008
+							gettext('Balance'),
3009 3009
 							'INPUT',
3010
-							array (
3010
+							array(
3011 3011
 									'name' => 'balance[balance]',
3012 3012
 									'value' => '',
3013 3013
 									'size' => '20',
@@ -3023,10 +3023,10 @@  discard block
 block discarded – undo
3023 3023
 							'search_int_type',
3024 3024
 							'' 
3025 3025
 					),
3026
-					array (
3027
-							gettext ( 'Credit Limit' ),
3026
+					array(
3027
+							gettext('Credit Limit'),
3028 3028
 							'INPUT',
3029
-							array (
3029
+							array(
3030 3030
 									'name' => 'credit_limit[credit_limit]',
3031 3031
 									'value' => '',
3032 3032
 									'size' => '20',
@@ -3042,10 +3042,10 @@  discard block
 block discarded – undo
3042 3042
 							'search_int_type',
3043 3043
 							'' 
3044 3044
 					),
3045
-					array (
3046
-							gettext ( 'Email' ),
3045
+					array(
3046
+							gettext('Email'),
3047 3047
 							'INPUT',
3048
-							array (
3048
+							array(
3049 3049
 									'name' => 'email[email]',
3050 3050
 									'value' => '',
3051 3051
 									'size' => '20',
@@ -3061,10 +3061,10 @@  discard block
 block discarded – undo
3061 3061
 							'search_string_type',
3062 3062
 							'' 
3063 3063
 					),
3064
-					array (
3065
-							gettext ( 'First Used' ),
3064
+					array(
3065
+							gettext('First Used'),
3066 3066
 							'INPUT',
3067
-							array (
3067
+							array(
3068 3068
 									'name' => 'first_used[0]',
3069 3069
 									'',
3070 3070
 									'size' => '20',
@@ -3076,10 +3076,10 @@  discard block
 block discarded – undo
3076 3076
 							'',
3077 3077
 							'first_used[first_used-date]' 
3078 3078
 					),
3079
-					array (
3080
-							gettext ( 'Expiry Date' ),
3079
+					array(
3080
+							gettext('Expiry Date'),
3081 3081
 							'INPUT',
3082
-							array (
3082
+							array(
3083 3083
 									'name' => 'expiry[0]',
3084 3084
 									'id' => 'expiry',
3085 3085
 									'size' => '20',
@@ -3090,10 +3090,10 @@  discard block
 block discarded – undo
3090 3090
 							'',
3091 3091
 							'expiry[expiry-date]' 
3092 3092
 					),
3093
-					array (
3093
+					array(
3094 3094
 							'CC',
3095 3095
 							'INPUT',
3096
-							array (
3096
+							array(
3097 3097
 									'name' => 'maxchannels[maxchannels]',
3098 3098
 									'value' => '',
3099 3099
 									'size' => '20',
@@ -3108,8 +3108,8 @@  discard block
 block discarded – undo
3108 3108
 							'',
3109 3109
 							'search_int_type' 
3110 3110
 					),
3111
-					array (
3112
-							gettext ( 'Status' ),
3111
+					array(
3112
+							gettext('Status'),
3113 3113
 							'status',
3114 3114
 							'SELECT',
3115 3115
 							'',
@@ -3121,10 +3121,10 @@  discard block
 block discarded – undo
3121 3121
 							'',
3122 3122
 							'set_search_status' 
3123 3123
 					),
3124
-					array (
3125
-							gettext ( 'Created Date' ),
3124
+					array(
3125
+							gettext('Created Date'),
3126 3126
 							'INPUT',
3127
-							array (
3127
+							array(
3128 3128
 									'name' => 'creation[0]',
3129 3129
 									'',
3130 3130
 									'size' => '20',
@@ -3136,8 +3136,8 @@  discard block
 block discarded – undo
3136 3136
 							'',
3137 3137
 							'creation[creation-date]' 
3138 3138
 					),
3139
-					array (
3140
-							gettext ( 'Account Type' ),
3139
+					array(
3140
+							gettext('Account Type'),
3141 3141
 							'posttoexternal',
3142 3142
 							'SELECT',
3143 3143
 							'',
@@ -3149,8 +3149,8 @@  discard block
 block discarded – undo
3149 3149
 							'',
3150 3150
 							'set_account_type_search' 
3151 3151
 					),
3152
-					array (
3153
-							gettext ( 'Billing Cycle' ),
3152
+					array(
3153
+							gettext('Billing Cycle'),
3154 3154
 							'sweep_id',
3155 3155
 							'SELECT',
3156 3156
 							'',
@@ -3162,7 +3162,7 @@  discard block
 block discarded – undo
3162 3162
 							'',
3163 3163
 							'set_Billing_Schedule_status' 
3164 3164
 					),
3165
-					array (
3165
+					array(
3166 3166
 							'',
3167 3167
 							'HIDDEN',
3168 3168
 							'ajax_search',
@@ -3171,7 +3171,7 @@  discard block
 block discarded – undo
3171 3171
 							'',
3172 3172
 							'' 
3173 3173
 					),
3174
-					array (
3174
+					array(
3175 3175
 							'',
3176 3176
 							'HIDDEN',
3177 3177
 							'advance_search',
@@ -3183,18 +3183,18 @@  discard block
 block discarded – undo
3183 3183
 			);
3184 3184
 		}
3185 3185
 		
3186
-		$form ['button_search'] = array (
3186
+		$form ['button_search'] = array(
3187 3187
 				'name' => 'action',
3188 3188
 				'id' => "account_search_btn",
3189
-				'content' => gettext ( 'Search' ),
3189
+				'content' => gettext('Search'),
3190 3190
 				'value' => 'save',
3191 3191
 				'type' => 'button',
3192 3192
 				'class' => 'btn btn-line-parrot pull-right' 
3193 3193
 		);
3194
-		$form ['button_reset'] = array (
3194
+		$form ['button_reset'] = array(
3195 3195
 				'name' => 'action',
3196 3196
 				'id' => "id_reset",
3197
-				'content' => gettext ( 'Clear' ),
3197
+				'content' => gettext('Clear'),
3198 3198
 				'value' => 'cancel',
3199 3199
 				'type' => 'reset',
3200 3200
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -3203,17 +3203,17 @@  discard block
 block discarded – undo
3203 3203
 		return $form;
3204 3204
 	}
3205 3205
 	function get_reseller_search_form() {
3206
-		$form ['forms'] = array (
3206
+		$form ['forms'] = array(
3207 3207
 				"",
3208
-				array (
3208
+				array(
3209 3209
 						'id' => "account_search" 
3210 3210
 				) 
3211 3211
 		);
3212
-		$form [gettext ( 'Search' )] = array (
3213
-				array (
3214
-						gettext ( 'Account' ),
3212
+		$form [gettext('Search')] = array(
3213
+				array(
3214
+						gettext('Account'),
3215 3215
 						'INPUT',
3216
-						array (
3216
+						array(
3217 3217
 								'name' => 'number[number]',
3218 3218
 								'',
3219 3219
 								'size' => '20',
@@ -3229,10 +3229,10 @@  discard block
 block discarded – undo
3229 3229
 						'search_string_type',
3230 3230
 						'' 
3231 3231
 				),
3232
-				array (
3233
-						gettext ( 'First Name' ),
3232
+				array(
3233
+						gettext('First Name'),
3234 3234
 						'INPUT',
3235
-						array (
3235
+						array(
3236 3236
 								'name' => 'first_name[first_name]',
3237 3237
 								'',
3238 3238
 								'id' => 'first_name',
@@ -3249,10 +3249,10 @@  discard block
 block discarded – undo
3249 3249
 						'search_string_type',
3250 3250
 						'' 
3251 3251
 				),
3252
-				array (
3253
-						gettext ( 'Last Name' ),
3252
+				array(
3253
+						gettext('Last Name'),
3254 3254
 						'INPUT',
3255
-						array (
3255
+						array(
3256 3256
 								'name' => 'last_name[last_name]',
3257 3257
 								'value' => '',
3258 3258
 								'size' => '20',
@@ -3268,10 +3268,10 @@  discard block
 block discarded – undo
3268 3268
 						'search_string_type',
3269 3269
 						'' 
3270 3270
 				),
3271
-				array (
3272
-						gettext ( 'Email' ),
3271
+				array(
3272
+						gettext('Email'),
3273 3273
 						'INPUT',
3274
-						array (
3274
+						array(
3275 3275
 								'name' => 'email[email]',
3276 3276
 								'value' => '',
3277 3277
 								'size' => '20',
@@ -3287,10 +3287,10 @@  discard block
 block discarded – undo
3287 3287
 						'search_string_type',
3288 3288
 						'' 
3289 3289
 				),
3290
-				array (
3291
-						gettext ( 'Company' ),
3290
+				array(
3291
+						gettext('Company'),
3292 3292
 						'INPUT',
3293
-						array (
3293
+						array(
3294 3294
 								'name' => 'company_name[company_name]',
3295 3295
 								'value' => '',
3296 3296
 								'size' => '20',
@@ -3306,8 +3306,8 @@  discard block
 block discarded – undo
3306 3306
 						'search_string_type',
3307 3307
 						'' 
3308 3308
 				),
3309
-				array (
3310
-						gettext ( 'Rate Group' ),
3309
+				array(
3310
+						gettext('Rate Group'),
3311 3311
 						'pricelist_id',
3312 3312
 						'SELECT',
3313 3313
 						'',
@@ -3319,13 +3319,13 @@  discard block
 block discarded – undo
3319 3319
 						'pricelists',
3320 3320
 						'build_dropdown',
3321 3321
 						'where_arr',
3322
-						array (
3322
+						array(
3323 3323
 								"status" => "0",
3324 3324
 								"reseller_id" => "0" 
3325 3325
 						) 
3326 3326
 				),
3327
-				array (
3328
-						gettext ( 'Account Type' ),
3327
+				array(
3328
+						gettext('Account Type'),
3329 3329
 						'posttoexternal',
3330 3330
 						'SELECT',
3331 3331
 						'',
@@ -3337,10 +3337,10 @@  discard block
 block discarded – undo
3337 3337
 						'',
3338 3338
 						'set_account_type_search' 
3339 3339
 				),
3340
-				array (
3341
-						gettext ( 'Balance' ),
3340
+				array(
3341
+						gettext('Balance'),
3342 3342
 						'INPUT',
3343
-						array (
3343
+						array(
3344 3344
 								'name' => 'balance[balance]',
3345 3345
 								'value' => '',
3346 3346
 								'size' => '20',
@@ -3357,10 +3357,10 @@  discard block
 block discarded – undo
3357 3357
 						'' 
3358 3358
 				),
3359 3359
 				
3360
-				array (
3361
-						gettext ( 'Credit Limit' ),
3360
+				array(
3361
+						gettext('Credit Limit'),
3362 3362
 						'INPUT',
3363
-						array (
3363
+						array(
3364 3364
 								'name' => 'credit_limit[credit_limit]',
3365 3365
 								'value' => '',
3366 3366
 								'size' => '20',
@@ -3376,8 +3376,8 @@  discard block
 block discarded – undo
3376 3376
 						'search_int_type',
3377 3377
 						'' 
3378 3378
 				),
3379
-				array (
3380
-						gettext ( 'Status' ),
3379
+				array(
3380
+						gettext('Status'),
3381 3381
 						'status',
3382 3382
 						'SELECT',
3383 3383
 						'',
@@ -3389,10 +3389,10 @@  discard block
 block discarded – undo
3389 3389
 						'',
3390 3390
 						'set_search_status' 
3391 3391
 				),
3392
-				array (
3393
-						gettext ( 'Created Date' ),
3392
+				array(
3393
+						gettext('Created Date'),
3394 3394
 						'INPUT',
3395
-						array (
3395
+						array(
3396 3396
 								'name' => 'creation[0]',
3397 3397
 								'',
3398 3398
 								'size' => '20',
@@ -3404,7 +3404,7 @@  discard block
 block discarded – undo
3404 3404
 						'',
3405 3405
 						'creation[creation-date]' 
3406 3406
 				),
3407
-				array (
3407
+				array(
3408 3408
 						'',
3409 3409
 						'HIDDEN',
3410 3410
 						'ajax_search',
@@ -3413,7 +3413,7 @@  discard block
 block discarded – undo
3413 3413
 						'',
3414 3414
 						'' 
3415 3415
 				),
3416
-				array (
3416
+				array(
3417 3417
 						'',
3418 3418
 						'HIDDEN',
3419 3419
 						'advance_search',
@@ -3424,18 +3424,18 @@  discard block
 block discarded – undo
3424 3424
 				) 
3425 3425
 		);
3426 3426
 		
3427
-		$form ['button_search'] = array (
3427
+		$form ['button_search'] = array(
3428 3428
 				'name' => 'action',
3429 3429
 				'id' => "account_search_btn",
3430
-				'content' => gettext ( 'Search' ),
3430
+				'content' => gettext('Search'),
3431 3431
 				'value' => 'save',
3432 3432
 				'type' => 'button',
3433 3433
 				'class' => 'btn btn-line-parrot pull-right' 
3434 3434
 		);
3435
-		$form ['button_reset'] = array (
3435
+		$form ['button_reset'] = array(
3436 3436
 				'name' => 'action',
3437 3437
 				'id' => "id_reset",
3438
-				'content' => gettext ( 'Clear' ),
3438
+				'content' => gettext('Clear'),
3439 3439
 				'value' => 'cancel',
3440 3440
 				'type' => 'reset',
3441 3441
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -3444,17 +3444,17 @@  discard block
 block discarded – undo
3444 3444
 		return $form;
3445 3445
 	}
3446 3446
 	function get_admin_search_form() {
3447
-		$form ['forms'] = array (
3447
+		$form ['forms'] = array(
3448 3448
 				"",
3449
-				array (
3449
+				array(
3450 3450
 						'id' => "account_search" 
3451 3451
 				) 
3452 3452
 		);
3453
-		$form ['Search'] = array (
3454
-				array (
3455
-						gettext ( 'Account' ),
3453
+		$form ['Search'] = array(
3454
+				array(
3455
+						gettext('Account'),
3456 3456
 						'INPUT',
3457
-						array (
3457
+						array(
3458 3458
 								'name' => 'number[number]',
3459 3459
 								'',
3460 3460
 								'size' => '20',
@@ -3470,10 +3470,10 @@  discard block
 block discarded – undo
3470 3470
 						'search_string_type',
3471 3471
 						'' 
3472 3472
 				),
3473
-				array (
3474
-						gettext ( 'First Name' ),
3473
+				array(
3474
+						gettext('First Name'),
3475 3475
 						'INPUT',
3476
-						array (
3476
+						array(
3477 3477
 								'name' => 'first_name[first_name]',
3478 3478
 								'',
3479 3479
 								'id' => 'first_name',
@@ -3490,10 +3490,10 @@  discard block
 block discarded – undo
3490 3490
 						'search_string_type',
3491 3491
 						'' 
3492 3492
 				),
3493
-				array (
3494
-						gettext ( 'Last Name' ),
3493
+				array(
3494
+						gettext('Last Name'),
3495 3495
 						'INPUT',
3496
-						array (
3496
+						array(
3497 3497
 								'name' => 'last_name[last_name]',
3498 3498
 								'value' => '',
3499 3499
 								'size' => '20',
@@ -3509,10 +3509,10 @@  discard block
 block discarded – undo
3509 3509
 						'search_string_type',
3510 3510
 						'' 
3511 3511
 				),
3512
-				array (
3513
-						gettext ( 'Company' ),
3512
+				array(
3513
+						gettext('Company'),
3514 3514
 						'INPUT',
3515
-						array (
3515
+						array(
3516 3516
 								'name' => 'company_name[company_name]',
3517 3517
 								'value' => '',
3518 3518
 								'size' => '20',
@@ -3528,10 +3528,10 @@  discard block
 block discarded – undo
3528 3528
 						'search_string_type',
3529 3529
 						'' 
3530 3530
 				),
3531
-				array (
3532
-						gettext ( 'Email' ),
3531
+				array(
3532
+						gettext('Email'),
3533 3533
 						'INPUT',
3534
-						array (
3534
+						array(
3535 3535
 								'name' => 'email[email]',
3536 3536
 								'value' => '',
3537 3537
 								'size' => '20',
@@ -3547,8 +3547,8 @@  discard block
 block discarded – undo
3547 3547
 						'search_string_type',
3548 3548
 						'' 
3549 3549
 				),
3550
-				array (
3551
-						gettext ( 'Entity Type' ),
3550
+				array(
3551
+						gettext('Entity Type'),
3552 3552
 						'type',
3553 3553
 						'SELECT',
3554 3554
 						'',
@@ -3560,10 +3560,10 @@  discard block
 block discarded – undo
3560 3560
 						'',
3561 3561
 						'set_entity_type_admin' 
3562 3562
 				),
3563
-				array (
3564
-						gettext ( 'Phone' ),
3563
+				array(
3564
+						gettext('Phone'),
3565 3565
 						'INPUT',
3566
-						array (
3566
+						array(
3567 3567
 								'name' => 'telephone_1[telephone_1]',
3568 3568
 								'value' => '',
3569 3569
 								'size' => '20',
@@ -3579,8 +3579,8 @@  discard block
 block discarded – undo
3579 3579
 						'search_int_type',
3580 3580
 						'' 
3581 3581
 				),
3582
-				array (
3583
-						gettext ( 'Country' ),
3582
+				array(
3583
+						gettext('Country'),
3584 3584
 						'country_id',
3585 3585
 						'SELECT',
3586 3586
 						'',
@@ -3594,7 +3594,7 @@  discard block
 block discarded – undo
3594 3594
 						'',
3595 3595
 						'' 
3596 3596
 				),
3597
-				array (
3597
+				array(
3598 3598
 						'Status',
3599 3599
 						'status',
3600 3600
 						'SELECT',
@@ -3607,7 +3607,7 @@  discard block
 block discarded – undo
3607 3607
 						'',
3608 3608
 						'set_search_status' 
3609 3609
 				),
3610
-				array (
3610
+				array(
3611 3611
 						'',
3612 3612
 						'HIDDEN',
3613 3613
 						'ajax_search',
@@ -3616,7 +3616,7 @@  discard block
 block discarded – undo
3616 3616
 						'',
3617 3617
 						'' 
3618 3618
 				),
3619
-				array (
3619
+				array(
3620 3620
 						'',
3621 3621
 						'HIDDEN',
3622 3622
 						'advance_search',
@@ -3627,18 +3627,18 @@  discard block
 block discarded – undo
3627 3627
 				) 
3628 3628
 		);
3629 3629
 		
3630
-		$form ['button_search'] = array (
3630
+		$form ['button_search'] = array(
3631 3631
 				'name' => 'action',
3632 3632
 				'id' => "account_search_btn",
3633
-				'content' => gettext ( 'Search' ),
3633
+				'content' => gettext('Search'),
3634 3634
 				'value' => 'save',
3635 3635
 				'type' => 'button',
3636 3636
 				'class' => 'btn btn-line-parrot pull-right' 
3637 3637
 		);
3638
-		$form ['button_reset'] = array (
3638
+		$form ['button_reset'] = array(
3639 3639
 				'name' => 'action',
3640 3640
 				'id' => "id_reset",
3641
-				'content' => gettext ( 'Clear' ),
3641
+				'content' => gettext('Clear'),
3642 3642
 				'value' => 'cancel',
3643 3643
 				'type' => 'reset',
3644 3644
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
@@ -3648,8 +3648,8 @@  discard block
 block discarded – undo
3648 3648
 	}
3649 3649
 	function build_account_list_for_admin() {
3650 3650
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
3651
-		$grid_field_arr = json_encode ( array (
3652
-				array (
3651
+		$grid_field_arr = json_encode(array(
3652
+				array(
3653 3653
 						"<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>",
3654 3654
 						"30",
3655 3655
 						"",
@@ -3660,8 +3660,8 @@  discard block
 block discarded – undo
3660 3660
 						"false",
3661 3661
 						"center" 
3662 3662
 				),
3663
-				array (
3664
-						gettext ( "Account" ),
3663
+				array(
3664
+						gettext("Account"),
3665 3665
 						"135",
3666 3666
 						"number",
3667 3667
 						"number",
@@ -3671,8 +3671,8 @@  discard block
 block discarded – undo
3671 3671
 						"true",
3672 3672
 						"left" 
3673 3673
 				),
3674
-				array (
3675
-						gettext ( "First Name" ),
3674
+				array(
3675
+						gettext("First Name"),
3676 3676
 						"150",
3677 3677
 						"first_name",
3678 3678
 						"",
@@ -3682,8 +3682,8 @@  discard block
 block discarded – undo
3682 3682
 						"true",
3683 3683
 						"center" 
3684 3684
 				),
3685
-				array (
3686
-						gettext ( "Last Name" ),
3685
+				array(
3686
+						gettext("Last Name"),
3687 3687
 						"150",
3688 3688
 						"last_name",
3689 3689
 						"",
@@ -3693,8 +3693,8 @@  discard block
 block discarded – undo
3693 3693
 						"true",
3694 3694
 						"center" 
3695 3695
 				),
3696
-				array (
3697
-						gettext ( "Company" ),
3696
+				array(
3697
+						gettext("Company"),
3698 3698
 						"150",
3699 3699
 						"company_name",
3700 3700
 						"",
@@ -3704,8 +3704,8 @@  discard block
 block discarded – undo
3704 3704
 						"true",
3705 3705
 						"center" 
3706 3706
 				),
3707
-				array (
3708
-						gettext ( "Email" ),
3707
+				array(
3708
+						gettext("Email"),
3709 3709
 						"170",
3710 3710
 						"email",
3711 3711
 						"",
@@ -3715,8 +3715,8 @@  discard block
 block discarded – undo
3715 3715
 						"true",
3716 3716
 						"center" 
3717 3717
 				),
3718
-				array (
3719
-						gettext ( "Phone" ),
3718
+				array(
3719
+						gettext("Phone"),
3720 3720
 						"150",
3721 3721
 						"telephone_1",
3722 3722
 						"",
@@ -3726,8 +3726,8 @@  discard block
 block discarded – undo
3726 3726
 						"true",
3727 3727
 						"center" 
3728 3728
 				),
3729
-				array (
3730
-						gettext ( "Country" ),
3729
+				array(
3730
+						gettext("Country"),
3731 3731
 						"110",
3732 3732
 						"country_id",
3733 3733
 						"country",
@@ -3737,8 +3737,8 @@  discard block
 block discarded – undo
3737 3737
 						"true",
3738 3738
 						"center" 
3739 3739
 				),
3740
-				array (
3741
-						gettext ( "Status" ),
3740
+				array(
3741
+						gettext("Status"),
3742 3742
 						"110",
3743 3743
 						"status",
3744 3744
 						"status",
@@ -3751,34 +3751,34 @@  discard block
 block discarded – undo
3751 3751
 				/**
3752 3752
 				 * ****************************************************************
3753 3753
 				 */
3754
-				array (
3755
-						gettext ( "Action" ),
3754
+				array(
3755
+						gettext("Action"),
3756 3756
 						"100",
3757 3757
 						"",
3758 3758
 						"",
3759 3759
 						"",
3760
-						array (
3761
-								"EDIT" => array (
3760
+						array(
3761
+								"EDIT" => array(
3762 3762
 										"url" => "accounts/admin_edit/",
3763 3763
 										"mode" => "single" 
3764 3764
 								),
3765
-								"DELETE" => array (
3765
+								"DELETE" => array(
3766 3766
 										"url" => "accounts/admin_delete/",
3767 3767
 										"mode" => "single" 
3768 3768
 								) 
3769 3769
 						) 
3770 3770
 				) 
3771
-		) );
3771
+		));
3772 3772
 		return $grid_field_arr;
3773 3773
 	}
3774 3774
 	function build_account_list_for_customer() {
3775
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
3775
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
3776 3776
 		$currency_id = $account_info ['currency_id'];
3777
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
3777
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
3778 3778
 		
3779 3779
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
3780
-		$grid_field_arr = json_encode ( array (
3781
-				array (
3780
+		$grid_field_arr = json_encode(array(
3781
+				array(
3782 3782
 						"<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>",
3783 3783
 						"30",
3784 3784
 						"",
@@ -3789,8 +3789,8 @@  discard block
 block discarded – undo
3789 3789
 						"false",
3790 3790
 						"center" 
3791 3791
 				),
3792
-				array (
3793
-						gettext ( "Account" ),
3792
+				array(
3793
+						gettext("Account"),
3794 3794
 						"125",
3795 3795
 						"number",
3796 3796
 						"number",
@@ -3800,8 +3800,8 @@  discard block
 block discarded – undo
3800 3800
 						"true",
3801 3801
 						"left" 
3802 3802
 				),
3803
-				array (
3804
-						gettext ( "First Name" ),
3803
+				array(
3804
+						gettext("First Name"),
3805 3805
 						"95",
3806 3806
 						"first_name",
3807 3807
 						"",
@@ -3811,8 +3811,8 @@  discard block
 block discarded – undo
3811 3811
 						"true",
3812 3812
 						"center" 
3813 3813
 				),
3814
-				array (
3815
-						gettext ( "Last Name" ),
3814
+				array(
3815
+						gettext("Last Name"),
3816 3816
 						"95",
3817 3817
 						"last_name",
3818 3818
 						"",
@@ -3822,8 +3822,8 @@  discard block
 block discarded – undo
3822 3822
 						"true",
3823 3823
 						"center" 
3824 3824
 				),
3825
-				array (
3826
-						gettext ( "Company" ),
3825
+				array(
3826
+						gettext("Company"),
3827 3827
 						"85",
3828 3828
 						"company_name",
3829 3829
 						"",
@@ -3833,8 +3833,8 @@  discard block
 block discarded – undo
3833 3833
 						"true",
3834 3834
 						"center" 
3835 3835
 				),
3836
-				array (
3837
-						gettext ( "Rate Group" ),
3836
+				array(
3837
+						gettext("Rate Group"),
3838 3838
 						"85",
3839 3839
 						"pricelist_id",
3840 3840
 						"name",
@@ -3844,8 +3844,8 @@  discard block
 block discarded – undo
3844 3844
 						"true",
3845 3845
 						"center" 
3846 3846
 				),
3847
-				array (
3848
-						gettext ( "Balance" ) . " ($currency)",
3847
+				array(
3848
+						gettext("Balance")." ($currency)",
3849 3849
 						"100",
3850 3850
 						"balance",
3851 3851
 						"balance",
@@ -3855,8 +3855,8 @@  discard block
 block discarded – undo
3855 3855
 						"true",
3856 3856
 						"right" 
3857 3857
 				),
3858
-				array (
3859
-						gettext ( "Credit Limit" ) . " ($currency)",
3858
+				array(
3859
+						gettext("Credit Limit")." ($currency)",
3860 3860
 						"120",
3861 3861
 						"credit_limit",
3862 3862
 						"credit_limit",
@@ -3866,8 +3866,8 @@  discard block
 block discarded – undo
3866 3866
 						"true",
3867 3867
 						"right" 
3868 3868
 				),
3869
-				array (
3870
-						gettext ( "First Used" ),
3869
+				array(
3870
+						gettext("First Used"),
3871 3871
 						"80",
3872 3872
 						"first_used",
3873 3873
 						"",
@@ -3877,8 +3877,8 @@  discard block
 block discarded – undo
3877 3877
 						"true",
3878 3878
 						"center" 
3879 3879
 				),
3880
-				array (
3881
-						gettext ( "Expiry Date" ),
3880
+				array(
3881
+						gettext("Expiry Date"),
3882 3882
 						"80",
3883 3883
 						"expiry",
3884 3884
 						"",
@@ -3888,7 +3888,7 @@  discard block
 block discarded – undo
3888 3888
 						"true",
3889 3889
 						"center" 
3890 3890
 				),
3891
-				array (
3891
+				array(
3892 3892
 						"CC",
3893 3893
 						"45",
3894 3894
 						"maxchannels",
@@ -3899,8 +3899,8 @@  discard block
 block discarded – undo
3899 3899
 						"true",
3900 3900
 						"center" 
3901 3901
 				),
3902
-				array (
3903
-						gettext ( "Status" ),
3902
+				array(
3903
+						gettext("Status"),
3904 3904
 						"90",
3905 3905
 						"status",
3906 3906
 						"status",
@@ -3910,8 +3910,8 @@  discard block
 block discarded – undo
3910 3910
 						"true",
3911 3911
 						"center" 
3912 3912
 				),
3913
-				array (
3914
-						gettext ( "Created Date" ),
3913
+				array(
3914
+						gettext("Created Date"),
3915 3915
 						"90",
3916 3916
 						"creation",
3917 3917
 						"",
@@ -3924,42 +3924,42 @@  discard block
 block discarded – undo
3924 3924
 				/**
3925 3925
 				 * *********************************************************************
3926 3926
 				 */
3927
-				array (
3928
-						gettext ( "Action" ),
3927
+				array(
3928
+						gettext("Action"),
3929 3929
 						"140",
3930 3930
 						"",
3931 3931
 						"",
3932 3932
 						"",
3933
-						array (
3934
-								"PAYMENT" => array (
3933
+						array(
3934
+								"PAYMENT" => array(
3935 3935
 										"url" => "accounts/customer_payment_process_add/",
3936 3936
 										"mode" => "single" 
3937 3937
 								),
3938
-								"CALLERID" => array (
3938
+								"CALLERID" => array(
3939 3939
 										"url" => "accounts/customer_add_callerid/",
3940 3940
 										"mode" => "popup" 
3941 3941
 								),
3942
-								"EDIT" => array (
3942
+								"EDIT" => array(
3943 3943
 										"url" => "accounts/customer_edit/",
3944 3944
 										"mode" => "single" 
3945 3945
 								),
3946
-								"DELETE" => array (
3946
+								"DELETE" => array(
3947 3947
 										"url" => "accounts/customer_delete/",
3948 3948
 										"mode" => "single" 
3949 3949
 								) 
3950 3950
 						) 
3951 3951
 				) 
3952
-		) );
3952
+		));
3953 3953
 		return $grid_field_arr;
3954 3954
 	}
3955 3955
 	function build_account_list_for_reseller() {
3956
-		$account_info = $accountinfo = $this->CI->session->userdata ( 'accountinfo' );
3956
+		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
3957 3957
 		$currency_id = $account_info ['currency_id'];
3958
-		$currency = $this->CI->common->get_field_name ( 'currency', 'currency', $currency_id );
3958
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
3959 3959
 		
3960 3960
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
3961
-		$grid_field_arr = json_encode ( array (
3962
-				array (
3961
+		$grid_field_arr = json_encode(array(
3962
+				array(
3963 3963
 						"<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>",
3964 3964
 						"30",
3965 3965
 						"",
@@ -3970,8 +3970,8 @@  discard block
 block discarded – undo
3970 3970
 						"false",
3971 3971
 						"center" 
3972 3972
 				),
3973
-				array (
3974
-						gettext ( "Account" ),
3973
+				array(
3974
+						gettext("Account"),
3975 3975
 						"105",
3976 3976
 						"number",
3977 3977
 						"",
@@ -3981,8 +3981,8 @@  discard block
 block discarded – undo
3981 3981
 						"true",
3982 3982
 						"center" 
3983 3983
 				),
3984
-				array (
3985
-						gettext ( "First Name" ),
3984
+				array(
3985
+						gettext("First Name"),
3986 3986
 						"120",
3987 3987
 						"first_name",
3988 3988
 						"",
@@ -3992,8 +3992,8 @@  discard block
 block discarded – undo
3992 3992
 						"true",
3993 3993
 						"center" 
3994 3994
 				),
3995
-				array (
3996
-						gettext ( "Last Name" ),
3995
+				array(
3996
+						gettext("Last Name"),
3997 3997
 						"115",
3998 3998
 						"last_name",
3999 3999
 						"",
@@ -4003,8 +4003,8 @@  discard block
 block discarded – undo
4003 4003
 						"true",
4004 4004
 						"center" 
4005 4005
 				),
4006
-				array (
4007
-						gettext ( "Company" ),
4006
+				array(
4007
+						gettext("Company"),
4008 4008
 						"130",
4009 4009
 						"company_name",
4010 4010
 						"",
@@ -4014,8 +4014,8 @@  discard block
 block discarded – undo
4014 4014
 						"true",
4015 4015
 						"center" 
4016 4016
 				),
4017
-				array (
4018
-						gettext ( "Rate Group" ),
4017
+				array(
4018
+						gettext("Rate Group"),
4019 4019
 						"95",
4020 4020
 						"pricelist_id",
4021 4021
 						"name",
@@ -4025,8 +4025,8 @@  discard block
 block discarded – undo
4025 4025
 						"true",
4026 4026
 						"center" 
4027 4027
 				),
4028
-				array (
4029
-						gettext ( "Account Type" ),
4028
+				array(
4029
+						gettext("Account Type"),
4030 4030
 						"107",
4031 4031
 						"posttoexternal",
4032 4032
 						"posttoexternal",
@@ -4036,8 +4036,8 @@  discard block
 block discarded – undo
4036 4036
 						"true",
4037 4037
 						"center" 
4038 4038
 				),
4039
-				array (
4040
-						gettext ( "Balance" ) . " ($currency)",
4039
+				array(
4040
+						gettext("Balance")." ($currency)",
4041 4041
 						"100",
4042 4042
 						"balance",
4043 4043
 						"balance",
@@ -4047,8 +4047,8 @@  discard block
 block discarded – undo
4047 4047
 						"true",
4048 4048
 						"right" 
4049 4049
 				),
4050
-				array (
4051
-						gettext ( "Credit Limit" ) . " ($currency)",
4050
+				array(
4051
+						gettext("Credit Limit")." ($currency)",
4052 4052
 						"120",
4053 4053
 						"credit_limit",
4054 4054
 						"credit_limit",
@@ -4058,8 +4058,8 @@  discard block
 block discarded – undo
4058 4058
 						"true",
4059 4059
 						"right" 
4060 4060
 				),
4061
-				array (
4062
-						gettext ( "Status" ),
4061
+				array(
4062
+						gettext("Status"),
4063 4063
 						"110",
4064 4064
 						"status",
4065 4065
 						"status",
@@ -4069,8 +4069,8 @@  discard block
 block discarded – undo
4069 4069
 						"true",
4070 4070
 						"center" 
4071 4071
 				),
4072
-				array (
4073
-						gettext ( "Created Date" ),
4072
+				array(
4073
+						gettext("Created Date"),
4074 4074
 						"90",
4075 4075
 						"creation",
4076 4076
 						"",
@@ -4083,56 +4083,56 @@  discard block
 block discarded – undo
4083 4083
 				/**
4084 4084
 				 * ***********************************************************
4085 4085
 				 */
4086
-				array (
4087
-						gettext ( "Action" ),
4086
+				array(
4087
+						gettext("Action"),
4088 4088
 						"139",
4089 4089
 						"",
4090 4090
 						"",
4091 4091
 						"",
4092
-						array (
4093
-								"PAYMENT" => array (
4092
+						array(
4093
+								"PAYMENT" => array(
4094 4094
 										"url" => "accounts/customer_payment_process_add/",
4095 4095
 										"mode" => "single" 
4096 4096
 								),
4097
-								"CALLERID" => array (
4097
+								"CALLERID" => array(
4098 4098
 										"url" => "accounts/customer_add_callerid/",
4099 4099
 										"mode" => 'popup' 
4100 4100
 								),
4101
-								"EDIT" => array (
4101
+								"EDIT" => array(
4102 4102
 										"url" => "accounts/reseller_edit/",
4103 4103
 										"mode" => "single" 
4104 4104
 								),
4105
-								"DELETE" => array (
4105
+								"DELETE" => array(
4106 4106
 										"url" => "accounts/reseller_delete/",
4107 4107
 										"mode" => "single" 
4108 4108
 								) 
4109 4109
 						) 
4110 4110
 				) 
4111
-		) );
4111
+		));
4112 4112
 		return $grid_field_arr;
4113 4113
 	}
4114 4114
 	function build_grid_buttons_customer() {
4115
-		$logintype = $this->CI->session->userdata ( 'userlevel_logintype' );
4115
+		$logintype = $this->CI->session->userdata('userlevel_logintype');
4116 4116
 		$provider = null;
4117 4117
 		if ($logintype != 1)
4118
-			$provider = array (
4119
-					gettext ( "Create Provider" ),
4118
+			$provider = array(
4119
+					gettext("Create Provider"),
4120 4120
 					"btn btn-line-blue btn",
4121 4121
 					"fa fa-plus-circle fa-lg",
4122 4122
 					"button_action",
4123 4123
 					"/accounts/provider_add/" 
4124 4124
 			);
4125 4125
 			// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
4126
-		$buttons_json = json_encode ( array (
4127
-				array (
4128
-						gettext ( "Create Customer" ),
4126
+		$buttons_json = json_encode(array(
4127
+				array(
4128
+						gettext("Create Customer"),
4129 4129
 						"btn btn-line-warning btn",
4130 4130
 						"fa fa-plus-circle fa-lg",
4131 4131
 						"button_action",
4132 4132
 						"/accounts/customer_add/" 
4133 4133
 				),
4134
-				array (
4135
-						gettext ( "Mass Create" ),
4134
+				array(
4135
+						gettext("Mass Create"),
4136 4136
 						"btn btn-line-warning btn",
4137 4137
 						"fa fa-plus-circle fa-lg",
4138 4138
 						"button_action",
@@ -4141,81 +4141,81 @@  discard block
 block discarded – undo
4141 4141
 						"medium" 
4142 4142
 				),
4143 4143
 				$provider,
4144
-				array (
4145
-						gettext ( "Export" ),
4144
+				array(
4145
+						gettext("Export"),
4146 4146
 						"btn btn-xing",
4147 4147
 						" fa fa-download fa-lg",
4148 4148
 						"button_action",
4149 4149
 						"/accounts/customer_export_cdr_xls/",
4150 4150
 						'single' 
4151 4151
 				),
4152
-				array (
4153
-						gettext ( "Delete" ),
4152
+				array(
4153
+						gettext("Delete"),
4154 4154
 						"btn btn-line-danger",
4155 4155
 						"fa fa-times-circle fa-lg",
4156 4156
 						"button_action",
4157 4157
 						"/accounts/customer_selected_delete/" 
4158 4158
 				) 
4159
-		) );
4159
+		));
4160 4160
 		return $buttons_json;
4161 4161
 	}
4162 4162
 	function build_grid_buttons_admin() {
4163
-		$buttons_json = json_encode ( array (
4164
-				array (
4165
-						gettext ( "Create Admin" ),
4163
+		$buttons_json = json_encode(array(
4164
+				array(
4165
+						gettext("Create Admin"),
4166 4166
 						"btn btn-line-warning btn",
4167 4167
 						"fa fa-plus-circle fa-lg",
4168 4168
 						"button_action",
4169 4169
 						"/accounts/admin_add/" 
4170 4170
 				),
4171
-				array (
4172
-						gettext ( "Create Subadmin" ),
4171
+				array(
4172
+						gettext("Create Subadmin"),
4173 4173
 						"btn btn-line-warning btn",
4174 4174
 						"fa fa-plus-circle fa-lg",
4175 4175
 						"button_action",
4176 4176
 						"/accounts/subadmin_add/4" 
4177 4177
 				),
4178
-				array (
4179
-						gettext ( "Delete" ),
4178
+				array(
4179
+						gettext("Delete"),
4180 4180
 						"btn btn-line-danger",
4181 4181
 						"fa fa-times-circle fa-lg",
4182 4182
 						"button_action",
4183 4183
 						"/accounts/admin_selected_delete/" 
4184 4184
 				) 
4185
-		) );
4185
+		));
4186 4186
 		return $buttons_json;
4187 4187
 	}
4188 4188
 	function build_grid_buttons_reseller() {
4189
-		$buttons_json = json_encode ( array (
4190
-				array (
4191
-						gettext ( "Create" ),
4189
+		$buttons_json = json_encode(array(
4190
+				array(
4191
+						gettext("Create"),
4192 4192
 						"btn btn-line-warning btn",
4193 4193
 						"fa fa-plus-circle fa-lg",
4194 4194
 						"button_action",
4195 4195
 						"/accounts/reseller_add/" 
4196 4196
 				),
4197
-				array (
4198
-						gettext ( "Export" ),
4197
+				array(
4198
+						gettext("Export"),
4199 4199
 						"btn btn-xing",
4200 4200
 						" fa fa-download fa-lg",
4201 4201
 						"button_action",
4202 4202
 						"/accounts/reseller_export_cdr_xls",
4203 4203
 						'single' 
4204 4204
 				),
4205
-				array (
4206
-						gettext ( "Delete" ),
4205
+				array(
4206
+						gettext("Delete"),
4207 4207
 						"btn btn-line-danger",
4208 4208
 						"fa fa-times-circle fa-lg",
4209 4209
 						"button_action",
4210 4210
 						"/accounts/reseller_selected_delete/" 
4211 4211
 				) 
4212
-		) );
4212
+		));
4213 4213
 		return $buttons_json;
4214 4214
 	}
4215 4215
 	function build_ip_list_for_customer($accountid, $accountype) {
4216
-		$grid_field_arr = json_encode ( array (
4217
-				array (
4218
-						gettext ( 'Name' ),
4216
+		$grid_field_arr = json_encode(array(
4217
+				array(
4218
+						gettext('Name'),
4219 4219
 						"180",
4220 4220
 						"name",
4221 4221
 						"",
@@ -4225,8 +4225,8 @@  discard block
 block discarded – undo
4225 4225
 						"true",
4226 4226
 						"center" 
4227 4227
 				),
4228
-				array (
4229
-						gettext ( 'IP' ),
4228
+				array(
4229
+						gettext('IP'),
4230 4230
 						"180",
4231 4231
 						"ip",
4232 4232
 						"",
@@ -4236,8 +4236,8 @@  discard block
 block discarded – undo
4236 4236
 						"true",
4237 4237
 						"center" 
4238 4238
 				),
4239
-				array (
4240
-						gettext ( 'Prefix' ),
4239
+				array(
4240
+						gettext('Prefix'),
4241 4241
 						"180",
4242 4242
 						"prefix",
4243 4243
 						"",
@@ -4247,8 +4247,8 @@  discard block
 block discarded – undo
4247 4247
 						"true",
4248 4248
 						"center" 
4249 4249
 				),
4250
-				array (
4251
-						gettext ( 'Created Date' ),
4250
+				array(
4251
+						gettext('Created Date'),
4252 4252
 						"174",
4253 4253
 						"created_date",
4254 4254
 						"created_date",
@@ -4258,8 +4258,8 @@  discard block
 block discarded – undo
4258 4258
 						"true",
4259 4259
 						"center" 
4260 4260
 				),
4261
-				array (
4262
-						gettext ( 'Modified Date' ),
4261
+				array(
4262
+						gettext('Modified Date'),
4263 4263
 						"160",
4264 4264
 						"last_modified_date",
4265 4265
 						"last_modified_date",
@@ -4269,26 +4269,26 @@  discard block
 block discarded – undo
4269 4269
 						"true",
4270 4270
 						"center" 
4271 4271
 				),
4272
-				array (
4273
-						gettext ( 'Action' ),
4272
+				array(
4273
+						gettext('Action'),
4274 4274
 						"150",
4275 4275
 						"",
4276 4276
 						"",
4277 4277
 						"",
4278
-						array (
4279
-								"DELETE" => array (
4280
-										"url" => "accounts/" . $accountype . "_ipmap_action/delete/$accountid/$accountype/",
4278
+						array(
4279
+								"DELETE" => array(
4280
+										"url" => "accounts/".$accountype."_ipmap_action/delete/$accountid/$accountype/",
4281 4281
 										"mode" => "single" 
4282 4282
 								) 
4283 4283
 						) 
4284 4284
 				) 
4285
-		) );
4285
+		));
4286 4286
 		return $grid_field_arr;
4287 4287
 	}
4288 4288
 	function build_animap_list_for_customer($accountid, $accounttype) {
4289
-		$grid_field_arr = json_encode ( array (
4290
-				array (
4291
-						gettext ( "Caller ID" ),
4289
+		$grid_field_arr = json_encode(array(
4290
+				array(
4291
+						gettext("Caller ID"),
4292 4292
 						"200",
4293 4293
 						"number",
4294 4294
 						"",
@@ -4298,8 +4298,8 @@  discard block
 block discarded – undo
4298 4298
 						"true",
4299 4299
 						"center" 
4300 4300
 				),
4301
-				array (
4302
-						gettext ( "Status" ),
4301
+				array(
4302
+						gettext("Status"),
4303 4303
 						"180",
4304 4304
 						"status",
4305 4305
 						"status",
@@ -4309,8 +4309,8 @@  discard block
 block discarded – undo
4309 4309
 						"true",
4310 4310
 						"center" 
4311 4311
 				),
4312
-				array (
4313
-						gettext ( "Created Date" ),
4312
+				array(
4313
+						gettext("Created Date"),
4314 4314
 						"200",
4315 4315
 						"creation_date",
4316 4316
 						"creation_date",
@@ -4320,8 +4320,8 @@  discard block
 block discarded – undo
4320 4320
 						"true",
4321 4321
 						"center" 
4322 4322
 				),
4323
-				array (
4324
-						gettext ( "Modified Date" ),
4323
+				array(
4324
+						gettext("Modified Date"),
4325 4325
 						"170",
4326 4326
 						"last_modified_date",
4327 4327
 						"last_modified_date",
@@ -4331,25 +4331,25 @@  discard block
 block discarded – undo
4331 4331
 						"true",
4332 4332
 						"center" 
4333 4333
 				),
4334
-				array (
4335
-						gettext ( "Action" ),
4334
+				array(
4335
+						gettext("Action"),
4336 4336
 						"200",
4337 4337
 						"",
4338 4338
 						"",
4339 4339
 						"",
4340
-						array (
4341
-								"DELETE" => array (
4342
-										"url" => "accounts/" . $accounttype . "_animap_action/delete/$accountid/",
4340
+						array(
4341
+								"DELETE" => array(
4342
+										"url" => "accounts/".$accounttype."_animap_action/delete/$accountid/",
4343 4343
 										"mode" => "single" 
4344 4344
 								) 
4345 4345
 						) 
4346 4346
 				) 
4347
-		) );
4347
+		));
4348 4348
 		return $grid_field_arr;
4349 4349
 	}
4350 4350
 	function build_sipiax_list_for_customer() {
4351
-		$grid_field_arr = json_encode ( array (
4352
-				array (
4351
+		$grid_field_arr = json_encode(array(
4352
+				array(
4353 4353
 						"Tech",
4354 4354
 						"150",
4355 4355
 						"tech",
@@ -4357,49 +4357,49 @@  discard block
 block discarded – undo
4357 4357
 						"",
4358 4358
 						"" 
4359 4359
 				),
4360
-				array (
4361
-						gettext ( "Type" ),
4360
+				array(
4361
+						gettext("Type"),
4362 4362
 						"150",
4363 4363
 						"type",
4364 4364
 						"",
4365 4365
 						"",
4366 4366
 						"" 
4367 4367
 				),
4368
-				array (
4369
-						gettext ( "User Name" ),
4368
+				array(
4369
+						gettext("User Name"),
4370 4370
 						"150",
4371 4371
 						"username",
4372 4372
 						"sweep",
4373 4373
 						"sweeplist",
4374 4374
 						"get_field_name" 
4375 4375
 				),
4376
-				array (
4377
-						gettext ( "Password" ),
4376
+				array(
4377
+						gettext("Password"),
4378 4378
 						"150",
4379 4379
 						"secret",
4380 4380
 						"",
4381 4381
 						"",
4382 4382
 						"" 
4383 4383
 				),
4384
-				array (
4385
-						gettext ( "Context" ),
4384
+				array(
4385
+						gettext("Context"),
4386 4386
 						"150",
4387 4387
 						"context",
4388 4388
 						"",
4389 4389
 						"",
4390 4390
 						"" 
4391 4391
 				) 
4392
-		) );
4392
+		));
4393 4393
 		return $grid_field_arr;
4394 4394
 	}
4395 4395
 	function set_block_pattern_action_buttons($id) {
4396 4396
 		$ret_url = '';
4397
-		$ret_url .= '<a href="/did/delete/' . $id . '/" class="icon delete_image" title="Delete" onClick="return get_alert_msg();">&nbsp;</a>';
4397
+		$ret_url .= '<a href="/did/delete/'.$id.'/" class="icon delete_image" title="Delete" onClick="return get_alert_msg();">&nbsp;</a>';
4398 4398
 		return $ret_url;
4399 4399
 	}
4400 4400
 	function build_animap_list() {
4401
-		$grid_field_arr = json_encode ( array (
4402
-				array (
4401
+		$grid_field_arr = json_encode(array(
4402
+				array(
4403 4403
 						"Caller ID",
4404 4404
 						"180",
4405 4405
 						"number",
@@ -4407,36 +4407,36 @@  discard block
 block discarded – undo
4407 4407
 						"",
4408 4408
 						"" 
4409 4409
 				),
4410
-				array (
4411
-						gettext ( "status" ),
4410
+				array(
4411
+						gettext("status"),
4412 4412
 						"180",
4413 4413
 						"status",
4414 4414
 						"status",
4415 4415
 						"animap",
4416 4416
 						"get_status" 
4417 4417
 				),
4418
-				array (
4419
-						gettext ( "Action" ),
4418
+				array(
4419
+						gettext("Action"),
4420 4420
 						"130",
4421 4421
 						"",
4422 4422
 						"",
4423 4423
 						"",
4424
-						array (
4425
-								"EDIT_ANIMAP" => array (
4424
+						array(
4425
+								"EDIT_ANIMAP" => array(
4426 4426
 										"url" => "accounts/callingcards_animap_list_edit/",
4427 4427
 										"mode" => "single" 
4428 4428
 								),
4429
-								"DELETE_ANIMAP" => array (
4429
+								"DELETE_ANIMAP" => array(
4430 4430
 										"url" => "accounts/callingcards_animap_list_remove/",
4431 4431
 										"mode" => "single" 
4432 4432
 								) 
4433 4433
 						) 
4434 4434
 				) 
4435
-		) );
4435
+		));
4436 4436
 		return $grid_field_arr;
4437 4437
 	}
4438 4438
 	function build_grid_buttons_destination() {
4439
-		$buttons_json = json_encode ( array () );
4439
+		$buttons_json = json_encode(array());
4440 4440
 		return $buttons_json;
4441 4441
 	}
4442 4442
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,8 +20,9 @@  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
 class Accounts_form {
26 27
 	function __construct($library_name = '') {
27 28
 		$this->CI = & get_instance ();
@@ -4114,14 +4115,15 @@  discard block
 block discarded – undo
4114 4115
 	function build_grid_buttons_customer() {
4115 4116
 		$logintype = $this->CI->session->userdata ( 'userlevel_logintype' );
4116 4117
 		$provider = null;
4117
-		if ($logintype != 1)
4118
-			$provider = array (
4118
+		if ($logintype != 1) {
4119
+					$provider = array (
4119 4120
 					gettext ( "Create Provider" ),
4120 4121
 					"btn btn-line-blue btn",
4121 4122
 					"fa fa-plus-circle fa-lg",
4122 4123
 					"button_action",
4123 4124
 					"/accounts/provider_add/" 
4124 4125
 			);
4126
+		}
4125 4127
 			// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
4126 4128
 		$buttons_json = json_encode ( array (
4127 4129
 				array (
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/email/models/email_model.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@
 block discarded – undo
134 134
 		return true;
135 135
 	}
136 136
 /**
137
- * **********************************************************
138
- */
137
+	 * **********************************************************
138
+	 */
139 139
 }
140 140
 
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class Email_model extends CI_Model {
25 25
 	function Email_model() {
26
-		parent::__construct ();
26
+		parent::__construct();
27 27
 	}
28 28
 	
29 29
 	/**
@@ -31,69 +31,69 @@  discard block
 block discarded – undo
31 31
 	 * *
32 32
 	 */
33 33
 	function get_email_list($flag, $start = 0, $limit = 0) {
34
-		$account_data = $this->session->userdata ( "accountinfo" );
34
+		$account_data = $this->session->userdata("accountinfo");
35 35
 		
36 36
 		$account_id = $account_data ['id'];
37 37
 		$account_email = $account_data ['email'];
38 38
 		$account_type = $account_data ['type'];
39 39
 		
40 40
 		if ($account_type == 0) {
41
-			$this->db->where ( 'accountid', $account_id );
41
+			$this->db->where('accountid', $account_id);
42 42
 		}
43 43
 		if ($account_type == 1) {
44
-			$this->db->where_in ( 'reseller_id' );
45
-			$this->db->select ( 'id' );
46
-			$email_address = $this->db->get ( 'accounts' );
44
+			$this->db->where_in('reseller_id');
45
+			$this->db->select('id');
46
+			$email_address = $this->db->get('accounts');
47 47
 			
48
-			$email_address = $email_address->result_array ();
48
+			$email_address = $email_address->result_array();
49 49
 			
50
-			if (empty ( $email_address )) {
51
-				$this->db->or_where ( 'accountid', 0 );
50
+			if (empty ($email_address)) {
51
+				$this->db->or_where('accountid', 0);
52 52
 			} else {
53
-				$this->db->where ( 'reseller_id', $account_id );
53
+				$this->db->where('reseller_id', $account_id);
54 54
 			}
55 55
 		}
56
-		$this->db_model->build_search ( 'email_search_list' );
56
+		$this->db_model->build_search('email_search_list');
57 57
 		if ($flag) {
58
-			$query = $this->db_model->select ( "*", "mail_details", '', "id", "DESC", $limit, $start );
58
+			$query = $this->db_model->select("*", "mail_details", '', "id", "DESC", $limit, $start);
59 59
 		} else {
60
-			$query = $this->db_model->countQuery ( "*", "mail_details", '' );
60
+			$query = $this->db_model->countQuery("*", "mail_details", '');
61 61
 		}
62 62
 		return $query;
63 63
 	}
64 64
 	function add_email($add_array) {
65
-		$this->db->insert ( "mail_details", $add_array );
65
+		$this->db->insert("mail_details", $add_array);
66 66
 		return true;
67 67
 	}
68 68
 	function remove_email($id) {
69
-		$this->db->where ( "id", $id );
70
-		$this->db->delete ( "mail_details" );
69
+		$this->db->where("id", $id);
70
+		$this->db->delete("mail_details");
71 71
 		return true;
72 72
 	}
73 73
 	function edit_email($data, $id) {
74
-		$this->db->where ( "id", $id );
75
-		$this->db->update ( "mail_details", $data );
74
+		$this->db->where("id", $id);
75
+		$this->db->update("mail_details", $data);
76 76
 	}
77 77
 	function customer_get_email_list($flag, $accountid, $start = 0, $limit = 0) {
78
-		$this->db->where ( 'accountid', $accountid );
78
+		$this->db->where('accountid', $accountid);
79 79
 		if ($flag) {
80
-			$query = $this->db_model->select ( "*", "mail_details", '', "id", "desc", $limit, $start );
80
+			$query = $this->db_model->select("*", "mail_details", '', "id", "desc", $limit, $start);
81 81
 		} else {
82
-			$query = $this->db_model->countQuery ( "*", "mail_details", '' );
82
+			$query = $this->db_model->countQuery("*", "mail_details", '');
83 83
 		}
84 84
 		
85 85
 		return $query;
86 86
 	}
87 87
 	function get_email_client_data($data, $start = 0, $limit = 0) {
88 88
 		if ($data ['type'] == '') {
89
-			$where = array (
89
+			$where = array(
90 90
 					'pricelist_id' => $data ['pricelist_id'],
91 91
 					'posttoexternal' => $data ['posttoexternal'],
92 92
 					'status' => $data ['status'],
93 93
 					'deleted' => '0' 
94 94
 			);
95 95
 		} else {
96
-			$where = array (
96
+			$where = array(
97 97
 					'pricelist_id' => $data ['pricelist_id'],
98 98
 					'posttoexternal' => $data ['posttoexternal'],
99 99
 					'status' => $data ['status'],
@@ -102,33 +102,33 @@  discard block
 block discarded – undo
102 102
 			);
103 103
 		}
104 104
 		
105
-		$query = $this->db_model->getSelect ( "email,id", "accounts", $where );
106
-		$query = $query->result_array ();
105
+		$query = $this->db_model->getSelect("email,id", "accounts", $where);
106
+		$query = $query->result_array();
107 107
 		return $query;
108 108
 	}
109 109
 	/* Mass mail */
110 110
 	function multipal_email($data) {
111
-		$mail_ids = explode ( ',', $data ['to'] );
112
-		foreach ( $mail_ids as $key => $val ) {
111
+		$mail_ids = explode(',', $data ['to']);
112
+		foreach ($mail_ids as $key => $val) {
113 113
 			if ($val != '') {
114 114
 				$template_type ['message'] = $data ['template'];
115 115
 				$template_type ['subject'] = $data ['subject'];
116
-				$act_details = $this->db_model->getSelect ( "*", "accounts", array (
116
+				$act_details = $this->db_model->getSelect("*", "accounts", array(
117 117
 						'email' => $val,
118 118
 						"deleted" => 0 
119
-				) );
120
-				$count = $act_details->num_rows ();
121
-				$account_info = array ();
119
+				));
120
+				$count = $act_details->num_rows();
121
+				$account_info = array();
122 122
 				if ($count <= 0) {
123 123
 					$account_info ['email'] = $val;
124 124
 					$account_info ['accountid'] = '0';
125 125
 				} else {
126
-					$res_data = $act_details->result_array ();
126
+					$res_data = $act_details->result_array();
127 127
 					$account_info = $res_data [0];
128 128
 					$account_info ['accountid'] = $account_info ['id'];
129 129
 				}
130
-				$account_info ['password'] = $this->common->decode ( $account_info ['password'] );
131
-				$this->email_lib->send_email ( $template_type, $account_info, '', $data ['file'], 0, 1 );
130
+				$account_info ['password'] = $this->common->decode($account_info ['password']);
131
+				$this->email_lib->send_email($template_type, $account_info, '', $data ['file'], 0, 1);
132 132
 			}
133 133
 		}
134 134
 		return true;
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/email/controllers/email.php 2 patches
Spacing   +213 added lines, -213 removed lines patch added patch discarded remove patch
@@ -23,70 +23,70 @@  discard block
 block discarded – undo
23 23
 // ##############################################################################
24 24
 class Email extends MX_Controller {
25 25
 	function Email() {
26
-		parent::__construct ();
26
+		parent::__construct();
27 27
 		
28
-		$this->load->helper ( 'template_inheritance' );
28
+		$this->load->helper('template_inheritance');
29 29
 		
30
-		$this->load->library ( 'session' );
31
-		$this->load->library ( 'email_form' );
32
-		$this->load->library ( 'astpp/form' );
33
-		$this->load->model ( 'email_model' );
34
-		$this->load->library ( 'csvreader' );
35
-		$this->load->library ( 'astpp/email_lib' );
36
-		if ($this->session->userdata ( 'user_login' ) == FALSE)
37
-			redirect ( base_url () . '/astpp/login' );
30
+		$this->load->library('session');
31
+		$this->load->library('email_form');
32
+		$this->load->library('astpp/form');
33
+		$this->load->model('email_model');
34
+		$this->load->library('csvreader');
35
+		$this->load->library('astpp/email_lib');
36
+		if ($this->session->userdata('user_login') == FALSE)
37
+			redirect(base_url().'/astpp/login');
38 38
 	}
39 39
 	function email_edit($edit_id = '') {
40
-		$data ['page_title'] = gettext ( 'Edit Email List' );
41
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
42
-			$account_data = $this->session->userdata ( "accountinfo" );
40
+		$data ['page_title'] = gettext('Edit Email List');
41
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
42
+			$account_data = $this->session->userdata("accountinfo");
43 43
 			$reseller = $account_data ['id'];
44
-			$where = array (
44
+			$where = array(
45 45
 					'id' => $edit_id,
46 46
 					"reseller_id" => $reseller 
47 47
 			);
48 48
 		} else {
49
-			$where = array (
49
+			$where = array(
50 50
 					'id' => $edit_id 
51 51
 			);
52 52
 		}
53
-		$account = $this->db_model->getSelect ( "*", "mail_details", $where );
53
+		$account = $this->db_model->getSelect("*", "mail_details", $where);
54 54
 		if ($account->num_rows > 0) {
55
-			foreach ( $account->result_array () as $key => $value ) {
55
+			foreach ($account->result_array() as $key => $value) {
56 56
 				$edit_data = $value;
57 57
 			}
58
-			$data ['form'] = $this->form->build_form ( $this->email_form->get_form_fields_email (), $edit_data );
59
-			$this->load->view ( 'view_email_add_edit', $data );
58
+			$data ['form'] = $this->form->build_form($this->email_form->get_form_fields_email(), $edit_data);
59
+			$this->load->view('view_email_add_edit', $data);
60 60
 		} else {
61
-			redirect ( base_url () . 'email/email_history_list/' );
61
+			redirect(base_url().'email/email_history_list/');
62 62
 		}
63
-		redirect ( base_url () . 'email/email_history_list/' );
63
+		redirect(base_url().'email/email_history_list/');
64 64
 	}
65 65
 	function email_resend() {
66
-		$add_array = $this->input->post ();
66
+		$add_array = $this->input->post();
67 67
 		/**
68 68
 		 * ASTPP 3.0
69 69
 		 * For Signup Email broadcast link change
70 70
 		 * *
71 71
 		 */
72
-		$add_array = $this->db_model->getSelect ( "*", 'mail_details', array (
72
+		$add_array = $this->db_model->getSelect("*", 'mail_details', array(
73 73
 				'id' => $add_array ['id'] 
74
-		) );
75
-		$add_array = $add_array->result_array ();
74
+		));
75
+		$add_array = $add_array->result_array();
76 76
 		$add_array = $add_array [0];
77 77
 		/**
78 78
 		 * *********************************************************
79 79
 		 */
80 80
 		
81
-		$data ['page_title'] = gettext ( 'Resand Email' );
82
-		$where = array (
81
+		$data ['page_title'] = gettext('Resand Email');
82
+		$where = array(
83 83
 				'id' => $add_array ['id'] 
84 84
 		);
85
-		$account = $this->db_model->getSelect ( "*", "mail_details", $where );
86
-		foreach ( $account->result_array () as $key => $value ) {
85
+		$account = $this->db_model->getSelect("*", "mail_details", $where);
86
+		foreach ($account->result_array() as $key => $value) {
87 87
 			$edit_data = $value;
88 88
 		}
89
-		$add_array = array (
89
+		$add_array = array(
90 90
 				'accountid' => $edit_data ['accountid'],
91 91
 				'subject' => $add_array ['subject'],
92 92
 				'body' => $add_array ['body'],
@@ -97,58 +97,58 @@  discard block
 block discarded – undo
97 97
 				'attachment' => $edit_data ['attachment'] 
98 98
 		)
99 99
 		;
100
-		$this->email_re_send ( $add_array );
100
+		$this->email_re_send($add_array);
101 101
 		
102
-		$this->session->set_flashdata ( 'astpp_errormsg', 'Email resend successfully!' );
103
-		redirect ( base_url () . 'email/email_history_list/' );
102
+		$this->session->set_flashdata('astpp_errormsg', 'Email resend successfully!');
103
+		redirect(base_url().'email/email_history_list/');
104 104
 	}
105 105
 	function email_resend_edit($edit_id = '') {
106
-		$data ['page_title'] = gettext ( 'Resend Email' );
107
-		$where = array (
106
+		$data ['page_title'] = gettext('Resend Email');
107
+		$where = array(
108 108
 				'id' => $edit_id 
109 109
 		);
110
-		$account = $this->db_model->getSelect ( "*", "mail_details", $where );
110
+		$account = $this->db_model->getSelect("*", "mail_details", $where);
111 111
 		if ($account->num_rows > 0) {
112
-			foreach ( $account->result_array () as $key => $value ) {
112
+			foreach ($account->result_array() as $key => $value) {
113 113
 				$edit_data = $value;
114 114
 			}
115 115
 			$data ['maildata'] = $edit_data ['attachment'];
116
-			$data ['form'] = $this->form->build_form ( $this->email_form->get_form_fields_email_edit (), $edit_data );
116
+			$data ['form'] = $this->form->build_form($this->email_form->get_form_fields_email_edit(), $edit_data);
117 117
 			
118
-			$this->load->view ( 'view_email_add_edit', $data );
118
+			$this->load->view('view_email_add_edit', $data);
119 119
 		} else {
120
-			redirect ( base_url () . 'email/email_history_list/' );
120
+			redirect(base_url().'email/email_history_list/');
121 121
 		}
122 122
 	}
123 123
 	function email_resend_edit_customer($edit_id = '') {
124
-		$data ['page_title'] = gettext ( 'Resent Email' );
125
-		$where = array (
124
+		$data ['page_title'] = gettext('Resent Email');
125
+		$where = array(
126 126
 				'id' => $edit_id 
127 127
 		);
128
-		$account = $this->db_model->getSelect ( "*", "mail_details", $where );
128
+		$account = $this->db_model->getSelect("*", "mail_details", $where);
129 129
 		if ($account->num_rows > 0) {
130
-			foreach ( $account->result_array () as $key => $value ) {
130
+			foreach ($account->result_array() as $key => $value) {
131 131
 				$edit_data = $value;
132 132
 			}
133 133
 			$data ['maildata'] = $edit_data ['attachment'];
134
-			$data ['form'] = $this->form->build_form ( $this->email_form->get_form_fields_email_view_cus_edit (), $edit_data );
134
+			$data ['form'] = $this->form->build_form($this->email_form->get_form_fields_email_view_cus_edit(), $edit_data);
135 135
 			
136
-			$this->load->view ( 'view_email_add_edit', $data );
136
+			$this->load->view('view_email_add_edit', $data);
137 137
 		} else {
138
-			redirect ( base_url () . 'email/email_history_list/' );
138
+			redirect(base_url().'email/email_history_list/');
139 139
 		}
140 140
 	}
141 141
 	function email_resend_customer($edit_id = '') {
142
-		$add_array = $this->input->post ();
143
-		$data ['page_title'] = gettext ( 'Resand Email' );
144
-		$where = array (
142
+		$add_array = $this->input->post();
143
+		$data ['page_title'] = gettext('Resand Email');
144
+		$where = array(
145 145
 				'id' => $add_array ['id'] 
146 146
 		);
147
-		$account = $this->db_model->getSelect ( "*", "mail_details", $where );
148
-		foreach ( $account->result_array () as $key => $value ) {
147
+		$account = $this->db_model->getSelect("*", "mail_details", $where);
148
+		foreach ($account->result_array() as $key => $value) {
149 149
 			$edit_data = $value;
150 150
 		}
151
-		$add_array = array (
151
+		$add_array = array(
152 152
 				'accountid' => $edit_data ['accountid'],
153 153
 				'subject' => $add_array ['subject'],
154 154
 				'body' => $add_array ['body'],
@@ -158,65 +158,65 @@  discard block
 block discarded – undo
158 158
 				'template' => $edit_data ['template'],
159 159
 				'attachment' => $edit_data ['attachment'] 
160 160
 		);
161
-		$this->email_model->add_email ( $add_array );
162
-		$this->email_lib->send_email ( '', $add_array, '', '', 1 );
161
+		$this->email_model->add_email($add_array);
162
+		$this->email_lib->send_email('', $add_array, '', '', 1);
163 163
 		
164
-		$this->load->module ( 'accounts/accounts' );
165
-		$this->session->set_flashdata ( 'astpp_errormsg', 'Email resend successfully!' );
166
-		redirect ( base_url () . 'accounts/customer_edit/' . $value ["accountid"] );
164
+		$this->load->module('accounts/accounts');
165
+		$this->session->set_flashdata('astpp_errormsg', 'Email resend successfully!');
166
+		redirect(base_url().'accounts/customer_edit/'.$value ["accountid"]);
167 167
 	}
168 168
 	function email_add($type = "") {
169
-		$data ['username'] = $this->session->userdata ( 'user_name' );
169
+		$data ['username'] = $this->session->userdata('user_name');
170 170
 		$data ['flag'] = 'create';
171
-		$data ['page_title'] = gettext ( 'Create Commission Rate' );
172
-		$data ['form'] = $this->form->build_form ( $this->email_form->get_form_fields_email (), '' );
171
+		$data ['page_title'] = gettext('Create Commission Rate');
172
+		$data ['form'] = $this->form->build_form($this->email_form->get_form_fields_email(), '');
173 173
 		
174
-		$this->load->view ( 'view_email_add_edit', $data );
174
+		$this->load->view('view_email_add_edit', $data);
175 175
 	}
176 176
 	function email_save() {
177
-		$add_array = $this->input->post ();
178
-		$data ['form'] = $this->form->build_form ( $this->email_form->get_form_fields_email (), $add_array );
177
+		$add_array = $this->input->post();
178
+		$data ['form'] = $this->form->build_form($this->email_form->get_form_fields_email(), $add_array);
179 179
 		if ($add_array ['id'] != '') {
180
-			$data ['page_title'] = gettext ( 'Edit email List' );
181
-			if ($this->form_validation->run () == FALSE) {
182
-				$data ['validation_errors'] = validation_errors ();
180
+			$data ['page_title'] = gettext('Edit email List');
181
+			if ($this->form_validation->run() == FALSE) {
182
+				$data ['validation_errors'] = validation_errors();
183 183
 				echo $data ['validation_errors'];
184 184
 				exit ();
185 185
 			} else {
186
-				$this->email_model->edit_email ( $add_array, $add_array ['id'] );
187
-				echo json_encode ( array (
186
+				$this->email_model->edit_email($add_array, $add_array ['id']);
187
+				echo json_encode(array(
188 188
 						"SUCCESS" => "Email list updated successfully!" 
189
-				) );
189
+				));
190 190
 				exit ();
191 191
 			}
192 192
 		} else {
193
-			$data ['page_title'] = gettext ( 'Create Email List' );
194
-			if ($this->form_validation->run () == FALSE) {
195
-				$data ['validation_errors'] = validation_errors ();
193
+			$data ['page_title'] = gettext('Create Email List');
194
+			if ($this->form_validation->run() == FALSE) {
195
+				$data ['validation_errors'] = validation_errors();
196 196
 				echo $data ['validation_errors'];
197 197
 				exit ();
198 198
 			} else {
199
-				$this->email_model->add_email ( $add_array );
200
-				echo json_encode ( array (
199
+				$this->email_model->add_email($add_array);
200
+				echo json_encode(array(
201 201
 						"SUCCESS" => "Email list added successfully!" 
202
-				) );
202
+				));
203 203
 				exit ();
204 204
 			}
205 205
 		}
206 206
 	}
207 207
 	function email_re_send($edit_data) {
208
-		$this->email_lib->send_email ( '', $edit_data, '', $edit_data ['attachment'], 1 );
209
-		$this->session->set_flashdata ( 'astpp_errormsg', 'Email resend successfully!' );
210
-		redirect ( base_url () . '/email/email_history_list/' );
208
+		$this->email_lib->send_email('', $edit_data, '', $edit_data ['attachment'], 1);
209
+		$this->session->set_flashdata('astpp_errormsg', 'Email resend successfully!');
210
+		redirect(base_url().'/email/email_history_list/');
211 211
 	}
212 212
 	function email_view($edit_id = '') {
213
-		$data ['page_title'] = gettext ( 'View Email' );
214
-		$where = array (
213
+		$data ['page_title'] = gettext('View Email');
214
+		$where = array(
215 215
 				'id' => $edit_id 
216 216
 		);
217
-		$account = $this->db_model->getSelect ( "*", "mail_details", $where );
217
+		$account = $this->db_model->getSelect("*", "mail_details", $where);
218 218
 		if ($account->num_rows > 0) {
219
-			foreach ( $account->result_array () as $key => $value ) {
219
+			foreach ($account->result_array() as $key => $value) {
220 220
 				$edit_data = $value;
221 221
 			}
222 222
 			if ($edit_data ['status'] == 1) {
@@ -224,65 +224,65 @@  discard block
 block discarded – undo
224 224
 			} else {
225 225
 				$edit_data ['status'] = 'Sent';
226 226
 			}
227
-			$data ['form'] = $this->form->build_form ( $this->email_form->get_form_fields_email_view (), $edit_data );
227
+			$data ['form'] = $this->form->build_form($this->email_form->get_form_fields_email_view(), $edit_data);
228 228
 			
229
-			$this->load->view ( 'view_email_add_edit', $data );
229
+			$this->load->view('view_email_add_edit', $data);
230 230
 		} else {
231
-			redirect ( base_url () . 'email/email_history_list/' );
231
+			redirect(base_url().'email/email_history_list/');
232 232
 		}
233 233
 	}
234 234
 	function email_view_customer($edit_id = '') {
235
-		$data ['page_title'] = gettext ( 'View Email' );
236
-		$where = array (
235
+		$data ['page_title'] = gettext('View Email');
236
+		$where = array(
237 237
 				'id' => $edit_id 
238 238
 		);
239
-		$account = $this->db_model->getSelect ( "*", "mail_details", $where );
239
+		$account = $this->db_model->getSelect("*", "mail_details", $where);
240 240
 		if ($account->num_rows > 0) {
241
-			foreach ( $account->result_array () as $key => $value ) {
241
+			foreach ($account->result_array() as $key => $value) {
242 242
 				$edit_data = $value;
243 243
 			}
244
-			$data ['form'] = $this->form->build_form ( $this->email_form->get_form_fields_email_view_cus (), $edit_data );
245
-			$this->load->view ( 'view_email_add_edit', $data );
244
+			$data ['form'] = $this->form->build_form($this->email_form->get_form_fields_email_view_cus(), $edit_data);
245
+			$this->load->view('view_email_add_edit', $data);
246 246
 		} else {
247
-			redirect ( base_url () . 'email/email_history_list/' . $edit_id );
247
+			redirect(base_url().'email/email_history_list/'.$edit_id);
248 248
 		}
249 249
 	}
250 250
 	function email_delete($id) {
251
-		$this->email_model->remove_email ( $id );
252
-		$this->session->set_flashdata ( 'astpp_notification', 'Email removed successfully!' );
253
-		redirect ( base_url () . '/email/email_history_list/' );
251
+		$this->email_model->remove_email($id);
252
+		$this->session->set_flashdata('astpp_notification', 'Email removed successfully!');
253
+		redirect(base_url().'/email/email_history_list/');
254 254
 	}
255 255
 	function email_delete_customer($accounttype, $accountid, $id) {
256
-		$this->email_model->remove_email ( $id );
257
-		$where = array (
256
+		$this->email_model->remove_email($id);
257
+		$where = array(
258 258
 				'id' => $id 
259 259
 		);
260
-		$account = $this->db_model->getSelect ( "*", "mail_details", $where );
261
-		foreach ( $account->result_array () as $key => $value ) {
260
+		$account = $this->db_model->getSelect("*", "mail_details", $where);
261
+		foreach ($account->result_array() as $key => $value) {
262 262
 			$edit_data = $value;
263 263
 		}
264
-		$url = "accounts/" . $accounttype . "_emailhistory/$accountid/";
265
-		$this->session->set_flashdata ( 'astpp_notification', 'Email removed successfully!' );
266
-		$this->load->module ( 'accounts/accounts' );
267
-		redirect ( base_url () . $url );
264
+		$url = "accounts/".$accounttype."_emailhistory/$accountid/";
265
+		$this->session->set_flashdata('astpp_notification', 'Email removed successfully!');
266
+		$this->load->module('accounts/accounts');
267
+		redirect(base_url().$url);
268 268
 	}
269 269
 	function email_mass() {
270
-		$account_data = $this->session->userdata ( "accountinfo" );
270
+		$account_data = $this->session->userdata("accountinfo");
271 271
 		if ($account_data ['type'] == '1' || $account_data ['type'] == 0 || $account_data ['type'] == 3)
272
-			redirect ( base_url () . '/astpp/dashboard/' );
273
-		$data ['username'] = $this->session->userdata ( 'user_name' );
274
-		$data ['page_title'] = gettext ( 'Email Mass' );
275
-		$data ['form'] = $this->form->build_form ( $this->email_form->build_list_for_email_client_area (), '' );
276
-		$this->load->view ( 'view_email_client_area', $data );
272
+			redirect(base_url().'/astpp/dashboard/');
273
+		$data ['username'] = $this->session->userdata('user_name');
274
+		$data ['page_title'] = gettext('Email Mass');
275
+		$data ['form'] = $this->form->build_form($this->email_form->build_list_for_email_client_area(), '');
276
+		$this->load->view('view_email_client_area', $data);
277 277
 	}
278 278
 	/* Mass Email */
279 279
 	function attachment_icons($select = "", $table = "", $attachement = "") {
280 280
 		if ($attachement != "") {
281
-			$array = explode ( ",", $attachement );
281
+			$array = explode(",", $attachement);
282 282
 			$str = '';
283
-			foreach ( $array as $key => $val ) {
284
-				$link = base_url () . "email/email_history_list_attachment/" . $val;
285
-				$str .= "<a href='" . $link . "' title='" . $val . "' class='btn btn-royelblue btn-sm'><i class='fa fa-paperclip fa-fw'></i></a>&nbsp;&nbsp;";
283
+			foreach ($array as $key => $val) {
284
+				$link = base_url()."email/email_history_list_attachment/".$val;
285
+				$str .= "<a href='".$link."' title='".$val."' class='btn btn-royelblue btn-sm'><i class='fa fa-paperclip fa-fw'></i></a>&nbsp;&nbsp;";
286 286
 			}
287 287
 			return $str;
288 288
 		} else {
@@ -291,82 +291,82 @@  discard block
 block discarded – undo
291 291
 	}
292 292
 	function email_client_get() {
293 293
 		$files = $_FILES;
294
-		$add_array = $this->input->post ();
295
-		$add_array ['page_title'] = gettext ( 'Compose email' );
294
+		$add_array = $this->input->post();
295
+		$add_array ['page_title'] = gettext('Compose email');
296 296
 		$nooffile = $files ['file'] ['name'];
297
-		$count = count ( $nooffile );
297
+		$count = count($nooffile);
298 298
 		$add_array ['attachment'] = '';
299 299
 		$add_array ['file'] = '';
300
-		for($i = 0; $i < $count; $i ++) {
300
+		for ($i = 0; $i < $count; $i++) {
301 301
 			$tmp_name [] = $files ['file'] ['tmp_name'] [$i];
302 302
 			if ($files ['file'] ['error'] [$i] == 0) {
303 303
 				$cur_name = $files ['file'] ['name'] [$i];
304
-				$parts = explode ( ".", $cur_name );
305
-				$add_array ['attachment'] .= date ( 'ymdhis' ) . $i . '.' . $parts [1] . ',';
306
-				$add_array ['file'] .= date ( 'ymdhis' ) . $i . '.' . $parts [1] . ',';
304
+				$parts = explode(".", $cur_name);
305
+				$add_array ['attachment'] .= date('ymdhis').$i.'.'.$parts [1].',';
306
+				$add_array ['file'] .= date('ymdhis').$i.'.'.$parts [1].',';
307 307
 				$uploadedFile1 = $files ['file'] ['tmp_name'] [$i];
308 308
 				$user_name = 'inextrix';
309
-				$actual_file_name = date ( 'ymdhis' ) . $i . '.' . $parts [1];
310
-				$dir_path = getcwd () . "/attachments/";
311
-				$path = $dir_path . $actual_file_name;
312
-				if (move_uploaded_file ( $uploadedFile1, $path )) {
313
-					$this->session->set_flashdata ( 'astpp_errormsg', 'files added successfully!' );
309
+				$actual_file_name = date('ymdhis').$i.'.'.$parts [1];
310
+				$dir_path = getcwd()."/attachments/";
311
+				$path = $dir_path.$actual_file_name;
312
+				if (move_uploaded_file($uploadedFile1, $path)) {
313
+					$this->session->set_flashdata('astpp_errormsg', 'files added successfully!');
314 314
 				} else {
315
-					$this->session->set_flashdata ( 'astpp_errormsg', 'Please try again   !' );
315
+					$this->session->set_flashdata('astpp_errormsg', 'Please try again   !');
316 316
 				}
317 317
 			}
318 318
 		}
319
-		$add_array ['attachment'] = trim ( $add_array ['attachment'], ',' );
320
-		$add_array ['file'] = trim ( $add_array ['file'], ',' );
321
-		$add_array ['email'] = explode ( ",", $add_array ['to'] );
322
-		$this->email_model->multipal_email ( $add_array );
323
-		$screen_path = getcwd () . "/cron";
324
-		$screen_filename = "Email_Broadcast_" . strtotime ( 'now' );
325
-		$command = "cd " . $screen_path . " && /usr/bin/screen -d -m -S  $screen_filename php cron.php BroadcastEmail";
326
-		exec ( $command );
327
-		$this->session->set_flashdata ( 'astpp_errormsg', 'Email broad cast successfully!' );
328
-		redirect ( base_url () . 'email/email_history_list/' );
319
+		$add_array ['attachment'] = trim($add_array ['attachment'], ',');
320
+		$add_array ['file'] = trim($add_array ['file'], ',');
321
+		$add_array ['email'] = explode(",", $add_array ['to']);
322
+		$this->email_model->multipal_email($add_array);
323
+		$screen_path = getcwd()."/cron";
324
+		$screen_filename = "Email_Broadcast_".strtotime('now');
325
+		$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S  $screen_filename php cron.php BroadcastEmail";
326
+		exec($command);
327
+		$this->session->set_flashdata('astpp_errormsg', 'Email broad cast successfully!');
328
+		redirect(base_url().'email/email_history_list/');
329 329
 		exit ();
330 330
 	}
331 331
 	function email_client_area() {
332
-		$add_array = $this->input->post ();
332
+		$add_array = $this->input->post();
333 333
 		if ($add_array ['temp'] == '') {
334 334
 			$subject = '';
335 335
 			$body = '';
336 336
 		} else {
337
-			$where = array (
337
+			$where = array(
338 338
 					'id' => $add_array ['temp'] 
339 339
 			);
340
-			$account = $this->db_model->getSelect ( "subject,template", "default_templates", $where );
341
-			$account_data = $account->result_array ();
342
-			$subject = isset ( $account_data [0] ['subject'] ) ? $account_data [0] ['subject'] : '';
343
-			$body = isset ( $account_data [0] ['template'] ) ? $account_data [0] ['template'] : '';
340
+			$account = $this->db_model->getSelect("subject,template", "default_templates", $where);
341
+			$account_data = $account->result_array();
342
+			$subject = isset ($account_data [0] ['subject']) ? $account_data [0] ['subject'] : '';
343
+			$body = isset ($account_data [0] ['template']) ? $account_data [0] ['template'] : '';
344 344
 		}
345
-		$count_all = $this->email_model->get_email_client_data ( $add_array );
346
-		$email_arr = array ();
347
-		$id_arr = array ();
348
-		foreach ( $count_all as $key => $value ) {
345
+		$count_all = $this->email_model->get_email_client_data($add_array);
346
+		$email_arr = array();
347
+		$id_arr = array();
348
+		foreach ($count_all as $key => $value) {
349 349
 			$value = $value;
350 350
 			if ($value ['email'] != '') {
351 351
 				$email_arr [$value ['email']] = $value ['email'];
352 352
 				$id_arr [] = $value ['id'];
353 353
 			}
354 354
 		}
355
-		if (empty ( $email_arr )) {
356
-			$this->session->set_flashdata ( 'astpp_notification', 'No record found! ' );
357
-			redirect ( base_url () . 'email/email_mass/' );
355
+		if (empty ($email_arr)) {
356
+			$this->session->set_flashdata('astpp_notification', 'No record found! ');
357
+			redirect(base_url().'email/email_mass/');
358 358
 		}
359 359
 		$to_email = $email_arr;
360 360
 		
361 361
 		$to_id = $id_arr;
362
-		$to_send_mail = implode ( ",", $to_email );
362
+		$to_send_mail = implode(",", $to_email);
363 363
 		if ($to_send_mail != '') {
364 364
 			$add_arr ['email'] = $email_arr;
365 365
 		}
366
-		$data ['username'] = $this->session->userdata ( 'user_name' );
367
-		$data ['page_title'] = gettext ( 'Compose Email' );
368
-		$send_id = $this->db_model->getSelect ( "emailaddress", "invoice_conf", array () );
369
-		$send_id = $send_id->result_array ();
366
+		$data ['username'] = $this->session->userdata('user_name');
367
+		$data ['page_title'] = gettext('Compose Email');
368
+		$send_id = $this->db_model->getSelect("emailaddress", "invoice_conf", array());
369
+		$send_id = $send_id->result_array();
370 370
 		$send_id = $send_id [0] ['emailaddress'];
371 371
 		$add_arr ['template'] = $body;
372 372
 		$add_arr ['subject'] = $subject;
@@ -375,105 +375,105 @@  discard block
 block discarded – undo
375 375
 		$add_arr ['temp'] = $add_array ['temp'];
376 376
 		$add_arr ['to'] = $to_send_mail;
377 377
 		$add_arr ['temp'] = $add_array ['temp'];
378
-		$this->load->view ( 'view_email_brod', $add_arr );
378
+		$this->load->view('view_email_brod', $add_arr);
379 379
 	}
380 380
 	
381 381
 	/**
382 382
 	 * *****************************************************
383 383
 	 */
384 384
 	function email_history_list_customer() {
385
-		$add_array = $this->input->post ();
386
-		$where = array (
385
+		$add_array = $this->input->post();
386
+		$where = array(
387 387
 				'id' => $add_array ['id'] 
388 388
 		);
389
-		$account = $this->db_model->getSelect ( "*", "mail_details", $where );
390
-		foreach ( $account->result_array () as $key => $value ) {
389
+		$account = $this->db_model->getSelect("*", "mail_details", $where);
390
+		foreach ($account->result_array() as $key => $value) {
391 391
 			$edit_data = $value;
392 392
 		}
393
-		$this->load->module ( 'accounts/accounts' );
394
-		redirect ( base_url () . 'accounts/customer_edit/' . $value ['accountid'] );
393
+		$this->load->module('accounts/accounts');
394
+		redirect(base_url().'accounts/customer_edit/'.$value ['accountid']);
395 395
 	}
396 396
 	function email_history_list() {
397
-		$data ['logintype'] = $this->session->userdata ( 'logintype' );
398
-		$data ['username'] = $this->session->userdata ( 'user_name' );
397
+		$data ['logintype'] = $this->session->userdata('logintype');
398
+		$data ['username'] = $this->session->userdata('user_name');
399 399
 		$data ['search_flag'] = true;
400
-		$this->session->set_userdata ( 'advance_search', 0 );
401
-		$data ['page_title'] = gettext ( 'Email History List' );
402
-		$data ['grid_fields'] = $this->email_form->build_list_for_email ();
403
-		$data ["grid_buttons"] = $this->email_form->build_grid_buttons_email ();
404
-		$data ['form_search'] = $this->form->build_serach_form ( $this->email_form->get_email_history_search_form () );
405
-		$this->load->view ( 'view_email_list', $data );
400
+		$this->session->set_userdata('advance_search', 0);
401
+		$data ['page_title'] = gettext('Email History List');
402
+		$data ['grid_fields'] = $this->email_form->build_list_for_email();
403
+		$data ["grid_buttons"] = $this->email_form->build_grid_buttons_email();
404
+		$data ['form_search'] = $this->form->build_serach_form($this->email_form->get_email_history_search_form());
405
+		$this->load->view('view_email_list', $data);
406 406
 	}
407 407
 	function email_history_list_json() {
408
-		$data ['logintype'] = $this->session->userdata ( 'logintype' );
409
-		$json_data = array ();
410
-		$count_all = $this->email_model->get_email_list ( false );
411
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
408
+		$data ['logintype'] = $this->session->userdata('logintype');
409
+		$json_data = array();
410
+		$count_all = $this->email_model->get_email_list(false);
411
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
412 412
 		$json_data = $paging_data ["json_paging"];
413
-		$query = $this->email_model->get_email_list ( true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
414
-		$grid_fields = json_decode ( $this->email_form->build_list_for_email () );
415
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
416
-		echo json_encode ( $json_data );
413
+		$query = $this->email_model->get_email_list(true, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
414
+		$grid_fields = json_decode($this->email_form->build_list_for_email());
415
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
416
+		echo json_encode($json_data);
417 417
 	}
418 418
 	function customer_mail_record($accountid, $accounttype) {
419
-		$json_data = array ();
420
-		$count_all = $this->email_model->customer_get_email_list ( false, $accountid, "", "" );
421
-		$paging_data = $this->form->load_grid_config ( $count_all, $_GET ['rp'], $_GET ['page'] );
419
+		$json_data = array();
420
+		$count_all = $this->email_model->customer_get_email_list(false, $accountid, "", "");
421
+		$paging_data = $this->form->load_grid_config($count_all, $_GET ['rp'], $_GET ['page']);
422 422
 		$json_data = $paging_data ["json_paging"];
423
-		$query = $this->email_model->customer_get_email_list ( true, $accountid, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"] );
424
-		$grid_fields = json_decode ( $this->email_form->build_list_for_email_customer ( $accountid, $accounttype ) );
425
-		$json_data ['rows'] = $this->form->build_grid ( $query, $grid_fields );
426
-		echo json_encode ( $json_data );
423
+		$query = $this->email_model->customer_get_email_list(true, $accountid, $paging_data ["paging"] ["start"], $paging_data ["paging"] ["page_no"]);
424
+		$grid_fields = json_decode($this->email_form->build_list_for_email_customer($accountid, $accounttype));
425
+		$json_data ['rows'] = $this->form->build_grid($query, $grid_fields);
426
+		echo json_encode($json_data);
427 427
 	}
428 428
 	function email_delete_multiple() {
429
-		$ids = $this->input->post ( "selected_ids", true );
429
+		$ids = $this->input->post("selected_ids", true);
430 430
 		$where = "id IN ($ids)";
431
-		$this->db->where ( $where );
432
-		echo $this->db->delete ( "email" );
431
+		$this->db->where($where);
432
+		echo $this->db->delete("email");
433 433
 	}
434 434
 	function email_send_multipal() {
435
-		$add_array = $this->input->post ();
435
+		$add_array = $this->input->post();
436 436
 		if ($add_array ['email'] == '' || $add_array ['subject'] == '' || $add_array ['template'] == '') {
437
-			$this->session->set_flashdata ( 'astpp_notification', 'Email address not found!' );
438
-			redirect ( base_url () . '/email/email_client_area/' );
437
+			$this->session->set_flashdata('astpp_notification', 'Email address not found!');
438
+			redirect(base_url().'/email/email_client_area/');
439 439
 		}
440
-		$this->email_model->multipal_email ( $add_array );
440
+		$this->email_model->multipal_email($add_array);
441 441
 		$screen_path = "/var/www/html/ITPLATP/cron";
442
-		$screen_filename = "Email_Broadcast_" . strtotime ( 'now' );
443
-		$command = "cd " . $screen_path . " && /usr/bin/screen -d -m -S  $screen_filename php cron.php BroadcastEmail";
444
-		exec ( $command );
445
-		$this->session->set_flashdata ( 'astpp_errormsg', 'Email broad cast successfully!' );
446
-		redirect ( base_url () . 'email/email_history_list/' );
442
+		$screen_filename = "Email_Broadcast_".strtotime('now');
443
+		$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S  $screen_filename php cron.php BroadcastEmail";
444
+		exec($command);
445
+		$this->session->set_flashdata('astpp_errormsg', 'Email broad cast successfully!');
446
+		redirect(base_url().'email/email_history_list/');
447 447
 	}
448 448
 	function email_history_list_search() {
449
-		$ajax_search = $this->input->post ( 'ajax_search', 0 );
449
+		$ajax_search = $this->input->post('ajax_search', 0);
450 450
 		
451
-		if ($this->input->post ( 'advance_search', TRUE ) == 1) {
452
-			$this->session->set_userdata ( 'advance_search', $this->input->post ( 'advance_search' ) );
453
-			$action = $this->input->post ();
454
-			unset ( $action ['action'] );
455
-			unset ( $action ['advance_search'] );
456
-			$this->session->set_userdata ( 'email_search_list', $action );
451
+		if ($this->input->post('advance_search', TRUE) == 1) {
452
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
453
+			$action = $this->input->post();
454
+			unset ($action ['action']);
455
+			unset ($action ['advance_search']);
456
+			$this->session->set_userdata('email_search_list', $action);
457 457
 		}
458 458
 		if (@$ajax_search != 1) {
459
-			redirect ( base_url () . 'email/email_history_list/' );
459
+			redirect(base_url().'email/email_history_list/');
460 460
 		}
461 461
 	}
462 462
 	function email_history_list_clearsearchfilter() {
463
-		$this->session->set_userdata ( 'advance_search', 0 );
464
-		$this->session->set_userdata ( 'email_search', "" );
463
+		$this->session->set_userdata('advance_search', 0);
464
+		$this->session->set_userdata('email_search', "");
465 465
 	}
466 466
 	/*
467 467
 	 * Purpose : Add following code for download attached file
468 468
 	 * Version 2.1
469 469
 	 */
470 470
 	function email_history_list_attachment($file_name) {
471
-		if (file_exists ( getcwd () . '/attachments/' . $file_name )) {
472
-			header ( 'Content-Type: application/octet-stream' );
473
-			header ( 'Content-Disposition: attachment; filename=' . $file_name );
474
-			ob_clean ();
475
-			flush ();
476
-			readfile ( getcwd () . '/attachments/' . $file_name );
471
+		if (file_exists(getcwd().'/attachments/'.$file_name)) {
472
+			header('Content-Type: application/octet-stream');
473
+			header('Content-Disposition: attachment; filename='.$file_name);
474
+			ob_clean();
475
+			flush();
476
+			readfile(getcwd().'/attachments/'.$file_name);
477 477
 		}
478 478
 	}
479 479
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@  discard block
 block discarded – undo
33 33
 		$this->load->model ( 'email_model' );
34 34
 		$this->load->library ( 'csvreader' );
35 35
 		$this->load->library ( 'astpp/email_lib' );
36
-		if ($this->session->userdata ( 'user_login' ) == FALSE)
37
-			redirect ( base_url () . '/astpp/login' );
36
+		if ($this->session->userdata ( 'user_login' ) == FALSE) {
37
+					redirect ( base_url () . '/astpp/login' );
38
+		}
38 39
 	}
39 40
 	function email_edit($edit_id = '') {
40 41
 		$data ['page_title'] = gettext ( 'Edit Email List' );
@@ -268,8 +269,9 @@  discard block
 block discarded – undo
268 269
 	}
269 270
 	function email_mass() {
270 271
 		$account_data = $this->session->userdata ( "accountinfo" );
271
-		if ($account_data ['type'] == '1' || $account_data ['type'] == 0 || $account_data ['type'] == 3)
272
-			redirect ( base_url () . '/astpp/dashboard/' );
272
+		if ($account_data ['type'] == '1' || $account_data ['type'] == 0 || $account_data ['type'] == 3) {
273
+					redirect ( base_url () . '/astpp/dashboard/' );
274
+		}
273 275
 		$data ['username'] = $this->session->userdata ( 'user_name' );
274 276
 		$data ['page_title'] = gettext ( 'Email Mass' );
275 277
 		$data ['form'] = $this->form->build_form ( $this->email_form->build_list_for_email_client_area (), '' );
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/email/libraries/email_form.php 2 patches
Spacing   +249 added lines, -249 removed lines patch added patch discarded remove patch
@@ -21,26 +21,26 @@  discard block
 block discarded – undo
21 21
 // You should have received a copy of the GNU Affero General Public License
22 22
 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 23
 // ##############################################################################
24
-if (! defined ( 'BASEPATH' ))
25
-	exit ( 'No direct script access allowed' );
24
+if ( ! defined('BASEPATH'))
25
+	exit ('No direct script access allowed');
26 26
 class Email_form {
27 27
 	function __construct($library_name = '') {
28
-		$this->CI = & get_instance ();
28
+		$this->CI = & get_instance();
29 29
 	}
30 30
 	function get_form_fields_email() {
31
-		$form ['forms'] = array (
32
-				base_url () . 'email/email_re_send/',
33
-				array (
31
+		$form ['forms'] = array(
32
+				base_url().'email/email_re_send/',
33
+				array(
34 34
 						'id' => 'commission_form',
35 35
 						'method' => 'POST',
36 36
 						'name' => 'commission_form' 
37 37
 				) 
38 38
 		);
39
-		$form [gettext ( 'Resend Email' )] = array (
40
-				array (
39
+		$form [gettext('Resend Email')] = array(
40
+				array(
41 41
 						'',
42 42
 						'HIDDEN',
43
-						array (
43
+						array(
44 44
 								'name' => 'id' 
45 45
 						),
46 46
 						'',
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 						'',
49 49
 						'' 
50 50
 				),
51
-				array (
52
-						gettext ( 'To' ),
51
+				array(
52
+						gettext('To'),
53 53
 						'INPUT',
54
-						array (
54
+						array(
55 55
 								'name' => 'to',
56 56
 								'size' => '20',
57 57
 								'class' => "text field medium" 
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 						'tOOL TIP',
61 61
 						'' 
62 62
 				),
63
-				array (
64
-						gettext ( 'From' ),
63
+				array(
64
+						gettext('From'),
65 65
 						'INPUT',
66
-						array (
66
+						array(
67 67
 								'name' => 'from',
68 68
 								'size' => '20',
69 69
 								'class' => "text field medium" 
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 						'tOOL TIP',
73 73
 						'' 
74 74
 				),
75
-				array (
76
-						gettext ( 'Subject' ),
75
+				array(
76
+						gettext('Subject'),
77 77
 						'INPUT',
78
-						array (
78
+						array(
79 79
 								'name' => 'subject',
80 80
 								'size' => '20',
81 81
 								'class' => "text field medium" 
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 						'tOOL TIP',
85 85
 						'' 
86 86
 				),
87
-				array (
88
-						gettext ( 'Body' ),
87
+				array(
88
+						gettext('Body'),
89 89
 						'TEXTAREA',
90
-						array (
90
+						array(
91 91
 								'name' => 'body',
92 92
 								'size' => '20',
93 93
 								'class' => "text field medium" 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 						'' 
98 98
 				),
99 99
 				
100
-				array (
101
-						gettext ( 'Status' ),
100
+				array(
101
+						gettext('Status'),
102 102
 						'status',
103 103
 						'SELECT',
104 104
 						'',
@@ -114,17 +114,17 @@  discard block
 block discarded – undo
114 114
 				) 
115 115
 		)
116 116
 		;
117
-		$form ['button_cancel'] = array (
117
+		$form ['button_cancel'] = array(
118 118
 				'name' => 'action',
119
-				'content' => gettext ( 'Cancel' ),
119
+				'content' => gettext('Cancel'),
120 120
 				'value' => 'cancel',
121 121
 				'type' => 'button',
122 122
 				'class' => 'btn btn-line-sky margin-x-10',
123 123
 				'onclick' => 'return redirect_page(\'NULL\')' 
124 124
 		);
125
-		$form ['button_save'] = array (
125
+		$form ['button_save'] = array(
126 126
 				'name' => 'action',
127
-				'content' => gettext ( 'Save' ),
127
+				'content' => gettext('Save'),
128 128
 				'value' => 'save',
129 129
 				'id' => 'submit',
130 130
 				'type' => 'submit',
@@ -135,19 +135,19 @@  discard block
 block discarded – undo
135 135
 	}
136 136
 	function get_form_fields_email_edit() {
137 137
 		$readable = 'disabled';
138
-		$form ['forms'] = array (
139
-				base_url () . 'email/email_resend/',
140
-				array (
138
+		$form ['forms'] = array(
139
+				base_url().'email/email_resend/',
140
+				array(
141 141
 						'id' => 'commission_form',
142 142
 						'method' => 'POST',
143 143
 						'name' => 'commission_form' 
144 144
 				) 
145 145
 		);
146
-		$form [gettext ( 'Resent Email' )] = array (
147
-				array (
146
+		$form [gettext('Resent Email')] = array(
147
+				array(
148 148
 						'',
149 149
 						'HIDDEN',
150
-						array (
150
+						array(
151 151
 								'name' => 'id' 
152 152
 						),
153 153
 						'',
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 						'',
156 156
 						'' 
157 157
 				),
158
-				array (
158
+				array(
159 159
 						'',
160 160
 						'HIDDEN',
161
-						array (
161
+						array(
162 162
 								'name' => 'status' 
163 163
 						),
164 164
 						'',
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 						'',
167 167
 						'' 
168 168
 				),
169
-				array (
170
-						gettext ( 'From' ),
169
+				array(
170
+						gettext('From'),
171 171
 						'TEXTAREA',
172
-						array (
172
+						array(
173 173
 								'name' => 'from',
174 174
 								'size' => '20',
175 175
 								'cols' => 50,
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
 						'tOOL TIP',
182 182
 						'' 
183 183
 				),
184
-				array (
185
-						gettext ( 'To' ),
184
+				array(
185
+						gettext('To'),
186 186
 						'TEXTAREA',
187
-						array (
187
+						array(
188 188
 								'name' => 'to',
189 189
 								'size' => '20',
190 190
 								'cols' => 50,
@@ -196,10 +196,10 @@  discard block
 block discarded – undo
196 196
 						'tOOL TIP',
197 197
 						'' 
198 198
 				),
199
-				array (
200
-						gettext ( 'Subject' ),
199
+				array(
200
+						gettext('Subject'),
201 201
 						'TEXTAREA',
202
-						array (
202
+						array(
203 203
 								'name' => 'subject',
204 204
 								'size' => '20',
205 205
 								'cols' => 50,
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
 						'tOOL TIP',
211 211
 						'' 
212 212
 				),
213
-				array (
214
-						gettext ( 'Body' ),
213
+				array(
214
+						gettext('Body'),
215 215
 						'TEXTAREA',
216
-						array (
216
+						array(
217 217
 								'name' => 'body',
218 218
 								'size' => '20',
219 219
 								'cols' => 50,
@@ -226,17 +226,17 @@  discard block
 block discarded – undo
226 226
 				) 
227 227
 		)
228 228
 		;
229
-		$form ['button_cancel'] = array (
229
+		$form ['button_cancel'] = array(
230 230
 				'name' => 'action',
231
-				'content' => gettext ( 'Close' ),
231
+				'content' => gettext('Close'),
232 232
 				'value' => 'cancel',
233 233
 				'type' => 'button',
234 234
 				'class' => 'btn btn-line-sky margin-x-10',
235 235
 				'onclick' => 'return redirect_page(\'NULL\')' 
236 236
 		);
237
-		$form ['button_save'] = array (
237
+		$form ['button_save'] = array(
238 238
 				'name' => 'action',
239
-				'content' => gettext ( 'Sent' ),
239
+				'content' => gettext('Sent'),
240 240
 				'value' => 'save',
241 241
 				'id' => 'button',
242 242
 				'type' => 'submit',
@@ -246,19 +246,19 @@  discard block
 block discarded – undo
246 246
 	}
247 247
 	function get_form_fields_email_view() {
248 248
 		$readable = 'disabled';
249
-		$form ['forms'] = array (
250
-				base_url () . 'email/email_history_list/',
251
-				array (
249
+		$form ['forms'] = array(
250
+				base_url().'email/email_history_list/',
251
+				array(
252 252
 						'id' => 'commission_form',
253 253
 						'method' => 'POST',
254 254
 						'name' => 'commission_form' 
255 255
 				) 
256 256
 		);
257
-		$form [gettext ( 'View Email' )] = array (
258
-				array (
257
+		$form [gettext('View Email')] = array(
258
+				array(
259 259
 						'',
260 260
 						'HIDDEN',
261
-						array (
261
+						array(
262 262
 								'name' => 'id' 
263 263
 						),
264 264
 						'',
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 						'',
267 267
 						'' 
268 268
 				),
269
-				array (
269
+				array(
270 270
 						'',
271 271
 						'HIDDEN',
272
-						array (
272
+						array(
273 273
 								'name' => 'status' 
274 274
 						),
275 275
 						'',
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
 						'',
278 278
 						'' 
279 279
 				),
280
-				array (
281
-						gettext ( 'From' ),
280
+				array(
281
+						gettext('From'),
282 282
 						'TEXTAREA',
283
-						array (
283
+						array(
284 284
 								'name' => 'from',
285 285
 								'size' => '20',
286 286
 								'cols' => 50,
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 						'tOOL TIP',
293 293
 						'' 
294 294
 				),
295
-				array (
296
-						gettext ( 'To' ),
295
+				array(
296
+						gettext('To'),
297 297
 						'TEXTAREA',
298
-						array (
298
+						array(
299 299
 								'name' => 'to',
300 300
 								'size' => '20',
301 301
 								'cols' => 50,
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 						'tOOL TIP',
309 309
 						'' 
310 310
 				),
311
-				array (
312
-						gettext ( 'Subject' ),
311
+				array(
312
+						gettext('Subject'),
313 313
 						'TEXTAREA',
314
-						array (
314
+						array(
315 315
 								'name' => 'subject',
316 316
 								'size' => '20',
317 317
 								'cols' => 50,
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 						'tOOL TIP',
325 325
 						'' 
326 326
 				),
327
-				array (
328
-						gettext ( 'Body' ),
327
+				array(
328
+						gettext('Body'),
329 329
 						'TEXTAREA',
330
-						array (
330
+						array(
331 331
 								'name' => 'body',
332 332
 								'size' => '20',
333 333
 								'cols' => 50,
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
 						'tOOL TIP',
341 341
 						'' 
342 342
 				),
343
-				array (
344
-						gettext ( 'Status' ),
343
+				array(
344
+						gettext('Status'),
345 345
 						'INPUT',
346
-						array (
346
+						array(
347 347
 								'name' => 'status',
348 348
 								'size' => '20',
349 349
 								'cols' => 50,
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
 				) 
359 359
 		)
360 360
 		;
361
-		$form ['button_save'] = array (
361
+		$form ['button_save'] = array(
362 362
 				'name' => 'action',
363
-				'content' => gettext ( 'Close' ),
363
+				'content' => gettext('Close'),
364 364
 				'value' => 'cancel',
365 365
 				'type' => 'button',
366 366
 				'class' => 'btn btn-line-sky margin-x-10',
@@ -370,19 +370,19 @@  discard block
 block discarded – undo
370 370
 	}
371 371
 	function get_form_fields_email_view_cus() {
372 372
 		$readable = 'disabled';
373
-		$form ['forms'] = array (
374
-				base_url () . 'email/email_history_list_customer/',
375
-				array (
373
+		$form ['forms'] = array(
374
+				base_url().'email/email_history_list_customer/',
375
+				array(
376 376
 						'id' => 'commission_form',
377 377
 						'method' => 'POST',
378 378
 						'name' => 'commission_form' 
379 379
 				) 
380 380
 		);
381
-		$form [gettext ( 'View Email' )] = array (
382
-				array (
381
+		$form [gettext('View Email')] = array(
382
+				array(
383 383
 						'',
384 384
 						'HIDDEN',
385
-						array (
385
+						array(
386 386
 								'name' => 'id' 
387 387
 						),
388 388
 						'',
@@ -390,10 +390,10 @@  discard block
 block discarded – undo
390 390
 						'',
391 391
 						'' 
392 392
 				),
393
-				array (
393
+				array(
394 394
 						'',
395 395
 						'HIDDEN',
396
-						array (
396
+						array(
397 397
 								'name' => 'status' 
398 398
 						),
399 399
 						'',
@@ -401,10 +401,10 @@  discard block
 block discarded – undo
401 401
 						'',
402 402
 						'' 
403 403
 				),
404
-				array (
405
-						gettext ( 'From' ),
404
+				array(
405
+						gettext('From'),
406 406
 						'TEXTAREA',
407
-						array (
407
+						array(
408 408
 								'name' => 'from',
409 409
 								'size' => '20',
410 410
 								'cols' => 50,
@@ -416,10 +416,10 @@  discard block
 block discarded – undo
416 416
 						'tOOL TIP',
417 417
 						'' 
418 418
 				),
419
-				array (
420
-						gettext ( 'To' ),
419
+				array(
420
+						gettext('To'),
421 421
 						'TEXTAREA',
422
-						array (
422
+						array(
423 423
 								'name' => 'to',
424 424
 								'size' => '20',
425 425
 								'cols' => 50,
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
 						'tOOL TIP',
432 432
 						'' 
433 433
 				),
434
-				array (
435
-						gettext ( 'Subject' ),
434
+				array(
435
+						gettext('Subject'),
436 436
 						'TEXTAREA',
437
-						array (
437
+						array(
438 438
 								'name' => 'subject',
439 439
 								'size' => '20',
440 440
 								'cols' => 50,
@@ -446,10 +446,10 @@  discard block
 block discarded – undo
446 446
 						'tOOL TIP',
447 447
 						'' 
448 448
 				),
449
-				array (
450
-						gettext ( 'Body' ),
449
+				array(
450
+						gettext('Body'),
451 451
 						'TEXTAREA',
452
-						array (
452
+						array(
453 453
 								'name' => 'body',
454 454
 								'size' => '20',
455 455
 								'cols' => 50,
@@ -462,9 +462,9 @@  discard block
 block discarded – undo
462 462
 						'' 
463 463
 				),
464 464
 				
465
-				array (
466
-						gettext ( 'Status' ),
467
-						array (
465
+				array(
466
+						gettext('Status'),
467
+						array(
468 468
 								'name' => 'status',
469 469
 								'disabled' => $readable,
470 470
 								'style' => 'width:20% !important;',
@@ -484,9 +484,9 @@  discard block
 block discarded – undo
484 484
 				) 
485 485
 		)
486 486
 		;
487
-		$form ['button_save'] = array (
487
+		$form ['button_save'] = array(
488 488
 				'name' => 'action',
489
-				'content' => gettext ( 'Close' ),
489
+				'content' => gettext('Close'),
490 490
 				'value' => 'cancel',
491 491
 				'type' => 'button',
492 492
 				'class' => 'btn btn-line-sky margin-x-10',
@@ -496,19 +496,19 @@  discard block
 block discarded – undo
496 496
 	}
497 497
 	function get_form_fields_email_view_cus_edit() {
498 498
 		$readable = 'disabled';
499
-		$form ['forms'] = array (
500
-				base_url () . 'email/email_resend_customer/',
501
-				array (
499
+		$form ['forms'] = array(
500
+				base_url().'email/email_resend_customer/',
501
+				array(
502 502
 						'id' => 'commission_form',
503 503
 						'method' => 'POST',
504 504
 						'name' => 'commission_form' 
505 505
 				) 
506 506
 		);
507
-		$form [gettext ( 'Resent Email' )] = array (
508
-				array (
507
+		$form [gettext('Resent Email')] = array(
508
+				array(
509 509
 						'',
510 510
 						'HIDDEN',
511
-						array (
511
+						array(
512 512
 								'name' => 'id' 
513 513
 						),
514 514
 						'',
@@ -516,10 +516,10 @@  discard block
 block discarded – undo
516 516
 						'',
517 517
 						'' 
518 518
 				),
519
-				array (
519
+				array(
520 520
 						'',
521 521
 						'HIDDEN',
522
-						array (
522
+						array(
523 523
 								'name' => 'status' 
524 524
 						),
525 525
 						'',
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
 						'',
528 528
 						'' 
529 529
 				),
530
-				array (
531
-						gettext ( 'From' ),
530
+				array(
531
+						gettext('From'),
532 532
 						'TEXTAREA',
533
-						array (
533
+						array(
534 534
 								'name' => 'from',
535 535
 								'size' => '20',
536 536
 								'cols' => 50,
@@ -542,10 +542,10 @@  discard block
 block discarded – undo
542 542
 						'tOOL TIP',
543 543
 						'' 
544 544
 				),
545
-				array (
546
-						gettext ( 'To' ),
545
+				array(
546
+						gettext('To'),
547 547
 						'TEXTAREA',
548
-						array (
548
+						array(
549 549
 								'name' => 'to',
550 550
 								'size' => '20',
551 551
 								'cols' => 50,
@@ -557,10 +557,10 @@  discard block
 block discarded – undo
557 557
 						'tOOL TIP',
558 558
 						'' 
559 559
 				),
560
-				array (
561
-						gettext ( 'Subject' ),
560
+				array(
561
+						gettext('Subject'),
562 562
 						'TEXTAREA',
563
-						array (
563
+						array(
564 564
 								'name' => 'subject',
565 565
 								'size' => '20',
566 566
 								'cols' => 50,
@@ -571,10 +571,10 @@  discard block
 block discarded – undo
571 571
 						'tOOL TIP',
572 572
 						'' 
573 573
 				),
574
-				array (
575
-						gettext ( 'Body' ),
574
+				array(
575
+						gettext('Body'),
576 576
 						'TEXTAREA',
577
-						array (
577
+						array(
578 578
 								'name' => 'body',
579 579
 								'size' => '20',
580 580
 								'cols' => 50,
@@ -586,17 +586,17 @@  discard block
 block discarded – undo
586 586
 						'' 
587 587
 				) 
588 588
 		);
589
-		$form ['button_cancel'] = array (
589
+		$form ['button_cancel'] = array(
590 590
 				'name' => 'action',
591
-				'content' => gettext ( 'Close' ),
591
+				'content' => gettext('Close'),
592 592
 				'value' => 'cancel',
593 593
 				'type' => 'button',
594 594
 				'class' => 'btn btn-line-sky margin-x-10',
595 595
 				'onclick' => 'return redirect_page(\'NULL\')' 
596 596
 		);
597
-		$form ['button_save'] = array (
597
+		$form ['button_save'] = array(
598 598
 				'name' => 'action',
599
-				'content' => gettext ( 'Sent' ),
599
+				'content' => gettext('Sent'),
600 600
 				'value' => 'save',
601 601
 				'id' => 'button',
602 602
 				'type' => 'submit',
@@ -606,9 +606,9 @@  discard block
 block discarded – undo
606 606
 	}
607 607
 	function build_list_for_email() {
608 608
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
609
-		$grid_field_arr = json_encode ( array (
610
-				array (
611
-						gettext ( "Date" ),
609
+		$grid_field_arr = json_encode(array(
610
+				array(
611
+						gettext("Date"),
612 612
 						"100",
613 613
 						"date",
614 614
 						"",
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 						"true",
619 619
 						"center" 
620 620
 				),
621
-				array (
622
-						gettext ( "Account" ),
621
+				array(
622
+						gettext("Account"),
623 623
 						"99",
624 624
 						"accountid",
625 625
 						"first_name,last_name,number",
@@ -629,8 +629,8 @@  discard block
 block discarded – undo
629 629
 						"true",
630 630
 						"center" 
631 631
 				),
632
-				array (
633
-						gettext ( "From" ),
632
+				array(
633
+						gettext("From"),
634 634
 						"145",
635 635
 						"from",
636 636
 						"",
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 						"true",
641 641
 						"center" 
642 642
 				),
643
-				array (
644
-						gettext ( "To" ),
643
+				array(
644
+						gettext("To"),
645 645
 						"140",
646 646
 						"to",
647 647
 						"",
@@ -651,8 +651,8 @@  discard block
 block discarded – undo
651 651
 						"true",
652 652
 						"center" 
653 653
 				),
654
-				array (
655
-						gettext ( "Subject" ),
654
+				array(
655
+						gettext("Subject"),
656 656
 						"180",
657 657
 						"subject",
658 658
 						"",
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
 						"true",
663 663
 						"center" 
664 664
 				),
665
-				array (
666
-						gettext ( "Body" ),
665
+				array(
666
+						gettext("Body"),
667 667
 						"320",
668 668
 						"body",
669 669
 						"",
@@ -673,8 +673,8 @@  discard block
 block discarded – undo
673 673
 						"true",
674 674
 						"center" 
675 675
 				),
676
-				array (
677
-						gettext ( "Attachement" ),
676
+				array(
677
+						gettext("Attachement"),
678 678
 						"120",
679 679
 						"attachment",
680 680
 						"attachment",
@@ -684,8 +684,8 @@  discard block
 block discarded – undo
684 684
 						"true",
685 685
 						"center" 
686 686
 				),
687
-				array (
688
-						gettext ( "Status" ),
687
+				array(
688
+						gettext("Status"),
689 689
 						"70",
690 690
 						"status",
691 691
 						"status",
@@ -695,36 +695,36 @@  discard block
 block discarded – undo
695 695
 						"true",
696 696
 						"center" 
697 697
 				),
698
-				array (
699
-						gettext ( "Action" ),
698
+				array(
699
+						gettext("Action"),
700 700
 						"100",
701 701
 						"",
702 702
 						"",
703 703
 						"",
704
-						array (
705
-								"RESEND" => array (
704
+						array(
705
+								"RESEND" => array(
706 706
 										"url" => "email/email_resend_edit/",
707 707
 										"mode" => "popup" 
708 708
 								),
709
-								"VIEW" => array (
709
+								"VIEW" => array(
710 710
 										"url" => "email/email_view/",
711 711
 										"mode" => "popup",
712 712
 										"layout" => "medium" 
713 713
 								),
714
-								"DELETE" => array (
714
+								"DELETE" => array(
715 715
 										"url" => "/email/email_delete/",
716 716
 										"mode" => "single" 
717 717
 								) 
718 718
 						) 
719 719
 				) 
720
-		) );
720
+		));
721 721
 		return $grid_field_arr;
722 722
 	}
723 723
 	function build_list_for_email_customer($accountid, $accounttype) {
724 724
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
725
-		$grid_field_arr = json_encode ( array (
726
-				array (
727
-						gettext ( "Date" ),
725
+		$grid_field_arr = json_encode(array(
726
+				array(
727
+						gettext("Date"),
728 728
 						"140",
729 729
 						"date",
730 730
 						"",
@@ -734,8 +734,8 @@  discard block
 block discarded – undo
734 734
 						"true",
735 735
 						"center" 
736 736
 				),
737
-				array (
738
-						gettext ( "Subject" ),
737
+				array(
738
+						gettext("Subject"),
739 739
 						"230",
740 740
 						"subject",
741 741
 						"",
@@ -745,8 +745,8 @@  discard block
 block discarded – undo
745 745
 						"true",
746 746
 						"center" 
747 747
 				),
748
-				array (
749
-						gettext ( "Body" ),
748
+				array(
749
+						gettext("Body"),
750 750
 						"350",
751 751
 						"body",
752 752
 						"",
@@ -756,8 +756,8 @@  discard block
 block discarded – undo
756 756
 						"true",
757 757
 						"center" 
758 758
 				),
759
-				array (
760
-						gettext ( "Attachement" ),
759
+				array(
760
+						gettext("Attachement"),
761 761
 						"120",
762 762
 						"attachment",
763 763
 						"attachment",
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
 						"true",
768 768
 						"center" 
769 769
 				),
770
-				array (
771
-						gettext ( "Status" ),
770
+				array(
771
+						gettext("Status"),
772 772
 						"100",
773 773
 						"status",
774 774
 						"status",
@@ -778,54 +778,54 @@  discard block
 block discarded – undo
778 778
 						"true",
779 779
 						"center" 
780 780
 				),
781
-				array (
782
-						gettext ( "Action" ),
781
+				array(
782
+						gettext("Action"),
783 783
 						"100",
784 784
 						"",
785 785
 						"",
786 786
 						"",
787
-						array (
788
-								"RESEND" => array (
787
+						array(
788
+								"RESEND" => array(
789 789
 										"url" => "email/email_resend_edit_customer/",
790 790
 										"mode" => "popup" 
791 791
 								),
792
-								"VIEW" => array (
792
+								"VIEW" => array(
793 793
 										"url" => "email/email_view_customer/",
794 794
 										"mode" => "popup",
795 795
 										"layout" => "medium" 
796 796
 								),
797
-								"DELETE" => array (
798
-										"url" => "email/email_delete_customer/" . $accounttype . "/" . $accountid . "/",
797
+								"DELETE" => array(
798
+										"url" => "email/email_delete_customer/".$accounttype."/".$accountid."/",
799 799
 										"mode" => "single" 
800 800
 								) 
801 801
 						) 
802 802
 				) 
803
-		) );
803
+		));
804 804
 		return $grid_field_arr;
805 805
 	}
806 806
 	function build_list_for_email_client_area() {
807
-		$logintype = $this->CI->session->userdata ( 'logintype' );
807
+		$logintype = $this->CI->session->userdata('logintype');
808 808
 		if ($logintype == 1 || $logintype == 5) {
809
-			$account_data = $this->CI->session->userdata ( "accountinfo" );
809
+			$account_data = $this->CI->session->userdata("accountinfo");
810 810
 			$loginid = $account_data ['id'];
811 811
 		} else {
812 812
 			$loginid = "0";
813 813
 		}
814
-		$form ['forms'] = array (
815
-				base_url () . 'email/email_client_area/',
816
-				array (
814
+		$form ['forms'] = array(
815
+				base_url().'email/email_client_area/',
816
+				array(
817 817
 						'id' => 'commission_form',
818 818
 						'method' => 'POST',
819 819
 						'name' => 'commission_form' 
820 820
 				) 
821 821
 		);
822
-		$form [gettext ( 'Filter' )] = array (
823
-				array (
824
-						gettext ( 'Rate Group' ),
822
+		$form [gettext('Filter')] = array(
823
+				array(
824
+						gettext('Rate Group'),
825 825
 						'pricelist_id',
826 826
 						'SELECT',
827 827
 						'',
828
-						array (
828
+						array(
829 829
 								"name" => "pricelist_id",
830 830
 								"rules" => "required" 
831 831
 						),
@@ -836,14 +836,14 @@  discard block
 block discarded – undo
836 836
 						'pricelists',
837 837
 						'build_dropdown',
838 838
 						'where_arr',
839
-						array (
839
+						array(
840 840
 								"status" => "0",
841 841
 								"reseller_id" => $loginid 
842 842
 						) 
843 843
 				),
844
-				array (
845
-						gettext ( 'Account Type' ),
846
-						array (
844
+				array(
845
+						gettext('Account Type'),
846
+						array(
847 847
 								'name' => 'posttoexternal',
848 848
 								'class' => 'posttoexternal',
849 849
 								'id' => 'posttoexternal' 
@@ -858,8 +858,8 @@  discard block
 block discarded – undo
858 858
 						'',
859 859
 						'set_account_type' 
860 860
 				),
861
-				array (
862
-						gettext ( 'Status' ),
861
+				array(
862
+						gettext('Status'),
863 863
 						'status',
864 864
 						'SELECT',
865 865
 						'',
@@ -871,8 +871,8 @@  discard block
 block discarded – undo
871 871
 						'',
872 872
 						'set_status' 
873 873
 				),
874
-				array (
875
-						gettext ( 'Entity Type' ),
874
+				array(
875
+						gettext('Entity Type'),
876 876
 						'type',
877 877
 						'SELECT',
878 878
 						'',
@@ -885,9 +885,9 @@  discard block
 block discarded – undo
885 885
 						'set_entity_type_email_mass' 
886 886
 				) 
887 887
 		);
888
-		$form [gettext ( 'Email Template' )] = array (
889
-				array (
890
-						gettext ( 'Email Template' ),
888
+		$form [gettext('Email Template')] = array(
889
+				array(
890
+						gettext('Email Template'),
891 891
 						'temp',
892 892
 						'SELECT',
893 893
 						'',
@@ -899,22 +899,22 @@  discard block
 block discarded – undo
899 899
 						'default_templates',
900 900
 						'build_dropdown',
901 901
 						'where_arr',
902
-						array (
902
+						array(
903 903
 								"reseller_id" => $loginid 
904 904
 						) 
905 905
 				) 
906 906
 		);
907 907
 		// $form['button_cancel'] = array('name' => 'action', 'content' => 'Reset', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
908
-		$form ['button_save'] = array (
909
-				gettext ( 'name' ) => 'action',
908
+		$form ['button_save'] = array(
909
+				gettext('name') => 'action',
910 910
 				'content' => 'Search',
911 911
 				'value' => 'save',
912 912
 				'id' => 'submit',
913 913
 				'type' => 'submit',
914 914
 				'class' => 'btn btn-line-parrot' 
915 915
 		);
916
-		$form ['button_cancel'] = array (
917
-				gettext ( 'name' ) => 'action',
916
+		$form ['button_cancel'] = array(
917
+				gettext('name') => 'action',
918 918
 				'content' => 'Reset',
919 919
 				'value' => 'cancel',
920 920
 				'type' => 'reset',
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 	}
927 927
 	function get_form_fields_email_view_client($add_arr) {
928 928
 		if ($add_arr ['type'] == '') {
929
-			$email_add = array (
929
+			$email_add = array(
930 930
 					'To',
931 931
 					'email',
932 932
 					'SELECT',
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 					'accounts',
940 940
 					'build_dropdown',
941 941
 					'where_arr',
942
-					array (
942
+					array(
943 943
 							'status' => $add_arr ['status'],
944 944
 							'posttoexternal' => $add_arr ['posttoexternal'],
945 945
 							'pricelist_id' => $add_arr ['pricelist_id'] 
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
 					'multi' 
948 948
 			);
949 949
 		} else {
950
-			$email_add = array (
950
+			$email_add = array(
951 951
 					'To',
952 952
 					'email',
953 953
 					'SELECT',
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 					'accounts',
961 961
 					'build_dropdown',
962 962
 					'where_arr',
963
-					array (
963
+					array(
964 964
 							'status' => $add_arr ['status'],
965 965
 							'posttoexternal' => $add_arr ['posttoexternal'],
966 966
 							'pricelist_id' => $add_arr ['pricelist_id'],
@@ -970,19 +970,19 @@  discard block
 block discarded – undo
970 970
 			);
971 971
 		}
972 972
 		
973
-		$form ['forms'] = array (
974
-				base_url () . 'email/email_send_multipal/',
975
-				array (
973
+		$form ['forms'] = array(
974
+				base_url().'email/email_send_multipal/',
975
+				array(
976 976
 						'id' => 'commission_form',
977 977
 						'method' => 'POST',
978 978
 						'name' => 'commission_form' 
979 979
 				) 
980 980
 		);
981
-		$form [gettext ( 'Compose Email' )] = array (
982
-				array (
981
+		$form [gettext('Compose Email')] = array(
982
+				array(
983 983
 						'',
984 984
 						'HIDDEN',
985
-						array (
985
+						array(
986 986
 								'name' => 'accountid' 
987 987
 						),
988 988
 						'',
@@ -990,10 +990,10 @@  discard block
 block discarded – undo
990 990
 						'',
991 991
 						'' 
992 992
 				),
993
-				array (
993
+				array(
994 994
 						'',
995 995
 						'HIDDEN',
996
-						array (
996
+						array(
997 997
 								'name' => 'temp' 
998 998
 						),
999 999
 						'',
@@ -1001,10 +1001,10 @@  discard block
 block discarded – undo
1001 1001
 						'',
1002 1002
 						'' 
1003 1003
 				),
1004
-				array (
1005
-						gettext ( 'From' ),
1004
+				array(
1005
+						gettext('From'),
1006 1006
 						'INPUT',
1007
-						array (
1007
+						array(
1008 1008
 								'name' => 'from',
1009 1009
 								'size' => '20',
1010 1010
 								'readonly' => true,
@@ -1016,10 +1016,10 @@  discard block
 block discarded – undo
1016 1016
 						'' 
1017 1017
 				),
1018 1018
 				$email_add,
1019
-				array (
1020
-						gettext ( 'Subject' ),
1019
+				array(
1020
+						gettext('Subject'),
1021 1021
 						'INPUT',
1022
-						array (
1022
+						array(
1023 1023
 								'name' => 'subject',
1024 1024
 								'size' => '20',
1025 1025
 								'class' => "text field medium" 
@@ -1028,10 +1028,10 @@  discard block
 block discarded – undo
1028 1028
 						'tOOL TIP',
1029 1029
 						'' 
1030 1030
 				),
1031
-				array (
1032
-						gettext ( 'Body' ),
1031
+				array(
1032
+						gettext('Body'),
1033 1033
 						'TEXTAREA',
1034
-						array (
1034
+						array(
1035 1035
 								'name' => 'template',
1036 1036
 								'id' => 'template',
1037 1037
 								'size' => '20',
@@ -1042,17 +1042,17 @@  discard block
 block discarded – undo
1042 1042
 						'' 
1043 1043
 				) 
1044 1044
 		);
1045
-		$form ['button_cancel'] = array (
1045
+		$form ['button_cancel'] = array(
1046 1046
 				'name' => 'action',
1047
-				'content' => gettext ( 'Cancel' ),
1047
+				'content' => gettext('Cancel'),
1048 1048
 				'value' => 'cancel',
1049 1049
 				'type' => 'button',
1050 1050
 				'class' => 'btn btn-line-sky margin-x-10',
1051 1051
 				'onclick' => 'return redirect_page(\'/email/email_mass/\')' 
1052 1052
 		);
1053
-		$form ['button_save'] = array (
1053
+		$form ['button_save'] = array(
1054 1054
 				'name' => 'action',
1055
-				'content' => gettext ( 'Send' ),
1055
+				'content' => gettext('Send'),
1056 1056
 				'value' => 'save',
1057 1057
 				'id' => 'submit',
1058 1058
 				'type' => 'submit',
@@ -1061,21 +1061,21 @@  discard block
 block discarded – undo
1061 1061
 		return $form;
1062 1062
 	}
1063 1063
 	function build_grid_buttons_email() {
1064
-		$buttons_json = json_encode ( array () );
1064
+		$buttons_json = json_encode(array());
1065 1065
 		return $buttons_json;
1066 1066
 	}
1067 1067
 	function get_email_history_search_form() {
1068
-		$form ['forms'] = array (
1068
+		$form ['forms'] = array(
1069 1069
 				"",
1070
-				array (
1070
+				array(
1071 1071
 						'id' => "email_search" 
1072 1072
 				) 
1073 1073
 		);
1074
-		$form [gettext ( 'Search' )] = array (
1075
-				array (
1076
-						gettext ( 'From Date' ),
1074
+		$form [gettext('Search')] = array(
1075
+				array(
1076
+						gettext('From Date'),
1077 1077
 						'INPUT',
1078
-						array (
1078
+						array(
1079 1079
 								'name' => 'date[]',
1080 1080
 								'id' => 'customer_cdr_from_date',
1081 1081
 								'size' => '20',
@@ -1086,10 +1086,10 @@  discard block
 block discarded – undo
1086 1086
 						'',
1087 1087
 						'date[date-date]' 
1088 1088
 				),
1089
-				array (
1090
-						gettext ( 'To Date' ),
1089
+				array(
1090
+						gettext('To Date'),
1091 1091
 						'INPUT',
1092
-						array (
1092
+						array(
1093 1093
 								'name' => 'date[]',
1094 1094
 								'id' => 'customer_cdr_to_date',
1095 1095
 								'size' => '20',
@@ -1100,8 +1100,8 @@  discard block
 block discarded – undo
1100 1100
 						'',
1101 1101
 						'date[date-date]' 
1102 1102
 				),
1103
-				array (
1104
-						gettext ( 'Account' ),
1103
+				array(
1104
+						gettext('Account'),
1105 1105
 						'accountid',
1106 1106
 						'SELECT',
1107 1107
 						'',
@@ -1113,15 +1113,15 @@  discard block
 block discarded – undo
1113 1113
 						'accounts',
1114 1114
 						'build_concat_dropdown',
1115 1115
 						'where_arr',
1116
-						array (
1116
+						array(
1117 1117
 								"reseller_id" => "0",
1118 1118
 								"deleted" => "0" 
1119 1119
 						) 
1120 1120
 				),
1121
-				array (
1122
-						gettext ( 'From' ),
1121
+				array(
1122
+						gettext('From'),
1123 1123
 						'INPUT',
1124
-						array (
1124
+						array(
1125 1125
 								'name' => 'from[from]',
1126 1126
 								'',
1127 1127
 								'id' => 'from',
@@ -1138,10 +1138,10 @@  discard block
 block discarded – undo
1138 1138
 						'search_string_type',
1139 1139
 						'' 
1140 1140
 				),
1141
-				array (
1142
-						gettext ( 'To' ),
1141
+				array(
1142
+						gettext('To'),
1143 1143
 						'INPUT',
1144
-						array (
1144
+						array(
1145 1145
 								'name' => 'to[to]',
1146 1146
 								'',
1147 1147
 								'id' => 'to',
@@ -1158,10 +1158,10 @@  discard block
 block discarded – undo
1158 1158
 						'search_string_type',
1159 1159
 						'' 
1160 1160
 				),
1161
-				array (
1162
-						gettext ( 'Subject' ),
1161
+				array(
1162
+						gettext('Subject'),
1163 1163
 						'INPUT',
1164
-						array (
1164
+						array(
1165 1165
 								'name' => 'subject[subject]',
1166 1166
 								'',
1167 1167
 								'id' => 'body',
@@ -1178,10 +1178,10 @@  discard block
 block discarded – undo
1178 1178
 						'search_string_type',
1179 1179
 						'' 
1180 1180
 				),
1181
-				array (
1182
-						gettext ( 'Body' ),
1181
+				array(
1182
+						gettext('Body'),
1183 1183
 						'INPUT',
1184
-						array (
1184
+						array(
1185 1185
 								'name' => 'body[body]',
1186 1186
 								'',
1187 1187
 								'id' => 'body',
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
 						'search_string_type',
1199 1199
 						'' 
1200 1200
 				),
1201
-				array (
1201
+				array(
1202 1202
 						'',
1203 1203
 						'HIDDEN',
1204 1204
 						'ajax_search',
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 						'',
1208 1208
 						'' 
1209 1209
 				),
1210
-				array (
1210
+				array(
1211 1211
 						'',
1212 1212
 						'HIDDEN',
1213 1213
 						'advance_search',
@@ -1217,18 +1217,18 @@  discard block
 block discarded – undo
1217 1217
 						'' 
1218 1218
 				) 
1219 1219
 		);
1220
-		$form ['button_search'] = array (
1220
+		$form ['button_search'] = array(
1221 1221
 				'name' => 'action',
1222 1222
 				'id' => "email_search_btn",
1223
-				'content' => gettext ( 'Search' ),
1223
+				'content' => gettext('Search'),
1224 1224
 				'value' => 'save',
1225 1225
 				'type' => 'button',
1226 1226
 				'class' => 'btn btn-line-parrot pull-right' 
1227 1227
 		);
1228
-		$form ['button_reset'] = array (
1228
+		$form ['button_reset'] = array(
1229 1229
 				'name' => 'action',
1230 1230
 				'id' => "id_reset",
1231
-				'content' => gettext ( 'Clear' ),
1231
+				'content' => gettext('Clear'),
1232 1232
 				'value' => 'cancel',
1233 1233
 				'type' => 'reset',
1234 1234
 				'class' => 'btn btn-line-sky pull-right margin-x-10' 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@
 block discarded – undo
21 21
 // You should have received a copy of the GNU Affero General Public License
22 22
 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 23
 // ##############################################################################
24
-if (! defined ( 'BASEPATH' ))
24
+if (! defined ( 'BASEPATH' )) {
25 25
 	exit ( 'No direct script access allowed' );
26
+}
26 27
 class Email_form {
27 28
 	function __construct($library_name = '') {
28 29
 		$this->CI = & get_instance ();
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/taxes/models/taxes_model.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -22,48 +22,48 @@
 block discarded – undo
22 22
 // ##############################################################################
23 23
 class Taxes_model extends CI_Model {
24 24
 	function Taxes_model() {
25
-		parent::__construct ();
25
+		parent::__construct();
26 26
 	}
27 27
 	function get_taxes_list($flag, $start = 0, $limit = 0) {
28
-		$this->db_model->build_search ( 'taxes_list_search' );
29
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
30
-			$where = array (
28
+		$this->db_model->build_search('taxes_list_search');
29
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
30
+			$where = array(
31 31
 					"reseller_id" => $this->session->userdata ["accountinfo"] ['id'] 
32 32
 			);
33 33
 		} else {
34
-			$where = array (
34
+			$where = array(
35 35
 					"reseller_id" => 0 
36 36
 			);
37 37
 		}
38 38
 		if ($flag) {
39
-			$query = $this->db_model->select ( "*", "taxes", $where, "id", "ASC", $limit, $start );
39
+			$query = $this->db_model->select("*", "taxes", $where, "id", "ASC", $limit, $start);
40 40
 		} else {
41
-			$query = $this->db_model->countQuery ( "*", "taxes", $where );
41
+			$query = $this->db_model->countQuery("*", "taxes", $where);
42 42
 		}
43 43
 		return $query;
44 44
 	}
45 45
 	function add_tax($data) {
46
-		unset ( $data ["action"] );
47
-		$data ["creation_date"] = date ( "Y-m-d H:i:s" );
48
-		if ($this->session->userdata ( 'logintype' ) == 1 || $this->session->userdata ( 'logintype' ) == 5) {
46
+		unset ($data ["action"]);
47
+		$data ["creation_date"] = date("Y-m-d H:i:s");
48
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
49 49
 			$data ['reseller_id'] = $this->session->userdata ["accountinfo"] ['id'];
50 50
 		} else {
51 51
 			$data ['reseller_id'] = 0;
52 52
 		}
53
-		$this->db->insert ( "taxes", $data );
53
+		$this->db->insert("taxes", $data);
54 54
 	}
55 55
 	function edit_tax($data, $id) {
56
-		unset ( $data ["action"] );
57
-		$data ["last_modified_date"] = date ( "Y-m-d H:i:s" );
58
-		$this->db->where ( "id", $id );
59
-		$this->db->update ( "taxes", $data );
56
+		unset ($data ["action"]);
57
+		$data ["last_modified_date"] = date("Y-m-d H:i:s");
58
+		$this->db->where("id", $id);
59
+		$this->db->update("taxes", $data);
60 60
 	}
61 61
 	function remove_taxes($id) {
62
-		$this->db->delete ( 'taxes_to_accounts', array (
62
+		$this->db->delete('taxes_to_accounts', array(
63 63
 				'taxes_id' => $id 
64
-		) );
65
-		return $this->db->delete ( "taxes", array (
64
+		));
65
+		return $this->db->delete("taxes", array(
66 66
 				'id' => $id 
67
-		) );
67
+		));
68 68
 	}
69 69
 }
Please login to merge, or discard this patch.