Passed
Pull Request — v3.0 (#162)
by Samir
13:26
created
web_interface/astpp/application/modules/accounts/models/accounts_model.php 2 patches
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	function add_account($accountinfo) {
32 32
 	
33 33
 		$account_data = $this->session->userdata("accountinfo");
34
-		$accountinfo['reseller_id'] = ($account_data['type'] == 1 ) ? $account_data['id'] : 0;
35
-		$accountinfo['maxchannels'] = ($accountinfo['type'] == 1 || $account_data['type'] == 2 || $account_data['type'] == -1 ) ? "0" : $accountinfo['maxchannels'];
34
+		$accountinfo['reseller_id'] = ($account_data['type'] == 1) ? $account_data['id'] : 0;
35
+		$accountinfo['maxchannels'] = ($accountinfo['type'] == 1 || $account_data['type'] == 2 || $account_data['type'] == -1) ? "0" : $accountinfo['maxchannels'];
36 36
 		unset($accountinfo['action']);
37 37
 		$sip_flag = isset($accountinfo['sip_device_flag']) ? 1 : 0;
38 38
 		$opensip_flag = isset($accountinfo['opensips_device_flag']) ? 1 : 0;
39
-		unset($accountinfo['sip_device_flag'],$accountinfo['opensips_device_flag'],$accountinfo['tax_id']);
39
+		unset($accountinfo['sip_device_flag'], $accountinfo['opensips_device_flag'], $accountinfo['tax_id']);
40 40
 
41 41
 		/*         * ******************************** */
42 42
 		$accountinfo['creation'] = gmdate('Y-m-d H:i:s');
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
         }else{
52 52
 	  $accountinfo['allow_ip_management']=1;
53 53
         }*/
54
-		if(isset($accountinfo['local_call'])){
55
-	  $accountinfo['local_call']=0;
56
-		}else{
57
-	  $accountinfo['local_call']=1;
54
+		if (isset($accountinfo['local_call'])) {
55
+	  $accountinfo['local_call'] = 0;
56
+		} else {
57
+	  $accountinfo['local_call'] = 1;
58 58
 		}
59
-		if ($accountinfo['type'] == 1){
59
+		if ($accountinfo['type'] == 1) {
60 60
 		$invoice_config = $accountinfo['invoice_config_flag'];
61
-		}else{
61
+		} else {
62 62
 		$invoice_config = "";		
63 63
 		}
64 64
 		unset($accountinfo['invoice_config_flag']);
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 			}
87 87
 		if ($sip_flag == '1') {
88 88
 			$this->db->select('id');
89
-			$this->db->where('name','default');
90
-			$sipprofile_result=(array)$this->db->get('sip_profiles')->first_row();
89
+			$this->db->where('name', 'default');
90
+			$sipprofile_result = (array)$this->db->get('sip_profiles')->first_row();
91 91
 			$free_switch_array = array('fs_username' => $accountinfo['number'],
92 92
 				'fs_password' => $this->common->decode($accountinfo['password']),
93 93
 				'context' => 'default',
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 			$this->load->model('opensips/opensips_model');
110 110
 			$this->opensips_model->add_opensipsdevices($opensips_array);
111 111
 		}
112
-		$accountinfo['confirm'] =  base_url();
113
-		if($accountinfo['id'] == ""){
112
+		$accountinfo['confirm'] = base_url();
113
+		if ($accountinfo['id'] == "") {
114 114
 		$accountinfo['id'] = $last_id;
115 115
 		}
116 116
 		$accountinfo['password'] = $this->common->decode($accountinfo['password']);    
@@ -154,16 +154,16 @@  discard block
 block discarded – undo
154 154
 				if ($query_pricelist->num_rows > 0) {
155 155
 					$description = '';
156 156
 					if ($update_array['balance']['operator'] == '2') {
157
-						$description .="Reseller update set balance by admin";
157
+						$description .= "Reseller update set balance by admin";
158 158
 					}
159 159
 					if ($update_array['balance']['operator'] == '3') {
160
-						$description .="Reseller update increase balance by admin";
160
+						$description .= "Reseller update increase balance by admin";
161 161
 					}
162 162
 					if ($update_array['balance']['operator'] == '4') {
163
-						$description .="Reseller update descrise balance by admin";
163
+						$description .= "Reseller update descrise balance by admin";
164 164
 					}
165 165
 					foreach ($query_pricelist->result_array() as $key => $reseller_payment) {
166
-						if (!empty($reseller_payment['reseller_id']) && $reseller_payment['reseller_id'] != '') {
166
+						if ( ! empty($reseller_payment['reseller_id']) && $reseller_payment['reseller_id'] != '') {
167 167
 							$payment_by = $reseller_payment['reseller_id'];
168 168
 						} else {
169 169
 							$payment_by = '-1';
@@ -218,16 +218,16 @@  discard block
 block discarded – undo
218 218
 			if ($query_pricelist->num_rows > 0) {
219 219
 				$description = '';
220 220
 				if ($update_array['balance']['operator'] == '2') {
221
-					$description .="Customer update set balance by admin";
221
+					$description .= "Customer update set balance by admin";
222 222
 				}
223 223
 				if ($update_array['balance']['operator'] == '3') {
224
-					$description .="Customer update increase balance by admin";
224
+					$description .= "Customer update increase balance by admin";
225 225
 				}
226 226
 				if ($update_array['balance']['operator'] == '4') {
227
-					$description .="Customer update descrise balance by admin";
227
+					$description .= "Customer update descrise balance by admin";
228 228
 				}
229 229
 				foreach ($query_pricelist->result_array() as $key => $customer_payment) {
230
-					if (!empty($customer_payment['reseller_id']) && $customer_payment['reseller_id'] != '0') {
230
+					if ( ! empty($customer_payment['reseller_id']) && $customer_payment['reseller_id'] != '0') {
231 231
 						$payment_by = $customer_payment['reseller_id'];
232 232
 					} else {
233 233
 						$payment_by = '-1';
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
 			$pin = $this->common->find_uniq_rendno_accno($number_length, 'pin', 'accounts', '', $count);
284 284
 		}
285 285
 		$sip_flag = false;
286
-		$opensip_flag=false;
287
-		if (isset($add_array['sip_device_flag']) && common_model::$global_config['system_config']['opensips']== 0) {
286
+		$opensip_flag = false;
287
+		if (isset($add_array['sip_device_flag']) && common_model::$global_config['system_config']['opensips'] == 0) {
288 288
 			$sip_flag = true;
289 289
 		}
290
-		if (isset($add_array['opensips_device_flag']) && common_model::$global_config['system_config']['opensips']== 1) {
290
+		if (isset($add_array['opensips_device_flag']) && common_model::$global_config['system_config']['opensips'] == 1) {
291 291
 			$opensip_flag = true;
292 292
 		}
293 293
 		unset(
@@ -298,20 +298,20 @@  discard block
 block discarded – undo
298 298
 				$add_array['sip_device_flag'],
299 299
 				$add_array['opensips_device_flag']
300 300
 		);
301
-		if(isset($add_array['is_recording']) &&  $add_array['is_recording'] != ''){
302
-		$is_recording=1;
303
-		}else{
304
-		$is_recording=0;
301
+		if (isset($add_array['is_recording']) && $add_array['is_recording'] != '') {
302
+		$is_recording = 1;
303
+		} else {
304
+		$is_recording = 0;
305 305
 		}
306
-		if(isset($add_array['allow_ip_management']) &&  $add_array['allow_ip_management'] != ''){
307
-		$allow_ip_management=1;
308
-		}else{
309
-		$allow_ip_management=0;
306
+		if (isset($add_array['allow_ip_management']) && $add_array['allow_ip_management'] != '') {
307
+		$allow_ip_management = 1;
308
+		} else {
309
+		$allow_ip_management = 0;
310 310
 		}
311
-		if(isset($add_array['local_call']) &&  $add_array['local_call'] != ''){
312
-		$local_call=1;
313
-		}else{
314
-		$local_call=0;
311
+		if (isset($add_array['local_call']) && $add_array['local_call'] != '') {
312
+		$local_call = 1;
313
+		} else {
314
+		$local_call = 0;
315 315
 		}
316 316
 		if ($sip_flag) {
317 317
 			$query = $this->db_model->select("*", "sip_profiles", array('status' => "0"), "id", "ASC", '1', '0');
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 			$this->db->insert_batch('accounts', $insert_array);
420 420
 			if ($opensip_flag == 1) {
421 421
 				$db_config = Common_model::$global_config['system_config'];
422
-				$opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
422
+				$opensipdsn = "mysql://".$db_config['opensips_dbuser'].":".$db_config['opensips_dbpass']."@".$db_config['opensips_dbhost']."/".$db_config['opensips_dbname']."?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=";
423 423
 				$this->opensips_db = $this->load->database($opensipdsn, true);
424 424
 				$this->opensips_db->insert_batch("subscriber", $opensips_array);
425 425
 			}
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	}
429 429
 
430 430
 	function get_max_limit($add_array) {
431
-		$this->db->where('deleted','0');
431
+		$this->db->where('deleted', '0');
432 432
 		$this->db->where("length(number)", $add_array['account_length']);
433 433
 		$this->db->like('number', $add_array['prefix'], 'after');
434 434
 		$this->db->select("count(id) as count");
@@ -444,16 +444,16 @@  discard block
 block discarded – undo
444 444
 	}
445 445
 	function account_process_payment($data) {
446 446
 	$data['accountid'] = $data['id'];
447
-		$accountdata=(array)$this->db->get_where('accounts',array("id"=>$data['accountid']))->first_row();
448
-		$accountinfo =$this->session->userdata('accountinfo');
447
+		$accountdata = (array)$this->db->get_where('accounts', array("id"=>$data['accountid']))->first_row();
448
+		$accountinfo = $this->session->userdata('accountinfo');
449 449
 	$data["payment_by"] = $accountdata['reseller_id'] > 0 ? $accountdata['reseller_id'] : '-1';
450 450
 	$data['payment_mode'] = $data['payment_type'];
451
-	unset($data['action'],$data['id'],$data['account_currency'],$data['payment_type']);
452
-	if (isset($data) && !empty($accountdata)) {
453
-		$data['credit']=$data['credit'] =='' ?  0 : $data['credit'];
451
+	unset($data['action'], $data['id'], $data['account_currency'], $data['payment_type']);
452
+	if (isset($data) && ! empty($accountdata)) {
453
+		$data['credit'] = $data['credit'] == '' ? 0 : $data['credit'];
454 454
 		$date = gmdate('Y-m-d H:i:s');
455
-		if($data['payment_mode']== 1){       
456
-		  $balance = $this->update_balance($data['credit'], $data['accountid'],$data['payment_mode']);
455
+		if ($data['payment_mode'] == 1) {       
456
+		  $balance = $this->update_balance($data['credit'], $data['accountid'], $data['payment_mode']);
457 457
 			  $insert_arr = array("accountid" => $data['accountid'],
458 458
 			  "credit" => "-".$data['credit'],
459 459
 			  'payment_mode'=>$data['payment_mode'],
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 			  'payment_by'=>$data['payment_by'],
475 475
 		  );
476 476
 		  $this->db->insert("payments", $insert_arr);
477
-		  $accountdata['refill_amount']=$data['credit'];
478
-		  $current_id=$accountinfo['type'] ==1 ? $accountinfo['id'] : '0';
479
-		  if($accountdata['reseller_id'] == $current_id){
477
+		  $accountdata['refill_amount'] = $data['credit'];
478
+		  $current_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : '0';
479
+		  if ($accountdata['reseller_id'] == $current_id) {
480 480
 			$this->common->mail_to_users('voip_account_refilled', $accountdata);
481
-		  }else{
481
+		  } else {
482 482
 			$this->common->mail_to_users('voip_child_account_refilled', $accountdata);
483 483
 		  }
484 484
 		}
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 
489 489
 	function get_admin_Account_list($flag, $start = 0, $limit = 0, $reseller_id = 0) {
490 490
 		$this->db_model->build_search('admin_list_search');
491
-		$where = "reseller_id =" . $reseller_id . " AND deleted =0 AND type in (2,4,-1)";
491
+		$where = "reseller_id =".$reseller_id." AND deleted =0 AND type in (2,4,-1)";
492 492
 		if ($this->session->userdata('advance_search') == 1) {
493 493
 			$search = $this->session->userdata('admin_list_search');
494 494
 			if ($search['type'] == '') {
@@ -504,10 +504,10 @@  discard block
 block discarded – undo
504 504
 		if ($flag) {
505 505
 			$this->db->limit($limit, $start);
506 506
 		}
507
-		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
508
-		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
509
-		}else{
510
-			$this->db->order_by('number','desc');
507
+		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
508
+		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
509
+		} else {
510
+			$this->db->order_by('number', 'desc');
511 511
 		}
512 512
 		$result = $this->db->get('accounts');
513 513
 
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
 			$this->db->where($type);
536 536
 		}
537 537
 		if ($flag) {
538
-			if (!$export)
538
+			if ( ! $export)
539 539
 				$this->db->limit($limit, $start);
540 540
 		}
541
-		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
542
-		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
543
-		}else{
544
-			$this->db->order_by('number','desc');
541
+		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
542
+		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
543
+		} else {
544
+			$this->db->order_by('number', 'desc');
545 545
 		}
546 546
 		$result = $this->db->get('accounts');
547 547
 		if ($flag) {
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	function insert_block($data, $accountid) {
591 591
 		$data = explode(",", $data);
592 592
 		$tmp = array();
593
-		if (!empty($data)) {
593
+		if ( ! empty($data)) {
594 594
 			foreach ($data as $key => $data_value) {
595 595
 				$tmp[$key]["accountid"] = $accountid;
596 596
 				$result = $this->get_pattern_by_id($data_value);
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 	}
622 622
 
623 623
 	function add_callerid($data) {
624
-		unset($data['action'],$data['flag']);
624
+		unset($data['action'], $data['flag']);
625 625
 		$data['accountid'] = $this->common->get_field_name('id', 'accounts', array('number' => $data['accountid']));
626 626
 		$this->db->insert('accounts_callerid', $data);
627 627
 		return true;
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
 
707 707
 	function update_balance($amount, $accountid, $payment_type) {
708 708
 		if ($payment_type == 0) {
709
-			$query = 'UPDATE `accounts` SET `balance` = (balance + ' . $amount . ') WHERE `id` = ' . $accountid;
709
+			$query = 'UPDATE `accounts` SET `balance` = (balance + '.$amount.') WHERE `id` = '.$accountid;
710 710
 			return $this->db->query($query);
711 711
 		}if ($payment_type == 1) {
712
-			$query = 'UPDATE `accounts` SET `balance` = (balance - ' . $amount . ') WHERE `id` = ' . $accountid;
712
+			$query = 'UPDATE `accounts` SET `balance` = (balance - '.$amount.') WHERE `id` = '.$accountid;
713 713
 			return $this->db->query($query);
714 714
 		}
715 715
 	}
Please login to merge, or discard this patch.
Braces   +36 added lines, -30 removed lines patch added patch discarded remove patch
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
         }*/
54 54
 		if(isset($accountinfo['local_call'])){
55 55
 	  $accountinfo['local_call']=0;
56
-		}else{
56
+		} else{
57 57
 	  $accountinfo['local_call']=1;
58 58
 		}
59 59
 		if ($accountinfo['type'] == 1){
60 60
 		$invoice_config = $accountinfo['invoice_config_flag'];
61
-		}else{
61
+		} else{
62 62
 		$invoice_config = "";		
63 63
 		}
64 64
 		unset($accountinfo['invoice_config_flag']);
@@ -300,17 +300,17 @@  discard block
 block discarded – undo
300 300
 		);
301 301
 		if(isset($add_array['is_recording']) &&  $add_array['is_recording'] != ''){
302 302
 		$is_recording=1;
303
-		}else{
303
+		} else{
304 304
 		$is_recording=0;
305 305
 		}
306 306
 		if(isset($add_array['allow_ip_management']) &&  $add_array['allow_ip_management'] != ''){
307 307
 		$allow_ip_management=1;
308
-		}else{
308
+		} else{
309 309
 		$allow_ip_management=0;
310 310
 		}
311 311
 		if(isset($add_array['local_call']) &&  $add_array['local_call'] != ''){
312 312
 		$local_call=1;
313
-		}else{
313
+		} else{
314 314
 		$local_call=0;
315 315
 		}
316 316
 		if ($sip_flag) {
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 		  $current_id=$accountinfo['type'] ==1 ? $accountinfo['id'] : '0';
479 479
 		  if($accountdata['reseller_id'] == $current_id){
480 480
 			$this->common->mail_to_users('voip_account_refilled', $accountdata);
481
-		  }else{
481
+		  } else{
482 482
 			$this->common->mail_to_users('voip_child_account_refilled', $accountdata);
483 483
 		  }
484 484
 		}
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 		}
507 507
 		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
508 508
 		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
509
-		}else{
509
+		} else{
510 510
 			$this->db->order_by('number','desc');
511 511
 		}
512 512
 		$result = $this->db->get('accounts');
@@ -535,12 +535,13 @@  discard block
 block discarded – undo
535 535
 			$this->db->where($type);
536 536
 		}
537 537
 		if ($flag) {
538
-			if (!$export)
539
-				$this->db->limit($limit, $start);
538
+			if (!$export) {
539
+							$this->db->limit($limit, $start);
540
+			}
540 541
 		}
541 542
 		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
542 543
 		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
543
-		}else{
544
+		} else{
544 545
 			$this->db->order_by('number','desc');
545 546
 		}
546 547
 		$result = $this->db->get('accounts');
@@ -614,10 +615,11 @@  discard block
 block discarded – undo
614 615
 
615 616
 	function get_account_number($accountid) {
616 617
 		$query = $this->db_model->getSelect("number", "accounts", array("id" => $accountid));
617
-		if ($query->num_rows() > 0)
618
-			return $query->row_array();
619
-		else
620
-			return false;
618
+		if ($query->num_rows() > 0) {
619
+					return $query->row_array();
620
+		} else {
621
+					return false;
622
+		}
621 623
 	}
622 624
 
623 625
 	function add_callerid($data) {
@@ -662,10 +664,11 @@  discard block
 block discarded – undo
662 664
 	function get_accounttax_by_id($account_id) {
663 665
 		$this->db->where("accountid", trim($account_id));
664 666
 		$query = $this->db->get("taxes_to_accounts");
665
-		if ($query->num_rows() > 0)
666
-			return $query->result_array();
667
-		else
668
-			return false;
667
+		if ($query->num_rows() > 0) {
668
+					return $query->result_array();
669
+		} else {
670
+					return false;
671
+		}
669 672
 	}
670 673
 
671 674
 	/**
@@ -678,29 +681,32 @@  discard block
 block discarded – undo
678 681
 		$this->db->where("number", $acc_num);
679 682
 		$query = $this->db->get("accounts");
680 683
 
681
-		if ($query->num_rows() > 0)
682
-			return $query->row_array();
683
-		else
684
-			return false;
684
+		if ($query->num_rows() > 0) {
685
+					return $query->row_array();
686
+		} else {
687
+					return false;
688
+		}
685 689
 	}
686 690
 
687 691
 	function get_account_by_number($id) {
688 692
 		$this->db->where("id", $id);
689 693
 		$query = $this->db->get("accounts");
690 694
 
691
-		if ($query->num_rows() > 0)
692
-			return $query->row_array();
693
-		else
694
-			return false;
695
+		if ($query->num_rows() > 0) {
696
+					return $query->row_array();
697
+		} else {
698
+					return false;
699
+		}
695 700
 	}
696 701
 
697 702
 	function get_currency_by_id($currency_id) {
698 703
 
699 704
 		$query = $this->db_model->getSelect("*", 'currency', array('id' => $currency_id));
700
-		if ($query->num_rows() > 0)
701
-			return $query->row_array();
702
-		else
703
-			return false;
705
+		if ($query->num_rows() > 0) {
706
+					return $query->row_array();
707
+		} else {
708
+					return false;
709
+		}
704 710
 	}
705 711
 
706 712
 
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/accounts/controllers/accounts.php 3 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1386,35 +1386,35 @@
 block discarded – undo
1386 1386
 			  $invoice_id=$this->invoices->invoices->generate_receipt($reseller_info['id'],$custom_array['credit'],$reseller_info,$last_invoice_ID+1,$invoice_prefix,$due_date);
1387 1387
 			  $account_balance = $this->common->get_field_name('balance', 'accounts', $reseller_info['id']);
1388 1388
 			  $insert_arr = array("accountid" => $reseller_info['id'],
1389
-				      "description" => trim($custom_array['notes']),
1390
-				      "debit" => 0,
1391
-				      "credit" => $custom_array['credit'],
1392
-				      "created_date" => gmdate("Y-m-d H:i:s"), 
1393
-				      "invoiceid"=>$invoice_id,
1394
-				      "reseller_id"=>$reseller_info['reseller_id'],
1395
-				      "item_type"=>'Refill',
1396
-				      "item_id"=>'0',
1397
-  				      'before_balance'=>$account_balance - $custom_array['credit'],
1398
-				      'after_balance'=>$account_balance,
1399
-				    );
1400
-			    $this->db->insert("invoice_details", $insert_arr);
1389
+					  "description" => trim($custom_array['notes']),
1390
+					  "debit" => 0,
1391
+					  "credit" => $custom_array['credit'],
1392
+					  "created_date" => gmdate("Y-m-d H:i:s"), 
1393
+					  "invoiceid"=>$invoice_id,
1394
+					  "reseller_id"=>$reseller_info['reseller_id'],
1395
+					  "item_type"=>'Refill',
1396
+					  "item_id"=>'0',
1397
+  					  'before_balance'=>$account_balance - $custom_array['credit'],
1398
+					  'after_balance'=>$account_balance,
1399
+					);
1400
+				$this->db->insert("invoice_details", $insert_arr);
1401
+			}
1402
+			  }
1401 1403
 			}
1402
-		      }
1403
-		    }
1404 1404
 		}
1405
-	        $message = $post_array['payment_type'] == 0 ? "Recharge successfully!" : "Post charge applied successfully.";
1405
+			$message = $post_array['payment_type'] == 0 ? "Recharge successfully!" : "Post charge applied successfully.";
1406 1406
 /***********************************************************************************************/
1407
-                echo json_encode(array("SUCCESS"=> $message));
1408
-                exit;
1409
-        //    }
1410
-        }
1411
-        $this->load->view('view_accounts_process_payment', $data);
1412
-    }
1413
-
1414
-    /**
1415
-     * @param string $select
1416
-     */
1417
-    function get_invoice_date($select,$accountid){
1407
+				echo json_encode(array("SUCCESS"=> $message));
1408
+				exit;
1409
+		//    }
1410
+		}
1411
+		$this->load->view('view_accounts_process_payment', $data);
1412
+	}
1413
+
1414
+	/**
1415
+	 * @param string $select
1416
+	 */
1417
+	function get_invoice_date($select,$accountid){
1418 1418
 	$query = $this->db_model->select($select, "invoices", '',"id","DESC","1","0");
1419 1419
 	if($query->num_rows >0){
1420 1420
 		$invoiceid = $query->result_array();
Please login to merge, or discard this patch.
Spacing   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$this->load->model('Astpp_common');
39 39
 		$this->protected_pages = array('account_list');
40 40
 		if ($this->session->userdata('user_login') == FALSE)
41
-			redirect(base_url() . '/login/login');
41
+			redirect(base_url().'/login/login');
42 42
 	}
43 43
 
44 44
 	function customer_list() {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			$this->session->set_userdata('customer_list_search', $action);
98 98
 		}
99 99
 		if (@$ajax_search != 1) {
100
-			redirect(base_url() . 'accounts/customer_list/');
100
+			redirect(base_url().'accounts/customer_list/');
101 101
 		}
102 102
 	}
103 103
 
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 
109 109
 	function customer_export_cdr_xls() {
110 110
 	$account_info = $accountinfo = $this->session->userdata('accountinfo');
111
-	$currency_id=$account_info['currency_id'];
112
-	 $currency=$this->common->get_field_name('currency', 'currency', $currency_id);
111
+	$currency_id = $account_info['currency_id'];
112
+	 $currency = $this->common->get_field_name('currency', 'currency', $currency_id);
113 113
 		$query = $this->accounts_model->get_customer_Account_list(true, '', '', true);
114 114
 		ob_clean();
115
-		$customer_array[] = array("Account", "First Name", "Last Name", "Company", "Rate Group ", "Balance ($currency)", "Credit Limit ($currency)", "First Used", "Expiry Date","CC","Status","Created Date");
115
+		$customer_array[] = array("Account", "First Name", "Last Name", "Company", "Rate Group ", "Balance ($currency)", "Credit Limit ($currency)", "First Used", "Expiry Date", "CC", "Status", "Created Date");
116 116
 		if ($query->num_rows() > 0) {
117 117
 
118 118
 			foreach ($query->result_array() as $row) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 			}
134 134
 		}
135 135
 		$this->load->helper('csv');
136
-		array_to_csv($customer_array, 'Customers_' . date("Y-m-d") . '.csv');
136
+		array_to_csv($customer_array, 'Customers_'.date("Y-m-d").'.csv');
137 137
 	}
138 138
 
139 139
 	function provider_add() {
@@ -154,20 +154,20 @@  discard block
 block discarded – undo
154 154
 		$entity_type = strtolower($this->common->get_entity_type('', '', $type));
155 155
 		$data['username'] = $this->session->userdata('user_name');
156 156
 		$data['flag'] = 'create';
157
-		$data['page_title'] = 'Create ' . $entity_type;
157
+		$data['page_title'] = 'Create '.$entity_type;
158 158
 		$data['back_flag'] = true;
159 159
 		$data['country_id'] = $accountinfo['country_id'];
160 160
 		$data['callingcard'] = Common_model::$global_config['system_config']['pinlength'];
161 161
 		$data['currency_id'] = $accountinfo['currency_id'];
162 162
 		$data['timezone_id'] = $accountinfo['timezone_id'];
163 163
 		$data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_type), '');
164
-		if (!$data['timezone_id']) {
164
+		if ( ! $data['timezone_id']) {
165 165
 			$data['timezone_id'] = 1;
166 166
 		}
167
-		if (!$data['currency_id']) {
167
+		if ( ! $data['currency_id']) {
168 168
 			$data['currency_id'] = 1;
169 169
 		}
170
-		if (!$data['country_id']) {
170
+		if ( ! $data['country_id']) {
171 171
 			$data['country_id'] = 1;
172 172
 		}
173 173
 		$data['entity_name'] = $entity_type;
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
183 183
 		$account = $this->db_model->getSelect("*", "accounts", $where);
184 184
 		if ($account->num_rows > 0) {
185
-			$account_data = (array) $account->first_row();
185
+			$account_data = (array)$account->first_row();
186 186
 			$entity_name = strtolower($this->common->get_entity_type('', '', $account_data['type']));
187
-			$data['page_title'] =ucfirst($entity_name) . " Profile";
187
+			$data['page_title'] = ucfirst($entity_name)." Profile";
188 188
 			$data['invoice_date'] = $account_data['invoice_day'];
189 189
 			$data["account_data"] = $account_data;
190 190
 			 $data['callingcard'] = Common_model::$global_config['system_config']['pinlength'];
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 			$account_data['password'] = $this->common->decode($account_data['password']);
203 203
 			/*             * ********************** */
204 204
 			$data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $edit_id), $account_data);
205
-			$data['edit_id']=$edit_id;
205
+			$data['edit_id'] = $edit_id;
206 206
 			$this->load->view('view_customer_details', $data);
207 207
 		} else {
208
-			redirect(base_url() . 'accounts/customer_list/');
208
+			redirect(base_url().'accounts/customer_list/');
209 209
 		}
210 210
 	}
211 211
 
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 		$data['currency_id'] = $add_array['currency_id'];
218 218
 		$data['entity_name'] = $entity_name;
219 219
 		$data['callingcard'] = Common_model::$global_config['system_config']['pinlength'];
220
-		$data['edit_id']=$add_array['id'];
220
+		$data['edit_id'] = $add_array['id'];
221 221
 		$data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $add_array['id']), $add_array);
222 222
 		if ($add_array['id'] != '') {
223
-			$data['page_title'] = 'Edit ' . $this->common->get_entity_type('', '', $add_array['type']);
223
+			$data['page_title'] = 'Edit '.$this->common->get_entity_type('', '', $add_array['type']);
224 224
 			if ($this->form_validation->run() == FALSE) {
225 225
 				$data['validation_errors'] = validation_errors();
226 226
 			} else {
@@ -245,16 +245,16 @@  discard block
 block discarded – undo
245 245
 					unset($add_array['tax_id']);
246 246
 				}
247 247
 				//Completed
248
-				unset($add_array['posttoexternal'],$add_array['number']);
248
+				unset($add_array['posttoexternal'], $add_array['number']);
249 249
 				$this->accounts_model->edit_account($add_array, $add_array['id']);
250
-				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' updated successfully!');
251
-				redirect(base_url() . 'accounts/customer_list/');
250
+				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name).' updated successfully!');
251
+				redirect(base_url().'accounts/customer_list/');
252 252
 				exit;
253 253
 			}
254 254
 			$data["account_data"]["0"] = $add_array;
255 255
 			$this->load->view('view_customer_details', $data);
256 256
 		} else {
257
-			$data['page_title'] = 'Create ' . $entity_name;
257
+			$data['page_title'] = 'Create '.$entity_name;
258 258
 			if ($this->form_validation->run() == FALSE) {
259 259
 				$data['validation_errors'] = validation_errors();
260 260
 			} else {
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 					}
278 278
 					unset($add_array['tax_id']);
279 279
 				}
280
-				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' added successfully!');
281
-				redirect(base_url() . 'accounts/customer_list/');
280
+				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name).' added successfully!');
281
+				redirect(base_url().'accounts/customer_list/');
282 282
 				exit;
283 283
 			}
284 284
 			$this->load->view('view_accounts_create', $data);
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 		$account = $this->db_model->getSelect("*", "accounts", $where);
300 300
 
301 301
 		if ($account->num_rows > 0) {
302
-			$account_data = (array) $account->first_row();
302
+			$account_data = (array)$account->first_row();
303 303
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
304 304
 			$data['page_title'] = 'Speed Dial';
305 305
 			$data['accounttype'] = $accounttype;
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 			$data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($accounttype, $edit_id), $account_data);
319 319
 			$this->load->view('view_customer_speed_dial', $data);
320 320
 		} else {
321
-			redirect(base_url() . 'accounts/customer_list/');
321
+			redirect(base_url().'accounts/customer_list/');
322 322
 		}
323 323
 	}
324 324
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 	function customer_ipmap($edit_id) {
354 354
 		$data['page_title'] = "IP Settings";
355
-		$data['add_form']=true;
355
+		$data['add_form'] = true;
356 356
 		//Get Account information from session.
357 357
 		$accountinfo = $this->session->userdata('accountinfo');
358 358
 		//Get Parent informartion
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
361 361
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
362 362
 		if ($account_res->num_rows > 0) {
363
-			$account_data = (array) $account_res->first_row();
363
+			$account_data = (array)$account_res->first_row();
364 364
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
365 365
 			$data["grid_fields"] = $this->accounts_form->build_ip_list_for_customer($edit_id, $accounttype);
366 366
 			$data['edit_id'] = $edit_id;
367 367
 			$data['accounttype'] = $accounttype;
368 368
 			$this->load->view('view_customer_ipmap', $data);
369 369
 		} else {
370
-			redirect(base_url() . 'accounts/customer_list/');
370
+			redirect(base_url().'accounts/customer_list/');
371 371
 			exit;
372 372
 		}
373 373
 	}
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
 	function customer_ipmap_json($accountid, $accounttype) {
376 376
 		$json_data = array();
377 377
 		$where = array("accountid" => $accountid);
378
-		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_ipmap');
379
-		$like_str=!empty($instant_search) ? "(name like '%$instant_search%'  OR ip like '%$instant_search%' OR prefix like '%$instant_search%' OR created_date like '%$instant_search%' )" :null;
380
-		if(!empty($like_str))
378
+		$instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_ipmap');
379
+		$like_str = ! empty($instant_search) ? "(name like '%$instant_search%'  OR ip like '%$instant_search%' OR prefix like '%$instant_search%' OR created_date like '%$instant_search%' )" : null;
380
+		if ( ! empty($like_str))
381 381
 		$this->db->where($like_str);
382 382
 		$count_all = $this->db_model->countQuery("*", "ip_map", $where);
383 383
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
384 384
 		$json_data = $paging_data["json_paging"];
385
-		if(!empty($like_str))
385
+		if ( ! empty($like_str))
386 386
 		$this->db->where($like_str);
387 387
 		$query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
388 388
 		$grid_fields = json_decode($this->accounts_form->build_ip_list_for_customer($accountid, $accounttype));
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 				if (strpos($ip, '/') !== false) {
404 404
 					$add_array['ip'] = $add_array['ip'];
405 405
 				} else {
406
-					$add_array['ip'] = $add_array['ip'] . '/32';
406
+					$add_array['ip'] = $add_array['ip'].'/32';
407 407
 				}
408 408
 				$where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix']));
409 409
 				$getdata = $this->db_model->countQuery("*", "ip_map", $where);
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 			}
439 439
 			$this->session->set_flashdata('astpp_notification', 'IP removed sucessfully.');
440 440
 		}
441
-		redirect(base_url() . "accounts/" . $accounttype . "_ipmap/" . $accountid . "/");
441
+		redirect(base_url()."accounts/".$accounttype."_ipmap/".$accountid."/");
442 442
 	}
443 443
 
444 444
 	//This function using for provider t
@@ -456,30 +456,30 @@  discard block
 block discarded – undo
456 456
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
457 457
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
458 458
 		if ($account_res->num_rows > 0) {
459
-			$account_data = (array) $account_res->first_row();
459
+			$account_data = (array)$account_res->first_row();
460 460
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
461 461
 			$data["grid_fields"] = $this->accounts_form->build_animap_list_for_customer($edit_id, $accounttype);
462 462
 			$data['edit_id'] = $edit_id;
463 463
 			$data['accounttype'] = $accounttype;
464 464
 			$this->load->view('view_customer_animap', $data);
465 465
 		} else {
466
-			redirect(base_url() . 'accounts/customer_list/');
466
+			redirect(base_url().'accounts/customer_list/');
467 467
 			exit;
468 468
 		}
469 469
 	}
470 470
 
471 471
 	function customer_animap_json($accountid, $accounttype) {
472 472
 		$json_data = array();
473
-		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_animap'); 
474
-		$like_str=!empty($instant_search) ? "(number like '%$instant_search%'  OR  creation_date like '%$instant_search%' )" :null;
475
-		if(!empty($like_str))
473
+		$instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_animap'); 
474
+		$like_str = ! empty($instant_search) ? "(number like '%$instant_search%'  OR  creation_date like '%$instant_search%' )" : null;
475
+		if ( ! empty($like_str))
476 476
 		$this->db->where($like_str);
477 477
 		$where = array("accountid" => $accountid);
478 478
 		$count_all = $this->db_model->countQuery("*", "ani_map", $where);
479 479
 
480 480
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
481 481
 		$json_data = $paging_data["json_paging"];
482
-		if(!empty($like_str))
482
+		if ( ! empty($like_str))
483 483
 		$this->db->where($like_str);
484 484
 		$query = $this->db_model->select("*", "ani_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
485 485
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 	function customer_animap_action($action, $accountid, $aniid = "") {
498 498
 		$entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid));
499 499
 		$entity_type = strtolower($this->common->get_entity_type('', '', $entity_type));
500
-		$url = "accounts/" . $entity_type . "_animap/$accountid/";
500
+		$url = "accounts/".$entity_type."_animap/$accountid/";
501 501
 		if ($action == "add") {
502 502
 			$ani = $this->input->post();
503 503
 			$this->db->where('number', $ani['number']);
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 			$this->session->set_flashdata('astpp_notification', 'Caller ID removed sucessfully!');
528 528
 			$this->db_model->delete("ani_map", array("id" => $aniid));
529 529
 		}
530
-		redirect(base_url() . $url);
530
+		redirect(base_url().$url);
531 531
 	}
532 532
 
533 533
 	//This function using by Customer/Provider edit tab
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 		}
549 549
 		if ($module == "invoices") {
550 550
 			$this->load->module('invoices/invoices');
551
-			$this->invoices->customer_invoices($accountid,$entity_type, false);
551
+			$this->invoices->customer_invoices($accountid, $entity_type, false);
552 552
 		}
