Completed
Pull Request — v3.0 (#136)
by
unknown
25:07
created
astpp/application/modules/accounts/views/view_customer_invoices.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 <? startblock('extra_head') ?>
4 4
 <script type="text/javascript" language="javascript">
5 5
     $(document).ready(function() {
6
-        build_grid("invoices_list","<?php echo base_url() . "accounts/customer_details_json/invoices/$edit_id/"; ?>",<? echo $grid_fields; ?>,"");
6
+        build_grid("invoices_list","<?php echo base_url()."accounts/customer_details_json/invoices/$edit_id/"; ?>",<? echo $grid_fields; ?>,"");
7 7
         $("#left_panel_quick_search").keyup(function(){
8 8
             quick_search("accounts/customer_details_search/"+'<?php echo $accounttype?>'+"_invoices/");
9 9
         });
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
             <div class="col-md-12 no-padding color-three border_box"> 
23 23
                 <div class="pull-left">
24 24
                     <ul class="breadcrumb">
25
-                        <li><a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_list/"; ?>"><?= ucfirst($accounttype); ?>s</a></li>
25
+                        <li><a href="<?= base_url()."accounts/".strtolower($accounttype)."_list/"; ?>"><?= ucfirst($accounttype); ?>s</a></li>
26 26
                         <li>
27
-                            <a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_edit/" . $edit_id . "/"; ?>"> Profile </a>
27
+                            <a href="<?= base_url()."accounts/".strtolower($accounttype)."_edit/".$edit_id."/"; ?>"> Profile </a>
28 28
                         </li>
29 29
                         <li class="active">
30
-                            <a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_invoices/" . $edit_id . "/"; ?>">
30
+                            <a href="<?= base_url()."accounts/".strtolower($accounttype)."_invoices/".$edit_id."/"; ?>">
31 31
                                 Invoices
32 32
                             </a>
33 33
                         </li>
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
                 <div class="pull-right">
37 37
                     <ul class="breadcrumb">
38 38
 		      <li class="active pull-right">
39
-		      <a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_edit/" . $edit_id . "/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
39
+		      <a href="<?= base_url()."accounts/".strtolower($accounttype)."_edit/".$edit_id."/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
40 40
                     </ul>
41 41
                 </div>
42 42
             </div>     
Please login to merge, or discard this patch.
astpp/application/modules/accounts/views/view_customer_speed_dial.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
                                 <div class="col-md-4">Action</div>
92 92
                                  </div>
93 93
                                 <?php
94
-                                $res = $this->db_model->getSelect("*", "speed_dial", array("accountid" => $account_data[0]['id']));
95
-                                if ($res->num_rows() > 0) {
96
-                                    $result = $res->result_array();
97
-                                } else {
98
-                                    $result = 0;
99
-                                }
100
-                                for ($i = 0; $i <= 9; $i++) {
101
-                                    ?>
94
+								$res = $this->db_model->getSelect("*", "speed_dial", array("accountid" => $account_data[0]['id']));
95
+								if ($res->num_rows() > 0) {
96
+									$result = $res->result_array();
97
+								} else {
98
+									$result = 0;
99
+								}
100
+								for ($i = 0; $i <= 9; $i++) {
101
+									?>
102 102
                                     <div class="col-md-12">
103 103
                                         <div id="key<?php echo $i; ?><?php echo $i + 1; ?>" style="display:block;">
104 104
                                             <div class="col-md-1">
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
                                             <div class="col-md-3">
110 110
                                                 <label class="col-md-2" name="speed_dial" size="16"> 
111 111
                                                     <?php if ($result[$i]['speed_num'] == $i) {
112
-                                                        echo $result[$i]['number'];
113
-                                                    } ?> 
112
+														echo $result[$i]['number'];
113
+													} ?> 
114 114
                                                 </label>
115 115
                                             </div>
116 116
                                             <div class="col-md-4 margin-b-10">
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
                                             </div>
133 133
                                                <div class="col-md-3">
134 134
                                             <input class="col-md-2 form-control" name="speed_dial_<?php echo $i; ?>" id="speed_dial_<?php echo $i; ?>" size="16" type="text"  value="<?php if (isset($speeddial[$i]) && !empty($speeddial[$i])) {
135
-        echo $speeddial[$i];
136
-    } ?>">
135
+		echo $speeddial[$i];
136
+	} ?>">
137 137
                                                </div>
138 138
                                             <div class="col-md-4">
139 139
                                           <div class="col-md-2 no-padding">
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
             <div class="col-md-12 no-padding color-three border_box"> 
63 63
                 <div class="pull-left">
64 64
                     <ul class="breadcrumb">
65
-                        <li><a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_list/";?>"><?= ucfirst($accounttype); ?>s </a></li>
65
+                        <li><a href="<?= base_url()."accounts/".strtolower($accounttype)."_list/"; ?>"><?= ucfirst($accounttype); ?>s </a></li>
66 66
                         <li>
67
-                            <a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_edit/" . $edit_id . "/"; ?>"> Profile </a>
67
+                            <a href="<?= base_url()."accounts/".strtolower($accounttype)."_edit/".$edit_id."/"; ?>"> Profile </a>
68 68
                         </li>
69 69
                        <li class="active">
70
-                            <a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_speeddial/" . $edit_id . "/"; ?>"> Speed Dial </a>
70
+                            <a href="<?= base_url()."accounts/".strtolower($accounttype)."_speeddial/".$edit_id."/"; ?>"> Speed Dial </a>
71 71
                         </li>
72 72
                     </ul>
73 73
                 </div>
74 74
                 <div class="pull-right">
75 75
                     <ul class="breadcrumb">
76 76
 		      <li class="active pull-right">
77
-		      <a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_edit/" . $edit_id . "/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
77
+		      <a href="<?= base_url()."accounts/".strtolower($accounttype)."_edit/".$edit_id."/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
78 78
                     </ul>
79 79
                 </div>                
80 80
             </div>     
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
                                             </label>
132 132
                                             </div>
133 133
                                                <div class="col-md-3">
134
-                                            <input class="col-md-2 form-control" name="speed_dial_<?php echo $i; ?>" id="speed_dial_<?php echo $i; ?>" size="16" type="text"  value="<?php if (isset($speeddial[$i]) && !empty($speeddial[$i])) {
134
+                                            <input class="col-md-2 form-control" name="speed_dial_<?php echo $i; ?>" id="speed_dial_<?php echo $i; ?>" size="16" type="text"  value="<?php if (isset($speeddial[$i]) && ! empty($speeddial[$i])) {
135 135
         echo $speeddial[$i];
136 136
     } ?>">
137 137
                                                </div>
Please login to merge, or discard this patch.
astpp/application/modules/accounts/views/view_customer_refill_report.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 <? startblock('extra_head') ?>
4 4
 <script type="text/javascript" language="javascript">
5 5
     $(document).ready(function() {
6
-        build_grid("refillreport_grid","<?php echo base_url() . "accounts/customer_details_json/refill/$edit_id/"; ?>",<? echo $grid_fields ?>,"");
6
+        build_grid("refillreport_grid","<?php echo base_url()."accounts/customer_details_json/refill/$edit_id/"; ?>",<? echo $grid_fields ?>,"");
7 7
         $("#left_panel_quick_search").keyup(function(){
8 8
             quick_search("accounts/customer_details_search/"+'<?php echo $accounttype?>'+"_refill/");
9 9
         });
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
             <div class="col-md-12 no-padding color-three border_box"> 
21 21
                 <div class="pull-left">
22 22
                     <ul class="breadcrumb">
23
-                        <li><a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_list/";?>"><?= ucfirst($accounttype); ?>s</a></li>
23
+                        <li><a href="<?= base_url()."accounts/".strtolower($accounttype)."_list/"; ?>"><?= ucfirst($accounttype); ?>s</a></li>
24 24
                         <li>
25
-                            <a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_edit/" . $edit_id . "/"; ?>"> Profile </a>
25
+                            <a href="<?= base_url()."accounts/".strtolower($accounttype)."_edit/".$edit_id."/"; ?>"> Profile </a>
26 26
                         </li>
27 27
                         <li class="active">
28
-                            <a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_refillreport/" . $edit_id . "/"; ?>">
28
+                            <a href="<?= base_url()."accounts/".strtolower($accounttype)."_refillreport/".$edit_id."/"; ?>">
29 29
                                 Refill Report
30 30
                             </a>
31 31
                         </li>
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                 <div class="pull-right">
35 35
                     <ul class="breadcrumb">
36 36
 		      <li class="active pull-right">
37
-		      <a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_edit/" . $edit_id . "/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
37
+		      <a href="<?= base_url()."accounts/".strtolower($accounttype)."_edit/".$edit_id."/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
38 38
                     </ul>
39 39
                 </div>
40 40
             </div>
Please login to merge, or discard this patch.
astpp/application/modules/accounts/views/view_accounts_add_callerid.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<script type="text/javascript" src="<?php echo base_url();?>assets/js/jquery-1.7.1.js"></script>
1
+<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/jquery-1.7.1.js"></script>
2 2
 <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/facebox.js"></script>
3 3
 <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/flexigrid.js"></script>
4 4
 <script type="text/javascript">
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,10 @@
 block discarded – undo
24 24
     <section class="slice color-three no-margin">
25 25
 	<div class="w-section inverse no-padding">
26 26
             <div style="color:red;margin-left: 60px;">
27
-                <?php if (isset($validation_errors)) echo $validation_errors; ?> 
27
+                <?php if (isset($validation_errors)) {
28
+	echo $validation_errors;
29
+}
30
+?> 
28 31
             </div>
29 32
             <?php echo $form; ?>
30 33
         </div>      
Please login to merge, or discard this patch.
astpp/application/modules/accounts/views/view_customer_dids.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -104,10 +104,10 @@
 block discarded – undo
104 104
                                 <label for="Country" class="col-md-3 no-padding">Country : </label>
105 105
                                 <div class="col-md-8 no-padding sel_drop">
106 106
                                  <?php
107
-                                $country_arr = array("id" => "country_id", "name" => "country_id", "class" => "country_id");
108
-                                $country = form_dropdown($country_arr, $this->db_model->build_dropdown("id,country", "countrycode", "", ""), $country_id);
109
-                                echo $country;
110
-                                ?>
107
+								$country_arr = array("id" => "country_id", "name" => "country_id", "class" => "country_id");
108
+								$country = form_dropdown($country_arr, $this->db_model->build_dropdown("id,country", "countrycode", "", ""), $country_id);
109
+								echo $country;
110
+								?>
111 111
                                 </div>
112 112
                             </div>
113 113
                             <div class="col-md-4">
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@  discard block
 block discarded – undo
4 4
 <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/validate.js"></script>
5 5
 <script type="text/javascript" language="javascript">
6 6
     $(document).ready(function() {
7
-        build_grid("dids_list","<?php echo base_url() . "accounts/customer_details_json/did/$edit_id/"; ?>",<? echo $grid_fields; ?>,"");
7
+        build_grid("dids_list","<?php echo base_url()."accounts/customer_details_json/did/$edit_id/"; ?>",<? echo $grid_fields; ?>,"");
8 8
         $("#country_id" ).change(function() {
9 9
             var country_id= $('#country_id').val();
10
-            var url ='<?php echo base_url() . "accounts/customer_did_country/"; ?>';
10
+            var url ='<?php echo base_url()."accounts/customer_did_country/"; ?>';
11 11
             var accountid ='<?php echo $edit_id; ?>';
12 12
             $.ajax({
13 13
                 type: "POST",
@@ -64,19 +64,19 @@  discard block
 block discarded – undo
64 64
             <div class="col-md-12 no-padding color-three border_box"> 
65 65
                 <div class="pull-left">
66 66
                     <ul class="breadcrumb">
67
-                        <li><a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_list/";?>"><?= ucfirst($accounttype); ?>s</a></li>
67
+                        <li><a href="<?= base_url()."accounts/".strtolower($accounttype)."_list/"; ?>"><?= ucfirst($accounttype); ?>s</a></li>
68 68
                         <li>
69
-                            <a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_edit/" . $edit_id . "/"; ?>"> Profile </a>
69
+                            <a href="<?= base_url()."accounts/".strtolower($accounttype)."_edit/".$edit_id."/"; ?>"> Profile </a>
70 70
                         </li>
71 71
                         <li class="active">
72
-                            <a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_dids/" . $edit_id . "/"; ?>"><?= $page_title; ?></a>
72
+                            <a href="<?= base_url()."accounts/".strtolower($accounttype)."_dids/".$edit_id."/"; ?>"><?= $page_title; ?></a>
73 73
                         </li>
74 74
                     </ul>
75 75
                 </div>
76 76
                 <div class="pull-right">
77 77
                     <ul class="breadcrumb">
78 78
 		      <li class="active pull-right">
79
-		      <a href="<?= base_url() . "accounts/" . strtolower($accounttype) . "_edit/" . $edit_id . "/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
79
+		      <a href="<?= base_url()."accounts/".strtolower($accounttype)."_edit/".$edit_id."/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li>
80 80
                     </ul>
81 81
                 </div>
82 82
             </div>
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                      <fieldset class="margin-b-20">
100 100
                         <legend>Purchase DID</legend>
101 101
 
102
-                        <form method="post" id="did_purchase" name="did_purchase" action="<?= base_url() . "accounts/customer_dids_action/add/$edit_id/$accounttype/"; ?>" enctype="multipart/form-data">
102
+                        <form method="post" id="did_purchase" name="did_purchase" action="<?= base_url()."accounts/customer_dids_action/add/$edit_id/$accounttype/"; ?>" enctype="multipart/form-data">
103 103
                             <div class="col-md-4">
104 104
                                 <label for="Country" class="col-md-3 no-padding">Country : </label>
105 105
                                 <div class="col-md-8 no-padding sel_drop">
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/accounts/models/accounts_model.php 3 patches
Indentation   +674 added lines, -674 removed lines patch added patch discarded remove patch
@@ -24,24 +24,24 @@  discard block
 block discarded – undo
24 24
 
25 25
 class Accounts_model extends CI_Model {
26 26
 
27
-    function Accounts_model() {
28
-        parent::__construct();
29
-    }
27
+	function Accounts_model() {
28
+		parent::__construct();
29
+	}
30 30
 
31
-    function add_account($accountinfo) {
31
+	function add_account($accountinfo) {
32 32
 	
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'];
36
-        unset($accountinfo['action']);
37
-        $sip_flag = isset($accountinfo['sip_device_flag']) ? 1 : 0;
38
-        $opensip_flag = isset($accountinfo['opensips_device_flag']) ? 1 : 0;
39
-        unset($accountinfo['sip_device_flag'],$accountinfo['opensips_device_flag'],$accountinfo['tax_id']);
40
-
41
-        /*         * ******************************** */
42
-        $accountinfo['creation'] = gmdate('Y-m-d H:i:s');
43
-        $accountinfo['expiry'] = gmdate('Y-m-d H:i:s', strtotime('+20 years'));
44
-        /*if(isset($accountinfo['is_recording'])){
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'];
36
+		unset($accountinfo['action']);
37
+		$sip_flag = isset($accountinfo['sip_device_flag']) ? 1 : 0;
38
+		$opensip_flag = isset($accountinfo['opensips_device_flag']) ? 1 : 0;
39
+		unset($accountinfo['sip_device_flag'],$accountinfo['opensips_device_flag'],$accountinfo['tax_id']);
40
+
41
+		/*         * ******************************** */
42
+		$accountinfo['creation'] = gmdate('Y-m-d H:i:s');
43
+		$accountinfo['expiry'] = gmdate('Y-m-d H:i:s', strtotime('+20 years'));
44
+		/*if(isset($accountinfo['is_recording'])){
45 45
 	  $accountinfo['is_recording']=0;
46 46
         }else{
47 47
 	  $accountinfo['is_recording']=1;
@@ -51,401 +51,401 @@  discard block
 block discarded – undo
51 51
         }else{
52 52
 	  $accountinfo['allow_ip_management']=1;
53 53
         }*/
54
-        if(isset($accountinfo['local_call'])){
54
+		if(isset($accountinfo['local_call'])){
55 55
 	  $accountinfo['local_call']=0;
56
-        }else{
56
+		}else{
57 57
 	  $accountinfo['local_call']=1;
58
-        }
59
-        if ($accountinfo['type'] == 1){
60
-        $invoice_config = $accountinfo['invoice_config_flag'];
58
+		}
59
+		if ($accountinfo['type'] == 1){
60
+		$invoice_config = $accountinfo['invoice_config_flag'];
61 61
 		}else{
62 62
 		$invoice_config = "";		
63 63
 		}
64 64
 		unset($accountinfo['invoice_config_flag']);
65
-        $result = $this->db->insert('accounts', $accountinfo);
66
-        $last_id = $this->db->insert_id();
67
-                /**
65
+		$result = $this->db->insert('accounts', $accountinfo);
66
+		$last_id = $this->db->insert_id();
67
+				/**
68 68
           ASTPP  3.0 
69 69
           For Invoice Configuration
70
-         * */ 
71
-         if ($accountinfo['type'] == 1 && isset($invoice_config) && $invoice_config == "0") {
72
-                if ($accountinfo['country_id'] == NULL) {
73
-                    $accountinfo['country_id'] = "";
74
-                } else {
75
-                    $data = $this->db_model->getSelect("country", "countrycode", array("id" => $accountinfo['country_id']));
76
-                    $data = $data->result_array();
77
-                    $country_name = $data[0];
78
-                }
79
-                if ($accountinfo['postal_code'] == NULL) {
80
-                    $accountinfo['postal_code'] = "";
81
-                }
82
-
83
-                $invoice_config = array('accountid' => $last_id, 'company_name' => $accountinfo['company_name'], 'address' => $accountinfo['address_1'], 'city' => $accountinfo['city'], 'province' => $accountinfo['province'], 'country' => $country_name['country'], 'zipcode' => $accountinfo['postal_code'], 'telephone' => $accountinfo['telephone_1'], 'emailaddress' => $accountinfo['email']);
84
-                $this->db->where('account_id', $accountinfo['id']);
85
-                $this->db->insert('invoice_conf', $invoice_config);
86
-            }
87
-        if ($sip_flag == '1') {
88
-            $this->db->select('id');
89
-            $this->db->where('name','default');
90
-            $sipprofile_result=(array)$this->db->get('sip_profiles')->first_row();
91
-            $free_switch_array = array('fs_username' => $accountinfo['number'],
92
-                'fs_password' => $this->common->decode($accountinfo['password']),
93
-                'context' => 'default',
94
-                'effective_caller_id_name' => $accountinfo['number'],
95
-                'effective_caller_id_number' => $accountinfo['number'],
96
-                'sip_profile_id' => $sipprofile_result['id'],
97
-                'pricelist_id' => $accountinfo['pricelist_id'],
98
-                'accountcode' => $last_id,
99
-                'status' => $accountinfo['status']);
100
-            $this->load->model('freeswitch/freeswitch_model');
101
-            $this->freeswitch_model->add_freeswith($free_switch_array);
102
-        }
103
-        if ($opensip_flag == 1) {
104
-            $opensips_array = array('username' => $accountinfo['number'],
105
-                'domain' => common_model::$global_config['system_config']['opensips_domain'],
106
-                'password' => $accountinfo['password'],
107
-                'accountcode' => $accountinfo['number'],
108
-                'pricelist_id' => $accountinfo['pricelist_id']);
109
-            $this->load->model('opensips/opensips_model');
110
-            $this->opensips_model->add_opensipsdevices($opensips_array);
111
-        }
112
-        $accountinfo['confirm'] =  base_url();
113
-        if($accountinfo['id'] == ""){
114
-        $accountinfo['id'] = $last_id;
70
+				 * */ 
71
+		 if ($accountinfo['type'] == 1 && isset($invoice_config) && $invoice_config == "0") {
72
+				if ($accountinfo['country_id'] == NULL) {
73
+					$accountinfo['country_id'] = "";
74
+				} else {
75
+					$data = $this->db_model->getSelect("country", "countrycode", array("id" => $accountinfo['country_id']));
76
+					$data = $data->result_array();
77
+					$country_name = $data[0];
78
+				}
79
+				if ($accountinfo['postal_code'] == NULL) {
80
+					$accountinfo['postal_code'] = "";
81
+				}
82
+
83
+				$invoice_config = array('accountid' => $last_id, 'company_name' => $accountinfo['company_name'], 'address' => $accountinfo['address_1'], 'city' => $accountinfo['city'], 'province' => $accountinfo['province'], 'country' => $country_name['country'], 'zipcode' => $accountinfo['postal_code'], 'telephone' => $accountinfo['telephone_1'], 'emailaddress' => $accountinfo['email']);
84
+				$this->db->where('account_id', $accountinfo['id']);
85
+				$this->db->insert('invoice_conf', $invoice_config);
86
+			}
87
+		if ($sip_flag == '1') {
88
+			$this->db->select('id');
89
+			$this->db->where('name','default');
90
+			$sipprofile_result=(array)$this->db->get('sip_profiles')->first_row();
91
+			$free_switch_array = array('fs_username' => $accountinfo['number'],
92
+				'fs_password' => $this->common->decode($accountinfo['password']),
93
+				'context' => 'default',
94
+				'effective_caller_id_name' => $accountinfo['number'],
95
+				'effective_caller_id_number' => $accountinfo['number'],
96
+				'sip_profile_id' => $sipprofile_result['id'],
97
+				'pricelist_id' => $accountinfo['pricelist_id'],
98
+				'accountcode' => $last_id,
99
+				'status' => $accountinfo['status']);
100
+			$this->load->model('freeswitch/freeswitch_model');
101
+			$this->freeswitch_model->add_freeswith($free_switch_array);
102
+		}
103
+		if ($opensip_flag == 1) {
104
+			$opensips_array = array('username' => $accountinfo['number'],
105
+				'domain' => common_model::$global_config['system_config']['opensips_domain'],
106
+				'password' => $accountinfo['password'],
107
+				'accountcode' => $accountinfo['number'],
108
+				'pricelist_id' => $accountinfo['pricelist_id']);
109
+			$this->load->model('opensips/opensips_model');
110
+			$this->opensips_model->add_opensipsdevices($opensips_array);
111
+		}
112
+		$accountinfo['confirm'] =  base_url();
113
+		if($accountinfo['id'] == ""){
114
+		$accountinfo['id'] = $last_id;
115 115
 		}
116
-        $accountinfo['password'] = $this->common->decode($accountinfo['password']);    
116
+		$accountinfo['password'] = $this->common->decode($accountinfo['password']);    
117 117
 
118
-        $this->common->mail_to_users('email_add_user', $accountinfo);
119
-        return $last_id;
120
-    }
118
+		$this->common->mail_to_users('email_add_user', $accountinfo);
119
+		return $last_id;
120
+	}
121 121
 
122
-    /**
122
+	/**
123 123
       ASTPP  3.0 
124 124
       Reseller Batch Update
125
-     * */
126
-    function reseller_rates_batch_update($update_array) {
127
-        unset($update_array['action']);
128
-        $update_array['type'] = 1;
129
-        $date = gmdate("Y-m-d h:i:s");
130
-        $this->db_model->build_search('reseller_list_search');
131
-        if ($update_array['type'] == 1) {
132
-            $this->db_model->build_batch_update_array($update_array);
133
-            $login_type = $this->session->userdata('logintype');
134
-            $reseller_info = $this->session->userdata['accountinfo'];
135
-            if ($reseller_info['type'] == 1) {
136
-                $this->db->where('reseller_id', $reseller_info['id']);
137
-            } else {
138
-                $this->db->where('reseller_id', '0');
139
-            }
140
-            $this->db->where('type', '1');
141
-            $this->db->update("accounts");
142
-            $this->db_model->build_search('reseller_list_search');
143
-            if (isset($update_array['balance']['balance']) && $update_array['balance']['balance'] != '') {
144
-                $search_flag = $this->db_model->build_search('reseller_list_search');
145
-                $account_data = $this->session->userdata("accountinfo");
146
-                if ($account_data['type'] == 1) {
147
-                    $where = array('type' => 1, "balance" => $update_array['balance']['balance'], "reseller_id" => $account_data['id'], 'deleted' => '0', 'status' => '0');
148
-                } else {
149
-                    $where = array('type' => 1, "balance" => $update_array['balance']['balance'], 'deleted' => '0', 'status' => '0');
150
-                }
151
-
152
-                $this->db_model->build_search('reseller_list_search');
153
-                $query_pricelist = $this->db_model->getSelect("id,reseller_id,balance", "accounts", $where);
154
-                if ($query_pricelist->num_rows > 0) {
155
-                    $description = '';
156
-                    if ($update_array['balance']['operator'] == '2') {
157
-                        $description .="Reseller update set balance by admin";
158
-                    }
159
-                    if ($update_array['balance']['operator'] == '3') {
160
-                        $description .="Reseller update increase balance by admin";
161
-                    }
162
-                    if ($update_array['balance']['operator'] == '4') {
163
-                        $description .="Reseller update descrise balance by admin";
164
-                    }
165
-                    foreach ($query_pricelist->result_array() as $key => $reseller_payment) {
166
-                        if (!empty($reseller_payment['reseller_id']) && $reseller_payment['reseller_id'] != '') {
167
-                            $payment_by = $reseller_payment['reseller_id'];
168
-                        } else {
169
-                            $payment_by = '-1';
170
-                        }
171
-                        $insert_arr = array("accountid" => $reseller_payment['id'],
172
-                            "credit" => $update_array['balance']['balance'],
173
-                            'payment_mode' => 0,
174
-                            'type' => "SYSTEM",
175
-                            "notes" => $description,
176
-                            "payment_date" => $date,
177
-                            'payment_by' => $payment_by,
178
-                            'reseller_id' => $reseller_payment['reseller_id'],
179
-                        );
180
-                        $this->db->insert("payments", $insert_arr);
181
-                    }
182
-                }
183
-            }
184
-        }
125
+	 * */
126
+	function reseller_rates_batch_update($update_array) {
127
+		unset($update_array['action']);
128
+		$update_array['type'] = 1;
129
+		$date = gmdate("Y-m-d h:i:s");
130
+		$this->db_model->build_search('reseller_list_search');
131
+		if ($update_array['type'] == 1) {
132
+			$this->db_model->build_batch_update_array($update_array);
133
+			$login_type = $this->session->userdata('logintype');
134
+			$reseller_info = $this->session->userdata['accountinfo'];
135
+			if ($reseller_info['type'] == 1) {
136
+				$this->db->where('reseller_id', $reseller_info['id']);
137
+			} else {
138
+				$this->db->where('reseller_id', '0');
139
+			}
140
+			$this->db->where('type', '1');
141
+			$this->db->update("accounts");
142
+			$this->db_model->build_search('reseller_list_search');
143
+			if (isset($update_array['balance']['balance']) && $update_array['balance']['balance'] != '') {
144
+				$search_flag = $this->db_model->build_search('reseller_list_search');
145
+				$account_data = $this->session->userdata("accountinfo");
146
+				if ($account_data['type'] == 1) {
147
+					$where = array('type' => 1, "balance" => $update_array['balance']['balance'], "reseller_id" => $account_data['id'], 'deleted' => '0', 'status' => '0');
148
+				} else {
149
+					$where = array('type' => 1, "balance" => $update_array['balance']['balance'], 'deleted' => '0', 'status' => '0');
150
+				}
151
+
152
+				$this->db_model->build_search('reseller_list_search');
153
+				$query_pricelist = $this->db_model->getSelect("id,reseller_id,balance", "accounts", $where);
154
+				if ($query_pricelist->num_rows > 0) {
155
+					$description = '';
156
+					if ($update_array['balance']['operator'] == '2') {
157
+						$description .="Reseller update set balance by admin";
158
+					}
159
+					if ($update_array['balance']['operator'] == '3') {
160
+						$description .="Reseller update increase balance by admin";
161
+					}
162
+					if ($update_array['balance']['operator'] == '4') {
163
+						$description .="Reseller update descrise balance by admin";
164
+					}
165
+					foreach ($query_pricelist->result_array() as $key => $reseller_payment) {
166
+						if (!empty($reseller_payment['reseller_id']) && $reseller_payment['reseller_id'] != '') {
167
+							$payment_by = $reseller_payment['reseller_id'];
168
+						} else {
169
+							$payment_by = '-1';
170
+						}
171
+						$insert_arr = array("accountid" => $reseller_payment['id'],
172
+							"credit" => $update_array['balance']['balance'],
173
+							'payment_mode' => 0,
174
+							'type' => "SYSTEM",
175
+							"notes" => $description,
176
+							"payment_date" => $date,
177
+							'payment_by' => $payment_by,
178
+							'reseller_id' => $reseller_payment['reseller_id'],
179
+						);
180
+						$this->db->insert("payments", $insert_arr);
181
+					}
182
+				}
183
+			}
184
+		}
185 185
 
186
-        return true;
187
-    }
188
-    /**
186
+		return true;
187
+	}
188
+	/**
189 189
       ASTPP  3.0 
190 190
       Customer Batch Update
191
-     * */
192
-    function customer_rates_batch_update($update_array) {
193
-
194
-        unset($update_array['action']);
195
-        $date = gmdate("Y-m-d h:i:s");
196
-        $this->db_model->build_search('customer_list_search');
197
-        $reseller_info = $this->session->userdata['accountinfo'];
198
-        if ($reseller_info['type'] == 1) {
199
-            $this->db->where('reseller_id', $reseller_info['id']);
200
-        } else {
201
-            $this->db->where('reseller_id', '0');
202
-        }
203
-        $this->db_model->build_search('customer_list_search');
204
-        $this->db->where('type !=', '1');
205
-        $this->db_model->build_batch_update_array($update_array);
206
-        $this->db->update("accounts");
207
-        if (isset($update_array['balance']['balance']) && $update_array['balance']['balance'] != '') {
208
-            $account_data = $this->session->userdata("accountinfo");
209
-
210
-            if ($account_data['type'] == 1) {
211
-                $where = array('type' => 1, "reseller_id" => $account_data['id'], 'deleted' => '0', 'status' => '0');
212
-            } else {
213
-                $where = array('type !=' => '-1', "balance" => $update_array['balance']['balance'], 'deleted' => '0', 'status' => '0');
214
-            }
215
-
216
-            $this->db_model->build_search('customer_list_search');
217
-            $query_pricelist = $this->db_model->getSelect("id,reseller_id,balance", "accounts", $where);
218
-            if ($query_pricelist->num_rows > 0) {
219
-                $description = '';
220
-                if ($update_array['balance']['operator'] == '2') {
221
-                    $description .="Customer update set balance by admin";
222
-                }
223
-                if ($update_array['balance']['operator'] == '3') {
224
-                    $description .="Customer update increase balance by admin";
225
-                }
226
-                if ($update_array['balance']['operator'] == '4') {
227
-                    $description .="Customer update descrise balance by admin";
228
-                }
229
-                foreach ($query_pricelist->result_array() as $key => $customer_payment) {
230
-                    if (!empty($customer_payment['reseller_id']) && $customer_payment['reseller_id'] != '0') {
231
-                        $payment_by = $customer_payment['reseller_id'];
232
-                    } else {
233
-                        $payment_by = '-1';
234
-                    }
235
-                    $insert_arr = array("accountid" => $customer_payment['id'],
236
-                        "credit" => $update_array['balance']['balance'],
237
-                        'payment_mode' => 0,
238
-                        'type' => "SYSTEM",
239
-                        "notes" => $description,
240
-                        "payment_date" => $date,
241
-                        'payment_by' => $payment_by,
242
-                        'reseller_id' => $customer_payment['reseller_id'],
243
-                    );
244
-                    $this->db->insert("payments", $insert_arr);
245
-                }
246
-            }
247
-        }
248
-        return true;
249
-    }
250
-
251
-    /*     * ************************************************************************ */
252
-
253
-    function edit_account($accountinfo, $edit_id) {
254
-        unset($accountinfo['action']);
255
-        unset($accountinfo['onoffswitch']);
256
-        $this->db->where('id', $edit_id);
257
-        $result = $this->db->update('accounts', $accountinfo);
258
-        return true;
259
-    }
260
-
261
-    function bulk_insert_accounts($add_array) {
262
-        $logintype = $this->session->userdata('logintype');
263
-        $creation_limit = $this->get_max_limit($add_array);
264
-        $count = $add_array['count'];
265
-        $pin_flag = $add_array['pin'];
191
+	 * */
192
+	function customer_rates_batch_update($update_array) {
193
+
194
+		unset($update_array['action']);
195
+		$date = gmdate("Y-m-d h:i:s");
196
+		$this->db_model->build_search('customer_list_search');
197
+		$reseller_info = $this->session->userdata['accountinfo'];
198
+		if ($reseller_info['type'] == 1) {
199
+			$this->db->where('reseller_id', $reseller_info['id']);
200
+		} else {
201
+			$this->db->where('reseller_id', '0');
202
+		}
203
+		$this->db_model->build_search('customer_list_search');
204
+		$this->db->where('type !=', '1');
205
+		$this->db_model->build_batch_update_array($update_array);
206
+		$this->db->update("accounts");
207
+		if (isset($update_array['balance']['balance']) && $update_array['balance']['balance'] != '') {
208
+			$account_data = $this->session->userdata("accountinfo");
209
+
210
+			if ($account_data['type'] == 1) {
211
+				$where = array('type' => 1, "reseller_id" => $account_data['id'], 'deleted' => '0', 'status' => '0');
212
+			} else {
213
+				$where = array('type !=' => '-1', "balance" => $update_array['balance']['balance'], 'deleted' => '0', 'status' => '0');
214
+			}
215
+
216
+			$this->db_model->build_search('customer_list_search');
217
+			$query_pricelist = $this->db_model->getSelect("id,reseller_id,balance", "accounts", $where);
218
+			if ($query_pricelist->num_rows > 0) {
219
+				$description = '';
220
+				if ($update_array['balance']['operator'] == '2') {
221
+					$description .="Customer update set balance by admin";
222
+				}
223
+				if ($update_array['balance']['operator'] == '3') {
224
+					$description .="Customer update increase balance by admin";
225
+				}
226
+				if ($update_array['balance']['operator'] == '4') {
227
+					$description .="Customer update descrise balance by admin";
228
+				}
229
+				foreach ($query_pricelist->result_array() as $key => $customer_payment) {
230
+					if (!empty($customer_payment['reseller_id']) && $customer_payment['reseller_id'] != '0') {
231
+						$payment_by = $customer_payment['reseller_id'];
232
+					} else {
233
+						$payment_by = '-1';
234
+					}
235
+					$insert_arr = array("accountid" => $customer_payment['id'],
236
+						"credit" => $update_array['balance']['balance'],
237
+						'payment_mode' => 0,
238
+						'type' => "SYSTEM",
239
+						"notes" => $description,
240
+						"payment_date" => $date,
241
+						'payment_by' => $payment_by,
242
+						'reseller_id' => $customer_payment['reseller_id'],
243
+					);
244
+					$this->db->insert("payments", $insert_arr);
245
+				}
246
+			}
247
+		}
248
+		return true;
249
+	}
250
+
251
+	/*     * ************************************************************************ */
252
+
253
+	function edit_account($accountinfo, $edit_id) {
254
+		unset($accountinfo['action']);
255
+		unset($accountinfo['onoffswitch']);
256
+		$this->db->where('id', $edit_id);
257
+		$result = $this->db->update('accounts', $accountinfo);
258
+		return true;
259
+	}
260
+
261
+	function bulk_insert_accounts($add_array) {
262
+		$logintype = $this->session->userdata('logintype');
263
+		$creation_limit = $this->get_max_limit($add_array);
264
+		$count = $add_array['count'];
265
+		$pin_flag = $add_array['pin'];
266 266
         
267
-        $balance = $add_array['balance'] != '' ? $add_array['balance'] : 0.0000;
268
-        $credit_limit = $add_array['credit_limit'] != '' ? $add_array['credit_limit'] : 0.0000;
269
-        $prefix = $add_array['prefix'];
270
-        $account_length = $add_array['account_length'];
267
+		$balance = $add_array['balance'] != '' ? $add_array['balance'] : 0.0000;
268
+		$credit_limit = $add_array['credit_limit'] != '' ? $add_array['credit_limit'] : 0.0000;
269
+		$prefix = $add_array['prefix'];
270
+		$account_length = $add_array['account_length'];
271 271
         
272
-        $length = strlen($prefix);
273
-        if ($length != 0) {
274
-            $number_length = $account_length - $length;
275
-        } else {
276
-            $number_length = $account_length;
277
-        }
272
+		$length = strlen($prefix);
273
+		if ($length != 0) {
274
+			$number_length = $account_length - $length;
275
+		} else {
276
+			$number_length = $account_length;
277
+		}
278 278
 
279
-        $pricelist_id = $add_array['pricelist_id'] != '' ? $add_array['pricelist_id'] : 0;
280
-        $number = $this->common->find_uniq_rendno_accno($number_length, 'number', 'accounts', $prefix, $count);
281
-        $password = $this->common->find_uniq_rendno_accno($number_length, 'password', 'accounts', '', $count);
282
-        if ($pin_flag) {
283
-            $pin = $this->common->find_uniq_rendno_accno($number_length, 'pin', 'accounts', '', $count);
284
-        }
285
-        $sip_flag = false;
286
-        $opensip_flag=false;
287
-        if (isset($add_array['sip_device_flag']) && common_model::$global_config['system_config']['opensips']== 0) {
288
-            $sip_flag = true;
289
-        }
290
-        if (isset($add_array['opensips_device_flag']) && common_model::$global_config['system_config']['opensips']== 1) {
291
-            $opensip_flag = true;
292
-        }
293
-        unset(
294
-                $add_array['count'],
295
-                $add_array['pin'],
296
-                $add_array['account_length'],
297
-                $add_array['prefix'],
298
-                $add_array['sip_device_flag'],
299
-                $add_array['opensips_device_flag']
300
-        );
301
-        if(isset($add_array['is_recording']) &&  $add_array['is_recording'] != ''){
302
-        $is_recording=1;
303
-        }else{
304
-        $is_recording=0;
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;
310
-        }
311
-        if(isset($add_array['local_call']) &&  $add_array['local_call'] != ''){
312
-        $local_call=1;
313
-        }else{
314
-        $local_call=0;
315
-        }
316
-        if ($sip_flag) {
317
-            $query = $this->db_model->select("*", "sip_profiles", array('status' => "0"), "id", "ASC", '1', '0');
318
-            $sip_id = $query->result_array();
319
-            $sip_profile_id = $sip_id[0]['id'];
320
-            for ($i = 0; $i < $count; $i++) {
321
-                $acc_num = $number[$i];
322
-                $current_password = $password[$i];
323
-                $insert_array = array('number' => $acc_num,
324
-                    'password' => $this->common->encode($current_password),
325
-                    'pricelist_id' => $pricelist_id,
326
-                    'reseller_id' => $add_array['reseller_id'],
327
-                    'status' => 0,
328
-                    'credit_limit' => $credit_limit,
329
-                    'posttoexternal' => $add_array['posttoexternal'],
330
-                    'balance' => $balance,
331
-                    'currency_id' => $add_array['currency_id'],
332
-                    'country_id' => $add_array['country_id'],
333
-                    'timezone_id' => $add_array['timezone_id'],
334
-                    'company_name' => $add_array['company_name'],
335
-                    'first_name' => $acc_num,
336
-                    'type' => 0,
337
-                    'charge_per_min'=>$add_array['charge_per_min'],
338
-                    'validfordays' => $add_array['validfordays'],
339
-                    "creation"=>gmdate("Y-m-d H:i:s"),
340
-                    "maxchannels"=>0,
341
-                    "sweep_id"=>$add_array['sweep_id'],
342
-                    "local_call"=>$local_call,
343
-                     "invoice_day"=>$add_array['invoice_day'],
344
-                    "allow_ip_management"=>$allow_ip_management,
345
-                    "is_recording"=>$is_recording,
346
-                    "expiry" => gmdate('Y-m-d H:i:s', strtotime('+10 years'))
347
-                );
348
-                if ($pin_flag == 1) {
349
-                    $insert_array['pin'] = $pin[$i];
350
-                }
351
-                $this->db->insert('accounts', $insert_array);
352
-                $last_id = $this->db->insert_id();
353
-                $params_array = array('password' => $password[$i],
354
-                    "vm-enabled"=>"true",
355
-                    "vm-password"=>"",
356
-                    "vm-mailto"=>"",
357
-                    "vm-attach-file"=>"true",
358
-                    "vm-keep-local-after-email"=>"true",
359
-                    "vm-email-all-messages"=>"true"
360
-                    );
361
-                $params_array_vars = array('effective_caller_id_name' => $acc_num,
362
-                    'effective_caller_id_number' => $acc_num,
363
-                    'user_context' => 'default');
364
-                $sip_device_array[$i] = array('username' => $acc_num,
365
-                    'sip_profile_id' => $sip_profile_id,
366
-                    'reseller_id' => $add_array['reseller_id'],
367
-                    'accountid' => $last_id,
368
-                    'dir_params' => json_encode($params_array),
369
-                    'dir_vars' => json_encode($params_array_vars),
370
-                    'status' => 0,
371
-                    'creation_date' => gmdate("Y-m-d H:i:s")
372
-                    );
373
-            }
374
-            $this->db->insert_batch('sip_devices', $sip_device_array);
375
-        } else {
376
-            for ($i = 0; $i < $count; $i++) {
377
-                $acc_num = $number[$i];
378
-                $current_password = $password[$i];
379
-                $insert_array[$i] = array('number' => $acc_num,
380
-                    'password' => $this->common->encode($current_password),
381
-                    'pricelist_id' => $pricelist_id,
382
-                    'reseller_id' => $add_array['reseller_id'],
383
-                    'status' => 0,
384
-                    'credit_limit' => $credit_limit,
385
-                    'sweep_id' => 0,
386
-                    'posttoexternal' => $add_array['posttoexternal'],
387
-                    'balance' => $balance,
388
-                    'currency_id' => $add_array['currency_id'],
389
-                    'country_id' => $add_array['country_id'],
390
-                    'timezone_id' => $add_array['timezone_id'],
391
-                    'company_name' => $add_array['company_name'],
392
-                    'invoice_day' => 0,
393
-                    'first_name' => $acc_num,
394
-                    'type' => 0,
395
-                    'validfordays' => $add_array['validfordays'],
396
-                    "creation"=>gmdate("Y-m-d H:i:s"),
397
-                    "is_recording"=>0,
398
-                    "maxchannels"=>0,
399
-                    "sweep_id"=>2,
400
-                    "invoice_day"=>gmdate("d"),
401
-                    "expiry" => gmdate('Y-m-d H:i:s', strtotime('+10 years'))
279
+		$pricelist_id = $add_array['pricelist_id'] != '' ? $add_array['pricelist_id'] : 0;
280
+		$number = $this->common->find_uniq_rendno_accno($number_length, 'number', 'accounts', $prefix, $count);
281
+		$password = $this->common->find_uniq_rendno_accno($number_length, 'password', 'accounts', '', $count);
282
+		if ($pin_flag) {
283
+			$pin = $this->common->find_uniq_rendno_accno($number_length, 'pin', 'accounts', '', $count);
284
+		}
285
+		$sip_flag = false;
286
+		$opensip_flag=false;
287
+		if (isset($add_array['sip_device_flag']) && common_model::$global_config['system_config']['opensips']== 0) {
288
+			$sip_flag = true;
289
+		}
290
+		if (isset($add_array['opensips_device_flag']) && common_model::$global_config['system_config']['opensips']== 1) {
291
+			$opensip_flag = true;
292
+		}
293
+		unset(
294
+				$add_array['count'],
295
+				$add_array['pin'],
296
+				$add_array['account_length'],
297
+				$add_array['prefix'],
298
+				$add_array['sip_device_flag'],
299
+				$add_array['opensips_device_flag']
300
+		);
301
+		if(isset($add_array['is_recording']) &&  $add_array['is_recording'] != ''){
302
+		$is_recording=1;
303
+		}else{
304
+		$is_recording=0;
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;
310
+		}
311
+		if(isset($add_array['local_call']) &&  $add_array['local_call'] != ''){
312
+		$local_call=1;
313
+		}else{
314
+		$local_call=0;
315
+		}
316
+		if ($sip_flag) {
317
+			$query = $this->db_model->select("*", "sip_profiles", array('status' => "0"), "id", "ASC", '1', '0');
318
+			$sip_id = $query->result_array();
319
+			$sip_profile_id = $sip_id[0]['id'];
320
+			for ($i = 0; $i < $count; $i++) {
321
+				$acc_num = $number[$i];
322
+				$current_password = $password[$i];
323
+				$insert_array = array('number' => $acc_num,
324
+					'password' => $this->common->encode($current_password),
325
+					'pricelist_id' => $pricelist_id,
326
+					'reseller_id' => $add_array['reseller_id'],
327
+					'status' => 0,
328
+					'credit_limit' => $credit_limit,
329
+					'posttoexternal' => $add_array['posttoexternal'],
330
+					'balance' => $balance,
331
+					'currency_id' => $add_array['currency_id'],
332
+					'country_id' => $add_array['country_id'],
333
+					'timezone_id' => $add_array['timezone_id'],
334
+					'company_name' => $add_array['company_name'],
335
+					'first_name' => $acc_num,
336
+					'type' => 0,
337
+					'charge_per_min'=>$add_array['charge_per_min'],
338
+					'validfordays' => $add_array['validfordays'],
339
+					"creation"=>gmdate("Y-m-d H:i:s"),
340
+					"maxchannels"=>0,
341
+					"sweep_id"=>$add_array['sweep_id'],
342
+					"local_call"=>$local_call,
343
+					 "invoice_day"=>$add_array['invoice_day'],
344
+					"allow_ip_management"=>$allow_ip_management,
345
+					"is_recording"=>$is_recording,
346
+					"expiry" => gmdate('Y-m-d H:i:s', strtotime('+10 years'))
347
+				);
348
+				if ($pin_flag == 1) {
349
+					$insert_array['pin'] = $pin[$i];
350
+				}
351
+				$this->db->insert('accounts', $insert_array);
352
+				$last_id = $this->db->insert_id();
353
+				$params_array = array('password' => $password[$i],
354
+					"vm-enabled"=>"true",
355
+					"vm-password"=>"",
356
+					"vm-mailto"=>"",
357
+					"vm-attach-file"=>"true",
358
+					"vm-keep-local-after-email"=>"true",
359
+					"vm-email-all-messages"=>"true"
360
+					);
361
+				$params_array_vars = array('effective_caller_id_name' => $acc_num,
362
+					'effective_caller_id_number' => $acc_num,
363
+					'user_context' => 'default');
364
+				$sip_device_array[$i] = array('username' => $acc_num,
365
+					'sip_profile_id' => $sip_profile_id,
366
+					'reseller_id' => $add_array['reseller_id'],
367
+					'accountid' => $last_id,
368
+					'dir_params' => json_encode($params_array),
369
+					'dir_vars' => json_encode($params_array_vars),
370
+					'status' => 0,
371
+					'creation_date' => gmdate("Y-m-d H:i:s")
372
+					);
373
+			}
374
+			$this->db->insert_batch('sip_devices', $sip_device_array);
375
+		} else {
376
+			for ($i = 0; $i < $count; $i++) {
377
+				$acc_num = $number[$i];
378
+				$current_password = $password[$i];
379
+				$insert_array[$i] = array('number' => $acc_num,
380
+					'password' => $this->common->encode($current_password),
381
+					'pricelist_id' => $pricelist_id,
382
+					'reseller_id' => $add_array['reseller_id'],
383
+					'status' => 0,
384
+					'credit_limit' => $credit_limit,
385
+					'sweep_id' => 0,
386
+					'posttoexternal' => $add_array['posttoexternal'],
387
+					'balance' => $balance,
388
+					'currency_id' => $add_array['currency_id'],
389
+					'country_id' => $add_array['country_id'],
390
+					'timezone_id' => $add_array['timezone_id'],
391
+					'company_name' => $add_array['company_name'],
392
+					'invoice_day' => 0,
393
+					'first_name' => $acc_num,
394
+					'type' => 0,
395
+					'validfordays' => $add_array['validfordays'],
396
+					"creation"=>gmdate("Y-m-d H:i:s"),
397
+					"is_recording"=>0,
398
+					"maxchannels"=>0,
399
+					"sweep_id"=>2,
400
+					"invoice_day"=>gmdate("d"),
401
+					"expiry" => gmdate('Y-m-d H:i:s', strtotime('+10 years'))
402 402
                     
403
-                );
404
-                if ($pin_flag == 1) {
405
-                    $insert_array[$i]['pin'] = $pin[$i];
406
-                }
407
-                if ($opensip_flag) {
408
-                    $opensips_domain = common_model::$global_config['system_config']['opensips_domain'];
409
-                    $opensips_array[$i] = array('username' => $acc_num,
410
-                        'domain' => $opensips_domain,
411
-                        'password' => $current_password,
412
-                        'accountcode' => $acc_num,
413
-                        'reseller_id' => $add_array['reseller_id'],
414
-                        "creation_date" => gmdate("Y-m-d H:i:s"),
415
-                        "status"=>0
416
-                        );
417
-                }
418
-            }
419
-            $this->db->insert_batch('accounts', $insert_array);
420
-            if ($opensip_flag == 1) {
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=";
423
-                $this->opensips_db = $this->load->database($opensipdsn, true);
424
-                $this->opensips_db->insert_batch("subscriber", $opensips_array);
425
-            }
426
-        }
427
-        return TRUE;
428
-    }
403
+				);
404
+				if ($pin_flag == 1) {
405
+					$insert_array[$i]['pin'] = $pin[$i];
406
+				}
407
+				if ($opensip_flag) {
408
+					$opensips_domain = common_model::$global_config['system_config']['opensips_domain'];
409
+					$opensips_array[$i] = array('username' => $acc_num,
410
+						'domain' => $opensips_domain,
411
+						'password' => $current_password,
412
+						'accountcode' => $acc_num,
413
+						'reseller_id' => $add_array['reseller_id'],
414
+						"creation_date" => gmdate("Y-m-d H:i:s"),
415
+						"status"=>0
416
+						);
417
+				}
418
+			}
419
+			$this->db->insert_batch('accounts', $insert_array);
420
+			if ($opensip_flag == 1) {
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=";
423
+				$this->opensips_db = $this->load->database($opensipdsn, true);
424
+				$this->opensips_db->insert_batch("subscriber", $opensips_array);
425
+			}
426
+		}
427
+		return TRUE;
428
+	}
429 429
 
430
-    function get_max_limit($add_array) {
430
+	function get_max_limit($add_array) {
431 431
 		$this->db->where('deleted','0');
432
-        $this->db->where("length(number)", $add_array['account_length']);
433
-        $this->db->like('number', $add_array['prefix'], 'after');
434
-        $this->db->select("count(id) as count");
435
-        $this->db->from('accounts');
436
-        $result = $this->db->get();
437
-        $result = $result->result_array();
438
-        $count = $result[0]['count'];
439
-        $remaining_length = 0;
440
-        $remaining_length = $add_array['account_length'] - strlen($add_array['prefix']);
441
-        $currentlength = pow(10, $remaining_length);
442
-        $currentlength = $currentlength - $count;
443
-        return $currentlength;
444
-    }
445
-    function account_process_payment($data) {
432
+		$this->db->where("length(number)", $add_array['account_length']);
433
+		$this->db->like('number', $add_array['prefix'], 'after');
434
+		$this->db->select("count(id) as count");
435
+		$this->db->from('accounts');
436
+		$result = $this->db->get();
437
+		$result = $result->result_array();
438
+		$count = $result[0]['count'];
439
+		$remaining_length = 0;
440
+		$remaining_length = $add_array['account_length'] - strlen($add_array['prefix']);
441
+		$currentlength = pow(10, $remaining_length);
442
+		$currentlength = $currentlength - $count;
443
+		return $currentlength;
444
+	}
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 451
 	unset($data['action'],$data['id'],$data['account_currency'],$data['payment_type']);
@@ -477,300 +477,300 @@  discard block
 block discarded – undo
477 477
 		  $accountdata['refill_amount']=$data['credit'];
478 478
 		  $current_id=$accountinfo['type'] ==1 ? $accountinfo['id'] : '0';
479 479
 		  if($accountdata['reseller_id'] == $current_id){
480
-		    $this->common->mail_to_users('voip_account_refilled', $accountdata);
480
+			$this->common->mail_to_users('voip_account_refilled', $accountdata);
481 481
 		  }else{
482
-		    $this->common->mail_to_users('voip_child_account_refilled', $accountdata);
482
+			$this->common->mail_to_users('voip_child_account_refilled', $accountdata);
483 483
 		  }
484 484
 		}
485 485
 	}
486
-    }
486
+	}
487 487
 /****************Completed******************/
488 488
 
489
-    function get_admin_Account_list($flag, $start = 0, $limit = 0, $reseller_id = 0) {
490
-        $this->db_model->build_search('admin_list_search');
491
-        $where = "reseller_id =" . $reseller_id . " AND deleted =0 AND type in (2,4,-1)";
492
-        if ($this->session->userdata('advance_search') == 1) {
493
-            $search = $this->session->userdata('admin_list_search');
494
-            if ($search['type'] == '') {
495
-                $this->db->where($where);
496
-                $this->db_model->build_search('admin_list_search');
497
-            } else {
498
-                $this->db->where('type', $search['type']);
499
-            }
500
-        } else {
501
-            $this->db->where($where);
502
-            $this->db_model->build_search('admin_list_search');
503
-        }
504
-        if ($flag) {
505
-            $this->db->limit($limit, $start);
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');
511
-        }
512
-        $result = $this->db->get('accounts');
489
+	function get_admin_Account_list($flag, $start = 0, $limit = 0, $reseller_id = 0) {
490
+		$this->db_model->build_search('admin_list_search');
491
+		$where = "reseller_id =" . $reseller_id . " AND deleted =0 AND type in (2,4,-1)";
492
+		if ($this->session->userdata('advance_search') == 1) {
493
+			$search = $this->session->userdata('admin_list_search');
494
+			if ($search['type'] == '') {
495
+				$this->db->where($where);
496
+				$this->db_model->build_search('admin_list_search');
497
+			} else {
498
+				$this->db->where('type', $search['type']);
499
+			}
500
+		} else {
501
+			$this->db->where($where);
502
+			$this->db_model->build_search('admin_list_search');
503
+		}
504
+		if ($flag) {
505
+			$this->db->limit($limit, $start);
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');
511
+		}
512
+		$result = $this->db->get('accounts');
513 513
 
514
-        if ($flag) {
515
-            return $result;
516
-        } else {
517
-            return $result->num_rows();
518
-        }
519
-    }
520
-
521
-    function get_customer_Account_list($flag, $start = 0, $limit = 0, $export = false) {
522
-        $this->db_model->build_search('customer_list_search');
523
-        $accountinfo = $this->session->userdata("accountinfo");
524
-        $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
525
-        $where = array("deleted" => "0", 'reseller_id' => $reseller_id);
526
-        $this->db->select('*');
527
-        $type = "type IN (0,3)";
528
-        $this->db->where($where);
529
-        if ($this->session->userdata('advance_search') == 1) {
530
-            $search = $this->session->userdata('customer_list_search');
531
-            if ($search['type'] != '0' && $search['type'] != '3') {
532
-                $this->db->where($type);
533
-            }
534
-        } else {
535
-            $this->db->where($type);
536
-        }
537
-        if ($flag) {
538
-            if (!$export)
539
-                $this->db->limit($limit, $start);
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');
545
-        }
546
-        $result = $this->db->get('accounts');
547
-        if ($flag) {
548
-            return $result;
549
-        } else {
550
-            return $result->num_rows();
551
-        }
552
-    }
514
+		if ($flag) {
515
+			return $result;
516
+		} else {
517
+			return $result->num_rows();
518
+		}
519
+	}
553 520
 
554
-    function get_reseller_Account_list($flag, $start = 0, $limit = 0, $export = false) {
555
-        $this->db_model->build_search('reseller_list_search');
556
-        $where = array('reseller_id' => "0", "deleted" => "0", "type" => "1");
557
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
558
-            $where['reseller_id'] = $this->session->userdata["accountinfo"]['id'];
559
-        }
560
-        if ($flag) {
561
-            $query = $this->db_model->select("*", "accounts", $where, "number", "desc", $limit, $start);
562
-        } else {
563
-            $query = $this->db_model->countQuery("*", "accounts", $where);
564
-        }
565
-        return $query;
566
-    }
567
-
568
-    function get_provider_Account_list($flag, $start = 0, $limit = 0) {
569
-        $this->db_model->build_search('provider_list_search');
570
-        $where = array("deleted" => "0", "type" => "3", 'reseller_id' => 0);
571
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
572
-            $where['reseller_id'] = $this->session->userdata["accountinfo"]['id'];
573
-        }
574
-        if ($flag) {
575
-            $query = $this->db_model->select("*", "accounts", $where, "number", "desc", $limit, $start);
576
-        } else {
577
-            $query = $this->db_model->countQuery("*", "accounts", $where);
578
-        }
579
-        return $query;
580
-    }
581
-
582
-    function remove_customer($id) {
583
-        $this->db->where("id", $id);
584
-        $this->db->where("type <>", "-1");
585
-        $data = array('deleted' => '1');
586
-        $this->db->update("accounts", $data);
587
-        return true;
588
-    }
589
-
590
-    function insert_block($data, $accountid) {
591
-        $data = explode(",", $data);
592
-        $tmp = array();
593
-        if (!empty($data)) {
594
-            foreach ($data as $key => $data_value) {
595
-                $tmp[$key]["accountid"] = $accountid;
596
-                $result = $this->get_pattern_by_id($data_value);
597
-                $tmp[$key]["blocked_patterns"] = $result[0]['pattern'];
598
-                $tmp[$key]["destination"] = $result[0]['comment'];
599
-            }
600
-            return $this->db->insert_batch("block_patterns", $tmp);
601
-        }
602
-    }
603
-
604
-    function get_pattern_by_id($pattern) {
605
-        $patterns = $this->db_model->getSelect("pattern,comment", "routes", array("id" => $pattern));
606
-        $patterns_value = $patterns->result_array();
607
-        return $patterns_value;
608
-    }
609
-
610
-    function get_callerid($account_id) {
611
-        $query = $this->db_model->getSelect("*", "accounts_callerid", array("accountid" => $account_id));
612
-        return $query;
613
-    }
614
-
615
-    function get_account_number($accountid) {
616
-        $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;
621
-    }
622
-
623
-    function add_callerid($data) {
624
-        unset($data['action'],$data['flag']);
625
-        $data['accountid'] = $this->common->get_field_name('id', 'accounts', array('number' => $data['accountid']));
626
-        $this->db->insert('accounts_callerid', $data);
627
-        return true;
628
-    }
629
-
630
-    function edit_callerid($data) {
631
-        unset($data['action']);
632
-        unset($data['flag']);
633
-        $data['accountid'] = $this->common->get_field_name('id', 'accounts', array('number' => $data['accountid']));
634
-        $this->db->where('accountid', $data['accountid']);
635
-        $this->db->update('accounts_callerid', $data);
636
-        return true;
637
-    }
638
-
639
-    /**
640
-     * -------Here we write code for model accounting functions remove_all_account_tax------
641
-     * for remove all account's taxes enteries from database.
642
-     */
643
-    function remove_all_account_tax($account_tax) {
644
-        $this->db->where('accountid', $account_tax);
645
-        $this->db->delete('taxes_to_accounts');
646
-        return true;
647
-    }
648
-
649
-    /**
650
-     * -------Here we write code for model accounting functions add_account_tax------
651
-     * this function use to insert data for add taxes to account.
652
-     */
653
-    function add_account_tax($data) {
654
-        $this->db->insert('taxes_to_accounts', $data);
655
-    }
656
-
657
-    /**
658
-     * -------Here we write code for model accounting functions get_accounttax_by_id------
659
-     * this function use get the account taxes details as per account number
660
-     * @account_id = account id
661
-     */
662
-    function get_accounttax_by_id($account_id) {
663
-        $this->db->where("accountid", trim($account_id));
664
-        $query = $this->db->get("taxes_to_accounts");
665
-        if ($query->num_rows() > 0)
666
-            return $query->result_array();
667
-        else
668
-            return false;
669
-    }
670
-
671
-    /**
672
-     * -------Here we write code for model accounting functions check_account_num------
673
-     * this function write to verify the account number is valid or not.
674
-     * @acc_num = account number
675
-     */
676
-    function check_account_num($acc_num) {
677
-        $this->db->select('accountid');
678
-        $this->db->where("number", $acc_num);
679
-        $query = $this->db->get("accounts");
680
-
681
-        if ($query->num_rows() > 0)
682
-            return $query->row_array();
683
-        else
684
-            return false;
685
-    }
686
-
687
-    function get_account_by_number($id) {
688
-        $this->db->where("id", $id);
689
-        $query = $this->db->get("accounts");
690
-
691
-        if ($query->num_rows() > 0)
692
-            return $query->row_array();
693
-        else
694
-            return false;
695
-    }
696
-
697
-    function get_currency_by_id($currency_id) {
698
-
699
-        $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;
704
-    }
705
-
706
-
707
-    function update_balance($amount, $accountid, $payment_type) {
708
-        if ($payment_type == 0) {
709
-            $query = 'UPDATE `accounts` SET `balance` = (balance + ' . $amount . ') WHERE `id` = ' . $accountid;
710
-            return $this->db->query($query);
711
-        }if ($payment_type == 1) {
712
-            $query = 'UPDATE `accounts` SET `balance` = (balance - ' . $amount . ') WHERE `id` = ' . $accountid;
713
-            return $this->db->query($query);
714
-        }
715
-    }
521
+	function get_customer_Account_list($flag, $start = 0, $limit = 0, $export = false) {
522
+		$this->db_model->build_search('customer_list_search');
523
+		$accountinfo = $this->session->userdata("accountinfo");
524
+		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
525
+		$where = array("deleted" => "0", 'reseller_id' => $reseller_id);
526
+		$this->db->select('*');
527
+		$type = "type IN (0,3)";
528
+		$this->db->where($where);
529
+		if ($this->session->userdata('advance_search') == 1) {
530
+			$search = $this->session->userdata('customer_list_search');
531
+			if ($search['type'] != '0' && $search['type'] != '3') {
532
+				$this->db->where($type);
533
+			}
534
+		} else {
535
+			$this->db->where($type);
536
+		}
537
+		if ($flag) {
538
+			if (!$export)
539
+				$this->db->limit($limit, $start);
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');
545
+		}
546
+		$result = $this->db->get('accounts');
547
+		if ($flag) {
548
+			return $result;
549
+		} else {
550
+			return $result->num_rows();
551
+		}
552
+	}
716 553
 
717
-    function account_authentication($where_data, $id) {
718
-        if ($id != "") {
719
-            $this->db->where("id <>", $id);
720
-        }
721
-        $this->db->where($where_data);
722
-        $this->db->from("accounts");
723
-        $query = $this->db->count_all_results();
724
-        return $query;
725
-    }
726
-
727
-    function get_animap($flag, $start, $limit, $id) {
728
-        $where = array('accountid' => $id);
729
-
730
-        if ($flag) {
731
-            $query = $this->db_model->select("*", "ani_map", $where, "number", "DESC", $limit, $start);
732
-        } else {
733
-            $query = $this->db_model->countQuery("*", "ani_map", $where);
734
-        }
735
-        return $query;
736
-    }
737
-
738
-    function add_animap($data) {
739
-        $this->db->insert('ani_map', $data);
740
-        return true;
741
-    }
742
-
743
-    function edit_animap($data, $id) {
744
-        $new_array = array('number' => $data['number'], 'status' => $data['status']);
745
-        $this->db->where('id', $id);
746
-        $this->db->update('ani_map', $new_array);
747
-        return true;
748
-    }
749
-
750
-    function remove_ani_map($id) {
751
-        $this->db->where('id', $id);
752
-        $this->db->delete('ani_map');
753
-        return true;
754
-    }
755
-
756
-    function animap_authentication($where_data, $id) {
757
-        if ($id != "") {
758
-            $this->db->where("id <>", $id);
759
-        }
760
-        $this->db->where($where_data);
761
-        $this->db->from("ani_map");
762
-        $query = $this->db->count_all_results();
763
-        return $query;
764
-    }
765
-    function add_invoice_config($add_array) {
766
-        $result = $this->db->insert('invoice_conf', $add_array);
767
-        return true;
768
-    }
769
-
770
-    function edit_invoice_config($add_array, $edit_id) {
771
-        $this->db->where('id', $edit_id);
772
-        $result = $this->db->update('invoice_conf', $add_array);
773
-        return true;
774
-    }
554
+	function get_reseller_Account_list($flag, $start = 0, $limit = 0, $export = false) {
555
+		$this->db_model->build_search('reseller_list_search');
556
+		$where = array('reseller_id' => "0", "deleted" => "0", "type" => "1");
557
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
558
+			$where['reseller_id'] = $this->session->userdata["accountinfo"]['id'];
559
+		}
560
+		if ($flag) {
561
+			$query = $this->db_model->select("*", "accounts", $where, "number", "desc", $limit, $start);
562
+		} else {
563
+			$query = $this->db_model->countQuery("*", "accounts", $where);
564
+		}
565
+		return $query;
566
+	}
567
+
568
+	function get_provider_Account_list($flag, $start = 0, $limit = 0) {
569
+		$this->db_model->build_search('provider_list_search');
570
+		$where = array("deleted" => "0", "type" => "3", 'reseller_id' => 0);
571
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
572
+			$where['reseller_id'] = $this->session->userdata["accountinfo"]['id'];
573
+		}
574
+		if ($flag) {
575
+			$query = $this->db_model->select("*", "accounts", $where, "number", "desc", $limit, $start);
576
+		} else {
577
+			$query = $this->db_model->countQuery("*", "accounts", $where);
578
+		}
579
+		return $query;
580
+	}
581
+
582
+	function remove_customer($id) {
583
+		$this->db->where("id", $id);
584
+		$this->db->where("type <>", "-1");
585
+		$data = array('deleted' => '1');
586
+		$this->db->update("accounts", $data);
587
+		return true;
588
+	}
589
+
590
+	function insert_block($data, $accountid) {
591
+		$data = explode(",", $data);
592
+		$tmp = array();
593
+		if (!empty($data)) {
594
+			foreach ($data as $key => $data_value) {
595
+				$tmp[$key]["accountid"] = $accountid;
596
+				$result = $this->get_pattern_by_id($data_value);
597
+				$tmp[$key]["blocked_patterns"] = $result[0]['pattern'];
598
+				$tmp[$key]["destination"] = $result[0]['comment'];
599
+			}
600
+			return $this->db->insert_batch("block_patterns", $tmp);
601
+		}
602
+	}
603
+
604
+	function get_pattern_by_id($pattern) {
605
+		$patterns = $this->db_model->getSelect("pattern,comment", "routes", array("id" => $pattern));
606
+		$patterns_value = $patterns->result_array();
607
+		return $patterns_value;
608
+	}
609
+
610
+	function get_callerid($account_id) {
611
+		$query = $this->db_model->getSelect("*", "accounts_callerid", array("accountid" => $account_id));
612
+		return $query;
613
+	}
614
+
615
+	function get_account_number($accountid) {
616
+		$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;
621
+	}
622
+
623
+	function add_callerid($data) {
624
+		unset($data['action'],$data['flag']);
625
+		$data['accountid'] = $this->common->get_field_name('id', 'accounts', array('number' => $data['accountid']));
626
+		$this->db->insert('accounts_callerid', $data);
627
+		return true;
628
+	}
629
+
630
+	function edit_callerid($data) {
631
+		unset($data['action']);
632
+		unset($data['flag']);
633
+		$data['accountid'] = $this->common->get_field_name('id', 'accounts', array('number' => $data['accountid']));
634
+		$this->db->where('accountid', $data['accountid']);
635
+		$this->db->update('accounts_callerid', $data);
636
+		return true;
637
+	}
638
+
639
+	/**
640
+	 * -------Here we write code for model accounting functions remove_all_account_tax------
641
+	 * for remove all account's taxes enteries from database.
642
+	 */
643
+	function remove_all_account_tax($account_tax) {
644
+		$this->db->where('accountid', $account_tax);
645
+		$this->db->delete('taxes_to_accounts');
646
+		return true;
647
+	}
648
+
649
+	/**
650
+	 * -------Here we write code for model accounting functions add_account_tax------
651
+	 * this function use to insert data for add taxes to account.
652
+	 */
653
+	function add_account_tax($data) {
654
+		$this->db->insert('taxes_to_accounts', $data);
655
+	}
656
+
657
+	/**
658
+	 * -------Here we write code for model accounting functions get_accounttax_by_id------
659
+	 * this function use get the account taxes details as per account number
660
+	 * @account_id = account id
661
+	 */
662
+	function get_accounttax_by_id($account_id) {
663
+		$this->db->where("accountid", trim($account_id));
664
+		$query = $this->db->get("taxes_to_accounts");
665
+		if ($query->num_rows() > 0)
666
+			return $query->result_array();
667
+		else
668
+			return false;
669
+	}
670
+
671
+	/**
672
+	 * -------Here we write code for model accounting functions check_account_num------
673
+	 * this function write to verify the account number is valid or not.
674
+	 * @acc_num = account number
675
+	 */
676
+	function check_account_num($acc_num) {
677
+		$this->db->select('accountid');
678
+		$this->db->where("number", $acc_num);
679
+		$query = $this->db->get("accounts");
680
+
681
+		if ($query->num_rows() > 0)
682
+			return $query->row_array();
683
+		else
684
+			return false;
685
+	}
686
+
687
+	function get_account_by_number($id) {
688
+		$this->db->where("id", $id);
689
+		$query = $this->db->get("accounts");
690
+
691
+		if ($query->num_rows() > 0)
692
+			return $query->row_array();
693
+		else
694
+			return false;
695
+	}
696
+
697
+	function get_currency_by_id($currency_id) {
698
+
699
+		$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;
704
+	}
705
+
706
+
707
+	function update_balance($amount, $accountid, $payment_type) {
708
+		if ($payment_type == 0) {
709
+			$query = 'UPDATE `accounts` SET `balance` = (balance + ' . $amount . ') WHERE `id` = ' . $accountid;
710
+			return $this->db->query($query);
711
+		}if ($payment_type == 1) {
712
+			$query = 'UPDATE `accounts` SET `balance` = (balance - ' . $amount . ') WHERE `id` = ' . $accountid;
713
+			return $this->db->query($query);
714
+		}
715
+	}
716
+
717
+	function account_authentication($where_data, $id) {
718
+		if ($id != "") {
719
+			$this->db->where("id <>", $id);
720
+		}
721
+		$this->db->where($where_data);
722
+		$this->db->from("accounts");
723
+		$query = $this->db->count_all_results();
724
+		return $query;
725
+	}
726
+
727
+	function get_animap($flag, $start, $limit, $id) {
728
+		$where = array('accountid' => $id);
729
+
730
+		if ($flag) {
731
+			$query = $this->db_model->select("*", "ani_map", $where, "number", "DESC", $limit, $start);
732
+		} else {
733
+			$query = $this->db_model->countQuery("*", "ani_map", $where);
734
+		}
735
+		return $query;
736
+	}
737
+
738
+	function add_animap($data) {
739
+		$this->db->insert('ani_map', $data);
740
+		return true;
741
+	}
742
+
743
+	function edit_animap($data, $id) {
744
+		$new_array = array('number' => $data['number'], 'status' => $data['status']);
745
+		$this->db->where('id', $id);
746
+		$this->db->update('ani_map', $new_array);
747
+		return true;
748
+	}
749
+
750
+	function remove_ani_map($id) {
751
+		$this->db->where('id', $id);
752
+		$this->db->delete('ani_map');
753
+		return true;
754
+	}
755
+
756
+	function animap_authentication($where_data, $id) {
757
+		if ($id != "") {
758
+			$this->db->where("id <>", $id);
759
+		}
760
+		$this->db->where($where_data);
761
+		$this->db->from("ani_map");
762
+		$query = $this->db->count_all_results();
763
+		return $query;
764
+	}
765
+	function add_invoice_config($add_array) {
766
+		$result = $this->db->insert('invoice_conf', $add_array);
767
+		return true;
768
+	}
769
+
770
+	function edit_invoice_config($add_array, $edit_id) {
771
+		$this->db->where('id', $edit_id);
772
+		$result = $this->db->update('invoice_conf', $add_array);
773
+		return true;
774
+	}
775 775
 
776 776
 }
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 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'],
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 			  'payment_by'=>$data['payment_by'],
464 464
 		  );
465 465
 		  $this->db->insert("payments", $insert_arr);
466
-		}else{ 
467
-		  $balance = $this->update_balance($data['credit'], $data['accountid'],$data['payment_mode']);
466
+		} else { 
467
+		  $balance = $this->update_balance($data['credit'], $data['accountid'], $data['payment_mode']);
468 468
 		  $insert_arr = array("accountid" => $data['accountid'],
469 469
 			  "credit" => $data['credit'],
470 470
 			  '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   +37 added lines, -31 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) {
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 			  'payment_by'=>$data['payment_by'],
464 464
 		  );
465 465
 		  $this->db->insert("payments", $insert_arr);
466
-		}else{ 
466
+		} else{ 
467 467
 		  $balance = $this->update_balance($data['credit'], $data['accountid'],$data['payment_mode']);
468 468
 		  $insert_arr = array("accountid" => $data['accountid'],
469 469
 			  "credit" => $data['credit'],
@@ -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/charges/controllers/charges.php 3 patches
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -24,177 +24,177 @@
 block discarded – undo
24 24
 
25 25
 class Charges extends MX_Controller {
26 26
 
27
-    function Charges() {
28
-        parent::__construct();
29
-
30
-        $this->load->helper('template_inheritance');
31
-
32
-        $this->load->library('session');
33
-        $this->load->library("charges_form");
34
-        $this->load->library('astpp/form');
35
-        $this->load->model('charges_model');
36
-
37
-        if ($this->session->userdata('user_login') == FALSE)
38
-            redirect(base_url() . '/astpp/login');
39
-    }
40
-
41
-    function periodiccharges_add() {
42
-        $data['username'] = $this->session->userdata('user_name');
43
-        $data['flag'] = 'create';
44
-        $data['page_title'] = 'Create Subscription';
45
-        $data['form'] = $this->form->build_form($this->charges_form->get_charge_form_fields(), '');
46
-        $this->load->view('view_periodiccharges_add_edit', $data);
47
-    }
48
-
49
-    function periodiccharges_edit($edit_id = '') {
50
-        $data['page_title'] = 'Edit Subscription ';
51
-        $where = array('id' => $edit_id);
52
-        $account = $this->db_model->getSelect("*", "charges", $where);
53
-        foreach ($account->result_array() as $key => $value) {
54
-            $edit_data = $value;
55
-        }
56
-        $edit_data['charge'] = $this->common_model->to_calculate_currency($edit_data['charge'], '', '', true, false);
27
+	function Charges() {
28
+		parent::__construct();
29
+
30
+		$this->load->helper('template_inheritance');
31
+
32
+		$this->load->library('session');
33
+		$this->load->library("charges_form");
34
+		$this->load->library('astpp/form');
35
+		$this->load->model('charges_model');
36
+
37
+		if ($this->session->userdata('user_login') == FALSE)
38
+			redirect(base_url() . '/astpp/login');
39
+	}
40
+
41
+	function periodiccharges_add() {
42
+		$data['username'] = $this->session->userdata('user_name');
43
+		$data['flag'] = 'create';
44
+		$data['page_title'] = 'Create Subscription';
45
+		$data['form'] = $this->form->build_form($this->charges_form->get_charge_form_fields(), '');
46
+		$this->load->view('view_periodiccharges_add_edit', $data);
47
+	}
48
+
49
+	function periodiccharges_edit($edit_id = '') {
50
+		$data['page_title'] = 'Edit Subscription ';
51
+		$where = array('id' => $edit_id);
52
+		$account = $this->db_model->getSelect("*", "charges", $where);
53
+		foreach ($account->result_array() as $key => $value) {
54
+			$edit_data = $value;
55
+		}
56
+		$edit_data['charge'] = $this->common_model->to_calculate_currency($edit_data['charge'], '', '', true, false);
57 57
         
58
-        $data['form'] = $this->form->build_form($this->charges_form->get_charge_form_fields(), $edit_data);
59
-        $this->load->view('view_periodiccharges_add_edit', $data);
60
-    }
61
-
62
-    function periodiccharges_save() {
63
-        $add_array = $this->input->post();
64
-        $data['form'] = $this->form->build_form($this->charges_form->get_charge_form_fields(), $add_array);
65
-        if ($add_array['id'] != '') {
66
-            $data['page_title'] = 'Edit Subscription';
67
-            if ($this->form_validation->run() == FALSE) {
68
-                $data['validation_errors'] = validation_errors();
69
-                echo $data['validation_errors'];
70
-                exit;
71
-            } else {
72
-                if ($add_array['pricelist_id'] == '') {
73
-                    $add_array['pricelist_id'] = '0';
74
-                }
75
-                $add_array['charge'] = $this->common_model->add_calculate_currency($add_array['charge'], '', '', false, false);
76
-                $this->charges_model->edit_charge($add_array, $add_array['id']);
58
+		$data['form'] = $this->form->build_form($this->charges_form->get_charge_form_fields(), $edit_data);
59
+		$this->load->view('view_periodiccharges_add_edit', $data);
60
+	}
61
+
62
+	function periodiccharges_save() {
63
+		$add_array = $this->input->post();
64
+		$data['form'] = $this->form->build_form($this->charges_form->get_charge_form_fields(), $add_array);
65
+		if ($add_array['id'] != '') {
66
+			$data['page_title'] = 'Edit Subscription';
67
+			if ($this->form_validation->run() == FALSE) {
68
+				$data['validation_errors'] = validation_errors();
69
+				echo $data['validation_errors'];
70
+				exit;
71
+			} else {
72
+				if ($add_array['pricelist_id'] == '') {
73
+					$add_array['pricelist_id'] = '0';
74
+				}
75
+				$add_array['charge'] = $this->common_model->add_calculate_currency($add_array['charge'], '', '', false, false);
76
+				$this->charges_model->edit_charge($add_array, $add_array['id']);
77 77
                 
78
-                if($add_array['pricelist_id'] > 0){
79
-                   $this->charges_model->add_account_charges($add_array['pricelist_id'],$add_array['id'],true);
80
-                }                
81
-                echo json_encode(array("SUCCESS"=> $add_array["description"]." subscription updated successfully!"));
82
-                exit;
83
-            }
84
-        } else {
85
-            $data['page_title'] = 'Add Subscription';
86
-            if ($this->form_validation->run() == FALSE) {
87
-                $data['validation_errors'] = validation_errors();
88
-                echo $data['validation_errors'];
89
-                exit;
90
-            } else {
91
-                $add_array['charge'] = $this->common_model->add_calculate_currency($add_array['charge'], '', '', false, false);
92
-                $charge_id = $this->charges_model->add_charge($add_array);
93
-                if($add_array['pricelist_id'] > 0 && $charge_id > 0){
94
-                   $this->charges_model->add_account_charges($add_array['pricelist_id'],$charge_id,false);
95
-                }                  
96
-                echo json_encode(array("SUCCESS"=> $add_array["description"]." subscription added successfully!"));
97
-                exit;
98
-            }
99
-        }
100
-    }
101
-
102
-
103
-
104
-    function periodiccharges_delete($id) {
105
-        $this->charges_model->remove_charge($id);
106
-        $this->session->set_flashdata('astpp_notification', 'Subscription removed successfully!');
107
-        redirect(base_url() . 'charges/periodiccharges/');
108
-    }
109
-
110
-    function periodiccharges_search() {
111
-        $ajax_search = $this->input->post('ajax_search', 0);
112
-        if ($this->input->post('advance_search', TRUE) == 1) {
113
-            $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
114
-            $action = $this->input->post();
115
-            unset($action['action']);
116
-            unset($action['advance_search']);
117
-            if (isset($action['charge']['charge']) && $action['charge']['charge'] != '') {
118
-                $action['charge']['charge'] = $this->common_model->add_calculate_currency($action['charge']['charge'], "", '', true, false);
119
-            }
120
-            $this->session->set_userdata('charges_list_search', $action);
121
-        }
122
-        if (@$ajax_search != 1) {
123
-            redirect(base_url() . 'charges/periodiccharges/');
124
-        }
125
-    }
126
-
127
-    function periodiccharges_clearsearchfilter() {
128
-        $this->session->set_userdata('advance_search', 0);
129
-        $this->session->set_userdata('charges_list_search', "");
130
-    }
131
-
132
-    function periodiccharges() {
133
-        $data['username'] = $this->session->userdata('user_name');
134
-        $data['page_title'] = 'Subscriptions';
135
-        $data['search_flag'] = true;
136
-        $this->session->set_userdata('advance_search', 0);
137
-        $data['grid_fields'] = $this->charges_form->build_charge_list_for_admin();
138
-        $data["grid_buttons"] = $this->charges_form->build_grid_buttons();
139
-        $data['form_search'] = $this->form->build_serach_form($this->charges_form->get_charges_search_form());
140
-
141
-        $this->load->view('view_charges_list', $data);
142
-    }
143
-
144
-    /**
145
-     * -------Here we write code for controller accounts functions account_list------
146
-     * Listing of Accounts table data through php function json_encode
147
-     */
148
-    function periodiccharges_json() {
149
-        $json_data = array();
150
-        $count_all = $this->charges_model->getcharges_list(false);
151
-        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
152
-        $json_data = $paging_data["json_paging"];
153
-        $query = $this->charges_model->getcharges_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
154
-        $grid_fields = json_decode($this->charges_form->build_charge_list_for_admin());
155
-        $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
156
-
157
-        echo json_encode($json_data);
158
-    }
159
-
160
-    function periodiccharges_delete_multiple() {
161
-        $ids = $this->input->post("selected_ids", true);
162
-        $where = "id IN ($ids)";
163
-        $charge_where="charge_id IN(".$ids.")";
164
-        $this->db->delete('charge_to_account',$charge_where);
165
-        echo $this->db->delete("charges",$where);
166
-    }
167
-    function customer_charge_list($accountid, $accounttype) {
78
+				if($add_array['pricelist_id'] > 0){
79
+				   $this->charges_model->add_account_charges($add_array['pricelist_id'],$add_array['id'],true);
80
+				}                
81
+				echo json_encode(array("SUCCESS"=> $add_array["description"]." subscription updated successfully!"));
82
+				exit;
83
+			}
84
+		} else {
85
+			$data['page_title'] = 'Add Subscription';
86
+			if ($this->form_validation->run() == FALSE) {
87
+				$data['validation_errors'] = validation_errors();
88
+				echo $data['validation_errors'];
89
+				exit;
90
+			} else {
91
+				$add_array['charge'] = $this->common_model->add_calculate_currency($add_array['charge'], '', '', false, false);
92
+				$charge_id = $this->charges_model->add_charge($add_array);
93
+				if($add_array['pricelist_id'] > 0 && $charge_id > 0){
94
+				   $this->charges_model->add_account_charges($add_array['pricelist_id'],$charge_id,false);
95
+				}                  
96
+				echo json_encode(array("SUCCESS"=> $add_array["description"]." subscription added successfully!"));
97
+				exit;
98
+			}
99
+		}
100
+	}
101
+
102
+
103
+
104
+	function periodiccharges_delete($id) {
105
+		$this->charges_model->remove_charge($id);
106
+		$this->session->set_flashdata('astpp_notification', 'Subscription removed successfully!');
107
+		redirect(base_url() . 'charges/periodiccharges/');
108
+	}
109
+
110
+	function periodiccharges_search() {
111
+		$ajax_search = $this->input->post('ajax_search', 0);
112
+		if ($this->input->post('advance_search', TRUE) == 1) {
113
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
114
+			$action = $this->input->post();
115
+			unset($action['action']);
116
+			unset($action['advance_search']);
117
+			if (isset($action['charge']['charge']) && $action['charge']['charge'] != '') {
118
+				$action['charge']['charge'] = $this->common_model->add_calculate_currency($action['charge']['charge'], "", '', true, false);
119
+			}
120
+			$this->session->set_userdata('charges_list_search', $action);
121
+		}
122
+		if (@$ajax_search != 1) {
123
+			redirect(base_url() . 'charges/periodiccharges/');
124
+		}
125
+	}
126
+
127
+	function periodiccharges_clearsearchfilter() {
128
+		$this->session->set_userdata('advance_search', 0);
129
+		$this->session->set_userdata('charges_list_search', "");
130
+	}
131
+
132
+	function periodiccharges() {
133
+		$data['username'] = $this->session->userdata('user_name');
134
+		$data['page_title'] = 'Subscriptions';
135
+		$data['search_flag'] = true;
136
+		$this->session->set_userdata('advance_search', 0);
137
+		$data['grid_fields'] = $this->charges_form->build_charge_list_for_admin();
138
+		$data["grid_buttons"] = $this->charges_form->build_grid_buttons();
139
+		$data['form_search'] = $this->form->build_serach_form($this->charges_form->get_charges_search_form());
140
+
141
+		$this->load->view('view_charges_list', $data);
142
+	}
143
+
144
+	/**
145
+	 * -------Here we write code for controller accounts functions account_list------
146
+	 * Listing of Accounts table data through php function json_encode
147
+	 */
148
+	function periodiccharges_json() {
149
+		$json_data = array();
150
+		$count_all = $this->charges_model->getcharges_list(false);
151
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
152
+		$json_data = $paging_data["json_paging"];
153
+		$query = $this->charges_model->getcharges_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
154
+		$grid_fields = json_decode($this->charges_form->build_charge_list_for_admin());
155
+		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
156
+
157
+		echo json_encode($json_data);
158
+	}
159
+
160
+	function periodiccharges_delete_multiple() {
161
+		$ids = $this->input->post("selected_ids", true);
162
+		$where = "id IN ($ids)";
163
+		$charge_where="charge_id IN(".$ids.")";
164
+		$this->db->delete('charge_to_account',$charge_where);
165
+		echo $this->db->delete("charges",$where);
166
+	}
167
+	function customer_charge_list($accountid, $accounttype) {
168 168
 	
169
-        $json_data = array();
170
-
171
-        $select = "charge_to_account.id,charges.description,charges.charge,charges.sweep_id,charges.pro_rate,charges.creation_date,charges.last_modified_date";
172
-        $table = "charges";
173
-        $jionTable = array('charge_to_account', 'accounts');
174
-        $jionCondition = array('charges.id = charge_to_account.charge_id', 'accounts.id = charge_to_account.accountid');
175
-        $type = array('left', 'inner');
176
-        $where = array('accounts.id' => $accountid);
177
-        $order_type = 'id';
178
-        $order_by = "ASC";
179
-        $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_subscription'); 
180
-        $like_str=!empty($instant_search) ? "(charges.description like '%$instant_search%'  
169
+		$json_data = array();
170
+
171
+		$select = "charge_to_account.id,charges.description,charges.charge,charges.sweep_id,charges.pro_rate,charges.creation_date,charges.last_modified_date";
172
+		$table = "charges";
173
+		$jionTable = array('charge_to_account', 'accounts');
174
+		$jionCondition = array('charges.id = charge_to_account.charge_id', 'accounts.id = charge_to_account.accountid');
175
+		$type = array('left', 'inner');
176
+		$where = array('accounts.id' => $accountid);
177
+		$order_type = 'id';
178
+		$order_by = "ASC";
179
+		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_subscription'); 
180
+		$like_str=!empty($instant_search) ? "(charges.description like '%$instant_search%'  
181 181
                                             OR  charges.charge like '%$instant_search%'
182 182
                                             OR  charges.charge like '%$instant_search%' 
183 183
                                                 )"
184
-                                           :null;
185
-        if(!empty($like_str))
186
-        $this->db->where($like_str);
187
-        $count_all = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type);
188
-        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
189
-        $json_data = $paging_data["json_paging"];
190
-        if(!empty($like_str))
191
-        $this->db->where($like_str);
192
-        $account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $paging_data["paging"]["page_no"], $paging_data["paging"]["start"], $order_by, $order_type, "");
193
-        $grid_fields = json_decode($this->charges_form->build_charges_list_for_customer($accountid, $accounttype));
194
-        $json_data['rows'] = $this->form->build_grid($account_charge_list, $grid_fields);
195
-
196
-        echo json_encode($json_data);
197
-    }
184
+										   :null;
185
+		if(!empty($like_str))
186
+		$this->db->where($like_str);
187
+		$count_all = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type);
188
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
189
+		$json_data = $paging_data["json_paging"];
190
+		if(!empty($like_str))
191
+		$this->db->where($like_str);
192
+		$account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $paging_data["paging"]["page_no"], $paging_data["paging"]["start"], $order_by, $order_type, "");
193
+		$grid_fields = json_decode($this->charges_form->build_charges_list_for_customer($accountid, $accounttype));
194
+		$json_data['rows'] = $this->form->build_grid($account_charge_list, $grid_fields);
195
+
196
+		echo json_encode($json_data);
197
+	}
198 198
 
199 199
 
200 200
     
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $this->load->model('charges_model');
36 36
 
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 periodiccharges_add() {
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
                 $add_array['charge'] = $this->common_model->add_calculate_currency($add_array['charge'], '', '', false, false);
76 76
                 $this->charges_model->edit_charge($add_array, $add_array['id']);
77 77
                 
78
-                if($add_array['pricelist_id'] > 0){
79
-                   $this->charges_model->add_account_charges($add_array['pricelist_id'],$add_array['id'],true);
78
+                if ($add_array['pricelist_id'] > 0) {
79
+                   $this->charges_model->add_account_charges($add_array['pricelist_id'], $add_array['id'], true);
80 80
                 }                
81 81
                 echo json_encode(array("SUCCESS"=> $add_array["description"]." subscription updated successfully!"));
82 82
                 exit;
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
             } else {
91 91
                 $add_array['charge'] = $this->common_model->add_calculate_currency($add_array['charge'], '', '', false, false);
92 92
                 $charge_id = $this->charges_model->add_charge($add_array);
93
-                if($add_array['pricelist_id'] > 0 && $charge_id > 0){
94
-                   $this->charges_model->add_account_charges($add_array['pricelist_id'],$charge_id,false);
93
+                if ($add_array['pricelist_id'] > 0 && $charge_id > 0) {
94
+                   $this->charges_model->add_account_charges($add_array['pricelist_id'], $charge_id, false);
95 95
                 }                  
96 96
                 echo json_encode(array("SUCCESS"=> $add_array["description"]." subscription added successfully!"));
97 97
                 exit;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     function periodiccharges_delete($id) {
105 105
         $this->charges_model->remove_charge($id);
106 106
         $this->session->set_flashdata('astpp_notification', 'Subscription removed successfully!');
107
-        redirect(base_url() . 'charges/periodiccharges/');
107
+        redirect(base_url().'charges/periodiccharges/');
108 108
     }
109 109
 
110 110
     function periodiccharges_search() {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             $this->session->set_userdata('charges_list_search', $action);
121 121
         }
122 122
         if (@$ajax_search != 1) {
123
-            redirect(base_url() . 'charges/periodiccharges/');
123
+            redirect(base_url().'charges/periodiccharges/');
124 124
         }
125 125
     }
126 126
 
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
     function periodiccharges_delete_multiple() {
161 161
         $ids = $this->input->post("selected_ids", true);
162 162
         $where = "id IN ($ids)";
163
-        $charge_where="charge_id IN(".$ids.")";
164
-        $this->db->delete('charge_to_account',$charge_where);
165
-        echo $this->db->delete("charges",$where);
163
+        $charge_where = "charge_id IN(".$ids.")";
164
+        $this->db->delete('charge_to_account', $charge_where);
165
+        echo $this->db->delete("charges", $where);
166 166
     }
167 167
     function customer_charge_list($accountid, $accounttype) {
168 168
 	
@@ -176,18 +176,18 @@  discard block
 block discarded – undo
176 176
         $where = array('accounts.id' => $accountid);
177 177
         $order_type = 'id';
178 178
         $order_by = "ASC";
179
-        $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_subscription'); 
180
-        $like_str=!empty($instant_search) ? "(charges.description like '%$instant_search%'  
179
+        $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_subscription'); 
180
+        $like_str = ! empty($instant_search) ? "(charges.description like '%$instant_search%'  
181 181
                                             OR  charges.charge like '%$instant_search%'
182 182
                                             OR  charges.charge like '%$instant_search%' 
183 183
                                                 )"
184 184
                                            :null;
185
-        if(!empty($like_str))
185
+        if ( ! empty($like_str))
186 186
         $this->db->where($like_str);
187 187
         $count_all = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type);
188 188
         $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
189 189
         $json_data = $paging_data["json_paging"];
190
-        if(!empty($like_str))
190
+        if ( ! empty($like_str))
191 191
         $this->db->where($like_str);
192 192
         $account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $paging_data["paging"]["page_no"], $paging_data["paging"]["start"], $order_by, $order_type, "");
193 193
         $grid_fields = json_decode($this->charges_form->build_charges_list_for_customer($accountid, $accounttype));
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
         $this->load->library('astpp/form');
35 35
         $this->load->model('charges_model');
36 36
 
37
-        if ($this->session->userdata('user_login') == FALSE)
38
-            redirect(base_url() . '/astpp/login');
37
+        if ($this->session->userdata('user_login') == FALSE) {
38
+                    redirect(base_url() . '/astpp/login');
39
+        }
39 40
     }
