@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | <div class="w-section inverse no-padding margin-t-20"> |
51 | 51 | <div class="w-box dark sign-in-wr box_shadow margin-b-10"> |
52 | 52 | <div class="col-md-12 no-padding"> |
53 | - <? if($this->session->userdata('userlevel_logintype') != '0'){?> |
|
54 | - <a class="col-md-9" href="<?php echo base_url();?>"> |
|
55 | - <img id="logo" alt="dashboard" src="<?php echo base_url();?>assets/images/logo.png"> |
|
56 | - <? } else{?> |
|
57 | - <a class="col-md-9" href="<?php echo base_url();?>"> |
|
58 | - <img id="logo" alt="user_logo" src="<?php echo base_url();?>assets/images/logo.png"> |
|
53 | + <? if ($this->session->userdata('userlevel_logintype') != '0') {?> |
|
54 | + <a class="col-md-9" href="<?php echo base_url(); ?>"> |
|
55 | + <img id="logo" alt="dashboard" src="<?php echo base_url(); ?>assets/images/logo.png"> |
|
56 | + <? } else {?> |
|
57 | + <a class="col-md-9" href="<?php echo base_url(); ?>"> |
|
58 | + <img id="logo" alt="user_logo" src="<?php echo base_url(); ?>assets/images/logo.png"> |
|
59 | 59 | <? }?> |
60 | 60 | </a> |
61 | 61 | |
62 | - <div class="col-md-3"><a href="<?php echo base_url();?>"><input type="submit" value="Login" name="Login" class="btn btn-success col-md-12 margin-t-10"></a></div> |
|
62 | + <div class="col-md-3"><a href="<?php echo base_url(); ?>"><input type="submit" value="Login" name="Login" class="btn btn-success col-md-12 margin-t-10"></a></div> |
|
63 | 63 | |
64 | 64 | |
65 | 65 | </div> |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | <form class="form-light col-md-12 no-padding" action="<?php echo base_url(); ?>confirmpass" method="post" accept-charset="utf-8" id="customer_form" name="customer_form"> |
70 | 70 | |
71 | -<input type="hidden" name="email" value=<?php echo $email;?>> |
|
71 | +<input type="hidden" name="email" value=<?php echo $email; ?>> |
|
72 | 72 | |
73 | 73 | <div class="col-md-12 margin-t-20 padding-r-32 padding-l-32"> |
74 | 74 | <h3 style="color: #173D77 !important; padding: 0 0 10px;border-bottom: 1px solid #ddd;">Enter Your Password</h3> |
@@ -77,16 +77,16 @@ discard block |
||
77 | 77 | <div class="col-md-12 margin-t-20 padding-r-32 padding-l-32"> |
78 | 78 | <label class="col-md-5 no-padding" style="text-align: left;">Password</label> |
79 | 79 | <div class="col-md-7 no-padding"> |
80 | -<input type="text" name="password" required value="<?php if(isset($value['password'])) echo $value['password']; else '';?>" id="password" size="15" maxlength="40" class="form-control" /> |
|
81 | -<div class='error-style col-md-12 no-padding' style='color:red; font-size: 13px;' id="une"><?php if(isset($error['password'])) echo $error['password'];?></div> |
|
80 | +<input type="text" name="password" required value="<?php if (isset($value['password'])) echo $value['password']; else ''; ?>" id="password" size="15" maxlength="40" class="form-control" /> |
|
81 | +<div class='error-style col-md-12 no-padding' style='color:red; font-size: 13px;' id="une"><?php if (isset($error['password'])) echo $error['password']; ?></div> |
|
82 | 82 | </div> |
83 | 83 | </div> |
84 | 84 | |
85 | 85 | <div class="col-md-12 margin-t-10 padding-r-32 padding-l-32"> |
86 | 86 | <label class="col-md-5 no-padding" style="text-align: left;">Confirm Password</label> |
87 | 87 | <div class="col-md-7 no-padding"> |
88 | -<input type="text" name="confirmpassword" required value="<?php if(isset($value['confirm_password'])) echo $value['confirm_password']; else '';?>" id="confirm_password" size="15" maxlength="40" class="form-control" /> |
|
89 | -<div class='error-style col-md-12' style='color:red; font-size: 13px;' id="conpas"><?php if(isset($error['confirm_password'])) echo $error['confirm_password'];?></div> |
|
88 | +<input type="text" name="confirmpassword" required value="<?php if (isset($value['confirm_password'])) echo $value['confirm_password']; else ''; ?>" id="confirm_password" size="15" maxlength="40" class="form-control" /> |
|
89 | +<div class='error-style col-md-12' style='color:red; font-size: 13px;' id="conpas"><?php if (isset($error['confirm_password'])) echo $error['confirm_password']; ?></div> |
|
90 | 90 | </div> |
91 | 91 | </div> |
92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | <button name="action" type="submit" value="Submit" class="btn btn-line-parrot col-md-12" onclick="return check_function();" >Submit</button> |
95 | 95 | |
96 | 96 | |
97 | -<!--<div style="color:black" >Already have an account <a style="color:blue" href="<?=base_url();?>"> Log in </a> </div>--> |
|
97 | +<!--<div style="color:black" >Already have an account <a style="color:blue" href="<?=base_url(); ?>"> Log in </a> </div>--> |
|
98 | 98 | |
99 | 99 | </div></form> |
100 | 100 |
@@ -77,16 +77,32 @@ |
||
77 | 77 | <div class="col-md-12 margin-t-20 padding-r-32 padding-l-32"> |
78 | 78 | <label class="col-md-5 no-padding" style="text-align: left;">Password</label> |
79 | 79 | <div class="col-md-7 no-padding"> |
80 | -<input type="text" name="password" required value="<?php if(isset($value['password'])) echo $value['password']; else '';?>" id="password" size="15" maxlength="40" class="form-control" /> |
|
81 | -<div class='error-style col-md-12 no-padding' style='color:red; font-size: 13px;' id="une"><?php if(isset($error['password'])) echo $error['password'];?></div> |
|
80 | +<input type="text" name="password" required value="<?php if(isset($value['password'])) { |
|
81 | + echo $value['password']; |
|
82 | +} else { |
|
83 | + ''; |
|
84 | +} |
|
85 | +?>" id="password" size="15" maxlength="40" class="form-control" /> |
|
86 | +<div class='error-style col-md-12 no-padding' style='color:red; font-size: 13px;' id="une"><?php if(isset($error['password'])) { |
|
87 | + echo $error['password']; |
|
88 | +} |
|
89 | +?></div> |
|
82 | 90 | </div> |
83 | 91 | </div> |
84 | 92 | |
85 | 93 | <div class="col-md-12 margin-t-10 padding-r-32 padding-l-32"> |
86 | 94 | <label class="col-md-5 no-padding" style="text-align: left;">Confirm Password</label> |
87 | 95 | <div class="col-md-7 no-padding"> |
88 | -<input type="text" name="confirmpassword" required value="<?php if(isset($value['confirm_password'])) echo $value['confirm_password']; else '';?>" id="confirm_password" size="15" maxlength="40" class="form-control" /> |
|
89 | -<div class='error-style col-md-12' style='color:red; font-size: 13px;' id="conpas"><?php if(isset($error['confirm_password'])) echo $error['confirm_password'];?></div> |
|
96 | +<input type="text" name="confirmpassword" required value="<?php if(isset($value['confirm_password'])) { |
|
97 | + echo $value['confirm_password']; |
|
98 | +} else { |
|
99 | + ''; |
|
100 | +} |
|
101 | +?>" id="confirm_password" size="15" maxlength="40" class="form-control" /> |
|
102 | +<div class='error-style col-md-12' style='color:red; font-size: 13px;' id="conpas"><?php if(isset($error['confirm_password'])) { |
|
103 | + echo $error['confirm_password']; |
|
104 | +} |
|
105 | +?></div> |
|
90 | 106 | </div> |
91 | 107 | </div> |
92 | 108 |
@@ -40,12 +40,12 @@ |
||
40 | 40 | <?php if (isset($astpp_notification)){ ?> |
41 | 41 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
42 | 42 | <?php }else{ |
43 | - echo " "; |
|
44 | - } |
|
43 | + echo " "; |
|
44 | + } |
|
45 | 45 | $astpp_err_msg = $this->session->flashdata('astpp_signupmsg'); |
46 | - if ($astpp_err_msg) { |
|
46 | + if ($astpp_err_msg) { |
|
47 | 47 | echo $astpp_err_msg; |
48 | - } |
|
48 | + } |
|
49 | 49 | ?> |
50 | 50 | </span></div> <br/> |
51 | 51 | <br/><br/><br/><br/> |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | <link href="<?= base_url() ?>assets/css/global-style.css" rel="stylesheet" type="text/css"> |
12 | 12 | |
13 | 13 | <!-- IE --> |
14 | - <script type="text/javascript" src="<?php echo base_url();?>assets/js/respond.js"></script> |
|
15 | - <script type="text/javascript" src="<?php echo base_url();?>assets/js/respond.src.js"></script> |
|
14 | + <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/respond.js"></script> |
|
15 | + <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/respond.src.js"></script> |
|
16 | 16 | <noscript> |
17 | 17 | <div id="noscript-warning"> |
18 | 18 | ASTPP work best with JavaScript enabled |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | <div class="row"> |
38 | 38 | |
39 | 39 | <div class="col-md-4 col-md-offset-4"> <span class="login_error"> |
40 | - <?php if (isset($astpp_notification)){ ?> |
|
40 | + <?php if (isset($astpp_notification)) { ?> |
|
41 | 41 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
42 | - <?php }else{ |
|
42 | + <?php } else { |
|
43 | 43 | echo " "; |
44 | 44 | } |
45 | 45 | $astpp_err_msg = $this->session->flashdata('astpp_signupmsg'); |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | </h2> |
62 | 62 | |
63 | 63 | </div> |
64 | - <div class="margin-t-15 padding-r-32 padding-l-32" style="color: #232222; text-align:left;"><?php echo "We sent update password link. <br>Please check your Email!!<br>";?></div> |
|
64 | + <div class="margin-t-15 padding-r-32 padding-l-32" style="color: #232222; text-align:left;"><?php echo "We sent update password link. <br>Please check your Email!!<br>"; ?></div> |
|
65 | 65 | |
66 | 66 | <div class="margin-b-20 padding-r-32 padding-l-32"> |
67 | 67 | <div class="col-md-12 no-padding"> |
68 | - <a href="<?php echo base_url();?>"> |
|
68 | + <a href="<?php echo base_url(); ?>"> |
|
69 | 69 | <input type="submit" value="Go to Login Page" name="Login" style="border-radius: 3px" class="btn btn-success col-md-12 margin-t-10"> |
70 | 70 | </a> |
71 | 71 | </div> |
@@ -38,7 +38,7 @@ |
||
38 | 38 | <div class="col-md-4 col-md-offset-4"> <span class="login_error"> |
39 | 39 | <?php if (isset($astpp_notification)){ ?> |
40 | 40 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
41 | - <?php }else{ |
|
41 | + <?php } else{ |
|
42 | 42 | echo " "; |
43 | 43 | } ?> |
44 | 44 | </span></div> <br/> |
@@ -98,7 +98,7 @@ |
||
98 | 98 | <?php if (isset($astpp_notification)){ ?> |
99 | 99 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
100 | 100 | <?php }else{ |
101 | - echo " "; |
|
101 | + echo " "; |
|
102 | 102 | } ?> |
103 | 103 | </span> |
104 | 104 | </div> |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | <div class="row"> |
96 | 96 | <div class="col-md-4 col-md-offset-4"> |
97 | 97 | <span class="login_error"> |
98 | - <?php if (isset($astpp_notification)){ ?> |
|
98 | + <?php if (isset($astpp_notification)) { ?> |
|
99 | 99 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
100 | - <?php }else{ |
|
100 | + <?php } else { |
|
101 | 101 | echo " "; |
102 | 102 | } ?> |
103 | 103 | </span> |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | <div class=""> |
114 | 114 | <!-- Header Start--> |
115 | 115 | <div class="col-md-12"> |
116 | - <? if($this->session->userdata('userlevel_logintype') != '0'){?> |
|
117 | - <a class="col-md-10" style="padding:0px 0px 10px 0px" href="<?php echo base_url();?>"> |
|
118 | - <img style="height: 44px;" id="logo" alt="dashboard" src="<?php echo base_url();?>assets/images/logo.png"> |
|
119 | - <? } else{?> |
|
120 | - <a class="col-md-10" style="padding:0px 0px 20px 0px" href="<?php echo base_url();?>"> |
|
121 | - <img style="height: 44px;" id="logo" title='ASTPP - Open Source Voip Billing Solution' alt='ASTPP - Open Source Voip Billing Solution' src="<?php echo base_url();?>assets/images/logo.png"> |
|
116 | + <? if ($this->session->userdata('userlevel_logintype') != '0') {?> |
|
117 | + <a class="col-md-10" style="padding:0px 0px 10px 0px" href="<?php echo base_url(); ?>"> |
|
118 | + <img style="height: 44px;" id="logo" alt="dashboard" src="<?php echo base_url(); ?>assets/images/logo.png"> |
|
119 | + <? } else {?> |
|
120 | + <a class="col-md-10" style="padding:0px 0px 20px 0px" href="<?php echo base_url(); ?>"> |
|
121 | + <img style="height: 44px;" id="logo" title='ASTPP - Open Source Voip Billing Solution' alt='ASTPP - Open Source Voip Billing Solution' src="<?php echo base_url(); ?>assets/images/logo.png"> |
|
122 | 122 | <? }?> |
123 | 123 | </a> |
124 | 124 | |
125 | 125 | <div class="col-md-2"> |
126 | - <a href="<?php echo base_url();?>"> |
|
126 | + <a href="<?php echo base_url(); ?>"> |
|
127 | 127 | <input type="submit" value="Login" name="Login" style="border-radius: 2px" class="btn btn-success col-md-12 margin-t-10"> |
128 | 128 | </a> |
129 | 129 | </div> |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | <div class='col-md-9'> |
197 | 197 | <? |
198 | 198 | $js = 'id="country_id"'; |
199 | - $country = form_dropdown(array('id'=>'country_id','name'=>'country_id'), $this->db_model->build_dropdown("id,country", "countrycode", "", ""), '', 'id="country_id"'); |
|
199 | + $country = form_dropdown(array('id'=>'country_id', 'name'=>'country_id'), $this->db_model->build_dropdown("id,country", "countrycode", "", ""), '', 'id="country_id"'); |
|
200 | 200 | echo $country; |
201 | 201 | ?> |
202 | 202 | </div> |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | <label for="Timezone" class="col-md-3 no-padding add_settings" style="text-align: left;">Timezone</label> |
211 | 211 | <div class='col-md-9'> |
212 | 212 | <? |
213 | - $timezone = form_dropdown(array('id'=>'timezone_id','name'=>'timezone_id'), $this->db_model->build_dropdown("id,gmtzone", "timezone", "", ""), '', 'id="timezone_id"'); |
|
213 | + $timezone = form_dropdown(array('id'=>'timezone_id', 'name'=>'timezone_id'), $this->db_model->build_dropdown("id,gmtzone", "timezone", "", ""), '', 'id="timezone_id"'); |
|
214 | 214 | echo $timezone; |
215 | 215 | ?> |
216 | 216 | </div> |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | <label for="Currency" class="col-md-3 no-padding add_settings" style="text-align: left;">Currency</label> |
220 | 220 | <div class='col-md-9'> |
221 | 221 | <? |
222 | - $currency = form_dropdown(array('id'=>'currency_id','name'=>'currency_id'), $this->db_model->build_dropdown("id,currencyname", "currency", "", ""), '', 'id="currency_id"'); |
|
222 | + $currency = form_dropdown(array('id'=>'currency_id', 'name'=>'currency_id'), $this->db_model->build_dropdown("id,currencyname", "currency", "", ""), '', 'id="currency_id"'); |
|
223 | 223 | echo $currency; |
224 | 224 | ?> |
225 | 225 | </div> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | <span class="login_error"> |
98 | 98 | <?php if (isset($astpp_notification)){ ?> |
99 | 99 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
100 | - <?php }else{ |
|
100 | + <?php } else{ |
|
101 | 101 | echo " "; |
102 | 102 | } ?> |
103 | 103 | </span> |
@@ -136,14 +136,24 @@ discard block |
||
136 | 136 | |
137 | 137 | <div class="margin-t-15 padding-r-32 padding-l-32"> |
138 | 138 | |
139 | - <input type="hidden" name="key_unique" value="<?php if (isset($key_unique)) echo $key_unique; else ''; ?>" |
|
139 | + <input type="hidden" name="key_unique" value="<?php if (isset($key_unique)) { |
|
140 | + echo $key_unique; |
|
141 | +} else { |
|
142 | + ''; |
|
143 | +} |
|
144 | +?>" |
|
140 | 145 | id="key_unique" size="15" maxlength="250" class="col-md-5 form-control"/> |
141 | 146 | <div class="col-md-12 no-padding"> |
142 | 147 | |
143 | 148 | <li class="col-md-6 no-padding"> |
144 | 149 | <label class="col-md-3 no-padding" style="text-align: left;">First Name *</label> |
145 | 150 | <div class='col-md-9'> |
146 | - <input type="text" name="first_name" value="<?php if (isset($value['first_name'])) echo $value['first_name']; else ''; ?>" id="first_name" size="15" maxlength="40" class="form-control"/> |
|
151 | + <input type="text" name="first_name" value="<?php if (isset($value['first_name'])) { |
|
152 | + echo $value['first_name']; |
|
153 | +} else { |
|
154 | + ''; |
|
155 | +} |
|
156 | +?>" id="first_name" size="15" maxlength="40" class="form-control"/> |
|
147 | 157 | <div style="width: 97.67%; float: left;text-align: left;"> |
148 | 158 | <span id="f_name" style="color:red;"> </span> |
149 | 159 | </div> |
@@ -152,7 +162,12 @@ discard block |
||
152 | 162 | <li class="col-md-6 no-padding"> |
153 | 163 | <label class="col-md-3 no-padding" style="text-align: left;">Last Name</label> |
154 | 164 | <div class='col-md-9'> |
155 | - <input type="text" name="last_name" id="last_name" value="<?php if (isset($value['last_name'])) echo $value['last_name']; else ''; ?>" size="15" maxlength="40" class="form-control"/> |
|
165 | + <input type="text" name="last_name" id="last_name" value="<?php if (isset($value['last_name'])) { |
|
166 | + echo $value['last_name']; |
|
167 | +} else { |
|
168 | + ''; |
|
169 | +} |
|
170 | +?>" size="15" maxlength="40" class="form-control"/> |
|
156 | 171 | <div style="width: 97.67%; float: left;text-align: left;"> |
157 | 172 | <span id="l_name" style="color:red;"> </span> |
158 | 173 | </div> |
@@ -166,13 +181,23 @@ discard block |
||
166 | 181 | <li class="col-md-6 no-padding"> |
167 | 182 | <label class="col-md-3 no-padding" style="text-align: left;">Company</label> |
168 | 183 | <div class='col-md-9'> |
169 | - <input type="text" id="company_name" name="company_name" value="<?php if (isset($value['company_name'])) echo $value['company_name']; else ''; ?>" maxlength="40" size="15" class="form-control"/> |
|
184 | + <input type="text" id="company_name" name="company_name" value="<?php if (isset($value['company_name'])) { |
|
185 | + echo $value['company_name']; |
|
186 | +} else { |
|
187 | + ''; |
|
188 | +} |
|
189 | +?>" maxlength="40" size="15" class="form-control"/> |
|
170 | 190 | </div> |
171 | 191 | </li> |
172 | 192 | <li class="col-md-6 no-padding"> |
173 | 193 | <label class="col-md-3 no-padding" style="text-align: left;">Telephone</label> |
174 | 194 | <div class='col-md-9'> |
175 | - <input type="text" id="telephone_1" name="telephone_1" value="<?php if (isset($value['telephone_1'])) echo $value['telephone_1']; else ''; ?>" size="15" maxlength="20" class="form-control"/> |
|
195 | + <input type="text" id="telephone_1" name="telephone_1" value="<?php if (isset($value['telephone_1'])) { |
|
196 | + echo $value['telephone_1']; |
|
197 | +} else { |
|
198 | + ''; |
|
199 | +} |
|
200 | +?>" size="15" maxlength="20" class="form-control"/> |
|
176 | 201 | <div style="width: 100%; float: left;text-align: left;"> |
177 | 202 | <span id="phonenumber" style="color:red;"> </span> |
178 | 203 | </div> |
@@ -186,9 +211,17 @@ discard block |
||
186 | 211 | <li class="col-md-6 no-padding"> |
187 | 212 | <label class="col-md-3 no-padding" style="text-align: left;">Email *</label> |
188 | 213 | <div class='col-md-9'> |
189 | - <input type="text" name="email" id="email" value="<?php if (isset($value['email'])) echo $value['email']; else ''; ?>" size="50" maxlength="80" class="form-control"/> |
|
214 | + <input type="text" name="email" id="email" value="<?php if (isset($value['email'])) { |
|
215 | + echo $value['email']; |
|
216 | +} else { |
|
217 | + ''; |
|
218 | +} |
|
219 | +?>" size="50" maxlength="80" class="form-control"/> |
|
190 | 220 | <span id="email_error" style="color:red;"> |
191 | - <div style="width: 100%; float: left;text-align: left;"><?php if (isset($error['email'])) echo $error['email']; ?></div></span> |
|
221 | + <div style="width: 100%; float: left;text-align: left;"><?php if (isset($error['email'])) { |
|
222 | + echo $error['email']; |
|
223 | +} |
|
224 | +?></div></span> |
|
192 | 225 | </div> |
193 | 226 | </li> |
194 | 227 | <li class="col-md-6 no-padding"> |
@@ -229,7 +262,12 @@ discard block |
||
229 | 262 | <li class="col-md-6 no-padding"> |
230 | 263 | <label class="col-md-3 no-padding" style="text-align: left;">Address</label> |
231 | 264 | <div class='col-md-9'> |
232 | - <textarea id="address_1" name="address_1" value="" size="15" maxlength="200" class="form-control"> <?php if (isset($value['address_1'])) echo $value['address_1']; else ''; ?> </textarea> |
|
265 | + <textarea id="address_1" name="address_1" value="" size="15" maxlength="200" class="form-control"> <?php if (isset($value['address_1'])) { |
|
266 | + echo $value['address_1']; |
|
267 | +} else { |
|
268 | + ''; |
|
269 | +} |
|
270 | +?> </textarea> |
|
233 | 271 | </div> |
234 | 272 | </li> |
235 | 273 | <li class="col-md-6 no-padding"> |
@@ -243,7 +281,10 @@ discard block |
||
243 | 281 | <div class="col-md-3 no-padding"></div> |
244 | 282 | <div class='col-md-9 margin-t-10'> |
245 | 283 | <input class='form-control posttoexternal' id="userCaptcha" name="userCaptcha" type="text" autocomplete="off" placeholder="Enter above text"/> |
246 | - <div style="width: 100%; float: left;text-align: left;"><?php if (isset($error['userCaptcha'])) echo $error['userCaptcha']; ?></div> |
|
284 | + <div style="width: 100%; float: left;text-align: left;"><?php if (isset($error['userCaptcha'])) { |
|
285 | + echo $error['userCaptcha']; |
|
286 | +} |
|
287 | +?></div> |
|
247 | 288 | </div> |
248 | 289 | </li> |
249 | 290 | </div> |
@@ -38,12 +38,12 @@ |
||
38 | 38 | <?php if (isset($astpp_notification)){ ?> |
39 | 39 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
40 | 40 | <?php }else{ |
41 | - echo " "; |
|
42 | - } |
|
41 | + echo " "; |
|
42 | + } |
|
43 | 43 | $astpp_err_msg = $this->session->flashdata('astpp_signupmsg'); |
44 | - if ($astpp_err_msg) { |
|
44 | + if ($astpp_err_msg) { |
|
45 | 45 | echo $astpp_err_msg; |
46 | - } |
|
46 | + } |
|
47 | 47 | ?> |
48 | 48 | </span></div> <br/> |
49 | 49 | <br/> |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | <link href="<?= base_url() ?>assets/css/global-style.css" rel="stylesheet" type="text/css"> |
12 | 12 | |
13 | 13 | <!-- IE --> |
14 | - <script type="text/javascript" src="<?php echo base_url();?>assets/js/respond.js"></script> |
|
15 | - <script type="text/javascript" src="<?php echo base_url();?>assets/js/respond.src.js"></script> |
|
14 | + <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/respond.js"></script> |
|
15 | + <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/respond.src.js"></script> |
|
16 | 16 | <noscript> |
17 | 17 | <div id="noscript-warning"> |
18 | 18 | ASTPP work best with JavaScript enabled |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | <div class="row"> |
36 | 36 | |
37 | 37 | <div class="col-md-4 col-md-offset-4"> <span class="login_error"> |
38 | - <?php if (isset($astpp_notification)){ ?> |
|
38 | + <?php if (isset($astpp_notification)) { ?> |
|
39 | 39 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
40 | - <?php }else{ |
|
40 | + <?php } else { |
|
41 | 41 | echo " "; |
42 | 42 | } |
43 | 43 | $astpp_err_msg = $this->session->flashdata('astpp_signupmsg'); |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | |
63 | 63 | </div> |
64 | 64 | <div class="margin-t-15 padding-r-32 padding-l-32"><h2 class="no-padding" style="color:#79c57b;text-align:left;"><i class="fa fa-check-circle"></i> Successful!</h2></div> |
65 | - <div class="margin-t-15 padding-r-32 padding-l-32" style="color: #232222; text-align:left;"><?php echo "Your account has been created successfully!!! <br> Please check your Email!!!";?></div> |
|
65 | + <div class="margin-t-15 padding-r-32 padding-l-32" style="color: #232222; text-align:left;"><?php echo "Your account has been created successfully!!! <br> Please check your Email!!!"; ?></div> |
|
66 | 66 | <div class="margin-b-20 padding-r-32 padding-l-32"> |
67 | 67 | <div class="col-md-12 no-padding"> |
68 | - <a href="<?php echo base_url();?>"> |
|
68 | + <a href="<?php echo base_url(); ?>"> |
|
69 | 69 | <input type="submit" value="Go to Login Page" name="Login" style="border-radius: 3px" class="btn btn-success col-md-12 margin-t-10"> |
70 | 70 | </a> |
71 | 71 | </div> |
@@ -37,7 +37,7 @@ |
||
37 | 37 | <div class="col-md-4 col-md-offset-4"> <span class="login_error"> |
38 | 38 | <?php if (isset($astpp_notification)){ ?> |
39 | 39 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
40 | - <?php }else{ |
|
40 | + <?php } else{ |
|
41 | 41 | echo " "; |
42 | 42 | } |
43 | 43 | $astpp_err_msg = $this->session->flashdata('astpp_signupmsg'); |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | <?php if (isset($astpp_notification)){ ?> |
39 | 39 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
40 | 40 | <?php }else{ |
41 | - echo " "; |
|
42 | - } |
|
41 | + echo " "; |
|
42 | + } |
|
43 | 43 | $astpp_err_msg = $this->session->flashdata('astpp_signupmsg'); |
44 | - if ($astpp_err_msg) { |
|
44 | + if ($astpp_err_msg) { |
|
45 | 45 | echo $astpp_err_msg; |
46 | - } |
|
46 | + } |
|
47 | 47 | ?> |
48 | 48 | </span></div> <br/> |
49 | 49 | <br/> |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | echo "<div class=\"col-md-12 margin-t-10 margin-b-20 padding-r-32 padding-l-32\" style=\"color: #232222;\">Link is Expire Please Try Again</div><br>"; |
85 | 85 | echo ""; |
86 | - } |
|
86 | + } |
|
87 | 87 | ?> |
88 | 88 | |
89 | 89 |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | <link href="<?= base_url() ?>assets/css/global-style.css" rel="stylesheet" type="text/css"> |
12 | 12 | |
13 | 13 | <!-- IE --> |
14 | - <script type="text/javascript" src="<?php echo base_url();?>assets/js/respond.js"></script> |
|
15 | - <script type="text/javascript" src="<?php echo base_url();?>assets/js/respond.src.js"></script> |
|
14 | + <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/respond.js"></script> |
|
15 | + <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/respond.src.js"></script> |
|
16 | 16 | <noscript> |
17 | 17 | <div id="noscript-warning"> |
18 | 18 | ASTPP work best with JavaScript enabled |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | <div class="row"> |
36 | 36 | |
37 | 37 | <div class="col-md-4 col-md-offset-4"> <span class="login_error"> |
38 | - <?php if (isset($astpp_notification)){ ?> |
|
38 | + <?php if (isset($astpp_notification)) { ?> |
|
39 | 39 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
40 | - <?php }else{ |
|
40 | + <?php } else { |
|
41 | 41 | echo " "; |
42 | 42 | } |
43 | 43 | $astpp_err_msg = $this->session->flashdata('astpp_signupmsg'); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | <img alt="login" src="<?= base_url() ?>assets/images/logo.png"> |
61 | 61 | </div> |
62 | 62 | <div class="col-md-3"> |
63 | - <a class="btn btn-success col-md-12 margin-t-10" href="<?php echo base_url();?>">Login</a> |
|
63 | + <a class="btn btn-success col-md-12 margin-t-10" href="<?php echo base_url(); ?>">Login</a> |
|
64 | 64 | |
65 | 65 | </div> |
66 | 66 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | echo "<div <div class=\"col-md-12 margin-t-10 margin-b-10 padding-r-32 padding-l-32\" style=\"color: #232222;\">Password : ".$this->common->decode($user_data['password'])."</div>"; |
80 | 80 | echo "<br><br>"; |
81 | 81 | |
82 | - }else |
|
82 | + } else |
|
83 | 83 | { |
84 | 84 | echo "<div class=\"col-md-12 margin-t-10 margin-b-20 padding-r-32 padding-l-32\" style=\"color: #232222;\">Link is Expire Please Try Again</div><br>"; |
85 | 85 | echo ""; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | <div class="col-md-4 col-md-offset-4"> <span class="login_error"> |
38 | 38 | <?php if (isset($astpp_notification)){ ?> |
39 | 39 | Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active. |
40 | - <?php }else{ |
|
40 | + <?php } else{ |
|
41 | 41 | echo " "; |
42 | 42 | } |
43 | 43 | $astpp_err_msg = $this->session->flashdata('astpp_signupmsg'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | echo "<div <div class=\"col-md-12 margin-t-10 margin-b-10 padding-r-32 padding-l-32\" style=\"color: #232222;\">Password : ".$this->common->decode($user_data['password'])."</div>"; |
80 | 80 | echo "<br><br>"; |
81 | 81 | |
82 | - }else |
|
82 | + } else |
|
83 | 83 | { |
84 | 84 | echo "<div class=\"col-md-12 margin-t-10 margin-b-20 padding-r-32 padding-l-32\" style=\"color: #232222;\">Link is Expire Please Try Again</div><br>"; |
85 | 85 | echo ""; |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | <div class="col-md-12 no-padding"> |
53 | 53 | |
54 | 54 | |
55 | - <? if($this->session->userdata('userlevel_logintype') != '0'){?> |
|
56 | - <a class="col-md-9" href="<?php echo base_url();?>"> |
|
57 | - <img id="logo" alt="dashboard" src="<?php echo base_url();?>assets/images/logo.png"> |
|
58 | - <? } else{?> |
|
59 | - <a class="col-md-9" href="<?php echo base_url();?>"> |
|
60 | - <img id="logo" alt="user_logo" src="<?php echo base_url();?>assets/images/logo.png"> |
|
55 | + <? if ($this->session->userdata('userlevel_logintype') != '0') {?> |
|
56 | + <a class="col-md-9" href="<?php echo base_url(); ?>"> |
|
57 | + <img id="logo" alt="dashboard" src="<?php echo base_url(); ?>assets/images/logo.png"> |
|
58 | + <? } else {?> |
|
59 | + <a class="col-md-9" href="<?php echo base_url(); ?>"> |
|
60 | + <img id="logo" alt="user_logo" src="<?php echo base_url(); ?>assets/images/logo.png"> |
|
61 | 61 | <? }?> |
62 | 62 | </a> |
63 | 63 | |
64 | 64 | |
65 | - <div class="col-md-3"><a href="<?php echo base_url();?>"><input type="submit" value="Login" name="Login" class="btn btn-success col-md-12"></a></div> |
|
65 | + <div class="col-md-3"><a href="<?php echo base_url(); ?>"><input type="submit" value="Login" name="Login" class="btn btn-success col-md-12"></a></div> |
|
66 | 66 | |
67 | 67 | </div> |
68 | 68 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | <form class="form-light col-md-12 no-padding" action="<?php echo base_url(); ?>signup/successpassword/" method="post" accept-charset="utf-8" id="customer_form" name="customer_form"> |
73 | 73 | |
74 | -<input type="hidden" name="email" value=<?php echo $email;?>> |
|
74 | +<input type="hidden" name="email" value=<?php echo $email; ?>> |
|
75 | 75 | <div class="col-md-12 margin-t-20 padding-r-32 padding-l-32"> |
76 | 76 | <h3 style="color: #37A137 !important; padding: 0 0 10px;"><i class="fa fa-check-circle" style="color:#37A137;"></i> Your password successfully changed</h3> |
77 | 77 | </div> |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | <div class="w-section inverse no-padding margin-t-20"> |
52 | 52 | <div class="w-box dark sign-in-wr box_shadow margin-b-10"> |
53 | 53 | <div class="col-md-12 no-padding"> |
54 | - <? if($this->session->userdata('userlevel_logintype') != '0'){?> |
|
55 | - <a class="col-md-9" href="<?php echo base_url();?>"> |
|
56 | - <img id="logo" alt="dashboard" src="<?php echo base_url();?>assets/images/logo.png"> |
|
57 | - <? } else{?> |
|
58 | - <a class="col-md-9" href="<?php echo base_url();?>"> |
|
59 | - <img id="logo" alt="user_logo" src="<?php echo base_url();?>assets/images/logo.png"> |
|
54 | + <? if ($this->session->userdata('userlevel_logintype') != '0') {?> |
|
55 | + <a class="col-md-9" href="<?php echo base_url(); ?>"> |
|
56 | + <img id="logo" alt="dashboard" src="<?php echo base_url(); ?>assets/images/logo.png"> |
|
57 | + <? } else {?> |
|
58 | + <a class="col-md-9" href="<?php echo base_url(); ?>"> |
|
59 | + <img id="logo" alt="user_logo" src="<?php echo base_url(); ?>assets/images/logo.png"> |
|
60 | 60 | <? }?> |
61 | 61 | </a> |
62 | 62 | |
63 | 63 | |
64 | - <div class="col-md-3"><a href="<?php echo base_url();?>"><input type="submit" value="Login" name="Login" class="btn btn-success col-md-12 margin-t-10"></a></div> |
|
64 | + <div class="col-md-3"><a href="<?php echo base_url(); ?>"><input type="submit" value="Login" name="Login" class="btn btn-success col-md-12 margin-t-10"></a></div> |
|
65 | 65 | |
66 | 66 | </div> |
67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | <br> |
71 | 71 | |
72 | 72 | <form class="form-light col-md-12 no-padding" action="<?php echo base_url(); ?>signup/successpassword/" method="post" accept-charset="utf-8" id="customer_form" name="customer_form"> |
73 | -<input type="hidden" name="email" value=<?php echo $email;?>> |
|
73 | +<input type="hidden" name="email" value=<?php echo $email; ?>> |
|
74 | 74 | <div class="col-md-12 margin-t-20 margin-b-10 padding-r-32 padding-l-32" style="color:#232222;"> |
75 | 75 | <br/> Sorry, we cannot process for singup at this time.<br>Please contact administrator for more information<br><br> |
76 | 76 | </div> |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | |
25 | 25 | class Signup_model extends CI_Model |
26 | 26 | { |
27 | - function Signup_model() |
|
27 | + function Signup_model() |
|
28 | 28 | { |
29 | - parent::__construct(); |
|
29 | + parent::__construct(); |
|
30 | 30 | |
31 | - $this->load->model('Astpp_common'); |
|
32 | - $this->load->helper('form'); |
|
33 | - $this->load->model('common_model'); |
|
31 | + $this->load->model('Astpp_common'); |
|
32 | + $this->load->helper('form'); |
|
33 | + $this->load->model('common_model'); |
|
34 | 34 | $this->load->library('session'); |
35 | - } |
|
35 | + } |
|
36 | 36 | |
37 | 37 | function get_rate() |
38 | 38 | { |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | return $query->row(); |
47 | 47 | |
48 | 48 | } |
49 | - function add_user($data) |
|
50 | - { |
|
49 | + function add_user($data) |
|
50 | + { |
|
51 | 51 | $data['reseller_id'] = $data['key_unique']; |
52 | 52 | unset($data['agreeCheck']); |
53 | 53 | unset($data['key_unique']); |
@@ -55,31 +55,31 @@ discard block |
||
55 | 55 | $data['expiry'] = date('Y-m-d H:i:s', strtotime('+10 years')); |
56 | 56 | $this->db->insert("accounts",$data); |
57 | 57 | return $this->db->insert_id(); |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | function check_user($accno,$email,$balance) |
61 | 61 | { |
62 | 62 | $info = array("number"=>$accno,"email"=>$email,"status"=>1); |
63 | - $this->db->where($info); |
|
64 | - $this->db->select('*'); |
|
63 | + $this->db->where($info); |
|
64 | + $this->db->select('*'); |
|
65 | 65 | $acc_res=$this->db->get('accounts'); |
66 | 66 | if($acc_res->num_rows() > 0) |
67 | 67 | { |
68 | - $acc_res=$acc_res->result_array(); |
|
69 | - $acc_res=$acc_res[0]; |
|
70 | - $this->db->where('pricelist_id',$acc_res['pricelist_id']); |
|
71 | - $this->db->select("*"); |
|
72 | - $charge_res=$this->db->get('charges'); |
|
68 | + $acc_res=$acc_res->result_array(); |
|
69 | + $acc_res=$acc_res[0]; |
|
70 | + $this->db->where('pricelist_id',$acc_res['pricelist_id']); |
|
71 | + $this->db->select("*"); |
|
72 | + $charge_res=$this->db->get('charges'); |
|
73 | 73 | |
74 | 74 | if($charge_res->num_rows() > 0){ |
75 | 75 | $charge_res=$charge_res->result_array(); |
76 | - $charge_res=$charge_res[0]; |
|
77 | - $charge_acc_arr=array( |
|
76 | + $charge_res=$charge_res[0]; |
|
77 | + $charge_acc_arr=array( |
|
78 | 78 | "charge_id"=>$charge_res['id'], |
79 | 79 | "accountid"=>$acc_res['id'], |
80 | 80 | "status"=>0, |
81 | 81 | "assign_date"=>date('Y-m-d H:i:s') |
82 | - ); |
|
82 | + ); |
|
83 | 83 | }else{ |
84 | 84 | $charge_res=$charge_res->result_array(); |
85 | 85 | //echo "<pre>"; print_r($charge_res); exit; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | "accountid"=>$acc_res['id'], |
88 | 88 | "assign_date"=>date('Y-m-d H:i:s')); |
89 | 89 | } |
90 | - $result=$this->db->insert("charge_to_account",$charge_acc_arr); |
|
90 | + $result=$this->db->insert("charge_to_account",$charge_acc_arr); |
|
91 | 91 | $update = array("status" => 0,"balance" => $balance ); |
92 | 92 | $this->db->where($info); |
93 | 93 | $result = $this->db->update('accounts', $update); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | $this->db->select("id,name"); |
43 | 43 | $this->db->from('pricelists'); |
44 | - $this->db->where("status","0"); |
|
44 | + $this->db->where("status", "0"); |
|
45 | 45 | $query = $this->db->get(); |
46 | 46 | return $query->row(); |
47 | 47 | |
@@ -51,49 +51,49 @@ discard block |
||
51 | 51 | $data['reseller_id'] = $data['key_unique']; |
52 | 52 | unset($data['agreeCheck']); |
53 | 53 | unset($data['key_unique']); |
54 | - $data['creation']=gmdate('Y-m-d H:i:s'); |
|
54 | + $data['creation'] = gmdate('Y-m-d H:i:s'); |
|
55 | 55 | $data['expiry'] = date('Y-m-d H:i:s', strtotime('+10 years')); |
56 | - $this->db->insert("accounts",$data); |
|
56 | + $this->db->insert("accounts", $data); |
|
57 | 57 | return $this->db->insert_id(); |
58 | 58 | } |
59 | 59 | |
60 | - function check_user($accno,$email,$balance) |
|
60 | + function check_user($accno, $email, $balance) |
|
61 | 61 | { |
62 | - $info = array("number"=>$accno,"email"=>$email,"status"=>1); |
|
62 | + $info = array("number"=>$accno, "email"=>$email, "status"=>1); |
|
63 | 63 | $this->db->where($info); |
64 | 64 | $this->db->select('*'); |
65 | - $acc_res=$this->db->get('accounts'); |
|
66 | - if($acc_res->num_rows() > 0) |
|
65 | + $acc_res = $this->db->get('accounts'); |
|
66 | + if ($acc_res->num_rows() > 0) |
|
67 | 67 | { |
68 | - $acc_res=$acc_res->result_array(); |
|
69 | - $acc_res=$acc_res[0]; |
|
70 | - $this->db->where('pricelist_id',$acc_res['pricelist_id']); |
|
68 | + $acc_res = $acc_res->result_array(); |
|
69 | + $acc_res = $acc_res[0]; |
|
70 | + $this->db->where('pricelist_id', $acc_res['pricelist_id']); |
|
71 | 71 | $this->db->select("*"); |
72 | - $charge_res=$this->db->get('charges'); |
|
72 | + $charge_res = $this->db->get('charges'); |
|
73 | 73 | |
74 | - if($charge_res->num_rows() > 0){ |
|
75 | - $charge_res=$charge_res->result_array(); |
|
76 | - $charge_res=$charge_res[0]; |
|
77 | - $charge_acc_arr=array( |
|
74 | + if ($charge_res->num_rows() > 0) { |
|
75 | + $charge_res = $charge_res->result_array(); |
|
76 | + $charge_res = $charge_res[0]; |
|
77 | + $charge_acc_arr = array( |
|
78 | 78 | "charge_id"=>$charge_res['id'], |
79 | 79 | "accountid"=>$acc_res['id'], |
80 | 80 | "status"=>0, |
81 | 81 | "assign_date"=>date('Y-m-d H:i:s') |
82 | 82 | ); |
83 | - }else{ |
|
84 | - $charge_res=$charge_res->result_array(); |
|
83 | + } else { |
|
84 | + $charge_res = $charge_res->result_array(); |
|
85 | 85 | //echo "<pre>"; print_r($charge_res); exit; |
86 | 86 | $charge_acc_arr = array("charge_id"=>'id', |
87 | 87 | "accountid"=>$acc_res['id'], |
88 | 88 | "assign_date"=>date('Y-m-d H:i:s')); |
89 | 89 | } |
90 | - $result=$this->db->insert("charge_to_account",$charge_acc_arr); |
|
91 | - $update = array("status" => 0,"balance" => $balance ); |
|
90 | + $result = $this->db->insert("charge_to_account", $charge_acc_arr); |
|
91 | + $update = array("status" => 0, "balance" => $balance); |
|
92 | 92 | $this->db->where($info); |
93 | 93 | $result = $this->db->update('accounts', $update); |
94 | - $sip_device_update = array('username'=>$accno,"status"=>1); |
|
94 | + $sip_device_update = array('username'=>$accno, "status"=>1); |
|
95 | 95 | return 1; |
96 | - }else{ |
|
96 | + } else { |
|
97 | 97 | return 0; |
98 | 98 | } |
99 | 99 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | "status"=>0, |
81 | 81 | "assign_date"=>date('Y-m-d H:i:s') |
82 | 82 | ); |
83 | - }else{ |
|
83 | + } else{ |
|
84 | 84 | $charge_res=$charge_res->result_array(); |
85 | 85 | //echo "<pre>"; print_r($charge_res); exit; |
86 | 86 | $charge_acc_arr = array("charge_id"=>'id', |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $result = $this->db->update('accounts', $update); |
94 | 94 | $sip_device_update = array('username'=>$accno,"status"=>1); |
95 | 95 | return 1; |
96 | - }else{ |
|
96 | + } else{ |
|
97 | 97 | return 0; |
98 | 98 | } |
99 | 99 | } |
@@ -24,30 +24,30 @@ discard block |
||
24 | 24 | |
25 | 25 | class User extends MX_Controller { |
26 | 26 | |
27 | - function User() { |
|
28 | - parent::__construct(); |
|
29 | - $this->load->helper('template_inheritance'); |
|
30 | - $this->load->helper('form'); |
|
31 | - $this->load->library("astpp/form"); |
|
32 | - $this->load->library("user_form"); |
|
33 | - $this->load->model('Auth_model'); |
|
34 | - $this->load->model('Astpp_common'); |
|
35 | - $this->load->model('user_model'); |
|
36 | - } |
|
37 | - |
|
38 | - function index() { |
|
39 | - if ($this->session->userdata('user_login') == FALSE) |
|
40 | - redirect(base_url() . 'login/login'); |
|
41 | - $data['page_title'] = 'Dashboard'; |
|
42 | - $this->load->view('view_user_dashboard', $data); |
|
43 | - } |
|
44 | - |
|
45 | - function user_dashboard_recent_payments() { |
|
46 | - $result=$this->user_model->user_dashboard_recent_recharge_info(); |
|
27 | + function User() { |
|
28 | + parent::__construct(); |
|
29 | + $this->load->helper('template_inheritance'); |
|
30 | + $this->load->helper('form'); |
|
31 | + $this->load->library("astpp/form"); |
|
32 | + $this->load->library("user_form"); |
|
33 | + $this->load->model('Auth_model'); |
|
34 | + $this->load->model('Astpp_common'); |
|
35 | + $this->load->model('user_model'); |
|
36 | + } |
|
37 | + |
|
38 | + function index() { |
|
39 | + if ($this->session->userdata('user_login') == FALSE) |
|
40 | + redirect(base_url() . 'login/login'); |
|
41 | + $data['page_title'] = 'Dashboard'; |
|
42 | + $this->load->view('view_user_dashboard', $data); |
|
43 | + } |
|
44 | + |
|
45 | + function user_dashboard_recent_payments() { |
|
46 | + $result=$this->user_model->user_dashboard_recent_recharge_info(); |
|
47 | 47 | $gmtoffset=$this->common->get_timezone_offset(); |
48 | - $i=0; |
|
49 | - $json_data=array(); |
|
50 | - if($result->num_rows() > 0) |
|
48 | + $i=0; |
|
49 | + $json_data=array(); |
|
50 | + if($result->num_rows() > 0) |
|
51 | 51 | { |
52 | 52 | $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',''); |
53 | 53 | $json_data[0]['accountid']='Accounts'; |
@@ -55,63 +55,63 @@ discard block |
||
55 | 55 | $json_data[0]['payment_date']='Date'; |
56 | 56 | $json_data[0]['notes']='Notes'; |
57 | 57 | foreach($result->result_array() as $key=>$data){ |
58 | - $current_timestamp=strtotime($data['payment_date']); |
|
59 | - $modified_date=$current_timestamp+$gmtoffset; |
|
60 | - $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous"; |
|
61 | - $json_data[$i]['accountid']=$data['accountid']; |
|
62 | - $json_data[$i]['credit']=$this->common_model->calculate_currency($data['credit'],'','',true,false); |
|
63 | - $json_data[$i]['payment_date']=date('Y-m-d H:i:s',strtotime($data['payment_date'])+$gmtoffset); |
|
64 | - $json_data[$i]['notes']=$data['notes']; |
|
65 | - $i++; |
|
66 | - } |
|
67 | - } |
|
68 | - echo json_encode($json_data); |
|
69 | - } |
|
70 | - |
|
71 | - function user_dashboard_package_data() { |
|
72 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
73 | - $json_data = array(); |
|
74 | - $this->db->where('pricelist_id', $accountinfo['pricelist_id']); |
|
75 | - $this->db->select('*'); |
|
76 | - $result = $this->db->get('packages', 10); |
|
77 | - $i = 1; |
|
78 | - if ($result->num_rows() > 0) { |
|
79 | - $json_data[0]['package_name'] = 'Package Name'; |
|
80 | - $json_data[0]['includedseconds'] = 'Included Seconds'; |
|
81 | - $json_data[0]['status'] = 'Status'; |
|
82 | - $result = $result->result_array(); |
|
83 | - foreach ($result as $data) { |
|
84 | - $json_data[$i]['package_name'] = $data['package_name']; |
|
85 | - $json_data[$i]['includedseconds'] = $data['includedseconds']; |
|
86 | - $json_data[$i]['status'] = $this->common->get_status('export', '', $data['status']); |
|
87 | - $i++; |
|
88 | - } |
|
89 | - } |
|
90 | - echo json_encode($json_data); |
|
91 | - } |
|
92 | - function user_dashboard_invoices_data() { |
|
93 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
94 | - $currency=$this->common->get_field_name('currency','currency',array("id"=>$accountinfo['currency_id'])); |
|
95 | - $this->db->where('accountid', $accountinfo['id']); |
|
96 | - $this->db->where('confirm', 1); |
|
97 | - $this->db->select('*'); |
|
98 | - $this->db->order_by('invoice_date', 'desc'); |
|
99 | - $result = $this->db->get('invoices', 10); |
|
100 | - $json_data = array(); |
|
101 | - $gmtoffset = $this->common->get_timezone_offset(); |
|
102 | - if ($result->num_rows() > 0) { |
|
103 | - $result = $result->result_array(); |
|
104 | - $json_data[0]['type'] = 'Invoice Type'; |
|
105 | - $json_data[0]['id'] = 'Number'; |
|
106 | - $json_data[0]['from_date'] = 'From Date'; |
|
107 | - $json_data[0]['invoice_date'] = 'Generated Date'; |
|
108 | - $json_data[0]['amount'] = 'Amount ('.$currency.')'; |
|
109 | - $json_data[0]['inv_type'] = 'Recharge Type'; |
|
110 | - $i = 1; |
|
111 | - foreach ($result as $key => $data) { |
|
112 | - $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$data['id'])); |
|
113 | - |
|
114 | - $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$data['id'])); |
|
58 | + $current_timestamp=strtotime($data['payment_date']); |
|
59 | + $modified_date=$current_timestamp+$gmtoffset; |
|
60 | + $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous"; |
|
61 | + $json_data[$i]['accountid']=$data['accountid']; |
|
62 | + $json_data[$i]['credit']=$this->common_model->calculate_currency($data['credit'],'','',true,false); |
|
63 | + $json_data[$i]['payment_date']=date('Y-m-d H:i:s',strtotime($data['payment_date'])+$gmtoffset); |
|
64 | + $json_data[$i]['notes']=$data['notes']; |
|
65 | + $i++; |
|
66 | + } |
|
67 | + } |
|
68 | + echo json_encode($json_data); |
|
69 | + } |
|
70 | + |
|
71 | + function user_dashboard_package_data() { |
|
72 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
73 | + $json_data = array(); |
|
74 | + $this->db->where('pricelist_id', $accountinfo['pricelist_id']); |
|
75 | + $this->db->select('*'); |
|
76 | + $result = $this->db->get('packages', 10); |
|
77 | + $i = 1; |
|
78 | + if ($result->num_rows() > 0) { |
|
79 | + $json_data[0]['package_name'] = 'Package Name'; |
|
80 | + $json_data[0]['includedseconds'] = 'Included Seconds'; |
|
81 | + $json_data[0]['status'] = 'Status'; |
|
82 | + $result = $result->result_array(); |
|
83 | + foreach ($result as $data) { |
|
84 | + $json_data[$i]['package_name'] = $data['package_name']; |
|
85 | + $json_data[$i]['includedseconds'] = $data['includedseconds']; |
|
86 | + $json_data[$i]['status'] = $this->common->get_status('export', '', $data['status']); |
|
87 | + $i++; |
|
88 | + } |
|
89 | + } |
|
90 | + echo json_encode($json_data); |
|
91 | + } |
|
92 | + function user_dashboard_invoices_data() { |
|
93 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
94 | + $currency=$this->common->get_field_name('currency','currency',array("id"=>$accountinfo['currency_id'])); |
|
95 | + $this->db->where('accountid', $accountinfo['id']); |
|
96 | + $this->db->where('confirm', 1); |
|
97 | + $this->db->select('*'); |
|
98 | + $this->db->order_by('invoice_date', 'desc'); |
|
99 | + $result = $this->db->get('invoices', 10); |
|
100 | + $json_data = array(); |
|
101 | + $gmtoffset = $this->common->get_timezone_offset(); |
|
102 | + if ($result->num_rows() > 0) { |
|
103 | + $result = $result->result_array(); |
|
104 | + $json_data[0]['type'] = 'Invoice Type'; |
|
105 | + $json_data[0]['id'] = 'Number'; |
|
106 | + $json_data[0]['from_date'] = 'From Date'; |
|
107 | + $json_data[0]['invoice_date'] = 'Generated Date'; |
|
108 | + $json_data[0]['amount'] = 'Amount ('.$currency.')'; |
|
109 | + $json_data[0]['inv_type'] = 'Recharge Type'; |
|
110 | + $i = 1; |
|
111 | + foreach ($result as $key => $data) { |
|
112 | + $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$data['id'])); |
|
113 | + |
|
114 | + $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$data['id'])); |
|
115 | 115 | $invoice_num=$invoice_prefix.$invoiceid; |
116 | 116 | $inv_type=$this->common->get_invoice_total('item_type', '', $data['id']); |
117 | 117 | if($inv_type == ''){ |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | $json_data[$i]['amount'] = $inv_debit; |
132 | 132 | $json_data[$i]['inv_type'] = $inv_type; |
133 | 133 | $i++; |
134 | - } |
|
135 | - } |
|
136 | - echo json_encode($json_data); |
|
137 | - } |
|
134 | + } |
|
135 | + } |
|
136 | + echo json_encode($json_data); |
|
137 | + } |
|
138 | 138 | |
139 | - function user_dashboard_subscription_data(){ |
|
139 | + function user_dashboard_subscription_data(){ |
|
140 | 140 | $accountinfo=$this->session->userdata('accountinfo'); |
141 | 141 | $this->db->where('accountid',$accountinfo['id']); |
142 | 142 | $this->db->select('*'); |
@@ -187,487 +187,487 @@ discard block |
||
187 | 187 | } |
188 | 188 | $i++; |
189 | 189 | } |
190 | - } |
|
191 | - echo json_encode($json_data); |
|
192 | - } |
|
190 | + } |
|
191 | + echo json_encode($json_data); |
|
192 | + } |
|
193 | 193 | |
194 | - function user_edit_account() { |
|
195 | - if ($add_array['id'] != '') { |
|
196 | - $data['form'] = $this->form->build_form($this->accounts->accounts_form->get_user_form_fields($add_array['id']), $add_array); |
|
197 | - $data['page_title'] = 'Edit ' . $entity_name; |
|
198 | - if ($this->form_validation->run() == FALSE) { |
|
199 | - $data['validation_errors'] = validation_errors(); |
|
200 | - } else { |
|
201 | - $add_array['password'] = $this->common->encode($add_array['password']); |
|
202 | - unset($add_array['number']); |
|
203 | - $this->accounts->accounts_model->edit_account($add_array, $add_array['id']); |
|
204 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
205 | - if ($add_array['id'] == $accountinfo['id']) { |
|
206 | - $this->session->set_userdata('accountinfo',(array)$this->db->get_where('accounts', array('id' => $add_array['id']))->first_row()); |
|
207 | - } |
|
208 | - $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' updated successfully!'); |
|
209 | - redirect(base_url() . 'user/user/'); |
|
210 | - } |
|
211 | - $this->load->view('view_user_details', $data); |
|
212 | - } else { |
|
213 | - $data['page_title'] = 'Edit ' . $entity_name; |
|
214 | - $where = array('id' => $account_data["id"]); |
|
215 | - $account = $this->db_model->getSelect("*", "accounts", $where); |
|
216 | - $data["account_data"] = $account->result_array(); |
|
217 | - |
|
218 | - foreach ($account->result_array() as $key => $value) { |
|
219 | - $editable_data = $value; |
|
220 | - } |
|
221 | - $editable_data['password'] = $this->common->decode($editable_data['password']); |
|
222 | - $data['form'] = $this->form->build_form($this->accounts->accounts_form->get_user_form_fields($editable_data['id']), $editable_data); |
|
223 | - $this->load->view('view_user_details', $data); |
|
224 | - } |
|
225 | - } |
|
194 | + function user_edit_account() { |
|
195 | + if ($add_array['id'] != '') { |
|
196 | + $data['form'] = $this->form->build_form($this->accounts->accounts_form->get_user_form_fields($add_array['id']), $add_array); |
|
197 | + $data['page_title'] = 'Edit ' . $entity_name; |
|
198 | + if ($this->form_validation->run() == FALSE) { |
|
199 | + $data['validation_errors'] = validation_errors(); |
|
200 | + } else { |
|
201 | + $add_array['password'] = $this->common->encode($add_array['password']); |
|
202 | + unset($add_array['number']); |
|
203 | + $this->accounts->accounts_model->edit_account($add_array, $add_array['id']); |
|
204 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
205 | + if ($add_array['id'] == $accountinfo['id']) { |
|
206 | + $this->session->set_userdata('accountinfo',(array)$this->db->get_where('accounts', array('id' => $add_array['id']))->first_row()); |
|
207 | + } |
|
208 | + $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' updated successfully!'); |
|
209 | + redirect(base_url() . 'user/user/'); |
|
210 | + } |
|
211 | + $this->load->view('view_user_details', $data); |
|
212 | + } else { |
|
213 | + $data['page_title'] = 'Edit ' . $entity_name; |
|
214 | + $where = array('id' => $account_data["id"]); |
|
215 | + $account = $this->db_model->getSelect("*", "accounts", $where); |
|
216 | + $data["account_data"] = $account->result_array(); |
|
217 | + |
|
218 | + foreach ($account->result_array() as $key => $value) { |
|
219 | + $editable_data = $value; |
|
220 | + } |
|
221 | + $editable_data['password'] = $this->common->decode($editable_data['password']); |
|
222 | + $data['form'] = $this->form->build_form($this->accounts->accounts_form->get_user_form_fields($editable_data['id']), $editable_data); |
|
223 | + $this->load->view('view_user_details', $data); |
|
224 | + } |
|
225 | + } |
|
226 | 226 | |
227 | - function user_did_edit($edit_id = '') { |
|
228 | - $data['page_title'] = 'Edit DIDs'; |
|
229 | - $account_data = $this->session->userdata("accountinfo"); |
|
230 | - $this->db->where('id',$edit_id); |
|
231 | - $this->db->select('id,call_type,extensions,number'); |
|
232 | - $did_info=(array)$this->db->get('dids')->first_row(); |
|
233 | - $did_info['free_didlist']=$did_info['id']; |
|
234 | - $data['form'] = $this->form->build_form($this->user_form->build_user_did_form(),$did_info); |
|
235 | - $this->load->view('view_user_did_edit', $data); |
|
236 | - } |
|
237 | - |
|
238 | - function user_dids_action($action,$did_id = "") { |
|
239 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
240 | - $reseller_id = $accountinfo['reseller_id']; |
|
241 | - $did_id = empty($did_id) ? $this->input->post("free_didlist", true) : $did_id; |
|
227 | + function user_did_edit($edit_id = '') { |
|
228 | + $data['page_title'] = 'Edit DIDs'; |
|
229 | + $account_data = $this->session->userdata("accountinfo"); |
|
230 | + $this->db->where('id',$edit_id); |
|
231 | + $this->db->select('id,call_type,extensions,number'); |
|
232 | + $did_info=(array)$this->db->get('dids')->first_row(); |
|
233 | + $did_info['free_didlist']=$did_info['id']; |
|
234 | + $data['form'] = $this->form->build_form($this->user_form->build_user_did_form(),$did_info); |
|
235 | + $this->load->view('view_user_did_edit', $data); |
|
236 | + } |
|
237 | + |
|
238 | + function user_dids_action($action,$did_id = "") { |
|
239 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
240 | + $reseller_id = $accountinfo['reseller_id']; |
|
241 | + $did_id = empty($did_id) ? $this->input->post("free_didlist", true) : $did_id; |
|
242 | 242 | |
243 | - if($did_id !=''){ |
|
244 | - $account_query = $this->db_model->getSelect("*", "accounts",array('id' => $accountinfo['id'])); |
|
245 | - $account_arr = (array) $account_query->first_row(); |
|
246 | - $did_query = $this->db_model->getSelect("*", "dids", array("id" => $did_id)); |
|
247 | - $did_arr = (array) $did_query->first_row(); |
|
248 | - if ($action == "add"){ |
|
249 | - if($did_arr['accountid'] == 0 && $did_arr['parent_id'] == $reseller_id ) { |
|
250 | - $setup_cost=$did_arr['setup']; |
|
251 | - if ($accountinfo["reseller_id"] > 0) { |
|
252 | - $reseller_pricing_res = $this->db_model->getSelect("*", "reseller_pricing", array("note" => $did_arr['number'],"reseller_id"=>$accountinfo['reseller_id'])); |
|
253 | - $reseller_pricing_arr = (array)$reseller_pricing_res->first_row(); |
|
254 | - $setup_cost=$reseller_pricing_arr['setup']; |
|
255 | - } |
|
256 | - $available_bal = $this->db_model->get_available_bal($account_arr); |
|
257 | - if ($available_bal >= $setup_cost) { |
|
258 | - $available_bal = $this->db_model->update_balance($setup_cost,$accountinfo["id"], "debit"); |
|
259 | - $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
260 | - $this->common->add_invoice_details($accountinfo,"DIDCHRG",$setup_cost,$did_arr['number']); |
|
261 | - $this->db_model->update("dids", array("accountid" => $accountinfo["id"],"assign_date" => gmdate('Y-m-d H:i:s')), array("id" => $did_id)); |
|
262 | - $this->common->mail_to_users('email_add_did', $account_arr,"",$did_arr['number']); |
|
263 | - $this->session->set_flashdata('astpp_errormsg', 'Did added successfully.'); |
|
264 | - redirect(base_url() . "user/user_didlist/"); |
|
265 | - } else { |
|
266 | - $this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this did'); |
|
267 | - redirect(base_url() . "user/user_didlist/"); |
|
268 | - } |
|
269 | - }else{ |
|
270 | - $this->session->set_flashdata('astpp_notification', 'This DID already purchased by someone.'); |
|
271 | - redirect(base_url() . "user/user_didlist/"); |
|
272 | - } |
|
273 | - } |
|
274 | - if ($action == "edit") { |
|
275 | - $add_array=$this->input->post(); |
|
276 | - $data['form'] = $this->form->build_form($this->user_form->build_user_did_form($add_array['free_didlist']), $add_array); |
|
277 | - if ($this->form_validation->run() == FALSE) { |
|
278 | - $data['validation_errors'] = validation_errors(); |
|
279 | - echo $data['validation_errors']; |
|
280 | - exit; |
|
281 | - } else { |
|
282 | - $update_arr = array("call_type" => $add_array['call_type'], |
|
243 | + if($did_id !=''){ |
|
244 | + $account_query = $this->db_model->getSelect("*", "accounts",array('id' => $accountinfo['id'])); |
|
245 | + $account_arr = (array) $account_query->first_row(); |
|
246 | + $did_query = $this->db_model->getSelect("*", "dids", array("id" => $did_id)); |
|
247 | + $did_arr = (array) $did_query->first_row(); |
|
248 | + if ($action == "add"){ |
|
249 | + if($did_arr['accountid'] == 0 && $did_arr['parent_id'] == $reseller_id ) { |
|
250 | + $setup_cost=$did_arr['setup']; |
|
251 | + if ($accountinfo["reseller_id"] > 0) { |
|
252 | + $reseller_pricing_res = $this->db_model->getSelect("*", "reseller_pricing", array("note" => $did_arr['number'],"reseller_id"=>$accountinfo['reseller_id'])); |
|
253 | + $reseller_pricing_arr = (array)$reseller_pricing_res->first_row(); |
|
254 | + $setup_cost=$reseller_pricing_arr['setup']; |
|
255 | + } |
|
256 | + $available_bal = $this->db_model->get_available_bal($account_arr); |
|
257 | + if ($available_bal >= $setup_cost) { |
|
258 | + $available_bal = $this->db_model->update_balance($setup_cost,$accountinfo["id"], "debit"); |
|
259 | + $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
260 | + $this->common->add_invoice_details($accountinfo,"DIDCHRG",$setup_cost,$did_arr['number']); |
|
261 | + $this->db_model->update("dids", array("accountid" => $accountinfo["id"],"assign_date" => gmdate('Y-m-d H:i:s')), array("id" => $did_id)); |
|
262 | + $this->common->mail_to_users('email_add_did', $account_arr,"",$did_arr['number']); |
|
263 | + $this->session->set_flashdata('astpp_errormsg', 'Did added successfully.'); |
|
264 | + redirect(base_url() . "user/user_didlist/"); |
|
265 | + } else { |
|
266 | + $this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this did'); |
|
267 | + redirect(base_url() . "user/user_didlist/"); |
|
268 | + } |
|
269 | + }else{ |
|
270 | + $this->session->set_flashdata('astpp_notification', 'This DID already purchased by someone.'); |
|
271 | + redirect(base_url() . "user/user_didlist/"); |
|
272 | + } |
|
273 | + } |
|
274 | + if ($action == "edit") { |
|
275 | + $add_array=$this->input->post(); |
|
276 | + $data['form'] = $this->form->build_form($this->user_form->build_user_did_form($add_array['free_didlist']), $add_array); |
|
277 | + if ($this->form_validation->run() == FALSE) { |
|
278 | + $data['validation_errors'] = validation_errors(); |
|
279 | + echo $data['validation_errors']; |
|
280 | + exit; |
|
281 | + } else { |
|
282 | + $update_arr = array("call_type" => $add_array['call_type'], |
|
283 | 283 | "extensions" => $add_array['extensions'],"last_modified_date"=>gmdate("Y-m-d H:i:s") |
284 | - ); |
|
285 | - $this->db->update("dids", $update_arr, array("id" => $did_id)); |
|
286 | - if($accountinfo['reseller_id'] > 0 ){ |
|
284 | + ); |
|
285 | + $this->db->update("dids", $update_arr, array("id" => $did_id)); |
|
286 | + if($accountinfo['reseller_id'] > 0 ){ |
|
287 | 287 | |
288 | 288 | $this->db->update('reseller_pricing',$update_arr,array('note'=>$did_arr['number'])); |
289 | - } |
|
290 | - echo json_encode(array("SUCCESS" => $did_arr['number'] . " DID Updated Successfully!")); |
|
291 | - exit; |
|
292 | - } |
|
293 | - $this->load->view('view_user_did_edit', $data); |
|
294 | - } |
|
295 | - if ($action == "delete") { |
|
296 | - $this->db->update("dids", array("accountid" =>0,"assign_date" =>"0000-00-00 00:00:00" , 'charge_upto'=>"0000-00-00 00:00:00"),array("id" => $did_id)); |
|
297 | - $this->common->mail_to_users('email_remove_did', $account_arr,"",$did_arr['number']); |
|
298 | - $this->session->set_flashdata('astpp_notification', 'DID Removed Successfully.'); |
|
299 | - redirect(base_url() . "user/user_didlist/"); |
|
300 | - } |
|
301 | - }else{ |
|
289 | + } |
|
290 | + echo json_encode(array("SUCCESS" => $did_arr['number'] . " DID Updated Successfully!")); |
|
291 | + exit; |
|
292 | + } |
|
293 | + $this->load->view('view_user_did_edit', $data); |
|
294 | + } |
|
295 | + if ($action == "delete") { |
|
296 | + $this->db->update("dids", array("accountid" =>0,"assign_date" =>"0000-00-00 00:00:00" , 'charge_upto'=>"0000-00-00 00:00:00"),array("id" => $did_id)); |
|
297 | + $this->common->mail_to_users('email_remove_did', $account_arr,"",$did_arr['number']); |
|
298 | + $this->session->set_flashdata('astpp_notification', 'DID Removed Successfully.'); |
|
299 | + redirect(base_url() . "user/user_didlist/"); |
|
300 | + } |
|
301 | + }else{ |
|
302 | 302 | $this->session->set_flashdata('astpp_notification', 'DID not found.'); |
303 | 303 | redirect(base_url() . "user/user_didlist/"); |
304 | - } |
|
305 | - } |
|
306 | - |
|
307 | - function user_rates_list() { |
|
308 | - $data['username'] = $this->session->userdata('user_name'); |
|
309 | - $data['page_title'] = 'My Rates'; |
|
310 | - $data['search_flag'] = true; |
|
311 | - $this->session->set_userdata('advance_search', 0); |
|
312 | - $this->load->module('rates/rates'); |
|
313 | - $data["grid_buttons"] = $this->user_form->user_rates_list_buttons(); |
|
314 | - $data['grid_fields'] = $this->user_form->user_rates_list(); |
|
315 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->user_rates_list_search()); |
|
316 | - $this->load->view('view_user_rates_list', $data); |
|
317 | - } |
|
318 | - |
|
319 | - function user_rates_list_json() { |
|
320 | - $account_data = $this->session->userdata("accountinfo"); |
|
321 | - $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
|
322 | - $count_all = $this->user_model->get_user_rates_list(false); |
|
323 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
324 | - $json_data = $paging_data["json_paging"]; |
|
325 | - |
|
326 | - $query = $this->user_model->get_user_rates_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
327 | - $grid_fields = json_decode($this->user_form->user_rates_list()); |
|
328 | - foreach ($query->result_array() as $key => $value) { |
|
329 | - $cost=$account_data['type']!=3 ? ($value['cost'] + (($value['cost']*$markup)/100)) : $value['cost']; |
|
330 | - $json_data['rows'][] = array('cell' => array( |
|
331 | - $this->common->get_only_numeric_val("","",$value["pattern"]), |
|
332 | - $value['comment'], |
|
333 | - $this->common_model->calculate_currency($value['connectcost'],'','',true,false), |
|
334 | - $value['includedseconds'], |
|
335 | - $this->common_model->calculate_currency(($cost),'','',true,false), |
|
336 | - $value['init_inc'], |
|
337 | - $value['inc'] |
|
338 | - )); |
|
339 | - } |
|
340 | - echo json_encode($json_data); |
|
341 | - } |
|
304 | + } |
|
305 | + } |
|
306 | + |
|
307 | + function user_rates_list() { |
|
308 | + $data['username'] = $this->session->userdata('user_name'); |
|
309 | + $data['page_title'] = 'My Rates'; |
|
310 | + $data['search_flag'] = true; |
|
311 | + $this->session->set_userdata('advance_search', 0); |
|
312 | + $this->load->module('rates/rates'); |
|
313 | + $data["grid_buttons"] = $this->user_form->user_rates_list_buttons(); |
|
314 | + $data['grid_fields'] = $this->user_form->user_rates_list(); |
|
315 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->user_rates_list_search()); |
|
316 | + $this->load->view('view_user_rates_list', $data); |
|
317 | + } |
|
318 | + |
|
319 | + function user_rates_list_json() { |
|
320 | + $account_data = $this->session->userdata("accountinfo"); |
|
321 | + $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
|
322 | + $count_all = $this->user_model->get_user_rates_list(false); |
|
323 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
324 | + $json_data = $paging_data["json_paging"]; |
|
325 | + |
|
326 | + $query = $this->user_model->get_user_rates_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
327 | + $grid_fields = json_decode($this->user_form->user_rates_list()); |
|
328 | + foreach ($query->result_array() as $key => $value) { |
|
329 | + $cost=$account_data['type']!=3 ? ($value['cost'] + (($value['cost']*$markup)/100)) : $value['cost']; |
|
330 | + $json_data['rows'][] = array('cell' => array( |
|
331 | + $this->common->get_only_numeric_val("","",$value["pattern"]), |
|
332 | + $value['comment'], |
|
333 | + $this->common_model->calculate_currency($value['connectcost'],'','',true,false), |
|
334 | + $value['includedseconds'], |
|
335 | + $this->common_model->calculate_currency(($cost),'','',true,false), |
|
336 | + $value['init_inc'], |
|
337 | + $value['inc'] |
|
338 | + )); |
|
339 | + } |
|
340 | + echo json_encode($json_data); |
|
341 | + } |
|
342 | 342 | |
343 | - function user_rates_list_search() { |
|
344 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
345 | - |
|
346 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
347 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
348 | - $action = $this->input->post(); |
|
349 | - unset($action['action'],$action['advance_search']); |
|
350 | - if (isset($action['connectcost']['connectcost']) && $action['connectcost']['connectcost'] != '') { |
|
351 | - $action['connectcost']['connectcost'] = $this->common_model->add_calculate_currency($action['connectcost']['connectcost'], "", '', true, false); |
|
352 | - } |
|
353 | - if (isset($action['cost']['cost']) && $action['cost']['cost'] != '') { |
|
354 | - $account_data = $this->session->userdata("accountinfo"); |
|
355 | - $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
|
356 | - $markup = ($markup > 0)?$markup:1; |
|
357 | - $action['cost']['cost'] = $this->common_model->add_calculate_currency($action['cost']['cost'], "", '', true, false); |
|
358 | - if($account_data['type']!=3) |
|
359 | - $action['cost']['cost']=($action['cost']['cost'] - ($action['cost']['cost']*$markup)/100); |
|
360 | - } |
|
361 | - $this->session->set_userdata('user_rates_list_search', $action); |
|
362 | - } |
|
363 | - if ($ajax_search != 1) { |
|
364 | - redirect(base_url() . 'user/user_rates_list/'); |
|
365 | - } |
|
366 | - } |
|
367 | - |
|
368 | - function user_rates_list_clearsearchfilter() { |
|
369 | - $this->session->set_userdata('advance_search', 0); |
|
370 | - $this->session->set_userdata('user_rates_list_search', ""); |
|
371 | - } |
|
343 | + function user_rates_list_search() { |
|
344 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
345 | + |
|
346 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
347 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
348 | + $action = $this->input->post(); |
|
349 | + unset($action['action'],$action['advance_search']); |
|
350 | + if (isset($action['connectcost']['connectcost']) && $action['connectcost']['connectcost'] != '') { |
|
351 | + $action['connectcost']['connectcost'] = $this->common_model->add_calculate_currency($action['connectcost']['connectcost'], "", '', true, false); |
|
352 | + } |
|
353 | + if (isset($action['cost']['cost']) && $action['cost']['cost'] != '') { |
|
354 | + $account_data = $this->session->userdata("accountinfo"); |
|
355 | + $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
|
356 | + $markup = ($markup > 0)?$markup:1; |
|
357 | + $action['cost']['cost'] = $this->common_model->add_calculate_currency($action['cost']['cost'], "", '', true, false); |
|
358 | + if($account_data['type']!=3) |
|
359 | + $action['cost']['cost']=($action['cost']['cost'] - ($action['cost']['cost']*$markup)/100); |
|
360 | + } |
|
361 | + $this->session->set_userdata('user_rates_list_search', $action); |
|
362 | + } |
|
363 | + if ($ajax_search != 1) { |
|
364 | + redirect(base_url() . 'user/user_rates_list/'); |
|
365 | + } |
|
366 | + } |
|
367 | + |
|
368 | + function user_rates_list_clearsearchfilter() { |
|
369 | + $this->session->set_userdata('advance_search', 0); |
|
370 | + $this->session->set_userdata('user_rates_list_search', ""); |
|
371 | + } |
|
372 | 372 | |
373 | - function user_rates_list_export() { |
|
373 | + function user_rates_list_export() { |
|
374 | 374 | $account_data=$this->session->userdata('accountinfo'); |
375 | - $currency_id=$account_data['currency_id']; |
|
376 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
377 | - $query = $this->user_model->get_user_rates_list(true, '', '', false); |
|
378 | - $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
|
379 | - ob_clean(); |
|
380 | - $inbound_array[] = array("Code", "Destination","Connect Cost($currency)","Included Seconds","Per Minute Cost($currency)","Initital Increment","Increment"); |
|
381 | - if ($query->num_rows() > 0) { |
|
382 | - foreach ($query->result_array() as $row) { |
|
375 | + $currency_id=$account_data['currency_id']; |
|
376 | + $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
377 | + $query = $this->user_model->get_user_rates_list(true, '', '', false); |
|
378 | + $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
|
379 | + ob_clean(); |
|
380 | + $inbound_array[] = array("Code", "Destination","Connect Cost($currency)","Included Seconds","Per Minute Cost($currency)","Initital Increment","Increment"); |
|
381 | + if ($query->num_rows() > 0) { |
|
382 | + foreach ($query->result_array() as $row) { |
|
383 | 383 | $cost=$account_data['type']!=3 ? ($row['cost'] + ($row['cost']*$markup)/100) :$row['cost']; |
384 | 384 | $inbound_array[] = array( |
385 | - $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]), |
|
386 | - $row['comment'], |
|
387 | - $this->common_model->calculate_currency($row['connectcost'],'','',true,false), |
|
388 | - $row['includedseconds'], |
|
385 | + $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]), |
|
386 | + $row['comment'], |
|
387 | + $this->common_model->calculate_currency($row['connectcost'],'','',true,false), |
|
388 | + $row['includedseconds'], |
|
389 | 389 | $this->common_model->calculate_currency($cost,'','',true,false), |
390 | 390 | $row['init_inc'], |
391 | - $row['inc'] |
|
392 | - ); |
|
393 | - } |
|
394 | - } |
|
395 | - $this->load->helper('csv'); |
|
396 | - array_to_csv($inbound_array, 'Rates_' . date("Y-m-d") . '.csv'); |
|
397 | - } |
|
398 | - |
|
399 | - function user_refill($action = "") { |
|
400 | - if (common_model::$global_config['system_config']['paypal_status'] == 1) { |
|
401 | - redirect(base_url() . 'user/user/'); |
|
402 | - } |
|
403 | - $this->load->module("user/refill"); |
|
404 | - if ($action == "GET_AMT") { |
|
405 | - $amount = $this->input->post("value", true); |
|
406 | - $this->refill->convert_amount($amount); |
|
407 | - } else { |
|
408 | - $this->refill->index(); |
|
409 | - } |
|
410 | - } |
|
411 | - |
|
412 | - function user_convert_amount($amount) { |
|
413 | - $amount = $this->common_model->add_calculate_currency($amount, "", "", false, false); |
|
414 | - echo number_format($amount, 5); |
|
415 | - } |
|
391 | + $row['inc'] |
|
392 | + ); |
|
393 | + } |
|
394 | + } |
|
395 | + $this->load->helper('csv'); |
|
396 | + array_to_csv($inbound_array, 'Rates_' . date("Y-m-d") . '.csv'); |
|
397 | + } |
|
398 | + |
|
399 | + function user_refill($action = "") { |
|
400 | + if (common_model::$global_config['system_config']['paypal_status'] == 1) { |
|
401 | + redirect(base_url() . 'user/user/'); |
|
402 | + } |
|
403 | + $this->load->module("user/refill"); |
|
404 | + if ($action == "GET_AMT") { |
|
405 | + $amount = $this->input->post("value", true); |
|
406 | + $this->refill->convert_amount($amount); |
|
407 | + } else { |
|
408 | + $this->refill->index(); |
|
409 | + } |
|
410 | + } |
|
411 | + |
|
412 | + function user_convert_amount($amount) { |
|
413 | + $amount = $this->common_model->add_calculate_currency($amount, "", "", false, false); |
|
414 | + echo number_format($amount, 5); |
|
415 | + } |
|
416 | 416 | |
417 | 417 | |
418 | - function user_report_export() { |
|
419 | - $this->load->module('reports/reports'); |
|
420 | - $this->user_cdrreport_export(); |
|
421 | - } |
|
422 | - |
|
423 | - function change_password() { |
|
424 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
425 | - $id = $accountinfo['id']; |
|
426 | - $this->load->model('user_model'); |
|
427 | - |
|
428 | - $query = $this->user_model->change_password($id); |
|
429 | - foreach ($query as $row) { |
|
430 | - $data['password'] = $row->password; |
|
431 | - } |
|
432 | - $databasepassword = $data['password']; |
|
433 | - $password = $_POST['oldpassword']; |
|
434 | - $newpassword = $_POST['newpassword']; |
|
435 | - $conformpassword = $_POST['conformpassword']; |
|
436 | - if ($databasepassword == $password) { |
|
437 | - |
|
438 | - if ($conformpassword == $newpassword) { |
|
439 | - $update = $newpassword; |
|
440 | - $this->load->model('user_model'); |
|
441 | - $this->user_model->change_db_password($update, $id); |
|
442 | - $this->session->set_flashdata('astpp_errormsg', "Password changed Sucessfully....!!!"); |
|
443 | - redirect(base_url() . 'user/user/changepassword/'); |
|
444 | - } else { |
|
445 | - $this->session->set_flashdata('astpp_notification', "New Password & Conformpassword not match."); |
|
446 | - redirect(base_url() . 'user/user/changepassword/'); |
|
447 | - } |
|
448 | - } else { |
|
449 | - $this->session->set_flashdata('astpp_notification', "Invalid old passwword."); |
|
450 | - redirect(base_url() . 'user/user/changepassword/'); |
|
451 | - } |
|
452 | - } |
|
453 | - |
|
454 | - function changepassword() { |
|
455 | - $data['username'] = $this->session->userdata('user_name'); |
|
456 | - $data['page_title'] = 'Change Password'; |
|
457 | - $this->load->view('view_changepassword', $data); |
|
458 | - } |
|
459 | - |
|
460 | - function user_generate_password() { |
|
461 | - echo $this->common->generate_password(); |
|
462 | - } |
|
463 | - |
|
464 | - function user_generate_number($digit) { |
|
465 | - echo $this->common->find_uniq_rendno($digit, 'number', 'accounts'); |
|
466 | - } |
|
467 | - |
|
468 | - function user_refill_coupon_list() { |
|
469 | - $data['username'] = $this->session->userdata('user_name'); |
|
470 | - $data['page_title'] = 'Refill Coupon List'; |
|
471 | - $this->load->module('refill_coupon/refill_coupon'); |
|
472 | - $data['grid_fields'] = $this->refill_coupon->refill_coupon_form->build_user_refill_coupon_grid(); |
|
473 | - $acc_data = $this->session->userdata("accountinfo"); |
|
474 | - $reseller_id = $acc_data['reseller_id']; |
|
475 | - |
|
476 | - $drp_data = $this->db->query("SELECT id,CONCAT(number,'(',amount,')') as details,number FROM refill_coupon WHERE status = '0' and reseller_id='" . $reseller_id . "'"); |
|
477 | - $reseller_data = array(); |
|
478 | - $data['refill_coupon_list'] = form_dropdown_all('refill_coupon_list', $reseller_data, ''); |
|
479 | - $this->load->view('view_refill_coupon_list', $data); |
|
480 | - } |
|
481 | - |
|
482 | - function user_refill_coupon_list_json() { |
|
483 | - $account_data = $this->session->userdata("accountinfo"); |
|
484 | - |
|
485 | - $this->load->module('refill_coupon/refill_coupon'); |
|
486 | - $this->refill_coupon->refill_coupon_customer_json($account_data["id"]); |
|
487 | - } |
|
488 | - |
|
489 | - function user_refill_coupon_number($refill_coupon_no) { |
|
490 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
491 | - $reseller_id = $accountinfo['reseller_id']; |
|
492 | - $customer_id = $accountinfo['id']; |
|
493 | - $this->db->where('reseller_id', $reseller_id); |
|
494 | - $this->db->where('number', $refill_coupon_no); |
|
495 | - $this->db->select('*'); |
|
496 | - $refill_coupon_result = $this->db->get('refill_coupon'); |
|
497 | - if ($refill_coupon_result->num_rows() > 0) { |
|
498 | - $refill_coupon_result = $refill_coupon_result->result_array(); |
|
499 | - $refill_coupon_result = $refill_coupon_result[0]; |
|
500 | - if ($refill_coupon_result['status'] == 1) { |
|
501 | - echo json_encode(1); |
|
502 | - } elseif ($refill_coupon_result['status'] == 2) { |
|
503 | - echo json_encode(2); |
|
504 | - } else { |
|
505 | - $this->db->select('balance'); |
|
506 | - $result = (array)$this->db->get_where('accounts',array('id'=>$customer_id))->first_row(); |
|
507 | - $user_balance=$this->db_model->get_available_bal($accountinfo); |
|
508 | - $original_balance=$refill_coupon_result['amount']; |
|
509 | - $refill_coupon_result['amount'] = $this->common_model->to_calculate_currency($original_balance,'','',TRUE,TRUE); |
|
510 | - $refill_coupon_result['new_balance'] = $this->common_model->to_calculate_currency($user_balance+$original_balance,'','',TRUE,TRUE); |
|
511 | - echo json_encode($refill_coupon_result); |
|
512 | - } |
|
513 | - } else { |
|
514 | - echo json_encode(3); |
|
515 | - } |
|
516 | - } |
|
517 | - |
|
518 | - function user_refill_coupon_action($refill_coupon_no) { |
|
519 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
520 | - $reseller_id = $accountinfo['reseller_id']; |
|
521 | - if ($reseller_id == 0) { |
|
522 | - $reseller_id = '-1'; |
|
523 | - } |
|
524 | - $date = gmdate('Y-m-d H:i:s'); |
|
525 | - $customer_id = $accountinfo['id']; |
|
526 | - $this->db->where('number', $refill_coupon_no); |
|
527 | - $this->db->select('amount'); |
|
528 | - $result = $this->db->get('refill_coupon'); |
|
529 | - if ($result->num_rows() > 0) { |
|
530 | - $result = $result->result_array(); |
|
531 | - $amount = $result[0]['amount']; |
|
532 | - $this->db->where('id', $customer_id); |
|
533 | - $this->db->select('balance'); |
|
534 | - $result = $this->db->get('accounts'); |
|
535 | - $result = $result->result_array(); |
|
536 | - $current_balance = $result[0]['balance']; |
|
537 | - $new_balance = $current_balance + $amount; |
|
538 | - $data = array('balance' => $new_balance); |
|
539 | - $this->db->where('id', $customer_id); |
|
540 | - $this->db->update('accounts', $data); |
|
541 | - $this->db->where('number', $refill_coupon_no); |
|
542 | - $refill_coupon_data = array('status' => 2, "account_id" => $customer_id, 'firstused' => $date); |
|
543 | - $this->db->update('refill_coupon', $refill_coupon_data); |
|
544 | - $payment_arr = array("accountid" => $customer_id, 'type' => 'refill_coupon', 'credit' => $amount, 'payment_by' => $reseller_id, 'payment_date' => $date, 'refill_coupon_number' => $refill_coupon_no, 'notes' => 'Recharge using Refill coupon,Refill coupon No. ' . $refill_coupon_no . ''); |
|
545 | - $this->db->insert('payments', $payment_arr); |
|
546 | - } |
|
547 | - redirect(base_url() . "user/user_refill_coupon_list/"); |
|
548 | - } |
|
549 | - |
|
550 | - function user_packages() { |
|
551 | - $data['page_title'] = 'Packages'; |
|
552 | - $data['grid_fields'] = $this->user_form->build_packages_list_for_user(); |
|
553 | - $this->load->view('view_user_packages_list', $data); |
|
554 | - } |
|
555 | - |
|
556 | - function user_packages_json() { |
|
557 | - $json_data = array(); |
|
558 | - $count_all = $this->user_model->get_user_packages_list(false,'',''); |
|
559 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
560 | - $json_data = $paging_data["json_paging"]; |
|
561 | - $query = $this->user_model->get_user_packages_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
562 | - $grid_fields = json_decode($this->user_form->build_packages_list_for_user()); |
|
563 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
564 | - echo json_encode($json_data); |
|
565 | - } |
|
566 | - |
|
567 | - function user_invoices() { |
|
568 | - $data['page_title'] = 'Invoices'; |
|
569 | - $this->load->view('view_user_invoices_list', $data); |
|
570 | - } |
|
571 | - |
|
572 | - function user_invoices_json() { |
|
573 | - $json_data = array(); |
|
574 | - $count_all = $this->user_model->get_user_invoices_list(false); |
|
575 | - $paging_data = $this->form->load_grid_config($count_all, 10, 1); |
|
576 | - $json_data = $paging_data["json_paging"]; |
|
577 | - $query = $this->user_model->get_user_invoices_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
578 | - $this->load->module('invoices/invoices'); |
|
579 | - $grid_fields = json_decode($this->user_form->build_invoices_list_for_user()); |
|
580 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
581 | - echo json_encode($json_data); |
|
582 | - } |
|
583 | - |
|
584 | - function user_emails() { |
|
585 | - $data['page_title'] = 'EMails'; |
|
586 | - $data['grid_fields'] = $this->user_form->build_emails_list_for_user(); |
|
587 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_emails_search()); |
|
588 | - $this->load->view('view_user_emails_list', $data); |
|
589 | - } |
|
590 | - |
|
591 | - function user_emails_json() { |
|
592 | - $json_data = array(); |
|
593 | - $count_all = $this->user_model->get_user_emails_list(false); |
|
594 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
595 | - $json_data = $paging_data["json_paging"]; |
|
596 | - $query = $this->user_model->get_user_emails_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
597 | - $grid_fields = json_decode($this->user_form->build_emails_list_for_user()); |
|
598 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
599 | - echo json_encode($json_data); |
|
600 | - } |
|
601 | - function user_emails_search(){ |
|
602 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
603 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
604 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
605 | - $action = $this->input->post(); |
|
606 | - unset($action['action'],$action['advance_search']); |
|
607 | - $this->session->set_userdata('user_emails_search', $action); |
|
608 | - } |
|
609 | - if (@$ajax_search != 1) { |
|
610 | - redirect(base_url() . 'user/user_emails/'); |
|
611 | - } |
|
612 | - } |
|
613 | - function user_emails_clearsearchfilter(){ |
|
614 | - $this->session->set_userdata('advance_search', 0); |
|
615 | - $this->session->set_userdata('user_emails_search', ""); |
|
616 | - } |
|
617 | - function user_invoice_config() { |
|
618 | - $data['page_title'] = 'Company Profile'; |
|
619 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
620 | - $add_array = $this->input->post(); |
|
621 | - $data["account_data"] = $add_array; |
|
622 | - if (isset($add_array['submit'])) { |
|
623 | - if ($_FILES['file']['name'] == '') { |
|
624 | - $invoiceconf = $this->user_model->get_invoiceconf(); |
|
625 | - $file_name=($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : ''; |
|
626 | - } |
|
627 | - if (isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') { |
|
628 | - $files = $_FILES['file']; |
|
629 | - if ($files['size'] < 0) { |
|
630 | - $this->session->set_flashdata('astpp_notification', 'PLease upload maximum file'); |
|
631 | - redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
632 | - } |
|
633 | - $file = $_FILES['file']; |
|
634 | - $uploadedFile = $file["tmp_name"]; |
|
635 | - $file_name = $file['name']; |
|
636 | - $file_type = $file['type']; |
|
637 | - if ($file_type == 'image/jpg' || $file_type == 'image/png' || $file_type == 'image/jpeg') { |
|
638 | - $dir_path = FCPATH. "upload/"; |
|
639 | - $path = $dir_path . $add_array['accountid']."_".$file['name']; |
|
640 | - if (move_uploaded_file($uploadedFile, $path)) { |
|
641 | - $this->session->set_flashdata('astpp_errormsg', gettext('files added successfully!')); |
|
642 | - } else { |
|
643 | - $this->session->set_flashdata('astpp_notification', "File Uploading Fail Please Try Again"); |
|
644 | - redirect(base_url() . 'user/user_invoice_config/'); |
|
645 | - } |
|
646 | - } else { |
|
647 | - $this->session->set_flashdata('astpp_notification', 'Please upload only image!'); |
|
648 | - redirect(base_url() . 'user/user_invoice_config/'); |
|
649 | - } |
|
650 | - } |
|
651 | - $add_array['logo'] = $file_name; |
|
652 | - unset($add_array['submit']); |
|
653 | - if ($add_array['id'] == '') { |
|
654 | - $add_array['accountid'] = $accountinfo['id']; |
|
655 | - $this->user_model->add_invoice_config($add_array); |
|
656 | - } else { |
|
657 | - $this->user_model->edit_invoice_config($add_array, $add_array['id']); |
|
658 | - } |
|
659 | - $this->session->set_flashdata('astpp_errormsg', 'Invoice config updated successfully!'); |
|
660 | - redirect(base_url() . 'user/user_invoice_config/'); |
|
661 | - } else { |
|
662 | - $data["account_data"] =(array)$this->db->get_where('invoice_conf',array("accountid"=>$accountinfo['id']))->first_row(); |
|
663 | - if(isset($data["account_data"]['logo'])){ |
|
664 | - $data["account_data"]['file']=$accountinfo['id']."_".$data["account_data"]['logo']; |
|
665 | - } |
|
666 | - $this->load->view('view_user_invoices_config', $data); |
|
667 | - } |
|
668 | - } |
|
669 | - |
|
670 | - function user_invoice_logo_delete($accountid){ |
|
418 | + function user_report_export() { |
|
419 | + $this->load->module('reports/reports'); |
|
420 | + $this->user_cdrreport_export(); |
|
421 | + } |
|
422 | + |
|
423 | + function change_password() { |
|
424 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
425 | + $id = $accountinfo['id']; |
|
426 | + $this->load->model('user_model'); |
|
427 | + |
|
428 | + $query = $this->user_model->change_password($id); |
|
429 | + foreach ($query as $row) { |
|
430 | + $data['password'] = $row->password; |
|
431 | + } |
|
432 | + $databasepassword = $data['password']; |
|
433 | + $password = $_POST['oldpassword']; |
|
434 | + $newpassword = $_POST['newpassword']; |
|
435 | + $conformpassword = $_POST['conformpassword']; |
|
436 | + if ($databasepassword == $password) { |
|
437 | + |
|
438 | + if ($conformpassword == $newpassword) { |
|
439 | + $update = $newpassword; |
|
440 | + $this->load->model('user_model'); |
|
441 | + $this->user_model->change_db_password($update, $id); |
|
442 | + $this->session->set_flashdata('astpp_errormsg', "Password changed Sucessfully....!!!"); |
|
443 | + redirect(base_url() . 'user/user/changepassword/'); |
|
444 | + } else { |
|
445 | + $this->session->set_flashdata('astpp_notification', "New Password & Conformpassword not match."); |
|
446 | + redirect(base_url() . 'user/user/changepassword/'); |
|
447 | + } |
|
448 | + } else { |
|
449 | + $this->session->set_flashdata('astpp_notification', "Invalid old passwword."); |
|
450 | + redirect(base_url() . 'user/user/changepassword/'); |
|
451 | + } |
|
452 | + } |
|
453 | + |
|
454 | + function changepassword() { |
|
455 | + $data['username'] = $this->session->userdata('user_name'); |
|
456 | + $data['page_title'] = 'Change Password'; |
|
457 | + $this->load->view('view_changepassword', $data); |
|
458 | + } |
|
459 | + |
|
460 | + function user_generate_password() { |
|
461 | + echo $this->common->generate_password(); |
|
462 | + } |
|
463 | + |
|
464 | + function user_generate_number($digit) { |
|
465 | + echo $this->common->find_uniq_rendno($digit, 'number', 'accounts'); |
|
466 | + } |
|
467 | + |
|
468 | + function user_refill_coupon_list() { |
|
469 | + $data['username'] = $this->session->userdata('user_name'); |
|
470 | + $data['page_title'] = 'Refill Coupon List'; |
|
471 | + $this->load->module('refill_coupon/refill_coupon'); |
|
472 | + $data['grid_fields'] = $this->refill_coupon->refill_coupon_form->build_user_refill_coupon_grid(); |
|
473 | + $acc_data = $this->session->userdata("accountinfo"); |
|
474 | + $reseller_id = $acc_data['reseller_id']; |
|
475 | + |
|
476 | + $drp_data = $this->db->query("SELECT id,CONCAT(number,'(',amount,')') as details,number FROM refill_coupon WHERE status = '0' and reseller_id='" . $reseller_id . "'"); |
|
477 | + $reseller_data = array(); |
|
478 | + $data['refill_coupon_list'] = form_dropdown_all('refill_coupon_list', $reseller_data, ''); |
|
479 | + $this->load->view('view_refill_coupon_list', $data); |
|
480 | + } |
|
481 | + |
|
482 | + function user_refill_coupon_list_json() { |
|
483 | + $account_data = $this->session->userdata("accountinfo"); |
|
484 | + |
|
485 | + $this->load->module('refill_coupon/refill_coupon'); |
|
486 | + $this->refill_coupon->refill_coupon_customer_json($account_data["id"]); |
|
487 | + } |
|
488 | + |
|
489 | + function user_refill_coupon_number($refill_coupon_no) { |
|
490 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
491 | + $reseller_id = $accountinfo['reseller_id']; |
|
492 | + $customer_id = $accountinfo['id']; |
|
493 | + $this->db->where('reseller_id', $reseller_id); |
|
494 | + $this->db->where('number', $refill_coupon_no); |
|
495 | + $this->db->select('*'); |
|
496 | + $refill_coupon_result = $this->db->get('refill_coupon'); |
|
497 | + if ($refill_coupon_result->num_rows() > 0) { |
|
498 | + $refill_coupon_result = $refill_coupon_result->result_array(); |
|
499 | + $refill_coupon_result = $refill_coupon_result[0]; |
|
500 | + if ($refill_coupon_result['status'] == 1) { |
|
501 | + echo json_encode(1); |
|
502 | + } elseif ($refill_coupon_result['status'] == 2) { |
|
503 | + echo json_encode(2); |
|
504 | + } else { |
|
505 | + $this->db->select('balance'); |
|
506 | + $result = (array)$this->db->get_where('accounts',array('id'=>$customer_id))->first_row(); |
|
507 | + $user_balance=$this->db_model->get_available_bal($accountinfo); |
|
508 | + $original_balance=$refill_coupon_result['amount']; |
|
509 | + $refill_coupon_result['amount'] = $this->common_model->to_calculate_currency($original_balance,'','',TRUE,TRUE); |
|
510 | + $refill_coupon_result['new_balance'] = $this->common_model->to_calculate_currency($user_balance+$original_balance,'','',TRUE,TRUE); |
|
511 | + echo json_encode($refill_coupon_result); |
|
512 | + } |
|
513 | + } else { |
|
514 | + echo json_encode(3); |
|
515 | + } |
|
516 | + } |
|
517 | + |
|
518 | + function user_refill_coupon_action($refill_coupon_no) { |
|
519 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
520 | + $reseller_id = $accountinfo['reseller_id']; |
|
521 | + if ($reseller_id == 0) { |
|
522 | + $reseller_id = '-1'; |
|
523 | + } |
|
524 | + $date = gmdate('Y-m-d H:i:s'); |
|
525 | + $customer_id = $accountinfo['id']; |
|
526 | + $this->db->where('number', $refill_coupon_no); |
|
527 | + $this->db->select('amount'); |
|
528 | + $result = $this->db->get('refill_coupon'); |
|
529 | + if ($result->num_rows() > 0) { |
|
530 | + $result = $result->result_array(); |
|
531 | + $amount = $result[0]['amount']; |
|
532 | + $this->db->where('id', $customer_id); |
|
533 | + $this->db->select('balance'); |
|
534 | + $result = $this->db->get('accounts'); |
|
535 | + $result = $result->result_array(); |
|
536 | + $current_balance = $result[0]['balance']; |
|
537 | + $new_balance = $current_balance + $amount; |
|
538 | + $data = array('balance' => $new_balance); |
|
539 | + $this->db->where('id', $customer_id); |
|
540 | + $this->db->update('accounts', $data); |
|
541 | + $this->db->where('number', $refill_coupon_no); |
|
542 | + $refill_coupon_data = array('status' => 2, "account_id" => $customer_id, 'firstused' => $date); |
|
543 | + $this->db->update('refill_coupon', $refill_coupon_data); |
|
544 | + $payment_arr = array("accountid" => $customer_id, 'type' => 'refill_coupon', 'credit' => $amount, 'payment_by' => $reseller_id, 'payment_date' => $date, 'refill_coupon_number' => $refill_coupon_no, 'notes' => 'Recharge using Refill coupon,Refill coupon No. ' . $refill_coupon_no . ''); |
|
545 | + $this->db->insert('payments', $payment_arr); |
|
546 | + } |
|
547 | + redirect(base_url() . "user/user_refill_coupon_list/"); |
|
548 | + } |
|
549 | + |
|
550 | + function user_packages() { |
|
551 | + $data['page_title'] = 'Packages'; |
|
552 | + $data['grid_fields'] = $this->user_form->build_packages_list_for_user(); |
|
553 | + $this->load->view('view_user_packages_list', $data); |
|
554 | + } |
|
555 | + |
|
556 | + function user_packages_json() { |
|
557 | + $json_data = array(); |
|
558 | + $count_all = $this->user_model->get_user_packages_list(false,'',''); |
|
559 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
560 | + $json_data = $paging_data["json_paging"]; |
|
561 | + $query = $this->user_model->get_user_packages_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
562 | + $grid_fields = json_decode($this->user_form->build_packages_list_for_user()); |
|
563 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
564 | + echo json_encode($json_data); |
|
565 | + } |
|
566 | + |
|
567 | + function user_invoices() { |
|
568 | + $data['page_title'] = 'Invoices'; |
|
569 | + $this->load->view('view_user_invoices_list', $data); |
|
570 | + } |
|
571 | + |
|
572 | + function user_invoices_json() { |
|
573 | + $json_data = array(); |
|
574 | + $count_all = $this->user_model->get_user_invoices_list(false); |
|
575 | + $paging_data = $this->form->load_grid_config($count_all, 10, 1); |
|
576 | + $json_data = $paging_data["json_paging"]; |
|
577 | + $query = $this->user_model->get_user_invoices_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
578 | + $this->load->module('invoices/invoices'); |
|
579 | + $grid_fields = json_decode($this->user_form->build_invoices_list_for_user()); |
|
580 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
581 | + echo json_encode($json_data); |
|
582 | + } |
|
583 | + |
|
584 | + function user_emails() { |
|
585 | + $data['page_title'] = 'EMails'; |
|
586 | + $data['grid_fields'] = $this->user_form->build_emails_list_for_user(); |
|
587 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_emails_search()); |
|
588 | + $this->load->view('view_user_emails_list', $data); |
|
589 | + } |
|
590 | + |
|
591 | + function user_emails_json() { |
|
592 | + $json_data = array(); |
|
593 | + $count_all = $this->user_model->get_user_emails_list(false); |
|
594 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
595 | + $json_data = $paging_data["json_paging"]; |
|
596 | + $query = $this->user_model->get_user_emails_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
597 | + $grid_fields = json_decode($this->user_form->build_emails_list_for_user()); |
|
598 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
599 | + echo json_encode($json_data); |
|
600 | + } |
|
601 | + function user_emails_search(){ |
|
602 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
603 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
604 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
605 | + $action = $this->input->post(); |
|
606 | + unset($action['action'],$action['advance_search']); |
|
607 | + $this->session->set_userdata('user_emails_search', $action); |
|
608 | + } |
|
609 | + if (@$ajax_search != 1) { |
|
610 | + redirect(base_url() . 'user/user_emails/'); |
|
611 | + } |
|
612 | + } |
|
613 | + function user_emails_clearsearchfilter(){ |
|
614 | + $this->session->set_userdata('advance_search', 0); |
|
615 | + $this->session->set_userdata('user_emails_search', ""); |
|
616 | + } |
|
617 | + function user_invoice_config() { |
|
618 | + $data['page_title'] = 'Company Profile'; |
|
619 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
620 | + $add_array = $this->input->post(); |
|
621 | + $data["account_data"] = $add_array; |
|
622 | + if (isset($add_array['submit'])) { |
|
623 | + if ($_FILES['file']['name'] == '') { |
|
624 | + $invoiceconf = $this->user_model->get_invoiceconf(); |
|
625 | + $file_name=($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : ''; |
|
626 | + } |
|
627 | + if (isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') { |
|
628 | + $files = $_FILES['file']; |
|
629 | + if ($files['size'] < 0) { |
|
630 | + $this->session->set_flashdata('astpp_notification', 'PLease upload maximum file'); |
|
631 | + redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
632 | + } |
|
633 | + $file = $_FILES['file']; |
|
634 | + $uploadedFile = $file["tmp_name"]; |
|
635 | + $file_name = $file['name']; |
|
636 | + $file_type = $file['type']; |
|
637 | + if ($file_type == 'image/jpg' || $file_type == 'image/png' || $file_type == 'image/jpeg') { |
|
638 | + $dir_path = FCPATH. "upload/"; |
|
639 | + $path = $dir_path . $add_array['accountid']."_".$file['name']; |
|
640 | + if (move_uploaded_file($uploadedFile, $path)) { |
|
641 | + $this->session->set_flashdata('astpp_errormsg', gettext('files added successfully!')); |
|
642 | + } else { |
|
643 | + $this->session->set_flashdata('astpp_notification', "File Uploading Fail Please Try Again"); |
|
644 | + redirect(base_url() . 'user/user_invoice_config/'); |
|
645 | + } |
|
646 | + } else { |
|
647 | + $this->session->set_flashdata('astpp_notification', 'Please upload only image!'); |
|
648 | + redirect(base_url() . 'user/user_invoice_config/'); |
|
649 | + } |
|
650 | + } |
|
651 | + $add_array['logo'] = $file_name; |
|
652 | + unset($add_array['submit']); |
|
653 | + if ($add_array['id'] == '') { |
|
654 | + $add_array['accountid'] = $accountinfo['id']; |
|
655 | + $this->user_model->add_invoice_config($add_array); |
|
656 | + } else { |
|
657 | + $this->user_model->edit_invoice_config($add_array, $add_array['id']); |
|
658 | + } |
|
659 | + $this->session->set_flashdata('astpp_errormsg', 'Invoice config updated successfully!'); |
|
660 | + redirect(base_url() . 'user/user_invoice_config/'); |
|
661 | + } else { |
|
662 | + $data["account_data"] =(array)$this->db->get_where('invoice_conf',array("accountid"=>$accountinfo['id']))->first_row(); |
|
663 | + if(isset($data["account_data"]['logo'])){ |
|
664 | + $data["account_data"]['file']=$accountinfo['id']."_".$data["account_data"]['logo']; |
|
665 | + } |
|
666 | + $this->load->view('view_user_invoices_config', $data); |
|
667 | + } |
|
668 | + } |
|
669 | + |
|
670 | + function user_invoice_logo_delete($accountid){ |
|
671 | 671 | $invoiceconf = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid)); |
672 | 672 | $result=$invoiceconf->result_array(); |
673 | 673 | $logo=$result[0]['logo']; |
@@ -675,164 +675,164 @@ discard block |
||
675 | 675 | $where_arr=array('logo'=>$logo); |
676 | 676 | $this->db->where($where_arr); |
677 | 677 | $this->db->update('invoice_conf',$post_arr); |
678 | - } |
|
678 | + } |
|
679 | 679 | |
680 | - function user_myprofile() { |
|
681 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
682 | - $entity_name = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
|
683 | - $data['page_title'] = 'My Profile'; |
|
684 | - $add_array = $this->input->post(); |
|
685 | - if ($add_array['id'] != '') { |
|
686 | - $add_array['type'] = $accountinfo['type']; |
|
687 | - $data['form'] = $this->form->build_form($this->user_form->get_userprofile_form_fields($add_array), $add_array); |
|
688 | - if ($this->form_validation->run() == FALSE) { |
|
689 | - $data['validation_errors'] = validation_errors(); |
|
690 | - } else { |
|
691 | - if ($add_array['id'] == $accountinfo['id']) { |
|
692 | - $this->user_model->edit_account($add_array, $add_array['id']); |
|
693 | - $result = $this->db->get_where('accounts', array('id' => $add_array['id'])); |
|
694 | - $result = $result->result_array(); |
|
695 | - $this->session->set_userdata('accountinfo', $result[0]); |
|
696 | - $this->session->set_flashdata('astpp_errormsg',' Your profile updated successfully!'); |
|
697 | - redirect(base_url() . 'user/user_myprofile/'); |
|
698 | - }else{ |
|
699 | - $this->session->set_flashdata('astpp_notification', 'Something wrong.Please contact to administrator.'); |
|
700 | - } |
|
701 | - } |
|
702 | - } else { |
|
703 | - $where = array('id' => $accountinfo["id"]); |
|
704 | - $account = $this->db_model->getSelect("*", "accounts", $where); |
|
705 | - $data["account_data"] = $account->result_array(); |
|
706 | - |
|
707 | - foreach ($account->result_array() as $key => $value) { |
|
708 | - $editable_data = $value; |
|
709 | - } |
|
710 | - $editable_data['password'] = $this->common->decode($editable_data['password']); |
|
711 | - $data['form'] = $this->form->build_form($this->user_form->get_userprofile_form_fields($editable_data), $editable_data); |
|
712 | - } |
|
713 | - $this->load->view('view_user_details', $data); |
|
714 | - } |
|
680 | + function user_myprofile() { |
|
681 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
682 | + $entity_name = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
|
683 | + $data['page_title'] = 'My Profile'; |
|
684 | + $add_array = $this->input->post(); |
|
685 | + if ($add_array['id'] != '') { |
|
686 | + $add_array['type'] = $accountinfo['type']; |
|
687 | + $data['form'] = $this->form->build_form($this->user_form->get_userprofile_form_fields($add_array), $add_array); |
|
688 | + if ($this->form_validation->run() == FALSE) { |
|
689 | + $data['validation_errors'] = validation_errors(); |
|
690 | + } else { |
|
691 | + if ($add_array['id'] == $accountinfo['id']) { |
|
692 | + $this->user_model->edit_account($add_array, $add_array['id']); |
|
693 | + $result = $this->db->get_where('accounts', array('id' => $add_array['id'])); |
|
694 | + $result = $result->result_array(); |
|
695 | + $this->session->set_userdata('accountinfo', $result[0]); |
|
696 | + $this->session->set_flashdata('astpp_errormsg',' Your profile updated successfully!'); |
|
697 | + redirect(base_url() . 'user/user_myprofile/'); |
|
698 | + }else{ |
|
699 | + $this->session->set_flashdata('astpp_notification', 'Something wrong.Please contact to administrator.'); |
|
700 | + } |
|
701 | + } |
|
702 | + } else { |
|
703 | + $where = array('id' => $accountinfo["id"]); |
|
704 | + $account = $this->db_model->getSelect("*", "accounts", $where); |
|
705 | + $data["account_data"] = $account->result_array(); |
|
706 | + |
|
707 | + foreach ($account->result_array() as $key => $value) { |
|
708 | + $editable_data = $value; |
|
709 | + } |
|
710 | + $editable_data['password'] = $this->common->decode($editable_data['password']); |
|
711 | + $data['form'] = $this->form->build_form($this->user_form->get_userprofile_form_fields($editable_data), $editable_data); |
|
712 | + } |
|
713 | + $this->load->view('view_user_details', $data); |
|
714 | + } |
|
715 | 715 | |
716 | - function user_change_password() { |
|
717 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
718 | - $data['page_title'] = "Change Password"; |
|
719 | - $add_array = $this->input->post(); |
|
720 | - if(!empty($add_array)) { |
|
721 | - $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(), $add_array); |
|
722 | - if ($this->form_validation->run() == FALSE) { |
|
723 | - $data['validation_errors'] = validation_errors(); |
|
724 | - } else { |
|
725 | - $password_encode = $this->common->encode($add_array['new_password']); |
|
726 | - $data = array('password' => $password_encode); |
|
727 | - $this->db->where('id',$add_array['id']); |
|
728 | - $this->db->update('accounts', $data); |
|
729 | - $this->session->set_flashdata('astpp_errormsg', 'Password updated successfully!'); |
|
730 | - redirect(base_url() . 'user/user_change_password/'); |
|
731 | - } |
|
732 | - }else{ |
|
733 | - $data_array['id']=$accountinfo['id']; |
|
734 | - $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(),$data_array); |
|
735 | - } |
|
736 | - $this->load->view('view_user_change_password', $data); |
|
737 | - } |
|
738 | - |
|
739 | - function user_refill_report() { |
|
740 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
741 | - $data['page_title'] = 'Refill Report'; |
|
742 | - $data['search_flag'] = true; |
|
743 | - $this->session->set_userdata('advance_search', 0); |
|
744 | - $data['grid_fields'] = $this->user_form->build_user_refill_report(); |
|
745 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_refill_report_search()); |
|
746 | - if($accountinfo['type'] == 1){ |
|
747 | - $this->load->view('view_reseller_refill_report', $data); |
|
748 | - }else{ |
|
749 | - $this->load->view('view_user_refill_report', $data); |
|
750 | - } |
|
751 | - } |
|
752 | - |
|
753 | - function user_refill_report_json() { |
|
754 | - $json_data = array(); |
|
755 | - $count_all = $this->user_model->get_user_refill_list(false); |
|
756 | - $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'], $_GET['page']); |
|
757 | - $json_data = $paging_data["json_paging"]; |
|
758 | - $query = $this->user_model->get_user_refill_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
759 | - $grid_fields = json_decode($this->user_form->build_user_refill_report()); |
|
760 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
761 | - echo json_encode($json_data); |
|
762 | - } |
|
716 | + function user_change_password() { |
|
717 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
718 | + $data['page_title'] = "Change Password"; |
|
719 | + $add_array = $this->input->post(); |
|
720 | + if(!empty($add_array)) { |
|
721 | + $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(), $add_array); |
|
722 | + if ($this->form_validation->run() == FALSE) { |
|
723 | + $data['validation_errors'] = validation_errors(); |
|
724 | + } else { |
|
725 | + $password_encode = $this->common->encode($add_array['new_password']); |
|
726 | + $data = array('password' => $password_encode); |
|
727 | + $this->db->where('id',$add_array['id']); |
|
728 | + $this->db->update('accounts', $data); |
|
729 | + $this->session->set_flashdata('astpp_errormsg', 'Password updated successfully!'); |
|
730 | + redirect(base_url() . 'user/user_change_password/'); |
|
731 | + } |
|
732 | + }else{ |
|
733 | + $data_array['id']=$accountinfo['id']; |
|
734 | + $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(),$data_array); |
|
735 | + } |
|
736 | + $this->load->view('view_user_change_password', $data); |
|
737 | + } |
|
738 | + |
|
739 | + function user_refill_report() { |
|
740 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
741 | + $data['page_title'] = 'Refill Report'; |
|
742 | + $data['search_flag'] = true; |
|
743 | + $this->session->set_userdata('advance_search', 0); |
|
744 | + $data['grid_fields'] = $this->user_form->build_user_refill_report(); |
|
745 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_refill_report_search()); |
|
746 | + if($accountinfo['type'] == 1){ |
|
747 | + $this->load->view('view_reseller_refill_report', $data); |
|
748 | + }else{ |
|
749 | + $this->load->view('view_user_refill_report', $data); |
|
750 | + } |
|
751 | + } |
|
752 | + |
|
753 | + function user_refill_report_json() { |
|
754 | + $json_data = array(); |
|
755 | + $count_all = $this->user_model->get_user_refill_list(false); |
|
756 | + $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'], $_GET['page']); |
|
757 | + $json_data = $paging_data["json_paging"]; |
|
758 | + $query = $this->user_model->get_user_refill_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
759 | + $grid_fields = json_decode($this->user_form->build_user_refill_report()); |
|
760 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
761 | + echo json_encode($json_data); |
|
762 | + } |
|
763 | 763 | |
764 | - function user_refill_report_search() { |
|
765 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
766 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
767 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
768 | - $action = $this->input->post(); |
|
769 | - unset($action['action'],$action['advance_search']); |
|
770 | - if (isset($action['credit']['credit']) && $action['credit']['credit'] != '') { |
|
771 | - $action['credit']['credit'] = $this->common_model->add_calculate_currency($action['credit']['credit'], "", '', true, false); |
|
772 | - } |
|
773 | - $this->session->set_userdata('user_refill_report_search', $action); |
|
774 | - } |
|
775 | - if (@$ajax_search != 1) { |
|
776 | - redirect(base_url() . 'user/user_refill_report/'); |
|
777 | - } |
|
778 | - } |
|
764 | + function user_refill_report_search() { |
|
765 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
766 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
767 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
768 | + $action = $this->input->post(); |
|
769 | + unset($action['action'],$action['advance_search']); |
|
770 | + if (isset($action['credit']['credit']) && $action['credit']['credit'] != '') { |
|
771 | + $action['credit']['credit'] = $this->common_model->add_calculate_currency($action['credit']['credit'], "", '', true, false); |
|
772 | + } |
|
773 | + $this->session->set_userdata('user_refill_report_search', $action); |
|
774 | + } |
|
775 | + if (@$ajax_search != 1) { |
|
776 | + redirect(base_url() . 'user/user_refill_report/'); |
|
777 | + } |
|
778 | + } |
|
779 | 779 | |
780 | - function user_refill_report_clearsearchfilter() { |
|
781 | - $this->session->set_userdata('advance_search', 0); |
|
782 | - $this->session->set_userdata('user_refill_report_search', ""); |
|
783 | - } |
|
780 | + function user_refill_report_clearsearchfilter() { |
|
781 | + $this->session->set_userdata('advance_search', 0); |
|
782 | + $this->session->set_userdata('user_refill_report_search', ""); |
|
783 | + } |
|
784 | 784 | |
785 | - function user_invoices_list() { |
|
785 | + function user_invoices_list() { |
|
786 | 786 | $data['page_title'] = 'Invoices'; |
787 | - $data['search_flag'] = true; |
|
788 | - $this->session->set_userdata('advance_search', 0); |
|
789 | - $data['grid_fields'] = $this->user_form->build_user_invoices(); |
|
790 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_invoices_search()); |
|
791 | - $this->load->view('view_user_invoices_list', $data); |
|
792 | - } |
|
793 | - function user_invoices_list_json() { |
|
794 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
795 | - $where = array("accountid" => $accountinfo['id']); |
|
796 | - $count_all = $this->user_model->get_user_invoice_list(false, '', '', $where); |
|
797 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
798 | - $json_data = $paging_data["json_paging"]; |
|
799 | - $user_currency=$this->common->get_field_name('currency','currency',$accountinfo['currency_id']); |
|
800 | - $invoices_query = $this->user_model->get_user_invoice_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $where); |
|
801 | - $invoices_result = $invoices_query->result_array(); |
|
802 | - $ountstanding_value = 0; |
|
803 | - $total_amount = 0; |
|
804 | - $this->db->where('accountid', $accountinfo['id']); |
|
805 | - $this->db->select('sum(credit) as total_credit'); |
|
806 | - $invoice_details_result = $this->db->get('invoice_details'); |
|
807 | - $total_credit = (array)$invoice_details_result->first_row(); |
|
808 | - $total_credit = $total_credit['total_credit']; |
|
809 | - foreach ($invoices_result as $key => $value) { |
|
810 | - $total_amount+=$value['amount']; |
|
811 | - $invoice_date = date("Y-m-d", strtotime($value['invoice_date'])); |
|
812 | - $from_date = date("Y-m-d", strtotime($value['from_date'])); |
|
813 | - $due_date = date("Y-m-d", strtotime($value['due_date'])); |
|
814 | - $outstanding = $value['amount']; |
|
815 | - $invoice_total_query = $this->db_model->select("sum(debit) as debit,sum(credit) as credit,created_date", "invoice_details", array("invoiceid" => $value['id'], "item_type" => "INVPAY"), "created_date", "DESC", "1", "0"); |
|
816 | - if ($invoice_total_query->num_rows() > 0) { |
|
817 | - $invoice_total_query = $invoice_total_query->result_array(); |
|
818 | - $outstanding -= $invoice_total_query[0]['credit']; |
|
819 | - $payment_last = ($invoice_total_query[0]['created_date']) ? date("Y-m-d", strtotime($invoice_total_query[0]['created_date'])) : ''; |
|
820 | - } |
|
821 | - $invoice_total_query = $this->db_model->select("debit,created_date", "invoice_details", array("invoiceid" => $value['id'], "item_type" => "INVPAY"), "created_date", "DESC", "1", "0"); |
|
822 | - if ($invoice_total_query->num_rows() > 0) { |
|
823 | - $invoice_total_result = $invoice_total_query->result_array(); |
|
824 | - } |
|
825 | - $download = '<a href="' . base_url() . '/user/user_invoice_download/' . $value['id'] . '/00' . $value['invoice_prefix'] . $value['invoiceid'] . '" class="btn btn-royelblue btn-sm" title="Download Invoice" ><i class="fa fa-cloud-download fa-fw"></i></a> '; |
|
826 | - if($value['type'] == 'I'){ |
|
827 | - if ($outstanding > 0) { |
|
828 | - $payment = ' <a style="padding: 0 8px;" href="' . base_url() . 'user/user_invoice_payment/' . $value['id'] . '" class="btn btn-warning" title="Payment">Unpaid</a>'; |
|
829 | - } else { |
|
830 | - $payment = ' <button style="padding: 0 8px;" class="btn btn-success" type="button">Paid</button>'; |
|
831 | - } |
|
787 | + $data['search_flag'] = true; |
|
788 | + $this->session->set_userdata('advance_search', 0); |
|
789 | + $data['grid_fields'] = $this->user_form->build_user_invoices(); |
|
790 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_invoices_search()); |
|
791 | + $this->load->view('view_user_invoices_list', $data); |
|
792 | + } |
|
793 | + function user_invoices_list_json() { |
|
794 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
795 | + $where = array("accountid" => $accountinfo['id']); |
|
796 | + $count_all = $this->user_model->get_user_invoice_list(false, '', '', $where); |
|
797 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
798 | + $json_data = $paging_data["json_paging"]; |
|
799 | + $user_currency=$this->common->get_field_name('currency','currency',$accountinfo['currency_id']); |
|
800 | + $invoices_query = $this->user_model->get_user_invoice_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $where); |
|
801 | + $invoices_result = $invoices_query->result_array(); |
|
802 | + $ountstanding_value = 0; |
|
803 | + $total_amount = 0; |
|
804 | + $this->db->where('accountid', $accountinfo['id']); |
|
805 | + $this->db->select('sum(credit) as total_credit'); |
|
806 | + $invoice_details_result = $this->db->get('invoice_details'); |
|
807 | + $total_credit = (array)$invoice_details_result->first_row(); |
|
808 | + $total_credit = $total_credit['total_credit']; |
|
809 | + foreach ($invoices_result as $key => $value) { |
|
810 | + $total_amount+=$value['amount']; |
|
811 | + $invoice_date = date("Y-m-d", strtotime($value['invoice_date'])); |
|
812 | + $from_date = date("Y-m-d", strtotime($value['from_date'])); |
|
813 | + $due_date = date("Y-m-d", strtotime($value['due_date'])); |
|
814 | + $outstanding = $value['amount']; |
|
815 | + $invoice_total_query = $this->db_model->select("sum(debit) as debit,sum(credit) as credit,created_date", "invoice_details", array("invoiceid" => $value['id'], "item_type" => "INVPAY"), "created_date", "DESC", "1", "0"); |
|
816 | + if ($invoice_total_query->num_rows() > 0) { |
|
817 | + $invoice_total_query = $invoice_total_query->result_array(); |
|
818 | + $outstanding -= $invoice_total_query[0]['credit']; |
|
819 | + $payment_last = ($invoice_total_query[0]['created_date']) ? date("Y-m-d", strtotime($invoice_total_query[0]['created_date'])) : ''; |
|
820 | + } |
|
821 | + $invoice_total_query = $this->db_model->select("debit,created_date", "invoice_details", array("invoiceid" => $value['id'], "item_type" => "INVPAY"), "created_date", "DESC", "1", "0"); |
|
822 | + if ($invoice_total_query->num_rows() > 0) { |
|
823 | + $invoice_total_result = $invoice_total_query->result_array(); |
|
824 | + } |
|
825 | + $download = '<a href="' . base_url() . '/user/user_invoice_download/' . $value['id'] . '/00' . $value['invoice_prefix'] . $value['invoiceid'] . '" class="btn btn-royelblue btn-sm" title="Download Invoice" ><i class="fa fa-cloud-download fa-fw"></i></a> '; |
|
826 | + if($value['type'] == 'I'){ |
|
827 | + if ($outstanding > 0) { |
|
828 | + $payment = ' <a style="padding: 0 8px;" href="' . base_url() . 'user/user_invoice_payment/' . $value['id'] . '" class="btn btn-warning" title="Payment">Unpaid</a>'; |
|
829 | + } else { |
|
830 | + $payment = ' <button style="padding: 0 8px;" class="btn btn-success" type="button">Paid</button>'; |
|
831 | + } |
|
832 | 832 | }else{ |
833 | - $payment = ''; |
|
833 | + $payment = ''; |
|
834 | 834 | } |
835 | - if($value['generate_type'] == 1){ |
|
835 | + if($value['generate_type'] == 1){ |
|
836 | 836 | $invoice_type='Manually'; |
837 | 837 | }else{ |
838 | 838 | $invoice_type='Automatically'; |
@@ -859,87 +859,87 @@ discard block |
||
859 | 859 | $download . $payment, |
860 | 860 | )); |
861 | 861 | $ountstanding_value = $ountstanding_value + $outstanding; |
862 | - } |
|
863 | - echo json_encode($json_data); |
|
864 | - } |
|
865 | - |
|
866 | - function user_invoices_list_search() { |
|
867 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
868 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
869 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
870 | - $action = $this->input->post(); |
|
862 | + } |
|
863 | + echo json_encode($json_data); |
|
864 | + } |
|
865 | + |
|
866 | + function user_invoices_list_search() { |
|
867 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
868 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
869 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
870 | + $action = $this->input->post(); |
|
871 | 871 | print_r($action); |
872 | - unset($action['action']); |
|
873 | - unset($action['advance_search']); |
|
874 | - $action['from_date'][0] = $action['from_date'][0] ? $action['from_date'][0] . " 00:00:00" : ''; |
|
875 | - $action['to_date'][1] = $action['to_date'][1] ? $action['to_date'][1] . " 23:59:59" : ''; |
|
876 | - $action['invoice_date'][0] = $action['invoice_date'][0] ? $action['invoice_date'][0] . " 00:00:00" : ''; |
|
877 | - $this->session->set_userdata('user_invoice_list_search', $action); |
|
878 | - } |
|
879 | - if (@$ajax_search != 1) { |
|
880 | - redirect(base_url() . 'user/user_invoice_list/'); |
|
881 | - } |
|
882 | - } |
|
883 | - |
|
884 | - function user_invoices_list_clearsearchfilter() { |
|
885 | - $this->session->set_userdata('advance_search', 0); |
|
886 | - $this->session->set_userdata('user_invoice_list_search', ""); |
|
887 | - } |
|
888 | - |
|
889 | - function user_invoices_download($invoiceid) { |
|
890 | - $this->load->module('invoices/invoices'); |
|
891 | - $this->invoices->invoice_main_download($invoiceid); |
|
892 | - } |
|
893 | - function user_list_responce(){ |
|
872 | + unset($action['action']); |
|
873 | + unset($action['advance_search']); |
|
874 | + $action['from_date'][0] = $action['from_date'][0] ? $action['from_date'][0] . " 00:00:00" : ''; |
|
875 | + $action['to_date'][1] = $action['to_date'][1] ? $action['to_date'][1] . " 23:59:59" : ''; |
|
876 | + $action['invoice_date'][0] = $action['invoice_date'][0] ? $action['invoice_date'][0] . " 00:00:00" : ''; |
|
877 | + $this->session->set_userdata('user_invoice_list_search', $action); |
|
878 | + } |
|
879 | + if (@$ajax_search != 1) { |
|
880 | + redirect(base_url() . 'user/user_invoice_list/'); |
|
881 | + } |
|
882 | + } |
|
883 | + |
|
884 | + function user_invoices_list_clearsearchfilter() { |
|
885 | + $this->session->set_userdata('advance_search', 0); |
|
886 | + $this->session->set_userdata('user_invoice_list_search', ""); |
|
887 | + } |
|
888 | + |
|
889 | + function user_invoices_download($invoiceid) { |
|
890 | + $this->load->module('invoices/invoices'); |
|
891 | + $this->invoices->invoice_main_download($invoiceid); |
|
892 | + } |
|
893 | + function user_list_responce(){ |
|
894 | 894 | $this->load->module('invoices/invoices'); |
895 | - $this->invoices->invoice_list_responce(); |
|
896 | - } |
|
897 | - function user_invoice_payment($invoiceid){ |
|
895 | + $this->invoices->invoice_list_responce(); |
|
896 | + } |
|
897 | + function user_invoice_payment($invoiceid){ |
|
898 | 898 | $this->load->module('invoices/invoices'); |
899 | - $this->invoices->invoice_summary($invoiceid); |
|
900 | - } |
|
901 | - function user_invoice_payment_pay($action=""){ |
|
902 | - $this->load->module("user/payment"); |
|
903 | - if($action=="GET_AMT"){ |
|
904 | - $amount = $this->input->post("value",true); |
|
905 | - $amount = $this->common_model->add_calculate_currency($amount,"","",true,false); |
|
906 | - echo number_format($amount,2); |
|
907 | - }else{ |
|
908 | - $this->payment->index(); |
|
909 | - } |
|
910 | - } |
|
911 | - function user_invoice_download($invoiceid){ |
|
899 | + $this->invoices->invoice_summary($invoiceid); |
|
900 | + } |
|
901 | + function user_invoice_payment_pay($action=""){ |
|
902 | + $this->load->module("user/payment"); |
|
903 | + if($action=="GET_AMT"){ |
|
904 | + $amount = $this->input->post("value",true); |
|
905 | + $amount = $this->common_model->add_calculate_currency($amount,"","",true,false); |
|
906 | + echo number_format($amount,2); |
|
907 | + }else{ |
|
908 | + $this->payment->index(); |
|
909 | + } |
|
910 | + } |
|
911 | + function user_invoice_download($invoiceid){ |
|
912 | 912 | $this->load->module('invoices/invoices'); |
913 | - $this->invoices->invoice_download($invoiceid); |
|
914 | - } |
|
915 | - function user_charges_history() { |
|
913 | + $this->invoices->invoice_download($invoiceid); |
|
914 | + } |
|
915 | + function user_charges_history() { |
|
916 | 916 | $data['page_title'] = 'Charges History'; |
917 | - $this->session->set_userdata('advance_search', 0); |
|
918 | - $data['grid_fields'] = $this->user_form->build_user_charge_history(); |
|
919 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_charge_history_search()); |
|
920 | - $this->load->view('view_user_charges_list', $data); |
|
921 | - } |
|
922 | - |
|
923 | - function user_charges_history_json() { |
|
924 | - $json_data = array(); |
|
925 | - $count_all = $this->user_model->get_user_charge_history(false); |
|
926 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
927 | - $json_data = $paging_data["json_paging"]; |
|
928 | - $query = $this->user_model->get_user_charge_history(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
917 | + $this->session->set_userdata('advance_search', 0); |
|
918 | + $data['grid_fields'] = $this->user_form->build_user_charge_history(); |
|
919 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_charge_history_search()); |
|
920 | + $this->load->view('view_user_charges_list', $data); |
|
921 | + } |
|
922 | + |
|
923 | + function user_charges_history_json() { |
|
924 | + $json_data = array(); |
|
925 | + $count_all = $this->user_model->get_user_charge_history(false); |
|
926 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
927 | + $json_data = $paging_data["json_paging"]; |
|
928 | + $query = $this->user_model->get_user_charge_history(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
929 | 929 | |
930 | 930 | $result= $query->result_array(); |
931 | - $query1 = $this->user_model->get_user_charge_history(true,'',''); |
|
931 | + $query1 = $this->user_model->get_user_charge_history(true,'',''); |
|
932 | 932 | $res= $query1->result_array(); |
933 | 933 | $debit=0; |
934 | 934 | $credit=0; |
935 | 935 | $before_balance=0; |
936 | 936 | $after_balance=0; |
937 | 937 | $i=0; |
938 | - foreach ($result as $key => $value) { |
|
939 | - $date=$this->common->convert_GMT_to('','',$value['created_date']); |
|
940 | - $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
941 | - $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$value['invoiceid'])); |
|
942 | - $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$value['invoiceid'])); |
|
938 | + foreach ($result as $key => $value) { |
|
939 | + $date=$this->common->convert_GMT_to('','',$value['created_date']); |
|
940 | + $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
941 | + $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$value['invoiceid'])); |
|
942 | + $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$value['invoiceid'])); |
|
943 | 943 | $invoice_num=$invoice_prefix.$invoiceid; |
944 | 944 | $account=$this->common->get_field_name_coma_new('first_name,last_name,number','accounts',$value['accountid']); |
945 | 945 | $reseller=$this->common->reseller_select_value('first_name,last_name,number','accounts',$value['reseller_id']); |
@@ -955,17 +955,17 @@ discard block |
||
955 | 955 | $debit=$this->common->convert_to_currency('','',$value['debit']); |
956 | 956 | } |
957 | 957 | $credit=$this->common->convert_to_currency('','',$value['credit']); |
958 | - if($cust_type == 0 && $value['item_type'] == 'INVPAY'){ |
|
958 | + if($cust_type == 0 && $value['item_type'] == 'INVPAY'){ |
|
959 | 959 | $credit = '(-) '.$credit; |
960 | - } |
|
960 | + } |
|
961 | 961 | if($value['after_balance'] == '-'){ |
962 | 962 | $after_balance='-'; |
963 | 963 | }else{ |
964 | 964 | $after_balance=$this->common->convert_to_currency('','',$value['after_balance']); |
965 | 965 | } |
966 | 966 | $description=$value['description']; |
967 | - $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
968 | - $json_data['rows'][] = array('cell' => array( |
|
967 | + $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
968 | + $json_data['rows'][] = array('cell' => array( |
|
969 | 969 | $date, |
970 | 970 | $invoice_num, |
971 | 971 | $item_type, |
@@ -974,1005 +974,1005 @@ discard block |
||
974 | 974 | $credit, |
975 | 975 | $after_balance, |
976 | 976 | $description, |
977 | - )); |
|
977 | + )); |
|
978 | 978 | |
979 | - } |
|
979 | + } |
|
980 | 980 | $debit_sum = 0; |
981 | 981 | $credit_sum = 0; |
982 | 982 | foreach($res as $value){ |
983 | - $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
984 | - $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
983 | + $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
984 | + $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
|
985 | 985 | $debit_sum += $value['debit']; |
986 | 986 | $credit_sum += $value['credit']; |
987 | 987 | $before_balance += $value['before_balance']; |
988 | 988 | $after_balance += $value['after_balance']; |
989 | 989 | } |
990 | - $json_data['rows'][$count_all]['cell']=array('<b>Total</b>','-','-','-','<b>'.$this->common->convert_to_currency('','',$debit_sum).'</b>','<b>'.$this->common->convert_to_currency('','',$credit_sum).'</b>','-','-'); |
|
991 | - echo json_encode($json_data); |
|
992 | - |
|
993 | - |
|
994 | - } |
|
995 | - function user_charges_history_search() { |
|
996 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
997 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
998 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
999 | - $action = $this->input->post(); |
|
1000 | - unset($action['action']); |
|
1001 | - unset($action['advance_search']); |
|
1002 | - $action['created_date'][0] = $action['created_date'][0] ? $action['created_date'][0] . " 00:00:00" : ''; |
|
1003 | - $action['created_date'][1] = $action['created_date'][1] ? $action['created_date'][1] . " 23:59:59" : ''; |
|
1004 | - if (isset($action['debit']['debit']) && $action['debit']['debit'] != '') { |
|
1005 | - $action['debit']['debit'] = $this->common_model->add_calculate_currency($action['debit']['debit'], "", '', true, false); |
|
1006 | - } |
|
1007 | - if (isset($action['credit']['credit']) && $action['credit']['credit'] != '') { |
|
1008 | - $action['credit']['credit'] = $this->common_model->add_calculate_currency($action['credit']['credit'], "", '', true, false); |
|
1009 | - } |
|
1010 | - $this->session->set_userdata('user_charge_history_search', $action); |
|
1011 | - } |
|
1012 | - if (@$ajax_search != 1) { |
|
1013 | - redirect(base_url() . 'user/user_charges_history/'); |
|
1014 | - } |
|
1015 | - } |
|
1016 | - |
|
1017 | - function user_charges_history_clearsearchfilter() { |
|
1018 | - $this->session->set_userdata('advance_search', 0); |
|
1019 | - $this->session->set_userdata('user_charge_history_search', ""); |
|
1020 | - } |
|
1021 | - function user_subscriptions() { |
|
990 | + $json_data['rows'][$count_all]['cell']=array('<b>Total</b>','-','-','-','<b>'.$this->common->convert_to_currency('','',$debit_sum).'</b>','<b>'.$this->common->convert_to_currency('','',$credit_sum).'</b>','-','-'); |
|
991 | + echo json_encode($json_data); |
|
992 | + |
|
993 | + |
|
994 | + } |
|
995 | + function user_charges_history_search() { |
|
996 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
997 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
998 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
999 | + $action = $this->input->post(); |
|
1000 | + unset($action['action']); |
|
1001 | + unset($action['advance_search']); |
|
1002 | + $action['created_date'][0] = $action['created_date'][0] ? $action['created_date'][0] . " 00:00:00" : ''; |
|
1003 | + $action['created_date'][1] = $action['created_date'][1] ? $action['created_date'][1] . " 23:59:59" : ''; |
|
1004 | + if (isset($action['debit']['debit']) && $action['debit']['debit'] != '') { |
|
1005 | + $action['debit']['debit'] = $this->common_model->add_calculate_currency($action['debit']['debit'], "", '', true, false); |
|
1006 | + } |
|
1007 | + if (isset($action['credit']['credit']) && $action['credit']['credit'] != '') { |
|
1008 | + $action['credit']['credit'] = $this->common_model->add_calculate_currency($action['credit']['credit'], "", '', true, false); |
|
1009 | + } |
|
1010 | + $this->session->set_userdata('user_charge_history_search', $action); |
|
1011 | + } |
|
1012 | + if (@$ajax_search != 1) { |
|
1013 | + redirect(base_url() . 'user/user_charges_history/'); |
|
1014 | + } |
|
1015 | + } |
|
1016 | + |
|
1017 | + function user_charges_history_clearsearchfilter() { |
|
1018 | + $this->session->set_userdata('advance_search', 0); |
|
1019 | + $this->session->set_userdata('user_charge_history_search', ""); |
|
1020 | + } |
|
1021 | + function user_subscriptions() { |
|
1022 | 1022 | $data['page_title'] = 'Subscriptions'; |
1023 | - $this->session->set_userdata('advance_search', 0); |
|
1024 | - $data['grid_fields'] = $this->user_form->build_user_subscription(); |
|
1025 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_subscription_search()); |
|
1026 | - $this->load->view('view_user_subscriptions_list', $data); |
|
1027 | - } |
|
1023 | + $this->session->set_userdata('advance_search', 0); |
|
1024 | + $data['grid_fields'] = $this->user_form->build_user_subscription(); |
|
1025 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_subscription_search()); |
|
1026 | + $this->load->view('view_user_subscriptions_list', $data); |
|
1027 | + } |
|
1028 | 1028 | |
1029 | - function user_subscriptions_json() { |
|
1029 | + function user_subscriptions_json() { |
|
1030 | 1030 | |
1031 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1032 | - $json_data = array(); |
|
1033 | - $select = "charge_to_account.id,charges.description,charges.charge,charges.sweep_id"; |
|
1034 | - $table = "charges"; |
|
1035 | - $jionTable = array('charge_to_account', 'accounts'); |
|
1036 | - $jionCondition = array('charges.id = charge_to_account.charge_id', 'accounts.id = charge_to_account.accountid'); |
|
1037 | - $type = array('left', 'inner'); |
|
1038 | - $where = array('accounts.id' => $accountinfo['id']); |
|
1039 | - $order_type = 'charges.id'; |
|
1040 | - $order_by = "ASC"; |
|
1041 | - $this->db_model->build_search("user_subscription_search"); |
|
1042 | - $count_all = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type); |
|
1043 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1044 | - $json_data = $paging_data["json_paging"]; |
|
1045 | - $this->db_model->build_search("user_subscription_search"); |
|
1031 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1032 | + $json_data = array(); |
|
1033 | + $select = "charge_to_account.id,charges.description,charges.charge,charges.sweep_id"; |
|
1034 | + $table = "charges"; |
|
1035 | + $jionTable = array('charge_to_account', 'accounts'); |
|
1036 | + $jionCondition = array('charges.id = charge_to_account.charge_id', 'accounts.id = charge_to_account.accountid'); |
|
1037 | + $type = array('left', 'inner'); |
|
1038 | + $where = array('accounts.id' => $accountinfo['id']); |
|
1039 | + $order_type = 'charges.id'; |
|
1040 | + $order_by = "ASC"; |
|
1041 | + $this->db_model->build_search("user_subscription_search"); |
|
1042 | + $count_all = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type); |
|
1043 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1044 | + $json_data = $paging_data["json_paging"]; |
|
1045 | + $this->db_model->build_search("user_subscription_search"); |
|
1046 | 1046 | |
1047 | - $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, ""); |
|
1048 | - $grid_fields = json_decode($this->user_form->build_user_subscription()); |
|
1049 | - $json_data['rows'] = $this->form->build_grid($account_charge_list, $grid_fields); |
|
1050 | - echo json_encode($json_data); |
|
1051 | - } |
|
1052 | - function user_subscriptions_search() { |
|
1053 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1054 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1055 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1056 | - $action = $this->input->post(); |
|
1057 | - unset($action['action']); |
|
1058 | - unset($action['advance_search']); |
|
1059 | - if (isset($action['charge']['charge']) && $action['charge']['charge'] != '') { |
|
1060 | - $action['charge']['charge'] = $this->common_model->add_calculate_currency($action['charge']['charge'], "", '', true, false); |
|
1061 | - } |
|
1062 | - if(isset($action['sweep_id']) && $action['sweep_id'] != ''){ |
|
1063 | - $action['charges.sweep_id']=$action['sweep_id']; |
|
1064 | - unset($action['sweep_id']); |
|
1065 | - } |
|
1066 | - $this->session->set_userdata('user_subscription_search', $action); |
|
1067 | - } |
|
1068 | - if (@$ajax_search != 1) { |
|
1069 | - redirect(base_url() . 'user/user_subscriptions/'); |
|
1070 | - } |
|
1071 | - } |
|
1072 | - |
|
1073 | - function user_subscriptions_clearsearchfilter() { |
|
1074 | - $this->session->set_userdata('advance_search', 0); |
|
1075 | - $this->session->set_userdata('user_subscription_search', ""); |
|
1076 | - } |
|
1077 | - |
|
1078 | - function user_didlist() { |
|
1079 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1080 | - $data['page_title'] = 'Purchase DIDs'; |
|
1081 | - $data['search_flag'] = true; |
|
1082 | - $data['grid_fields'] = $this->user_form->build_user_didlist(); |
|
1083 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_didlist_search()); |
|
1084 | - $data["grid_buttons"] = array(); |
|
1085 | - $acc_data = $this->session->userdata("accountinfo"); |
|
1086 | - $data['accountid'] = $acc_data['id']; |
|
1087 | - $data['country_id']=$acc_data['country_id']; |
|
1088 | - $result_did_final = array(); |
|
1089 | - if($accountinfo['reseller_id'] > 0){ |
|
1047 | + $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, ""); |
|
1048 | + $grid_fields = json_decode($this->user_form->build_user_subscription()); |
|
1049 | + $json_data['rows'] = $this->form->build_grid($account_charge_list, $grid_fields); |
|
1050 | + echo json_encode($json_data); |
|
1051 | + } |
|
1052 | + function user_subscriptions_search() { |
|
1053 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1054 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1055 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1056 | + $action = $this->input->post(); |
|
1057 | + unset($action['action']); |
|
1058 | + unset($action['advance_search']); |
|
1059 | + if (isset($action['charge']['charge']) && $action['charge']['charge'] != '') { |
|
1060 | + $action['charge']['charge'] = $this->common_model->add_calculate_currency($action['charge']['charge'], "", '', true, false); |
|
1061 | + } |
|
1062 | + if(isset($action['sweep_id']) && $action['sweep_id'] != ''){ |
|
1063 | + $action['charges.sweep_id']=$action['sweep_id']; |
|
1064 | + unset($action['sweep_id']); |
|
1065 | + } |
|
1066 | + $this->session->set_userdata('user_subscription_search', $action); |
|
1067 | + } |
|
1068 | + if (@$ajax_search != 1) { |
|
1069 | + redirect(base_url() . 'user/user_subscriptions/'); |
|
1070 | + } |
|
1071 | + } |
|
1072 | + |
|
1073 | + function user_subscriptions_clearsearchfilter() { |
|
1074 | + $this->session->set_userdata('advance_search', 0); |
|
1075 | + $this->session->set_userdata('user_subscription_search', ""); |
|
1076 | + } |
|
1077 | + |
|
1078 | + function user_didlist() { |
|
1079 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1080 | + $data['page_title'] = 'Purchase DIDs'; |
|
1081 | + $data['search_flag'] = true; |
|
1082 | + $data['grid_fields'] = $this->user_form->build_user_didlist(); |
|
1083 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_didlist_search()); |
|
1084 | + $data["grid_buttons"] = array(); |
|
1085 | + $acc_data = $this->session->userdata("accountinfo"); |
|
1086 | + $data['accountid'] = $acc_data['id']; |
|
1087 | + $data['country_id']=$acc_data['country_id']; |
|
1088 | + $result_did_final = array(); |
|
1089 | + if($accountinfo['reseller_id'] > 0){ |
|
1090 | 1090 | $this->db->select('dids.id, dids.number, reseller_pricing.setup, reseller_pricing.monthlycost'); |
1091 | 1091 | $this->db->where('dids.accountid',0); |
1092 | 1092 | $this->db->where('reseller_pricing.note','dids.number',false); |
1093 | 1093 | $this->db->where('reseller_pricing.reseller_id',$accountinfo['reseller_id']); |
1094 | 1094 | $this->db->from('dids,reseller_pricing'); |
1095 | - }else{ |
|
1095 | + }else{ |
|
1096 | 1096 | $this->db->where('parent_id',0); |
1097 | 1097 | $this->db->where('accountid',0); |
1098 | 1098 | $this->db->select('id,number,setup,monthlycost'); |
1099 | 1099 | $this->db->from('dids'); |
1100 | - } |
|
1101 | - $dids_array=(array)$this->db->get()->result_array(); |
|
1102 | - $drp_list=array(); |
|
1103 | - if(!empty($dids_array)){ |
|
1100 | + } |
|
1101 | + $dids_array=(array)$this->db->get()->result_array(); |
|
1102 | + $drp_list=array(); |
|
1103 | + if(!empty($dids_array)){ |
|
1104 | 1104 | foreach ($dids_array as $drp_value) { |
1105 | - if (!empty($drp_value['monthlycost']) && $drp_value['monthlycost'] != 0) { |
|
1106 | - $did_cost = $this->common_model->to_calculate_currency($drp_value['monthlycost'],'','',true,true); |
|
1107 | - } else { |
|
1105 | + if (!empty($drp_value['monthlycost']) && $drp_value['monthlycost'] != 0) { |
|
1106 | + $did_cost = $this->common_model->to_calculate_currency($drp_value['monthlycost'],'','',true,true); |
|
1107 | + } else { |
|
1108 | 1108 | $did_cost = 0; |
1109 | - } |
|
1110 | - if (!empty($drp_value['setup']) && $drp_value['setup'] != 0) { |
|
1109 | + } |
|
1110 | + if (!empty($drp_value['setup']) && $drp_value['setup'] != 0) { |
|
1111 | 1111 | $did_setup = $this->common_model->to_calculate_currency($drp_value['setup'],'','',true,true); |
1112 | - } else { |
|
1112 | + } else { |
|
1113 | 1113 | $did_setup = 0; |
1114 | - } |
|
1115 | - $drp_list[$drp_value['id']] = $drp_value['number'] . ' ( Setup : ' . $did_setup . ')' . '( Monthly : ' . $did_cost . ' )'; |
|
1114 | + } |
|
1115 | + $drp_list[$drp_value['id']] = $drp_value['number'] . ' ( Setup : ' . $did_setup . ')' . '( Monthly : ' . $did_cost . ' )'; |
|
1116 | 1116 | } |
1117 | - } |
|
1118 | - $data['didlist'] = form_dropdown_all(array("name"=>"free_didlist","id"=>"free_didlist","class"=>"did_dropdown"), $drp_list, ''); |
|
1119 | - $this->load->view('view_user_did_list', $data); |
|
1120 | - } |
|
1121 | - |
|
1122 | - function user_didlist_json() { |
|
1123 | - $account_data = $this->session->userdata("accountinfo"); |
|
1124 | - if ($account_data['reseller_id'] != 0) { |
|
1125 | - $json_data = array(); |
|
1126 | - $where = array('dids.accountid' => $account_data['id']); |
|
1127 | - $jionCondition = 'dids.number = reseller_pricing.note AND dids.parent_id = reseller_pricing.reseller_id'; |
|
1128 | - $count_all = $this->db_model->getJionQueryCount("dids", '*', $where, "reseller_pricing", $jionCondition, 'inner'); |
|
1129 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1130 | - $json_data = $paging_data["json_paging"]; |
|
1131 | - $this->db_model->build_search('user_did_search'); |
|
1132 | - $query = $this->db_model->getJionQuery("dids", 'reseller_pricing.setup,reseller_pricing.cost,reseller_pricing.last_modified_date,reseller_pricing.connectcost,reseller_pricing.inc,reseller_pricing.init_inc,reseller_pricing.includedseconds,reseller_pricing.monthlycost,dids.number,dids.id,dids.accountid,dids.extensions,dids.status,dids.provider_id,dids.allocation_bill_status,reseller_pricing.disconnectionfee,dids.dial_as,dids.call_type,dids.country_id', $where, "reseller_pricing", $jionCondition, 'inner', $paging_data["paging"]["page_no"], $paging_data["paging"]["start"], "dids.id", "", ''); |
|
1133 | - } else { |
|
1134 | - $json_data = array(); |
|
1135 | - $where = array('accountid' => $account_data['id']); |
|
1136 | - $this->db_model->build_search('user_did_search'); |
|
1137 | - $count_all = $this->db_model->countQuery("*", "dids", $where); |
|
1138 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1139 | - $json_data = $paging_data["json_paging"]; |
|
1140 | - $this->db_model->build_search('user_did_search'); |
|
1141 | - $query = $this->db_model->getSelect("*", "dids", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
1142 | - } |
|
1143 | - $did_grid_fields = json_decode($this->user_form->build_user_didlist()); |
|
1144 | - $json_data['rows'] = $this->form->build_grid($query, $did_grid_fields); |
|
1145 | - echo json_encode($json_data); |
|
1146 | - } |
|
1147 | - |
|
1148 | - function user_did_country() { |
|
1149 | - $this->load->module('accounts/accounts'); |
|
1150 | - $this->accounts->customer_did_country(); |
|
1151 | - } |
|
1152 | - |
|
1153 | - function user_didlist_search() { |
|
1154 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1155 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1156 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1157 | - $action = $this->input->post(); |
|
1158 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1159 | - if($accountinfo['reseller_id'] > 0 && $action['call_type'] > 0){ |
|
1160 | - $action['dids.call_type']=$action['call_type']; |
|
1161 | - unset($action['call_type']); |
|
1162 | - } |
|
1163 | - unset($action['action']); |
|
1164 | - unset($action['advance_search']); |
|
1165 | - $this->session->set_userdata('user_did_search', $action); |
|
1166 | - } |
|
1167 | - if (@$ajax_search != 1) { |
|
1168 | - redirect(base_url() . 'user/user_didlist/'); |
|
1169 | - } |
|
1170 | - } |
|
1171 | - |
|
1172 | - function user_didlist_clearsearchfilter() { |
|
1173 | - $this->session->set_userdata('advance_search', 0); |
|
1174 | - $this->session->set_userdata('user_did_search', ""); |
|
1175 | - } |
|
1117 | + } |
|
1118 | + $data['didlist'] = form_dropdown_all(array("name"=>"free_didlist","id"=>"free_didlist","class"=>"did_dropdown"), $drp_list, ''); |
|
1119 | + $this->load->view('view_user_did_list', $data); |
|
1120 | + } |
|
1121 | + |
|
1122 | + function user_didlist_json() { |
|
1123 | + $account_data = $this->session->userdata("accountinfo"); |
|
1124 | + if ($account_data['reseller_id'] != 0) { |
|
1125 | + $json_data = array(); |
|
1126 | + $where = array('dids.accountid' => $account_data['id']); |
|
1127 | + $jionCondition = 'dids.number = reseller_pricing.note AND dids.parent_id = reseller_pricing.reseller_id'; |
|
1128 | + $count_all = $this->db_model->getJionQueryCount("dids", '*', $where, "reseller_pricing", $jionCondition, 'inner'); |
|
1129 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1130 | + $json_data = $paging_data["json_paging"]; |
|
1131 | + $this->db_model->build_search('user_did_search'); |
|
1132 | + $query = $this->db_model->getJionQuery("dids", 'reseller_pricing.setup,reseller_pricing.cost,reseller_pricing.last_modified_date,reseller_pricing.connectcost,reseller_pricing.inc,reseller_pricing.init_inc,reseller_pricing.includedseconds,reseller_pricing.monthlycost,dids.number,dids.id,dids.accountid,dids.extensions,dids.status,dids.provider_id,dids.allocation_bill_status,reseller_pricing.disconnectionfee,dids.dial_as,dids.call_type,dids.country_id', $where, "reseller_pricing", $jionCondition, 'inner', $paging_data["paging"]["page_no"], $paging_data["paging"]["start"], "dids.id", "", ''); |
|
1133 | + } else { |
|
1134 | + $json_data = array(); |
|
1135 | + $where = array('accountid' => $account_data['id']); |
|
1136 | + $this->db_model->build_search('user_did_search'); |
|
1137 | + $count_all = $this->db_model->countQuery("*", "dids", $where); |
|
1138 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1139 | + $json_data = $paging_data["json_paging"]; |
|
1140 | + $this->db_model->build_search('user_did_search'); |
|
1141 | + $query = $this->db_model->getSelect("*", "dids", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
1142 | + } |
|
1143 | + $did_grid_fields = json_decode($this->user_form->build_user_didlist()); |
|
1144 | + $json_data['rows'] = $this->form->build_grid($query, $did_grid_fields); |
|
1145 | + echo json_encode($json_data); |
|
1146 | + } |
|
1147 | + |
|
1148 | + function user_did_country() { |
|
1149 | + $this->load->module('accounts/accounts'); |
|
1150 | + $this->accounts->customer_did_country(); |
|
1151 | + } |
|
1152 | + |
|
1153 | + function user_didlist_search() { |
|
1154 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1155 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1156 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1157 | + $action = $this->input->post(); |
|
1158 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1159 | + if($accountinfo['reseller_id'] > 0 && $action['call_type'] > 0){ |
|
1160 | + $action['dids.call_type']=$action['call_type']; |
|
1161 | + unset($action['call_type']); |
|
1162 | + } |
|
1163 | + unset($action['action']); |
|
1164 | + unset($action['advance_search']); |
|
1165 | + $this->session->set_userdata('user_did_search', $action); |
|
1166 | + } |
|
1167 | + if (@$ajax_search != 1) { |
|
1168 | + redirect(base_url() . 'user/user_didlist/'); |
|
1169 | + } |
|
1170 | + } |
|
1171 | + |
|
1172 | + function user_didlist_clearsearchfilter() { |
|
1173 | + $this->session->set_userdata('advance_search', 0); |
|
1174 | + $this->session->set_userdata('user_did_search', ""); |
|
1175 | + } |
|
1176 | 1176 | |
1177 | - function user_ipmap(){ |
|
1178 | - $this->session->set_userdata('advance_search', 0); |
|
1179 | - $data['grid_fields'] = $this->user_form->build_user_ipmap(); |
|
1180 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_ipmap_search()); |
|
1181 | - $this->load->view('view_user_ipmap_list', $data); |
|
1182 | - } |
|
1177 | + function user_ipmap(){ |
|
1178 | + $this->session->set_userdata('advance_search', 0); |
|
1179 | + $data['grid_fields'] = $this->user_form->build_user_ipmap(); |
|
1180 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_ipmap_search()); |
|
1181 | + $this->load->view('view_user_ipmap_list', $data); |
|
1182 | + } |
|
1183 | 1183 | |
1184 | - function user_ipmap_json(){ |
|
1185 | - $json_data = array(); |
|
1186 | - $account_data = $this->session->userdata("accountinfo"); |
|
1187 | - $count_all = $this->user_model->user_ipmap_list(false); |
|
1188 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1189 | - $json_data = $paging_data["json_paging"]; |
|
1190 | - $query = $this->user_model->user_ipmap_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1191 | - $ipmap_grid_fields = json_decode($this->user_form->build_user_ipmap()); |
|
1192 | - $json_data['rows'] = $this->form->build_grid($query, $ipmap_grid_fields); |
|
1193 | - echo json_encode($json_data); |
|
1194 | - } |
|
1195 | - |
|
1196 | - function user_ipmap_search(){ |
|
1197 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1198 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1199 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1200 | - $action = $this->input->post(); |
|
1201 | - unset($action['action']); |
|
1202 | - unset($action['advance_search']); |
|
1203 | - $this->session->set_userdata('user_ipmap_search', $action); |
|
1204 | - } |
|
1205 | - if (@$ajax_search != 1) { |
|
1206 | - redirect(base_url() . 'user/user_ipmap/'); |
|
1207 | - } |
|
1208 | - } |
|
1184 | + function user_ipmap_json(){ |
|
1185 | + $json_data = array(); |
|
1186 | + $account_data = $this->session->userdata("accountinfo"); |
|
1187 | + $count_all = $this->user_model->user_ipmap_list(false); |
|
1188 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1189 | + $json_data = $paging_data["json_paging"]; |
|
1190 | + $query = $this->user_model->user_ipmap_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1191 | + $ipmap_grid_fields = json_decode($this->user_form->build_user_ipmap()); |
|
1192 | + $json_data['rows'] = $this->form->build_grid($query, $ipmap_grid_fields); |
|
1193 | + echo json_encode($json_data); |
|
1194 | + } |
|
1195 | + |
|
1196 | + function user_ipmap_search(){ |
|
1197 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1198 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1199 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1200 | + $action = $this->input->post(); |
|
1201 | + unset($action['action']); |
|
1202 | + unset($action['advance_search']); |
|
1203 | + $this->session->set_userdata('user_ipmap_search', $action); |
|
1204 | + } |
|
1205 | + if (@$ajax_search != 1) { |
|
1206 | + redirect(base_url() . 'user/user_ipmap/'); |
|
1207 | + } |
|
1208 | + } |
|
1209 | 1209 | |
1210 | - function user_ipmap_clearsearchfilter(){ |
|
1211 | - $this->session->set_userdata('advance_search', 0); |
|
1212 | - $this->session->set_userdata('user_ipmap_search', ""); |
|
1213 | - } |
|
1210 | + function user_ipmap_clearsearchfilter(){ |
|
1211 | + $this->session->set_userdata('advance_search', 0); |
|
1212 | + $this->session->set_userdata('user_ipmap_search', ""); |
|
1213 | + } |
|
1214 | 1214 | |
1215 | - function user_ipmap_action($action='delete',$id=false){ |
|
1216 | - $add_array=$this->input->post(); |
|
1217 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1218 | - if($action == 'add'){ |
|
1219 | - $ip = $add_array['ip']; |
|
1220 | - if (strpos($ip, '/') !== false) { |
|
1221 | - $add_array['ip'] = $add_array['ip']; |
|
1222 | - } else { |
|
1223 | - $add_array['ip'] = $add_array['ip'] . '/32'; |
|
1224 | - } |
|
1225 | - $where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix'])); |
|
1226 | - $getdata = $this->db_model->countQuery("*", "ip_map", $where); |
|
1227 | - if ($getdata > 0) { |
|
1228 | - $this->session->set_flashdata('astpp_notification', 'IP already exist in system.'); |
|
1229 | - } else { |
|
1230 | - unset($add_array['action']); |
|
1231 | - $add_array['context'] = 'default'; |
|
1232 | - $add_array['accountid'] = $accountinfo['id']; |
|
1233 | - $ip_flag = $this->db->insert("ip_map", $add_array); |
|
1234 | - if ($ip_flag) { |
|
1235 | - $this->load->library('freeswitch_lib'); |
|
1236 | - $this->load->module('freeswitch/freeswitch'); |
|
1237 | - $command = "api reloadacl"; |
|
1238 | - $response = $this->freeswitch_model->reload_freeswitch($command); |
|
1239 | - $this->session->set_userdata('astpp_notification', $response); |
|
1240 | - } |
|
1241 | - $this->session->set_flashdata('astpp_errormsg', 'IP Added Sucessfully.'); |
|
1242 | - } |
|
1243 | - } |
|
1244 | - if($action =='delete'){ |
|
1245 | - $this->db->delete('ip_map',array('id'=>$id)); |
|
1246 | - $this->session->set_flashdata('astpp_notification', 'IP Removed Sucessfully.'); |
|
1247 | - } |
|
1248 | - redirect(base_url()."user/user_ipmap/"); |
|
1249 | - } |
|
1215 | + function user_ipmap_action($action='delete',$id=false){ |
|
1216 | + $add_array=$this->input->post(); |
|
1217 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1218 | + if($action == 'add'){ |
|
1219 | + $ip = $add_array['ip']; |
|
1220 | + if (strpos($ip, '/') !== false) { |
|
1221 | + $add_array['ip'] = $add_array['ip']; |
|
1222 | + } else { |
|
1223 | + $add_array['ip'] = $add_array['ip'] . '/32'; |
|
1224 | + } |
|
1225 | + $where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix'])); |
|
1226 | + $getdata = $this->db_model->countQuery("*", "ip_map", $where); |
|
1227 | + if ($getdata > 0) { |
|
1228 | + $this->session->set_flashdata('astpp_notification', 'IP already exist in system.'); |
|
1229 | + } else { |
|
1230 | + unset($add_array['action']); |
|
1231 | + $add_array['context'] = 'default'; |
|
1232 | + $add_array['accountid'] = $accountinfo['id']; |
|
1233 | + $ip_flag = $this->db->insert("ip_map", $add_array); |
|
1234 | + if ($ip_flag) { |
|
1235 | + $this->load->library('freeswitch_lib'); |
|
1236 | + $this->load->module('freeswitch/freeswitch'); |
|
1237 | + $command = "api reloadacl"; |
|
1238 | + $response = $this->freeswitch_model->reload_freeswitch($command); |
|
1239 | + $this->session->set_userdata('astpp_notification', $response); |
|
1240 | + } |
|
1241 | + $this->session->set_flashdata('astpp_errormsg', 'IP Added Sucessfully.'); |
|
1242 | + } |
|
1243 | + } |
|
1244 | + if($action =='delete'){ |
|
1245 | + $this->db->delete('ip_map',array('id'=>$id)); |
|
1246 | + $this->session->set_flashdata('astpp_notification', 'IP Removed Sucessfully.'); |
|
1247 | + } |
|
1248 | + redirect(base_url()."user/user_ipmap/"); |
|
1249 | + } |
|
1250 | 1250 | |
1251 | - function user_sipdevices() { |
|
1251 | + function user_sipdevices() { |
|
1252 | 1252 | $data['page_title'] = 'SIP Devices'; |
1253 | - $this->session->set_userdata('advance_search', 0); |
|
1254 | - $data['grid_fields'] = $this->user_form->build_user_sipdevices(); |
|
1255 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_sipdevices_search()); |
|
1256 | - $this->load->view('view_user_sipdevices_list', $data); |
|
1257 | - } |
|
1258 | - |
|
1259 | - function user_sipdevices_json() { |
|
1260 | - $account_data = $this->session->userdata("accountinfo"); |
|
1261 | - $json_data = array(); |
|
1262 | - $count_all = $this->user_model->user_sipdevices_list(false, $account_data['id']); |
|
1263 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1264 | - $json_data = $paging_data["json_paging"]; |
|
1265 | - $devices_result = array(); |
|
1266 | - $query = $this->user_model->user_sipdevices_list(true,$account_data['id'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1267 | - foreach ($query as $key => $value) { |
|
1253 | + $this->session->set_userdata('advance_search', 0); |
|
1254 | + $data['grid_fields'] = $this->user_form->build_user_sipdevices(); |
|
1255 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_sipdevices_search()); |
|
1256 | + $this->load->view('view_user_sipdevices_list', $data); |
|
1257 | + } |
|
1258 | + |
|
1259 | + function user_sipdevices_json() { |
|
1260 | + $account_data = $this->session->userdata("accountinfo"); |
|
1261 | + $json_data = array(); |
|
1262 | + $count_all = $this->user_model->user_sipdevices_list(false, $account_data['id']); |
|
1263 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1264 | + $json_data = $paging_data["json_paging"]; |
|
1265 | + $devices_result = array(); |
|
1266 | + $query = $this->user_model->user_sipdevices_list(true,$account_data['id'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1267 | + foreach ($query as $key => $value) { |
|
1268 | 1268 | $path_true = base_url().'/assets/images/true.png'; |
1269 | 1269 | $path_false = base_url().'/assets/images/false.png'; |
1270 | 1270 | $voicemail_enabled = $value['voicemail_enabled'] == 'true'? '<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">' : '<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">'; |
1271 | - $json_data['rows'][] = array('cell' => array( |
|
1272 | - '<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value=' .$value['id'].'><lable class="lbl"></lable>', |
|
1273 | - $value['username'], |
|
1274 | - $value['password'], |
|
1275 | - $value['effective_caller_id_name'], |
|
1276 | - $value['effective_caller_id_number'], |
|
1277 | - $this->common->get_status('status', 'sip_devices',$value), |
|
1278 | - $this->common->convert_GMT_to('','',$value['creation_date']), |
|
1279 | - $this->common->convert_GMT_to('','',$value['last_modified_date']), |
|
1280 | - $voicemail_enabled, |
|
1281 | - '<a href="'. base_url() .'user/user_sipdevices_edit/' . $value['id'] . '/" class="btn btn-royelblue btn-sm" rel="facebox" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> '. |
|
1282 | - '<a href="'. base_url() .'user/user_sipdevices_delete/' .$value['id']. '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>' |
|
1283 | - )); |
|
1284 | - } |
|
1285 | - echo json_encode($json_data); |
|
1286 | - } |
|
1287 | - function user_sipdevices_search() { |
|
1288 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1289 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1290 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1291 | - $action = $this->input->post(); |
|
1292 | - unset($action['action']); |
|
1293 | - unset($action['advance_search']); |
|
1294 | - $this->session->set_userdata('user_sipdevices_search', $action); |
|
1295 | - } |
|
1296 | - if (@$ajax_search != 1) { |
|
1297 | - redirect(base_url() . 'user/user_sipdevices/'); |
|
1298 | - } |
|
1299 | - } |
|
1271 | + $json_data['rows'][] = array('cell' => array( |
|
1272 | + '<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value=' .$value['id'].'><lable class="lbl"></lable>', |
|
1273 | + $value['username'], |
|
1274 | + $value['password'], |
|
1275 | + $value['effective_caller_id_name'], |
|
1276 | + $value['effective_caller_id_number'], |
|
1277 | + $this->common->get_status('status', 'sip_devices',$value), |
|
1278 | + $this->common->convert_GMT_to('','',$value['creation_date']), |
|
1279 | + $this->common->convert_GMT_to('','',$value['last_modified_date']), |
|
1280 | + $voicemail_enabled, |
|
1281 | + '<a href="'. base_url() .'user/user_sipdevices_edit/' . $value['id'] . '/" class="btn btn-royelblue btn-sm" rel="facebox" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> '. |
|
1282 | + '<a href="'. base_url() .'user/user_sipdevices_delete/' .$value['id']. '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>' |
|
1283 | + )); |
|
1284 | + } |
|
1285 | + echo json_encode($json_data); |
|
1286 | + } |
|
1287 | + function user_sipdevices_search() { |
|
1288 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1289 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1290 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1291 | + $action = $this->input->post(); |
|
1292 | + unset($action['action']); |
|
1293 | + unset($action['advance_search']); |
|
1294 | + $this->session->set_userdata('user_sipdevices_search', $action); |
|
1295 | + } |
|
1296 | + if (@$ajax_search != 1) { |
|
1297 | + redirect(base_url() . 'user/user_sipdevices/'); |
|
1298 | + } |
|
1299 | + } |
|
1300 | 1300 | |
1301 | - function user_sipdevices_clearsearchfilter() { |
|
1302 | - $this->session->set_userdata('advance_search', 0); |
|
1303 | - $this->session->set_userdata('user_sipdevices_search', ""); |
|
1304 | - } |
|
1301 | + function user_sipdevices_clearsearchfilter() { |
|
1302 | + $this->session->set_userdata('advance_search', 0); |
|
1303 | + $this->session->set_userdata('user_sipdevices_search', ""); |
|
1304 | + } |
|
1305 | 1305 | |
1306 | - function user_sipdevices_add(){ |
|
1307 | - $data['page_title'] = 'Create SIP Device'; |
|
1308 | - $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form(),""); |
|
1309 | - $this->load->view('view_user_sipdevices_add_edit', $data); |
|
1310 | - } |
|
1311 | - function user_sipdevices_edit($edit_id=''){ |
|
1312 | - $account_data = $this->session->userdata("accountinfo"); |
|
1313 | - $data['page_title'] = 'Edit SIP Device'; |
|
1314 | - $where = array('id' => $edit_id); |
|
1315 | - $sipdevice_info = $this->user_model->user_sipdevice_info($edit_id); |
|
1316 | - $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form($edit_id), $sipdevice_info); |
|
1317 | - $this->load->view('view_user_sipdevices_add_edit', $data); |
|
1318 | - } |
|
1319 | - function user_sipdevices_save(){ |
|
1320 | - $add_array = $this->input->post(); |
|
1321 | - $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form($add_array['id']), $add_array); |
|
1322 | - if ($add_array['id'] != '') { |
|
1323 | - $data['page_title'] = 'Edit SIP Devices'; |
|
1324 | - if ($this->form_validation->run() == FALSE) { |
|
1325 | - $data['validation_errors'] = validation_errors(); |
|
1326 | - echo $data['validation_errors']; |
|
1327 | - exit; |
|
1328 | - } else { |
|
1329 | - $this->user_model->user_sipdevice_edit($add_array, $add_array['id']); |
|
1330 | - echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!")); |
|
1331 | - exit; |
|
1332 | - } |
|
1333 | - } else { |
|
1334 | - $data['page_title'] = 'Create SIP Device'; |
|
1335 | - if ($this->form_validation->run() == FALSE) { |
|
1336 | - $data['validation_errors'] = validation_errors(); |
|
1337 | - echo $data['validation_errors']; |
|
1338 | - exit; |
|
1339 | - } else { |
|
1340 | - $this->user_model->user_sipdevice_add($add_array); |
|
1341 | - echo json_encode(array("SUCCESS"=> "SIP Device Added Successfully!")); |
|
1342 | - exit; |
|
1343 | - } |
|
1344 | - } |
|
1345 | - } |
|
1346 | - function user_sipdevices_delete($id) { |
|
1347 | - $this->db->delete('sip_devices',array('id'=>$id)); |
|
1348 | - $this->session->set_flashdata('astpp_notification', 'SIP Device Removed Sucessfully!'); |
|
1349 | - redirect(base_url() . "user/user_sipdevices/"); |
|
1350 | - } |
|
1306 | + function user_sipdevices_add(){ |
|
1307 | + $data['page_title'] = 'Create SIP Device'; |
|
1308 | + $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form(),""); |
|
1309 | + $this->load->view('view_user_sipdevices_add_edit', $data); |
|
1310 | + } |
|
1311 | + function user_sipdevices_edit($edit_id=''){ |
|
1312 | + $account_data = $this->session->userdata("accountinfo"); |
|
1313 | + $data['page_title'] = 'Edit SIP Device'; |
|
1314 | + $where = array('id' => $edit_id); |
|
1315 | + $sipdevice_info = $this->user_model->user_sipdevice_info($edit_id); |
|
1316 | + $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form($edit_id), $sipdevice_info); |
|
1317 | + $this->load->view('view_user_sipdevices_add_edit', $data); |
|
1318 | + } |
|
1319 | + function user_sipdevices_save(){ |
|
1320 | + $add_array = $this->input->post(); |
|
1321 | + $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form($add_array['id']), $add_array); |
|
1322 | + if ($add_array['id'] != '') { |
|
1323 | + $data['page_title'] = 'Edit SIP Devices'; |
|
1324 | + if ($this->form_validation->run() == FALSE) { |
|
1325 | + $data['validation_errors'] = validation_errors(); |
|
1326 | + echo $data['validation_errors']; |
|
1327 | + exit; |
|
1328 | + } else { |
|
1329 | + $this->user_model->user_sipdevice_edit($add_array, $add_array['id']); |
|
1330 | + echo json_encode(array("SUCCESS"=> "SIP Device Updated Successfully!")); |
|
1331 | + exit; |
|
1332 | + } |
|
1333 | + } else { |
|
1334 | + $data['page_title'] = 'Create SIP Device'; |
|
1335 | + if ($this->form_validation->run() == FALSE) { |
|
1336 | + $data['validation_errors'] = validation_errors(); |
|
1337 | + echo $data['validation_errors']; |
|
1338 | + exit; |
|
1339 | + } else { |
|
1340 | + $this->user_model->user_sipdevice_add($add_array); |
|
1341 | + echo json_encode(array("SUCCESS"=> "SIP Device Added Successfully!")); |
|
1342 | + exit; |
|
1343 | + } |
|
1344 | + } |
|
1345 | + } |
|
1346 | + function user_sipdevices_delete($id) { |
|
1347 | + $this->db->delete('sip_devices',array('id'=>$id)); |
|
1348 | + $this->session->set_flashdata('astpp_notification', 'SIP Device Removed Sucessfully!'); |
|
1349 | + redirect(base_url() . "user/user_sipdevices/"); |
|
1350 | + } |
|
1351 | 1351 | |
1352 | - function user_sipdevices_delete_multiple(){ |
|
1353 | - $ids = $this->input->post("selected_ids", true); |
|
1354 | - $where = "id IN ($ids)"; |
|
1355 | - $this->db->delete("sip_devices",$where); |
|
1356 | - echo TRUE; |
|
1357 | - } |
|
1352 | + function user_sipdevices_delete_multiple(){ |
|
1353 | + $ids = $this->input->post("selected_ids", true); |
|
1354 | + $where = "id IN ($ids)"; |
|
1355 | + $this->db->delete("sip_devices",$where); |
|
1356 | + echo TRUE; |
|
1357 | + } |
|
1358 | 1358 | |
1359 | - function user_animap_list() { |
|
1359 | + function user_animap_list() { |
|
1360 | 1360 | $data['page_title'] = 'Caller ID'; |
1361 | - $this->session->set_userdata('advance_search', 0); |
|
1362 | - $data['grid_fields'] = $this->user_form->build_user_animap(); |
|
1363 | - $this->load->view('view_user_animap', $data); |
|
1364 | - } |
|
1365 | - |
|
1366 | - function user_animap_list_json() { |
|
1367 | - $account_data = $this->session->userdata("accountinfo"); |
|
1368 | - $json_data = array(); |
|
1369 | - $where = array("accountid" => $account_data['id']); |
|
1370 | - $count_all = $this->db_model->countQuery("*", "ani_map", $where); |
|
1371 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1372 | - $json_data = $paging_data["json_paging"]; |
|
1373 | - $query = $this->db_model->select("*", "ani_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
1374 | - $grid_fields = json_decode($this->user_form->build_user_animap()); |
|
1375 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1376 | - echo json_encode($json_data); |
|
1377 | - } |
|
1378 | - |
|
1379 | - function user_animap_action($action, $aniid = "") { |
|
1380 | - $add_array = $this->input->post(); |
|
1381 | - if ($action == "add" && $add_array['number'] != '') { |
|
1382 | - $this->db->where('number', $add_array['number']); |
|
1383 | - $this->db->select('count(id) as count'); |
|
1384 | - $cnt_result = $this->db->get('ani_map'); |
|
1385 | - $cnt_result = $cnt_result->result_array(); |
|
1386 | - $count = $cnt_result[0]['count']; |
|
1387 | - if ($count == 0) { |
|
1361 | + $this->session->set_userdata('advance_search', 0); |
|
1362 | + $data['grid_fields'] = $this->user_form->build_user_animap(); |
|
1363 | + $this->load->view('view_user_animap', $data); |
|
1364 | + } |
|
1365 | + |
|
1366 | + function user_animap_list_json() { |
|
1367 | + $account_data = $this->session->userdata("accountinfo"); |
|
1368 | + $json_data = array(); |
|
1369 | + $where = array("accountid" => $account_data['id']); |
|
1370 | + $count_all = $this->db_model->countQuery("*", "ani_map", $where); |
|
1371 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1372 | + $json_data = $paging_data["json_paging"]; |
|
1373 | + $query = $this->db_model->select("*", "ani_map", $where, "id", "ASC", $paging_data["paging"]["page_no"], $paging_data["paging"]["start"]); |
|
1374 | + $grid_fields = json_decode($this->user_form->build_user_animap()); |
|
1375 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1376 | + echo json_encode($json_data); |
|
1377 | + } |
|
1378 | + |
|
1379 | + function user_animap_action($action, $aniid = "") { |
|
1380 | + $add_array = $this->input->post(); |
|
1381 | + if ($action == "add" && $add_array['number'] != '') { |
|
1382 | + $this->db->where('number', $add_array['number']); |
|
1383 | + $this->db->select('count(id) as count'); |
|
1384 | + $cnt_result = $this->db->get('ani_map'); |
|
1385 | + $cnt_result = $cnt_result->result_array(); |
|
1386 | + $count = $cnt_result[0]['count']; |
|
1387 | + if ($count == 0) { |
|
1388 | 1388 | if($add_array['number'] != ""){ |
1389 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
1390 | - $insert_arr = array("number" => $add_array['number'], |
|
1391 | - "accountid" => $accountinfo['id'], |
|
1392 | - "context" => "default" |
|
1393 | - ); |
|
1394 | - $this->db->insert("ani_map", $insert_arr); |
|
1395 | - $this->session->set_flashdata('astpp_errormsg', 'Add Caller ID Sucessfully!'); |
|
1389 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
1390 | + $insert_arr = array("number" => $add_array['number'], |
|
1391 | + "accountid" => $accountinfo['id'], |
|
1392 | + "context" => "default" |
|
1393 | + ); |
|
1394 | + $this->db->insert("ani_map", $insert_arr); |
|
1395 | + $this->session->set_flashdata('astpp_errormsg', 'Add Caller ID Sucessfully!'); |
|
1396 | 1396 | }else{ |
1397 | 1397 | $this->session->set_flashdata('astpp_notification', 'Please Enter Caller ID value.'); |
1398 | 1398 | } |
1399 | - } else { |
|
1400 | - $this->session->set_flashdata('astpp_notification', ' Caller ID already Exists.'); |
|
1401 | - } |
|
1402 | - } |
|
1403 | - if ($action == "delete") { |
|
1404 | - $this->session->set_flashdata('astpp_notification', 'Caller ID removed sucessfully!'); |
|
1405 | - $this->db_model->delete("ani_map", array("id" => $aniid)); |
|
1399 | + } else { |
|
1400 | + $this->session->set_flashdata('astpp_notification', ' Caller ID already Exists.'); |
|
1401 | + } |
|
1402 | + } |
|
1403 | + if ($action == "delete") { |
|
1404 | + $this->session->set_flashdata('astpp_notification', 'Caller ID removed sucessfully!'); |
|
1405 | + $this->db_model->delete("ani_map", array("id" => $aniid)); |
|
1406 | 1406 | |
1407 | - } |
|
1408 | - redirect(base_url() . "user/user_animap_list/"); |
|
1409 | - } |
|
1407 | + } |
|
1408 | + redirect(base_url() . "user/user_animap_list/"); |
|
1409 | + } |
|
1410 | 1410 | |
1411 | - function user_alert_threshold() { |
|
1412 | - $data['page_title'] = 'Alert Threshold'; |
|
1413 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
1414 | - $add_array = $this->input->post(); |
|
1415 | - if (!empty($add_array)) { |
|
1416 | - unset($add_array['action'],$add_array['id']); |
|
1417 | - $this->user_model->edit_alert_threshold($add_array, $accountinfo['id']); |
|
1418 | - $this->session->set_flashdata('astpp_errormsg', 'Alert Threshold updated successfully!'); |
|
1419 | - redirect(base_url() . 'user/user_alert_threshold/'); |
|
1420 | - } else { |
|
1421 | - $where = array('id' => $accountinfo["id"]); |
|
1422 | - $account = $this->db_model->getSelect("notify_credit_limit,notify_flag,notify_email", "accounts", $where); |
|
1423 | - $data['form'] = $this->form->build_form($this->user_form->user_alert_threshold(),(array)$account->first_row()); |
|
1424 | - $this->load->view('view_user_alert_threshold', $data); |
|
1425 | - } |
|
1426 | - } |
|
1411 | + function user_alert_threshold() { |
|
1412 | + $data['page_title'] = 'Alert Threshold'; |
|
1413 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
1414 | + $add_array = $this->input->post(); |
|
1415 | + if (!empty($add_array)) { |
|
1416 | + unset($add_array['action'],$add_array['id']); |
|
1417 | + $this->user_model->edit_alert_threshold($add_array, $accountinfo['id']); |
|
1418 | + $this->session->set_flashdata('astpp_errormsg', 'Alert Threshold updated successfully!'); |
|
1419 | + redirect(base_url() . 'user/user_alert_threshold/'); |
|
1420 | + } else { |
|
1421 | + $where = array('id' => $accountinfo["id"]); |
|
1422 | + $account = $this->db_model->getSelect("notify_credit_limit,notify_flag,notify_email", "accounts", $where); |
|
1423 | + $data['form'] = $this->form->build_form($this->user_form->user_alert_threshold(),(array)$account->first_row()); |
|
1424 | + $this->load->view('view_user_alert_threshold', $data); |
|
1425 | + } |
|
1426 | + } |
|
1427 | 1427 | |
1428 | - function user_cdrs_report() { |
|
1429 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1430 | - $data['page_title'] = 'CDRs'; |
|
1431 | - $data['search_flag'] = true; |
|
1432 | - $data["grid_buttons"] = $this->user_form->build_cdrs_report_buttons(); |
|
1433 | - $data['grid_fields'] = $this->user_form->build_cdrs_report($accountinfo['type']); |
|
1434 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_cdrs_report_search($accountinfo['type'])); |
|
1435 | - $this->load->view('view_user_cdrs_report', $data); |
|
1436 | - } |
|
1437 | - |
|
1438 | - function user_cdrs_report_json() { |
|
1439 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1440 | - $variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost'; |
|
1441 | - $count_res = $this->user_model->getuser_cdrs_list(false, "", ""); |
|
1442 | - $count_all = (array) $count_res->first_row(); |
|
1443 | - $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
|
1444 | - $json_data = $paging_data["json_paging"]; |
|
1445 | - $query = $this->user_model->getuser_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false); |
|
1446 | - $grid_fields = json_decode($this->user_form->build_cdrs_report($accountinfo['type'])); |
|
1447 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1448 | - if ($count_all['count'] > 0) { |
|
1449 | - $search_arr = $this->session->userdata('user_cdrs_report_search'); |
|
1450 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1451 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1452 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1453 | - $json_data['rows'][] = array("cell" => array( |
|
1454 | - "<b>Grand Total</b>", |
|
1455 | - "", |
|
1456 | - "", |
|
1457 | - "", |
|
1458 | - $duration, |
|
1459 | - "<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>", |
|
1460 | - "", |
|
1461 | - "", |
|
1462 | - )); |
|
1463 | - } |
|
1464 | - echo json_encode($json_data); |
|
1465 | - } |
|
1466 | - |
|
1467 | - function user_cdrs_report_search() { |
|
1468 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1469 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1470 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1471 | - $action = $this->input->post(); |
|
1472 | - unset($action['action']); |
|
1473 | - unset($action['advance_search']); |
|
1474 | - if (isset($action['debit']['debit']) && $action['debit']['debit'] != '') { |
|
1475 | - $action['debit']['debit'] = $this->common_model->add_calculate_currency($action['debit']['debit'], "", '', true, false); |
|
1476 | - } |
|
1477 | - $this->session->set_userdata('user_cdrs_report_search', $action); |
|
1478 | - } |
|
1479 | - if (@$ajax_search != 1) { |
|
1480 | - redirect(base_url() . 'user/user_cdrs_report/'); |
|
1481 | - } |
|
1482 | - } |
|
1483 | - |
|
1484 | - function user_cdrs_report_clearsearchfilter() { |
|
1485 | - $this->session->set_userdata('advance_search', 0); |
|
1486 | - $this->session->set_userdata('user_cdrs_report_search', ""); |
|
1487 | - } |
|
1488 | - |
|
1489 | - function user_cdrreport_export() { |
|
1428 | + function user_cdrs_report() { |
|
1429 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1430 | + $data['page_title'] = 'CDRs'; |
|
1431 | + $data['search_flag'] = true; |
|
1432 | + $data["grid_buttons"] = $this->user_form->build_cdrs_report_buttons(); |
|
1433 | + $data['grid_fields'] = $this->user_form->build_cdrs_report($accountinfo['type']); |
|
1434 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_cdrs_report_search($accountinfo['type'])); |
|
1435 | + $this->load->view('view_user_cdrs_report', $data); |
|
1436 | + } |
|
1437 | + |
|
1438 | + function user_cdrs_report_json() { |
|
1439 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1440 | + $variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost'; |
|
1441 | + $count_res = $this->user_model->getuser_cdrs_list(false, "", ""); |
|
1442 | + $count_all = (array) $count_res->first_row(); |
|
1443 | + $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
|
1444 | + $json_data = $paging_data["json_paging"]; |
|
1445 | + $query = $this->user_model->getuser_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false); |
|
1446 | + $grid_fields = json_decode($this->user_form->build_cdrs_report($accountinfo['type'])); |
|
1447 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1448 | + if ($count_all['count'] > 0) { |
|
1449 | + $search_arr = $this->session->userdata('user_cdrs_report_search'); |
|
1450 | + $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1451 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1452 | + floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1453 | + $json_data['rows'][] = array("cell" => array( |
|
1454 | + "<b>Grand Total</b>", |
|
1455 | + "", |
|
1456 | + "", |
|
1457 | + "", |
|
1458 | + $duration, |
|
1459 | + "<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>", |
|
1460 | + "", |
|
1461 | + "", |
|
1462 | + )); |
|
1463 | + } |
|
1464 | + echo json_encode($json_data); |
|
1465 | + } |
|
1466 | + |
|
1467 | + function user_cdrs_report_search() { |
|
1468 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1469 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1470 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1471 | + $action = $this->input->post(); |
|
1472 | + unset($action['action']); |
|
1473 | + unset($action['advance_search']); |
|
1474 | + if (isset($action['debit']['debit']) && $action['debit']['debit'] != '') { |
|
1475 | + $action['debit']['debit'] = $this->common_model->add_calculate_currency($action['debit']['debit'], "", '', true, false); |
|
1476 | + } |
|
1477 | + $this->session->set_userdata('user_cdrs_report_search', $action); |
|
1478 | + } |
|
1479 | + if (@$ajax_search != 1) { |
|
1480 | + redirect(base_url() . 'user/user_cdrs_report/'); |
|
1481 | + } |
|
1482 | + } |
|
1483 | + |
|
1484 | + function user_cdrs_report_clearsearchfilter() { |
|
1485 | + $this->session->set_userdata('advance_search', 0); |
|
1486 | + $this->session->set_userdata('user_cdrs_report_search', ""); |
|
1487 | + } |
|
1488 | + |
|
1489 | + function user_cdrreport_export() { |
|
1490 | 1490 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
1491 | 1491 | $currency_id=$account_info['currency_id']; |
1492 | 1492 | $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
1493 | - $count_res = $this->user_model->getuser_cdrs_list(false, "", ""); |
|
1494 | - $count_all = (array) $count_res->first_row(); |
|
1495 | - ob_clean(); |
|
1496 | - $customer_array[] = array("Date", "CallerID", "Called Number","Code", "Destination", "Duration", "Debit($currency)", "Disposition", "Call Type"); |
|
1497 | - if ($count_all['count'] > 0) { |
|
1498 | - $query = $this->user_model->getuser_cdrs_list(true, '', '', true); |
|
1499 | - $currency_info = $this->common->get_currency_info(); |
|
1500 | - $search_arr = $this->session->userdata('user_cdrs_report_search'); |
|
1501 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1502 | - foreach ($query->result_array() as $value) { |
|
1503 | - $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
1504 | - floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
1505 | - $customer_array[] = array( |
|
1506 | - $this->common->convert_GMT_to('', '', $value['callstart']), |
|
1507 | - $value['callerid'], |
|
1508 | - $value['callednum'], |
|
1509 | - filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
|
1510 | - $value['notes'], |
|
1511 | - $duration, |
|
1512 | - $this->common->calculate_currency_manually($currency_info, $value['debit'],false), |
|
1513 | - $value['disposition'], |
|
1514 | - $value['calltype'] |
|
1515 | - ); |
|
1516 | - } |
|
1517 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1518 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1519 | - $customer_array[] = array("Grand Total", |
|
1520 | - "", |
|
1521 | - "", |
|
1522 | - "", |
|
1493 | + $count_res = $this->user_model->getuser_cdrs_list(false, "", ""); |
|
1494 | + $count_all = (array) $count_res->first_row(); |
|
1495 | + ob_clean(); |
|
1496 | + $customer_array[] = array("Date", "CallerID", "Called Number","Code", "Destination", "Duration", "Debit($currency)", "Disposition", "Call Type"); |
|
1497 | + if ($count_all['count'] > 0) { |
|
1498 | + $query = $this->user_model->getuser_cdrs_list(true, '', '', true); |
|
1499 | + $currency_info = $this->common->get_currency_info(); |
|
1500 | + $search_arr = $this->session->userdata('user_cdrs_report_search'); |
|
1501 | + $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1502 | + foreach ($query->result_array() as $value) { |
|
1503 | + $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
1504 | + floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
1505 | + $customer_array[] = array( |
|
1506 | + $this->common->convert_GMT_to('', '', $value['callstart']), |
|
1507 | + $value['callerid'], |
|
1508 | + $value['callednum'], |
|
1509 | + filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
|
1510 | + $value['notes'], |
|
1511 | + $duration, |
|
1512 | + $this->common->calculate_currency_manually($currency_info, $value['debit'],false), |
|
1513 | + $value['disposition'], |
|
1514 | + $value['calltype'] |
|
1515 | + ); |
|
1516 | + } |
|
1517 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1518 | + floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1519 | + $customer_array[] = array("Grand Total", |
|
1520 | + "", |
|
1521 | + "", |
|
1522 | + "", |
|
1523 | 1523 | "", |
1524 | - $duration, |
|
1525 | - $this->common->calculate_currency_manually($currency_info, $count_all['total_debit']), |
|
1526 | - "", |
|
1527 | - "" |
|
1528 | - ); |
|
1529 | - } |
|
1530 | - $this->load->helper('csv'); |
|
1531 | - array_to_csv($customer_array, 'Customer_CDR_' . date("Y-m-d") . '.csv'); |
|
1532 | - } |
|
1533 | - function user_payment($action=""){ |
|
1534 | - if(common_model::$global_config['system_config']['paypal_status'] == 1){ |
|
1535 | - redirect(base_url() . 'user/user/'); |
|
1536 | - } |
|
1537 | - $this->load->module("user/payment"); |
|
1538 | - if($action=="GET_AMT"){ |
|
1539 | - $amount = $this->input->post("value",true); |
|
1540 | - $this->payment->convert_amount($amount); |
|
1541 | - }else{ |
|
1542 | - $this->payment->index(); |
|
1543 | - } |
|
1544 | - } |
|
1524 | + $duration, |
|
1525 | + $this->common->calculate_currency_manually($currency_info, $count_all['total_debit']), |
|
1526 | + "", |
|
1527 | + "" |
|
1528 | + ); |
|
1529 | + } |
|
1530 | + $this->load->helper('csv'); |
|
1531 | + array_to_csv($customer_array, 'Customer_CDR_' . date("Y-m-d") . '.csv'); |
|
1532 | + } |
|
1533 | + function user_payment($action=""){ |
|
1534 | + if(common_model::$global_config['system_config']['paypal_status'] == 1){ |
|
1535 | + redirect(base_url() . 'user/user/'); |
|
1536 | + } |
|
1537 | + $this->load->module("user/payment"); |
|
1538 | + if($action=="GET_AMT"){ |
|
1539 | + $amount = $this->input->post("value",true); |
|
1540 | + $this->payment->convert_amount($amount); |
|
1541 | + }else{ |
|
1542 | + $this->payment->index(); |
|
1543 | + } |
|
1544 | + } |
|
1545 | 1545 | |
1546 | - function user_fund_transfer(){ |
|
1547 | - $data['page_title'] = 'Fund Transfer'; |
|
1548 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1549 | - $account=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
1550 | - $currency = (array)$this->db->get_where('currency',array("id"=>$account['currency_id']))->first_row(); |
|
1551 | - $data['form'] = $this->form->build_form($this->user_form->build_user_fund_transfer_form($account['number'], $currency['currency'], $accountinfo['id']), ''); |
|
1552 | - $this->load->view('view_user_fund_transfer', $data); |
|
1553 | - } |
|
1546 | + function user_fund_transfer(){ |
|
1547 | + $data['page_title'] = 'Fund Transfer'; |
|
1548 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1549 | + $account=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
1550 | + $currency = (array)$this->db->get_where('currency',array("id"=>$account['currency_id']))->first_row(); |
|
1551 | + $data['form'] = $this->form->build_form($this->user_form->build_user_fund_transfer_form($account['number'], $currency['currency'], $accountinfo['id']), ''); |
|
1552 | + $this->load->view('view_user_fund_transfer', $data); |
|
1553 | + } |
|
1554 | 1554 | |
1555 | - function user_fund_transfer_save() { |
|
1556 | - $data['page_title'] = 'Fund Transfer'; |
|
1557 | - $post_array = $this->input->post(); |
|
1558 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1559 | - $account=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
1560 | - $currency = (array)$this->db->get_where('currency',array("id"=>$account['currency_id']))->first_row(); |
|
1561 | - $data['form'] = $this->form->build_form($this->user_form->build_user_fund_transfer_form($account['number'], $currency['currency'], $accountinfo['id']), $post_array); |
|
1562 | - if ($this->form_validation->run() == FALSE) { |
|
1563 | - $data['validation_errors'] = validation_errors(); |
|
1564 | - } else { |
|
1565 | - if (trim($post_array['fromaccountid']) != trim($post_array['toaccountid'])) { |
|
1566 | - $account_info = $this->session->userdata('accountinfo'); |
|
1567 | - $balance = $this->common->get_field_name('balance', 'accounts', array('id' => $account_info['id'], 'status' => 0, 'type' => 0, 'deleted' => 0)); |
|
1568 | - $toid = $this->common->get_field_name('id', 'accounts', array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0)); |
|
1569 | - $toaccountinfo=(array)$this->db->get_where('accounts',array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0),1)->first_row(); |
|
1570 | - if($toaccountinfo){ |
|
1571 | - $reseller_id = $toaccountinfo['reseller_id']; |
|
1572 | - $post_array['credit'] = $this->common_model->add_calculate_currency($post_array['credit'], '', '', false, false); |
|
1573 | - $minimum_fund=(array)$this->db->get_where('system',array("name"=>"minimum_fund_transfer"),1)->first_row(); |
|
1574 | - if ($post_array['toaccountid'] == $account_info['number']) { |
|
1575 | - $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.'); |
|
1576 | - } |
|
1577 | - elseif ($reseller_id != $account_info['reseller_id']) { |
|
1578 | - $this->session->set_flashdata('astpp_notification', 'You can only transfer fund in same level account.'); |
|
1579 | - } |
|
1580 | - elseif ($post_array['toaccountid'] == '') { |
|
1581 | - $this->session->set_flashdata('astpp_notification', 'Please enter To account number.'); |
|
1582 | - } |
|
1583 | - elseif (empty($post_array['credit'])) { |
|
1584 | - $this->session->set_flashdata('astpp_notification', 'Please enter a amount.'); |
|
1585 | - } |
|
1586 | - elseif ($post_array['credit'] > $balance) { |
|
1587 | - $this->session->set_flashdata('astpp_notification', 'You have insufficient balance.'); |
|
1588 | - } |
|
1589 | - elseif ($toid <= 0 || !isset($post_array['toaccountid'])) { |
|
1590 | - $this->session->set_flashdata('astpp_notification', 'Please enter valid account number.'); |
|
1591 | - } |
|
1592 | - elseif ($post_array['credit'] < 0) { |
|
1593 | - $this->session->set_flashdata('astpp_notification', 'Please enter amount greater then 0.'); |
|
1594 | - } |
|
1595 | - elseif ($minimum_fund['value'] >= $post_array['credit']) { |
|
1596 | - $this->session->set_flashdata('astpp_notification', 'You need to enter minimum amount of fund transfer ' . $minimum_fund['value'] . ' .'); |
|
1597 | - } |
|
1598 | - elseif (!isset($toid) || !isset($post_array['toaccountid'])) { |
|
1599 | - $this->session->set_flashdata('astpp_notification', 'Please enter valid account number!'); |
|
1600 | - } |
|
1601 | - elseif ($post_array['credit'] < 0 || $post_array['credit'] > $balance) { |
|
1602 | - $this->session->set_flashdata('astpp_notification', 'Insuffiecient amount !'); |
|
1603 | - }else{ |
|
1604 | - $from['id'] = $post_array['id']; |
|
1605 | - $from['account_currency'] = $post_array['account_currency']; |
|
1606 | - $from['accountid'] = $post_array['fromaccountid']; |
|
1607 | - if ($account['posttoexternal'] == 1) { |
|
1608 | - $from['credit'] = abs($post_array['credit']); |
|
1609 | - $from['payment_type'] = '0'; |
|
1610 | - } else { |
|
1611 | - $from['credit'] = abs($post_array['credit']); |
|
1612 | - $from['payment_type'] = 'debit'; |
|
1613 | - } |
|
1614 | - $from['posttoexternal'] = $account['posttoexternal']; |
|
1555 | + function user_fund_transfer_save() { |
|
1556 | + $data['page_title'] = 'Fund Transfer'; |
|
1557 | + $post_array = $this->input->post(); |
|
1558 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1559 | + $account=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
1560 | + $currency = (array)$this->db->get_where('currency',array("id"=>$account['currency_id']))->first_row(); |
|
1561 | + $data['form'] = $this->form->build_form($this->user_form->build_user_fund_transfer_form($account['number'], $currency['currency'], $accountinfo['id']), $post_array); |
|
1562 | + if ($this->form_validation->run() == FALSE) { |
|
1563 | + $data['validation_errors'] = validation_errors(); |
|
1564 | + } else { |
|
1565 | + if (trim($post_array['fromaccountid']) != trim($post_array['toaccountid'])) { |
|
1566 | + $account_info = $this->session->userdata('accountinfo'); |
|
1567 | + $balance = $this->common->get_field_name('balance', 'accounts', array('id' => $account_info['id'], 'status' => 0, 'type' => 0, 'deleted' => 0)); |
|
1568 | + $toid = $this->common->get_field_name('id', 'accounts', array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0)); |
|
1569 | + $toaccountinfo=(array)$this->db->get_where('accounts',array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0),1)->first_row(); |
|
1570 | + if($toaccountinfo){ |
|
1571 | + $reseller_id = $toaccountinfo['reseller_id']; |
|
1572 | + $post_array['credit'] = $this->common_model->add_calculate_currency($post_array['credit'], '', '', false, false); |
|
1573 | + $minimum_fund=(array)$this->db->get_where('system',array("name"=>"minimum_fund_transfer"),1)->first_row(); |
|
1574 | + if ($post_array['toaccountid'] == $account_info['number']) { |
|
1575 | + $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.'); |
|
1576 | + } |
|
1577 | + elseif ($reseller_id != $account_info['reseller_id']) { |
|
1578 | + $this->session->set_flashdata('astpp_notification', 'You can only transfer fund in same level account.'); |
|
1579 | + } |
|
1580 | + elseif ($post_array['toaccountid'] == '') { |
|
1581 | + $this->session->set_flashdata('astpp_notification', 'Please enter To account number.'); |
|
1582 | + } |
|
1583 | + elseif (empty($post_array['credit'])) { |
|
1584 | + $this->session->set_flashdata('astpp_notification', 'Please enter a amount.'); |
|
1585 | + } |
|
1586 | + elseif ($post_array['credit'] > $balance) { |
|
1587 | + $this->session->set_flashdata('astpp_notification', 'You have insufficient balance.'); |
|
1588 | + } |
|
1589 | + elseif ($toid <= 0 || !isset($post_array['toaccountid'])) { |
|
1590 | + $this->session->set_flashdata('astpp_notification', 'Please enter valid account number.'); |
|
1591 | + } |
|
1592 | + elseif ($post_array['credit'] < 0) { |
|
1593 | + $this->session->set_flashdata('astpp_notification', 'Please enter amount greater then 0.'); |
|
1594 | + } |
|
1595 | + elseif ($minimum_fund['value'] >= $post_array['credit']) { |
|
1596 | + $this->session->set_flashdata('astpp_notification', 'You need to enter minimum amount of fund transfer ' . $minimum_fund['value'] . ' .'); |
|
1597 | + } |
|
1598 | + elseif (!isset($toid) || !isset($post_array['toaccountid'])) { |
|
1599 | + $this->session->set_flashdata('astpp_notification', 'Please enter valid account number!'); |
|
1600 | + } |
|
1601 | + elseif ($post_array['credit'] < 0 || $post_array['credit'] > $balance) { |
|
1602 | + $this->session->set_flashdata('astpp_notification', 'Insuffiecient amount !'); |
|
1603 | + }else{ |
|
1604 | + $from['id'] = $post_array['id']; |
|
1605 | + $from['account_currency'] = $post_array['account_currency']; |
|
1606 | + $from['accountid'] = $post_array['fromaccountid']; |
|
1607 | + if ($account['posttoexternal'] == 1) { |
|
1608 | + $from['credit'] = abs($post_array['credit']); |
|
1609 | + $from['payment_type'] = '0'; |
|
1610 | + } else { |
|
1611 | + $from['credit'] = abs($post_array['credit']); |
|
1612 | + $from['payment_type'] = 'debit'; |
|
1613 | + } |
|
1614 | + $from['posttoexternal'] = $account['posttoexternal']; |
|
1615 | 1615 | |
1616 | - $from['notes'] = $post_array['notes']; |
|
1617 | - $from['action'] = 'save'; |
|
1618 | - $to['id'] = $toid; |
|
1619 | - $to['account_currency'] = $post_array['account_currency']; |
|
1620 | - $to['accountid'] = $post_array['toaccountid']; |
|
1621 | - if ($toaccountinfo['posttoexternal'] == 0) { |
|
1622 | - $to['credit'] = abs($post_array['credit']); |
|
1623 | - $to['payment_type'] = '0'; |
|
1624 | - } else { |
|
1625 | - $to['credit'] = abs($post_array['credit']); |
|
1626 | - $to['payment_type'] = 'debit'; |
|
1627 | - } |
|
1628 | - $to['notes'] = $post_array['notes']; |
|
1629 | - $to['action'] = 'save'; |
|
1630 | - $response = $this->user_model->user_fund_transfer($from); |
|
1631 | - if ($response) { |
|
1632 | - $toresponse = $this->user_model->user_fund_transfer($to); |
|
1633 | - $this->session->set_flashdata('astpp_errormsg', 'Transfer success!'); |
|
1634 | - } else { |
|
1635 | - $this->session->set_flashdata('astpp_notification', 'Sorry We are not able to process this request.'); |
|
1636 | - } |
|
1637 | - } |
|
1638 | - }else{ |
|
1616 | + $from['notes'] = $post_array['notes']; |
|
1617 | + $from['action'] = 'save'; |
|
1618 | + $to['id'] = $toid; |
|
1619 | + $to['account_currency'] = $post_array['account_currency']; |
|
1620 | + $to['accountid'] = $post_array['toaccountid']; |
|
1621 | + if ($toaccountinfo['posttoexternal'] == 0) { |
|
1622 | + $to['credit'] = abs($post_array['credit']); |
|
1623 | + $to['payment_type'] = '0'; |
|
1624 | + } else { |
|
1625 | + $to['credit'] = abs($post_array['credit']); |
|
1626 | + $to['payment_type'] = 'debit'; |
|
1627 | + } |
|
1628 | + $to['notes'] = $post_array['notes']; |
|
1629 | + $to['action'] = 'save'; |
|
1630 | + $response = $this->user_model->user_fund_transfer($from); |
|
1631 | + if ($response) { |
|
1632 | + $toresponse = $this->user_model->user_fund_transfer($to); |
|
1633 | + $this->session->set_flashdata('astpp_errormsg', 'Transfer success!'); |
|
1634 | + } else { |
|
1635 | + $this->session->set_flashdata('astpp_notification', 'Sorry We are not able to process this request.'); |
|
1636 | + } |
|
1637 | + } |
|
1638 | + }else{ |
|
1639 | 1639 | $this->session->set_flashdata('astpp_notification', 'Account number not found.'); |
1640 | - } |
|
1641 | - } else { |
|
1642 | - $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.'); |
|
1643 | - } |
|
1644 | - redirect(base_url() . 'user/user_fund_transfer/'); |
|
1645 | - } |
|
1646 | - $this->load->view('view_user_fund_transfer', $data); |
|
1647 | - } |
|
1648 | - function user_opensips() { |
|
1649 | - $data['username'] = $this->session->userdata('user_name'); |
|
1650 | - $data['page_title'] = 'Opensips List'; |
|
1651 | - $data['search_flag'] = true; |
|
1652 | - $data["fs_grid_buttons"] = $this->user_form->build_user_opensips_buttons(); |
|
1653 | - $data['grid_fields'] = $this->user_form->build_user_opensips(); |
|
1654 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_opensips_search()); |
|
1655 | - $this->load->view('view_opensips_list', $data); |
|
1656 | - } |
|
1657 | - |
|
1658 | - function user_opensips_json() { |
|
1659 | - $accountinfo = $this->session->userdata("accountinfo"); |
|
1660 | - $json_data = array(); |
|
1661 | - $count_all = $this->user_model->get_user_opensips(false, $accountinfo['number']); |
|
1662 | - $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'],$_GET['page']); |
|
1663 | - $json_data = $paging_data["json_paging"]; |
|
1664 | - $query = $this->user_model->get_user_opensips(true, $accountinfo['number'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1665 | - $grid_fields = json_decode($this->user_form->build_user_opensips()); |
|
1666 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1667 | - echo json_encode($json_data); |
|
1668 | - } |
|
1669 | - |
|
1670 | - function user_opensips_clearsearchfilter() { |
|
1671 | - $this->session->set_userdata('advance_search', 0); |
|
1672 | - $this->session->set_userdata('user_opensips_search', ""); |
|
1673 | - } |
|
1674 | - |
|
1675 | - function user_opensips_search() { |
|
1676 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1677 | - |
|
1678 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1679 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1680 | - $action = $this->input->post(); |
|
1681 | - unset($action['action']); |
|
1682 | - unset($action['advance_search']); |
|
1683 | - $this->session->set_userdata('user_opensips_search', $action); |
|
1684 | - } |
|
1685 | - if ($ajax_search != 1) { |
|
1686 | - redirect(base_url() . 'user/user_opensips/'); |
|
1687 | - } |
|
1688 | - } |
|
1689 | - |
|
1690 | - function user_opensips_add() { |
|
1640 | + } |
|
1641 | + } else { |
|
1642 | + $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.'); |
|
1643 | + } |
|
1644 | + redirect(base_url() . 'user/user_fund_transfer/'); |
|
1645 | + } |
|
1646 | + $this->load->view('view_user_fund_transfer', $data); |
|
1647 | + } |
|
1648 | + function user_opensips() { |
|
1649 | + $data['username'] = $this->session->userdata('user_name'); |
|
1650 | + $data['page_title'] = 'Opensips List'; |
|
1651 | + $data['search_flag'] = true; |
|
1652 | + $data["fs_grid_buttons"] = $this->user_form->build_user_opensips_buttons(); |
|
1653 | + $data['grid_fields'] = $this->user_form->build_user_opensips(); |
|
1654 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_opensips_search()); |
|
1655 | + $this->load->view('view_opensips_list', $data); |
|
1656 | + } |
|
1657 | + |
|
1658 | + function user_opensips_json() { |
|
1659 | + $accountinfo = $this->session->userdata("accountinfo"); |
|
1660 | + $json_data = array(); |
|
1661 | + $count_all = $this->user_model->get_user_opensips(false, $accountinfo['number']); |
|
1662 | + $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'],$_GET['page']); |
|
1663 | + $json_data = $paging_data["json_paging"]; |
|
1664 | + $query = $this->user_model->get_user_opensips(true, $accountinfo['number'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1665 | + $grid_fields = json_decode($this->user_form->build_user_opensips()); |
|
1666 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1667 | + echo json_encode($json_data); |
|
1668 | + } |
|
1669 | + |
|
1670 | + function user_opensips_clearsearchfilter() { |
|
1671 | + $this->session->set_userdata('advance_search', 0); |
|
1672 | + $this->session->set_userdata('user_opensips_search', ""); |
|
1673 | + } |
|
1674 | + |
|
1675 | + function user_opensips_search() { |
|
1676 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1677 | + |
|
1678 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1679 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1680 | + $action = $this->input->post(); |
|
1681 | + unset($action['action']); |
|
1682 | + unset($action['advance_search']); |
|
1683 | + $this->session->set_userdata('user_opensips_search', $action); |
|
1684 | + } |
|
1685 | + if ($ajax_search != 1) { |
|
1686 | + redirect(base_url() . 'user/user_opensips/'); |
|
1687 | + } |
|
1688 | + } |
|
1689 | + |
|
1690 | + function user_opensips_add() { |
|
1691 | 1691 | $accountinfo = $this->session->userdata("accountinfo"); |
1692 | - $data['username'] = $this->session->userdata('user_name'); |
|
1693 | - $data['flag'] = 'create'; |
|
1694 | - $data['page_title'] = 'Create Opensips'; |
|
1695 | - $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form(), ''); |
|
1696 | - $this->load->view('view_opensips_add_edit', $data); |
|
1697 | - } |
|
1692 | + $data['username'] = $this->session->userdata('user_name'); |
|
1693 | + $data['flag'] = 'create'; |
|
1694 | + $data['page_title'] = 'Create Opensips'; |
|
1695 | + $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form(), ''); |
|
1696 | + $this->load->view('view_opensips_add_edit', $data); |
|
1697 | + } |
|
1698 | 1698 | |
1699 | - function user_opensips_edit($edit_id){ |
|
1699 | + function user_opensips_edit($edit_id){ |
|
1700 | 1700 | $data['page_title'] = 'Edit Opensips'; |
1701 | - $db_config = Common_model::$global_config['system_config']; |
|
1702 | - $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="; |
|
1703 | - $this->opensips_db = $this->load->database($opensipdsn, true); |
|
1704 | - $where = array('id' => $edit_id); |
|
1705 | - $this->opensips_db->where($where); |
|
1706 | - $account = $this->opensips_db->get("subscriber"); |
|
1707 | - foreach ($account->result_array() as $key => $value) { |
|
1708 | - $edit_data = $value; |
|
1709 | - } |
|
1710 | - $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form($edit_id), $edit_data); |
|
1711 | - $this->load->view('view_opensips_add_edit', $data); |
|
1701 | + $db_config = Common_model::$global_config['system_config']; |
|
1702 | + $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="; |
|
1703 | + $this->opensips_db = $this->load->database($opensipdsn, true); |
|
1704 | + $where = array('id' => $edit_id); |
|
1705 | + $this->opensips_db->where($where); |
|
1706 | + $account = $this->opensips_db->get("subscriber"); |
|
1707 | + foreach ($account->result_array() as $key => $value) { |
|
1708 | + $edit_data = $value; |
|
1709 | + } |
|
1710 | + $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form($edit_id), $edit_data); |
|
1711 | + $this->load->view('view_opensips_add_edit', $data); |
|
1712 | 1712 | |
1713 | - } |
|
1713 | + } |
|
1714 | 1714 | |
1715 | - function user_opensips_save(){ |
|
1715 | + function user_opensips_save(){ |
|
1716 | 1716 | $add_array = $this->input->post(); |
1717 | - $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form(), $add_array); |
|
1718 | - if ($add_array['id'] != '') { |
|
1719 | - $data['page_title'] = 'Edit Opensips'; |
|
1720 | - if ($this->form_validation->run() == FALSE) { |
|
1721 | - $data['validation_errors'] = validation_errors(); |
|
1722 | - echo $data['validation_errors']; |
|
1723 | - exit; |
|
1724 | - } else { |
|
1725 | - $auth_flag = $this->validate_device_data($add_array); |
|
1726 | - if($auth_flag == "TRUE"){ |
|
1727 | - $this->user_model->user_opensips_edit($add_array, $add_array['id']); |
|
1728 | - echo json_encode(array("SUCCESS"=> " OpenSips updated successfully!")); |
|
1729 | - exit; |
|
1730 | - }else{ |
|
1731 | - echo json_encode($auth_flag); |
|
1732 | - exit; |
|
1733 | - } |
|
1734 | - } |
|
1735 | - } else { |
|
1736 | - $data['page_title'] = 'Add Opensips'; |
|
1737 | - if ($this->form_validation->run() == FALSE) { |
|
1738 | - $data['validation_errors'] = validation_errors(); |
|
1739 | - echo $data['validation_errors']; |
|
1740 | - exit; |
|
1741 | - } else { |
|
1742 | - $auth_flag = $this->validate_device_data($add_array); |
|
1743 | - if($auth_flag == "TRUE"){ |
|
1744 | - $this->user_model->user_opensips_add($add_array); |
|
1745 | - echo json_encode(array("SUCCESS"=> "OpenSips added successfully!")); |
|
1746 | - exit; |
|
1747 | - }else{ |
|
1748 | - echo json_encode($auth_flag); |
|
1749 | - exit; |
|
1750 | - } |
|
1751 | - } |
|
1752 | - } |
|
1753 | - } |
|
1754 | - function validate_device_data($data){ |
|
1755 | - if(isset($data["username"]) && $data["username"] != ""){ |
|
1756 | - $db_config = Common_model::$global_config['system_config']; |
|
1757 | - $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="; |
|
1758 | - $this->opensips_db = $this->load->database($opensipdsn, true); |
|
1759 | - $where = array("username"=>$data["username"]); |
|
1760 | - if($data['id'] != ""){ |
|
1761 | - $this->opensips_db->where("id <>",$data['id']); |
|
1762 | - } |
|
1763 | - $this->opensips_db->where($where); |
|
1764 | - $auth_flag = $this->opensips_db->get("subscriber"); |
|
1765 | - $auth_flag = $auth_flag->num_rows(); |
|
1766 | - if($auth_flag == 0){ |
|
1767 | - return "TRUE"; |
|
1768 | - }else{ |
|
1769 | - return array("username_error"=>"Duplicate Username Found.Username Must be Unique"); |
|
1770 | - } |
|
1771 | - }else{ |
|
1772 | - return array("username_error"=>"User name is required field."); |
|
1773 | - } |
|
1774 | - return "0"; |
|
1775 | - } |
|
1717 | + $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form(), $add_array); |
|
1718 | + if ($add_array['id'] != '') { |
|
1719 | + $data['page_title'] = 'Edit Opensips'; |
|
1720 | + if ($this->form_validation->run() == FALSE) { |
|
1721 | + $data['validation_errors'] = validation_errors(); |
|
1722 | + echo $data['validation_errors']; |
|
1723 | + exit; |
|
1724 | + } else { |
|
1725 | + $auth_flag = $this->validate_device_data($add_array); |
|
1726 | + if($auth_flag == "TRUE"){ |
|
1727 | + $this->user_model->user_opensips_edit($add_array, $add_array['id']); |
|
1728 | + echo json_encode(array("SUCCESS"=> " OpenSips updated successfully!")); |
|
1729 | + exit; |
|
1730 | + }else{ |
|
1731 | + echo json_encode($auth_flag); |
|
1732 | + exit; |
|
1733 | + } |
|
1734 | + } |
|
1735 | + } else { |
|
1736 | + $data['page_title'] = 'Add Opensips'; |
|
1737 | + if ($this->form_validation->run() == FALSE) { |
|
1738 | + $data['validation_errors'] = validation_errors(); |
|
1739 | + echo $data['validation_errors']; |
|
1740 | + exit; |
|
1741 | + } else { |
|
1742 | + $auth_flag = $this->validate_device_data($add_array); |
|
1743 | + if($auth_flag == "TRUE"){ |
|
1744 | + $this->user_model->user_opensips_add($add_array); |
|
1745 | + echo json_encode(array("SUCCESS"=> "OpenSips added successfully!")); |
|
1746 | + exit; |
|
1747 | + }else{ |
|
1748 | + echo json_encode($auth_flag); |
|
1749 | + exit; |
|
1750 | + } |
|
1751 | + } |
|
1752 | + } |
|
1753 | + } |
|
1754 | + function validate_device_data($data){ |
|
1755 | + if(isset($data["username"]) && $data["username"] != ""){ |
|
1756 | + $db_config = Common_model::$global_config['system_config']; |
|
1757 | + $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="; |
|
1758 | + $this->opensips_db = $this->load->database($opensipdsn, true); |
|
1759 | + $where = array("username"=>$data["username"]); |
|
1760 | + if($data['id'] != ""){ |
|
1761 | + $this->opensips_db->where("id <>",$data['id']); |
|
1762 | + } |
|
1763 | + $this->opensips_db->where($where); |
|
1764 | + $auth_flag = $this->opensips_db->get("subscriber"); |
|
1765 | + $auth_flag = $auth_flag->num_rows(); |
|
1766 | + if($auth_flag == 0){ |
|
1767 | + return "TRUE"; |
|
1768 | + }else{ |
|
1769 | + return array("username_error"=>"Duplicate Username Found.Username Must be Unique"); |
|
1770 | + } |
|
1771 | + }else{ |
|
1772 | + return array("username_error"=>"User name is required field."); |
|
1773 | + } |
|
1774 | + return "0"; |
|
1775 | + } |
|
1776 | 1776 | |
1777 | - function user_opensips_delete($id){ |
|
1778 | - $this->user_model->user_opensips_delete($id); |
|
1779 | - $this->session->set_flashdata('astpp_errormsg', 'Opensips Device Removed Successfully!.'); |
|
1780 | - redirect(base_url() . "user/user_opensips/"); |
|
1781 | - } |
|
1782 | - function user_opensips_delete_multiple(){ |
|
1783 | - $db_config = Common_model::$global_config['system_config']; |
|
1784 | - $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="; |
|
1785 | - $this->opensips_db = $this->load->database($opensipdsn, true); |
|
1786 | - $ids = $this->input->post("selected_ids", true); |
|
1787 | - $where = "id IN ($ids)"; |
|
1788 | - $this->opensips_db->where($where); |
|
1789 | - $this->opensips_db->delete("subscriber"); |
|
1790 | - echo TRUE; |
|
1791 | - } |
|
1777 | + function user_opensips_delete($id){ |
|
1778 | + $this->user_model->user_opensips_delete($id); |
|
1779 | + $this->session->set_flashdata('astpp_errormsg', 'Opensips Device Removed Successfully!.'); |
|
1780 | + redirect(base_url() . "user/user_opensips/"); |
|
1781 | + } |
|
1782 | + function user_opensips_delete_multiple(){ |
|
1783 | + $db_config = Common_model::$global_config['system_config']; |
|
1784 | + $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="; |
|
1785 | + $this->opensips_db = $this->load->database($opensipdsn, true); |
|
1786 | + $ids = $this->input->post("selected_ids", true); |
|
1787 | + $where = "id IN ($ids)"; |
|
1788 | + $this->opensips_db->where($where); |
|
1789 | + $this->opensips_db->delete("subscriber"); |
|
1790 | + echo TRUE; |
|
1791 | + } |
|
1792 | 1792 | |
1793 | - function user_cdrs(){ |
|
1794 | - $data['username'] = $this->session->userdata('user_name'); |
|
1795 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1796 | - $data['page_title'] = 'CDRs'; |
|
1797 | - $accounttype = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
|
1798 | - $this->load->module('reports/reports'); |
|
1799 | - $data['grid_fields'] = $this->reports->reports_form->build_report_list_for_user($accounttype); |
|
1800 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_opensips_search()); |
|
1801 | - $data['accounttype']=$accounttype; |
|
1802 | - $this->load->view('view_user_cdrs', $data); |
|
1803 | - } |
|
1804 | - function user_cdrs_json(){ |
|
1805 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1806 | - $accounttype = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
|
1807 | - $this->load->module('reports/reports'); |
|
1808 | - $this->reports->customer_cdrreport($accountinfo['id'], $accounttype); |
|
1809 | - } |
|
1810 | - function user_details_search($module_name){ |
|
1811 | - $action = $this->input->post(); |
|
1812 | - $this->session->set_userdata('left_panel_search_'.$module_name,""); |
|
1813 | - if(!empty($action['left_panel_search'])){ |
|
1814 | - $this->session->set_userdata('left_panel_search_'.$module_name, $action['left_panel_search']); |
|
1815 | - } |
|
1816 | - } |
|
1817 | - |
|
1818 | - function user_provider_report_export() { |
|
1819 | - $this->load->module('reports/reports'); |
|
1820 | - $this->provider_cdrreport_export(); |
|
1821 | - } |
|
1793 | + function user_cdrs(){ |
|
1794 | + $data['username'] = $this->session->userdata('user_name'); |
|
1795 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1796 | + $data['page_title'] = 'CDRs'; |
|
1797 | + $accounttype = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
|
1798 | + $this->load->module('reports/reports'); |
|
1799 | + $data['grid_fields'] = $this->reports->reports_form->build_report_list_for_user($accounttype); |
|
1800 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_opensips_search()); |
|
1801 | + $data['accounttype']=$accounttype; |
|
1802 | + $this->load->view('view_user_cdrs', $data); |
|
1803 | + } |
|
1804 | + function user_cdrs_json(){ |
|
1805 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1806 | + $accounttype = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
|
1807 | + $this->load->module('reports/reports'); |
|
1808 | + $this->reports->customer_cdrreport($accountinfo['id'], $accounttype); |
|
1809 | + } |
|
1810 | + function user_details_search($module_name){ |
|
1811 | + $action = $this->input->post(); |
|
1812 | + $this->session->set_userdata('left_panel_search_'.$module_name,""); |
|
1813 | + if(!empty($action['left_panel_search'])){ |
|
1814 | + $this->session->set_userdata('left_panel_search_'.$module_name, $action['left_panel_search']); |
|
1815 | + } |
|
1816 | + } |
|
1817 | + |
|
1818 | + function user_provider_report_export() { |
|
1819 | + $this->load->module('reports/reports'); |
|
1820 | + $this->provider_cdrreport_export(); |
|
1821 | + } |
|
1822 | 1822 | |
1823 | 1823 | |
1824 | - function user_provider_cdrs_report() { |
|
1825 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1826 | - $data['page_title'] = 'Provider CDRs Report'; |
|
1827 | - $data['search_flag'] = true; |
|
1828 | - $data["grid_buttons"] = $this->user_form->build_provider_report_buttons(); |
|
1829 | - $data['grid_fields'] = $this->user_form->build_provider_report($accountinfo['type']); |
|
1830 | - $data['form_search'] = $this->form->build_serach_form($this->user_form->build_provider_report_search($accountinfo['type'])); |
|
1831 | - $this->load->view('view_provider_cdrs_report', $data); |
|
1832 | - } |
|
1833 | - |
|
1834 | - function user_provider_cdrs_report_json() { |
|
1835 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1836 | - $variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost'; |
|
1837 | - $count_res = $this->user_model->getprovider_cdrs_list(false, "", ""); |
|
1838 | - $count_all = (array) $count_res->first_row(); |
|
1839 | - $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
|
1840 | - $json_data = $paging_data["json_paging"]; |
|
1841 | - $query = $this->user_model->getprovider_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false); |
|
1842 | - $grid_fields = json_decode($this->user_form->build_provider_report($accountinfo['type'])); |
|
1843 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1844 | - if ($count_all['count'] > 0) { |
|
1845 | - $search_arr = $this->session->userdata('user_provider_cdrs_report_search'); |
|
1846 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1847 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1848 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1849 | - $json_data['rows'][] = array("cell" => array( |
|
1850 | - "<b>Grand Total</b>", |
|
1851 | - "", |
|
1852 | - "", |
|
1853 | - "", |
|
1854 | - $duration, |
|
1855 | - "<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>", |
|
1856 | - "", |
|
1857 | - "", |
|
1858 | - )); |
|
1859 | - } |
|
1860 | - echo json_encode($json_data); |
|
1861 | - } |
|
1862 | - |
|
1863 | - function user_provider_cdrs_report_search() { |
|
1864 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
1865 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
1866 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1867 | - $action = $this->input->post(); |
|
1868 | - if (isset($action['cost']['cost']) && $action['cost']['cost'] != '') { |
|
1869 | - $action['cost']['cost'] = $this->common_model->add_calculate_currency($action['cost']['cost'], "", '', true, false); |
|
1870 | - } |
|
1871 | - unset($action['action']); |
|
1872 | - unset($action['advance_search']); |
|
1873 | - $this->session->set_userdata('user_provider_cdrs_report_search', $action); |
|
1874 | - } |
|
1875 | - if ($ajax_search != 1) { |
|
1876 | - redirect(base_url() . 'user/user_provider_cdrs_report/'); |
|
1877 | - } |
|
1878 | - } |
|
1879 | - |
|
1880 | - function user_provider_cdrs_report_clearsearchfilter() { |
|
1881 | - $this->session->set_userdata('advance_search', 0); |
|
1882 | - $this->session->set_userdata('user_provider_cdrs_report_search', ""); |
|
1883 | - } |
|
1884 | - |
|
1885 | - function user_provider_cdrreport_export() { |
|
1824 | + function user_provider_cdrs_report() { |
|
1825 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1826 | + $data['page_title'] = 'Provider CDRs Report'; |
|
1827 | + $data['search_flag'] = true; |
|
1828 | + $data["grid_buttons"] = $this->user_form->build_provider_report_buttons(); |
|
1829 | + $data['grid_fields'] = $this->user_form->build_provider_report($accountinfo['type']); |
|
1830 | + $data['form_search'] = $this->form->build_serach_form($this->user_form->build_provider_report_search($accountinfo['type'])); |
|
1831 | + $this->load->view('view_provider_cdrs_report', $data); |
|
1832 | + } |
|
1833 | + |
|
1834 | + function user_provider_cdrs_report_json() { |
|
1835 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1836 | + $variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost'; |
|
1837 | + $count_res = $this->user_model->getprovider_cdrs_list(false, "", ""); |
|
1838 | + $count_all = (array) $count_res->first_row(); |
|
1839 | + $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
|
1840 | + $json_data = $paging_data["json_paging"]; |
|
1841 | + $query = $this->user_model->getprovider_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false); |
|
1842 | + $grid_fields = json_decode($this->user_form->build_provider_report($accountinfo['type'])); |
|
1843 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
1844 | + if ($count_all['count'] > 0) { |
|
1845 | + $search_arr = $this->session->userdata('user_provider_cdrs_report_search'); |
|
1846 | + $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1847 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1848 | + floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1849 | + $json_data['rows'][] = array("cell" => array( |
|
1850 | + "<b>Grand Total</b>", |
|
1851 | + "", |
|
1852 | + "", |
|
1853 | + "", |
|
1854 | + $duration, |
|
1855 | + "<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>", |
|
1856 | + "", |
|
1857 | + "", |
|
1858 | + )); |
|
1859 | + } |
|
1860 | + echo json_encode($json_data); |
|
1861 | + } |
|
1862 | + |
|
1863 | + function user_provider_cdrs_report_search() { |
|
1864 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
1865 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
1866 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
1867 | + $action = $this->input->post(); |
|
1868 | + if (isset($action['cost']['cost']) && $action['cost']['cost'] != '') { |
|
1869 | + $action['cost']['cost'] = $this->common_model->add_calculate_currency($action['cost']['cost'], "", '', true, false); |
|
1870 | + } |
|
1871 | + unset($action['action']); |
|
1872 | + unset($action['advance_search']); |
|
1873 | + $this->session->set_userdata('user_provider_cdrs_report_search', $action); |
|
1874 | + } |
|
1875 | + if ($ajax_search != 1) { |
|
1876 | + redirect(base_url() . 'user/user_provider_cdrs_report/'); |
|
1877 | + } |
|
1878 | + } |
|
1879 | + |
|
1880 | + function user_provider_cdrs_report_clearsearchfilter() { |
|
1881 | + $this->session->set_userdata('advance_search', 0); |
|
1882 | + $this->session->set_userdata('user_provider_cdrs_report_search', ""); |
|
1883 | + } |
|
1884 | + |
|
1885 | + function user_provider_cdrreport_export() { |
|
1886 | 1886 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
1887 | 1887 | $currency_id=$account_info['currency_id']; |
1888 | 1888 | $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
1889 | - $count_res = $this->user_model->getprovider_cdrs_list(false, "", ""); |
|
1890 | - $count_all = (array) $count_res->first_row(); |
|
1891 | - ob_clean(); |
|
1892 | - $customer_array[] = array("Date", "CallerID", "Called Number", "Destination", "Duration", "Cost($currency)", "Disposition", "Call Type"); |
|
1893 | - if ($count_all['count'] > 0) { |
|
1894 | - $query = $this->user_model->getuser_cdrs_list(true, '', '', true); |
|
1895 | - $currency_info = $this->common->get_currency_info(); |
|
1896 | - $search_arr = $this->session->userdata('user_provider_cdrs_report_search'); |
|
1897 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1898 | - foreach ($query->result_array() as $value) { |
|
1899 | - $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
1900 | - floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
1901 | - $customer_array[] = array( |
|
1902 | - $this->common->convert_GMT_to('', '', $value['callstart']), |
|
1903 | - $value['callerid'], |
|
1904 | - $value['callednum'], |
|
1905 | - filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
|
1906 | - $duration, |
|
1907 | - $this->common->calculate_currency_manually($currency_info, $value['cost'],false), |
|
1908 | - $value['disposition'], |
|
1909 | - $value['calltype'] |
|
1910 | - ); |
|
1911 | - } |
|
1912 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1913 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1914 | - $customer_array[] = array("Grand Total", |
|
1915 | - "", |
|
1916 | - "", |
|
1917 | - "", |
|
1918 | - $duration, |
|
1919 | - $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'],false,true), |
|
1920 | - "", |
|
1921 | - "" |
|
1922 | - ); |
|
1923 | - } |
|
1924 | - $this->load->helper('csv'); |
|
1925 | - array_to_csv($customer_array, 'Provider_CDR_' . date("Y-m-d") . '.csv'); |
|
1926 | - } |
|
1927 | - function user_speeddial(){ |
|
1928 | - $data['page_title'] = "Speed Dial"; |
|
1929 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
1930 | - $where = array('id' => $accountinfo['id'], "reseller_id" => $accountinfo['reseller_id']); |
|
1931 | - $account = $this->db_model->getSelect("*", "accounts", $where); |
|
1889 | + $count_res = $this->user_model->getprovider_cdrs_list(false, "", ""); |
|
1890 | + $count_all = (array) $count_res->first_row(); |
|
1891 | + ob_clean(); |
|
1892 | + $customer_array[] = array("Date", "CallerID", "Called Number", "Destination", "Duration", "Cost($currency)", "Disposition", "Call Type"); |
|
1893 | + if ($count_all['count'] > 0) { |
|
1894 | + $query = $this->user_model->getuser_cdrs_list(true, '', '', true); |
|
1895 | + $currency_info = $this->common->get_currency_info(); |
|
1896 | + $search_arr = $this->session->userdata('user_provider_cdrs_report_search'); |
|
1897 | + $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1898 | + foreach ($query->result_array() as $value) { |
|
1899 | + $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
1900 | + floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
1901 | + $customer_array[] = array( |
|
1902 | + $this->common->convert_GMT_to('', '', $value['callstart']), |
|
1903 | + $value['callerid'], |
|
1904 | + $value['callednum'], |
|
1905 | + filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
|
1906 | + $duration, |
|
1907 | + $this->common->calculate_currency_manually($currency_info, $value['cost'],false), |
|
1908 | + $value['disposition'], |
|
1909 | + $value['calltype'] |
|
1910 | + ); |
|
1911 | + } |
|
1912 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1913 | + floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1914 | + $customer_array[] = array("Grand Total", |
|
1915 | + "", |
|
1916 | + "", |
|
1917 | + "", |
|
1918 | + $duration, |
|
1919 | + $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'],false,true), |
|
1920 | + "", |
|
1921 | + "" |
|
1922 | + ); |
|
1923 | + } |
|
1924 | + $this->load->helper('csv'); |
|
1925 | + array_to_csv($customer_array, 'Provider_CDR_' . date("Y-m-d") . '.csv'); |
|
1926 | + } |
|
1927 | + function user_speeddial(){ |
|
1928 | + $data['page_title'] = "Speed Dial"; |
|
1929 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1930 | + $where = array('id' => $accountinfo['id'], "reseller_id" => $accountinfo['reseller_id']); |
|
1931 | + $account = $this->db_model->getSelect("*", "accounts", $where); |
|
1932 | 1932 | if ($account->num_rows() > 0) { |
1933 | 1933 | $account_data = (array) $account->first_row(); |
1934 | 1934 | $speeddial_res = $this->db->get_where("speed_dial", array("accountid" => $accountinfo['id'])); |
1935 | 1935 | $speeddial_info = array(); |
1936 | - if ($speeddial_res->num_rows() > 0) { |
|
1937 | - $speeddial_res = $speeddial_res->result_array(); |
|
1938 | - foreach ($speeddial_res as $key => $value) { |
|
1939 | - $speeddial_info[$value['speed_num']] = $value['number']; |
|
1940 | - } |
|
1941 | - } |
|
1942 | - $data['speeddial'] = $speeddial_info; |
|
1936 | + if ($speeddial_res->num_rows() > 0) { |
|
1937 | + $speeddial_res = $speeddial_res->result_array(); |
|
1938 | + foreach ($speeddial_res as $key => $value) { |
|
1939 | + $speeddial_info[$value['speed_num']] = $value['number']; |
|
1940 | + } |
|
1941 | + } |
|
1942 | + $data['speeddial'] = $speeddial_info; |
|
1943 | 1943 | $this->load->view('view_user_speeddial', $data); |
1944 | 1944 | }else{ |
1945 | 1945 | redirect(base_url.'user/user/'); |
1946 | 1946 | } |
1947 | - } |
|
1947 | + } |
|
1948 | 1948 | |
1949 | - function user_speeddial_save(){ |
|
1950 | - $add_array= $this->input->post(); |
|
1951 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1952 | - $where = array("accountid" => $accountinfo['id']); |
|
1949 | + function user_speeddial_save(){ |
|
1950 | + $add_array= $this->input->post(); |
|
1951 | + $accountinfo=$this->session->userdata('accountinfo'); |
|
1952 | + $where = array("accountid" => $accountinfo['id']); |
|
1953 | 1953 | $this->db->select('count(id) as count'); |
1954 | 1954 | $this->db->where($where); |
1955 | 1955 | $speed_dial_result = (array)$this->db->get('speed_dial')->first_row(); |
1956 | 1956 | if ($speed_dial_result['count'] == 0) { |
1957 | - for ($i = 0; $i <= 9; $i++) { |
|
1958 | - $dest_number = $add_array['number'] == $i ? $add_array['destination'] : ''; |
|
1959 | - $data[$i] = array("number" => $dest_number, "speed_num" => $i, 'accountid' => $accountinfo['id']); |
|
1960 | - } |
|
1961 | - $this->db->insert_batch('speed_dial', $data); |
|
1957 | + for ($i = 0; $i <= 9; $i++) { |
|
1958 | + $dest_number = $add_array['number'] == $i ? $add_array['destination'] : ''; |
|
1959 | + $data[$i] = array("number" => $dest_number, "speed_num" => $i, 'accountid' => $accountinfo['id']); |
|
1960 | + } |
|
1961 | + $this->db->insert_batch('speed_dial', $data); |
|
1962 | 1962 | } else { |
1963 | - $this->db->where('speed_num', $add_array['number']); |
|
1964 | - $this->db->where('accountid', $accountinfo['id']); |
|
1965 | - $result = $this->db->update('speed_dial', array('number' => $add_array['destination'])); |
|
1963 | + $this->db->where('speed_num', $add_array['number']); |
|
1964 | + $this->db->where('accountid', $accountinfo['id']); |
|
1965 | + $result = $this->db->update('speed_dial', array('number' => $add_array['destination'])); |
|
1966 | 1966 | } |
1967 | - } |
|
1968 | - function user_speeddial_remove() { |
|
1967 | + } |
|
1968 | + function user_speeddial_remove() { |
|
1969 | 1969 | $accountinfo=$this->session->userdata('accountinfo'); |
1970 | 1970 | $add_array=$this->input->post(); |
1971 | - $updateinfo = array('number' => ''); |
|
1972 | - $this->db->where('speed_num', $add_array['number']); |
|
1973 | - $this->db->where('accountid', $accountinfo['id']); |
|
1974 | - $result = $this->db->update('speed_dial', $updateinfo); |
|
1975 | - } |
|
1971 | + $updateinfo = array('number' => ''); |
|
1972 | + $this->db->where('speed_num', $add_array['number']); |
|
1973 | + $this->db->where('accountid', $accountinfo['id']); |
|
1974 | + $result = $this->db->update('speed_dial', $updateinfo); |
|
1975 | + } |
|
1976 | 1976 | } |
1977 | 1977 | |
1978 | 1978 | ?> |
@@ -37,31 +37,31 @@ discard block |
||
37 | 37 | |
38 | 38 | function index() { |
39 | 39 | if ($this->session->userdata('user_login') == FALSE) |
40 | - redirect(base_url() . 'login/login'); |
|
40 | + redirect(base_url().'login/login'); |
|
41 | 41 | $data['page_title'] = 'Dashboard'; |
42 | 42 | $this->load->view('view_user_dashboard', $data); |
43 | 43 | } |
44 | 44 | |
45 | 45 | function user_dashboard_recent_payments() { |
46 | - $result=$this->user_model->user_dashboard_recent_recharge_info(); |
|
47 | - $gmtoffset=$this->common->get_timezone_offset(); |
|
48 | - $i=0; |
|
49 | - $json_data=array(); |
|
50 | - if($result->num_rows() > 0) |
|
46 | + $result = $this->user_model->user_dashboard_recent_recharge_info(); |
|
47 | + $gmtoffset = $this->common->get_timezone_offset(); |
|
48 | + $i = 0; |
|
49 | + $json_data = array(); |
|
50 | + if ($result->num_rows() > 0) |
|
51 | 51 | { |
52 | - $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts',''); |
|
53 | - $json_data[0]['accountid']='Accounts'; |
|
54 | - $json_data[0]['credit']='Amount'; |
|
55 | - $json_data[0]['payment_date']='Date'; |
|
56 | - $json_data[0]['notes']='Notes'; |
|
57 | - foreach($result->result_array() as $key=>$data){ |
|
58 | - $current_timestamp=strtotime($data['payment_date']); |
|
59 | - $modified_date=$current_timestamp+$gmtoffset; |
|
60 | - $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] :"Anonymous"; |
|
61 | - $json_data[$i]['accountid']=$data['accountid']; |
|
62 | - $json_data[$i]['credit']=$this->common_model->calculate_currency($data['credit'],'','',true,false); |
|
63 | - $json_data[$i]['payment_date']=date('Y-m-d H:i:s',strtotime($data['payment_date'])+$gmtoffset); |
|
64 | - $json_data[$i]['notes']=$data['notes']; |
|
52 | + $account_arr = $this->common->get_array('id,number,first_name,last_name', 'accounts', ''); |
|
53 | + $json_data[0]['accountid'] = 'Accounts'; |
|
54 | + $json_data[0]['credit'] = 'Amount'; |
|
55 | + $json_data[0]['payment_date'] = 'Date'; |
|
56 | + $json_data[0]['notes'] = 'Notes'; |
|
57 | + foreach ($result->result_array() as $key=>$data) { |
|
58 | + $current_timestamp = strtotime($data['payment_date']); |
|
59 | + $modified_date = $current_timestamp + $gmtoffset; |
|
60 | + $data['accountid'] = ($data['accountid'] != '' && isset($account_arr[$data['accountid']])) ? $account_arr[$data['accountid']] : "Anonymous"; |
|
61 | + $json_data[$i]['accountid'] = $data['accountid']; |
|
62 | + $json_data[$i]['credit'] = $this->common_model->calculate_currency($data['credit'], '', '', true, false); |
|
63 | + $json_data[$i]['payment_date'] = date('Y-m-d H:i:s', strtotime($data['payment_date']) + $gmtoffset); |
|
64 | + $json_data[$i]['notes'] = $data['notes']; |
|
65 | 65 | $i++; |
66 | 66 | } |
67 | 67 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | function user_dashboard_invoices_data() { |
93 | 93 | $accountinfo = $this->session->userdata('accountinfo'); |
94 | - $currency=$this->common->get_field_name('currency','currency',array("id"=>$accountinfo['currency_id'])); |
|
94 | + $currency = $this->common->get_field_name('currency', 'currency', array("id"=>$accountinfo['currency_id'])); |
|
95 | 95 | $this->db->where('accountid', $accountinfo['id']); |
96 | 96 | $this->db->where('confirm', 1); |
97 | 97 | $this->db->select('*'); |
@@ -109,20 +109,20 @@ discard block |
||
109 | 109 | $json_data[0]['inv_type'] = 'Recharge Type'; |
110 | 110 | $i = 1; |
111 | 111 | foreach ($result as $key => $data) { |
112 | - $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$data['id'])); |
|
112 | + $invoice_prefix = $entity_type = $this->common->get_field_name('invoice_prefix', 'invoices', array('id'=>$data['id'])); |
|
113 | 113 | |
114 | - $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$data['id'])); |
|
115 | - $invoice_num=$invoice_prefix.$invoiceid; |
|
116 | - $inv_type=$this->common->get_invoice_total('item_type', '', $data['id']); |
|
117 | - if($inv_type == ''){ |
|
118 | - $inv_type='Automatically'; |
|
114 | + $invoiceid = $entity_type = $this->common->get_field_name('invoiceid', 'invoices', array('id'=>$data['id'])); |
|
115 | + $invoice_num = $invoice_prefix.$invoiceid; |
|
116 | + $inv_type = $this->common->get_invoice_total('item_type', '', $data['id']); |
|
117 | + if ($inv_type == '') { |
|
118 | + $inv_type = 'Automatically'; |
|
119 | 119 | } |
120 | - if($inv_type == 'manual_inv'){ |
|
121 | - $inv_type='Manually'; |
|
120 | + if ($inv_type == 'manual_inv') { |
|
121 | + $inv_type = 'Manually'; |
|
122 | 122 | } |
123 | - $inv_debit=$this->common->get_invoice_total('debit', '', $data['id']); |
|
124 | - if($inv_debit == ''){ |
|
125 | - $inv_debit=$this->common->convert_to_currency('', '',0); |
|
123 | + $inv_debit = $this->common->get_invoice_total('debit', '', $data['id']); |
|
124 | + if ($inv_debit == '') { |
|
125 | + $inv_debit = $this->common->convert_to_currency('', '', 0); |
|
126 | 126 | } |
127 | 127 | $json_data[$i]['type'] = $data['type']; |
128 | 128 | $json_data[$i]['id'] = $invoice_num; |
@@ -136,54 +136,54 @@ discard block |
||
136 | 136 | echo json_encode($json_data); |
137 | 137 | } |
138 | 138 | |
139 | - function user_dashboard_subscription_data(){ |
|
140 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
141 | - $this->db->where('accountid',$accountinfo['id']); |
|
139 | + function user_dashboard_subscription_data() { |
|
140 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
141 | + $this->db->where('accountid', $accountinfo['id']); |
|
142 | 142 | $this->db->select('*'); |
143 | - $this->db->order_by('assign_date','desc'); |
|
144 | - $result=$this->db->get('charge_to_account',10); |
|
145 | - $json_data=array(); |
|
143 | + $this->db->order_by('assign_date', 'desc'); |
|
144 | + $result = $this->db->get('charge_to_account', 10); |
|
145 | + $json_data = array(); |
|
146 | 146 | |
147 | - $gmtoffset=$this->common->get_timezone_offset(); |
|
148 | - if($result->num_rows()> 0 ){ |
|
149 | - $result=$result->result_array(); |
|
150 | - $charge_str=null; |
|
151 | - $charges_arr=array(); |
|
152 | - foreach($result as $charges_data){ |
|
153 | - $charge_str.=$charges_data['charge_id'].","; |
|
147 | + $gmtoffset = $this->common->get_timezone_offset(); |
|
148 | + if ($result->num_rows() > 0) { |
|
149 | + $result = $result->result_array(); |
|
150 | + $charge_str = null; |
|
151 | + $charges_arr = array(); |
|
152 | + foreach ($result as $charges_data) { |
|
153 | + $charge_str .= $charges_data['charge_id'].","; |
|
154 | 154 | } |
155 | - $charge_str=rtrim($charge_str,","); |
|
155 | + $charge_str = rtrim($charge_str, ","); |
|
156 | 156 | $where = "id IN ($charge_str)"; |
157 | 157 | $this->db->where($where); |
158 | 158 | $this->db->select('id,description,sweep_id'); |
159 | - $charge_result=$this->db->get('charges'); |
|
160 | - foreach($charge_result->result_array() as $data){ |
|
161 | - $charges_arr[$data['id']]['description']=$data['description']; |
|
162 | - $charges_arr[$data['id']]['sweep_id']=$data['sweep_id']; |
|
159 | + $charge_result = $this->db->get('charges'); |
|
160 | + foreach ($charge_result->result_array() as $data) { |
|
161 | + $charges_arr[$data['id']]['description'] = $data['description']; |
|
162 | + $charges_arr[$data['id']]['sweep_id'] = $data['sweep_id']; |
|
163 | 163 | } |
164 | - $json_data[0]['charge_id']='Charge Name'; |
|
165 | - $json_data[0]['assign_date']='Assign Date'; |
|
166 | - $json_data[0]['sweep_id']='Billing Cycle'; |
|
167 | - $i=1; |
|
168 | - foreach($result as $key=>$data){ |
|
169 | - if(isset($charges_arr[$data['charge_id']]['sweep_id'])){ |
|
170 | - $sweep_id= $charges_arr[$data['charge_id']]['sweep_id']; |
|
164 | + $json_data[0]['charge_id'] = 'Charge Name'; |
|
165 | + $json_data[0]['assign_date'] = 'Assign Date'; |
|
166 | + $json_data[0]['sweep_id'] = 'Billing Cycle'; |
|
167 | + $i = 1; |
|
168 | + foreach ($result as $key=>$data) { |
|
169 | + if (isset($charges_arr[$data['charge_id']]['sweep_id'])) { |
|
170 | + $sweep_id = $charges_arr[$data['charge_id']]['sweep_id']; |
|
171 | 171 | } |
172 | - $data['charge_id'] =isset($charges_arr[$data['charge_id']]['description']) ? $charges_arr[$data['charge_id']]['description'] :"Anonymous"; |
|
173 | - $json_data[$i]['charge_id']=$data['charge_id']; |
|
174 | - if($data['assign_date'] != '0000-00-00 00:00:00'){ |
|
175 | - $json_data[$i]['assign_date']=date('Y-m-d H:i:s',strtotime($data['assign_date'])+$gmtoffset); |
|
176 | - }else{ |
|
177 | - $json_data[$i]['assign_date']=$data['assign_date']; |
|
172 | + $data['charge_id'] = isset($charges_arr[$data['charge_id']]['description']) ? $charges_arr[$data['charge_id']]['description'] : "Anonymous"; |
|
173 | + $json_data[$i]['charge_id'] = $data['charge_id']; |
|
174 | + if ($data['assign_date'] != '0000-00-00 00:00:00') { |
|
175 | + $json_data[$i]['assign_date'] = date('Y-m-d H:i:s', strtotime($data['assign_date']) + $gmtoffset); |
|
176 | + } else { |
|
177 | + $json_data[$i]['assign_date'] = $data['assign_date']; |
|
178 | 178 | } |
179 | - if(isset($sweep_id)){ |
|
180 | - if($sweep_id ==0){ |
|
181 | - $json_data[$i]['sweep_id']='Daily'; |
|
182 | - }else{ |
|
183 | - $json_data[$i]['sweep_id']='Monthly'; |
|
179 | + if (isset($sweep_id)) { |
|
180 | + if ($sweep_id == 0) { |
|
181 | + $json_data[$i]['sweep_id'] = 'Daily'; |
|
182 | + } else { |
|
183 | + $json_data[$i]['sweep_id'] = 'Monthly'; |
|
184 | 184 | } |
185 | - }else{ |
|
186 | - $json_data[$i]['sweep_id']='Anonymous'; |
|
185 | + } else { |
|
186 | + $json_data[$i]['sweep_id'] = 'Anonymous'; |
|
187 | 187 | } |
188 | 188 | $i++; |
189 | 189 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | function user_edit_account() { |
195 | 195 | if ($add_array['id'] != '') { |
196 | 196 | $data['form'] = $this->form->build_form($this->accounts->accounts_form->get_user_form_fields($add_array['id']), $add_array); |
197 | - $data['page_title'] = 'Edit ' . $entity_name; |
|
197 | + $data['page_title'] = 'Edit '.$entity_name; |
|
198 | 198 | if ($this->form_validation->run() == FALSE) { |
199 | 199 | $data['validation_errors'] = validation_errors(); |
200 | 200 | } else { |
@@ -203,14 +203,14 @@ discard block |
||
203 | 203 | $this->accounts->accounts_model->edit_account($add_array, $add_array['id']); |
204 | 204 | $accountinfo = $this->session->userdata('accountinfo'); |
205 | 205 | if ($add_array['id'] == $accountinfo['id']) { |
206 | - $this->session->set_userdata('accountinfo',(array)$this->db->get_where('accounts', array('id' => $add_array['id']))->first_row()); |
|
206 | + $this->session->set_userdata('accountinfo', (array)$this->db->get_where('accounts', array('id' => $add_array['id']))->first_row()); |
|
207 | 207 | } |
208 | - $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name) . ' updated successfully!'); |
|
209 | - redirect(base_url() . 'user/user/'); |
|
208 | + $this->session->set_flashdata('astpp_errormsg', ucfirst($entity_name).' updated successfully!'); |
|
209 | + redirect(base_url().'user/user/'); |
|
210 | 210 | } |
211 | 211 | $this->load->view('view_user_details', $data); |
212 | 212 | } else { |
213 | - $data['page_title'] = 'Edit ' . $entity_name; |
|
213 | + $data['page_title'] = 'Edit '.$entity_name; |
|
214 | 214 | $where = array('id' => $account_data["id"]); |
215 | 215 | $account = $this->db_model->getSelect("*", "accounts", $where); |
216 | 216 | $data["account_data"] = $account->result_array(); |
@@ -227,52 +227,52 @@ discard block |
||
227 | 227 | function user_did_edit($edit_id = '') { |
228 | 228 | $data['page_title'] = 'Edit DIDs'; |
229 | 229 | $account_data = $this->session->userdata("accountinfo"); |
230 | - $this->db->where('id',$edit_id); |
|
230 | + $this->db->where('id', $edit_id); |
|
231 | 231 | $this->db->select('id,call_type,extensions,number'); |
232 | - $did_info=(array)$this->db->get('dids')->first_row(); |
|
233 | - $did_info['free_didlist']=$did_info['id']; |
|
234 | - $data['form'] = $this->form->build_form($this->user_form->build_user_did_form(),$did_info); |
|
232 | + $did_info = (array)$this->db->get('dids')->first_row(); |
|
233 | + $did_info['free_didlist'] = $did_info['id']; |
|
234 | + $data['form'] = $this->form->build_form($this->user_form->build_user_did_form(), $did_info); |
|
235 | 235 | $this->load->view('view_user_did_edit', $data); |
236 | 236 | } |
237 | 237 | |
238 | - function user_dids_action($action,$did_id = "") { |
|
238 | + function user_dids_action($action, $did_id = "") { |
|
239 | 239 | $accountinfo = $this->session->userdata('accountinfo'); |
240 | 240 | $reseller_id = $accountinfo['reseller_id']; |
241 | 241 | $did_id = empty($did_id) ? $this->input->post("free_didlist", true) : $did_id; |
242 | 242 | |
243 | - if($did_id !=''){ |
|
244 | - $account_query = $this->db_model->getSelect("*", "accounts",array('id' => $accountinfo['id'])); |
|
245 | - $account_arr = (array) $account_query->first_row(); |
|
243 | + if ($did_id != '') { |
|
244 | + $account_query = $this->db_model->getSelect("*", "accounts", array('id' => $accountinfo['id'])); |
|
245 | + $account_arr = (array)$account_query->first_row(); |
|
246 | 246 | $did_query = $this->db_model->getSelect("*", "dids", array("id" => $did_id)); |
247 | - $did_arr = (array) $did_query->first_row(); |
|
248 | - if ($action == "add"){ |
|
249 | - if($did_arr['accountid'] == 0 && $did_arr['parent_id'] == $reseller_id ) { |
|
250 | - $setup_cost=$did_arr['setup']; |
|
247 | + $did_arr = (array)$did_query->first_row(); |
|
248 | + if ($action == "add") { |
|
249 | + if ($did_arr['accountid'] == 0 && $did_arr['parent_id'] == $reseller_id) { |
|
250 | + $setup_cost = $did_arr['setup']; |
|
251 | 251 | if ($accountinfo["reseller_id"] > 0) { |
252 | - $reseller_pricing_res = $this->db_model->getSelect("*", "reseller_pricing", array("note" => $did_arr['number'],"reseller_id"=>$accountinfo['reseller_id'])); |
|
252 | + $reseller_pricing_res = $this->db_model->getSelect("*", "reseller_pricing", array("note" => $did_arr['number'], "reseller_id"=>$accountinfo['reseller_id'])); |
|
253 | 253 | $reseller_pricing_arr = (array)$reseller_pricing_res->first_row(); |
254 | - $setup_cost=$reseller_pricing_arr['setup']; |
|
254 | + $setup_cost = $reseller_pricing_arr['setup']; |
|
255 | 255 | } |
256 | 256 | $available_bal = $this->db_model->get_available_bal($account_arr); |
257 | 257 | if ($available_bal >= $setup_cost) { |
258 | - $available_bal = $this->db_model->update_balance($setup_cost,$accountinfo["id"], "debit"); |
|
259 | - $accountinfo=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
260 | - $this->common->add_invoice_details($accountinfo,"DIDCHRG",$setup_cost,$did_arr['number']); |
|
261 | - $this->db_model->update("dids", array("accountid" => $accountinfo["id"],"assign_date" => gmdate('Y-m-d H:i:s')), array("id" => $did_id)); |
|
262 | - $this->common->mail_to_users('email_add_did', $account_arr,"",$did_arr['number']); |
|
258 | + $available_bal = $this->db_model->update_balance($setup_cost, $accountinfo["id"], "debit"); |
|
259 | + $accountinfo = (array)$this->db->get_where('accounts', array("id"=>$accountinfo['id']))->first_row(); |
|
260 | + $this->common->add_invoice_details($accountinfo, "DIDCHRG", $setup_cost, $did_arr['number']); |
|
261 | + $this->db_model->update("dids", array("accountid" => $accountinfo["id"], "assign_date" => gmdate('Y-m-d H:i:s')), array("id" => $did_id)); |
|
262 | + $this->common->mail_to_users('email_add_did', $account_arr, "", $did_arr['number']); |
|
263 | 263 | $this->session->set_flashdata('astpp_errormsg', 'Did added successfully.'); |
264 | - redirect(base_url() . "user/user_didlist/"); |
|
264 | + redirect(base_url()."user/user_didlist/"); |
|
265 | 265 | } else { |
266 | 266 | $this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this did'); |
267 | - redirect(base_url() . "user/user_didlist/"); |
|
267 | + redirect(base_url()."user/user_didlist/"); |
|
268 | 268 | } |
269 | - }else{ |
|
269 | + } else { |
|
270 | 270 | $this->session->set_flashdata('astpp_notification', 'This DID already purchased by someone.'); |
271 | - redirect(base_url() . "user/user_didlist/"); |
|
271 | + redirect(base_url()."user/user_didlist/"); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | if ($action == "edit") { |
275 | - $add_array=$this->input->post(); |
|
275 | + $add_array = $this->input->post(); |
|
276 | 276 | $data['form'] = $this->form->build_form($this->user_form->build_user_did_form($add_array['free_didlist']), $add_array); |
277 | 277 | if ($this->form_validation->run() == FALSE) { |
278 | 278 | $data['validation_errors'] = validation_errors(); |
@@ -280,27 +280,27 @@ discard block |
||
280 | 280 | exit; |
281 | 281 | } else { |
282 | 282 | $update_arr = array("call_type" => $add_array['call_type'], |
283 | - "extensions" => $add_array['extensions'],"last_modified_date"=>gmdate("Y-m-d H:i:s") |
|
283 | + "extensions" => $add_array['extensions'], "last_modified_date"=>gmdate("Y-m-d H:i:s") |
|
284 | 284 | ); |
285 | 285 | $this->db->update("dids", $update_arr, array("id" => $did_id)); |
286 | - if($accountinfo['reseller_id'] > 0 ){ |
|
286 | + if ($accountinfo['reseller_id'] > 0) { |
|
287 | 287 | |
288 | - $this->db->update('reseller_pricing',$update_arr,array('note'=>$did_arr['number'])); |
|
288 | + $this->db->update('reseller_pricing', $update_arr, array('note'=>$did_arr['number'])); |
|
289 | 289 | } |
290 | - echo json_encode(array("SUCCESS" => $did_arr['number'] . " DID Updated Successfully!")); |
|
290 | + echo json_encode(array("SUCCESS" => $did_arr['number']." DID Updated Successfully!")); |
|
291 | 291 | exit; |
292 | 292 | } |
293 | 293 | $this->load->view('view_user_did_edit', $data); |
294 | 294 | } |
295 | 295 | if ($action == "delete") { |
296 | - $this->db->update("dids", array("accountid" =>0,"assign_date" =>"0000-00-00 00:00:00" , 'charge_upto'=>"0000-00-00 00:00:00"),array("id" => $did_id)); |
|
297 | - $this->common->mail_to_users('email_remove_did', $account_arr,"",$did_arr['number']); |
|
296 | + $this->db->update("dids", array("accountid" =>0, "assign_date" =>"0000-00-00 00:00:00", 'charge_upto'=>"0000-00-00 00:00:00"), array("id" => $did_id)); |
|
297 | + $this->common->mail_to_users('email_remove_did', $account_arr, "", $did_arr['number']); |
|
298 | 298 | $this->session->set_flashdata('astpp_notification', 'DID Removed Successfully.'); |
299 | - redirect(base_url() . "user/user_didlist/"); |
|
299 | + redirect(base_url()."user/user_didlist/"); |
|
300 | 300 | } |
301 | - }else{ |
|
301 | + } else { |
|
302 | 302 | $this->session->set_flashdata('astpp_notification', 'DID not found.'); |
303 | - redirect(base_url() . "user/user_didlist/"); |
|
303 | + redirect(base_url()."user/user_didlist/"); |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
@@ -326,13 +326,13 @@ discard block |
||
326 | 326 | $query = $this->user_model->get_user_rates_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
327 | 327 | $grid_fields = json_decode($this->user_form->user_rates_list()); |
328 | 328 | foreach ($query->result_array() as $key => $value) { |
329 | - $cost=$account_data['type']!=3 ? ($value['cost'] + (($value['cost']*$markup)/100)) : $value['cost']; |
|
329 | + $cost = $account_data['type'] != 3 ? ($value['cost'] + (($value['cost'] * $markup) / 100)) : $value['cost']; |
|
330 | 330 | $json_data['rows'][] = array('cell' => array( |
331 | - $this->common->get_only_numeric_val("","",$value["pattern"]), |
|
331 | + $this->common->get_only_numeric_val("", "", $value["pattern"]), |
|
332 | 332 | $value['comment'], |
333 | - $this->common_model->calculate_currency($value['connectcost'],'','',true,false), |
|
333 | + $this->common_model->calculate_currency($value['connectcost'], '', '', true, false), |
|
334 | 334 | $value['includedseconds'], |
335 | - $this->common_model->calculate_currency(($cost),'','',true,false), |
|
335 | + $this->common_model->calculate_currency(($cost), '', '', true, false), |
|
336 | 336 | $value['init_inc'], |
337 | 337 | $value['inc'] |
338 | 338 | )); |
@@ -346,22 +346,22 @@ discard block |
||
346 | 346 | if ($this->input->post('advance_search', TRUE) == 1) { |
347 | 347 | $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
348 | 348 | $action = $this->input->post(); |
349 | - unset($action['action'],$action['advance_search']); |
|
349 | + unset($action['action'], $action['advance_search']); |
|
350 | 350 | if (isset($action['connectcost']['connectcost']) && $action['connectcost']['connectcost'] != '') { |
351 | 351 | $action['connectcost']['connectcost'] = $this->common_model->add_calculate_currency($action['connectcost']['connectcost'], "", '', true, false); |
352 | 352 | } |
353 | 353 | if (isset($action['cost']['cost']) && $action['cost']['cost'] != '') { |
354 | 354 | $account_data = $this->session->userdata("accountinfo"); |
355 | 355 | $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
356 | - $markup = ($markup > 0)?$markup:1; |
|
356 | + $markup = ($markup > 0) ? $markup : 1; |
|
357 | 357 | $action['cost']['cost'] = $this->common_model->add_calculate_currency($action['cost']['cost'], "", '', true, false); |
358 | - if($account_data['type']!=3) |
|
359 | - $action['cost']['cost']=($action['cost']['cost'] - ($action['cost']['cost']*$markup)/100); |
|
358 | + if ($account_data['type'] != 3) |
|
359 | + $action['cost']['cost'] = ($action['cost']['cost'] - ($action['cost']['cost'] * $markup) / 100); |
|
360 | 360 | } |
361 | 361 | $this->session->set_userdata('user_rates_list_search', $action); |
362 | 362 | } |
363 | 363 | if ($ajax_search != 1) { |
364 | - redirect(base_url() . 'user/user_rates_list/'); |
|
364 | + redirect(base_url().'user/user_rates_list/'); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
@@ -371,34 +371,34 @@ discard block |
||
371 | 371 | } |
372 | 372 | |
373 | 373 | function user_rates_list_export() { |
374 | - $account_data=$this->session->userdata('accountinfo'); |
|
375 | - $currency_id=$account_data['currency_id']; |
|
376 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
374 | + $account_data = $this->session->userdata('accountinfo'); |
|
375 | + $currency_id = $account_data['currency_id']; |
|
376 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
377 | 377 | $query = $this->user_model->get_user_rates_list(true, '', '', false); |
378 | 378 | $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
379 | 379 | ob_clean(); |
380 | - $inbound_array[] = array("Code", "Destination","Connect Cost($currency)","Included Seconds","Per Minute Cost($currency)","Initital Increment","Increment"); |
|
380 | + $inbound_array[] = array("Code", "Destination", "Connect Cost($currency)", "Included Seconds", "Per Minute Cost($currency)", "Initital Increment", "Increment"); |
|
381 | 381 | if ($query->num_rows() > 0) { |
382 | 382 | foreach ($query->result_array() as $row) { |
383 | - $cost=$account_data['type']!=3 ? ($row['cost'] + ($row['cost']*$markup)/100) :$row['cost']; |
|
383 | + $cost = $account_data['type'] != 3 ? ($row['cost'] + ($row['cost'] * $markup) / 100) : $row['cost']; |
|
384 | 384 | $inbound_array[] = array( |
385 | - $row['pattern']=$this->common->get_only_numeric_val("","",$row["pattern"]), |
|
385 | + $row['pattern'] = $this->common->get_only_numeric_val("", "", $row["pattern"]), |
|
386 | 386 | $row['comment'], |
387 | - $this->common_model->calculate_currency($row['connectcost'],'','',true,false), |
|
387 | + $this->common_model->calculate_currency($row['connectcost'], '', '', true, false), |
|
388 | 388 | $row['includedseconds'], |
389 | - $this->common_model->calculate_currency($cost,'','',true,false), |
|
389 | + $this->common_model->calculate_currency($cost, '', '', true, false), |
|
390 | 390 | $row['init_inc'], |
391 | 391 | $row['inc'] |
392 | 392 | ); |
393 | 393 | } |
394 | 394 | } |
395 | 395 | $this->load->helper('csv'); |
396 | - array_to_csv($inbound_array, 'Rates_' . date("Y-m-d") . '.csv'); |
|
396 | + array_to_csv($inbound_array, 'Rates_'.date("Y-m-d").'.csv'); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | function user_refill($action = "") { |
400 | 400 | if (common_model::$global_config['system_config']['paypal_status'] == 1) { |
401 | - redirect(base_url() . 'user/user/'); |
|
401 | + redirect(base_url().'user/user/'); |
|
402 | 402 | } |
403 | 403 | $this->load->module("user/refill"); |
404 | 404 | if ($action == "GET_AMT") { |
@@ -440,14 +440,14 @@ discard block |
||
440 | 440 | $this->load->model('user_model'); |
441 | 441 | $this->user_model->change_db_password($update, $id); |
442 | 442 | $this->session->set_flashdata('astpp_errormsg', "Password changed Sucessfully....!!!"); |
443 | - redirect(base_url() . 'user/user/changepassword/'); |
|
443 | + redirect(base_url().'user/user/changepassword/'); |
|
444 | 444 | } else { |
445 | 445 | $this->session->set_flashdata('astpp_notification', "New Password & Conformpassword not match."); |
446 | - redirect(base_url() . 'user/user/changepassword/'); |
|
446 | + redirect(base_url().'user/user/changepassword/'); |
|
447 | 447 | } |
448 | 448 | } else { |
449 | 449 | $this->session->set_flashdata('astpp_notification', "Invalid old passwword."); |
450 | - redirect(base_url() . 'user/user/changepassword/'); |
|
450 | + redirect(base_url().'user/user/changepassword/'); |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $acc_data = $this->session->userdata("accountinfo"); |
474 | 474 | $reseller_id = $acc_data['reseller_id']; |
475 | 475 | |
476 | - $drp_data = $this->db->query("SELECT id,CONCAT(number,'(',amount,')') as details,number FROM refill_coupon WHERE status = '0' and reseller_id='" . $reseller_id . "'"); |
|
476 | + $drp_data = $this->db->query("SELECT id,CONCAT(number,'(',amount,')') as details,number FROM refill_coupon WHERE status = '0' and reseller_id='".$reseller_id."'"); |
|
477 | 477 | $reseller_data = array(); |
478 | 478 | $data['refill_coupon_list'] = form_dropdown_all('refill_coupon_list', $reseller_data, ''); |
479 | 479 | $this->load->view('view_refill_coupon_list', $data); |
@@ -503,11 +503,11 @@ discard block |
||
503 | 503 | echo json_encode(2); |
504 | 504 | } else { |
505 | 505 | $this->db->select('balance'); |
506 | - $result = (array)$this->db->get_where('accounts',array('id'=>$customer_id))->first_row(); |
|
507 | - $user_balance=$this->db_model->get_available_bal($accountinfo); |
|
508 | - $original_balance=$refill_coupon_result['amount']; |
|
509 | - $refill_coupon_result['amount'] = $this->common_model->to_calculate_currency($original_balance,'','',TRUE,TRUE); |
|
510 | - $refill_coupon_result['new_balance'] = $this->common_model->to_calculate_currency($user_balance+$original_balance,'','',TRUE,TRUE); |
|
506 | + $result = (array)$this->db->get_where('accounts', array('id'=>$customer_id))->first_row(); |
|
507 | + $user_balance = $this->db_model->get_available_bal($accountinfo); |
|
508 | + $original_balance = $refill_coupon_result['amount']; |
|
509 | + $refill_coupon_result['amount'] = $this->common_model->to_calculate_currency($original_balance, '', '', TRUE, TRUE); |
|
510 | + $refill_coupon_result['new_balance'] = $this->common_model->to_calculate_currency($user_balance + $original_balance, '', '', TRUE, TRUE); |
|
511 | 511 | echo json_encode($refill_coupon_result); |
512 | 512 | } |
513 | 513 | } else { |
@@ -541,10 +541,10 @@ discard block |
||
541 | 541 | $this->db->where('number', $refill_coupon_no); |
542 | 542 | $refill_coupon_data = array('status' => 2, "account_id" => $customer_id, 'firstused' => $date); |
543 | 543 | $this->db->update('refill_coupon', $refill_coupon_data); |
544 | - $payment_arr = array("accountid" => $customer_id, 'type' => 'refill_coupon', 'credit' => $amount, 'payment_by' => $reseller_id, 'payment_date' => $date, 'refill_coupon_number' => $refill_coupon_no, 'notes' => 'Recharge using Refill coupon,Refill coupon No. ' . $refill_coupon_no . ''); |
|
544 | + $payment_arr = array("accountid" => $customer_id, 'type' => 'refill_coupon', 'credit' => $amount, 'payment_by' => $reseller_id, 'payment_date' => $date, 'refill_coupon_number' => $refill_coupon_no, 'notes' => 'Recharge using Refill coupon,Refill coupon No. '.$refill_coupon_no.''); |
|
545 | 545 | $this->db->insert('payments', $payment_arr); |
546 | 546 | } |
547 | - redirect(base_url() . "user/user_refill_coupon_list/"); |
|
547 | + redirect(base_url()."user/user_refill_coupon_list/"); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | function user_packages() { |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | |
556 | 556 | function user_packages_json() { |
557 | 557 | $json_data = array(); |
558 | - $count_all = $this->user_model->get_user_packages_list(false,'',''); |
|
558 | + $count_all = $this->user_model->get_user_packages_list(false, '', ''); |
|
559 | 559 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
560 | 560 | $json_data = $paging_data["json_paging"]; |
561 | 561 | $query = $this->user_model->get_user_packages_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
@@ -598,19 +598,19 @@ discard block |
||
598 | 598 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
599 | 599 | echo json_encode($json_data); |
600 | 600 | } |
601 | - function user_emails_search(){ |
|
601 | + function user_emails_search() { |
|
602 | 602 | $ajax_search = $this->input->post('ajax_search', 0); |
603 | 603 | if ($this->input->post('advance_search', TRUE) == 1) { |
604 | 604 | $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
605 | 605 | $action = $this->input->post(); |
606 | - unset($action['action'],$action['advance_search']); |
|
606 | + unset($action['action'], $action['advance_search']); |
|
607 | 607 | $this->session->set_userdata('user_emails_search', $action); |
608 | 608 | } |
609 | 609 | if (@$ajax_search != 1) { |
610 | - redirect(base_url() . 'user/user_emails/'); |
|
610 | + redirect(base_url().'user/user_emails/'); |
|
611 | 611 | } |
612 | 612 | } |
613 | - function user_emails_clearsearchfilter(){ |
|
613 | + function user_emails_clearsearchfilter() { |
|
614 | 614 | $this->session->set_userdata('advance_search', 0); |
615 | 615 | $this->session->set_userdata('user_emails_search', ""); |
616 | 616 | } |
@@ -622,30 +622,30 @@ discard block |
||
622 | 622 | if (isset($add_array['submit'])) { |
623 | 623 | if ($_FILES['file']['name'] == '') { |
624 | 624 | $invoiceconf = $this->user_model->get_invoiceconf(); |
625 | - $file_name=($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : ''; |
|
625 | + $file_name = ($invoiceconf['logo'] != '') ? $invoiceconf['logo'] : ''; |
|
626 | 626 | } |
627 | 627 | if (isset($_FILES['file']['name']) && $_FILES['file']['name'] != '') { |
628 | 628 | $files = $_FILES['file']; |
629 | 629 | if ($files['size'] < 0) { |
630 | 630 | $this->session->set_flashdata('astpp_notification', 'PLease upload maximum file'); |
631 | - redirect(base_url() . "accounts/reseller_invoice_config/". $add_array['accountid']."/"); |
|
631 | + redirect(base_url()."accounts/reseller_invoice_config/".$add_array['accountid']."/"); |
|
632 | 632 | } |
633 | 633 | $file = $_FILES['file']; |
634 | 634 | $uploadedFile = $file["tmp_name"]; |
635 | 635 | $file_name = $file['name']; |
636 | 636 | $file_type = $file['type']; |
637 | 637 | if ($file_type == 'image/jpg' || $file_type == 'image/png' || $file_type == 'image/jpeg') { |
638 | - $dir_path = FCPATH. "upload/"; |
|
639 | - $path = $dir_path . $add_array['accountid']."_".$file['name']; |
|
638 | + $dir_path = FCPATH."upload/"; |
|
639 | + $path = $dir_path.$add_array['accountid']."_".$file['name']; |
|
640 | 640 | if (move_uploaded_file($uploadedFile, $path)) { |
641 | 641 | $this->session->set_flashdata('astpp_errormsg', gettext('files added successfully!')); |
642 | 642 | } else { |
643 | 643 | $this->session->set_flashdata('astpp_notification', "File Uploading Fail Please Try Again"); |
644 | - redirect(base_url() . 'user/user_invoice_config/'); |
|
644 | + redirect(base_url().'user/user_invoice_config/'); |
|
645 | 645 | } |
646 | 646 | } else { |
647 | 647 | $this->session->set_flashdata('astpp_notification', 'Please upload only image!'); |
648 | - redirect(base_url() . 'user/user_invoice_config/'); |
|
648 | + redirect(base_url().'user/user_invoice_config/'); |
|
649 | 649 | } |
650 | 650 | } |
651 | 651 | $add_array['logo'] = $file_name; |
@@ -657,24 +657,24 @@ discard block |
||
657 | 657 | $this->user_model->edit_invoice_config($add_array, $add_array['id']); |
658 | 658 | } |
659 | 659 | $this->session->set_flashdata('astpp_errormsg', 'Invoice config updated successfully!'); |
660 | - redirect(base_url() . 'user/user_invoice_config/'); |
|
660 | + redirect(base_url().'user/user_invoice_config/'); |
|
661 | 661 | } else { |
662 | - $data["account_data"] =(array)$this->db->get_where('invoice_conf',array("accountid"=>$accountinfo['id']))->first_row(); |
|
663 | - if(isset($data["account_data"]['logo'])){ |
|
664 | - $data["account_data"]['file']=$accountinfo['id']."_".$data["account_data"]['logo']; |
|
662 | + $data["account_data"] = (array)$this->db->get_where('invoice_conf', array("accountid"=>$accountinfo['id']))->first_row(); |
|
663 | + if (isset($data["account_data"]['logo'])) { |
|
664 | + $data["account_data"]['file'] = $accountinfo['id']."_".$data["account_data"]['logo']; |
|
665 | 665 | } |
666 | 666 | $this->load->view('view_user_invoices_config', $data); |
667 | 667 | } |
668 | 668 | } |
669 | 669 | |
670 | - function user_invoice_logo_delete($accountid){ |
|
671 | - $invoiceconf = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid)); |
|
672 | - $result=$invoiceconf->result_array(); |
|
673 | - $logo=$result[0]['logo']; |
|
674 | - $post_arr=array('logo'=>''); |
|
675 | - $where_arr=array('logo'=>$logo); |
|
670 | + function user_invoice_logo_delete($accountid) { |
|
671 | + $invoiceconf = $this->db_model->getSelect("*", "invoice_conf", array("accountid"=> $accountid)); |
|
672 | + $result = $invoiceconf->result_array(); |
|
673 | + $logo = $result[0]['logo']; |
|
674 | + $post_arr = array('logo'=>''); |
|
675 | + $where_arr = array('logo'=>$logo); |
|
676 | 676 | $this->db->where($where_arr); |
677 | - $this->db->update('invoice_conf',$post_arr); |
|
677 | + $this->db->update('invoice_conf', $post_arr); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | function user_myprofile() { |
@@ -693,9 +693,9 @@ discard block |
||
693 | 693 | $result = $this->db->get_where('accounts', array('id' => $add_array['id'])); |
694 | 694 | $result = $result->result_array(); |
695 | 695 | $this->session->set_userdata('accountinfo', $result[0]); |
696 | - $this->session->set_flashdata('astpp_errormsg',' Your profile updated successfully!'); |
|
697 | - redirect(base_url() . 'user/user_myprofile/'); |
|
698 | - }else{ |
|
696 | + $this->session->set_flashdata('astpp_errormsg', ' Your profile updated successfully!'); |
|
697 | + redirect(base_url().'user/user_myprofile/'); |
|
698 | + } else { |
|
699 | 699 | $this->session->set_flashdata('astpp_notification', 'Something wrong.Please contact to administrator.'); |
700 | 700 | } |
701 | 701 | } |
@@ -717,35 +717,35 @@ discard block |
||
717 | 717 | $accountinfo = $this->session->userdata("accountinfo"); |
718 | 718 | $data['page_title'] = "Change Password"; |
719 | 719 | $add_array = $this->input->post(); |
720 | - if(!empty($add_array)) { |
|
720 | + if ( ! empty($add_array)) { |
|
721 | 721 | $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(), $add_array); |
722 | 722 | if ($this->form_validation->run() == FALSE) { |
723 | 723 | $data['validation_errors'] = validation_errors(); |
724 | 724 | } else { |
725 | 725 | $password_encode = $this->common->encode($add_array['new_password']); |
726 | 726 | $data = array('password' => $password_encode); |
727 | - $this->db->where('id',$add_array['id']); |
|
727 | + $this->db->where('id', $add_array['id']); |
|
728 | 728 | $this->db->update('accounts', $data); |
729 | 729 | $this->session->set_flashdata('astpp_errormsg', 'Password updated successfully!'); |
730 | - redirect(base_url() . 'user/user_change_password/'); |
|
730 | + redirect(base_url().'user/user_change_password/'); |
|
731 | 731 | } |
732 | - }else{ |
|
733 | - $data_array['id']=$accountinfo['id']; |
|
734 | - $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(),$data_array); |
|
732 | + } else { |
|
733 | + $data_array['id'] = $accountinfo['id']; |
|
734 | + $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(), $data_array); |
|
735 | 735 | } |
736 | 736 | $this->load->view('view_user_change_password', $data); |
737 | 737 | } |
738 | 738 | |
739 | 739 | function user_refill_report() { |
740 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
740 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
741 | 741 | $data['page_title'] = 'Refill Report'; |
742 | 742 | $data['search_flag'] = true; |
743 | 743 | $this->session->set_userdata('advance_search', 0); |
744 | 744 | $data['grid_fields'] = $this->user_form->build_user_refill_report(); |
745 | 745 | $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_refill_report_search()); |
746 | - if($accountinfo['type'] == 1){ |
|
746 | + if ($accountinfo['type'] == 1) { |
|
747 | 747 | $this->load->view('view_reseller_refill_report', $data); |
748 | - }else{ |
|
748 | + } else { |
|
749 | 749 | $this->load->view('view_user_refill_report', $data); |
750 | 750 | } |
751 | 751 | } |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | function user_refill_report_json() { |
754 | 754 | $json_data = array(); |
755 | 755 | $count_all = $this->user_model->get_user_refill_list(false); |
756 | - $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'], $_GET['page']); |
|
756 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
757 | 757 | $json_data = $paging_data["json_paging"]; |
758 | 758 | $query = $this->user_model->get_user_refill_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
759 | 759 | $grid_fields = json_decode($this->user_form->build_user_refill_report()); |
@@ -766,14 +766,14 @@ discard block |
||
766 | 766 | if ($this->input->post('advance_search', TRUE) == 1) { |
767 | 767 | $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
768 | 768 | $action = $this->input->post(); |
769 | - unset($action['action'],$action['advance_search']); |
|
769 | + unset($action['action'], $action['advance_search']); |
|
770 | 770 | if (isset($action['credit']['credit']) && $action['credit']['credit'] != '') { |
771 | 771 | $action['credit']['credit'] = $this->common_model->add_calculate_currency($action['credit']['credit'], "", '', true, false); |
772 | 772 | } |
773 | 773 | $this->session->set_userdata('user_refill_report_search', $action); |
774 | 774 | } |
775 | 775 | if (@$ajax_search != 1) { |
776 | - redirect(base_url() . 'user/user_refill_report/'); |
|
776 | + redirect(base_url().'user/user_refill_report/'); |
|
777 | 777 | } |
778 | 778 | } |
779 | 779 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | $count_all = $this->user_model->get_user_invoice_list(false, '', '', $where); |
797 | 797 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
798 | 798 | $json_data = $paging_data["json_paging"]; |
799 | - $user_currency=$this->common->get_field_name('currency','currency',$accountinfo['currency_id']); |
|
799 | + $user_currency = $this->common->get_field_name('currency', 'currency', $accountinfo['currency_id']); |
|
800 | 800 | $invoices_query = $this->user_model->get_user_invoice_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $where); |
801 | 801 | $invoices_result = $invoices_query->result_array(); |
802 | 802 | $ountstanding_value = 0; |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | $total_credit = (array)$invoice_details_result->first_row(); |
808 | 808 | $total_credit = $total_credit['total_credit']; |
809 | 809 | foreach ($invoices_result as $key => $value) { |
810 | - $total_amount+=$value['amount']; |
|
810 | + $total_amount += $value['amount']; |
|
811 | 811 | $invoice_date = date("Y-m-d", strtotime($value['invoice_date'])); |
812 | 812 | $from_date = date("Y-m-d", strtotime($value['from_date'])); |
813 | 813 | $due_date = date("Y-m-d", strtotime($value['due_date'])); |
@@ -822,23 +822,23 @@ discard block |
||
822 | 822 | if ($invoice_total_query->num_rows() > 0) { |
823 | 823 | $invoice_total_result = $invoice_total_query->result_array(); |
824 | 824 | } |
825 | - $download = '<a href="' . base_url() . '/user/user_invoice_download/' . $value['id'] . '/00' . $value['invoice_prefix'] . $value['invoiceid'] . '" class="btn btn-royelblue btn-sm" title="Download Invoice" ><i class="fa fa-cloud-download fa-fw"></i></a> '; |
|
826 | - if($value['type'] == 'I'){ |
|
825 | + $download = '<a href="'.base_url().'/user/user_invoice_download/'.$value['id'].'/00'.$value['invoice_prefix'].$value['invoiceid'].'" class="btn btn-royelblue btn-sm" title="Download Invoice" ><i class="fa fa-cloud-download fa-fw"></i></a> '; |
|
826 | + if ($value['type'] == 'I') { |
|
827 | 827 | if ($outstanding > 0) { |
828 | - $payment = ' <a style="padding: 0 8px;" href="' . base_url() . 'user/user_invoice_payment/' . $value['id'] . '" class="btn btn-warning" title="Payment">Unpaid</a>'; |
|
828 | + $payment = ' <a style="padding: 0 8px;" href="'.base_url().'user/user_invoice_payment/'.$value['id'].'" class="btn btn-warning" title="Payment">Unpaid</a>'; |
|
829 | 829 | } else { |
830 | 830 | $payment = ' <button style="padding: 0 8px;" class="btn btn-success" type="button">Paid</button>'; |
831 | 831 | } |
832 | - }else{ |
|
832 | + } else { |
|
833 | 833 | $payment = ''; |
834 | 834 | } |
835 | - if($value['generate_type'] == 1){ |
|
836 | - $invoice_type='Manually'; |
|
837 | - }else{ |
|
838 | - $invoice_type='Automatically'; |
|
835 | + if ($value['generate_type'] == 1) { |
|
836 | + $invoice_type = 'Manually'; |
|
837 | + } else { |
|
838 | + $invoice_type = 'Automatically'; |
|
839 | 839 | } |
840 | 840 | |
841 | - if($value['type'] == 'R'){ |
|
841 | + if ($value['type'] == 'R') { |
|
842 | 842 | $icon = '<div class="flx_font flx_magenta">R</div>'; |
843 | 843 | } |
844 | 844 | else |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | $payment_last, |
857 | 857 | $this->common->currency_decimal($this->common_model->calculate_currency($value['amount'])), |
858 | 858 | $this->common->currency_decimal($this->common_model->calculate_currency($outstanding)), |
859 | - $download . $payment, |
|
859 | + $download.$payment, |
|
860 | 860 | )); |
861 | 861 | $ountstanding_value = $ountstanding_value + $outstanding; |
862 | 862 | } |
@@ -871,13 +871,13 @@ discard block |
||
871 | 871 | print_r($action); |
872 | 872 | unset($action['action']); |
873 | 873 | unset($action['advance_search']); |
874 | - $action['from_date'][0] = $action['from_date'][0] ? $action['from_date'][0] . " 00:00:00" : ''; |
|
875 | - $action['to_date'][1] = $action['to_date'][1] ? $action['to_date'][1] . " 23:59:59" : ''; |
|
876 | - $action['invoice_date'][0] = $action['invoice_date'][0] ? $action['invoice_date'][0] . " 00:00:00" : ''; |
|
874 | + $action['from_date'][0] = $action['from_date'][0] ? $action['from_date'][0]." 00:00:00" : ''; |
|
875 | + $action['to_date'][1] = $action['to_date'][1] ? $action['to_date'][1]." 23:59:59" : ''; |
|
876 | + $action['invoice_date'][0] = $action['invoice_date'][0] ? $action['invoice_date'][0]." 00:00:00" : ''; |
|
877 | 877 | $this->session->set_userdata('user_invoice_list_search', $action); |
878 | 878 | } |
879 | 879 | if (@$ajax_search != 1) { |
880 | - redirect(base_url() . 'user/user_invoice_list/'); |
|
880 | + redirect(base_url().'user/user_invoice_list/'); |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | |
@@ -890,25 +890,25 @@ discard block |
||
890 | 890 | $this->load->module('invoices/invoices'); |
891 | 891 | $this->invoices->invoice_main_download($invoiceid); |
892 | 892 | } |
893 | - function user_list_responce(){ |
|
893 | + function user_list_responce() { |
|
894 | 894 | $this->load->module('invoices/invoices'); |
895 | 895 | $this->invoices->invoice_list_responce(); |
896 | 896 | } |
897 | - function user_invoice_payment($invoiceid){ |
|
897 | + function user_invoice_payment($invoiceid) { |
|
898 | 898 | $this->load->module('invoices/invoices'); |
899 | 899 | $this->invoices->invoice_summary($invoiceid); |
900 | 900 | } |
901 | - function user_invoice_payment_pay($action=""){ |
|
901 | + function user_invoice_payment_pay($action = "") { |
|
902 | 902 | $this->load->module("user/payment"); |
903 | - if($action=="GET_AMT"){ |
|
904 | - $amount = $this->input->post("value",true); |
|
905 | - $amount = $this->common_model->add_calculate_currency($amount,"","",true,false); |
|
906 | - echo number_format($amount,2); |
|
907 | - }else{ |
|
903 | + if ($action == "GET_AMT") { |
|
904 | + $amount = $this->input->post("value", true); |
|
905 | + $amount = $this->common_model->add_calculate_currency($amount, "", "", true, false); |
|
906 | + echo number_format($amount, 2); |
|
907 | + } else { |
|
908 | 908 | $this->payment->index(); |
909 | 909 | } |
910 | 910 | } |
911 | - function user_invoice_download($invoiceid){ |
|
911 | + function user_invoice_download($invoiceid) { |
|
912 | 912 | $this->load->module('invoices/invoices'); |
913 | 913 | $this->invoices->invoice_download($invoiceid); |
914 | 914 | } |
@@ -927,43 +927,43 @@ discard block |
||
927 | 927 | $json_data = $paging_data["json_paging"]; |
928 | 928 | $query = $this->user_model->get_user_charge_history(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
929 | 929 | |
930 | - $result= $query->result_array(); |
|
931 | - $query1 = $this->user_model->get_user_charge_history(true,'',''); |
|
932 | - $res= $query1->result_array(); |
|
933 | - $debit=0; |
|
934 | - $credit=0; |
|
935 | - $before_balance=0; |
|
936 | - $after_balance=0; |
|
937 | - $i=0; |
|
930 | + $result = $query->result_array(); |
|
931 | + $query1 = $this->user_model->get_user_charge_history(true, '', ''); |
|
932 | + $res = $query1->result_array(); |
|
933 | + $debit = 0; |
|
934 | + $credit = 0; |
|
935 | + $before_balance = 0; |
|
936 | + $after_balance = 0; |
|
937 | + $i = 0; |
|
938 | 938 | foreach ($result as $key => $value) { |
939 | - $date=$this->common->convert_GMT_to('','',$value['created_date']); |
|
939 | + $date = $this->common->convert_GMT_to('', '', $value['created_date']); |
|
940 | 940 | $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
941 | - $invoice_prefix= $entity_type =$this->common->get_field_name('invoice_prefix','invoices',array('id'=>$value['invoiceid'])); |
|
942 | - $invoiceid= $entity_type =$this->common->get_field_name('invoiceid','invoices',array('id'=>$value['invoiceid'])); |
|
943 | - $invoice_num=$invoice_prefix.$invoiceid; |
|
944 | - $account=$this->common->get_field_name_coma_new('first_name,last_name,number','accounts',$value['accountid']); |
|
945 | - $reseller=$this->common->reseller_select_value('first_name,last_name,number','accounts',$value['reseller_id']); |
|
946 | - $item_type=$value['item_type']; |
|
947 | - if($value['before_balance'] == '-'){ |
|
948 | - $before_balance='-'; |
|
949 | - }else{ |
|
950 | - $before_balance=$this->common->convert_to_currency('','',$value['before_balance']); |
|
941 | + $invoice_prefix = $entity_type = $this->common->get_field_name('invoice_prefix', 'invoices', array('id'=>$value['invoiceid'])); |
|
942 | + $invoiceid = $entity_type = $this->common->get_field_name('invoiceid', 'invoices', array('id'=>$value['invoiceid'])); |
|
943 | + $invoice_num = $invoice_prefix.$invoiceid; |
|
944 | + $account = $this->common->get_field_name_coma_new('first_name,last_name,number', 'accounts', $value['accountid']); |
|
945 | + $reseller = $this->common->reseller_select_value('first_name,last_name,number', 'accounts', $value['reseller_id']); |
|
946 | + $item_type = $value['item_type']; |
|
947 | + if ($value['before_balance'] == '-') { |
|
948 | + $before_balance = '-'; |
|
949 | + } else { |
|
950 | + $before_balance = $this->common->convert_to_currency('', '', $value['before_balance']); |
|
951 | 951 | } |
952 | - if($value['debit'] == '-'){ |
|
953 | - $debit='-'; |
|
954 | - }else{ |
|
955 | - $debit=$this->common->convert_to_currency('','',$value['debit']); |
|
952 | + if ($value['debit'] == '-') { |
|
953 | + $debit = '-'; |
|
954 | + } else { |
|
955 | + $debit = $this->common->convert_to_currency('', '', $value['debit']); |
|
956 | 956 | } |
957 | - $credit=$this->common->convert_to_currency('','',$value['credit']); |
|
958 | - if($cust_type == 0 && $value['item_type'] == 'INVPAY'){ |
|
957 | + $credit = $this->common->convert_to_currency('', '', $value['credit']); |
|
958 | + if ($cust_type == 0 && $value['item_type'] == 'INVPAY') { |
|
959 | 959 | $credit = '(-) '.$credit; |
960 | 960 | } |
961 | - if($value['after_balance'] == '-'){ |
|
962 | - $after_balance='-'; |
|
963 | - }else{ |
|
964 | - $after_balance=$this->common->convert_to_currency('','',$value['after_balance']); |
|
961 | + if ($value['after_balance'] == '-') { |
|
962 | + $after_balance = '-'; |
|
963 | + } else { |
|
964 | + $after_balance = $this->common->convert_to_currency('', '', $value['after_balance']); |
|
965 | 965 | } |
966 | - $description=$value['description']; |
|
966 | + $description = $value['description']; |
|
967 | 967 | $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
968 | 968 | $json_data['rows'][] = array('cell' => array( |
969 | 969 | $date, |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | } |
980 | 980 | $debit_sum = 0; |
981 | 981 | $credit_sum = 0; |
982 | - foreach($res as $value){ |
|
982 | + foreach ($res as $value) { |
|
983 | 983 | $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
984 | 984 | $cust_type = $this->common->get_field_name('posttoexternal', 'accounts', $value['accountid']); |
985 | 985 | $debit_sum += $value['debit']; |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | $before_balance += $value['before_balance']; |
988 | 988 | $after_balance += $value['after_balance']; |
989 | 989 | } |
990 | - $json_data['rows'][$count_all]['cell']=array('<b>Total</b>','-','-','-','<b>'.$this->common->convert_to_currency('','',$debit_sum).'</b>','<b>'.$this->common->convert_to_currency('','',$credit_sum).'</b>','-','-'); |
|
990 | + $json_data['rows'][$count_all]['cell'] = array('<b>Total</b>', '-', '-', '-', '<b>'.$this->common->convert_to_currency('', '', $debit_sum).'</b>', '<b>'.$this->common->convert_to_currency('', '', $credit_sum).'</b>', '-', '-'); |
|
991 | 991 | echo json_encode($json_data); |
992 | 992 | |
993 | 993 | |
@@ -999,8 +999,8 @@ discard block |
||
999 | 999 | $action = $this->input->post(); |
1000 | 1000 | unset($action['action']); |
1001 | 1001 | unset($action['advance_search']); |
1002 | - $action['created_date'][0] = $action['created_date'][0] ? $action['created_date'][0] . " 00:00:00" : ''; |
|
1003 | - $action['created_date'][1] = $action['created_date'][1] ? $action['created_date'][1] . " 23:59:59" : ''; |
|
1002 | + $action['created_date'][0] = $action['created_date'][0] ? $action['created_date'][0]." 00:00:00" : ''; |
|
1003 | + $action['created_date'][1] = $action['created_date'][1] ? $action['created_date'][1]." 23:59:59" : ''; |
|
1004 | 1004 | if (isset($action['debit']['debit']) && $action['debit']['debit'] != '') { |
1005 | 1005 | $action['debit']['debit'] = $this->common_model->add_calculate_currency($action['debit']['debit'], "", '', true, false); |
1006 | 1006 | } |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | $this->session->set_userdata('user_charge_history_search', $action); |
1011 | 1011 | } |
1012 | 1012 | if (@$ajax_search != 1) { |
1013 | - redirect(base_url() . 'user/user_charges_history/'); |
|
1013 | + redirect(base_url().'user/user_charges_history/'); |
|
1014 | 1014 | } |
1015 | 1015 | } |
1016 | 1016 | |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | |
1029 | 1029 | function user_subscriptions_json() { |
1030 | 1030 | |
1031 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1031 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1032 | 1032 | $json_data = array(); |
1033 | 1033 | $select = "charge_to_account.id,charges.description,charges.charge,charges.sweep_id"; |
1034 | 1034 | $table = "charges"; |
@@ -1059,14 +1059,14 @@ discard block |
||
1059 | 1059 | if (isset($action['charge']['charge']) && $action['charge']['charge'] != '') { |
1060 | 1060 | $action['charge']['charge'] = $this->common_model->add_calculate_currency($action['charge']['charge'], "", '', true, false); |
1061 | 1061 | } |
1062 | - if(isset($action['sweep_id']) && $action['sweep_id'] != ''){ |
|
1063 | - $action['charges.sweep_id']=$action['sweep_id']; |
|
1062 | + if (isset($action['sweep_id']) && $action['sweep_id'] != '') { |
|
1063 | + $action['charges.sweep_id'] = $action['sweep_id']; |
|
1064 | 1064 | unset($action['sweep_id']); |
1065 | 1065 | } |
1066 | 1066 | $this->session->set_userdata('user_subscription_search', $action); |
1067 | 1067 | } |
1068 | 1068 | if (@$ajax_search != 1) { |
1069 | - redirect(base_url() . 'user/user_subscriptions/'); |
|
1069 | + redirect(base_url().'user/user_subscriptions/'); |
|
1070 | 1070 | } |
1071 | 1071 | } |
1072 | 1072 | |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | function user_didlist() { |
1079 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1079 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1080 | 1080 | $data['page_title'] = 'Purchase DIDs'; |
1081 | 1081 | $data['search_flag'] = true; |
1082 | 1082 | $data['grid_fields'] = $this->user_form->build_user_didlist(); |
@@ -1084,38 +1084,38 @@ discard block |
||
1084 | 1084 | $data["grid_buttons"] = array(); |
1085 | 1085 | $acc_data = $this->session->userdata("accountinfo"); |
1086 | 1086 | $data['accountid'] = $acc_data['id']; |
1087 | - $data['country_id']=$acc_data['country_id']; |
|
1087 | + $data['country_id'] = $acc_data['country_id']; |
|
1088 | 1088 | $result_did_final = array(); |
1089 | - if($accountinfo['reseller_id'] > 0){ |
|
1089 | + if ($accountinfo['reseller_id'] > 0) { |
|
1090 | 1090 | $this->db->select('dids.id, dids.number, reseller_pricing.setup, reseller_pricing.monthlycost'); |
1091 | - $this->db->where('dids.accountid',0); |
|
1092 | - $this->db->where('reseller_pricing.note','dids.number',false); |
|
1093 | - $this->db->where('reseller_pricing.reseller_id',$accountinfo['reseller_id']); |
|
1091 | + $this->db->where('dids.accountid', 0); |
|
1092 | + $this->db->where('reseller_pricing.note', 'dids.number', false); |
|
1093 | + $this->db->where('reseller_pricing.reseller_id', $accountinfo['reseller_id']); |
|
1094 | 1094 | $this->db->from('dids,reseller_pricing'); |
1095 | - }else{ |
|
1096 | - $this->db->where('parent_id',0); |
|
1097 | - $this->db->where('accountid',0); |
|
1095 | + } else { |
|
1096 | + $this->db->where('parent_id', 0); |
|
1097 | + $this->db->where('accountid', 0); |
|
1098 | 1098 | $this->db->select('id,number,setup,monthlycost'); |
1099 | 1099 | $this->db->from('dids'); |
1100 | 1100 | } |
1101 | - $dids_array=(array)$this->db->get()->result_array(); |
|
1102 | - $drp_list=array(); |
|
1103 | - if(!empty($dids_array)){ |
|
1101 | + $dids_array = (array)$this->db->get()->result_array(); |
|
1102 | + $drp_list = array(); |
|
1103 | + if ( ! empty($dids_array)) { |
|
1104 | 1104 | foreach ($dids_array as $drp_value) { |
1105 | - if (!empty($drp_value['monthlycost']) && $drp_value['monthlycost'] != 0) { |
|
1106 | - $did_cost = $this->common_model->to_calculate_currency($drp_value['monthlycost'],'','',true,true); |
|
1105 | + if ( ! empty($drp_value['monthlycost']) && $drp_value['monthlycost'] != 0) { |
|
1106 | + $did_cost = $this->common_model->to_calculate_currency($drp_value['monthlycost'], '', '', true, true); |
|
1107 | 1107 | } else { |
1108 | 1108 | $did_cost = 0; |
1109 | 1109 | } |
1110 | - if (!empty($drp_value['setup']) && $drp_value['setup'] != 0) { |
|
1111 | - $did_setup = $this->common_model->to_calculate_currency($drp_value['setup'],'','',true,true); |
|
1110 | + if ( ! empty($drp_value['setup']) && $drp_value['setup'] != 0) { |
|
1111 | + $did_setup = $this->common_model->to_calculate_currency($drp_value['setup'], '', '', true, true); |
|
1112 | 1112 | } else { |
1113 | 1113 | $did_setup = 0; |
1114 | 1114 | } |
1115 | - $drp_list[$drp_value['id']] = $drp_value['number'] . ' ( Setup : ' . $did_setup . ')' . '( Monthly : ' . $did_cost . ' )'; |
|
1115 | + $drp_list[$drp_value['id']] = $drp_value['number'].' ( Setup : '.$did_setup.')'.'( Monthly : '.$did_cost.' )'; |
|
1116 | 1116 | } |
1117 | 1117 | } |
1118 | - $data['didlist'] = form_dropdown_all(array("name"=>"free_didlist","id"=>"free_didlist","class"=>"did_dropdown"), $drp_list, ''); |
|
1118 | + $data['didlist'] = form_dropdown_all(array("name"=>"free_didlist", "id"=>"free_didlist", "class"=>"did_dropdown"), $drp_list, ''); |
|
1119 | 1119 | $this->load->view('view_user_did_list', $data); |
1120 | 1120 | } |
1121 | 1121 | |
@@ -1155,9 +1155,9 @@ discard block |
||
1155 | 1155 | if ($this->input->post('advance_search', TRUE) == 1) { |
1156 | 1156 | $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
1157 | 1157 | $action = $this->input->post(); |
1158 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1159 | - if($accountinfo['reseller_id'] > 0 && $action['call_type'] > 0){ |
|
1160 | - $action['dids.call_type']=$action['call_type']; |
|
1158 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1159 | + if ($accountinfo['reseller_id'] > 0 && $action['call_type'] > 0) { |
|
1160 | + $action['dids.call_type'] = $action['call_type']; |
|
1161 | 1161 | unset($action['call_type']); |
1162 | 1162 | } |
1163 | 1163 | unset($action['action']); |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | $this->session->set_userdata('user_did_search', $action); |
1166 | 1166 | } |
1167 | 1167 | if (@$ajax_search != 1) { |
1168 | - redirect(base_url() . 'user/user_didlist/'); |
|
1168 | + redirect(base_url().'user/user_didlist/'); |
|
1169 | 1169 | } |
1170 | 1170 | } |
1171 | 1171 | |
@@ -1174,14 +1174,14 @@ discard block |
||
1174 | 1174 | $this->session->set_userdata('user_did_search', ""); |
1175 | 1175 | } |
1176 | 1176 | |
1177 | - function user_ipmap(){ |
|
1177 | + function user_ipmap() { |
|
1178 | 1178 | $this->session->set_userdata('advance_search', 0); |
1179 | 1179 | $data['grid_fields'] = $this->user_form->build_user_ipmap(); |
1180 | 1180 | $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_ipmap_search()); |
1181 | 1181 | $this->load->view('view_user_ipmap_list', $data); |
1182 | 1182 | } |
1183 | 1183 | |
1184 | - function user_ipmap_json(){ |
|
1184 | + function user_ipmap_json() { |
|
1185 | 1185 | $json_data = array(); |
1186 | 1186 | $account_data = $this->session->userdata("accountinfo"); |
1187 | 1187 | $count_all = $this->user_model->user_ipmap_list(false); |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | echo json_encode($json_data); |
1194 | 1194 | } |
1195 | 1195 | |
1196 | - function user_ipmap_search(){ |
|
1196 | + function user_ipmap_search() { |
|
1197 | 1197 | $ajax_search = $this->input->post('ajax_search', 0); |
1198 | 1198 | if ($this->input->post('advance_search', TRUE) == 1) { |
1199 | 1199 | $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
@@ -1203,24 +1203,24 @@ discard block |
||
1203 | 1203 | $this->session->set_userdata('user_ipmap_search', $action); |
1204 | 1204 | } |
1205 | 1205 | if (@$ajax_search != 1) { |
1206 | - redirect(base_url() . 'user/user_ipmap/'); |
|
1206 | + redirect(base_url().'user/user_ipmap/'); |
|
1207 | 1207 | } |
1208 | 1208 | } |
1209 | 1209 | |
1210 | - function user_ipmap_clearsearchfilter(){ |
|
1210 | + function user_ipmap_clearsearchfilter() { |
|
1211 | 1211 | $this->session->set_userdata('advance_search', 0); |
1212 | 1212 | $this->session->set_userdata('user_ipmap_search', ""); |
1213 | 1213 | } |
1214 | 1214 | |
1215 | - function user_ipmap_action($action='delete',$id=false){ |
|
1216 | - $add_array=$this->input->post(); |
|
1217 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1218 | - if($action == 'add'){ |
|
1215 | + function user_ipmap_action($action = 'delete', $id = false) { |
|
1216 | + $add_array = $this->input->post(); |
|
1217 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1218 | + if ($action == 'add') { |
|
1219 | 1219 | $ip = $add_array['ip']; |
1220 | 1220 | if (strpos($ip, '/') !== false) { |
1221 | 1221 | $add_array['ip'] = $add_array['ip']; |
1222 | 1222 | } else { |
1223 | - $add_array['ip'] = $add_array['ip'] . '/32'; |
|
1223 | + $add_array['ip'] = $add_array['ip'].'/32'; |
|
1224 | 1224 | } |
1225 | 1225 | $where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix'])); |
1226 | 1226 | $getdata = $this->db_model->countQuery("*", "ip_map", $where); |
@@ -1241,8 +1241,8 @@ discard block |
||
1241 | 1241 | $this->session->set_flashdata('astpp_errormsg', 'IP Added Sucessfully.'); |
1242 | 1242 | } |
1243 | 1243 | } |
1244 | - if($action =='delete'){ |
|
1245 | - $this->db->delete('ip_map',array('id'=>$id)); |
|
1244 | + if ($action == 'delete') { |
|
1245 | + $this->db->delete('ip_map', array('id'=>$id)); |
|
1246 | 1246 | $this->session->set_flashdata('astpp_notification', 'IP Removed Sucessfully.'); |
1247 | 1247 | } |
1248 | 1248 | redirect(base_url()."user/user_ipmap/"); |
@@ -1263,23 +1263,23 @@ discard block |
||
1263 | 1263 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
1264 | 1264 | $json_data = $paging_data["json_paging"]; |
1265 | 1265 | $devices_result = array(); |
1266 | - $query = $this->user_model->user_sipdevices_list(true,$account_data['id'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1266 | + $query = $this->user_model->user_sipdevices_list(true, $account_data['id'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
1267 | 1267 | foreach ($query as $key => $value) { |
1268 | 1268 | $path_true = base_url().'/assets/images/true.png'; |
1269 | 1269 | $path_false = base_url().'/assets/images/false.png'; |
1270 | - $voicemail_enabled = $value['voicemail_enabled'] == 'true'? '<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">' : '<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">'; |
|
1270 | + $voicemail_enabled = $value['voicemail_enabled'] == 'true' ? '<img src='.$path_true.' style="height:20px;width:20px;" title="Enable">' : '<img src='.$path_false.' style="height:20px;width:20px;" title="Disable">'; |
|
1271 | 1271 | $json_data['rows'][] = array('cell' => array( |
1272 | - '<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value=' .$value['id'].'><lable class="lbl"></lable>', |
|
1272 | + '<input type="checkbox" name="chkAll" id="'.$value['id'].'" class="ace chkRefNos" onclick="clickchkbox('.$value['id'].')" value='.$value['id'].'><lable class="lbl"></lable>', |
|
1273 | 1273 | $value['username'], |
1274 | 1274 | $value['password'], |
1275 | 1275 | $value['effective_caller_id_name'], |
1276 | 1276 | $value['effective_caller_id_number'], |
1277 | - $this->common->get_status('status', 'sip_devices',$value), |
|
1278 | - $this->common->convert_GMT_to('','',$value['creation_date']), |
|
1279 | - $this->common->convert_GMT_to('','',$value['last_modified_date']), |
|
1277 | + $this->common->get_status('status', 'sip_devices', $value), |
|
1278 | + $this->common->convert_GMT_to('', '', $value['creation_date']), |
|
1279 | + $this->common->convert_GMT_to('', '', $value['last_modified_date']), |
|
1280 | 1280 | $voicemail_enabled, |
1281 | - '<a href="'. base_url() .'user/user_sipdevices_edit/' . $value['id'] . '/" class="btn btn-royelblue btn-sm" rel="facebox" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> '. |
|
1282 | - '<a href="'. base_url() .'user/user_sipdevices_delete/' .$value['id']. '/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>' |
|
1281 | + '<a href="'.base_url().'user/user_sipdevices_edit/'.$value['id'].'/" class="btn btn-royelblue btn-sm" rel="facebox" title="Edit"> <i class="fa fa-pencil-square-o fa-fw"></i></a> '. |
|
1282 | + '<a href="'.base_url().'user/user_sipdevices_delete/'.$value['id'].'/" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"> <i class="fa fa-trash fa-fw"></i></a>' |
|
1283 | 1283 | )); |
1284 | 1284 | } |
1285 | 1285 | echo json_encode($json_data); |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | $this->session->set_userdata('user_sipdevices_search', $action); |
1295 | 1295 | } |
1296 | 1296 | if (@$ajax_search != 1) { |
1297 | - redirect(base_url() . 'user/user_sipdevices/'); |
|
1297 | + redirect(base_url().'user/user_sipdevices/'); |
|
1298 | 1298 | } |
1299 | 1299 | } |
1300 | 1300 | |
@@ -1303,12 +1303,12 @@ discard block |
||
1303 | 1303 | $this->session->set_userdata('user_sipdevices_search', ""); |
1304 | 1304 | } |
1305 | 1305 | |
1306 | - function user_sipdevices_add(){ |
|
1306 | + function user_sipdevices_add() { |
|
1307 | 1307 | $data['page_title'] = 'Create SIP Device'; |
1308 | - $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form(),""); |
|
1308 | + $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form(), ""); |
|
1309 | 1309 | $this->load->view('view_user_sipdevices_add_edit', $data); |
1310 | 1310 | } |
1311 | - function user_sipdevices_edit($edit_id=''){ |
|
1311 | + function user_sipdevices_edit($edit_id = '') { |
|
1312 | 1312 | $account_data = $this->session->userdata("accountinfo"); |
1313 | 1313 | $data['page_title'] = 'Edit SIP Device'; |
1314 | 1314 | $where = array('id' => $edit_id); |
@@ -1316,7 +1316,7 @@ discard block |
||
1316 | 1316 | $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form($edit_id), $sipdevice_info); |
1317 | 1317 | $this->load->view('view_user_sipdevices_add_edit', $data); |
1318 | 1318 | } |
1319 | - function user_sipdevices_save(){ |
|
1319 | + function user_sipdevices_save() { |
|
1320 | 1320 | $add_array = $this->input->post(); |
1321 | 1321 | $data['form'] = $this->form->build_form($this->user_form->build_user_sipdevices_form($add_array['id']), $add_array); |
1322 | 1322 | if ($add_array['id'] != '') { |
@@ -1344,15 +1344,15 @@ discard block |
||
1344 | 1344 | } |
1345 | 1345 | } |
1346 | 1346 | function user_sipdevices_delete($id) { |
1347 | - $this->db->delete('sip_devices',array('id'=>$id)); |
|
1347 | + $this->db->delete('sip_devices', array('id'=>$id)); |
|
1348 | 1348 | $this->session->set_flashdata('astpp_notification', 'SIP Device Removed Sucessfully!'); |
1349 | - redirect(base_url() . "user/user_sipdevices/"); |
|
1349 | + redirect(base_url()."user/user_sipdevices/"); |
|
1350 | 1350 | } |
1351 | 1351 | |
1352 | - function user_sipdevices_delete_multiple(){ |
|
1352 | + function user_sipdevices_delete_multiple() { |
|
1353 | 1353 | $ids = $this->input->post("selected_ids", true); |
1354 | 1354 | $where = "id IN ($ids)"; |
1355 | - $this->db->delete("sip_devices",$where); |
|
1355 | + $this->db->delete("sip_devices", $where); |
|
1356 | 1356 | echo TRUE; |
1357 | 1357 | } |
1358 | 1358 | |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | $cnt_result = $cnt_result->result_array(); |
1386 | 1386 | $count = $cnt_result[0]['count']; |
1387 | 1387 | if ($count == 0) { |
1388 | - if($add_array['number'] != ""){ |
|
1388 | + if ($add_array['number'] != "") { |
|
1389 | 1389 | $accountinfo = $this->session->userdata("accountinfo"); |
1390 | 1390 | $insert_arr = array("number" => $add_array['number'], |
1391 | 1391 | "accountid" => $accountinfo['id'], |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | ); |
1394 | 1394 | $this->db->insert("ani_map", $insert_arr); |
1395 | 1395 | $this->session->set_flashdata('astpp_errormsg', 'Add Caller ID Sucessfully!'); |
1396 | - }else{ |
|
1396 | + } else { |
|
1397 | 1397 | $this->session->set_flashdata('astpp_notification', 'Please Enter Caller ID value.'); |
1398 | 1398 | } |
1399 | 1399 | } else { |
@@ -1405,28 +1405,28 @@ discard block |
||
1405 | 1405 | $this->db_model->delete("ani_map", array("id" => $aniid)); |
1406 | 1406 | |
1407 | 1407 | } |
1408 | - redirect(base_url() . "user/user_animap_list/"); |
|
1408 | + redirect(base_url()."user/user_animap_list/"); |
|
1409 | 1409 | } |
1410 | 1410 | |
1411 | 1411 | function user_alert_threshold() { |
1412 | 1412 | $data['page_title'] = 'Alert Threshold'; |
1413 | 1413 | $accountinfo = $this->session->userdata("accountinfo"); |
1414 | 1414 | $add_array = $this->input->post(); |
1415 | - if (!empty($add_array)) { |
|
1416 | - unset($add_array['action'],$add_array['id']); |
|
1415 | + if ( ! empty($add_array)) { |
|
1416 | + unset($add_array['action'], $add_array['id']); |
|
1417 | 1417 | $this->user_model->edit_alert_threshold($add_array, $accountinfo['id']); |
1418 | 1418 | $this->session->set_flashdata('astpp_errormsg', 'Alert Threshold updated successfully!'); |
1419 | - redirect(base_url() . 'user/user_alert_threshold/'); |
|
1419 | + redirect(base_url().'user/user_alert_threshold/'); |
|
1420 | 1420 | } else { |
1421 | 1421 | $where = array('id' => $accountinfo["id"]); |
1422 | 1422 | $account = $this->db_model->getSelect("notify_credit_limit,notify_flag,notify_email", "accounts", $where); |
1423 | - $data['form'] = $this->form->build_form($this->user_form->user_alert_threshold(),(array)$account->first_row()); |
|
1423 | + $data['form'] = $this->form->build_form($this->user_form->user_alert_threshold(), (array)$account->first_row()); |
|
1424 | 1424 | $this->load->view('view_user_alert_threshold', $data); |
1425 | 1425 | } |
1426 | 1426 | } |
1427 | 1427 | |
1428 | 1428 | function user_cdrs_report() { |
1429 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1429 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1430 | 1430 | $data['page_title'] = 'CDRs'; |
1431 | 1431 | $data['search_flag'] = true; |
1432 | 1432 | $data["grid_buttons"] = $this->user_form->build_cdrs_report_buttons(); |
@@ -1436,10 +1436,10 @@ discard block |
||
1436 | 1436 | } |
1437 | 1437 | |
1438 | 1438 | function user_cdrs_report_json() { |
1439 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1440 | - $variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost'; |
|
1439 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1440 | + $variable = $accountinfo['type'] != 3 ? 'total_debit' : 'total_cost'; |
|
1441 | 1441 | $count_res = $this->user_model->getuser_cdrs_list(false, "", ""); |
1442 | - $count_all = (array) $count_res->first_row(); |
|
1442 | + $count_all = (array)$count_res->first_row(); |
|
1443 | 1443 | $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
1444 | 1444 | $json_data = $paging_data["json_paging"]; |
1445 | 1445 | $query = $this->user_model->getuser_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false); |
@@ -1447,16 +1447,16 @@ discard block |
||
1447 | 1447 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
1448 | 1448 | if ($count_all['count'] > 0) { |
1449 | 1449 | $search_arr = $this->session->userdata('user_cdrs_report_search'); |
1450 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1451 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1452 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1450 | + $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1451 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ? |
|
1452 | + floor($count_all['billseconds'] / 60).":".sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1453 | 1453 | $json_data['rows'][] = array("cell" => array( |
1454 | 1454 | "<b>Grand Total</b>", |
1455 | 1455 | "", |
1456 | 1456 | "", |
1457 | 1457 | "", |
1458 | 1458 | $duration, |
1459 | - "<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>", |
|
1459 | + "<b>".$this->common_model->calculate_currency($count_all[$variable], "", "", true, false)."</b>", |
|
1460 | 1460 | "", |
1461 | 1461 | "", |
1462 | 1462 | )); |
@@ -1477,7 +1477,7 @@ discard block |
||
1477 | 1477 | $this->session->set_userdata('user_cdrs_report_search', $action); |
1478 | 1478 | } |
1479 | 1479 | if (@$ajax_search != 1) { |
1480 | - redirect(base_url() . 'user/user_cdrs_report/'); |
|
1480 | + redirect(base_url().'user/user_cdrs_report/'); |
|
1481 | 1481 | } |
1482 | 1482 | } |
1483 | 1483 | |
@@ -1488,20 +1488,20 @@ discard block |
||
1488 | 1488 | |
1489 | 1489 | function user_cdrreport_export() { |
1490 | 1490 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
1491 | - $currency_id=$account_info['currency_id']; |
|
1492 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
1491 | + $currency_id = $account_info['currency_id']; |
|
1492 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
1493 | 1493 | $count_res = $this->user_model->getuser_cdrs_list(false, "", ""); |
1494 | - $count_all = (array) $count_res->first_row(); |
|
1494 | + $count_all = (array)$count_res->first_row(); |
|
1495 | 1495 | ob_clean(); |
1496 | - $customer_array[] = array("Date", "CallerID", "Called Number","Code", "Destination", "Duration", "Debit($currency)", "Disposition", "Call Type"); |
|
1496 | + $customer_array[] = array("Date", "CallerID", "Called Number", "Code", "Destination", "Duration", "Debit($currency)", "Disposition", "Call Type"); |
|
1497 | 1497 | if ($count_all['count'] > 0) { |
1498 | 1498 | $query = $this->user_model->getuser_cdrs_list(true, '', '', true); |
1499 | 1499 | $currency_info = $this->common->get_currency_info(); |
1500 | 1500 | $search_arr = $this->session->userdata('user_cdrs_report_search'); |
1501 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1501 | + $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1502 | 1502 | foreach ($query->result_array() as $value) { |
1503 | - $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
1504 | - floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
1503 | + $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0) ? |
|
1504 | + floor($value['billseconds'] / 60).":".sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
1505 | 1505 | $customer_array[] = array( |
1506 | 1506 | $this->common->convert_GMT_to('', '', $value['callstart']), |
1507 | 1507 | $value['callerid'], |
@@ -1509,13 +1509,13 @@ discard block |
||
1509 | 1509 | filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
1510 | 1510 | $value['notes'], |
1511 | 1511 | $duration, |
1512 | - $this->common->calculate_currency_manually($currency_info, $value['debit'],false), |
|
1512 | + $this->common->calculate_currency_manually($currency_info, $value['debit'], false), |
|
1513 | 1513 | $value['disposition'], |
1514 | 1514 | $value['calltype'] |
1515 | 1515 | ); |
1516 | 1516 | } |
1517 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1518 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1517 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ? |
|
1518 | + floor($count_all['billseconds'] / 60).":".sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1519 | 1519 | $customer_array[] = array("Grand Total", |
1520 | 1520 | "", |
1521 | 1521 | "", |
@@ -1528,26 +1528,26 @@ discard block |
||
1528 | 1528 | ); |
1529 | 1529 | } |
1530 | 1530 | $this->load->helper('csv'); |
1531 | - array_to_csv($customer_array, 'Customer_CDR_' . date("Y-m-d") . '.csv'); |
|
1531 | + array_to_csv($customer_array, 'Customer_CDR_'.date("Y-m-d").'.csv'); |
|
1532 | 1532 | } |
1533 | - function user_payment($action=""){ |
|
1534 | - if(common_model::$global_config['system_config']['paypal_status'] == 1){ |
|
1535 | - redirect(base_url() . 'user/user/'); |
|
1533 | + function user_payment($action = "") { |
|
1534 | + if (common_model::$global_config['system_config']['paypal_status'] == 1) { |
|
1535 | + redirect(base_url().'user/user/'); |
|
1536 | 1536 | } |
1537 | 1537 | $this->load->module("user/payment"); |
1538 | - if($action=="GET_AMT"){ |
|
1539 | - $amount = $this->input->post("value",true); |
|
1538 | + if ($action == "GET_AMT") { |
|
1539 | + $amount = $this->input->post("value", true); |
|
1540 | 1540 | $this->payment->convert_amount($amount); |
1541 | - }else{ |
|
1541 | + } else { |
|
1542 | 1542 | $this->payment->index(); |
1543 | 1543 | } |
1544 | 1544 | } |
1545 | 1545 | |
1546 | - function user_fund_transfer(){ |
|
1546 | + function user_fund_transfer() { |
|
1547 | 1547 | $data['page_title'] = 'Fund Transfer'; |
1548 | 1548 | $accountinfo = $this->session->userdata('accountinfo'); |
1549 | - $account=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
1550 | - $currency = (array)$this->db->get_where('currency',array("id"=>$account['currency_id']))->first_row(); |
|
1549 | + $account = (array)$this->db->get_where('accounts', array("id"=>$accountinfo['id']))->first_row(); |
|
1550 | + $currency = (array)$this->db->get_where('currency', array("id"=>$account['currency_id']))->first_row(); |
|
1551 | 1551 | $data['form'] = $this->form->build_form($this->user_form->build_user_fund_transfer_form($account['number'], $currency['currency'], $accountinfo['id']), ''); |
1552 | 1552 | $this->load->view('view_user_fund_transfer', $data); |
1553 | 1553 | } |
@@ -1556,8 +1556,8 @@ discard block |
||
1556 | 1556 | $data['page_title'] = 'Fund Transfer'; |
1557 | 1557 | $post_array = $this->input->post(); |
1558 | 1558 | $accountinfo = $this->session->userdata('accountinfo'); |
1559 | - $account=(array)$this->db->get_where('accounts',array("id"=>$accountinfo['id']))->first_row(); |
|
1560 | - $currency = (array)$this->db->get_where('currency',array("id"=>$account['currency_id']))->first_row(); |
|
1559 | + $account = (array)$this->db->get_where('accounts', array("id"=>$accountinfo['id']))->first_row(); |
|
1560 | + $currency = (array)$this->db->get_where('currency', array("id"=>$account['currency_id']))->first_row(); |
|
1561 | 1561 | $data['form'] = $this->form->build_form($this->user_form->build_user_fund_transfer_form($account['number'], $currency['currency'], $accountinfo['id']), $post_array); |
1562 | 1562 | if ($this->form_validation->run() == FALSE) { |
1563 | 1563 | $data['validation_errors'] = validation_errors(); |
@@ -1566,11 +1566,11 @@ discard block |
||
1566 | 1566 | $account_info = $this->session->userdata('accountinfo'); |
1567 | 1567 | $balance = $this->common->get_field_name('balance', 'accounts', array('id' => $account_info['id'], 'status' => 0, 'type' => 0, 'deleted' => 0)); |
1568 | 1568 | $toid = $this->common->get_field_name('id', 'accounts', array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0)); |
1569 | - $toaccountinfo=(array)$this->db->get_where('accounts',array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0),1)->first_row(); |
|
1570 | - if($toaccountinfo){ |
|
1569 | + $toaccountinfo = (array)$this->db->get_where('accounts', array('number' => $post_array['toaccountid'], 'status' => 0, 'type' => 0, 'deleted' => 0), 1)->first_row(); |
|
1570 | + if ($toaccountinfo) { |
|
1571 | 1571 | $reseller_id = $toaccountinfo['reseller_id']; |
1572 | 1572 | $post_array['credit'] = $this->common_model->add_calculate_currency($post_array['credit'], '', '', false, false); |
1573 | - $minimum_fund=(array)$this->db->get_where('system',array("name"=>"minimum_fund_transfer"),1)->first_row(); |
|
1573 | + $minimum_fund = (array)$this->db->get_where('system', array("name"=>"minimum_fund_transfer"), 1)->first_row(); |
|
1574 | 1574 | if ($post_array['toaccountid'] == $account_info['number']) { |
1575 | 1575 | $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.'); |
1576 | 1576 | } |
@@ -1586,21 +1586,21 @@ discard block |
||
1586 | 1586 | elseif ($post_array['credit'] > $balance) { |
1587 | 1587 | $this->session->set_flashdata('astpp_notification', 'You have insufficient balance.'); |
1588 | 1588 | } |
1589 | - elseif ($toid <= 0 || !isset($post_array['toaccountid'])) { |
|
1589 | + elseif ($toid <= 0 || ! isset($post_array['toaccountid'])) { |
|
1590 | 1590 | $this->session->set_flashdata('astpp_notification', 'Please enter valid account number.'); |
1591 | 1591 | } |
1592 | 1592 | elseif ($post_array['credit'] < 0) { |
1593 | 1593 | $this->session->set_flashdata('astpp_notification', 'Please enter amount greater then 0.'); |
1594 | 1594 | } |
1595 | 1595 | elseif ($minimum_fund['value'] >= $post_array['credit']) { |
1596 | - $this->session->set_flashdata('astpp_notification', 'You need to enter minimum amount of fund transfer ' . $minimum_fund['value'] . ' .'); |
|
1596 | + $this->session->set_flashdata('astpp_notification', 'You need to enter minimum amount of fund transfer '.$minimum_fund['value'].' .'); |
|
1597 | 1597 | } |
1598 | - elseif (!isset($toid) || !isset($post_array['toaccountid'])) { |
|
1598 | + elseif ( ! isset($toid) || ! isset($post_array['toaccountid'])) { |
|
1599 | 1599 | $this->session->set_flashdata('astpp_notification', 'Please enter valid account number!'); |
1600 | 1600 | } |
1601 | 1601 | elseif ($post_array['credit'] < 0 || $post_array['credit'] > $balance) { |
1602 | 1602 | $this->session->set_flashdata('astpp_notification', 'Insuffiecient amount !'); |
1603 | - }else{ |
|
1603 | + } else { |
|
1604 | 1604 | $from['id'] = $post_array['id']; |
1605 | 1605 | $from['account_currency'] = $post_array['account_currency']; |
1606 | 1606 | $from['accountid'] = $post_array['fromaccountid']; |
@@ -1635,13 +1635,13 @@ discard block |
||
1635 | 1635 | $this->session->set_flashdata('astpp_notification', 'Sorry We are not able to process this request.'); |
1636 | 1636 | } |
1637 | 1637 | } |
1638 | - }else{ |
|
1638 | + } else { |
|
1639 | 1639 | $this->session->set_flashdata('astpp_notification', 'Account number not found.'); |
1640 | 1640 | } |
1641 | 1641 | } else { |
1642 | 1642 | $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.'); |
1643 | 1643 | } |
1644 | - redirect(base_url() . 'user/user_fund_transfer/'); |
|
1644 | + redirect(base_url().'user/user_fund_transfer/'); |
|
1645 | 1645 | } |
1646 | 1646 | $this->load->view('view_user_fund_transfer', $data); |
1647 | 1647 | } |
@@ -1659,7 +1659,7 @@ discard block |
||
1659 | 1659 | $accountinfo = $this->session->userdata("accountinfo"); |
1660 | 1660 | $json_data = array(); |
1661 | 1661 | $count_all = $this->user_model->get_user_opensips(false, $accountinfo['number']); |
1662 | - $paging_data = $this->form->load_grid_config($count_all,$_GET['rp'],$_GET['page']); |
|
1662 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
1663 | 1663 | $json_data = $paging_data["json_paging"]; |
1664 | 1664 | $query = $this->user_model->get_user_opensips(true, $accountinfo['number'], $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
1665 | 1665 | $grid_fields = json_decode($this->user_form->build_user_opensips()); |
@@ -1683,7 +1683,7 @@ discard block |
||
1683 | 1683 | $this->session->set_userdata('user_opensips_search', $action); |
1684 | 1684 | } |
1685 | 1685 | if ($ajax_search != 1) { |
1686 | - redirect(base_url() . 'user/user_opensips/'); |
|
1686 | + redirect(base_url().'user/user_opensips/'); |
|
1687 | 1687 | } |
1688 | 1688 | } |
1689 | 1689 | |
@@ -1696,10 +1696,10 @@ discard block |
||
1696 | 1696 | $this->load->view('view_opensips_add_edit', $data); |
1697 | 1697 | } |
1698 | 1698 | |
1699 | - function user_opensips_edit($edit_id){ |
|
1699 | + function user_opensips_edit($edit_id) { |
|
1700 | 1700 | $data['page_title'] = 'Edit Opensips'; |
1701 | 1701 | $db_config = Common_model::$global_config['system_config']; |
1702 | - $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="; |
|
1702 | + $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="; |
|
1703 | 1703 | $this->opensips_db = $this->load->database($opensipdsn, true); |
1704 | 1704 | $where = array('id' => $edit_id); |
1705 | 1705 | $this->opensips_db->where($where); |
@@ -1712,7 +1712,7 @@ discard block |
||
1712 | 1712 | |
1713 | 1713 | } |
1714 | 1714 | |
1715 | - function user_opensips_save(){ |
|
1715 | + function user_opensips_save() { |
|
1716 | 1716 | $add_array = $this->input->post(); |
1717 | 1717 | $data['form'] = $this->form->build_form($this->user_form->build_user_opensips_form(), $add_array); |
1718 | 1718 | if ($add_array['id'] != '') { |
@@ -1723,11 +1723,11 @@ discard block |
||
1723 | 1723 | exit; |
1724 | 1724 | } else { |
1725 | 1725 | $auth_flag = $this->validate_device_data($add_array); |
1726 | - if($auth_flag == "TRUE"){ |
|
1726 | + if ($auth_flag == "TRUE") { |
|
1727 | 1727 | $this->user_model->user_opensips_edit($add_array, $add_array['id']); |
1728 | 1728 | echo json_encode(array("SUCCESS"=> " OpenSips updated successfully!")); |
1729 | 1729 | exit; |
1730 | - }else{ |
|
1730 | + } else { |
|
1731 | 1731 | echo json_encode($auth_flag); |
1732 | 1732 | exit; |
1733 | 1733 | } |
@@ -1740,48 +1740,48 @@ discard block |
||
1740 | 1740 | exit; |
1741 | 1741 | } else { |
1742 | 1742 | $auth_flag = $this->validate_device_data($add_array); |
1743 | - if($auth_flag == "TRUE"){ |
|
1743 | + if ($auth_flag == "TRUE") { |
|
1744 | 1744 | $this->user_model->user_opensips_add($add_array); |
1745 | 1745 | echo json_encode(array("SUCCESS"=> "OpenSips added successfully!")); |
1746 | 1746 | exit; |
1747 | - }else{ |
|
1747 | + } else { |
|
1748 | 1748 | echo json_encode($auth_flag); |
1749 | 1749 | exit; |
1750 | 1750 | } |
1751 | 1751 | } |
1752 | 1752 | } |
1753 | 1753 | } |
1754 | - function validate_device_data($data){ |
|
1755 | - if(isset($data["username"]) && $data["username"] != ""){ |
|
1754 | + function validate_device_data($data) { |
|
1755 | + if (isset($data["username"]) && $data["username"] != "") { |
|
1756 | 1756 | $db_config = Common_model::$global_config['system_config']; |
1757 | - $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="; |
|
1757 | + $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="; |
|
1758 | 1758 | $this->opensips_db = $this->load->database($opensipdsn, true); |
1759 | 1759 | $where = array("username"=>$data["username"]); |
1760 | - if($data['id'] != ""){ |
|
1761 | - $this->opensips_db->where("id <>",$data['id']); |
|
1760 | + if ($data['id'] != "") { |
|
1761 | + $this->opensips_db->where("id <>", $data['id']); |
|
1762 | 1762 | } |
1763 | 1763 | $this->opensips_db->where($where); |
1764 | 1764 | $auth_flag = $this->opensips_db->get("subscriber"); |
1765 | 1765 | $auth_flag = $auth_flag->num_rows(); |
1766 | - if($auth_flag == 0){ |
|
1766 | + if ($auth_flag == 0) { |
|
1767 | 1767 | return "TRUE"; |
1768 | - }else{ |
|
1768 | + } else { |
|
1769 | 1769 | return array("username_error"=>"Duplicate Username Found.Username Must be Unique"); |
1770 | 1770 | } |
1771 | - }else{ |
|
1771 | + } else { |
|
1772 | 1772 | return array("username_error"=>"User name is required field."); |
1773 | 1773 | } |
1774 | 1774 | return "0"; |
1775 | 1775 | } |
1776 | 1776 | |
1777 | - function user_opensips_delete($id){ |
|
1777 | + function user_opensips_delete($id) { |
|
1778 | 1778 | $this->user_model->user_opensips_delete($id); |
1779 | 1779 | $this->session->set_flashdata('astpp_errormsg', 'Opensips Device Removed Successfully!.'); |
1780 | - redirect(base_url() . "user/user_opensips/"); |
|
1780 | + redirect(base_url()."user/user_opensips/"); |
|
1781 | 1781 | } |
1782 | - function user_opensips_delete_multiple(){ |
|
1782 | + function user_opensips_delete_multiple() { |
|
1783 | 1783 | $db_config = Common_model::$global_config['system_config']; |
1784 | - $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="; |
|
1784 | + $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="; |
|
1785 | 1785 | $this->opensips_db = $this->load->database($opensipdsn, true); |
1786 | 1786 | $ids = $this->input->post("selected_ids", true); |
1787 | 1787 | $where = "id IN ($ids)"; |
@@ -1790,27 +1790,27 @@ discard block |
||
1790 | 1790 | echo TRUE; |
1791 | 1791 | } |
1792 | 1792 | |
1793 | - function user_cdrs(){ |
|
1793 | + function user_cdrs() { |
|
1794 | 1794 | $data['username'] = $this->session->userdata('user_name'); |
1795 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1795 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1796 | 1796 | $data['page_title'] = 'CDRs'; |
1797 | 1797 | $accounttype = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
1798 | 1798 | $this->load->module('reports/reports'); |
1799 | 1799 | $data['grid_fields'] = $this->reports->reports_form->build_report_list_for_user($accounttype); |
1800 | 1800 | $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_opensips_search()); |
1801 | - $data['accounttype']=$accounttype; |
|
1801 | + $data['accounttype'] = $accounttype; |
|
1802 | 1802 | $this->load->view('view_user_cdrs', $data); |
1803 | 1803 | } |
1804 | - function user_cdrs_json(){ |
|
1805 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1804 | + function user_cdrs_json() { |
|
1805 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1806 | 1806 | $accounttype = strtolower($this->common->get_entity_type('', '', $accountinfo['type'])); |
1807 | 1807 | $this->load->module('reports/reports'); |
1808 | 1808 | $this->reports->customer_cdrreport($accountinfo['id'], $accounttype); |
1809 | 1809 | } |
1810 | - function user_details_search($module_name){ |
|
1810 | + function user_details_search($module_name) { |
|
1811 | 1811 | $action = $this->input->post(); |
1812 | - $this->session->set_userdata('left_panel_search_'.$module_name,""); |
|
1813 | - if(!empty($action['left_panel_search'])){ |
|
1812 | + $this->session->set_userdata('left_panel_search_'.$module_name, ""); |
|
1813 | + if ( ! empty($action['left_panel_search'])) { |
|
1814 | 1814 | $this->session->set_userdata('left_panel_search_'.$module_name, $action['left_panel_search']); |
1815 | 1815 | } |
1816 | 1816 | } |
@@ -1822,7 +1822,7 @@ discard block |
||
1822 | 1822 | |
1823 | 1823 | |
1824 | 1824 | function user_provider_cdrs_report() { |
1825 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1825 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1826 | 1826 | $data['page_title'] = 'Provider CDRs Report'; |
1827 | 1827 | $data['search_flag'] = true; |
1828 | 1828 | $data["grid_buttons"] = $this->user_form->build_provider_report_buttons(); |
@@ -1832,10 +1832,10 @@ discard block |
||
1832 | 1832 | } |
1833 | 1833 | |
1834 | 1834 | function user_provider_cdrs_report_json() { |
1835 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1836 | - $variable=$accountinfo['type'] != 3 ?'total_debit':'total_cost'; |
|
1835 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1836 | + $variable = $accountinfo['type'] != 3 ? 'total_debit' : 'total_cost'; |
|
1837 | 1837 | $count_res = $this->user_model->getprovider_cdrs_list(false, "", ""); |
1838 | - $count_all = (array) $count_res->first_row(); |
|
1838 | + $count_all = (array)$count_res->first_row(); |
|
1839 | 1839 | $paging_data = $this->form->load_grid_config($count_all['count'], $_GET['rp'], $_GET['page']); |
1840 | 1840 | $json_data = $paging_data["json_paging"]; |
1841 | 1841 | $query = $this->user_model->getprovider_cdrs_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], false); |
@@ -1843,16 +1843,16 @@ discard block |
||
1843 | 1843 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
1844 | 1844 | if ($count_all['count'] > 0) { |
1845 | 1845 | $search_arr = $this->session->userdata('user_provider_cdrs_report_search'); |
1846 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1847 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1848 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1846 | + $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1847 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ? |
|
1848 | + floor($count_all['billseconds'] / 60).":".sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1849 | 1849 | $json_data['rows'][] = array("cell" => array( |
1850 | 1850 | "<b>Grand Total</b>", |
1851 | 1851 | "", |
1852 | 1852 | "", |
1853 | 1853 | "", |
1854 | 1854 | $duration, |
1855 | - "<b>".$this->common_model->calculate_currency($count_all[$variable],"","",true,false)."</b>", |
|
1855 | + "<b>".$this->common_model->calculate_currency($count_all[$variable], "", "", true, false)."</b>", |
|
1856 | 1856 | "", |
1857 | 1857 | "", |
1858 | 1858 | )); |
@@ -1873,7 +1873,7 @@ discard block |
||
1873 | 1873 | $this->session->set_userdata('user_provider_cdrs_report_search', $action); |
1874 | 1874 | } |
1875 | 1875 | if ($ajax_search != 1) { |
1876 | - redirect(base_url() . 'user/user_provider_cdrs_report/'); |
|
1876 | + redirect(base_url().'user/user_provider_cdrs_report/'); |
|
1877 | 1877 | } |
1878 | 1878 | } |
1879 | 1879 | |
@@ -1884,53 +1884,53 @@ discard block |
||
1884 | 1884 | |
1885 | 1885 | function user_provider_cdrreport_export() { |
1886 | 1886 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
1887 | - $currency_id=$account_info['currency_id']; |
|
1888 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
1887 | + $currency_id = $account_info['currency_id']; |
|
1888 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
1889 | 1889 | $count_res = $this->user_model->getprovider_cdrs_list(false, "", ""); |
1890 | - $count_all = (array) $count_res->first_row(); |
|
1890 | + $count_all = (array)$count_res->first_row(); |
|
1891 | 1891 | ob_clean(); |
1892 | 1892 | $customer_array[] = array("Date", "CallerID", "Called Number", "Destination", "Duration", "Cost($currency)", "Disposition", "Call Type"); |
1893 | 1893 | if ($count_all['count'] > 0) { |
1894 | 1894 | $query = $this->user_model->getuser_cdrs_list(true, '', '', true); |
1895 | 1895 | $currency_info = $this->common->get_currency_info(); |
1896 | 1896 | $search_arr = $this->session->userdata('user_provider_cdrs_report_search'); |
1897 | - $show_seconds = (!empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1897 | + $show_seconds = ( ! empty($search_arr['search_in'])) ? $search_arr['search_in'] : 'minutes'; |
|
1898 | 1898 | foreach ($query->result_array() as $value) { |
1899 | - $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0 ) ? |
|
1900 | - floor($value['billseconds'] / 60) . ":" . sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
1899 | + $duration = ($show_seconds == 'minutes') ? ($value['billseconds'] > 0) ? |
|
1900 | + floor($value['billseconds'] / 60).":".sprintf("%02d", $value['billseconds'] % 60) : "00:00" : $value['billseconds']; |
|
1901 | 1901 | $customer_array[] = array( |
1902 | 1902 | $this->common->convert_GMT_to('', '', $value['callstart']), |
1903 | 1903 | $value['callerid'], |
1904 | 1904 | $value['callednum'], |
1905 | 1905 | filter_var($value['pattern'], FILTER_SANITIZE_NUMBER_INT), |
1906 | 1906 | $duration, |
1907 | - $this->common->calculate_currency_manually($currency_info, $value['cost'],false), |
|
1907 | + $this->common->calculate_currency_manually($currency_info, $value['cost'], false), |
|
1908 | 1908 | $value['disposition'], |
1909 | 1909 | $value['calltype'] |
1910 | 1910 | ); |
1911 | 1911 | } |
1912 | - $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0 ) ? |
|
1913 | - floor($count_all['billseconds'] / 60) . ":" . sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1912 | + $duration = ($show_seconds == 'minutes') ? ($count_all['billseconds'] > 0) ? |
|
1913 | + floor($count_all['billseconds'] / 60).":".sprintf("%02d", $count_all['billseconds'] % 60) : "00:00" : $count_all['billseconds']; |
|
1914 | 1914 | $customer_array[] = array("Grand Total", |
1915 | 1915 | "", |
1916 | 1916 | "", |
1917 | 1917 | "", |
1918 | 1918 | $duration, |
1919 | - $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'],false,true), |
|
1919 | + $this->common->calculate_currency_manually($currency_info, $count_all['total_cost'], false, true), |
|
1920 | 1920 | "", |
1921 | 1921 | "" |
1922 | 1922 | ); |
1923 | 1923 | } |
1924 | 1924 | $this->load->helper('csv'); |
1925 | - array_to_csv($customer_array, 'Provider_CDR_' . date("Y-m-d") . '.csv'); |
|
1925 | + array_to_csv($customer_array, 'Provider_CDR_'.date("Y-m-d").'.csv'); |
|
1926 | 1926 | } |
1927 | - function user_speeddial(){ |
|
1927 | + function user_speeddial() { |
|
1928 | 1928 | $data['page_title'] = "Speed Dial"; |
1929 | 1929 | $accountinfo = $this->session->userdata('accountinfo'); |
1930 | 1930 | $where = array('id' => $accountinfo['id'], "reseller_id" => $accountinfo['reseller_id']); |
1931 | 1931 | $account = $this->db_model->getSelect("*", "accounts", $where); |
1932 | 1932 | if ($account->num_rows() > 0) { |
1933 | - $account_data = (array) $account->first_row(); |
|
1933 | + $account_data = (array)$account->first_row(); |
|
1934 | 1934 | $speeddial_res = $this->db->get_where("speed_dial", array("accountid" => $accountinfo['id'])); |
1935 | 1935 | $speeddial_info = array(); |
1936 | 1936 | if ($speeddial_res->num_rows() > 0) { |
@@ -1941,14 +1941,14 @@ discard block |
||
1941 | 1941 | } |
1942 | 1942 | $data['speeddial'] = $speeddial_info; |
1943 | 1943 | $this->load->view('view_user_speeddial', $data); |
1944 | - }else{ |
|
1944 | + } else { |
|
1945 | 1945 | redirect(base_url.'user/user/'); |
1946 | 1946 | } |
1947 | 1947 | } |
1948 | 1948 | |
1949 | - function user_speeddial_save(){ |
|
1950 | - $add_array= $this->input->post(); |
|
1951 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1949 | + function user_speeddial_save() { |
|
1950 | + $add_array = $this->input->post(); |
|
1951 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1952 | 1952 | $where = array("accountid" => $accountinfo['id']); |
1953 | 1953 | $this->db->select('count(id) as count'); |
1954 | 1954 | $this->db->where($where); |
@@ -1966,8 +1966,8 @@ discard block |
||
1966 | 1966 | } |
1967 | 1967 | } |
1968 | 1968 | function user_speeddial_remove() { |
1969 | - $accountinfo=$this->session->userdata('accountinfo'); |
|
1970 | - $add_array=$this->input->post(); |
|
1969 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
1970 | + $add_array = $this->input->post(); |
|
1971 | 1971 | $updateinfo = array('number' => ''); |
1972 | 1972 | $this->db->where('speed_num', $add_array['number']); |
1973 | 1973 | $this->db->where('accountid', $accountinfo['id']); |
@@ -36,8 +36,9 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | function index() { |
39 | - if ($this->session->userdata('user_login') == FALSE) |
|
40 | - redirect(base_url() . 'login/login'); |
|
39 | + if ($this->session->userdata('user_login') == FALSE) { |
|
40 | + redirect(base_url() . 'login/login'); |
|
41 | + } |
|
41 | 42 | $data['page_title'] = 'Dashboard'; |
42 | 43 | $this->load->view('view_user_dashboard', $data); |
43 | 44 | } |
@@ -173,16 +174,16 @@ discard block |
||
173 | 174 | $json_data[$i]['charge_id']=$data['charge_id']; |
174 | 175 | if($data['assign_date'] != '0000-00-00 00:00:00'){ |
175 | 176 | $json_data[$i]['assign_date']=date('Y-m-d H:i:s',strtotime($data['assign_date'])+$gmtoffset); |
176 | - }else{ |
|
177 | + } else{ |
|
177 | 178 | $json_data[$i]['assign_date']=$data['assign_date']; |
178 | 179 | } |
179 | 180 | if(isset($sweep_id)){ |
180 | 181 | if($sweep_id ==0){ |
181 | 182 | $json_data[$i]['sweep_id']='Daily'; |
182 | - }else{ |
|
183 | + } else{ |
|
183 | 184 | $json_data[$i]['sweep_id']='Monthly'; |
184 | 185 | } |
185 | - }else{ |
|
186 | + } else{ |
|
186 | 187 | $json_data[$i]['sweep_id']='Anonymous'; |
187 | 188 | } |
188 | 189 | $i++; |
@@ -266,7 +267,7 @@ discard block |
||
266 | 267 | $this->session->set_flashdata('astpp_notification', 'Insuffiecient fund to purchase this did'); |
267 | 268 | redirect(base_url() . "user/user_didlist/"); |
268 | 269 | } |
269 | - }else{ |
|
270 | + } else{ |
|
270 | 271 | $this->session->set_flashdata('astpp_notification', 'This DID already purchased by someone.'); |
271 | 272 | redirect(base_url() . "user/user_didlist/"); |
272 | 273 | } |
@@ -298,7 +299,7 @@ discard block |
||
298 | 299 | $this->session->set_flashdata('astpp_notification', 'DID Removed Successfully.'); |
299 | 300 | redirect(base_url() . "user/user_didlist/"); |
300 | 301 | } |
301 | - }else{ |
|
302 | + } else{ |
|
302 | 303 | $this->session->set_flashdata('astpp_notification', 'DID not found.'); |
303 | 304 | redirect(base_url() . "user/user_didlist/"); |
304 | 305 | } |
@@ -355,8 +356,9 @@ discard block |
||
355 | 356 | $markup = $this->common->get_field_name('markup', 'pricelists', array('id'=>$account_data["pricelist_id"])); |
356 | 357 | $markup = ($markup > 0)?$markup:1; |
357 | 358 | $action['cost']['cost'] = $this->common_model->add_calculate_currency($action['cost']['cost'], "", '', true, false); |
358 | - if($account_data['type']!=3) |
|
359 | - $action['cost']['cost']=($action['cost']['cost'] - ($action['cost']['cost']*$markup)/100); |
|
359 | + if($account_data['type']!=3) { |
|
360 | + $action['cost']['cost']=($action['cost']['cost'] - ($action['cost']['cost']*$markup)/100); |
|
361 | + } |
|
360 | 362 | } |
361 | 363 | $this->session->set_userdata('user_rates_list_search', $action); |
362 | 364 | } |
@@ -695,7 +697,7 @@ discard block |
||
695 | 697 | $this->session->set_userdata('accountinfo', $result[0]); |
696 | 698 | $this->session->set_flashdata('astpp_errormsg',' Your profile updated successfully!'); |
697 | 699 | redirect(base_url() . 'user/user_myprofile/'); |
698 | - }else{ |
|
700 | + } else{ |
|
699 | 701 | $this->session->set_flashdata('astpp_notification', 'Something wrong.Please contact to administrator.'); |
700 | 702 | } |
701 | 703 | } |
@@ -729,7 +731,7 @@ discard block |
||
729 | 731 | $this->session->set_flashdata('astpp_errormsg', 'Password updated successfully!'); |
730 | 732 | redirect(base_url() . 'user/user_change_password/'); |
731 | 733 | } |
732 | - }else{ |
|
734 | + } else{ |
|
733 | 735 | $data_array['id']=$accountinfo['id']; |
734 | 736 | $data['form'] = $this->form->build_form($this->user_form->get_userprofile_change_password(),$data_array); |
735 | 737 | } |
@@ -745,7 +747,7 @@ discard block |
||
745 | 747 | $data['form_search'] = $this->form->build_serach_form($this->user_form->build_user_refill_report_search()); |
746 | 748 | if($accountinfo['type'] == 1){ |
747 | 749 | $this->load->view('view_reseller_refill_report', $data); |
748 | - }else{ |
|
750 | + } else{ |
|
749 | 751 | $this->load->view('view_user_refill_report', $data); |
750 | 752 | } |
751 | 753 | } |
@@ -829,19 +831,18 @@ discard block |
||
829 | 831 | } else { |
830 | 832 | $payment = ' <button style="padding: 0 8px;" class="btn btn-success" type="button">Paid</button>'; |
831 | 833 | } |
832 | - }else{ |
|
834 | + } else{ |
|
833 | 835 | $payment = ''; |
834 | 836 | } |
835 | 837 | if($value['generate_type'] == 1){ |
836 | 838 | $invoice_type='Manually'; |
837 | - }else{ |
|
839 | + } else{ |
|
838 | 840 | $invoice_type='Automatically'; |
839 | 841 | } |
840 | 842 | |
841 | 843 | if($value['type'] == 'R'){ |
842 | 844 | $icon = '<div class="flx_font flx_magenta">R</div>'; |
843 | - } |
|
844 | - else |
|
845 | + } else |
|
845 | 846 | { |
846 | 847 | $icon = '<div class="flx_font flx_drk_pink">I</div>'; |
847 | 848 | |
@@ -904,7 +905,7 @@ discard block |
||
904 | 905 | $amount = $this->input->post("value",true); |
905 | 906 | $amount = $this->common_model->add_calculate_currency($amount,"","",true,false); |
906 | 907 | echo number_format($amount,2); |
907 | - }else{ |
|
908 | + } else{ |
|
908 | 909 | $this->payment->index(); |
909 | 910 | } |
910 | 911 | } |
@@ -946,12 +947,12 @@ discard block |
||
946 | 947 | $item_type=$value['item_type']; |
947 | 948 | if($value['before_balance'] == '-'){ |
948 | 949 | $before_balance='-'; |
949 | - }else{ |
|
950 | + } else{ |
|
950 | 951 | $before_balance=$this->common->convert_to_currency('','',$value['before_balance']); |
951 | 952 | } |
952 | 953 | if($value['debit'] == '-'){ |
953 | 954 | $debit='-'; |
954 | - }else{ |
|
955 | + } else{ |
|
955 | 956 | $debit=$this->common->convert_to_currency('','',$value['debit']); |
956 | 957 | } |
957 | 958 | $credit=$this->common->convert_to_currency('','',$value['credit']); |
@@ -960,7 +961,7 @@ discard block |
||
960 | 961 | } |
961 | 962 | if($value['after_balance'] == '-'){ |
962 | 963 | $after_balance='-'; |
963 | - }else{ |
|
964 | + } else{ |
|
964 | 965 | $after_balance=$this->common->convert_to_currency('','',$value['after_balance']); |
965 | 966 | } |
966 | 967 | $description=$value['description']; |
@@ -1092,7 +1093,7 @@ discard block |
||
1092 | 1093 | $this->db->where('reseller_pricing.note','dids.number',false); |
1093 | 1094 | $this->db->where('reseller_pricing.reseller_id',$accountinfo['reseller_id']); |
1094 | 1095 | $this->db->from('dids,reseller_pricing'); |
1095 | - }else{ |
|
1096 | + } else{ |
|
1096 | 1097 | $this->db->where('parent_id',0); |
1097 | 1098 | $this->db->where('accountid',0); |
1098 | 1099 | $this->db->select('id,number,setup,monthlycost'); |
@@ -1393,7 +1394,7 @@ discard block |
||
1393 | 1394 | ); |
1394 | 1395 | $this->db->insert("ani_map", $insert_arr); |
1395 | 1396 | $this->session->set_flashdata('astpp_errormsg', 'Add Caller ID Sucessfully!'); |
1396 | - }else{ |
|
1397 | + } else{ |
|
1397 | 1398 | $this->session->set_flashdata('astpp_notification', 'Please Enter Caller ID value.'); |
1398 | 1399 | } |
1399 | 1400 | } else { |
@@ -1538,7 +1539,7 @@ discard block |
||
1538 | 1539 | if($action=="GET_AMT"){ |
1539 | 1540 | $amount = $this->input->post("value",true); |
1540 | 1541 | $this->payment->convert_amount($amount); |
1541 | - }else{ |
|
1542 | + } else{ |
|
1542 | 1543 | $this->payment->index(); |
1543 | 1544 | } |
1544 | 1545 | } |
@@ -1573,34 +1574,25 @@ discard block |
||
1573 | 1574 | $minimum_fund=(array)$this->db->get_where('system',array("name"=>"minimum_fund_transfer"),1)->first_row(); |
1574 | 1575 | if ($post_array['toaccountid'] == $account_info['number']) { |
1575 | 1576 | $this->session->set_flashdata('astpp_notification', 'You can not transfer fund in same account.'); |
1576 | - } |
|
1577 | - elseif ($reseller_id != $account_info['reseller_id']) { |
|
1577 | + } elseif ($reseller_id != $account_info['reseller_id']) { |
|
1578 | 1578 | $this->session->set_flashdata('astpp_notification', 'You can only transfer fund in same level account.'); |
1579 | - } |
|
1580 | - elseif ($post_array['toaccountid'] == '') { |
|
1579 | + } elseif ($post_array['toaccountid'] == '') { |
|
1581 | 1580 | $this->session->set_flashdata('astpp_notification', 'Please enter To account number.'); |
1582 | - } |
|
1583 | - elseif (empty($post_array['credit'])) { |
|
1581 | + } elseif (empty($post_array['credit'])) { |
|
1584 | 1582 | $this->session->set_flashdata('astpp_notification', 'Please enter a amount.'); |
1585 | - } |
|
1586 | - elseif ($post_array['credit'] > $balance) { |
|
1583 | + } elseif ($post_array['credit'] > $balance) { |
|
1587 | 1584 | $this->session->set_flashdata('astpp_notification', 'You have insufficient balance.'); |
1588 | - } |
|
1589 | - elseif ($toid <= 0 || !isset($post_array['toaccountid'])) { |
|
1585 | + } elseif ($toid <= 0 || !isset($post_array['toaccountid'])) { |
|
1590 | 1586 | $this->session->set_flashdata('astpp_notification', 'Please enter valid account number.'); |
1591 | - } |
|
1592 | - elseif ($post_array['credit'] < 0) { |
|
1587 | + } elseif ($post_array['credit'] < 0) { |
|
1593 | 1588 | $this->session->set_flashdata('astpp_notification', 'Please enter amount greater then 0.'); |
1594 | - } |
|
1595 | - elseif ($minimum_fund['value'] >= $post_array['credit']) { |
|
1589 | + } elseif ($minimum_fund['value'] >= $post_array['credit']) { |
|
1596 | 1590 | $this->session->set_flashdata('astpp_notification', 'You need to enter minimum amount of fund transfer ' . $minimum_fund['value'] . ' .'); |
1597 | - } |
|
1598 | - elseif (!isset($toid) || !isset($post_array['toaccountid'])) { |
|
1591 | + } elseif (!isset($toid) || !isset($post_array['toaccountid'])) { |
|
1599 | 1592 | $this->session->set_flashdata('astpp_notification', 'Please enter valid account number!'); |
1600 | - } |
|
1601 | - elseif ($post_array['credit'] < 0 || $post_array['credit'] > $balance) { |
|
1593 | + } elseif ($post_array['credit'] < 0 || $post_array['credit'] > $balance) { |
|
1602 | 1594 | $this->session->set_flashdata('astpp_notification', 'Insuffiecient amount !'); |
1603 | - }else{ |
|
1595 | + } else{ |
|
1604 | 1596 | $from['id'] = $post_array['id']; |
1605 | 1597 | $from['account_currency'] = $post_array['account_currency']; |
1606 | 1598 | $from['accountid'] = $post_array['fromaccountid']; |
@@ -1635,7 +1627,7 @@ discard block |
||
1635 | 1627 | $this->session->set_flashdata('astpp_notification', 'Sorry We are not able to process this request.'); |
1636 | 1628 | } |
1637 | 1629 | } |
1638 | - }else{ |
|
1630 | + } else{ |
|
1639 | 1631 | $this->session->set_flashdata('astpp_notification', 'Account number not found.'); |
1640 | 1632 | } |
1641 | 1633 | } else { |
@@ -1727,7 +1719,7 @@ discard block |
||
1727 | 1719 | $this->user_model->user_opensips_edit($add_array, $add_array['id']); |
1728 | 1720 | echo json_encode(array("SUCCESS"=> " OpenSips updated successfully!")); |
1729 | 1721 | exit; |
1730 | - }else{ |
|
1722 | + } else{ |
|
1731 | 1723 | echo json_encode($auth_flag); |
1732 | 1724 | exit; |
1733 | 1725 | } |
@@ -1744,7 +1736,7 @@ discard block |
||
1744 | 1736 | $this->user_model->user_opensips_add($add_array); |
1745 | 1737 | echo json_encode(array("SUCCESS"=> "OpenSips added successfully!")); |
1746 | 1738 | exit; |
1747 | - }else{ |
|
1739 | + } else{ |
|
1748 | 1740 | echo json_encode($auth_flag); |
1749 | 1741 | exit; |
1750 | 1742 | } |
@@ -1765,10 +1757,10 @@ discard block |
||
1765 | 1757 | $auth_flag = $auth_flag->num_rows(); |
1766 | 1758 | if($auth_flag == 0){ |
1767 | 1759 | return "TRUE"; |
1768 | - }else{ |
|
1760 | + } else{ |
|
1769 | 1761 | return array("username_error"=>"Duplicate Username Found.Username Must be Unique"); |
1770 | 1762 | } |
1771 | - }else{ |
|
1763 | + } else{ |
|
1772 | 1764 | return array("username_error"=>"User name is required field."); |
1773 | 1765 | } |
1774 | 1766 | return "0"; |
@@ -1941,7 +1933,7 @@ discard block |
||
1941 | 1933 | } |
1942 | 1934 | $data['speeddial'] = $speeddial_info; |
1943 | 1935 | $this->load->view('view_user_speeddial', $data); |
1944 | - }else{ |
|
1936 | + } else{ |
|
1945 | 1937 | redirect(base_url.'user/user/'); |
1946 | 1938 | } |
1947 | 1939 | } |