553 553
 		if ($module == "subscription") {
554 554
 			$this->load->module('charges/charges');
@@ -560,11 +560,11 @@  discard block
 block discarded – undo
560 560
 		}
561 561
 		if ($module == "charges") {
562 562
 			$this->load->module('reports/reports');
563
-			$this->reports->customer_charge_history($accountid,$entity_type);
563
+			$this->reports->customer_charge_history($accountid, $entity_type);
564 564
 		}
565 565
 		if ($module == "refill") {
566 566
 			$this->load->module('reports/reports');
567
-			$this->reports->customer_refillreport($accountid,$entity_type);
567
+			$this->reports->customer_refillreport($accountid, $entity_type);
568 568
 		}
569 569
 		if ($module == "emailhistory") {
570 570
 			$this->load->module('email/email');
@@ -572,13 +572,13 @@  discard block
 block discarded – undo
572 572
 		}
573 573
 		if ($module == "opensips") {
574 574
 			$this->load->module('opensips/opensips');
575
-			$this->opensips->customer_opensips_json($accountid,$entity_type);
575
+			$this->opensips->customer_opensips_json($accountid, $entity_type);
576 576
 		}
577 577
 	}
578
-	function customer_details_search($module_name){
578
+	function customer_details_search($module_name) {
579 579
 		$action = $this->input->post();
580
-		$this->session->set_userdata('left_panel_search_'.$module_name,"");
581
-		if(!empty($action['left_panel_search'])){
580
+		$this->session->set_userdata('left_panel_search_'.$module_name, "");
581
+		if ( ! empty($action['left_panel_search'])) {
582 582
 			$this->session->set_userdata('left_panel_search_'.$module_name, $action['left_panel_search']);
583 583
 		}
584 584
 	}
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
596 596
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
597 597
 		if ($account_res->num_rows > 0) {
598
-			$account_data = (array) $account_res->first_row();
598
+			$account_data = (array)$account_res->first_row();
599 599
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
600 600
 			$this->load->module('freeswitch/freeswitch');
601 601
 			$data["grid_buttons"] = $this->freeswitch->freeswitch_form->fsdevices_build_grid_buttons($edit_id, $accounttype);
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 			$data['accounttype'] = $accounttype;
605 605
 			$this->load->view('view_customer_sipdevices', $data);
606 606
 		} else {
607
-			redirect(base_url() . 'accounts/customer_list/');
607
+			redirect(base_url().'accounts/customer_list/');
608 608
 			exit;
609 609
 		}
610 610
 	}
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 		if ($action == "delete") {
621 621
 			$this->freeswitch->freeswitch_model->delete_freeswith_devices($id);
622 622
 			$this->session->set_flashdata('astpp_notification', 'Sip Device removed successfully!');
623
-			redirect(base_url() . "accounts/" . $entity_type . "_sipdevices/$accountid/");
623
+			redirect(base_url()."accounts/".$entity_type."_sipdevices/$accountid/");
624 624
 		}
625 625
 		if ($action == "edit") {
626 626
 			$this->freeswitch->customer_fssipdevices_edit($id, $accountid);
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
642 642
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
643 643
 		if ($account_res->num_rows > 0) {
644
-			$account_data = (array) $account_res->first_row();
644
+			$account_data = (array)$account_res->first_row();
645 645
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
646 646
 			$this->load->module('freeswitch/freeswitch');
647 647
 			$this->load->module('opensips/opensips');
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 			$data['accounttype'] = $accounttype;
652 652
 			$this->load->view('view_customer_opensips_devices', $data);
653 653
 		} else {
654
-			redirect(base_url() . 'accounts/customer_list/');
654
+			redirect(base_url().'accounts/customer_list/');
655 655
 			exit;
656 656
 		}
657 657
 	}
@@ -659,12 +659,12 @@  discard block
 block discarded – undo
659 659
 	function customer_opensips_action($action, $accountid, $id) {
660 660
 		$entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid));
661 661
 		$entity_type = strtolower($this->common->get_entity_type('', '', $entity_type));
662
-		$url = "accounts/" . $entity_type . "_opensips/$accountid/";
662
+		$url = "accounts/".$entity_type."_opensips/$accountid/";
663 663
 		$this->load->module('opensips/opensips');
664 664
 		if ($action == "delete") {
665 665
 			$this->opensips->opensips_model->remove_opensips($id);
666 666
 			$this->session->set_flashdata('astpp_notification', 'Opensips removed successfully!');
667
-			redirect(base_url() . $url);
667
+			redirect(base_url().$url);
668 668
 		}
669 669
 		if ($action == "edit") {
670 670
 			$this->opensips->customer_opensips_edit($accountid, $id);
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
690 690
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
691 691
 		if ($account_res->num_rows > 0) {
692
-			$account_data = (array) $account_res->first_row();
692
+			$account_data = (array)$account_res->first_row();
693 693
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
694 694
 			$data['chargelist'] = form_dropdown('applayable_charge', $this->Astpp_common->list_applyable_charges($edit_id), '');
695 695
 			$this->load->module('reports/reports');
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 			$data['accounttype'] = $accounttype;
699 699
 			$this->load->view('view_customer_charges', $data);
700 700
 		} else {
701
-			redirect(base_url() . 'accounts/customer_list/');
701
+			redirect(base_url().'accounts/customer_list/');
702 702
 			exit;
703 703
 		}
704 704
 	}
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
721 721
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
722 722
 		if ($account_res->num_rows > 0) {
723
-			$account_data = (array) $account_res->first_row();
723
+			$account_data = (array)$account_res->first_row();
724 724
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
725 725
 			$data['chargelist'] = form_dropdown_all(array("name" => 'applayable_charge', 'id' => 'applayable_charge', 'class' => ""), $this->Astpp_common->list_applyable_charges($edit_id), '');
726 726
 			$this->load->module('charges/charges');
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 			$data['accounttype'] = $accounttype;
730 730
 			$this->load->view('view_customer_subscriptions', $data);
731 731
 		} else {
732
-			redirect(base_url() . 'accounts/customer_list/');
732
+			redirect(base_url().'accounts/customer_list/');
733 733
 			exit;
734 734
 		}
735 735
 	}
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
           For Email Broadcast when Subscription Add - Delete
750 750
 		 * */
751 751
 		$accountinfo = $this->db_model->getSelect("*", "accounts", array("id" => $accountid));
752
-		$accountinfo = (array) $accountinfo->first_row();
752
+		$accountinfo = (array)$accountinfo->first_row();
753 753
 		/*         * ****************************** */
754 754
 		if ($action == "add") {
755 755
 			$charge_id = $this->input->post("applayable_charge", true);
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 		 * */
772 772
 		$this->common->mail_to_users($template_name, $accountinfo);
773 773
 		/*         * ********************************* */
774
-		redirect(base_url() . "accounts/" . $accounttype . "_subscription/$accountid/");
774
+		redirect(base_url()."accounts/".$accounttype."_subscription/$accountid/");
775 775
 	}
776 776
 
777 777
 	function provider_dids($edit_id) {
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
788 788
 		$account_res = $this->db_model->getSelect("type,country_id", "accounts", $where);
789 789
 		if ($account_res->num_rows > 0) {
790
-			$account_data = (array) $account_res->first_row();
790
+			$account_data = (array)$account_res->first_row();
791 791
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
792 792
 			$this->load->module('did/did');
793 793
 			$data['grid_fields'] = $this->did->did_form->build_did_list_for_customer($edit_id, $accounttype);
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 			$data['country_id'] = $account_data['country_id'];
800 800
 			$this->load->view('view_customer_dids', $data);
801 801
 		} else {
802
-			redirect(base_url() . 'accounts/customer_list/');
802
+			redirect(base_url().'accounts/customer_list/');
803 803
 			exit;
804 804
 		}
805 805
 	}
@@ -820,16 +820,16 @@  discard block
 block discarded – undo
820 820
 		$did_id = empty($did_id) ? $this->input->post("free_didlist", true) : $did_id;
821 821
 		if ($did_id != "") {
822 822
 			$account_arr = (array)$this->db->get_where("accounts", array("id" => $accountid))->first_row();
823
-			$did_arr = (array) $this->db->get_where("dids", array("id" => $did_id))->first_row();
824
-			$field_name = $account_arr['type'] ==1 ? "parent_id" : 'accountid';
823
+			$did_arr = (array)$this->db->get_where("dids", array("id" => $did_id))->first_row();
824
+			$field_name = $account_arr['type'] == 1 ? "parent_id" : 'accountid';
825 825
 			if ($action == "add") {
826 826
 				if ($did_arr['accountid'] == 0 && $did_arr['parent_id'] == $reseller_id) {
827 827
 					if ($accountinfo['type'] == 1) {
828 828
 						//for getting reseller setup price if reseller customer purchase
829 829
 						$reseller_pricing_query = $this->db_model->getSelect("*", "reseller_pricing", array("note" => $did_arr['number'], 'reseller_id' => $reseller_id));
830 830
 						if ($reseller_pricing_query->num_rows() > 0) {
831
-							$reseller_pricing = (array) $reseller_pricing_query->first_row();
832
-							$did_arr=array_merge($did_arr,$reseller_pricing);
831
+							$reseller_pricing = (array)$reseller_pricing_query->first_row();
832
+							$did_arr = array_merge($did_arr, $reseller_pricing);
833 833
 						}
834 834
 					}
835 835
 					$available_bal = $this->db_model->get_available_bal($account_arr);
@@ -867,12 +867,12 @@  discard block
 block discarded – undo
867 867
 					$this->db->where('note', $did_arr['number']);
868 868
 					$this->db->delete('reseller_pricing');
869 869
 				}
870
-				$account_arr['did_number']=$did_arr['number'];
870
+				$account_arr['did_number'] = $did_arr['number'];
871 871
 				$this->common->mail_to_users('email_remove_did', $account_arr);
872 872
 				$this->session->set_flashdata('astpp_notification', 'Did Removed Successfully.');
873 873
 			}
874 874
 		}
875
-		redirect(base_url() . "accounts/" . $accounttype . "_dids/$accountid/");
875
+		redirect(base_url()."accounts/".$accounttype."_dids/$accountid/");
876 876
 	}
877 877
 
878 878
 	function provider_invoices($edit_id) {
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
893 893
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
894 894
 		if ($account_res->num_rows > 0) {
895
-			$account_data = (array) $account_res->first_row();
895
+			$account_data = (array)$account_res->first_row();
896 896
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
897 897
 			$this->load->module('invoices/invoices');
898 898
 			$data['grid_fields'] = $this->invoices->invoices_form->build_invoices_list_for_customer_admin(false);
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 			$data['accounttype'] = $accounttype;
901 901
 			$this->load->view('view_customer_invoices', $data);
902 902
 		} else {
903
-			redirect(base_url() . 'accounts/customer_list/');
903
+			redirect(base_url().'accounts/customer_list/');
904 904
 			exit;
905 905
 		}
906 906
 	}
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
919 919
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
920 920
 		if ($account_res->num_rows > 0) {
921
-			$account_data = (array) $account_res->first_row();
921
+			$account_data = (array)$account_res->first_row();
922 922
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
923 923
 			$this->load->module('rates/rates');
924 924
 			$data['grid_fields'] = $this->rates->rates_form->build_pattern_list_for_customer($edit_id, $accounttype);
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 			$data['accounttype'] = $accounttype;
928 928
 			$this->load->view('view_customer_blocked_prefixes', $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
 	}
@@ -968,16 +968,16 @@  discard block
 block discarded – undo
968 968
 	function customer_delete_block_pattern($accountid, $patternid) {
969 969
 		$entity_type = $this->common->get_field_name('type', 'accounts', array('id' => $accountid));
970 970
 		$entity_type = strtolower($this->common->get_entity_type('', '', $entity_type));
971
-		$url = "accounts/" . $entity_type . "_blocked_prefixes/$accountid";
971
+		$url = "accounts/".$entity_type."_blocked_prefixes/$accountid";
972 972
 		$this->db_model->delete("block_patterns", array("id" => $patternid));
973 973
 		$this->session->set_flashdata('astpp_notification', 'Block Code Removed Sucessfully!');
974 974
         
975
-		redirect(base_url() . $url);
975
+		redirect(base_url().$url);
976 976
 	}
977
-	function customer_blockedprefixes_delete_multiple(){
977
+	function customer_blockedprefixes_delete_multiple() {
978 978
 		$ids = $this->input->post("selected_ids", true);
979 979
 		$where = "id IN ($ids)";
980
-		$this->db->delete("block_patterns",$where);
980
+		$this->db->delete("block_patterns", $where);
981 981
 		echo TRUE;
982 982
 	}
983 983
 
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
1013 1013
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
1014 1014
 		if ($account_res->num_rows > 0) {
1015
-			$account_data = (array) $account_res->first_row();
1015
+			$account_data = (array)$account_res->first_row();
1016 1016
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
1017 1017
 			$this->load->module('reports/reports');
1018 1018
 			$data['grid_fields'] = $this->reports->reports_form->build_report_list_for_user($accounttype);
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 			$data['accounttype'] = $accounttype;
1021 1021
 			$this->load->view('view_customer_cdrs_list', $data);
1022 1022
 		} else {
1023
-			redirect(base_url() . 'accounts/customer_list/');
1023
+			redirect(base_url().'accounts/customer_list/');
1024 1024
 			exit;
1025 1025
 		}
1026 1026
 	}
@@ -1029,27 +1029,27 @@  discard block
 block discarded – undo
1029 1029
 	/* ASTPP  3.0 
1030 1030
      * Using for provider refillreporttab.
1031 1031
      */
1032
-	function reseller_packages($edit_id){
1032
+	function reseller_packages($edit_id) {
1033 1033
 	   $data['page_title'] = "Packages";
1034 1034
 	   $accountinfo = $this->session->userdata('accountinfo');
1035 1035
 	   $reseller_id = ($accountinfo['type'] == 1 || $accountinfo['type'] == 5) ? $accountinfo['id'] : 0;
1036 1036
 	   $where = array('id' => $edit_id, "reseller_id" => $reseller_id);
1037 1037
 	   $account_res = $this->db_model->getSelect("type", "accounts", $where);
1038 1038
 	   if ($account_res->num_rows > 0) {
1039
-			$account_data = (array) $account_res->first_row();
1039
+			$account_data = (array)$account_res->first_row();
1040 1040
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
1041 1041
 			$this->load->module('package/package');
1042 1042
 			$data['grid_fields'] = $this->package->package_form->build_package_list_for_reseller();
1043 1043
 			$data['edit_id'] = $edit_id;
1044 1044
 			$data['accounttype'] = $accounttype;
1045 1045
 			$this->load->view('view_reseller_package_list', $data);
1046
-	   }else {
1047
-			redirect(base_url() . 'accounts/reseller_list/');
1046
+	   } else {
1047
+			redirect(base_url().'accounts/reseller_list/');
1048 1048
 			exit;
1049 1049
 	   }
1050 1050
 	} 
1051 1051
      
1052
-	function reseller_refillreport($edit_id){
1052
+	function reseller_refillreport($edit_id) {
1053 1053
 	  $this->customer_refillreport($edit_id);
1054 1054
 	}
1055 1055
 	function provider_refillreport($edit_id) {
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
1071 1071
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
1072 1072
 		if ($account_res->num_rows > 0) {
1073
-			$account_data = (array) $account_res->first_row();
1073
+			$account_data = (array)$account_res->first_row();
1074 1074
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
1075 1075
 			$this->load->module('reports/reports');
1076 1076
 			$data['grid_fields'] = $this->reports->reports_form->build_refillreport_for_customer();
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 			$data['accounttype'] = $accounttype;
1079 1079
 			$this->load->view('view_customer_refill_report', $data);
1080 1080
 		} else {
1081
-			redirect(base_url() . 'accounts/customer_list/');
1081
+			redirect(base_url().'accounts/customer_list/');
1082 1082
 			exit;
1083 1083
 		}
1084 1084
 	}
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
1109 1109
 		$account_res = $this->db_model->getSelect("type", "accounts", $where);
1110 1110
 		if ($account_res->num_rows > 0) {
1111
-			$account_data = (array) $account_res->first_row();
1111
+			$account_data = (array)$account_res->first_row();
1112 1112
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
1113 1113
 			$this->load->module('email/email');
1114 1114
 			$data['grid_fields'] = $this->email->email_form->build_list_for_email_customer($edit_id, $accounttype);
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 			$data['accounttype'] = $accounttype;
1117 1117
 			$this->load->view('view_customer_email_history', $data);
1118 1118
 		} else {
1119
-			redirect(base_url() . 'accounts/customer_list/');
1119
+			redirect(base_url().'accounts/customer_list/');
1120 1120
 			exit;
1121 1121
 		}
1122 1122
 	}
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 		$where = array('id' => $edit_id, "reseller_id" => $reseller_id);
1148 1148
 		$account_res = $this->db_model->getSelect("notify_credit_limit,notify_flag,notify_email,type,id", "accounts", $where);
1149 1149
 		if ($account_res->num_rows > 0) {
1150
-			$account_data = (array) $account_res->first_row();
1150
+			$account_data = (array)$account_res->first_row();
1151 1151
 			$accounttype = strtolower($this->common->get_entity_type('', '', $account_data['type']));
1152 1152
 			unset($account_data['type']);
1153 1153
 			$data['form'] = $this->form->build_form($this->accounts_form->customer_alert_threshold($accounttype), $account_data);
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 			$data['accounttype'] = $accounttype;
1156 1156
 			$this->load->view('view_customer_alert_threshold', $data);
1157 1157
 		} else {
1158
-			redirect(base_url() . 'accounts/customer_list/');
1158
+			redirect(base_url().'accounts/customer_list/');
1159 1159
 			exit;
1160 1160
 		}
1161 1161
 	}
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 
1169 1169
 	function customer_alert_threshold_save($entity_type) {
1170 1170
 		$add_array = $this->input->post();
1171
-		if (isset($add_array['id']) && !empty($add_array['id'])) {
1171
+		if (isset($add_array['id']) && ! empty($add_array['id'])) {
1172 1172
 			$data['page_title'] = "Alert Threshold";
1173 1173
 			$data['form'] = $this->form->build_form($this->accounts_form->customer_alert_threshold($entity_type), $add_array);
1174 1174
 			$data['edit_id'] = $add_array['id'];
@@ -1184,38 +1184,38 @@  discard block
 block discarded – undo
1184 1184
 					$data['validation_errors'] = validation_errors();
1185 1185
 				} else {
1186 1186
 					$this->db->where('id', $add_array['id']);
1187
-					$id=$add_array['id'];
1187
+					$id = $add_array['id'];
1188 1188
 					unset($add_array['id'], $add_array['action']);
1189 1189
 					$this->db->update('accounts', $add_array);
1190
-					$this->session->set_flashdata('astpp_errormsg','Alert threshold updated successfully!');
1191
-					redirect(base_url() . 'accounts/'.$entity_type.'_alert_threshold/'.$id."/");
1190
+					$this->session->set_flashdata('astpp_errormsg', 'Alert threshold updated successfully!');
1191
+					redirect(base_url().'accounts/'.$entity_type.'_alert_threshold/'.$id."/");
1192 1192
 					exit;
1193 1193
 				}
1194 1194
 			} else {
1195
-				redirect(base_url() . 'accounts/'.$entity_type.'_list/');
1195
+				redirect(base_url().'accounts/'.$entity_type.'_list/');
1196 1196
 				exit;
1197 1197
 			}
1198 1198
 			$this->load->view('view_customer_alert_threshold', $data);
1199 1199
 		} else {
1200
-			redirect(base_url() . 'accounts/customer_list/');
1200
+			redirect(base_url().'accounts/customer_list/');
1201 1201
 			exit;
1202 1202
 		}
1203 1203
 	}
1204 1204
 