40 41
 
41 42
     function periodiccharges_add() {
@@ -182,13 +183,15 @@  discard block
 block discarded – undo
182 183
                                             OR  charges.charge like '%$instant_search%' 
183 184
                                                 )"
184 185
                                            :null;
185
-        if(!empty($like_str))
186
-        $this->db->where($like_str);
186
+        if(!empty($like_str)) {
187
+                $this->db->where($like_str);
188
+        }
187 189
         $count_all = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type);
188 190
         $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
189 191
         $json_data = $paging_data["json_paging"];
190
-        if(!empty($like_str))
191
-        $this->db->where($like_str);
192
+        if(!empty($like_str)) {
193
+                $this->db->where($like_str);
194
+        }
192 195
         $account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $paging_data["paging"]["page_no"], $paging_data["paging"]["start"], $order_by, $order_type, "");
193 196
         $grid_fields = json_decode($this->charges_form->build_charges_list_for_customer($accountid, $accounttype));
194 197
         $json_data['rows'] = $this->form->build_grid($account_charge_list, $grid_fields);
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/charges/libraries/charges_form.php 3 patches
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -23,119 +23,119 @@
 block discarded – undo
23 23
 ###############################################################################
24 24
 
25 25
 if (!defined('BASEPATH'))
26
-    exit('No direct script access allowed');
26
+	exit('No direct script access allowed');
27 27
 
28 28
 class Charges_form {
29
-      	function __construct($library_name = '') {
30
-        $this->CI = & get_instance();
31
-    }
29
+	  	function __construct($library_name = '') {
30
+		$this->CI = & get_instance();
31
+	}
32 32
    
33
-    function get_charge_form_fields() {
34
-        $form['forms'] = array(base_url() . 'charges/periodiccharges_save/', array('id' => 'charges_form', 'method' => 'POST', 'name' => 'charges_form'));
35
-        $form['Information'] = array(
36
-            array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
37
-            array('Name', 'INPUT', array('name' => 'description', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
38
-            array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("reseller_id" => "0", "status <>" => "2")),
39
-            array('Amount', 'INPUT', array('name' => 'charge', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|greater_than[0]|currency_decimal|xss_clean', 'tOOL TIP', 'Please Enter account number'),
40
-	    array('Prorate', 'pro_rate', 'SELECT', '', '', 'tOOL TIP', 'Please Select Pro rate', '', '', '', 'set_prorate'),      
41
-	    array('Bill cycle', 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''),
33
+	function get_charge_form_fields() {
34
+		$form['forms'] = array(base_url() . 'charges/periodiccharges_save/', array('id' => 'charges_form', 'method' => 'POST', 'name' => 'charges_form'));
35
+		$form['Information'] = array(
36
+			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
37
+			array('Name', 'INPUT', array('name' => 'description', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
38
+			array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("reseller_id" => "0", "status <>" => "2")),
39
+			array('Amount', 'INPUT', array('name' => 'charge', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|greater_than[0]|currency_decimal|xss_clean', 'tOOL TIP', 'Please Enter account number'),
40
+		array('Prorate', 'pro_rate', 'SELECT', '', '', 'tOOL TIP', 'Please Select Pro rate', '', '', '', 'set_prorate'),      
41
+		array('Bill cycle', 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''),
42 42
 		array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
43
-        );
44
-        $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
45
-        $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
46
-        return $form;
47
-    }
43
+		);
44
+		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
45
+		$form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
46
+		return $form;
47
+	}
48 48
 
49
-    function get_charges_search_form() {
50
-    $logintype = $this->CI->session->userdata('logintype');
51
-        if ($logintype == 1 || $logintype == 5) {
52
-            $account_data = $this->CI->session->userdata("accountinfo");
53
-            $loginid = $account_data['id'];
49
+	function get_charges_search_form() {
50
+	$logintype = $this->CI->session->userdata('logintype');
51
+		if ($logintype == 1 || $logintype == 5) {
52
+			$account_data = $this->CI->session->userdata("accountinfo");
53
+			$loginid = $account_data['id'];
54 54
 
55
-        }else{
56
-            $loginid = "0";
57
-        }
58
-        $form['forms'] = array("", array('id' => "charges_search"));
59
-        $form['Search'] = array(
60
-            array('Name', 'INPUT', array('name' => 'description[description]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''),
61
-            array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array('status'=>0,'reseller_id'=>$loginid)),
55
+		}else{
56
+			$loginid = "0";
57
+		}
58
+		$form['forms'] = array("", array('id' => "charges_search"));
59
+		$form['Search'] = array(
60
+			array('Name', 'INPUT', array('name' => 'description[description]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''),
61
+			array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array('status'=>0,'reseller_id'=>$loginid)),
62 62
 			array('Amount', 'INPUT', array('name' => 'charge[charge]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'charge[charge-integer]', '', '', '', 'search_int_type', ''),
63 63
 			array('Billing Cycle', 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), 
64 64
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'),
65 65
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
66
-            array('', 'HIDDEN', 'advance_search', '1', '', '', '')
67
-        );
68
-        $form['button_search'] = array('name' => 'action', 'id' => "charges_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
69
-        $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
66
+			array('', 'HIDDEN', 'advance_search', '1', '', '', '')
67
+		);
68
+		$form['button_search'] = array('name' => 'action', 'id' => "charges_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
69
+		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
70 70
 
71
-        return $form;
72
-    }
73
-    /**
71
+		return $form;
72
+	}
73
+	/**
74 74
      ASTPP  3.0 
75 75
      Change size of grind 
76
-    **/
77
-    function build_charge_list_for_admin() {
76
+	 **/
77
+	function build_charge_list_for_admin() {
78 78
 		
79 79
 		  $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
80
-    $currency_id=$account_info['currency_id'];
81
-     $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
80
+	$currency_id=$account_info['currency_id'];
81
+	 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
82 82
 		
83
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
84
-        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
83
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
84
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
85 85
 /**
86 86
 ASTPP  3.0 
87 87
 For DID edit on DID number
88 88
 **/
89
-	    array(gettext("Name"), "140", "description", "", "", "","EDITABLE","true","center"),
89
+		array(gettext("Name"), "140", "description", "", "", "","EDITABLE","true","center"),
90 90
 /**************************************************/
91
-            array(gettext("Rate Group"), "140", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
92
-            array("Amount($currency)", "125", "charge", "charge", "charge", "convert_to_currency","","true","right"),
93
-            array(gettext("Prorate"), "125", "pro_rate", "pro_rate", "charges", "get_prorate","","true","center"),
94
-            array(gettext("Billing Cycle"), "130", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"),
95
-            /**
91
+			array(gettext("Rate Group"), "140", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
92
+			array("Amount($currency)", "125", "charge", "charge", "charge", "convert_to_currency","","true","right"),
93
+			array(gettext("Prorate"), "125", "pro_rate", "pro_rate", "charges", "get_prorate","","true","center"),
94
+			array(gettext("Billing Cycle"), "130", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"),
95
+			/**
96 96
 	    ASTPP  3.0 
97 97
 	    Show Creation date,last_modified date in reseller grid with admin login
98
-            **/
99
-            array(gettext("Status"), "125", "status", "status", "charges", "get_status","","true","center"),
100
-            array(gettext("Created Date"), "150", "creation_date", "", "", "","","true","center"),
101
-             array(gettext("Modified Date"), "150", "last_modified_date", "", "", "","","true","center"),
102
-            /************************************************/
103
-           /*
98
+			 **/
99
+			array(gettext("Status"), "125", "status", "status", "charges", "get_status","","true","center"),
100
+			array(gettext("Created Date"), "150", "creation_date", "", "", "","","true","center"),
101
+			 array(gettext("Modified Date"), "150", "last_modified_date", "", "", "","","true","center"),
102
+			/************************************************/
103
+		   /*
104 104
             ASTPP  3.0 
105 105
             change status active or inactive.
106 106
             */
107 107
             
108
-            /***********************************************/
109
-            array("Action", "150", "", "", "", array("EDIT" => array("url" => "charges/periodiccharges_edit/", "mode" => "popup", 'popup'),
110
-                    "DELETE" => array("url" => "charges/periodiccharges_delete/", "mode" => "single")))
111
-                ));
112
-        return $grid_field_arr;
113
-    }
114
-    /********************************************/
108
+			/***********************************************/
109
+			array("Action", "150", "", "", "", array("EDIT" => array("url" => "charges/periodiccharges_edit/", "mode" => "popup", 'popup'),
110
+					"DELETE" => array("url" => "charges/periodiccharges_delete/", "mode" => "single")))
111
+				));
112
+		return $grid_field_arr;
113
+	}
114
+	/********************************************/
115 115
 
116
-    function build_grid_buttons() {
117
-        $buttons_json = json_encode(array(array("Create" , "btn btn-line-warning btn" , "fa fa-plus-circle fa-lg", "button_action", "/charges/periodiccharges_add/", "popup"),
118
-            array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg",  "button_action", "/charges/periodiccharges_delete_multiple/")
119
-            ));
120
-        return $buttons_json;
121
-    }
116
+	function build_grid_buttons() {
117
+		$buttons_json = json_encode(array(array("Create" , "btn btn-line-warning btn" , "fa fa-plus-circle fa-lg", "button_action", "/charges/periodiccharges_add/", "popup"),
118
+			array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg",  "button_action", "/charges/periodiccharges_delete_multiple/")
119
+			));
120
+		return $buttons_json;
121
+	}
122 122
    
123
-    function build_charges_list_for_customer($accountid, $accounttype) {
123
+	function build_charges_list_for_customer($accountid, $accounttype) {
124 124
 		
125 125
 		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
126 126
 		$currency_id=$account_info['currency_id'];
127 127
 		$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);		
128 128
 		
129
-        $grid_field_arr = json_encode(array(array("Name", "140", "description", "", "", "","","true","center"),
130
-            array("Amount($currency)", "140", "charge", "charge", "charge", "convert_to_currency","","true","right"),
131
-            array("Prorate", "125", "pro_rate", "pro_rate", "charges", "get_prorate","","true","center"),
132
-            array("Billing Cycle", "170", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"),
133
-            array("Created Date", "150", "creation_date", "", "", "","","true","center"),
134
-             array("Modified Date", "150", "last_modified_date", "", "", "","","true","center"),
135
-            array("Action", "150", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_subscription_action/delete/$accountid/$accounttype/", "mode" => "single")))
136
-                ));
137
-        return $grid_field_arr;
138
-    }   
129
+		$grid_field_arr = json_encode(array(array("Name", "140", "description", "", "", "","","true","center"),
130
+			array("Amount($currency)", "140", "charge", "charge", "charge", "convert_to_currency","","true","right"),
131
+			array("Prorate", "125", "pro_rate", "pro_rate", "charges", "get_prorate","","true","center"),
132
+			array("Billing Cycle", "170", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"),
133
+			array("Created Date", "150", "creation_date", "", "", "","","true","center"),
134
+			 array("Modified Date", "150", "last_modified_date", "", "", "","","true","center"),
135
+			array("Action", "150", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_subscription_action/delete/$accountid/$accounttype/", "mode" => "single")))
136
+				));
137
+		return $grid_field_arr;
138
+	}   
139 139
 
140 140
 }
141 141
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 23
 ###############################################################################
24 24
 
25
-if (!defined('BASEPATH'))
25
+if ( ! defined('BASEPATH'))
26 26
     exit('No direct script access allowed');
27 27
 
28 28
 class Charges_form {
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     }
32 32
    
33 33
     function get_charge_form_fields() {
34
-        $form['forms'] = array(base_url() . 'charges/periodiccharges_save/', array('id' => 'charges_form', 'method' => 'POST', 'name' => 'charges_form'));
34
+        $form['forms'] = array(base_url().'charges/periodiccharges_save/', array('id' => 'charges_form', 'method' => 'POST', 'name' => 'charges_form'));
35 35
         $form['Information'] = array(
36 36
             array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
37 37
             array('Name', 'INPUT', array('name' => 'description', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
             $account_data = $this->CI->session->userdata("accountinfo");
53 53
             $loginid = $account_data['id'];
54 54
 
55
-        }else{
55
+        } else {
56 56
             $loginid = "0";
57 57
         }
58 58
         $form['forms'] = array("", array('id' => "charges_search"));
59 59
         $form['Search'] = array(
60 60
             array('Name', 'INPUT', array('name' => 'description[description]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''),
61
-            array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array('status'=>0,'reseller_id'=>$loginid)),
61
+            array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array('status'=>0, 'reseller_id'=>$loginid)),
62 62
 			array('Amount', 'INPUT', array('name' => 'charge[charge]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'charge[charge-integer]', '', '', '', 'search_int_type', ''),
63 63
 			array('Billing Cycle', 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), 
64 64
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'),
@@ -77,28 +77,28 @@  discard block
 block discarded – undo
77 77
     function build_charge_list_for_admin() {
78 78
 		
79 79
 		  $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
80
-    $currency_id=$account_info['currency_id'];
81
-     $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
80
+    $currency_id = $account_info['currency_id'];
81
+     $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
82 82
 		
83 83
         // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
84
-        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
84
+        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
85 85
 /**
86 86
 ASTPP  3.0 
87 87
 For DID edit on DID number
88 88
 **/
89
-	    array(gettext("Name"), "140", "description", "", "", "","EDITABLE","true","center"),
89
+	    array(gettext("Name"), "140", "description", "", "", "", "EDITABLE", "true", "center"),
90 90
 /**************************************************/
91
-            array(gettext("Rate Group"), "140", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
92
-            array("Amount($currency)", "125", "charge", "charge", "charge", "convert_to_currency","","true","right"),
93
-            array(gettext("Prorate"), "125", "pro_rate", "pro_rate", "charges", "get_prorate","","true","center"),
94
-            array(gettext("Billing Cycle"), "130", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"),
91
+            array(gettext("Rate Group"), "140", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
92
+            array("Amount($currency)", "125", "charge", "charge", "charge", "convert_to_currency", "", "true", "right"),
93
+            array(gettext("Prorate"), "125", "pro_rate", "pro_rate", "charges", "get_prorate", "", "true", "center"),
94
+            array(gettext("Billing Cycle"), "130", "sweep_id", "sweep", "sweeplist", "get_field_name", "", "true", "center"),
95 95
             /**
96 96
 	    ASTPP  3.0 
97 97
 	    Show Creation date,last_modified date in reseller grid with admin login
98 98
             **/
99
-            array(gettext("Status"), "125", "status", "status", "charges", "get_status","","true","center"),
100
-            array(gettext("Created Date"), "150", "creation_date", "", "", "","","true","center"),
101
-             array(gettext("Modified Date"), "150", "last_modified_date", "", "", "","","true","center"),
99
+            array(gettext("Status"), "125", "status", "status", "charges", "get_status", "", "true", "center"),
100
+            array(gettext("Created Date"), "150", "creation_date", "", "", "", "", "true", "center"),
101
+             array(gettext("Modified Date"), "150", "last_modified_date", "", "", "", "", "true", "center"),
102 102
             /************************************************/
103 103
            /*
104 104
             ASTPP  3.0 
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
     /********************************************/
115 115
 
116 116
     function build_grid_buttons() {
117
-        $buttons_json = json_encode(array(array("Create" , "btn btn-line-warning btn" , "fa fa-plus-circle fa-lg", "button_action", "/charges/periodiccharges_add/", "popup"),
118
-            array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg",  "button_action", "/charges/periodiccharges_delete_multiple/")
117
+        $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/charges/periodiccharges_add/", "popup"),
118
+            array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/charges/periodiccharges_delete_multiple/")
119 119
             ));
120 120
         return $buttons_json;
121 121
     }
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
     function build_charges_list_for_customer($accountid, $accounttype) {
124 124
 		
125 125
 		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
126
-		$currency_id=$account_info['currency_id'];
127
-		$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);		
126
+		$currency_id = $account_info['currency_id'];
127
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);		
128 128
 		
129
-        $grid_field_arr = json_encode(array(array("Name", "140", "description", "", "", "","","true","center"),
130
-            array("Amount($currency)", "140", "charge", "charge", "charge", "convert_to_currency","","true","right"),
131
-            array("Prorate", "125", "pro_rate", "pro_rate", "charges", "get_prorate","","true","center"),
132
-            array("Billing Cycle", "170", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"),
133
-            array("Created Date", "150", "creation_date", "", "", "","","true","center"),
134
-             array("Modified Date", "150", "last_modified_date", "", "", "","","true","center"),
129
+        $grid_field_arr = json_encode(array(array("Name", "140", "description", "", "", "", "", "true", "center"),
130
+            array("Amount($currency)", "140", "charge", "charge", "charge", "convert_to_currency", "", "true", "right"),
131
+            array("Prorate", "125", "pro_rate", "pro_rate", "charges", "get_prorate", "", "true", "center"),
132
+            array("Billing Cycle", "170", "sweep_id", "sweep", "sweeplist", "get_field_name", "", "true", "center"),
133
+            array("Created Date", "150", "creation_date", "", "", "", "", "true", "center"),
134
+             array("Modified Date", "150", "last_modified_date", "", "", "", "", "true", "center"),
135 135
             array("Action", "150", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_subscription_action/delete/$accountid/$accounttype/", "mode" => "single")))
136 136
                 ));
137 137
         return $grid_field_arr;
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 23
 ###############################################################################
24 24
 
25
-if (!defined('BASEPATH'))
26
-    exit('No direct script access allowed');
25
+if (!defined('BASEPATH')) {
26
+    exit('No direct script access allowed');
27
+}
27 28
 
28 29
 class Charges_form {
29 30
       	function __construct($library_name = '') {
@@ -52,7 +53,7 @@  discard block
 block discarded – undo
52 53
             $account_data = $this->CI->session->userdata("accountinfo");
53 54
             $loginid = $account_data['id'];
54 55
 
55
-        }else{
56
+        } else{
56 57
             $loginid = "0";
57 58
         }
58 59
         $form['forms'] = array("", array('id' => "charges_search"));
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/charges/views/view_charges_list.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@
 block discarded – undo
19 19
         
20 20
     });
21 21
 </script>
22
- <script src="<?php echo base_url();?>assets/demo/sh/shBrushJScript.js"></script>   
23
- <script src="<?php echo base_url();?>assets/demo/sh/shCore.js"></script>   
24
- <script src="<?php echo base_url();?>assets/demo/jquery.searchabledropdown-1.0.8.src.js"></script>  
22
+ <script src="<?php echo base_url(); ?>assets/demo/sh/shBrushJScript.js"></script>   
23
+ <script src="<?php echo base_url(); ?>assets/demo/sh/shCore.js"></script>   
24
+ <script src="<?php echo base_url(); ?>assets/demo/jquery.searchabledropdown-1.0.8.src.js"></script>  
25 25
 
26 26
 
27 27
 <? endblock() ?>
Please login to merge, or discard this patch.