1205 1205
 	function customer_bulk_creation() {
1206
-		$type=0;
1206
+		$type = 0;
1207 1207
 		$data['entity_name'] = strtolower($this->common->get_entity_type('', '', $type));
1208 1208
 		$data['page_title'] = 'Mass Customer';
1209 1209
 		$data['country_id'] = Common_model::$global_config['system_config']['country'];
1210 1210
 		$data['currency_id'] = $this->common->get_field_name('id', 'currency', array('currency' => Common_model::$global_config['system_config']['base_currency']));
1211 1211
 		$data['timezone_id'] = Common_model::$global_config['system_config']['default_timezone'];
1212
-		if (!$data['timezone_id']) {
1212
+		if ( ! $data['timezone_id']) {
1213 1213
 			$data['timezone_id'] = 1;
1214 1214
 		}
1215
-		if (!$data['currency_id']) {
1215
+		if ( ! $data['currency_id']) {
1216 1216
 			$data['currency_id'] = 1;
1217 1217
 		}
1218
-		if (!$data['country_id']) {
1218
+		if ( ! $data['country_id']) {
1219 1219
 			$data['country_id'] = 1;
1220 1220
 		}
1221 1221
 		$data['form'] = $this->form->build_form($this->accounts_form->customer_bulk_generate_form(), '');
@@ -1225,17 +1225,17 @@  discard block
 block discarded – undo
1225 1225
 	function customer_bulk_save() {
1226 1226
 		$data['page_title'] = 'Create Bulk Customer';
1227 1227
 		$add_array = $this->input->post();
1228
-		if (!empty($add_array) && isset($add_array)) {
1228
+		if ( ! empty($add_array) && isset($add_array)) {
1229 1229
 			$currentlength = $this->accounts_model->get_max_limit($add_array);
1230 1230
 			$account_data = $this->session->userdata("accountinfo");
1231
-			$add_array['reseller_id'] = $account_data['type']==1 ? $account_data['id']:0;
1231
+			$add_array['reseller_id'] = $account_data['type'] == 1 ? $account_data['id'] : 0;
1232 1232
 			$data['form'] = $this->form->build_form($this->accounts_form->customer_bulk_generate_form(), $add_array);
1233 1233
 			if ($this->form_validation->run() == FALSE) {
1234 1234
 				$data['validation_errors'] = validation_errors();
1235 1235
 				echo $data['validation_errors'];
1236 1236
 				exit;
1237 1237
 			}
1238
-			if($currentlength <= 0){
1238
+			if ($currentlength <= 0) {
1239 1239
 		echo json_encode(array("prefix_error" => "Your Account Limit has been reached.Please Change Your Prefix."));
1240 1240
 				exit;
1241 1241
 			}
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 				exit;
1245 1245
 			}
1246 1246
 			if ($currentlength > 0 && $add_array['count'] > $currentlength) {
1247
-				echo json_encode(array("count_error" => "You Can Create Maximum " . $currentlength . " accounts with " . $add_array['prefix'] . " prefix"));
1247
+				echo json_encode(array("count_error" => "You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix"));
1248 1248
 				exit;
1249 1249
 			} else {
1250 1250
 				$this->accounts_model->bulk_insert_accounts($add_array);
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
 				exit;
1253 1253
 			}
1254 1254
 		} else {
1255
-			redirect(base_url() . "accounts/customer_list/");
1255
+			redirect(base_url()."accounts/customer_list/");
1256 1256
 		}
1257 1257
 	}
1258 1258
 
@@ -1269,13 +1269,13 @@  discard block
 block discarded – undo
1269 1269
 
1270 1270
 	function customer_did_country() {
1271 1271
 		$country_id = $_POST['country_id'];
1272
-		$accountid= $this->input->post('accountid',true);
1272
+		$accountid = $this->input->post('accountid', true);
1273 1273
 		$accountinfo = $this->session->userdata("accountinfo");
1274
-		$entity_info=(array)$this->db->get_where('accounts',array("id"=>$accountid))->first_row();
1274
+		$entity_info = (array)$this->db->get_where('accounts', array("id"=>$accountid))->first_row();
1275 1275
 		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
1276 1276
 		if ($entity_info['reseller_id'] > 0) {
1277 1277
 			$parent_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : $accountinfo['reseller_id'];
1278
-			$query = 'select dids.id as id,dids.number as number,reseller_pricing.setup as setup, reseller_pricing.monthlycost as monthlycost from dids,reseller_pricing where dids.number= reseller_pricing.note and reseller_pricing.reseller_id =' . $parent_id . " and dids.accountid=0 and dids.country_id =" . $country_id;
1278
+			$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;
1279 1279
 			$did_list = $this->db->query($query);
1280 1280
 		} else {
1281 1281
 			$did_list = $this->db_model->getSelect("id,number,setup,monthlycost", "dids", array('country_id' => $country_id, 'accountid' => '0', 'parent_id' => $reseller_id));
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
 		if ($did_list->num_rows > 0) {
1285 1285
 			$did_data = $did_list->result_array();
1286 1286
 			foreach ($did_data as $key => $value) {
1287
-				$did_arr[$value['id']] = $value['number'] . " (Setup Cost : " . $this->common_model->calculate_currency($value['setup'], '', '', true) . ") (Monthly cost : " . $this->common_model->calculate_currency($value['monthlycost'], '', '', true) . ")";
1287
+				$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).")";
1288 1288
 			}
1289 1289
 		}
1290 1290
 		$did_info = array("name" => "free_didlist", "id" => "free_didlist", "class" => "free_didlist");
@@ -1319,28 +1319,28 @@  discard block
 block discarded – undo
1319 1319
 			$username = $this->session->userdata('username');
1320 1320
 		$login_user_data = $this->session->userdata("accountinfo");
1321 1321
 			$accountinfo = $this->accounts_model->get_account_by_number($post_array['id']);
1322
-			if($accountinfo['reseller_id'] == 0){
1322
+			if ($accountinfo['reseller_id'] == 0) {
1323 1323
 			   $where = array("accountid"=> 1);
1324
-		}else{
1324
+		} else {
1325 1325
 			$where = array("accountid"=> $accountinfo['id']);    
1326 1326
 		}
1327 1327
 		$query = $this->db_model->getSelect("*", "invoice_conf", $where);
1328
-		if($query->num_rows >0){
1328
+		if ($query->num_rows > 0) {
1329 1329
 			$invoice_conf = $query->result_array();
1330 1330
 			$invoice_conf = $invoice_conf[0];
1331
-		}else{
1332
-			$query = $this->db_model->getSelect("*", "invoice_conf",array("accountid"=> 1));
1331
+		} else {
1332
+			$query = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> 1));
1333 1333
 			$invoice_conf = $query->result_array();
1334 1334
 			$invoice_conf = $invoice_conf[0];            
1335 1335
 		}
1336
-		 $last_invoice_ID = $this->get_invoice_date("invoiceid",$accountinfo["id"]);
1337
-		 $invoice_prefix=$invoice_conf['invoice_prefix'];
1338
-		  $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoice_conf['interval']." days"));
1336
+		 $last_invoice_ID = $this->get_invoice_date("invoiceid", $accountinfo["id"]);
1337
+		 $invoice_prefix = $invoice_conf['invoice_prefix'];
1338
+		  $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoice_conf['interval']." days"));
1339 1339
 				$response = $this->accounts_model->account_process_payment($post_array);
1340 1340
 
1341
-				if($post_array['payment_type']== 1 ){
1341
+				if ($post_array['payment_type'] == 1) {
1342 1342
 			$this->load->module('invoices/invoices');
1343
-			$invoice_id=$this->invoices->invoices->generate_receipt($post_array['id'],$post_array['credit'],$accountinfo,$last_invoice_ID+1,$invoice_prefix,$due_date);
1343
+			$invoice_id = $this->invoices->invoices->generate_receipt($post_array['id'], $post_array['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date);
1344 1344
 		$account_balance = $this->common->get_field_name('balance', 'accounts', $post_array['id']);
1345 1345
 			$insert_arr = array("accountid" => $post_array['id'],
1346 1346
 					  "description" => trim($post_array['notes']),
@@ -1351,13 +1351,13 @@  discard block
 block discarded – undo
1351 1351
 					  "reseller_id"=>'0',
1352 1352
 					  "item_type"=>'POSTCHARG',
1353 1353
 					  "item_id"=>'0',
1354
-  					  'before_balance'=>$account_balance+$post_array['credit'],
1354
+  					  'before_balance'=>$account_balance + $post_array['credit'],
1355 1355
 					  'after_balance'=>$account_balance,
1356 1356
 					);
1357 1357
 			$this->db->insert("invoice_details", $insert_arr);
1358
-				}else{
1358
+				} else {
1359 1359
 			$this->load->module('invoices/invoices');
1360
-			$invoice_id=$this->invoices->invoices->generate_receipt($post_array['id'],$post_array['credit'],$accountinfo,$last_invoice_ID+1,$invoice_prefix,$due_date);
1360
+			$invoice_id = $this->invoices->invoices->generate_receipt($post_array['id'], $post_array['credit'], $accountinfo, $last_invoice_ID + 1, $invoice_prefix, $due_date);
1361 1361
 			$account_balance = $this->common->get_field_name('balance', 'accounts', $post_array['id']);
1362 1362
 			$insert_arr = array("accountid" => $post_array['id'],
1363 1363
 					  "description" => trim($post_array['notes']),
@@ -1368,22 +1368,22 @@  discard block
 block discarded – undo
1368 1368
 					  "reseller_id"=>$accountinfo['reseller_id'],
1369 1369
 					  "item_type"=>'Refill',
1370 1370
 					  "item_id"=>'0',
1371
-  					  'before_balance'=>$account_balance-$post_array['credit'],
1371
+  					  'before_balance'=>$account_balance - $post_array['credit'],
1372 1372
 					  'after_balance'=>$account_balance,
1373 1373
 					);
1374 1374
 			$this->db->insert("invoice_details", $insert_arr);
1375
-			if($login_user_data['type'] ==1){
1376
-			  $reseller_ids=$this->common->get_parent_info($login_user_data['id'],0);
1377
-			  $reseller_ids=rtrim($reseller_ids,",");
1378
-			  $reseller_arr=explode(",",$reseller_ids);
1379
-			  if(!empty($reseller_arr)){
1380
-			 $custom_array=$post_array;
1381
-			foreach($reseller_arr as $key=>$reseller_id){
1382
-			  $custom_array['id']=$reseller_id;
1375
+			if ($login_user_data['type'] == 1) {
1376
+			  $reseller_ids = $this->common->get_parent_info($login_user_data['id'], 0);
1377
+			  $reseller_ids = rtrim($reseller_ids, ",");
1378
+			  $reseller_arr = explode(",", $reseller_ids);
1379
+			  if ( ! empty($reseller_arr)) {
1380
+			 $custom_array = $post_array;
1381
+			foreach ($reseller_arr as $key=>$reseller_id) {
1382
+			  $custom_array['id'] = $reseller_id;
1383 1383
 			  $response = $this->accounts_model->account_process_payment($custom_array);
1384
-			  $reseller_info=(array)$this->db->get_where('accounts',array("id"=>$reseller_id))->first_row();
1385
-			  $last_invoice_ID = $this->get_invoice_date("invoiceid",$reseller_info["id"]);
1386
-			  $invoice_id=$this->invoices->invoices->generate_receipt($reseller_info['id'],$custom_array['credit'],$reseller_info,$last_invoice_ID+1,$invoice_prefix,$due_date);
1384
+			  $reseller_info = (array)$this->db->get_where('accounts', array("id"=>$reseller_id))->first_row();
1385
+			  $last_invoice_ID = $this->get_invoice_date("invoiceid", $reseller_info["id"]);
1386
+			  $invoice_id = $this->invoices->invoices->generate_receipt($reseller_info['id'], $custom_array['credit'], $reseller_info, $last_invoice_ID + 1, $invoice_prefix, $due_date);
1387 1387
 			  $account_balance = $this->common->get_field_name('balance', 'accounts', $reseller_info['id']);
1388 1388
 			  $insert_arr = array("accountid" => $reseller_info['id'],
1389 1389
 				      "description" => trim($custom_array['notes']),
@@ -1414,11 +1414,11 @@  discard block
 block discarded – undo
1414 1414
     /**
1415 1415
      * @param string $select
1416 1416
      */
1417
-    function get_invoice_date($select,$accountid){
1418
-	$query = $this->db_model->select($select, "invoices", '',"id","DESC","1","0");
1419
-	if($query->num_rows >0){
1417
+    function get_invoice_date($select, $accountid) {
1418
+	$query = $this->db_model->select($select, "invoices", '', "id", "DESC", "1", "0");
1419
+	if ($query->num_rows > 0) {
1420 1420
 		$invoiceid = $query->result_array();
1421
-		$invoice_date=$invoiceid[0][$select];
1421
+		$invoice_date = $invoiceid[0][$select];
1422 1422
 		return  $invoice_date;
1423 1423
 	}
1424 1424
 	return false;
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
 		$data['form'] = $this->form->build_form($this->accounts_form->get_customer_callerid_fields(), $data);
1456 1456
 		$post_array = $this->input->post();
1457 1457
         
1458
-		if (!empty($post_array)) {
1458
+		if ( ! empty($post_array)) {
1459 1459
 			if ($this->form_validation->run() == FALSE) {
1460 1460
 				$data['validation_errors'] = validation_errors();
1461 1461
 				echo $data['validation_errors'];
@@ -1484,13 +1484,13 @@  discard block
 block discarded – undo
1484 1484
 		$data['country_id'] = $accountinfo['country_id'];
1485 1485
 		$data['currency_id'] = $accountinfo['currency_id'];
1486 1486
 		$data['timezone_id'] = $accountinfo['timezone_id'];
1487
-		if (!$data['timezone_id']) {
1487
+		if ( ! $data['timezone_id']) {
1488 1488
 			$data['timezone_id'] = 1;
1489 1489
 		}
1490
-		if (!$data['currency_id']) {
1490
+		if ( ! $data['currency_id']) {
1491 1491
 			$data['currency_id'] = 1;
1492 1492
 		}
1493
-		if (!$data['country_id']) {
1493
+		if ( ! $data['country_id']) {
1494 1494
 			$data['country_id'] = 1;
1495 1495
 		}
1496 1496
 
@@ -1518,17 +1518,17 @@  discard block
 block discarded – undo
1518 1518
 		 * */
1519 1519
 		$encrypted_string = $this->common->encode($edit_data['id']);
1520 1520
 		$encrypt = $this->common->encode_params($encrypted_string);
1521
-		$edit_data['registration_url'] = base_url() . "signup/" . $encrypt;
1521
+		$edit_data['registration_url'] = base_url()."signup/".$encrypt;
1522 1522
 		/*         * *********************************************************** */
1523 1523
 		/*         * ***
1524 1524
           ASTPP  3.0 
1525 1525
           Password decode
1526 1526
          * **** */
1527 1527
 		$edit_data['password'] = $this->common->decode($edit_data['password']);
1528
-		$edit_data['credit_limit']=$this->common_model->calculate_currency(($edit_data['credit_limit']),'','',true,false);
1528
+		$edit_data['credit_limit'] = $this->common_model->calculate_currency(($edit_data['credit_limit']), '', '', true, false);
1529 1529
 		$entity_name = strtolower($this->common->get_entity_type('', '', $edit_data['type']));
1530
-		$data['edit_id']=$edit_id;
1531
-		$data['page_title'] =ucfirst($entity_name)." Profile";
1530
+		$data['edit_id'] = $edit_id;
1531
+		$data['page_title'] = ucfirst($entity_name)." Profile";
1532 1532
 		$data['entity_name'] = $entity_name;
1533 1533
 		/*         * ********************** */
1534 1534
 		$data['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields($edit_id), $edit_data);
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
 		$data['timezone_id'] = $add_array['timezone_id'];
1545 1545
 		$data['currency_id'] = $add_array['currency_id'];
1546 1546
 		$data['entity_name'] = $entity_name;
1547
-		$data['edit_id']=$add_array['id'];
1547
+		$data['edit_id'] = $add_array['id'];
1548 1548
 		$data['form'] = $this->form->build_form($this->accounts_form->get_form_reseller_fields($add_array['id']), $add_array);
1549 1549
 		if ($add_array['id'] != '') {
1550 1550
 			$data['page_title'] = 'Edit Reseller';
@@ -1569,11 +1569,11 @@  discard block
 block discarded – undo
1569 1569
 					}
1570 1570
 					unset($add_array['tax_id']);
1571 1571
 				}
1572
-				unset($add_array['number'],$add_array['registration_url']);
1572
+				unset($add_array['number'], $add_array['registration_url']);
1573 1573
 				$this->accounts_model->edit_account($add_array, $add_array['id']);
1574 1574
 				$this->session->set_flashdata('astpp_errormsg', 'Reseller updated successfully!');
1575 1575
 
1576
-				redirect(base_url() . 'accounts/reseller_list/');
1576
+				redirect(base_url().'accounts/reseller_list/');
1577 1577
 				exit;
1578 1578
 			}
1579 1579
 			$data["account_data"]["0"] = $add_array;
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 					unset($add_array['tax_id']);
1622 1622
 				}
1623 1623
 				$this->session->set_flashdata('astpp_errormsg', 'Reseller added successfully!');
1624
-				redirect(base_url() . 'accounts/reseller_list/');
1624
+				redirect(base_url().'accounts/reseller_list/');
1625 1625
 				exit;
1626 1626
 			}
1627 1627
 			$this->load->view('view_accounts_create', $data);
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
 		echo $this->common->generate_password();
1637 1637
 	}
1638 1638
 
1639
-	function customer_generate_number($digit='') {
1639
+	function customer_generate_number($digit = '') {
1640 1640
        
1641 1641
 		echo $this->common->find_uniq_rendno($digit, 'number', 'accounts');
1642 1642
 	}
@@ -1647,19 +1647,19 @@  discard block
 block discarded – undo
1647 1647
 		$entitytype = str_replace(' ', '', $entity_type);
1648 1648
 		$data['username'] = $this->session->userdata('user_name');
1649 1649
 		$data['flag'] = 'create';
1650
-		$data['page_title'] = 'Create ' . ucfirst($entity_type);
1650
+		$data['page_title'] = 'Create '.ucfirst($entity_type);
1651 1651
 		$data['back_flag'] = true;
1652 1652
 		$data['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype), '');
1653 1653
 		$data['country_id'] = $accountinfo['country_id'];
1654 1654
 		$data['currency_id'] = $accountinfo['currency_id'];
1655 1655
 		$data['timezone_id'] = $accountinfo['timezone_id'];
1656
-		if (!$data['timezone_id']) {
1656
+		if ( ! $data['timezone_id']) {
1657 1657
 			$data['timezone_id'] = 1;
1658 1658
 		}
1659
-		if (!$data['currency_id']) {
1659
+		if ( ! $data['currency_id']) {
1660 1660
 			$data['currency_id'] = 1;
1661 1661
 		}
1662
-		if (!$data['country_id']) {
1662
+		if ( ! $data['country_id']) {
1663 1663
 			$data['country_id'] = 1;
1664 1664
 		}
1665 1665
 		$data['entity_name'] = $entity_type;
@@ -1668,13 +1668,13 @@  discard block
 block discarded – undo
1668 1668
 
1669 1669
 	function admin_edit($edit_id = '') {
1670 1670
 	$data['back_flag'] = true;
1671
-		$accountinfo=(array)$this->db->get_where('accounts',array("id"=>$edit_id))->first_row();
1671
+		$accountinfo = (array)$this->db->get_where('accounts', array("id"=>$edit_id))->first_row();
1672 1672
 		$type = $accountinfo['type'] == -1 ? 2 : $accountinfo['type'];
1673 1673
 		$entity_type = strtolower($this->common->get_entity_type('', '', $type));
1674 1674
 		$entitytype = str_replace(' ', '', $entity_type);
1675 1675
 		$accountinfo['password'] = $this->common->decode($accountinfo['password']);
1676 1676
 		$data['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype, $edit_id), $accountinfo);
1677
-		$data['page_title'] = 'Edit ' . ucfirst($entity_type);
1677
+		$data['page_title'] = 'Edit '.ucfirst($entity_type);
1678 1678
 		$this->load->view('view_admin_details', $data);
1679 1679
         
1680 1680
 		}
@@ -1687,10 +1687,10 @@  discard block
 block discarded – undo
1687 1687
 		$entitytype = str_replace(' ', '', $entity_type);
1688 1688
 		$data['username'] = $this->session->userdata('user_name');
1689 1689
 		$data['flag'] = 'create';
1690
-		$data['page_title'] = 'Create ' . $entity_type;
1690
+		$data['page_title'] = 'Create '.$entity_type;
1691 1691
 		$data['form'] = $this->form->build_form($this->accounts_form->get_form_admin_fields($entitytype, $add_array['id']), $add_array);
1692 1692
 		if ($add_array['id'] != '') {
1693
-			$data['page_title'] = 'Edit ' . $entity_type;
1693
+			$data['page_title'] = 'Edit '.$entity_type;
1694 1694
 			if ($this->form_validation->run() == FALSE) {
1695 1695
 				$data['validation_errors'] = validation_errors();
1696 1696
 			} else {
@@ -1719,13 +1719,13 @@  discard block
 block discarded – undo
1719 1719
 					$result = $result->result_array();
1720 1720
 					$this->session->set_userdata('accountinfo', $result[0]);
1721 1721
 				}
1722
-				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type) . ' updated successfully!');
1723
-				redirect(base_url() . 'accounts/admin_list/');
1722
+				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type).' updated successfully!');
1723
+				redirect(base_url().'accounts/admin_list/');
1724 1724
 				exit;
1725 1725
 			}
1726 1726
 			$this->load->view('view_admin_details', $data);
1727 1727
 		} else {
1728
-			$data['page_title'] = 'Create ' . ucfirst($entity_type);
1728
+			$data['page_title'] = 'Create '.ucfirst($entity_type);
1729 1729
 			if ($this->form_validation->run() == FALSE) {
1730 1730
 				$data['validation_errors'] = validation_errors();
1731 1731
 			} else {
@@ -1743,8 +1743,8 @@  discard block
 block discarded – undo
1743 1743
 				}
1744 1744
 				$add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false);
1745 1745
 
1746
-				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type) . ' added successfully!');
1747
-				redirect(base_url() . 'accounts/admin_list/');
1746
+				$this->session->set_flashdata('astpp_errormsg', ucfirst($entity_type).' added successfully!');
1747
+				redirect(base_url().'accounts/admin_list/');
1748 1748
 				exit;
1749 1749
 			}$this->load->view('view_accounts_create', $data);
1750 1750
 		}
@@ -1895,12 +1895,12 @@  discard block
 block discarded – undo
1895 1895
 				$action['balance']['balance'] = $this->common_model->add_calculate_currency($action['balance']['balance'], "", '', true, false);
1896 1896
 			}
1897 1897
 			if (isset($action['credit_limit']['credit_limit']) && $action['credit_limit']['credit_limit'] != '') {
1898
-				$action['credit_limit']['credit_limit'] = $this->common_model->add_calculate_currency($action['credit_limit']['credit_limit'], "", '',true, false);
1898
+				$action['credit_limit']['credit_limit'] = $this->common_model->add_calculate_currency($action['credit_limit']['credit_limit'], "", '', true, false);
1899 1899
 			}
1900 1900
 			$this->session->set_userdata('reseller_list_search', $action);
1901 1901
 		}
1902 1902
 		if (@$ajax_search != 1) {
1903
-			redirect(base_url() . 'accounts/reseller_list/');
1903
+			redirect(base_url().'accounts/reseller_list/');
1904 1904
 		}
1905 1905
 	}
1906 1906
 
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
 			$this->session->set_userdata('admin_list_search', $action);
1927 1927
 		}
1928 1928
 		if (@$ajax_search != 1) {
1929
-			redirect(base_url() . 'accounts/admin_list/');
1929
+			redirect(base_url().'accounts/admin_list/');
1930 1930
 		}
1931 1931
 	}
1932 1932
 
@@ -1939,13 +1939,13 @@  discard block
 block discarded – undo
1939 1939
 	function customer_delete($id) {
1940 1940
 		$this->common->customer_delete_dependencies($id);
1941 1941
 		$this->session->set_flashdata('astpp_notification', 'Customer removed successfully!');
1942
-		redirect(base_url() . 'accounts/customer_list/');
1942
+		redirect(base_url().'accounts/customer_list/');
1943 1943
 	}
1944 1944
 
1945 1945
 	function reseller_delete($id) {
1946 1946
 		$this->common->subreseller_list($id);
1947 1947
 		$this->session->set_flashdata('astpp_notification', 'Reseller removed successfully!');
1948
-		redirect(base_url() . 'accounts/reseller_list/');
1948
+		redirect(base_url().'accounts/reseller_list/');
1949 1949
 	}
1950 1950
 
1951 1951
 	function free_customer_did($accountid) {
@@ -1976,19 +1976,19 @@  discard block
 block discarded – undo
1976 1976
 	function provider_delete($id) {
1977 1977
 		$this->accounts_model->remove_customer($id);
1978 1978
 		$this->session->set_flashdata('astpp_notification', 'Provider removed successfully!');
1979
-		redirect(base_url() . 'accounts/customer_list/');
1979
+		redirect(base_url().'accounts/customer_list/');
1980 1980
 	}
1981 1981
 
1982 1982
 	function admin_delete($id) {
1983 1983
 		$this->accounts_model->remove_customer($id);
1984 1984
 		$this->session->set_flashdata('astpp_notification', 'Admin removed successfully!');
1985
-		redirect(base_url() . 'accounts/admin_list/');
1985
+		redirect(base_url().'accounts/admin_list/');
1986 1986
 	}
1987 1987
 
1988 1988
 	function subadmin_delete($id) {
1989 1989
 		$this->accounts_model->remove_customer($id);
1990 1990
 		$this->session->set_flashdata('astpp_notification', 'Sub admin removed successfully!');
1991
-		redirect(base_url() . 'accounts/admin_list/');
1991
+		redirect(base_url().'accounts/admin_list/');
1992 1992
 	}
1993 1993
     
1994 1994
 	function reseller_details_json($module, $accountid) {
@@ -1999,13 +1999,13 @@  discard block
 block discarded – undo
1999 1999
 		}
2000 2000
 		if ($module == "invoices") {
2001 2001
 			$this->load->module('invoices/invoices');
2002
-			$this->invoices->customer_invoices($accountid,"reseller");
2002
+			$this->invoices->customer_invoices($accountid, "reseller");
2003 2003
 		}
2004 2004
 		if ($module == "charges") {
2005 2005
 			$this->load->module('charges/charges');
2006 2006
 			$this->charges->customer_charge_list($accountid, "reseller");
2007 2007
 		}
2008
-		if($module =='packages'){
2008
+		if ($module == 'packages') {
2009 2009
 	  $this->load->module('package/package');
2010 2010
 	  $this->package->package_list_reseller($accountid, "reseller");
2011 2011
 		}
@@ -2028,9 +2028,9 @@  discard block
 block discarded – undo
2028 2028
 			$this->db->insert("invoice_item", $insert_arr);
2029 2029
 
2030 2030
 			$this->accounts_model->update_balance($charge, $accountid, "debit");
2031
-			redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#packages");
2031
+			redirect(base_url()."accounts/".$accounttype."_edit/$accountid#packages");
2032 2032
 		} else {
2033
-			redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#packages");
2033
+			redirect(base_url()."accounts/".$accounttype."_edit/$accountid#packages");
2034 2034
 		}
2035 2035
 	}
2036 2036
 
@@ -2048,9 +2048,9 @@  discard block
 block discarded – undo
2048 2048
 				$this->did->did_model->add_reseller_pricing($accountid, $did_id);
2049 2049
 
2050 2050
 				$this->session->set_flashdata('astpp_errormsg', 'DID added successfully.');
2051
-				redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#did");
2051
+				redirect(base_url()."accounts/".$accounttype."_edit/$accountid#did");
2052 2052
 			} else {
2053
-				redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#did");
2053
+				redirect(base_url()."accounts/".$accounttype."_edit/$accountid#did");
2054 2054
 			}
2055 2055
 		}
2056 2056
 		if ($action == "delete") {
@@ -2079,14 +2079,14 @@  discard block
 block discarded – undo
2079 2079
 			} else {
2080 2080
 				$this->session->set_flashdata('astpp_notification', 'DID already removed before.');
2081 2081
 			}
2082
-			redirect(base_url() . "accounts/" . $accounttype . "_edit/$accountid#did");
2082
+			redirect(base_url()."accounts/".$accounttype."_edit/$accountid#did");
2083 2083
 		}
2084 2084
 	}
2085 2085
 
2086 2086
 	function customer_selected_delete() {
2087 2087
 		$ids = $this->input->post("selected_ids", true);
2088
-		$customer_ids=explode(",",$ids);
2089
-		foreach($customer_ids as $customer_id){
2088
+		$customer_ids = explode(",", $ids);
2089
+		foreach ($customer_ids as $customer_id) {
2090 2090
 			$customer_id = str_replace("'", "", $customer_id);
2091 2091
 			$this->common->customer_delete_dependencies($customer_id);
2092 2092
 		}
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
 					}
2155 2155
 				}
2156 2156
 				$this->session->set_flashdata('astpp_errormsg', 'Account tax added successfully!');
2157
-				redirect(base_url() . 'accounts/customer_list/');
2157
+				redirect(base_url().'accounts/customer_list/');
2158 2158
 			}
2159 2159
 			$data['id'] = array();
2160 2160
 			$data['taxesList'] = $this->common_model->get_list_taxes();
@@ -2186,9 +2186,9 @@  discard block
 block discarded – undo
2186 2186
 					}
2187 2187
 				}
2188 2188
 				if ($accountinfo['type'] == '0') {
2189
-					$link = base_url() . '/accounts/customer_list/';
2189
+					$link = base_url().'/accounts/customer_list/';
2190 2190
 				} else {
2191
-					$link = base_url() . '/accounts/reseller_list/';
2191
+					$link = base_url().'/accounts/reseller_list/';
2192 2192
 				}
2193 2193
 				$this->session->set_flashdata('astpp_errormsg', 'Account tax added successfully!');
2194 2194
 				redirect($link);
@@ -2198,7 +2198,7 @@  discard block
 block discarded – undo
2198 2198
 		} elseif ($action == 'delete') {
2199 2199
 			$this->accounting_model->remove_account_tax($id);
2200 2200
 			$this->session->set_flashdata('astpp_notification', 'Account tax removed successfully!');
2201
-			redirect(base_url() . 'accounting/account_taxes/');
2201
+			redirect(base_url().'accounting/account_taxes/');
2202 2202
 		}
2203 2203
 	}
2204 2204
 
@@ -2209,7 +2209,7 @@  discard block
 block discarded – undo
2209 2209
 	 */
2210 2210
 	function valid_account_tax() {
2211 2211
 		$tax_id = '';
2212
-		if (!empty($_POST['username'])) {
2212
+		if ( ! empty($_POST['username'])) {
2213 2213
 
2214 2214
 			$account_num = mysql_real_escape_string($_POST['username']);
2215 2215
 			$row = $this->accounts_model->check_account_num($account_num);
@@ -2217,11 +2217,11 @@  discard block
 block discarded – undo
2217 2217
 				$taxes_id = $this->accounts_model->get_accounttax_by_id($row['accountid']);
2218 2218
 				if ($taxes_id) {
2219 2219
 					foreach ($taxes_id as $id) {
2220
-						$tax_id.=$id['taxes_id'] . ",";
2220
+						$tax_id .= $id['taxes_id'].",";
2221 2221
 					}
2222 2222
 
2223 2223
 					$tax_id = rtrim($tax_id, ",");
2224
-					echo $row['accountid'] . ',' . $tax_id;
2224
+					echo $row['accountid'].','.$tax_id;
2225 2225
 				} else {
2226 2226
 					echo $row['accountid'];
2227 2227
 				}
@@ -2247,7 +2247,7 @@  discard block
 block discarded – undo
2247 2247
 					$this->session->set_userdata('accountinfo', $result[0]);
2248 2248
 				}
2249 2249
 				$this->session->set_flashdata('astpp_errormsg', 'Reseller updated successfully!');
2250
-				redirect(base_url() . '/dashboard/');
2250
+				redirect(base_url().'/dashboard/');
2251 2251
 			}
2252 2252
 			$this->load->view('view_reseller_edit_details_own', $data);
2253 2253
 		} else {
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
 			echo "2";
2305 2305
 			exit;
2306 2306
 		}
2307
-		if (isset($add_array['number']) && !empty($add_array['number'])) {
2307
+		if (isset($add_array['number']) && ! empty($add_array['number'])) {
2308 2308
 			if (isset($add_array['id']) && $add_array['id'] != '') {
2309 2309
 				unset($add_array['animap_id']);
2310 2310
 				$response = $this->accounts_model->edit_animap($add_array, $add_array['id']);
@@ -2338,7 +2338,7 @@  discard block
 block discarded – undo
2338 2338
 		}
2339 2339
 		$value_edit = '';
2340 2340
 		foreach ($edit_data as $key => $value) {
2341
-			$value_edit.=$value . ",";
2341
+			$value_edit .= $value.",";
2342 2342
 		}
2343 2343
 		echo rtrim($value_edit, ',');
2344 2344
 		exit;
@@ -2357,11 +2357,11 @@  discard block
 block discarded – undo
2357 2357
 
2358 2358
 	function reseller_export_cdr_xls() {
2359 2359
 	$account_info = $accountinfo = $this->session->userdata('accountinfo');
2360
-	$currency_id=$account_info['currency_id'];
2361
-	$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
2360
+	$currency_id = $account_info['currency_id'];
2361
+	$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
2362 2362
 	ob_clean();
2363 2363
 		$query = $this->accounts_model->get_reseller_Account_list(true, '', '', true);
2364
-		$customer_array[] = array("Account", "First Name", "Last Name", "Company", "Rate Group ", "Account type", "Balance($currency)", "Credit Limit($currency)", "Status","Created Date");
2364
+		$customer_array[] = array("Account", "First Name", "Last Name", "Company", "Rate Group ", "Account type", "Balance($currency)", "Credit Limit($currency)", "Status", "Created Date");
2365 2365
 		if ($query->num_rows() > 0) {
2366 2366
 
2367 2367
 			foreach ($query->result_array() as $row) {
@@ -2372,40 +2372,40 @@  discard block
 block discarded – undo
2372 2372
 					$row['company_name'],
2373 2373
 					$this->common->get_field_name('name', 'pricelists', $row['pricelist_id']),
2374 2374
 					$this->common->get_account_type('', '', $row['posttoexternal']),
2375
-					$this->common_model->calculate_currency($row['balance'],false,false),
2376
-					$this->common_model->calculate_currency($row['credit_limit'],false,false),
2375
+					$this->common_model->calculate_currency($row['balance'], false, false),
2376
+					$this->common_model->calculate_currency($row['credit_limit'], false, false),
2377 2377
 					$this->common->get_status('export', '', $row['status']),
2378 2378
 					$row['creation'],
2379 2379
 				);
2380 2380
 			}
2381 2381
 		}
2382 2382
 		$this->load->helper('csv');
2383
-		array_to_csv($customer_array, 'Resellers_' . date("Y-m-d") . '.csv');
2383
+		array_to_csv($customer_array, 'Resellers_'.date("Y-m-d").'.csv');
2384 2384
 	}
2385
-	function customer_validate_ip(){
2386
-	 $add_array=$this->input->post();
2387
-	 if(!empty($add_array)){
2385
+	function customer_validate_ip() {
2386
+	 $add_array = $this->input->post();
2387
+	 if ( ! empty($add_array)) {
2388 2388
 	   $ip = $add_array['ip'];
2389 2389
 	   if (strpos($ip, '/') !== false) {
2390 2390
 		 $add_array['ip'] = $add_array['ip'];
2391 2391
 	   } else {
2392
-		 $add_array['ip'] = $add_array['ip'] . '/32';
2392
+		 $add_array['ip'] = $add_array['ip'].'/32';
2393 2393
 	   }
2394
-	   $this->db->where('ip',$add_array['ip']);
2395
-	   $this->db->where('prefix',$add_array['prefix']);
2394
+	   $this->db->where('ip', $add_array['ip']);
2395
+	   $this->db->where('prefix', $add_array['prefix']);
2396 2396
 	   $this->db->select('count(ip) as count');
2397
-	   $ip_map_result=(array)$this->db->get('ip_map')->first_row();
2398
-	   if($ip_map_result['count'] > 0 ){
2397
+	   $ip_map_result = (array)$this->db->get('ip_map')->first_row();
2398
+	   if ($ip_map_result['count'] > 0) {
2399 2399
 		 echo 'FALSE';
2400
-	   }else{
2400
+	   } else {
2401 2401
 		 echo 'TRUE';
2402 2402
 	   }
2403
-	 }else{
2403
+	 } else {
2404 2404
 	  echo 'FALSE';
2405 2405
 	 }
2406 2406
     
2407 2407
 	}
2408
-function reseller_invoice_config($id=''){
2408
+function reseller_invoice_config($id = '') {
2409 2409
 		$data['page_title'] = 'Company Profile';
2410 2410
 		$accountinfo = $this->session->userdata("accountinfo");
2411 2411
 		$add_array = $this->input->post();
@@ -2415,30 +2415,30 @@  discard block
 block discarded – undo
2415 2415
 				$this->load->module('invoices/invoices');
2416 2416
 				$this->load->model("invoices_model");
2417 2417
 				$invoiceconf = $this->invoices_model->get_invoiceconf();
2418
-				$file_name=($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : '';
2418
+				$file_name = ($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : '';
2419 2419
 			}
2420 2420
 			if (isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') {
2421 2421
 				$files = $_FILES['file'];
2422 2422
 				if ($files['size'] < 0) {
2423 2423
 					$this->session->set_flashdata('astpp_notification', 'PLease upload maximum file');
2424
-				redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/");
2424
+				redirect(base_url()."accounts/reseller_invoice_config/".$add_array['accountid']."/");
2425 2425
 				}
2426 2426
 				$file = $_FILES['file'];
2427 2427
 				$uploadedFile = $file["tmp_name"];
2428 2428
 				$file_name = $file['name'];
2429 2429
 				$file_type = $file['type'];
2430 2430
 				if ($file_type == 'image/jpg' || $file_type == 'image/png' || $file_type == 'image/jpeg') {
2431
-					$dir_path = FCPATH. "upload/";
2432
-					$path = $dir_path . $add_array['accountid']."_".$file['name'];
2431
+					$dir_path = FCPATH."upload/";
2432
+					$path = $dir_path.$add_array['accountid']."_".$file['name'];
2433 2433
 					if (move_uploaded_file($uploadedFile, $path)) {
2434 2434
 						$this->session->set_flashdata('astpp_errormsg', gettext('files added successfully!'));
2435 2435
 					} else {
2436 2436
 						$this->session->set_flashdata('astpp_notification', "File Uploading Fail Please Try Again");
2437
-					redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/");
2437
+					redirect(base_url()."accounts/reseller_invoice_config/".$add_array['accountid']."/");
2438 2438
 					}
2439 2439
 				} else {
2440 2440
 					$this->session->set_flashdata('astpp_notification', 'Please upload only image!');
2441
-				redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/");
2441
+				redirect(base_url()."accounts/reseller_invoice_config/".$add_array['accountid']."/");
2442 2442
 				}
2443 2443
 			}
2444 2444
 			$add_array['logo'] = $file_name;
@@ -2449,30 +2449,30 @@  discard block
 block discarded – undo
2449 2449
 				$this->accounts_model->edit_invoice_config($add_array, $add_array['id']);
2450 2450
 			}
2451 2451
 			$this->session->set_flashdata('astpp_errormsg', 'Invoice config updated successfully!');
2452
-			redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/");
2452
+			redirect(base_url()."accounts/reseller_invoice_config/".$add_array['accountid']."/");
2453 2453
 		} else {
2454
-			$data["account_data"] =(array)$this->db->get_where('invoice_conf',array("accountid"=>$id))->first_row();
2455
-		$data["accounttype"]='Reseller';
2456
-		$data["edit_id"]=$id;
2457
-			if(isset($data["account_data"]['logo'])){
2458
-				$data["account_data"]['file']=$id."_".$data["account_data"]['logo'];
2454
+			$data["account_data"] = (array)$this->db->get_where('invoice_conf', array("accountid"=>$id))->first_row();
2455
+		$data["accounttype"] = 'Reseller';
2456
+		$data["edit_id"] = $id;
2457
+			if (isset($data["account_data"]['logo'])) {
2458
+				$data["account_data"]['file'] = $id."_".$data["account_data"]['logo'];
2459 2459
 		}
2460 2460
 			$this->load->view('view_reseller_invoices_config', $data);
2461 2461
 		}
2462 2462
 }
2463 2463
      
2464
-	 function reseller_invoice_logo_delete($accountid){
2465
-		 $invoiceconf  = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid));
2466
-		 $result=$invoiceconf->result_array();
2467
-		 $logo=$result[0]['logo'];
2468
-		 $post_arr=array('logo'=>'');
2469
-		 $where_arr=array('logo'=>$logo);
2464
+	 function reseller_invoice_logo_delete($accountid) {
2465
+		 $invoiceconf = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid));
2466
+		 $result = $invoiceconf->result_array();
2467
+		 $logo = $result[0]['logo'];
2468
+		 $post_arr = array('logo'=>'');
2469
+		 $where_arr = array('logo'=>$logo);
2470 2470
 		 $this->db->where($where_arr);
2471
-		 $this->db->update('invoice_conf',$post_arr);
2471
+		 $this->db->update('invoice_conf', $post_arr);
2472 2472
 	 }
2473 2473
      
2474 2474
      
2475
-	 function customer_global_grid_list(){
2475
+	 function customer_global_grid_list() {
2476 2476
 	  echo gettext($_POST['display']); 
2477 2477
  	}
2478 2478
  	
Please login to merge, or discard this patch.
Braces   +27 added lines, -20 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
 		$this->load->model('accounts_model');
38 38
 		$this->load->model('Astpp_common');
39 39
 		$this->protected_pages = array('account_list');
40
-		if ($this->session->userdata('user_login') == FALSE)
41
-			redirect(base_url() . '/login/login');
40
+		if ($this->session->userdata('user_login') == FALSE) {
41
+					redirect(base_url() . '/login/login');
42
+		}
42 43
 	}
43 44
 
44 45
 	function customer_list() {
@@ -377,13 +378,15 @@  discard block
 block discarded – undo
377 378
 		$where = array("accountid" => $accountid);
378 379
 		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_ipmap');
379 380
 		$like_str=!empty($instant_search) ? "(name like '%$instant_search%'  OR ip like '%$instant_search%' OR prefix like '%$instant_search%' OR created_date like '%$instant_search%' )" :null;
380
-		if(!empty($like_str))
381
-		$this->db->where($like_str);
381
+		if(!empty($like_str)) {
382
+				$this->db->where($like_str);
383
+		}
382 384
 		$count_all = $this->db_model->countQuery("*", "ip_map", $where);
383 385
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
384 386
 		$json_data = $paging_data["json_paging"];
385
-		if(!empty($like_str))
386
-		$this->db->where($like_str);
387
+		if(!empty($like_str)) {
388
+				$this->db->where($like_str);
389
+		}
387 390
 		$query = $this->db_model->select("*", "ip_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
388 391
 		$grid_fields = json_decode($this->accounts_form->build_ip_list_for_customer($accountid, $accounttype));
389 392
 		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
@@ -472,15 +475,17 @@  discard block
 block discarded – undo
472 475
 		$json_data = array();
473 476
 		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_animap'); 
474 477
 		$like_str=!empty($instant_search) ? "(number like '%$instant_search%'  OR  creation_date like '%$instant_search%' )" :null;
475
-		if(!empty($like_str))
476
-		$this->db->where($like_str);
478
+		if(!empty($like_str)) {
479
+				$this->db->where($like_str);
480
+		}
477 481
 		$where = array("accountid" => $accountid);
478 482
 		$count_all = $this->db_model->countQuery("*", "ani_map", $where);
479 483
 
480 484
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
481 485
 		$json_data = $paging_data["json_paging"];
482
-		if(!empty($like_str))
483
-		$this->db->where($like_str);
486
+		if(!empty($like_str)) {
487
+				$this->db->where($like_str);
488
+		}
484 489
 		$query = $this->db_model->select("*", "ani_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
485 490
 
486 491
 		$grid_fields = json_decode($this->accounts_form->build_animap_list_for_customer($accountid, $accounttype));
@@ -1043,7 +1048,7 @@  discard block
 block discarded – undo
1043 1048
 			$data['edit_id'] = $edit_id;
1044 1049
 			$data['accounttype'] = $accounttype;
1045 1050
 			$this->load->view('view_reseller_package_list', $data);
1046
-	   }else {
1051
+	   } else {
1047 1052
 			redirect(base_url() . 'accounts/reseller_list/');
1048 1053
 			exit;
1049 1054
 	   }
@@ -1321,14 +1326,14 @@  discard block
 block discarded – undo
1321 1326
 			$accountinfo = $this->accounts_model->get_account_by_number($post_array['id']);
1322 1327
 			if($accountinfo['reseller_id'] == 0){
1323 1328
 			   $where = array("accountid"=> 1);
1324
-		}else{
1329
+		} else{
1325 1330
 			$where = array("accountid"=> $accountinfo['id']);    
1326 1331
 		}
1327 1332
 		$query = $this->db_model->getSelect("*", "invoice_conf", $where);
1328 1333
 		if($query->num_rows >0){
1329 1334
 			$invoice_conf = $query->result_array();
1330 1335
 			$invoice_conf = $invoice_conf[0];
1331
-		}else{
1336
+		} else{
1332 1337
 			$query = $this->db_model->getSelect("*", "invoice_conf",array("accountid"=> 1));
1333 1338
 			$invoice_conf = $query->result_array();
1334 1339
 			$invoice_conf = $invoice_conf[0];            
@@ -1355,7 +1360,7 @@  discard block
 block discarded – undo
1355 1360
 					  'after_balance'=>$account_balance,
1356 1361
 					);
1357 1362
 			$this->db->insert("invoice_details", $insert_arr);
1358
-				}else{
1363
+				} else{
1359 1364
 			$this->load->module('invoices/invoices');
1360 1365
 			$invoice_id=$this->invoices->invoices->generate_receipt($post_array['id'],$post_array['credit'],$accountinfo,$last_invoice_ID+1,$invoice_prefix,$due_date);
1361 1366
 			$account_balance = $this->common->get_field_name('balance', 'accounts', $post_array['id']);
@@ -1788,8 +1793,9 @@  discard block
 block discarded – undo
1788 1793
 		$json_data['total'] = $config['total_rows'];
1789 1794
 		$perpage = $config['per_page'];
1790 1795
 		$start = ($page_no - 1) * $perpage;
1791
-		if ($start < 0)
1792
-			$start = 0;
1796
+		if ($start < 0) {
1797
+					$start = 0;
1798
+		}
1793 1799
 
1794 1800
 		$account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $perpage, $start, $order_by, $order_type, "");
1795 1801
 		if ($account_charge_list->num_rows > 0) {
@@ -2132,8 +2138,9 @@  discard block
 block discarded – undo
2132 2138
 		$data['username'] = $this->session->userdata('user_name');
2133 2139
 		$data['page_title'] = 'Account Taxes';
2134 2140
 
2135
-		if ($action == false)
2136
-			$action = "list";
2141
+		if ($action == false) {
2142
+					$action = "list";
2143
+		}
2137 2144
 
2138 2145
 		if ($action == 'list') {
2139 2146
 			$this->load->view('view_account_taxes_list', $data);
@@ -2397,10 +2404,10 @@  discard block
 block discarded – undo
2397 2404
 	   $ip_map_result=(array)$this->db->get('ip_map')->first_row();
2398 2405
 	   if($ip_map_result['count'] > 0 ){
2399 2406
 		 echo 'FALSE';
2400
-	   }else{
2407
+	   } else{
2401 2408
 		 echo 'TRUE';
2402 2409
 	   }
2403
-	 }else{
2410
+	 } else{
2404 2411
 	  echo 'FALSE';
2405 2412
 	 }
2406 2413
     
Please login to merge, or discard this patch.
astpp/application/modules/accounts/libraries/accounts_form.php 2 patches
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if ( ! defined('BASEPATH'))
25 25
 	exit('No direct script access allowed');
26 26
 
27 27
 class Accounts_form {
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		$type = $entity_type == 'customer' ? 0 : 3;
37 37
 		$uname = $this->CI->common->find_uniq_rendno_customer(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts');
38 38
 		$pin = Common_model::$global_config['system_config']['pinlength'];
39
-		$pin_number=$this->CI->common->find_uniq_rendno($pin, 'pin', 'accounts');
39
+		$pin_number = $this->CI->common->find_uniq_rendno($pin, 'pin', 'accounts');
40 40
 		$uname_user = $this->CI->common->find_uniq_rendno('10', 'number', 'accounts');
41 41
 		$password = $this->CI->common->generate_password();
42 42
 		$logintype = $this->CI->session->userdata('logintype');
@@ -48,33 +48,33 @@  discard block
 block discarded – undo
48 48
 		}
49 49
 		$sip_device = null;
50 50
 		$opensips_device = null;
51
-		if (!$entity_type) {
51
+		if ( ! $entity_type) {
52 52
 			$entity_type = 'customer';
53 53
 		}
54
-		$params=array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number','readonly'=>true);
54
+		$params = array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number', 'readonly'=>true);
55 55
         
56 56
 		if ($id > 0) {
57 57
 			$readable = 'disabled';
58
-			$val = 'accounts.email.' . $id;
59
-			$account_val='accounts.number.'.$id;
58
+			$val = 'accounts.email.'.$id;
59
+			$account_val = 'accounts.number.'.$id;
60 60
 			$password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20', 'class' => "text field medium"), 'required|', 'tOOL TIP', '');
61 61
 			$balance = array('Balance', 'INPUT', array('name' => 'balance', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), '', 'tOOL TIP', '');
62
-			$account=array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', '');
62
+			$account = array('Account', 'INPUT', $params, 'required|integer|greater_than[0]|is_unique['.$account_val.']', 'tOOL TIP', '');
63 63
 			/*             * ******************************** */
64 64
 		} else {
65 65
 			$val = 'accounts.email';
66
-			$account_val='accounts.number';
66
+			$account_val = 'accounts.number';
67 67
 			 if (common_model::$global_config['system_config']['opensips'] == 0) {
68 68
 				$sip_device = array('Create Opensips Device', 'opensips_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_prorate');
69 69
 			} else {
70 70
 			  $sip_device = array('Create SIP Device', 'sip_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_prorate');   
71 71
 		}
72
-			$account = array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>');      
72
+			$account = array('Account', 'INPUT', $params, 'required|integer|greater_than[0]|is_unique['.$account_val.']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>');      
73 73
 			$password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20', 'class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>');
74
-			$balance = array('Balance', 'INPUT', array('name' => 'balance', 'size' => '20','class' => "text field medium"), '', 'tOOL TIP', '');
74
+			$balance = array('Balance', 'INPUT', array('name' => 'balance', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', '');
75 75
 		}
76 76
 		$pin = array('Pin', 'INPUT', array('name' => 'pin', 'value' => $pin_number, 'size' => '20', 'class' => "text field medium", 'id' => 'change_pin'), 'required|is_numeric', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Pin" class="change_pin fa fa-refresh" ></i>');
77
-		$form['forms'] = array(base_url() . 'accounts/' . $entity_type . '_save/'.$id."/", array("id" => "customer_form", "name" => "customer_form"));
77
+		$form['forms'] = array(base_url().'accounts/'.$entity_type.'_save/'.$id."/", array("id" => "customer_form", "name" => "customer_form"));
78 78
 		$form[gettext('Account Profile')] = array(
79 79
 		array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
80 80
 		array('', 'HIDDEN', array('name' => 'type', 'value' => $type), '', '', ''),
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
 			$password,
83 83
 			$pin,
84 84
 			array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '15', 'class' => "text field medium"), 'required', 'tOOL TIP', ''),
85
-			array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
85
+			array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
86 86
 			array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''),
87 87
 			array(gettext('Phone'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
88 88
 			array(gettext('Mobile'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
89
-			array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50',  'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', ''),
90
-			array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15',  'class' => "text field medium"), '', 'tOOL TIP', ''),
89
+			array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique['.$val.']', 'tOOL TIP', ''),
90
+			array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
91 91
 			array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
92
-			array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
93
-			array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15',  'class' => "text field medium"), '', 'tOOL TIP', ''),
94
-			array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
92
+			array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
93
+			array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
94
+			array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
95 95
 			array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', array("name" => "country_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''),
96 96
 			array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', array("name" => "timezone_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''),
97 97
 			array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array())
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 			array(gettext('Number Translation'), 'INPUT', array('name' => 'dialed_modify', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
106 106
 			array(gettext('Concurrent Calls'), 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', ''),
107 107
 			array(gettext('Interval'), 'INPUT', array('name' => 'interval', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', ''),
108
-			array(gettext('First Used'), 'INPUT', array('name' => 'first_used', 'size' => '20', 'readonly' => true,  'class' => "text field medium", 'value' => '0000-00-00 00:00:00'), '', 'tOOL TIP', ''),
108
+			array(gettext('First Used'), 'INPUT', array('name' => 'first_used', 'size' => '20', 'readonly' => true, 'class' => "text field medium", 'value' => '0000-00-00 00:00:00'), '', 'tOOL TIP', ''),
109 109
 		array(gettext('Account Valid Days'), 'INPUT', array('name' => 'validfordays', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
110
-		array(gettext('Expiry Date'), 'INPUT', array('name' => 'expiry', 'size' => '20',  'class' => "text field medium", 'value' => $expiry_date, 'id' => 'expiry'), '', 'tOOL TIP', ''),
110
+		array(gettext('Expiry Date'), 'INPUT', array('name' => 'expiry', 'size' => '20', 'class' => "text field medium", 'value' => $expiry_date, 'id' => 'expiry'), '', 'tOOL TIP', ''),
111 111
 		);
112 112
 		
113 113
 		$form[gettext('Billing Settings')] = array(
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 			array(gettext('LC Charge / Min'), 'INPUT', array('name' => 'charge_per_min', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),           
122 122
 			array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, "reseller_id" => $loginid), 'multi'),
123 123
 		);
124
-	if($id==0){
124
+	if ($id == 0) {
125 125
 	  $form[gettext('Alert Threshold')] = array(
126 126
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
127 127
 			array(gettext('Email Alerts ?'), 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'),
128
-			array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20',  'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''),
129
-			array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50',  'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''),
128
+			array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''),
129
+			array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''),
130 130
 	  );
131 131
 	}
132 132
 		$form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot');
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
 	}
139 139
 
140 140
 	function customer_alert_threshold($entity_type) {
141
-		$form['forms'] = array(base_url() . 'accounts/' . $entity_type . '_alert_threshold_save/' . $entity_type . "/", array("id" => "customer_alert_threshold", "name" => "customer_alert_threshold"));
141
+		$form['forms'] = array(base_url().'accounts/'.$entity_type.'_alert_threshold_save/'.$entity_type."/", array("id" => "customer_alert_threshold", "name" => "customer_alert_threshold"));
142 142
 		$form[gettext('Alert Threshold')] = array(
143 143
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
144 144
 			array(gettext('Email Alerts ?'), 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'),
145
-			array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20',  'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''),
146
-			array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50',  'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''),
145
+			array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), 'valid_decimal', 'tOOL TIP', ''),
146
+			array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''),
147 147
 		);
148 148
 		$form['button_save'] = array('name' => 'action', 'content' => gettext('Save'), 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot');
149 149
 		return $form;
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
 				$sip_device = array(gettext('Create SIP Device'), 'sip_device_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status');
165 165
 			}
166 166
 		}
167
-		$form['forms'] = array(base_url() . 'accounts/customer_bulk_save/', array("id" => "customer_bulk_form", "name" => "customer_bulk_form"));
167
+		$form['forms'] = array(base_url().'accounts/customer_bulk_save/', array("id" => "customer_bulk_form", "name" => "customer_bulk_form"));
168 168
 		$form[gettext('General Details')] = array(
169
-			array(gettext('Account Count'), 'INPUT', array('name' => 'count', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
170
-			array(gettext('Start Prefix'), 'INPUT', array('name' => 'prefix', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
171
-			array(gettext('Acc. Number Length'), 'INPUT', array('name' => 'account_length', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
172
-			array(gettext('Company'), 'INPUT', array('name' => 'company_name',  'size' => '15', 'class' => 'text field medium'), 'trim|required|xss_clean', 'tOOL TIP', ''),
169
+			array(gettext('Account Count'), 'INPUT', array('name' => 'count', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
170
+			array(gettext('Start Prefix'), 'INPUT', array('name' => 'prefix', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
171
+			array(gettext('Acc. Number Length'), 'INPUT', array('name' => 'account_length', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
172
+			array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|required|xss_clean', 'tOOL TIP', ''),
173 173
 			array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', array("name" => "country_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''),
174 174
 			array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', array("name" => "timezone_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''),
175 175
 			array(gettext('Generate Pin'), 'pin', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_pin_allow_customer'),
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			array(gettext('Billing Schedule'), array('name' => 'sweep_id', 'id' => 'sweep_id', 'class' => 'sweep_id'), 'SELECT', '', '', 'tOOL TIP', '', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''),
185 185
 			array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'),
186 186
 			array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()),
187
-			array(gettext('Balance'), 'INPUT', array('name' => 'balance', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|greater_than[0]|currency_decimal|xss_clean', 'tOOL TIP', ''),
187
+			array(gettext('Balance'), 'INPUT', array('name' => 'balance', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|greater_than[0]|currency_decimal|xss_clean', 'tOOL TIP', ''),
188 188
 			array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), 'trim|currency_decimal|xss_clean', 'tOOL TIP', ''),
189 189
 			array(gettext('Valid Days'), 'INPUT', array('name' => 'validfordays', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
190 190
 		array(gettext('Allow Local Calls'), 'local_call', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'custom_status'),
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	}
197 197
 
198 198
 	function get_customer_callerid_fields() {
199
-		$form['forms'] = array(base_url() . 'accounts/customer_add_callerid/', array("id" => "callerid_form"));
199
+		$form['forms'] = array(base_url().'accounts/customer_add_callerid/', array("id" => "callerid_form"));
200 200
 		$form[gettext('Information')] = array(
201 201
 			array('', 'HIDDEN', array('name' => 'flag'), '', '', '', ''),
202 202
 			array(gettext('Account'), 'INPUT', array('name' => 'accountid', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter account number'),
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	}
211 211
 
212 212
 	function get_customer_payment_fields($currency, $number, $currency_id, $id) {
213
-		$form['forms'] = array(base_url() . 'accounts/customer_payment_save/', array('id' => 'acccount_charges_form', 'method' => 'POST', 'name' => 'acccount_charges_form'));
213
+		$form['forms'] = array(base_url().'accounts/customer_payment_save/', array('id' => 'acccount_charges_form', 'method' => 'POST', 'name' => 'acccount_charges_form'));
214 214
 		$form['​Refill information'] = array(
215 215
 			array('', 'HIDDEN', array('name' => 'id', 'value' => $id), '', '', '', ''),
216 216
 			array('', 'HIDDEN', array('name' => 'account_currency', 'value' => $currency_id), '', '', ''),
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 	function get_form_reseller_fields($id = false) {
228 228
 		$readable = false;
229 229
 		$invoice_config = null;
230
-		$concurrent_calls=null;
230
+		$concurrent_calls = null;
231 231
 		$logintype = $this->CI->session->userdata('logintype');
232 232
 		$uname = $this->CI->common->find_uniq_rendno(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts');
233 233
 		$password = $this->CI->common->generate_password();
234
-		$params=array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number','readonly'=>true);
234
+		$params = array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number', 'readonly'=>true);
235 235
 		if ($logintype == 1 || $logintype == 5) {
236 236
 			$account_data = $this->CI->session->userdata("accountinfo");
237 237
 			$loginid = $account_data['id'];
@@ -239,18 +239,18 @@  discard block
 block discarded – undo
239 239
 			$loginid = "0";
240 240
 		}
241 241
 		if ($id > 0) {
242
-			$val = 'accounts.email.' . $id;
243
-			$account_val='accounts.number.'.$id;
242
+			$val = 'accounts.email.'.$id;
243
+			$account_val = 'accounts.number.'.$id;
244 244
 			$readable = 'disabled';
245
-			$password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20',  'class' => "text field medium"), 'required|notMatch[number]|', 'tOOL TIP', '');
246
-			$concurrent_calls=array('Concurrent Calls', 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', '');
247
-			$account=array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', '');
245
+			$password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20', 'class' => "text field medium"), 'required|notMatch[number]|', 'tOOL TIP', '');
246
+			$concurrent_calls = array('Concurrent Calls', 'INPUT', array('name' => 'maxchannels', 'size' => '20', 'class' => "text field medium"), 'numeric', 'tOOL TIP', '');
247
+			$account = array('Account', 'INPUT', $params, 'required|integer|greater_than[0]|is_unique['.$account_val.']', 'tOOL TIP', '');
248 248
 		} else {
249 249
 			$val = 'accounts.email';
250
-			$account_val='accounts.number';
250
+			$account_val = 'accounts.number';
251 251
 			$invoice_config = array('Use same credential for Invoice Config', 'invoice_config_flag', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_prorate');
252 252
 			$password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20', 'class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>');
253
-			$account = array('Account', 'INPUT',$params, 'required|integer|greater_than[0]|is_unique[' . $account_val . ']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>');
253
+			$account = array('Account', 'INPUT', $params, 'required|integer|greater_than[0]|is_unique['.$account_val.']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>');
254 254
 		}
255 255
 		if ($id == "") {
256 256
 			$reg_url = array('', 'HIDDEN', array('name' => 'id'), '', '', '', '');
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			$reg_url = array('Registration URL', 'INPUT', array('name' => 'registration_url', 'size' => '20', 'readonly' => true, 'class' => "text field medium"), 'tOOL TIP', '');
259 259
 		}
260 260
 		/*         * ****************************************************************** */
261
-		$form['forms'] = array(base_url() . 'accounts/reseller_save/', array("id" => "reseller_form", "name" => "reseller_form"));
261
+		$form['forms'] = array(base_url().'accounts/reseller_save/', array("id" => "reseller_form", "name" => "reseller_form"));
262 262
 		$form['Client Panel Access'] = array(
263 263
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
264 264
 			array('', 'HIDDEN', array('name' => 'type', 'value' => '1'), '', '', ''),
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
 			array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'),
276 276
 			array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()),
277 277
 			array(gettext('Account Type'), array('name' => 'posttoexternal', 'disabled' => $readable, 'class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'),
278
-			array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
278
+			array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
279 279
 			array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, 'reseller_id' => $loginid), 'multi'),
280 280
 		);
281 281
 
282 282
 }
283
-else{
283
+else {
284 284
 			$form[gettext('Billing Information')] = array(
285 285
 			array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', array("name" => "pricelist_id", 'rules' => 'required'), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")),
286 286
             
@@ -288,31 +288,31 @@  discard block
 block discarded – undo
288 288
 			array(gettext('Billing Day'), array("name" => 'invoice_day', "class" => "invoice_day"), 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_invoice_option'),
289 289
 			array(gettext('Currency'), array('name' => 'currency_id', 'class' => 'currency_id'), 'SELECT', '', array("name" => "currency_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'currencyname,currency', 'currency', 'build_concat_dropdown', '', array()),
290 290
 			array(gettext('Account Type'), array('name' => 'posttoexternal', 'disabled' => $readable, 'class' => 'posttoexternal', 'id' => 'posttoexternal'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_account_type'),
291
-			array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
291
+			array(gettext('Credit Limit'), 'INPUT', array('name' => 'credit_limit', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
292 292
 			array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, 'reseller_id' => $loginid), 'multi'),
293 293
 			$invoice_config,
294 294
 		);
295 295
 	}
296 296
 		$form[gettext('Reseller Profile')] = array(
297
-			array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '50',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
298
-			array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
299
-			array(gettext('Company'), 'INPUT', array('name' => 'company_name',  'size' => '50', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''),
297
+			array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '50', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''),
298
+			array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
299
+			array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '50', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''),
300 300
 			array(gettext('Telephone 1'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
301 301
 			array(gettext('Telephone 2'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
302
-			array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', ''),
302
+			array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique['.$val.']', 'tOOL TIP', ''),
303 303
 			array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
304
-			array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15',  'class' => "text field medium"), '', 'tOOL TIP', ''),
304
+			array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
305 305
 			array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
306 306
 			array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', ''),
307
-			array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
307
+			array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
308 308
 			array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', array("name" => "country_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''),
309 309
 			array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', array("name" => "timezone_id", "rules" => "required"), 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''),
310 310
 			array(gettext('Account Status'), 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
311 311
 		);
312
-		if($id==0){
312
+		if ($id == 0) {
313 313
 	  $form[gettext('Alert Threshold')] = array(
314 314
 	  array('Email Alert?', 'notify_flag', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'custom_status'),
315
-		  array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
315
+		  array(gettext('Balance Below'), 'INPUT', array('name' => 'notify_credit_limit', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', ''),
316 316
 		  array(gettext('Email'), 'INPUT', array('name' => 'notify_email', 'size' => '50', 'class' => "text field medium"), 'valid_email', 'tOOL TIP', ''),
317 317
 	  );
318 318
 	}
@@ -323,24 +323,24 @@  discard block
 block discarded – undo
323 323
 
324 324
 	function get_form_admin_fields($entity_type = '', $id = false) {
325 325
 	  $uname = $this->CI->common->find_uniq_rendno(common_model::$global_config['system_config']['cardlength'], 'number', 'accounts');
326
-	  $params=array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number','readonly'=>true);
326
+	  $params = array('name' => 'number', 'value' => $uname, 'size' => '20', 'class' => "text field medium", 'id' => 'number', 'readonly'=>true);
327 327
 		if ($id > 0) {
328
-			$val = 'accounts.email.' . $id;
329
-			$account_val='accounts.number.'.$id;
330
-			$password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20',  'class' => "text field medium"), 'required|notMatch[number]|', 'tOOL TIP', '');
331
-			$account=array('Account', 'INPUT',$params, 'required|is_unique[' . $account_val . ']', 'tOOL TIP', '');
328
+			$val = 'accounts.email.'.$id;
329
+			$account_val = 'accounts.number.'.$id;
330
+			$password = array('Password', 'PASSWORD', array('name' => 'password', 'id' => 'password_show', 'onmouseover' => 'seetext(password_show)', 'onmouseout' => 'hidepassword(password_show)', 'size' => '20', 'class' => "text field medium"), 'required|notMatch[number]|', 'tOOL TIP', '');
331
+			$account = array('Account', 'INPUT', $params, 'required|is_unique['.$account_val.']', 'tOOL TIP', '');
332 332
 		} else {
333 333
 			$val = 'accounts.email';
334
-			$account_val='accounts.number';
334
+			$account_val = 'accounts.number';
335 335
 			$password = $this->CI->common->generate_password();
336
-			$password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20','class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>');
337
-			$account = array('Account', 'INPUT',$params, 'required|is_unique[' . $account_val . ']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>');
336
+			$password = array('Password', 'INPUT', array('name' => 'password', 'value' => $password, 'size' => '20', 'class' => "text field medium", 'id' => 'password'), 'required|', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Reset Password" class="change_pass fa fa-refresh" ></i>');
337
+			$account = array('Account', 'INPUT', $params, 'required|is_unique['.$account_val.']', 'tOOL TIP', '', '<i style="cursor:pointer; font-size: 17px; padding-left:10px; padding-top:6px;color: #1bcb61;" title="Generate Account" class="change_number fa fa-refresh" ></i>');
338 338
 			/*             * ****************** */
339 339
 		}
340 340
 
341 341
         
342 342
 		$type = $entity_type == 'admin' ? 2 : 4;
343
-		$form['forms'] = array(base_url() . 'accounts/' . $entity_type . '_save/', array("id" => "admin_form", "name" => "admin_form"));
343
+		$form['forms'] = array(base_url().'accounts/'.$entity_type.'_save/', array("id" => "admin_form", "name" => "admin_form"));
344 344
 		$form['Client Panel Access'] = array(
345 345
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
346 346
 			array('', 'HIDDEN', array('name' => 'type', 'value' => $type), '', '', ''),
@@ -348,17 +348,17 @@  discard block
 block discarded – undo
348 348
 			$password,
349 349
 				/*                 * ********************* */
350 350
 		);
351
-		$form[gettext($entity_type . ' Profile')] = array(
351
+		$form[gettext($entity_type.' Profile')] = array(
352 352
 			array(gettext('First Name'), 'INPUT', array('name' => 'first_name', 'id' => 'first_name', 'size' => '15', 'maxlength' => '40', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
353 353
 			array(gettext('Last Name'), 'INPUT', array('name' => 'last_name', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter Password'),
354
-			array(gettext('Company'), 'INPUT', array('name' => 'company_name',  'size' => '15', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''),
355
-			array(gettext('Telephone 1'), 'INPUT', array('name' => 'telephone_1', 'size' => '15',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
354
+			array(gettext('Company'), 'INPUT', array('name' => 'company_name', 'size' => '15', 'class' => 'text field medium'), 'trim|xss_clean', 'tOOL TIP', ''),
355
+			array(gettext('Telephone 1'), 'INPUT', array('name' => 'telephone_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
356 356
 			array(gettext('Telephone 2'), 'INPUT', array('name' => 'telephone_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
357
-			array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50',  'class' => "text field medium"), 'required|valid_email|is_unique[' . $val . ']', 'tOOL TIP', ''),
358
-			array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15','class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
359
-			array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
357
+			array(gettext('Email'), 'INPUT', array('name' => 'email', 'size' => '50', 'class' => "text field medium"), 'required|valid_email|is_unique['.$val.']', 'tOOL TIP', ''),
358
+			array(gettext('Address 1'), 'INPUT', array('name' => 'address_1', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
359
+			array(gettext('Address 2'), 'INPUT', array('name' => 'address_2', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
360 360
 			array(gettext('City'), 'INPUT', array('name' => 'city', 'size' => '20', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
361
-			array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15',  'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
361
+			array(gettext('Province/State'), 'INPUT', array('name' => 'province', 'size' => '15', 'class' => "text field medium"), '', 'tOOL TIP', 'Please Enter Password'),
362 362
 			array(gettext('Zip/Postal Code'), 'INPUT', array('name' => 'postal_code', 'size' => '15', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter Password'),
363 363
 			array(gettext('Country'), array('name' => 'country_id', 'class' => 'country_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'country', 'countrycode', 'build_dropdown', '', ''),
364 364
 			array(gettext('Timezone'), array('name' => 'timezone_id', 'class' => 'timezone_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'gmtzone', 'timezone', 'build_dropdown', '', ''),
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 		$form['forms'] = array("accounts/customer_batch_update/", array('id' => "reseller_batch_update"));
405 405
 		$form[gettext('Batch Update')] = array(
406 406
 			array(gettext('Rate Group'), array('name' => 'pricelist_id[pricelist_id]', 'id' => 'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0"), array('name' => 'pricelist_id[operator]', 'class' => 'update_drp'), 'update_drp_type'),
407
-			array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'id' => 'balance', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name' => 'balance[operator]', 'class' => 'update_drp'), '', '', '', 'update_int_type', ''),
407
+			array(gettext('Balance'), 'INPUT', array('name' => 'balance[balance]', 'id' => 'balance', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name' => 'balance[operator]', 'class' => 'update_drp'), '', '', '', 'update_int_type', ''),
408 408
 			$status,
409 409
 		);
410 410
 		$form['button_search'] = array('name' => 'action', 'id' => "batch_update_btn", 'content' => gettext('Update'), 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 
420 420
 	function get_search_customer_form() {
421 421
 		$logintype = $this->CI->session->userdata('userlevel_logintype');
422
-		 if($logintype != 1){
422
+		 if ($logintype != 1) {
423 423
 		$form['forms'] = array("", array('id' => "account_search"));
424 424
 		$form[gettext('Search')] = array(
425 425
 			array(gettext('Account'), 'INPUT', array('name' => 'number[number]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''),
@@ -525,15 +525,15 @@  discard block
 block discarded – undo
525 525
 	function build_account_list_for_admin() {
526 526
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
527 527
 		$grid_field_arr = json_encode(array(
528
-			array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
529
-			array(gettext("Account"), "135", "number", "number", "accounts", "account_number_icon", "EDITABLE","true","left"),
530
-			array(gettext("First Name"), "150", "first_name", "", "", "","","true","center"),
531
-			array(gettext("Last Name"), "150", "last_name", "", "", "","","true","center"),
532
-			array(gettext("Company"), "150", "company_name", "", "", "","","true","center"),
533
-			array(gettext("Email"), "170", "email", "", "", "","","true","center"),
534
-			array(gettext("Phone"), "150", "telephone_1", "", "", "","","true","center"),
535
-			array(gettext("Country"), "110", "country_id", "country", "countrycode", "get_field_name","","true","center"),
536
-			array(gettext("Status"), "110", "status", "status", "accounts", "get_status","","true","center"),
528
+			array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
529
+			array(gettext("Account"), "135", "number", "number", "accounts", "account_number_icon", "EDITABLE", "true", "left"),
530
+			array(gettext("First Name"), "150", "first_name", "", "", "", "", "true", "center"),
531
+			array(gettext("Last Name"), "150", "last_name", "", "", "", "", "true", "center"),
532
+			array(gettext("Company"), "150", "company_name", "", "", "", "", "true", "center"),
533
+			array(gettext("Email"), "170", "email", "", "", "", "", "true", "center"),
534
+			array(gettext("Phone"), "150", "telephone_1", "", "", "", "", "true", "center"),
535
+			array(gettext("Country"), "110", "country_id", "country", "countrycode", "get_field_name", "", "true", "center"),
536
+			array(gettext("Status"), "110", "status", "status", "accounts", "get_status", "", "true", "center"),
537 537
 			/*******************************************************************/
538 538
 			array("Action", "100", "", "", "", array(
539 539
 					"EDIT" => array("url" => "accounts/admin_edit/", "mode" => "single"),
@@ -545,24 +545,24 @@  discard block
 block discarded – undo
545 545
 
546 546
 	function build_account_list_for_customer() {
547 547
 	  $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
548
-	  $currency_id=$account_info['currency_id'];
549
-	  $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
548
+	  $currency_id = $account_info['currency_id'];
549
+	  $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
550 550
       
551 551
 	  // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
552 552
 	  $grid_field_arr = json_encode(array(
553
-		array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "","","","","false","center"),
554
-		array(gettext("Account"), "125", "number", "number", "accounts", "account_number_icon", "EDITABLE","true","left"),
555
-			array(gettext("First Name"), "95", "first_name", "", "", "","","true","center"),
556
-			array(gettext("Last Name"), "95", "last_name", "", "", "","","true","center"),
557
-			array(gettext("Company"), "85", "company_name", "", "", "","","true","center"),
558
-			array(gettext("Rate Group"), "85", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
559
-			array(gettext("Balance")." ($currency)", "100", "balance", "balance", "balance", "convert_to_currency_account","","true","right"),
560
-			array(gettext("Credit Limit")." ($currency)", "120", "credit_limit", "credit_limit", "credit_limit", "convert_to_currency_account","","true","right"),
561
-			array(gettext("First Used"), "80", "first_used", "", "", "","","true","center"),
562
-			array(gettext("Expiry Date"), "80", "expiry", "", "", "","","true","center"),
563
-			array("CC", "45", "maxchannels", "", "", "","","true","center"),
564
-			array(gettext("Status"), "90", "status", "status", "accounts", "get_status","","true","center"),
565
-			array(gettext("Created Date"), "90", "creation", "", "", "","","true","center"),
553
+		array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
554
+		array(gettext("Account"), "125", "number", "number", "accounts", "account_number_icon", "EDITABLE", "true", "left"),
555
+			array(gettext("First Name"), "95", "first_name", "", "", "", "", "true", "center"),
556
+			array(gettext("Last Name"), "95", "last_name", "", "", "", "", "true", "center"),
557
+			array(gettext("Company"), "85", "company_name", "", "", "", "", "true", "center"),
558
+			array(gettext("Rate Group"), "85", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
559
+			array(gettext("Balance")." ($currency)", "100", "balance", "balance", "balance", "convert_to_currency_account", "", "true", "right"),
560
+			array(gettext("Credit Limit")." ($currency)", "120", "credit_limit", "credit_limit", "credit_limit", "convert_to_currency_account", "", "true", "right"),
561
+			array(gettext("First Used"), "80", "first_used", "", "", "", "", "true", "center"),
562
+			array(gettext("Expiry Date"), "80", "expiry", "", "", "", "", "true", "center"),
563
+			array("CC", "45", "maxchannels", "", "", "", "", "true", "center"),
564
+			array(gettext("Status"), "90", "status", "status", "accounts", "get_status", "", "true", "center"),
565
+			array(gettext("Created Date"), "90", "creation", "", "", "", "", "true", "center"),
566 566
 			/************************************************************************/
567 567
 			array(gettext("Action"), "140", "", "", "", array("PAYMENT" => array("url" => "accounts/customer_payment_process_add/", "mode" => "single"),
568 568
 					"CALLERID" => array("url" => "accounts/customer_add_callerid/", "mode" => "popup"),
@@ -574,21 +574,21 @@  discard block
 block discarded – undo
574 574
 
575 575
 	function build_account_list_for_reseller() {
576 576
 	$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
577
-	$currency_id=$account_info['currency_id'];
578
-	$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
577
+	$currency_id = $account_info['currency_id'];
578
+	$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
579 579
 	
580 580
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
581
-		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
582
-			array(gettext("Account"), "105", "number", "", "", "", "EDITABLE","true","center"),
583
-			array(gettext("First Name"), "120", "first_name", "", "", "","","true","center"),
584
-			array(gettext("Last Name"), "115", "last_name", "", "", "","","true","center"),
585
-			array(gettext("Company"), "130", "company_name", "", "", "","","true","center"),
586
-			array(gettext("Rate Group"), "95", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
587
-			array(gettext("Account Type"), "107", "posttoexternal", "posttoexternal", "posttoexternal", "get_account_type","","true","center"),
588
-			array(gettext("Balance")." ($currency)", "100", "balance", "balance", "balance", "convert_to_currency","","true","right"),
589
-			array(gettext("Credit Limit")." ($currency)", "120", "credit_limit", "credit_limit", "credit_limit", "convert_to_currency","","true","right"),
590
-			array(gettext("Status"), "110", "status", "status", "accounts", "get_status","","true","center"),
591
-			array(gettext("Created Date"), "90", "creation", "", "", "","","true","center"),          
581
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
582
+			array(gettext("Account"), "105", "number", "", "", "", "EDITABLE", "true", "center"),
583
+			array(gettext("First Name"), "120", "first_name", "", "", "", "", "true", "center"),
584
+			array(gettext("Last Name"), "115", "last_name", "", "", "", "", "true", "center"),
585
+			array(gettext("Company"), "130", "company_name", "", "", "", "", "true", "center"),
586
+			array(gettext("Rate Group"), "95", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
587
+			array(gettext("Account Type"), "107", "posttoexternal", "posttoexternal", "posttoexternal", "get_account_type", "", "true", "center"),
588
+			array(gettext("Balance")." ($currency)", "100", "balance", "balance", "balance", "convert_to_currency", "", "true", "right"),
589
+			array(gettext("Credit Limit")." ($currency)", "120", "credit_limit", "credit_limit", "credit_limit", "convert_to_currency", "", "true", "right"),
590
+			array(gettext("Status"), "110", "status", "status", "accounts", "get_status", "", "true", "center"),
591
+			array(gettext("Created Date"), "90", "creation", "", "", "", "", "true", "center"),          
592 592
 			/**************************************************************/
593 593
 			array("Action", "139", "", "", "", array("PAYMENT" => array("url" => "accounts/customer_payment_process_add/", "mode" => "single"),
594 594
 					"CALLERID" => array("url" => "accounts/customer_add_callerid/", "mode" => 'popup'),
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 			 // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
609 609
 		$buttons_json = json_encode(array(
610 610
 			array(gettext("Create Customer"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add/"),
611
-			array(gettext("Mass Create"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_bulk_creation/", "popup","medium"),
611
+			array(gettext("Mass Create"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_bulk_creation/", "popup", "medium"),
612 612
 			$provider,
613 613
 			array(gettext("Export"), "btn btn-xing", " fa fa-download fa-lg", "button_action", "/accounts/customer_export_cdr_xls/", 'single'),
614 614
 			array(gettext("Delete"), "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/accounts/customer_selected_delete/")
@@ -636,23 +636,23 @@  discard block
 block discarded – undo
636 636
 
637 637
 	function build_ip_list_for_customer($accountid, $accountype) {
638 638
 		$grid_field_arr = json_encode(array(
639
-			array(gettext('Name'), "180", "name", "", "", "","","true","center"),
640
-			array(gettext('IP'), "180", "ip", "", "", "","","true","center"),
641
-			array(gettext('Prefix'), "180", "prefix", "", "", "","","true","center"),
642
-			array(gettext('Created Date'), "174", "created_date", "created_date", "created_date", "convert_GMT_to","","true","center"),
643
-			array(gettext('Modified Date'), "160", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
644
-			array(gettext('Action'), "150", "", "", "", array("DELETE" => array("url" => "accounts/" . $accountype . "_ipmap_action/delete/$accountid/$accountype/", "mode" => "single")))
639
+			array(gettext('Name'), "180", "name", "", "", "", "", "true", "center"),
640
+			array(gettext('IP'), "180", "ip", "", "", "", "", "true", "center"),
641
+			array(gettext('Prefix'), "180", "prefix", "", "", "", "", "true", "center"),
642
+			array(gettext('Created Date'), "174", "created_date", "created_date", "created_date", "convert_GMT_to", "", "true", "center"),
643
+			array(gettext('Modified Date'), "160", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
644
+			array(gettext('Action'), "150", "", "", "", array("DELETE" => array("url" => "accounts/".$accountype."_ipmap_action/delete/$accountid/$accountype/", "mode" => "single")))
645 645
 				));
646 646
 		return $grid_field_arr;
647 647
 	}
648 648
 
649 649
 	function build_animap_list_for_customer($accountid, $accounttype) {
650 650
 		$grid_field_arr = json_encode(array(
651
-			array(gettext("Caller ID"), "200", "number", "", "", "","","true","center"),
652
-			array(gettext("Status"), "180", "status", "status", "ani_map", "get_status_new","","true","center"),
653
-			array(gettext("Created Date"), "200", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
654
-			array(gettext("Modified Date"), "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
655
-			array(gettext("Action"), "200", "", "", "", array("DELETE" => array("url" => "accounts/" . $accounttype . "_animap_action/delete/$accountid/", "mode" => "single")))
651
+			array(gettext("Caller ID"), "200", "number", "", "", "", "", "true", "center"),
652
+			array(gettext("Status"), "180", "status", "status", "ani_map", "get_status_new", "", "true", "center"),
653
+			array(gettext("Created Date"), "200", "creation_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"),
654
+			array(gettext("Modified Date"), "170", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
655
+			array(gettext("Action"), "200", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_animap_action/delete/$accountid/", "mode" => "single")))
656 656
 				));
657 657
 		return $grid_field_arr;
658 658
 	}
@@ -668,13 +668,13 @@  discard block
 block discarded – undo
668 668
 
669 669
 	function set_block_pattern_action_buttons($id) {
670 670
 		$ret_url = '';
671
-		$ret_url .= '<a href="/did/delete/' . $id . '/" class="icon delete_image" title="Delete" onClick="return get_alert_msg();">&nbsp;</a>';
671
+		$ret_url .= '<a href="/did/delete/'.$id.'/" class="icon delete_image" title="Delete" onClick="return get_alert_msg();">&nbsp;</a>';
672 672
 		return $ret_url;
673 673
 	}
674 674
 
675 675
 	function build_animap_list() {
676 676
 		$grid_field_arr = json_encode(array(array("Caller ID", "180", "number", "", "", ""),
677
-			array(gettext("status"),"180","status","status","animap","get_status"),    
677
+			array(gettext("status"), "180", "status", "status", "animap", "get_status"),    
678 678
 			array(gettext("Action"), "130", "", "", "",
679 679
 				array(
680 680
 					"EDIT_ANIMAP" => array("url" => "accounts/callingcards_animap_list_edit/", "mode" => "single"),
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if (!defined('BASEPATH')) {
25 25
 	exit('No direct script access allowed');
26
+}
26 27
 
27 28
 class Accounts_form {
28 29
 	function __construct($library_name = '') {
@@ -279,8 +280,7 @@  discard block
 block discarded – undo
279 280
 			array(gettext('Tax'), 'tax_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'taxes_description', 'taxes', 'build_dropdown', 'where_arr', array('status' => 0, 'reseller_id' => $loginid), 'multi'),
280 281
 		);
281 282
 
282
-}
283
-else{
283
+} else{
284 284
 			$form[gettext('Billing Information')] = array(
285 285
 			array(gettext('Rate Group'), 'pricelist_id', 'SELECT', '', array("name" => "pricelist_id", 'rules' => 'required'), 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")),
286 286
             
@@ -442,8 +442,7 @@  discard block
 block discarded – undo
442 442
 			array('', 'HIDDEN', 'advance_search', '1', '', '', '')
443 443
 		);
444 444
         
445
-		}
446
-		else
445
+		} else
447 446
 		{
448 447
 		
449 448
 		$form['forms'] = array("", array('id' => "account_search"));
@@ -603,8 +602,9 @@  discard block
 block discarded – undo
603 602
 	function build_grid_buttons_customer() {
604 603
 		$logintype = $this->CI->session->userdata('userlevel_logintype');
605 604
 		$provider = null;
606
-		if ($logintype != 1)
607
-			$provider = array(gettext("Create Provider"), "btn btn-line-blue btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/provider_add/");
605
+		if ($logintype != 1) {
606
+					$provider = array(gettext("Create Provider"), "btn btn-line-blue btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/provider_add/");
607
+		}
608 608
 			 // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
609 609
 		$buttons_json = json_encode(array(
610 610
 			array(gettext("Create Customer"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add/"),
Please login to merge, or discard this patch.
astpp/application/modules/accounts/views/view_accounting_taxes_add.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@
 block discarded – undo
59 59
 							if (isset($taxesList) && is_array($taxesList) && count($taxesList) > 0) {
60 60
 								echo "<table>";
61 61
 								foreach ($taxesList as $values) {
62
-									if ($i == 1)
63
-										echo"<tr>";
62
+									if ($i == 1) {
63
+																			echo"<tr>";
64
+									}
64 65
 									?>
65 66
                                 <td style="padding-left: 10px;">
66 67
                                     <input type="checkbox" id="tax_<?= $values->id; ?>"name="tax_<?= $values->id; ?>" value="<?= $values->id; ?>" <? if (in_array($values->id, $tax_ids)) {
Please login to merge, or discard this patch.
astpp/application/modules/accounts/views/view_bulk_account_creation.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,10 +57,10 @@
 block discarded – undo
57 57
                     <div style="color:red;margin-left: 60px;">
58 58
                         <?php
59 59
 						if (isset($validation_errors)) {
60
-						   $validation_array=json_decode($validation_errors);
61
-						   if(is_object($validation_array)){
60
+						   $validation_array = json_decode($validation_errors);
61
+						   if (is_object($validation_array)) {
62 62
 						   $validation_array = get_object_vars($validation_array);
63
-						   foreach($validation_array as $key=>$value)
63
+						   foreach ($validation_array as $key=>$value)
64 64
 					  echo $value."<br/>";
65 65
 						   }
66 66
 						   else
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,11 +60,12 @@
 block discarded – undo
60 60
 						   $validation_array=json_decode($validation_errors);
61 61
 						   if(is_object($validation_array)){
62 62
 						   $validation_array = get_object_vars($validation_array);
63
-						   foreach($validation_array as $key=>$value)
64
-					  echo $value."<br/>";
63
+						   foreach($validation_array as $key=>$value) {
64
+						   					  echo $value."<br/>";
65
+						   }
66
+						   } else {
67
+						   					  echo $validation_errors;
65 68
 						   }
66
-						   else
67
-					  echo $validation_errors;
68 69
                            
69 70
 						}
70 71
 						?>
Please login to merge, or discard this patch.
astpp/application/modules/accounts/views/view_customer_alert_threshold.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 					}
52 52
 					$data_errrors = json_decode($validation_errors);
53 53
 					foreach ($data_errrors as $key => $value) {
54
-						echo $value . "<br/>";
54
+						echo $value."<br/>";
55 55
 					}
56 56
 					?> 
57 57
                 </div>
Please login to merge, or discard this patch.
astpp/application/modules/accounts/views/view_admin_details.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 <!--                                <?php
29 29
 								$data_errrors = json_decode($validation_errors);
30 30
 								foreach ($data_errrors as $key => $value) {
31
-									echo $value . "<br/>";
31
+									echo $value."<br/>";
32 32
 								}
33 33
 								?> 
34 34
                           </div>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/models/rates_model.php 3 patches
Indentation   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -122,236 +122,236 @@
 block discarded – undo
122 122
 		$this->db_model->build_search('origination_rate_list_search');
123 123
 /***********************/
124 124
 
125
-        if ($flag) {
126
-            $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
127
-        } else {
128
-            $query = $this->db_model->countQuery("*", "routes", $where);
125
+		if ($flag) {
126
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
127
+		} else {
128
+			$query = $this->db_model->countQuery("*", "routes", $where);
129 129
             
130
-        }
131
-        //echo $this->db->last_query();
132
-        return $query;
133
-    }
134
-    function getunblocked_pattern_list($accountid, $flag, $start = 0, $limit = 0) {
135
-        $this->db_model->build_search('origination_rate_list_search');
136
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
137
-            $account_data = $this->session->userdata("accountinfo");
138
-            $reseller = $account_data['id'];
139
-            $where = array("reseller_id" => $reseller, "status" => "0");
140
-        } else {
141
-            $where = array("status" => "0", 'reseller_id'=>'0');
142
-        }
143
-        $where1 = '(pattern NOT IN (select blocked_patterns from block_patterns where accountid = "'.$accountid.'"))';
144
-        $this->db->where($where1);        
145
-        if ($flag) {
146
-            $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
130
+		}
131
+		//echo $this->db->last_query();
132
+		return $query;
133
+	}
134
+	function getunblocked_pattern_list($accountid, $flag, $start = 0, $limit = 0) {
135
+		$this->db_model->build_search('origination_rate_list_search');
136
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
137
+			$account_data = $this->session->userdata("accountinfo");
138
+			$reseller = $account_data['id'];
139
+			$where = array("reseller_id" => $reseller, "status" => "0");
140
+		} else {
141
+			$where = array("status" => "0", 'reseller_id'=>'0');
142
+		}
143
+		$where1 = '(pattern NOT IN (select blocked_patterns from block_patterns where accountid = "'.$accountid.'"))';
144
+		$this->db->where($where1);        
145
+		if ($flag) {
146
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
147 147
 //             echo "<pre>"; print_r($query); exit;
148
-        } else {
149
-            $query = $this->db_model->countQuery("*", "routes", $where);
150
-        }
151
-        return $query;
152
-    }
153
-    function getunblocked_package_pattern($accountid, $flag, $start = 0, $limit = 0) {
154
-        $this->db_model->build_search('origination_rate_list_search');
155
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
156
-            $account_data = $this->session->userdata("accountinfo");
157
-            $reseller = $account_data['id'];
158
-            $where = array("reseller_id" => $reseller, "status" => "0");
159
-        } else {
160
-            $where = array("status" => "0", 'reseller_id'=>'0');
161
-        }
162
-        $where1 = '(pattern NOT IN (select DISTINCT patterns from package_patterns where package_id = "'.$accountid.'"))';
163
-        $this->db->where($where1);       
164
-        if ($flag) {
165
-            $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
166
-        } else {
167
-            $query = $this->db_model->countQuery("*", "routes", $where);
168
-        }
169
-        return $query;
170
-    }
148
+		} else {
149
+			$query = $this->db_model->countQuery("*", "routes", $where);
150
+		}
151
+		return $query;
152
+	}
153
+	function getunblocked_package_pattern($accountid, $flag, $start = 0, $limit = 0) {
154
+		$this->db_model->build_search('origination_rate_list_search');
155
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
156
+			$account_data = $this->session->userdata("accountinfo");
157
+			$reseller = $account_data['id'];
158
+			$where = array("reseller_id" => $reseller, "status" => "0");
159
+		} else {
160
+			$where = array("status" => "0", 'reseller_id'=>'0');
161
+		}
162
+		$where1 = '(pattern NOT IN (select DISTINCT patterns from package_patterns where package_id = "'.$accountid.'"))';
163
+		$this->db->where($where1);       
164
+		if ($flag) {
165
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
166
+		} else {
167
+			$query = $this->db_model->countQuery("*", "routes", $where);
168
+		}
169
+		return $query;
170
+	}
171 171
 
172
-    function get_origination_rate_list_for_user($flag, $start = 0, $limit = 0) {
173
-        $this->db_model->build_search('user_rates_list_search');
172
+	function get_origination_rate_list_for_user($flag, $start = 0, $limit = 0) {
173
+		$this->db_model->build_search('user_rates_list_search');
174 174
 
175
-        $account_data = $this->session->userdata("accountinfo");
176
-        $where = array("pricelist_id" => $account_data["pricelist_id"], "status" => '0');
175
+		$account_data = $this->session->userdata("accountinfo");
176
+		$where = array("pricelist_id" => $account_data["pricelist_id"], "status" => '0');
177 177
 
178
-        $this->db_model->build_search('origination_rate_list_search');
179
-        if ($flag) {
180
-            $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
181
-        } else {
182
-            $query = $this->db_model->countQuery("*", "routes", $where);
183
-        }
184
-        return $query;
185
-    }
178
+		$this->db_model->build_search('origination_rate_list_search');
179
+		if ($flag) {
180
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
181
+		} else {
182
+			$query = $this->db_model->countQuery("*", "routes", $where);
183
+		}
184
+		return $query;
185
+	}
186 186
 
187 187
 
188
-    function add_termination_rate($add_array) {
189
-        unset($add_array["action"]);
190
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
191
-            $account_data = $this->session->userdata("accountinfo");
192
-            $reseller = $account_data['id'];
193
-            $add_array['reseller_id'] = $reseller;
194
-        }
195
-        $add_array['pattern'] = "^".$add_array['pattern'].".*";
196
-        $add_array['prepend'] = $add_array['prepend'];
197
-        /*
188
+	function add_termination_rate($add_array) {
189
+		unset($add_array["action"]);
190
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
191
+			$account_data = $this->session->userdata("accountinfo");
192
+			$reseller = $account_data['id'];
193
+			$add_array['reseller_id'] = $reseller;
194
+		}
195
+		$add_array['pattern'] = "^".$add_array['pattern'].".*";
196
+		$add_array['prepend'] = $add_array['prepend'];
197
+		/*
198 198
         ASTPP  3.0 
199 199
          add creation date.
200 200
         */
201
-        $add_array['creation_date'] = gmdate('Y-m-d H:i:s');
202
-        /*******************************************************/
203
-        $this->insert_if_not_exitst($add_array, "outbound_routes");
204
-        //$this->db->insert("outbound_routes", $add_array);
205
-        return true;
206
-    }
201
+		$add_array['creation_date'] = gmdate('Y-m-d H:i:s');
202
+		/*******************************************************/
203
+		$this->insert_if_not_exitst($add_array, "outbound_routes");
204
+		//$this->db->insert("outbound_routes", $add_array);
205
+		return true;
206
+	}
207 207
 
208
-    function edit_termination_rate($data, $id) {
209
-        unset($data["action"]);
210
-        /*
208
+	function edit_termination_rate($data, $id) {
209
+		unset($data["action"]);
210
+		/*
211 211
         ASTPP  3.0
212 212
          Edit time last modified date
213 213
         */
214
-        $data['last_modified_date'] = gmdate('Y-m-d H:i:s');
215
-        /***************************************************/
216
-        $data['pattern'] = "^".$data['pattern'].".*";
217
-        $this->db->where("id", $id);
218
-        $this->db->update("outbound_routes", $data);
219
-    }
214
+		$data['last_modified_date'] = gmdate('Y-m-d H:i:s');
215
+		/***************************************************/
216
+		$data['pattern'] = "^".$data['pattern'].".*";
217
+		$this->db->where("id", $id);
218
+		$this->db->update("outbound_routes", $data);
219
+	}
220 220
 
221
-    function remove_termination_rate($id) {
222
-        $this->db->where("id", $id);
223
-        $this->db->delete("outbound_routes");
224
-        return true;
225
-    }
221
+	function remove_termination_rate($id) {
222
+		$this->db->where("id", $id);
223
+		$this->db->delete("outbound_routes");
224
+		return true;
225
+	}
226 226
 
227
-    function add_origination_rate($add_array) {
227
+	function add_origination_rate($add_array) {
228 228
 		
229
-        unset($add_array["action"]);
230
-        /*
229
+		unset($add_array["action"]);
230
+		/*
231 231
         ASTPP  3.0 
232 232
         ADD time put creation date in routes table 
233 233
         */
234
-        $add_array['creation_date'] = gmdate('Y-m-d H:i:s');
235
-        /**********************************************/
236
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
237
-            $account_data = $this->session->userdata("accountinfo");
238
-            $reseller = $account_data['id'];
239
-            $add_array['reseller_id'] = $reseller;
240
-        }
234
+		$add_array['creation_date'] = gmdate('Y-m-d H:i:s');
235
+		/**********************************************/
236
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
237
+			$account_data = $this->session->userdata("accountinfo");
238
+			$reseller = $account_data['id'];
239
+			$add_array['reseller_id'] = $reseller;
240
+		}
241 241
 	
242
-        $add_array['pattern'] = "^".$add_array['pattern'].".*";
242
+		$add_array['pattern'] = "^".$add_array['pattern'].".*";
243 243
 /*************
244 244
 ASTPP  3.0 
245 245
 Rate insert
246 246
 *************/
247
-        $this->insert_if_not_exitst($add_array, "routes");
247
+		$this->insert_if_not_exitst($add_array, "routes");
248 248
 //        $this->db->insert("routes", $add_array);
249 249
 /*******************************/
250
-        return true;
251
-    }
250
+		return true;
251
+	}
252 252
 
253
-    function edit_origination_rate($data, $id) {
254
-        unset($data["action"]);
255
-        /*
253
+	function edit_origination_rate($data, $id) {
254
+		unset($data["action"]);
255
+		/*
256 256
         ASTPP  3.0
257 257
          Edit tile last modified date update
258 258
         */
259
-        $data['last_modified_date'] = gmdate('Y-m-d H:i:s');
260
-        /********************************************************/
261
-        $data['pattern'] = "^".$data['pattern'].".*";
262
-        $this->db->where("id", $id);
263
-        $this->db->update("routes", $data);
264
-    }
259
+		$data['last_modified_date'] = gmdate('Y-m-d H:i:s');
260
+		/********************************************************/
261
+		$data['pattern'] = "^".$data['pattern'].".*";
262
+		$this->db->where("id", $id);
263
+		$this->db->update("routes", $data);
264
+	}
265 265
 
266
-    function remove_origination_rate($id) {
267
-        $this->db->where("id", $id);
268
-        $this->db->delete("routes");
269
-        return true;
270
-    }
266
+	function remove_origination_rate($id) {
267
+		$this->db->where("id", $id);
268
+		$this->db->delete("routes");
269
+		return true;
270
+	}
271 271
 
272
-    function get_trunk_name($field_value) {
273
-        $this->db->where("name", $field_value);
274
-        $query = $this->db->get('trunks');
275
-        $data = $query->result();
276
-        if ($query->num_rows > 0) {
277
-                    return $data[0]->id;
278
-        } else {
279
-                    return '';
280
-        }
281
-    }
272
+	function get_trunk_name($field_value) {
273
+		$this->db->where("name", $field_value);
274
+		$query = $this->db->get('trunks');
275
+		$data = $query->result();
276
+		if ($query->num_rows > 0) {
277
+					return $data[0]->id;
278
+		} else {
279
+					return '';
280
+		}
281
+	}
282 282
 
283
-    function bulk_insert_termination_rate($field_value) {
284
-        //$this->db->insert_batch('outbound_routes', $field_value);
285
-        $this->db->insert_on_duplicate_update_batch('outbound_routes', $field_value);
286
-        $affected_row = $this->db->affected_rows();
287
-        return $affected_row;
288
-    }
283
+	function bulk_insert_termination_rate($field_value) {
284
+		//$this->db->insert_batch('outbound_routes', $field_value);
285
+		$this->db->insert_on_duplicate_update_batch('outbound_routes', $field_value);
286
+		$affected_row = $this->db->affected_rows();
287
+		return $affected_row;
288
+	}
289 289
 
290
-    function bulk_insert_origination_rate($inserted_array) {
291
-        //$this->db->insert_batch('routes', $inserted_array);
292
-        $this->db->insert_on_duplicate_update_batch('routes', $inserted_array);
293
-        $affected_row = $this->db->affected_rows();
294
-        return $affected_row;
295
-    }
296
-    function termination_rate_batch_update($update_array) {
297
-        $this->db_model->build_search('termination_rates_list_search');
298
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
299
-            $account_data = $this->session->userdata("accountinfo");
300
-            $this->db->where("reseller_id", $account_data['id']);
301
-        }
290
+	function bulk_insert_origination_rate($inserted_array) {
291
+		//$this->db->insert_batch('routes', $inserted_array);
292
+		$this->db->insert_on_duplicate_update_batch('routes', $inserted_array);
293
+		$affected_row = $this->db->affected_rows();
294
+		return $affected_row;
295
+	}
296
+	function termination_rate_batch_update($update_array) {
297
+		$this->db_model->build_search('termination_rates_list_search');
298
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
299
+			$account_data = $this->session->userdata("accountinfo");
300
+			$this->db->where("reseller_id", $account_data['id']);
301
+		}
302 302
         
303
-        $updateflg = $this->db_model->build_batch_update_array($update_array);
304
-        if ($updateflg)
305
-            return $this->db->update("outbound_routes");
306
-        else
307
-            return false;
308
-    }
309
-    function origination_rate_batch_update($update_array) {
310
-        $this->db_model->build_search('origination_rate_list_search');
311
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
312
-            $account_data = $this->session->userdata("accountinfo");
313
-            $this->db->where("reseller_id", $account_data['id']);
314
-        }
315
-        $updateflg = $this->db_model->build_batch_update_array($update_array);
316
-        if ($updateflg)
317
-            return $this->db->update("routes");
318
-        else
319
-            return false;
320
-    }
321
-    function getreseller_rates_list($flag, $start = 0, $limit = 0, $export = false) {
322
-        $this->db_model->build_search('resellerrates_list_search');
323
-        $account_data = $this->session->userdata("accountinfo");
324
-        $where = array("status"=>"0", "pricelist_id" => $account_data["pricelist_id"]);
325
-        if ($flag) {
326
-            $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);            
327
-        } else {
328
-            $query = $this->db_model->countQuery("*", "routes", $where);
329
-        }
330
-        return $query;
331
-    }
303
+		$updateflg = $this->db_model->build_batch_update_array($update_array);
304
+		if ($updateflg)
305
+			return $this->db->update("outbound_routes");
306
+		else
307
+			return false;
308
+	}
309
+	function origination_rate_batch_update($update_array) {
310
+		$this->db_model->build_search('origination_rate_list_search');
311
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
312
+			$account_data = $this->session->userdata("accountinfo");
313
+			$this->db->where("reseller_id", $account_data['id']);
314
+		}
315
+		$updateflg = $this->db_model->build_batch_update_array($update_array);
316
+		if ($updateflg)
317
+			return $this->db->update("routes");
318
+		else
319
+			return false;
320
+	}
321
+	function getreseller_rates_list($flag, $start = 0, $limit = 0, $export = false) {
322
+		$this->db_model->build_search('resellerrates_list_search');
323
+		$account_data = $this->session->userdata("accountinfo");
324
+		$where = array("status"=>"0", "pricelist_id" => $account_data["pricelist_id"]);
325
+		if ($flag) {
326
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);            
327
+		} else {
328
+			$query = $this->db_model->countQuery("*", "routes", $where);
329
+		}
330
+		return $query;
331
+	}
332 332
 /*************
333 333
 ASTPP  3.0
334 334
 Rate insert
335 335
 *************/
336
-    /**
337
-     * @param string $table_name
338
-     */
339
-    function insert_if_not_exitst($add_array,$table_name){
340
-        $insert_str = "Insert into $table_name (";
341
-        $insert_key = "";
342
-        $insert_value = "";
343
-        $update_str = "";
344
-        foreach($add_array as $key => $value){
345
-           if($key != 'id'){
346
-                   $insert_key .= $key.",";
347
-                   $insert_value .= "'$value',";   
348
-                   $update_str .= $key." = '$value',";
349
-           }
350
-        }
351
-        $insert_key = rtrim($insert_key,",");
352
-        $insert_value = rtrim($insert_value,",");
353
-        $update_str = rtrim($update_str,",");
354
-        $insert_str .= $insert_key.") values"."(".$insert_value.")  ON DUPLICATE KEY UPDATE $update_str";
355
-        $this->db->query($insert_str);
356
-    }   
336
+	/**
337
+	 * @param string $table_name
338
+	 */
339
+	function insert_if_not_exitst($add_array,$table_name){
340
+		$insert_str = "Insert into $table_name (";
341
+		$insert_key = "";
342
+		$insert_value = "";
343
+		$update_str = "";
344
+		foreach($add_array as $key => $value){
345
+		   if($key != 'id'){
346
+				   $insert_key .= $key.",";
347
+				   $insert_value .= "'$value',";   
348
+				   $update_str .= $key." = '$value',";
349
+		   }
350
+		}
351
+		$insert_key = rtrim($insert_key,",");
352
+		$insert_value = rtrim($insert_value,",");
353
+		$update_str = rtrim($update_str,",");
354
+		$insert_str .= $insert_key.") values"."(".$insert_value.")  ON DUPLICATE KEY UPDATE $update_str";
355
+		$this->db->query($insert_str);
356
+	}   
357 357
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 ASTPP  3.0 
33 33
 Batch Delete
34 34
 ********/
35
-		if($this->session->userdata('advance_batch_delete') == 1){
35
+		if ($this->session->userdata('advance_batch_delete') == 1) {
36 36
 		   $this->db->where(array("trunk_id >"=>"0"));
37 37
 		   $this->db->delete("outbound_routes");
38
-		   $this->session->set_userdata('advance_batch_delete','0');
38
+		   $this->session->set_userdata('advance_batch_delete', '0');
39 39
 		   $this->session->unset_userdata('advance_batch_delete');
40 40
 	   }
41 41
 /**************/
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 			if ($export)
54 54
 				$this->db->limit($limit, $start);
55 55
 			$result = $this->db->get();
56
-		}else {
56
+		} else {
57 57
 			$result = $this->db->count_all_results();
58 58
 		}
59 59
 		return $result;
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 			if ($export)
75 75
 				$this->db->limit($limit, $start);
76 76
 			$result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
77
-		}else {
77
+		} else {
78 78
 			$result = $this->db_model->countQuery("*", "routes", $where);
79 79
 		}
80 80
 // 	echo "<pre>";print_r($result->result());exit;
81 81
 		return $result;
82 82
 	}
83 83
 
84
-	function get_origination_rate_for_user($flag, $start = 0, $limit = 0,$export = true) {
84
+	function get_origination_rate_for_user($flag, $start = 0, $limit = 0, $export = true) {
85 85
 		$this->db_model->build_search('origination_rate_list_search');
86 86
 
87 87
 		$account_data = $this->session->userdata("accountinfo");
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			if ($export)
94 94
 				$this->db->limit($limit, $start);
95 95
 			$result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
96
-		}else {
96
+		} else {
97 97
 			$result = $this->db_model->countQuery("*", "routes", $where);
98 98
 		}
99 99
 		return $result;
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 ASTPP  3.0 
112 112
 Batch delete
113 113
 ************/
114
-		if($this->session->userdata('advance_batch_delete') == 1){
114
+		if ($this->session->userdata('advance_batch_delete') == 1) {
115 115
 			$this->db->where($where);
116 116
 			$this->db->delete("routes");
117 117
 			//echo $this->db->last_query(); exit;
118
-			$this->session->set_userdata('advance_batch_delete','0');
118
+			$this->session->set_userdata('advance_batch_delete', '0');
119 119
 			$this->session->unset_userdata('advance_batch_delete');
120 120
 			
121 121
 		}
@@ -336,21 +336,21 @@  discard block
 block discarded – undo
336 336
     /**
337 337
      * @param string $table_name
338 338
      */
339
-    function insert_if_not_exitst($add_array,$table_name){
339
+    function insert_if_not_exitst($add_array, $table_name) {
340 340
         $insert_str = "Insert into $table_name (";
341 341
         $insert_key = "";
342 342
         $insert_value = "";
343 343
         $update_str = "";
344
-        foreach($add_array as $key => $value){
345
-           if($key != 'id'){
344
+        foreach ($add_array as $key => $value) {
345
+           if ($key != 'id') {
346 346
                    $insert_key .= $key.",";
347 347
                    $insert_value .= "'$value',";   
348 348
                    $update_str .= $key." = '$value',";
349 349
            }
350 350
         }
351
-        $insert_key = rtrim($insert_key,",");
352
-        $insert_value = rtrim($insert_value,",");
353
-        $update_str = rtrim($update_str,",");
351
+        $insert_key = rtrim($insert_key, ",");
352
+        $insert_value = rtrim($insert_value, ",");
353
+        $update_str = rtrim($update_str, ",");
354 354
         $insert_str .= $insert_key.") values"."(".$insert_value.")  ON DUPLICATE KEY UPDATE $update_str";
355 355
         $this->db->query($insert_str);
356 356
     }   
Please login to merge, or discard this patch.
Braces   +22 added lines, -17 removed lines patch added patch discarded remove patch
@@ -50,10 +50,11 @@  discard block
 block discarded – undo
50 50
 		$this->db_model->build_search('termination_rates_list_search');
51 51
 		$this->db->from('outbound_routes');
52 52
 		if ($flag) {
53
-			if ($export)
54
-				$this->db->limit($limit, $start);
53
+			if ($export) {
54
+							$this->db->limit($limit, $start);
55
+			}
55 56
 			$result = $this->db->get();
56
-		}else {
57
+		} else {
57 58
 			$result = $this->db->count_all_results();
58 59
 		}
59 60
 		return $result;
@@ -71,10 +72,11 @@  discard block
 block discarded – undo
71 72
        
72 73
 		$this->db_model->build_search('origination_rate_list_search');
73 74
 		if ($flag) {
74
-			if ($export)
75
-				$this->db->limit($limit, $start);
75
+			if ($export) {
76
+							$this->db->limit($limit, $start);
77
+			}
76 78
 			$result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
77
-		}else {
79
+		} else {
78 80
 			$result = $this->db_model->countQuery("*", "routes", $where);
79 81
 		}
80 82
 // 	echo "<pre>";print_r($result->result());exit;
@@ -90,10 +92,11 @@  discard block
 block discarded – undo
90 92
 
91 93
 		$this->db_model->build_search('origination_rate_list_search');
92 94
 		if ($flag) {
93
-			if ($export)
94
-				$this->db->limit($limit, $start);
95
+			if ($export) {
96
+							$this->db->limit($limit, $start);
97
+			}
95 98
 			$result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
96
-		}else {
99
+		} else {
97 100
 			$result = $this->db_model->countQuery("*", "routes", $where);
98 101
 		}
99 102
 		return $result;
@@ -301,10 +304,11 @@  discard block
 block discarded – undo
301 304
         }
302 305
         
303 306
         $updateflg = $this->db_model->build_batch_update_array($update_array);
304
-        if ($updateflg)
305
-            return $this->db->update("outbound_routes");
306
-        else
307
-            return false;
307
+        if ($updateflg) {
308
+                    return $this->db->update("outbound_routes");
309
+        } else {
310
+                    return false;
311
+        }
308 312
     }
309 313
     function origination_rate_batch_update($update_array) {
310 314
         $this->db_model->build_search('origination_rate_list_search');
@@ -313,10 +317,11 @@  discard block
 block discarded – undo
313 317
             $this->db->where("reseller_id", $account_data['id']);
314 318
         }
315 319
         $updateflg = $this->db_model->build_batch_update_array($update_array);
316
-        if ($updateflg)
317
-            return $this->db->update("routes");
318
-        else
319
-            return false;
320
+        if ($updateflg) {
321
+                    return $this->db->update("routes");
322
+        } else {
323
+                    return false;
324
+        }
320 325
     }
321 326
     function getreseller_rates_list($flag, $start = 0, $limit = 0, $export = false) {
322 327
         $this->db_model->build_search('resellerrates_list_search');
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/controllers/rates.php 2 patches
Spacing   +217 added lines, -217 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 		$this->load->library('astpp/form');
33 33
 		$this->load->model('rates_model');
34 34
 		$this->load->library('csvreader');
35
-	ini_set("memory_limit","2048M");
36
-	ini_set("max_execution_time","259200");
35
+	ini_set("memory_limit", "2048M");
36
+	ini_set("max_execution_time", "259200");
37 37
 		if ($this->session->userdata('user_login') == FALSE)
38
-			redirect(base_url() . '/astpp/login');
38
+			redirect(base_url().'/astpp/login');
39 39
 	}
40 40
 
41 41
 	function termination_rates_list() {
@@ -72,70 +72,70 @@  discard block
 block discarded – undo
72 72
 
73 73
 		echo json_encode($json_data);
74 74
 	}
75
-	  function termination_rates_list_delete($flag='') {
75
+	  function termination_rates_list_delete($flag = '') {
76 76
 		$json_data = array();
77
-		$this->session->set_userdata('advance_batch_data_delete',1);
77
+		$this->session->set_userdata('advance_batch_data_delete', 1);
78 78
 		$count_all = $this->rates_model->get_termination_rates_list(false);
79 79
 	echo $count_all; 
80 80
 	} 
81 81
 /****************/
82 82
 	 function termination_rate_import() {
83 83
 		$data['page_title'] = 'Import Termination Rates';
84
-		$this->session->set_userdata('import_termination_rate_csv',"");
85
-		$this->session->set_userdata('import_termination_rate_csv_error',"");
84
+		$this->session->set_userdata('import_termination_rate_csv', "");
85
+		$this->session->set_userdata('import_termination_rate_csv_error', "");
86 86
 		$this->load->view('view_import_termination_rate', $data);
87 87
 	}
88
-	function termination_rate_preview_file(){
89
-		$invalid_flag= false;
90
-	$check_header=$this->input->post('check_header',true);
88
+	function termination_rate_preview_file() {
89
+		$invalid_flag = false;
90
+	$check_header = $this->input->post('check_header', true);
91 91
 	$data['page_title'] = 'Import Termination Rates';
92 92
 		$new_final_arr_key = $this->config->item('Termination-rates-field');
93
-		if(empty($_FILES) || !isset($_FILES)){
93
+		if (empty($_FILES) || ! isset($_FILES)) {
94 94
 	  redirect(base_url()."rates/termination_rates_list/");
95 95
 	}
96
-		if (isset($_FILES['termination_rate_import']['name']) && $_FILES['termination_rate_import']['name'] != "" &&  isset($_POST['trunk_id']) && $_POST['trunk_id'] != '') {
96
+		if (isset($_FILES['termination_rate_import']['name']) && $_FILES['termination_rate_import']['name'] != "" && isset($_POST['trunk_id']) && $_POST['trunk_id'] != '') {
97 97
 			list($txt, $ext) = explode(".", $_FILES['termination_rate_import']['name']);
98
-			if($ext == "csv" && $_FILES['termination_rate_import']['size'] > 0){ 
98
+			if ($ext == "csv" && $_FILES['termination_rate_import']['size'] > 0) { 
99 99
 				$error = $_FILES['termination_rate_import']['error'];
100
-				if ($error == 0 ) {
100
+				if ($error == 0) {
101 101
 					$uploadedFile = $_FILES["termination_rate_import"]["tmp_name"];
102
-					$csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header);
103
-			if(!empty($csv_data)){
102
+					$csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header);
103
+			if ( ! empty($csv_data)) {
104 104
 			$full_path = $this->config->item('rates-file-path');
105
-			$actual_file_name = "ASTPP-TERMINATION-RATES-".date("Y-m-d H:i:s"). "." . $ext;
106
-			if (move_uploaded_file($uploadedFile,$full_path.$actual_file_name)) {
105
+			$actual_file_name = "ASTPP-TERMINATION-RATES-".date("Y-m-d H:i:s").".".$ext;
106
+			if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) {
107 107
 			  $data['csv_tmp_data'] = $csv_data;
108 108
 			  $data['trunkid'] = $_POST['trunk_id'];
109
-			  $data['check_header']=$check_header;
109
+			  $data['check_header'] = $check_header;
110 110
 			  $data['page_title'] = 'Termination Rates Preview';
111
-			  $this->session->set_userdata('import_termination_rate_csv',$actual_file_name);
112
-			}else{
111
+			  $this->session->set_userdata('import_termination_rate_csv', $actual_file_name);
112
+			} else {
113 113
 			  $data['error'] = "File Uploading Fail Please Try Again";
114 114
 			}
115 115
 					}
116 116
 				}
117
-				else{
118
-					$data['error']=="File Uploading Fail Please Try Again";
117
+				else {
118
+					$data['error'] == "File Uploading Fail Please Try Again";
119 119
 				}
120
-			}else {
120
+			} else {
121 121
 				$data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
122 122
 			}
123
-		}else{
124
-		$invalid_flag=true;
123
+		} else {
124
+		$invalid_flag = true;
125 125
 		}
126 126
 		if ($invalid_flag) {
127 127
 			$str = '';
128
-			if (!isset($_POST['trunk_id']) || empty($_POST['trunk_id'])) {
129
-				$str.= '<br/>Please Create Trunk.';
128
+			if ( ! isset($_POST['trunk_id']) || empty($_POST['trunk_id'])) {
129
+				$str .= '<br/>Please Create Trunk.';
130 130
 			}
131 131
 			if (empty($_FILES['termination_rate_import']['name'])) {
132
-				$str.= '<br/>Please Select  File.';
132
+				$str .= '<br/>Please Select  File.';
133 133
 			}
134
-			$data['error']=$str;
134
+			$data['error'] = $str;
135 135
 		}
136 136
 		$this->load->view('view_import_termination_rate', $data);
137 137
 	}
138
-	function termination_rate_rates_import($trunkID,$check_header=false) {
138
+	function termination_rate_rates_import($trunkID, $check_header = false) {
139 139
 		$new_final_arr = array();
140 140
 		$invalid_array = array();
141 141
 		$new_final_arr_key = $this->config->item('Termination-rates-field');
@@ -145,65 +145,65 @@  discard block
 block discarded – undo
145 145
 		}
146 146
 	$full_path = $this->config->item('rates-file-path');
147 147
 		$terminationrate_file_name = $this->session->userdata('import_termination_rate_csv');	
148
-		$csv_tmp_data = $this->csvreader->parse_file($full_path.$terminationrate_file_name,$new_final_arr_key,$check_header); 
149
-	$i=0;
148
+		$csv_tmp_data = $this->csvreader->parse_file($full_path.$terminationrate_file_name, $new_final_arr_key, $check_header); 
149
+	$i = 0;
150 150
 		foreach ($csv_tmp_data as $key => $csv_data) {
151
-	 if(isset($csv_data['pattern']) && $csv_data['pattern']!= '' && $i != 0){
152
-		$str=null;
153
-		$csv_data['prepend']= isset($csv_data['prepend'])? $csv_data['prepend'] :'';
154
-		$csv_data['comment']= isset($csv_data['comment'])? $csv_data['comment'] :'';
155
-		$csv_data['connectcost']= isset($csv_data['connectcost']) ? $csv_data['connectcost'] :0;
156
-		$csv_data['includedseconds']= isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] :0;
157
-		$csv_data['cost']= !empty($csv_data['cost']) && is_numeric( $csv_data['cost']) ? $csv_data['cost'] :0;
158
-		$csv_data['inc']= isset($csv_data['inc']) ? $csv_data['inc'] :0;
159
-		$csv_data['precedence']= isset($csv_data['precedence']) ? $csv_data['precedence'] :'';
160
-		$csv_data['strip']= isset($csv_data['strip']) ? $csv_data['strip'] :'';
151
+	 if (isset($csv_data['pattern']) && $csv_data['pattern'] != '' && $i != 0) {
152
+		$str = null;
153
+		$csv_data['prepend'] = isset($csv_data['prepend']) ? $csv_data['prepend'] : '';
154
+		$csv_data['comment'] = isset($csv_data['comment']) ? $csv_data['comment'] : '';
155
+		$csv_data['connectcost'] = isset($csv_data['connectcost']) ? $csv_data['connectcost'] : 0;
156
+		$csv_data['includedseconds'] = isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] : 0;
157
+		$csv_data['cost'] = ! empty($csv_data['cost']) && is_numeric($csv_data['cost']) ? $csv_data['cost'] : 0;
158
+		$csv_data['inc'] = isset($csv_data['inc']) ? $csv_data['inc'] : 0;
159
+		$csv_data['precedence'] = isset($csv_data['precedence']) ? $csv_data['precedence'] : '';
160
+		$csv_data['strip'] = isset($csv_data['strip']) ? $csv_data['strip'] : '';
161 161
 		$csv_data['last_modified_date'] = date("Y-m-d H:i:s");
162
-		$str=$this->data_validate($csv_data);
163
-		if($str != ""){
164
-		  $invalid_array[$i]=$csv_data;
162
+		$str = $this->data_validate($csv_data);
163
+		if ($str != "") {
164
+		  $invalid_array[$i] = $csv_data;
165 165
 		  $invalid_array[$i]['error'] = $str;
166 166
 		}
167
-		else{
168
-		  $csv_data['trunk_id']=$trunkID;
169
-		  $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
170
-		  $new_final_arr[$i]=$csv_data;
167
+		else {
168
+		  $csv_data['trunk_id'] = $trunkID;
169
+		  $csv_data['pattern'] = "^".$csv_data['pattern'].".*";
170
+		  $new_final_arr[$i] = $csv_data;
171 171
 		}
172 172
 	  }
173 173
 		  $i++;
174 174
 		}
175
-		 if(!empty($new_final_arr)){
175
+		 if ( ! empty($new_final_arr)) {
176 176
  		$result = $this->rates_model->bulk_insert_termination_rate($new_final_arr);
177 177
 		 }
178 178
 		  unlink($full_path.$terminationrate_file_name);
179
-	  $count=count($invalid_array);
180
-		if($count >0){
179
+	  $count = count($invalid_array);
180
+		if ($count > 0) {
181 181
 			$session_id = "-1";
182 182
 			$fp = fopen($full_path.$session_id.'.csv', 'w');
183
-			foreach($new_final_arr_key as $key=>$value){
184
-		  $custom_array[0][$key]=ucfirst($key);
183
+			foreach ($new_final_arr_key as $key=>$value) {
184
+		  $custom_array[0][$key] = ucfirst($key);
185 185
 			}
186
-			$custom_array[0]['error']= "Error";
187
-			$invalid_array =array_merge($custom_array,$invalid_array);
188
-			foreach($invalid_array as $err_data){
189
-					fputcsv($fp,$err_data);
186
+			$custom_array[0]['error'] = "Error";
187
+			$invalid_array = array_merge($custom_array, $invalid_array);
188
+			foreach ($invalid_array as $err_data) {
189
+					fputcsv($fp, $err_data);
190 190
 			}
191 191
 		   fclose($fp);
192 192
 		   $this->session->set_userdata('import_termination_rate_csv_error', $session_id.".csv");
193 193
 		   $data["error"] = $invalid_array;
194 194
 		   $data['trunkid'] = $trunkID;
195 195
 		   $data['impoted_count'] = count($new_final_arr);
196
-		   $data['failure_count'] = count($invalid_array)-1;
196
+		   $data['failure_count'] = count($invalid_array) - 1;
197 197
 		   $data['page_title'] = 'Termination Rates Import Error';	
198
-		   $this->load->view('view_import_error',$data);
199
-		 } else{
198
+		   $this->load->view('view_import_error', $data);
199
+		 } else {
200 200
 	  $this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Termination rates imported successfully!');
201 201
 		   redirect(base_url()."rates/termination_rates_list/");
202 202
 		 }        
203 203
 	}
204
-	function termination_rate_error_download(){
204
+	function termination_rate_error_download() {
205 205
 		$this->load->helper('download');
206
-		$error_data =  $this->session->userdata('import_termination_rate_csv_error');
206
+		$error_data = $this->session->userdata('import_termination_rate_csv_error');
207 207
 		$full_path = $this->config->item('rates-file-path');
208 208
 		$data = file_get_contents($full_path.$error_data);
209 209
 		force_download("Termination_rate_error.csv", $data); 
@@ -211,182 +211,182 @@  discard block
 block discarded – undo
211 211
 	}  
212 212
 	function origination_rate_import() {
213 213
 		$data['page_title'] = 'Import Origination Rates';
214
-		$this->session->set_userdata('import_origination_rate_csv',"");
215
-		$error_data =  $this->session->userdata('import_origination_rate_csv_error');
214
+		$this->session->set_userdata('import_origination_rate_csv', "");
215
+		$error_data = $this->session->userdata('import_origination_rate_csv_error');
216 216
 		$full_path = $this->config->item('rates-file-path');
217
-		if(file_exists($full_path.$error_data) && $error_data != ""){
217
+		if (file_exists($full_path.$error_data) && $error_data != "") {
218 218
 			unlink($full_path.$error_data);
219
-			$this->session->set_userdata('import_origination_rate_csv_error',"");
219
+			$this->session->set_userdata('import_origination_rate_csv_error', "");
220 220
 		}
221 221
 		$this->load->view('view_import_origination_rate', $data);
222 222
 	}
223
-	function origination_rate_preview_file(){
224
-	$invalid_flag= false;
225
-	$data=array();
223
+	function origination_rate_preview_file() {
224
+	$invalid_flag = false;
225
+	$data = array();
226 226
 	$data['page_title'] = 'Import Origination Rates';
227
-	$check_header=$this->input->post('check_header',true);
228
-	if(empty($_FILES) || !isset($_FILES)){
227
+	$check_header = $this->input->post('check_header', true);
228
+	if (empty($_FILES) || ! isset($_FILES)) {
229 229
 	  redirect(base_url()."rates/origination_rate_list/");
230 230
 	}
231
-	$get_extension=strpos($_FILES['origination_rate_import']['name'],'.');
231
+	$get_extension = strpos($_FILES['origination_rate_import']['name'], '.');
232 232
 	$new_final_arr_key = $this->config->item('Origination-rates-field');
233
-	if(!$get_extension){
234
-		$data['error']= "Please Upload File Atleast";
233
+	if ( ! $get_extension) {
234
+		$data['error'] = "Please Upload File Atleast";
235 235
 		}
236 236
 		if (isset($_FILES['origination_rate_import']['name']) && $_FILES['origination_rate_import']['name'] != "" && isset($_POST['pricelist_id']) && $_POST['pricelist_id'] != '') {
237
-			list($txt,$ext) = explode(".", $_FILES['origination_rate_import']['name']);
237
+			list($txt, $ext) = explode(".", $_FILES['origination_rate_import']['name']);
238 238
             
239
-			if($ext == "csv" && $_FILES['origination_rate_import']['size'] > 0){ 
239
+			if ($ext == "csv" && $_FILES['origination_rate_import']['size'] > 0) { 
240 240
 				$error = $_FILES['origination_rate_import']['error'];
241 241
 				if ($error == 0) {
242 242
 					$uploadedFile = $_FILES["origination_rate_import"]["tmp_name"];
243
-					$csv_data=$this->csvreader->parse_file($uploadedFile,$new_final_arr_key,$check_header);
244
-					if(!empty($csv_data)){
243
+					$csv_data = $this->csvreader->parse_file($uploadedFile, $new_final_arr_key, $check_header);
244
+					if ( ! empty($csv_data)) {
245 245
 			$full_path = $this->config->item('rates-file-path');
246
-					$actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s"). "." . $ext;
247
-					if (move_uploaded_file($uploadedFile,$full_path.$actual_file_name)) {
248
-			$flag=false;
249
-			$data['trunkid']=isset($_POST['trunk_id']) && $_POST['trunk_id'] > 0 ? $_POST['trunk_id'] : 0;
246
+					$actual_file_name = "ASTPP-ORIGIN-RATES-".date("Y-m-d H:i:s").".".$ext;
247
+					if (move_uploaded_file($uploadedFile, $full_path.$actual_file_name)) {
248
+			$flag = false;
249
+			$data['trunkid'] = isset($_POST['trunk_id']) && $_POST['trunk_id'] > 0 ? $_POST['trunk_id'] : 0;
250 250
 						$data['csv_tmp_data'] = $csv_data;
251 251
 						$data['pricelistid'] = $_POST['pricelist_id'];
252 252
 						$data['page_title'] = "Origination Rates Preview";
253
-						$data['check_header']=$check_header;
254
-						$this->session->set_userdata('import_origination_rate_csv',$actual_file_name);
255
-					}else{
253
+						$data['check_header'] = $check_header;
254
+						$this->session->set_userdata('import_origination_rate_csv', $actual_file_name);
255
+					} else {
256 256
 						$data['error'] = "File Uploading Fail Please Try Again";
257 257
 					}
258 258
 				}
259 259
 			 }   
260
-			else{
261
-					$data['error']=="File Uploading Fail Please Try Again";
260
+			else {
261
+					$data['error'] == "File Uploading Fail Please Try Again";
262 262
 				}
263 263
 		   }
264 264
 		   else {
265 265
 				$data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
266 266
 			}
267
-			}else{
268
-		$invalid_flag=true;
267
+			} else {
268
+		$invalid_flag = true;
269 269
 			}
270 270
 		if ($invalid_flag) {
271 271
 			$str = '';
272
-			if (!isset($_POST['pricelist_id']) || empty($_POST['pricelist_id'])) {
273
-				$str.= '<br/>Please Create Rate Group.';
272
+			if ( ! isset($_POST['pricelist_id']) || empty($_POST['pricelist_id'])) {
273
+				$str .= '<br/>Please Create Rate Group.';
274 274
 			}
275 275
 			if (empty($_FILES['origination_rate_import']['name'])) {
276
-				$str.= '<br/>Please Select File.';
276
+				$str .= '<br/>Please Select File.';
277 277
 			}
278
-			$data['error']=$str;
278
+			$data['error'] = $str;
279 279
 		}
280 280
 		$this->load->view('view_import_origination_rate', $data);
281 281
 	}
282
-	function origination_rate_import_file($pricelistID,$trunkid,$check_header=false) {
282
+	function origination_rate_import_file($pricelistID, $trunkid, $check_header = false) {
283 283
 	   $new_final_arr = array();
284 284
 		$invalid_array = array();
285 285
 		$new_final_arr_key = $this->config->item('Origination-rates-field');
286 286
 	$screen_path = $this->config->item('screen_path');
287
-	$reseller_id=0;
287
+	$reseller_id = 0;
288 288
 		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
289 289
 			$reseller_id = $this->session->userdata["accountinfo"]['id'];
290 290
 		}
291 291
         
292 292
 		$full_path = $this->config->item('rates-file-path');
293 293
 		$originationrate_file_name = $this->session->userdata('import_origination_rate_csv');	
294
-		$csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name,$new_final_arr_key,$check_header); 
294
+		$csv_tmp_data = $this->csvreader->parse_file($full_path.$originationrate_file_name, $new_final_arr_key, $check_header); 
295 295
 		//echo "<pre>";print_r($csv_tmp_data);exit;
296
-	$i=0;
296
+	$i = 0;
297 297
 		foreach ($csv_tmp_data as $key => $csv_data) {	
298
-	  if(isset($csv_data['pattern']) && $csv_data['pattern']!= '' && $i != 0){
299
-		$str=null;
300
-		$csv_data['comment']= isset($csv_data['comment'])? $csv_data['comment'] :'';
301
-		$csv_data['connectcost']= isset($csv_data['connectcost']) ? $csv_data['connectcost'] :0;
302
-		$csv_data['includedseconds']= isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] :0;
303
-		$csv_data['cost']= !empty($csv_data['cost']) && is_numeric( $csv_data['cost']) ? $csv_data['cost'] :0;
304
-		$csv_data['inc']= isset($csv_data['inc']) ? $csv_data['inc'] :0;
305
-		$csv_data['precedence']= isset($csv_data['precedence']) ? $csv_data['precedence'] :'';
298
+	  if (isset($csv_data['pattern']) && $csv_data['pattern'] != '' && $i != 0) {
299
+		$str = null;
300
+		$csv_data['comment'] = isset($csv_data['comment']) ? $csv_data['comment'] : '';
301
+		$csv_data['connectcost'] = isset($csv_data['connectcost']) ? $csv_data['connectcost'] : 0;
302
+		$csv_data['includedseconds'] = isset($csv_data['includedseconds']) ? $csv_data['includedseconds'] : 0;
303
+		$csv_data['cost'] = ! empty($csv_data['cost']) && is_numeric($csv_data['cost']) ? $csv_data['cost'] : 0;
304
+		$csv_data['inc'] = isset($csv_data['inc']) ? $csv_data['inc'] : 0;
305
+		$csv_data['precedence'] = isset($csv_data['precedence']) ? $csv_data['precedence'] : '';
306 306
 		$csv_data['last_modified_date'] = date("Y-m-d H:i:s");
307
-		$str=$this->data_validate($csv_data);
308
-		if($str != ""){
309
-		  $invalid_array[$i]=$csv_data;
307
+		$str = $this->data_validate($csv_data);
308
+		if ($str != "") {
309
+		  $invalid_array[$i] = $csv_data;
310 310
 		  $invalid_array[$i]['error'] = $str;
311 311
 		}
312
-		else{
313
-		  $csv_data['pricelist_id']=$pricelistID;
314
-		  $csv_data['trunk_id']=$trunkid;
315
-		  $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
316
-		  $csv_data['reseller_id']= $reseller_id;
312
+		else {
313
+		  $csv_data['pricelist_id'] = $pricelistID;
314
+		  $csv_data['trunk_id'] = $trunkid;
315
+		  $csv_data['pattern'] = "^".$csv_data['pattern'].".*";
316
+		  $csv_data['reseller_id'] = $reseller_id;
317 317
 		  $csv_data['creation_date'] = gmdate('Y-m-d H:i:s');
318
-		  $new_final_arr[$i]=$csv_data;
318
+		  $new_final_arr[$i] = $csv_data;
319 319
 		}
320 320
 	  }
321 321
 		  $i++;
322 322
 		}
323
-		  if(!empty($new_final_arr)){
323
+		  if ( ! empty($new_final_arr)) {
324 324
   		$result = $this->rates_model->bulk_insert_origination_rate($new_final_arr);
325 325
 		  }
326 326
 		  unlink($full_path.$originationrate_file_name);
327
-	 $count=count($invalid_array);
328
-		if($count >0){
327
+	 $count = count($invalid_array);
328
+		if ($count > 0) {
329 329
 			$session_id = "-1";
330 330
 			$fp = fopen($full_path.$session_id.'.csv', 'w');
331
-			foreach($new_final_arr_key as $key=>$value){
332
-		  $custom_array[0][$key]=ucfirst($key);
331
+			foreach ($new_final_arr_key as $key=>$value) {
332
+		  $custom_array[0][$key] = ucfirst($key);
333 333
 			}
334
-			$custom_array[0]['error']= "Error";
335
-			$invalid_array =array_merge($custom_array,$invalid_array);
336
-			foreach($invalid_array as $err_data){
337
-					fputcsv($fp,$err_data);
334
+			$custom_array[0]['error'] = "Error";
335
+			$invalid_array = array_merge($custom_array, $invalid_array);
336
+			foreach ($invalid_array as $err_data) {
337
+					fputcsv($fp, $err_data);
338 338
 			}
339 339
 			fclose($fp);
340 340
 		   $this->session->set_userdata('import_origination_rate_csv_error', $session_id.".csv");
341 341
 		   $data["error"] = $invalid_array;
342 342
 		   $data['pricelistid'] = $pricelistID;
343 343
 		   $data['impoted_count'] = count($new_final_arr);
344
-		   $data['failure_count'] = count($invalid_array)-1;
344
+		   $data['failure_count'] = count($invalid_array) - 1;
345 345
 		   $data['page_title'] = 'Origination Rates Import Error';	
346
-		   $this->load->view('view_import_error',$data);
347
-		 } else{
346
+		   $this->load->view('view_import_error', $data);
347
+		 } else {
348 348
 	   $this->session->set_flashdata('astpp_errormsg', 'Total '.count($new_final_arr).' Origination rates imported successfully!');
349 349
 		   redirect(base_url()."rates/origination_rates_list/");
350 350
 		   }
351 351
 	}
352
-	 function data_validate($csvdata){
353
-		  $str=null;
352
+	 function data_validate($csvdata) {
353
+		  $str = null;
354 354
 	  $alpha_regex = "/^[a-z ,.'-]+$/i";
355 355
 	  $alpha_numeric_regex = "/^[a-z0-9 ,.'-]+$/i";
356 356
 	  $email_regex = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/"; 
357
-	  $str.= $csvdata['pattern']!= '' ? null : 'Code,';
358
-	  $str=rtrim($str,',');
359
-	  if(!$str){
360
-		  $str.= is_numeric($csvdata['pattern']) ? null : 'Code,';
357
+	  $str .= $csvdata['pattern'] != '' ? null : 'Code,';
358
+	  $str = rtrim($str, ',');
359
+	  if ( ! $str) {
360
+		  $str .= is_numeric($csvdata['pattern']) ? null : 'Code,';
361 361
 
362
-		  $str.= !empty($csvdata['connectcost']) && is_numeric( $csvdata['connectcost']) ? null :( empty($csvdata['connectcost']) ? null : 'Connect Cost,');
363
-		  $str.= !empty($csvdata['includedseconds']) && is_numeric( $csvdata['includedseconds']) ? null :( empty($csvdata['includedseconds']) ? null : 'Included Seconds,');
362
+		  $str .= ! empty($csvdata['connectcost']) && is_numeric($csvdata['connectcost']) ? null : (empty($csvdata['connectcost']) ? null : 'Connect Cost,');
363
+		  $str .= ! empty($csvdata['includedseconds']) && is_numeric($csvdata['includedseconds']) ? null : (empty($csvdata['includedseconds']) ? null : 'Included Seconds,');
364 364
 
365
-		  $str.= !empty($csvdata['inc']) && is_numeric( $csvdata['inc']) ? null :( empty($csvdata['inc']) ? null : 'Increment,');
366
-		  $str.= !empty($csvdata['precedence']) && is_numeric( $csvdata['precedence']) ? null :( empty($csvdata['precedence']) ? null : 'Precedence,');
367
-		  $str.= (isset($csvdata['strip']) && !empty($csvdata['strip'])) ? (is_numeric($csvdata['strip']) ? null :'Strip,') : null;
368
-		  if($str){
369
-		$str=rtrim($str,',');
370
-		$error_field=explode(',',$str);
365
+		  $str .= ! empty($csvdata['inc']) && is_numeric($csvdata['inc']) ? null : (empty($csvdata['inc']) ? null : 'Increment,');
366
+		  $str .= ! empty($csvdata['precedence']) && is_numeric($csvdata['precedence']) ? null : (empty($csvdata['precedence']) ? null : 'Precedence,');
367
+		  $str .= (isset($csvdata['strip']) && ! empty($csvdata['strip'])) ? (is_numeric($csvdata['strip']) ? null : 'Strip,') : null;
368
+		  if ($str) {
369
+		$str = rtrim($str, ',');
370
+		$error_field = explode(',', $str);
371 371
 		$count = count($error_field);
372
-		$str.= $count > 1 ? ' are not valid' : ' is not Valid';
372
+		$str .= $count > 1 ? ' are not valid' : ' is not Valid';
373 373
 		return $str;
374 374
 		  }
375
-		  else{
375
+		  else {
376 376
 		  return false;
377 377
 		  }
378 378
 	  }
379
-	  else{
380
-	  $str=rtrim($str,',');
381
-		$error_field=explode(',',$str);
379
+	  else {
380
+	  $str = rtrim($str, ',');
381
+		$error_field = explode(',', $str);
382 382
 		$count = count($error_field);
383
-		$str.= $count > 1 ? ' are required' : ' is Required';
383
+		$str .= $count > 1 ? ' are required' : ' is Required';
384 384
 	return $str;
385 385
 	}
386 386
 	}
387
-	function origination_rate_error_download(){
387
+	function origination_rate_error_download() {
388 388
 		$this->load->helper('download');
389
-		$error_data =  $this->session->userdata('import_origination_rate_csv_error');
389
+		$error_data = $this->session->userdata('import_origination_rate_csv_error');
390 390
 		$full_path = $this->config->item('rates-file-path');
391 391
 		$data = file_get_contents($full_path.$error_data);
392 392
 		force_download("Origination_rate_error.csv", $data); 
@@ -416,13 +416,13 @@  discard block
 block discarded – undo
416 416
 				$edit_data = $value;
417 417
 			}
418 418
 			$edit_data['connectcost'] = $this->common_model->to_calculate_currency($edit_data['connectcost'], '', '', true, false);
419
-			$edit_data['cost'] = $this->common_model->to_calculate_currency($edit_data['cost'], '', '',true, false);
419
+			$edit_data['cost'] = $this->common_model->to_calculate_currency($edit_data['cost'], '', '', true, false);
420 420
 			$edit_data['pattern'] = filter_var($edit_data['pattern'], FILTER_SANITIZE_NUMBER_INT);
421 421
 
422 422
 			$data['form'] = $this->form->build_form($this->rates_form->get_origination_rate_form_fields(), $edit_data);
423 423
 			$this->load->view('view_origination_rate_add_edit', $data);
424 424
 		} else {
425
-			redirect(base_url() . 'rates/origination_rate_list/');
425
+			redirect(base_url().'rates/origination_rate_list/');
426 426
 		}
427 427
 	}
428 428
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 			$this->session->set_userdata('origination_rate_list_search', $action);
471 471
 		}
472 472
 		if (@$ajax_search != 1) {
473
-			redirect(base_url() . 'rates/origination_rates_list/');
473
+			redirect(base_url().'rates/origination_rates_list/');
474 474
 		}
475 475
 	}
476 476
 
@@ -482,13 +482,13 @@  discard block
 block discarded – undo
482 482
 	function termination_rate_delete($id) {
483 483
 		$this->rates_model->remove_termination_rate($id);
484 484
 		$this->session->set_flashdata('astpp_notification', 'Termination removed successfully!');
485
-		redirect(base_url() . '/rates/termination_rates_list/');
485
+		redirect(base_url().'/rates/termination_rates_list/');
486 486
 	}
487 487
 
488 488
 	function origination_rate_delete($id) {
489 489
 		$this->rates_model->remove_origination_rate($id);
490 490
 		$this->session->set_flashdata('astpp_notification', 'Origination rate removed successfully!');
491
-		redirect(base_url() . 'rates/origination_rates_list/');
491
+		redirect(base_url().'rates/origination_rates_list/');
492 492
 	}
493 493
 
494 494
 	function origination_rates_list() {
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
 		echo json_encode($json_data);
528 528
 	}
529 529
 
530
-	  function origination_rates_list_delete($flag='') {
530
+	  function origination_rates_list_delete($flag = '') {
531 531
 		$json_data = array();
532
-		$this->session->set_userdata('advance_batch_data_delete',1);
532
+		$this->session->set_userdata('advance_batch_data_delete', 1);
533 533
 		$count_all = $this->rates_model->get_origination_rate_list(false);
534 534
 		echo $count_all; 
535 535
 	} 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 			$this->session->set_userdata('termination_rates_list_search', $action);
604 604
 		}
605 605
 		if (@$ajax_search != 1) {
606
-			redirect(base_url() . 'rates/termination_rates_list/');
606
+			redirect(base_url().'rates/termination_rates_list/');
607 607
 		}
608 608
 	}
609 609
 
@@ -612,20 +612,20 @@  discard block
 block discarded – undo
612 612
 		$this->session->set_userdata('account_search', "");
613 613
 	}
614 614
 
615
-	function customer_block_pattern_list($accountid,$accounttype) {
615
+	function customer_block_pattern_list($accountid, $accounttype) {
616 616
 		$json_data = array();
617 617
 		$where = array('accountid' => $accountid);
618
-		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_pattern'); 
619
-		$like_str=!empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" :null;
620
-		if(!empty($like_str))
618
+		$instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_pattern'); 
619
+		$like_str = ! empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" : null;
620
+		if ( ! empty($like_str))
621 621
 		$this->db->where($like_str);
622 622
 		$count_all = $this->db_model->countQuery("*", "block_patterns", $where);
623 623
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
624 624
 		$json_data = $paging_data["json_paging"];
625
-		if(!empty($like_str))
625
+		if ( ! empty($like_str))
626 626
 		$this->db->where($like_str);
627 627
 		$pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
628
-		$grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid,$accounttype));
628
+		$grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid, $accounttype));
629 629
 		$json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields);
630 630
 		echo json_encode($json_data);
631 631
 	}
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 		$json_data = array();
649 649
 		$account_data = $this->session->userdata("accountinfo");
650 650
 		$markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"]));
651
-		$markup = ($markup > 0)?$markup:1;
651
+		$markup = ($markup > 0) ? $markup : 1;
652 652
 
653 653
 		$count_all = $this->rates_model->get_origination_rate_list_for_user(false);
654 654
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
@@ -658,11 +658,11 @@  discard block
 block discarded – undo
658 658
 		$grid_fields = json_decode($this->rates_form->build_origination_rate_list_for_user());
659 659
 		foreach ($query->result_array() as $key => $value) {
660 660
 			$json_data['rows'][] = array('cell' => array(
661
-					$this->common->get_only_numeric_val("","",$value["pattern"]),
661
+					$this->common->get_only_numeric_val("", "", $value["pattern"]),
662 662
 					$value['comment'],
663 663
 					$value['inc'],
664
-					$this->common_model->calculate_currency(($value['cost'] + ($value['cost']*$markup)/100),'','','',true),
665
-					$this->common_model->calculate_currency($value['connectcost'],'','','',true),
664
+					$this->common_model->calculate_currency(($value['cost'] + ($value['cost'] * $markup) / 100), '', '', '', true),
665
+					$this->common_model->calculate_currency($value['connectcost'], '', '', '', true),
666 666
 					$value['includedseconds']                    
667 667
 			));
668 668
 		}
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 			$this->session->set_userdata('origination_rate_list_search', $action);
682 682
 		}
683 683
 		if (@$ajax_search != 1) {
684
-			redirect(base_url() . 'user/user_rates_list/');
684
+			redirect(base_url().'user/user_rates_list/');
685 685
 		}
686 686
 	}
687 687
 
@@ -689,10 +689,10 @@  discard block
 block discarded – undo
689 689
 		$this->session->set_userdata('advance_search', 0);
690 690
 		$this->session->set_userdata('account_search', "");
691 691
 	}
692
-	function customer_rates_download_sample_file($file_name){
692
+	function customer_rates_download_sample_file($file_name) {
693 693
 		$this->load->helper('download');
694 694
 		$full_path = base_url()."assets/Rates_File/".$file_name.".csv";
695
-		$arrContextOptions=array(
695
+		$arrContextOptions = array(
696 696
 			"ssl"=>array(
697 697
 			"verify_peer"=>false,
698 698
 			"verify_peer_name"=>false,
@@ -701,19 +701,19 @@  discard block
 block discarded – undo
701 701
 		$file = file_get_contents($full_path, false, stream_context_create($arrContextOptions));
702 702
 		force_download("samplefile.csv", $file); 
703 703
 	}
704
-	function termination_rate_batch_update(){
704
+	function termination_rate_batch_update() {
705 705
 		$batch_update_arr = $this->input->post();
706
-	$batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"])?$this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false):"0.0000";
707
-	$batch_update_arr["connectcost"]["connectcost"] = isset($batch_update_arr["connectcost"]["connectcost"])?$this->common_model->add_calculate_currency($batch_update_arr["connectcost"]["connectcost"], '', '', true, false):"0.0000";
706
+	$batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"]) ? $this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false) : "0.0000";
707
+	$batch_update_arr["connectcost"]["connectcost"] = isset($batch_update_arr["connectcost"]["connectcost"]) ? $this->common_model->add_calculate_currency($batch_update_arr["connectcost"]["connectcost"], '', '', true, false) : "0.0000";
708 708
 //        $batch_update_arr = array("inc"=> array("inc"=>"1","operator"=>"3"),"cost"=> array("cost"=>"1","operator"=>"4"));
709 709
 		$result = $this->rates_model->termination_rate_batch_update($batch_update_arr);
710 710
 		echo json_encode(array("SUCCESS"=> "Termination rates batch updated successfully!"));
711 711
 		exit;
712 712
 	}
713 713
     
714
-	function origination_rate_batch_update(){
714
+	function origination_rate_batch_update() {
715 715
 		$batch_update_arr = $this->input->post();
716
-		 $batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"])?$this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false):"0.0000";
716
+		 $batch_update_arr["cost"]["cost"] = isset($batch_update_arr["cost"]["cost"]) ? $this->common_model->add_calculate_currency($batch_update_arr["cost"]["cost"], '', '', true, false) : "0.0000";
717 717
 //        $batch_update_arr = array("inc"=> array("inc"=>"1","operator"=>"3"),"cost"=> array("cost"=>"1","operator"=>"4"));
718 718
 		$result = $this->rates_model->origination_rate_batch_update($batch_update_arr);
719 719
 		echo json_encode(array("SUCCESS"=> "Origination rates batch updated successfully!"));
@@ -722,23 +722,23 @@  discard block
 block discarded – undo
722 722
 
723 723
 	function termination_rate_export_cdr_xls() {
724 724
 		$account_info = $accountinfo = $this->session->userdata('accountinfo');
725
-		$currency_id=$account_info['currency_id'];
726
-		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
725
+		$currency_id = $account_info['currency_id'];
726
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
727 727
 		$query = $this->rates_model->get_termination_rate(true, '', '', false);
728 728
 		$outbound_array = array();
729 729
 		ob_clean();
730
-		$outbound_array[] = array("Code", "Destination",  "Connect Cost($currency)", "Included Seconds","Per Minute Cost($currency)","Initial Increment", "Increment","Priority","Strip","Prepend","Trunk","Status","Created Date");
730
+		$outbound_array[] = array("Code", "Destination", "Connect Cost($currency)", "Included Seconds", "Per Minute Cost($currency)", "Initial Increment", "Increment", "Priority", "Strip", "Prepend", "Trunk", "Status", "Created Date");
731 731
 		if ($query->num_rows() > 0) {
732 732
 
733 733
 			foreach ($query->result_array() as $row) {
734 734
 				//echo"<pre>";print_r($row);exit;
735 735
 					$outbound_array[] = array(
736
-						$row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
736
+						$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
737 737
 						$row['comment'],
738
-						$this->common_model->calculate_currency($row['connectcost'],'','',TRUE,false),
738
+						$this->common_model->calculate_currency($row['connectcost'], '', '', TRUE, false),
739 739
                         
740 740
 						$row['includedseconds'],
741
-			$this->common_model->calculate_currency($row['cost'],'','',TRUE,false),
741
+			$this->common_model->calculate_currency($row['cost'], '', '', TRUE, false),
742 742
 /**
743 743
 ASTPP  3.0 
744 744
 For Add Initial Increment field
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 						$row['strip'],
751 751
 						$row['prepend'],
752 752
 						//$row['trunk_id'],
753
-						$this->common->get_field_name('name','trunks',$row["trunk_id"]),
753
+						$this->common->get_field_name('name', 'trunks', $row["trunk_id"]),
754 754
 						$this->common->get_status('export', '', $row['status']),
755 755
 						$row['creation_date'],
756 756
                         
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 			}
760 760
 		$this->load->helper('csv');
761 761
         
762
-		array_to_csv($outbound_array, 'Termination_Rates_' . date("Y-m-d") . '.csv');
762
+		array_to_csv($outbound_array, 'Termination_Rates_'.date("Y-m-d").'.csv');
763 763
        
764 764
 	}
765 765
 
@@ -770,13 +770,13 @@  discard block
 block discarded – undo
770 770
 		$this->load->library('pdf');
771 771
 		$this->fpdf = new PDF('P', 'pt');
772 772
 		$this->fpdf->initialize('P', 'mm', 'A4');
773
-		$this->fpdf->tablewidths = array(20, 30, 20, 20, 20, 20, 20,20,20);
774
-		$outbound_array[] = array("Code", "Destination",  "Connect Cost","Included Seconds","Per Minute Cost","Initial Increment", "Increment","Precedence","Prepend","Strip");
773
+		$this->fpdf->tablewidths = array(20, 30, 20, 20, 20, 20, 20, 20, 20);
774
+		$outbound_array[] = array("Code", "Destination", "Connect Cost", "Included Seconds", "Per Minute Cost", "Initial Increment", "Increment", "Precedence", "Prepend", "Strip");
775 775
 		if ($query->num_rows() > 0) {
776 776
 
777 777
 			foreach ($query->result_array() as $row) {
778 778
 					$outbound_array[] = array(
779
-			$row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
779
+			$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
780 780
 						$row['comment'],
781 781
 						$row['connectcost'],
782 782
 						$row['includedseconds'],
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 
800 800
 		$this->fpdf->SetFont('Arial', '', 15);
801 801
 		$this->fpdf->SetXY(60, 5);
802
-		$this->fpdf->Cell(100, 10, "Outbound Rates Report " . date('Y-m-d'));
802
+		$this->fpdf->Cell(100, 10, "Outbound Rates Report ".date('Y-m-d'));
803 803
 
804 804
 		$this->fpdf->SetY(20);
805 805
 		$this->fpdf->SetFont('Arial', '', 7);
@@ -807,29 +807,29 @@  discard block
 block discarded – undo
807 807
 		$this->fpdf->lMargin = 2;
808 808
 
809 809
 		$dimensions = $this->fpdf->export_pdf($outbound_array, "7");
810
-		$this->fpdf->Output('Termination_Rate_' . date("Y-m-d") . '.pdf', "D");
810
+		$this->fpdf->Output('Termination_Rate_'.date("Y-m-d").'.pdf', "D");
811 811
 	}
812 812
     
813 813
 
814 814
 	function origination_rate_export_cdr_xls() {
815 815
 		$account_info = $accountinfo = $this->session->userdata('accountinfo');
816
-		$currency_id=$account_info['currency_id'];
817
-		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
816
+		$currency_id = $account_info['currency_id'];
817
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
818 818
 		$query = $this->rates_model->get_origination_rate(true, '', '', false);
819 819
 	//echo "<pre>";print_r($query);exit;
820 820
 		$inbound_array = array();
821 821
 		ob_clean();
822
-		$inbound_array[] = array("Code", "Destination","Connect Cost($currency)","Included Seconds","Per Minute Cost($currency)", "Initial Increment", "Increment","Rate Group","Status","Created Date");
822
+		$inbound_array[] = array("Code", "Destination", "Connect Cost($currency)", "Included Seconds", "Per Minute Cost($currency)", "Initial Increment", "Increment", "Rate Group", "Status", "Created Date");
823 823
 		if ($query->num_rows() > 0) {
824 824
 
825 825
 			foreach ($query->result_array() as $row) {
826 826
 				//echo"<pre>";print_r($row);exit;
827 827
 					$inbound_array[] = array(
828
-						$row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
828
+						$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
829 829
 						$row['comment'],
830
-						$this->common_model->calculate_currency($row['connectcost'],'','',TRUE,false),
830
+						$this->common_model->calculate_currency($row['connectcost'], '', '', TRUE, false),
831 831
 						$row['includedseconds'],
832
-						$this->common_model->calculate_currency($row['cost'],'','',TRUE,false),
832
+						$this->common_model->calculate_currency($row['cost'], '', '', TRUE, false),
833 833
 /**
834 834
 ASTPP  3.0 
835 835
 For Add Initial Increment field
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 				}
846 846
 			}
847 847
 		$this->load->helper('csv');
848
-		array_to_csv($inbound_array, 'Origination_Rates_' . date("Y-m-d") . '.csv');
848
+		array_to_csv($inbound_array, 'Origination_Rates_'.date("Y-m-d").'.csv');
849 849
 	}
850 850
 	function origination_rate_export_cdr_pdf() {
851 851
 		$query = $this->rates_model->get_origination_rate(true, '', '', false);
@@ -856,15 +856,15 @@  discard block
 block discarded – undo
856 856
 		$this->fpdf = new PDF('P', 'pt');
857 857
 		$this->fpdf->initialize('P', 'mm', 'A4');
858 858
 		$this->fpdf->tablewidths = array(20, 20, 20, 20, 20, 20);
859
-	$inbound_array[] = array("Code", "Destination","Connect Cost","Included Seconds","Per Minute Cost","Initial Increment","Increment");
859
+	$inbound_array[] = array("Code", "Destination", "Connect Cost", "Included Seconds", "Per Minute Cost", "Initial Increment", "Increment");
860 860
 		if ($query->num_rows() > 0) {
861 861
 			foreach ($query->result_array() as $row) {
862 862
 					$inbound_array[] = array(
863
-					   $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
863
+					   $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
864 864
 						$row['comment'],
865 865
 						$row['connectcost'],
866 866
 						$row['includedseconds'],
867
-						$this->common_model->calculate_currency($row['cost'],'','','',false),
867
+						$this->common_model->calculate_currency($row['cost'], '', '', '', false),
868 868
 /**
869 869
 ASTPP  3.0 
870 870
 For Add Initial Increment field
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 
881 881
 		$this->fpdf->SetFont('Arial', '', 15);
882 882
 		$this->fpdf->SetXY(60, 5);
883
-		$this->fpdf->Cell(100, 10, "Origination Rates Report " . date('Y-m-d'));
883
+		$this->fpdf->Cell(100, 10, "Origination Rates Report ".date('Y-m-d'));
884 884
 
885 885
 		$this->fpdf->SetY(20);
886 886
 		$this->fpdf->SetFont('Arial', '', 7);
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 		$this->fpdf->lMargin = 2;
889 889
 
890 890
 		$dimensions = $this->fpdf->export_pdf($inbound_array, "5");
891
-		$this->fpdf->Output('Origination_Rate_' . date("Y-m-d") . '.pdf', "D");
891
+		$this->fpdf->Output('Origination_Rate_'.date("Y-m-d").'.pdf', "D");
892 892
 	}
893 893
 
894 894
   
@@ -900,14 +900,14 @@  discard block
 block discarded – undo
900 900
 		$this->fpdf = new PDF('P', 'pt');
901 901
 		$this->fpdf->initialize('P', 'mm', 'A4');
902 902
 	$this->fpdf->tablewidths = array(20, 20, 20, 20, 20, 20);
903
-		$inbound_array[] = array("Code", "Destination", "Increment","Cost Per Minutes",  "Connect Charge", "Included Seconds");
903
+		$inbound_array[] = array("Code", "Destination", "Increment", "Cost Per Minutes", "Connect Charge", "Included Seconds");
904 904
 		if ($query->num_rows() > 0) {
905 905
 			foreach ($query->result_array() as $row) {
906 906
 					$inbound_array[] = array(
907
-					   $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
907
+					   $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
908 908
 						$row['comment'],
909 909
 						$row['inc'],
910
-			$this->common_model->calculate_currency($row['cost'],'','','',false),
910
+			$this->common_model->calculate_currency($row['cost'], '', '', '', false),
911 911
 						$row['connectcost'],
912 912
 						$row['includedseconds']
913 913
 					);
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 
920 920
 		$this->fpdf->SetFont('Arial', '', 15);
921 921
 		$this->fpdf->SetXY(60, 5);
922
-		$this->fpdf->Cell(100, 10, "Rates Report " . date('Y-m-d'));
922
+		$this->fpdf->Cell(100, 10, "Rates Report ".date('Y-m-d'));
923 923
 
924 924
 		$this->fpdf->SetY(20);
925 925
 		$this->fpdf->SetFont('Arial', '', 7);
@@ -927,12 +927,12 @@  discard block
 block discarded – undo
927 927
 		$this->fpdf->lMargin = 2;
928 928
 
929 929
 		$dimensions = $this->fpdf->export_pdf($inbound_array, "5");
930
-		$this->fpdf->Output('Rates_' . date("Y-m-d") . '.pdf', "D");
930
+		$this->fpdf->Output('Rates_'.date("Y-m-d").'.pdf', "D");
931 931
 	}
932
-	function resellersrates_list(){
933
-	$accountinfo=$this->session->userdata('accountinfo');
932
+	function resellersrates_list() {
933
+	$accountinfo = $this->session->userdata('accountinfo');
934 934
 	$data['username'] = $this->session->userdata('user_name');
935
-		$data['page_title'] = 'My Rates' ;
935
+		$data['page_title'] = 'My Rates';
936 936
 		$data['search_flag'] = true;
937 937
 		$this->session->set_userdata('advance_search', 0);
938 938
 		$data['grid_fields'] = $this->rates_form->build_rates_list_for_reseller();
@@ -952,11 +952,11 @@  discard block
 block discarded – undo
952 952
 		$grid_fields = json_decode($this->rates_form->build_rates_list_for_reseller());
953 953
 		foreach ($query->result_array() as $key => $value) {
954 954
 			$json_data['rows'][] = array('cell' => array(
955
-					$this->common->get_only_numeric_val("","",$value["pattern"]),
955
+					$this->common->get_only_numeric_val("", "", $value["pattern"]),
956 956
 					$value['comment'],
957
-					$this->common_model->calculate_currency($value['connectcost'],'','','true',true),
957
+					$this->common_model->calculate_currency($value['connectcost'], '', '', 'true', true),
958 958
 					$value['includedseconds'],
959
-					$this->common_model->calculate_currency(($value['cost'] + ($value['cost']*$markup)/100),'','','true',true),
959
+					$this->common_model->calculate_currency(($value['cost'] + ($value['cost'] * $markup) / 100), '', '', 'true', true),
960 960
 					$value['inc'],
961 961
 					$value['precedence'],
962 962
 			));
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 			$this->session->set_userdata('resellerrates_list_search', $action);
977 977
 		}
978 978
 		if (@$ajax_search != 1) {
979
-			redirect(base_url() . 'rates/resellersrates_list/');
979
+			redirect(base_url().'rates/resellersrates_list/');
980 980
 		}
981 981
 	}
982 982
 	function resellersrates_list_clearsearchfilter() {
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 			foreach ($query->result_array() as $row) {
1001 1001
                 
1002 1002
 					$customer_array[] = array(
1003
-						$row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]),
1003
+						$row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]),
1004 1004
 						$row['comment'],
1005 1005
 						$row['connectcost'],
1006 1006
 			$row['includedseconds'],
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
 			}
1013 1013
 		}
1014 1014
 		$this->load->helper('csv');
1015
-		array_to_csv($customer_array, 'My_Own_Rate_' . date("Y-m-d") . '.csv');
1015
+		array_to_csv($customer_array, 'My_Own_Rate_'.date("Y-m-d").'.csv');
1016 1016
 		exit;
1017 1017
 	}
1018 1018
 /***********
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 			$this->session->set_userdata('termination_rates_list_search', $action);
1030 1030
 		}
1031 1031
 		if (@$ajax_search != 1) {
1032
-			redirect(base_url() . 'rates/termination_rates_list/');
1032
+			redirect(base_url().'rates/termination_rates_list/');
1033 1033
 		}
1034 1034
 	}
1035 1035
 	function origination_rates_list_batch_delete() {
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 			$this->session->set_userdata('origination_rate_list_search', $action);
1043 1043
 		}
1044 1044
 		if (@$ajax_search != 1) {
1045
-			redirect(base_url() . 'rates/origination_rates_list/');
1045
+			redirect(base_url().'rates/origination_rates_list/');
1046 1046
 		}
1047 1047
 	}
1048 1048
 /*************************/
Please login to merge, or discard this patch.
Braces   +21 added lines, -25 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
 		$this->load->library('csvreader');
35 35
 	ini_set("memory_limit","2048M");
36 36
 	ini_set("max_execution_time","259200");
37
-		if ($this->session->userdata('user_login') == FALSE)
38
-			redirect(base_url() . '/astpp/login');
37
+		if ($this->session->userdata('user_login') == FALSE) {
38
+					redirect(base_url() . '/astpp/login');
39
+		}
39 40
 	}
40 41
 
41 42
 	function termination_rates_list() {
@@ -109,18 +110,17 @@  discard block
 block discarded – undo
109 110
 			  $data['check_header']=$check_header;
110 111
 			  $data['page_title'] = 'Termination Rates Preview';
111 112
 			  $this->session->set_userdata('import_termination_rate_csv',$actual_file_name);
112
-			}else{
113
+			} else{
113 114
 			  $data['error'] = "File Uploading Fail Please Try Again";
114 115
 			}
115 116
 					}
116
-				}
117
-				else{
117
+				} else{
118 118
 					$data['error']=="File Uploading Fail Please Try Again";
119 119
 				}
120
-			}else {
120
+			} else {
121 121
 				$data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
122 122
 			}
123
-		}else{
123
+		} else{
124 124
 		$invalid_flag=true;
125 125
 		}
126 126
 		if ($invalid_flag) {
@@ -163,8 +163,7 @@  discard block
 block discarded – undo
163 163
 		if($str != ""){
164 164
 		  $invalid_array[$i]=$csv_data;
165 165
 		  $invalid_array[$i]['error'] = $str;
166
-		}
167
-		else{
166
+		} else{
168 167
 		  $csv_data['trunk_id']=$trunkID;
169 168
 		  $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
170 169
 		  $new_final_arr[$i]=$csv_data;
@@ -252,19 +251,17 @@  discard block
 block discarded – undo
252 251
 						$data['page_title'] = "Origination Rates Preview";
253 252
 						$data['check_header']=$check_header;
254 253
 						$this->session->set_userdata('import_origination_rate_csv',$actual_file_name);
255
-					}else{
254
+					} else{
256 255
 						$data['error'] = "File Uploading Fail Please Try Again";
257 256
 					}
258 257
 				}
259
-			 }   
260
-			else{
258
+			 } else{
261 259
 					$data['error']=="File Uploading Fail Please Try Again";
262 260
 				}
263
-		   }
264
-		   else {
261
+		   } else {
265 262
 				$data['error'] = "Invalid file format : Only CSV file allows to import records(Can't import empty file)";
266 263
 			}
267
-			}else{
264
+			} else{
268 265
 		$invalid_flag=true;
269 266
 			}
270 267
 		if ($invalid_flag) {
@@ -308,8 +305,7 @@  discard block
 block discarded – undo
308 305
 		if($str != ""){
309 306
 		  $invalid_array[$i]=$csv_data;
310 307
 		  $invalid_array[$i]['error'] = $str;
311
-		}
312
-		else{
308
+		} else{
313 309
 		  $csv_data['pricelist_id']=$pricelistID;
314 310
 		  $csv_data['trunk_id']=$trunkid;
315 311
 		  $csv_data['pattern'] = "^" . $csv_data['pattern'] . ".*";
@@ -371,12 +367,10 @@  discard block
 block discarded – undo
371 367
 		$count = count($error_field);
372 368
 		$str.= $count > 1 ? ' are not valid' : ' is not Valid';
373 369
 		return $str;
374
-		  }
375
-		  else{
370
+		  } else{
376 371
 		  return false;
377 372
 		  }
378
-	  }
379
-	  else{
373
+	  } else{
380 374
 	  $str=rtrim($str,',');
381 375
 		$error_field=explode(',',$str);
382 376
 		$count = count($error_field);
@@ -617,13 +611,15 @@  discard block
 block discarded – undo
617 611
 		$where = array('accountid' => $accountid);
618 612
 		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_pattern'); 
619 613
 		$like_str=!empty($instant_search) ? "(blocked_patterns like '%$instant_search%'  OR  destination like '%$instant_search%' )" :null;
620
-		if(!empty($like_str))
621
-		$this->db->where($like_str);
614
+		if(!empty($like_str)) {
615
+				$this->db->where($like_str);
616
+		}
622 617
 		$count_all = $this->db_model->countQuery("*", "block_patterns", $where);
623 618
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
624 619
 		$json_data = $paging_data["json_paging"];
625
-		if(!empty($like_str))
626
-		$this->db->where($like_str);
620
+		if(!empty($like_str)) {
621
+				$this->db->where($like_str);
622
+		}
627 623
 		$pattern_data = $this->db_model->getSelect("*", "block_patterns", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]);
628 624
 		$grid_fields = json_decode($this->rates_form->build_pattern_list_for_customer($accountid,$accounttype));
629 625
 		$json_data['rows'] = $this->form->build_grid($pattern_data, $grid_fields);
Please login to merge, or discard this patch.