Completed
Push — v3.0 ( 23635d...e28df5 )
by Samir
23s
created
astpp/application/modules/rates/views/view_import_origination_rate.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 <? startblock('extra_head') ?>
3 3
 <? endblock() ?>
4 4
 <? startblock('page-title') ?>
5
-<?= $page_title;?>
5
+<?= $page_title; ?>
6 6
 <? endblock() ?>
7 7
 <? startblock('content') ?>        
8
-   <?php if(!isset($csv_tmp_data)){ ?>
8
+   <?php if ( ! isset($csv_tmp_data)) { ?>
9 9
    
10 10
 <section class="slice color-three padding-t-20">
11 11
 	<div class="w-section inverse no-padding">
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
               <div class="col-md-12">
16 16
             	<div class="w-box">
17 17
                    <span  style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;">
18
-                    <? if(isset($error) && !empty($error)) {
18
+                    <? if (isset($error) && ! empty($error)) {
19 19
                         echo $error;
20 20
                     }?>
21 21
                    </span>            	
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
                            <div class="col-md-12 no-padding">
32 32
                                <label class="col-md-3">Rate Group:</label>
33 33
                                <div>
34
-                               <? $pricelists = form_dropdown('pricelist_id', $this->db_model->build_dropdown("id,name", "pricelists","where_arr", array("reseller_id" => "0", "status" => "0")), '');
34
+                               <? $pricelists = form_dropdown('pricelist_id', $this->db_model->build_dropdown("id,name", "pricelists", "where_arr", array("reseller_id" => "0", "status" => "0")), '');
35 35
                                     echo $pricelists;
36 36
                                ?>
37 37
                                </div>
38 38
                            </div>
39 39
 				<?
40
-				 $logintype=$this->session->userdata('userlevel_logintype');
40
+				 $logintype = $this->session->userdata('userlevel_logintype');
41 41
 				       // $trunk=null;
42
-				 if($logintype !=1) { ?>
42
+				 if ($logintype != 1) { ?>
43 43
                            <div class="col-md-12 no-padding">
44 44
                                <label class="col-md-3">Force Trunk:</label>
45 45
                                <div>
46
-                               <? $trunklist = form_dropdown_all('trunk_id', $this->db_model->build_dropdown("id,name", "trunks","where_arr", array("status" => "0")), '');
46
+                               <? $trunklist = form_dropdown_all('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr", array("status" => "0")), '');
47 47
                                     echo $trunklist;
48 48
                                ?>
49 49
                                </div>
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 <?}?>    
102 102
         
103 103
 <?php
104
-    if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?>
104
+    if (isset($csv_tmp_data) && ! empty($csv_tmp_data)) { ?>
105 105
 
106 106
 <section class="slice color-three">
107 107
 	<div class="w-section inverse no-padding">
@@ -110,14 +110,14 @@  discard block
 block discarded – undo
110 110
              <div class="col-md-12 margin-t-10">
111 111
             <form id="import_form" name="import_form" action="<?=base_url()?>rates/origination_rate_import_file/<?= $pricelistid?>/<?=$trunkid?><?=$check_header?>/" method="POST">
112 112
             <table width="100%" border="1"  class="details_table table">
113
-                <?  $cnt =7;
114
-                    foreach($csv_tmp_data as $csv_key => $csv_value){
115
-                        if($csv_key <  15){
113
+                <?  $cnt = 7;
114
+                    foreach ($csv_tmp_data as $csv_key => $csv_value) {
115
+                        if ($csv_key < 15) {
116 116
                             echo "<tr>";
117
-                            foreach($csv_value as $field_name => $field_val){
118
-                                if($csv_key == 0){
117
+                            foreach ($csv_value as $field_name => $field_val) {
118
+                                if ($csv_key == 0) {
119 119
                                     echo "<th>".ucfirst($field_name)."</th>";
120
-                                }else{
120
+                                } else {
121 121
                                     echo "<td class='portlet-content'>".$field_val."</td>";   
122 122
                                 }
123 123
                             }
Please login to merge, or discard this patch.
astpp/application/modules/rates/views/view_import_termination_rate.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 <? endblock() ?>
9 9
 
10 10
 <? startblock('content') ?>        
11
-   <?php if(!isset($csv_tmp_data)){ ?>
11
+   <?php if ( ! isset($csv_tmp_data)) { ?>
12 12
    
13 13
 <section class="slice color-three padding-t-20">
14 14
 	<div class="w-section inverse no-padding">
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
                <div class="col-md-12">
19 19
             	<div class="w-box">
20 20
             	 <span  style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;">
21
-                    <? if(isset($error) && !empty($error)) {
21
+                    <? if (isset($error) && ! empty($error)) {
22 22
                         echo $error;
23 23
                     }?>
24 24
                  </span>
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                            <div class="col-md-12 no-padding">
35 35
                                <label class="col-md-3">Trunk List:</label>
36 36
                                <div class="">
37
-                               <? $trunklist = form_dropdown('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr",array("status " => "0")), '');
37
+                               <? $trunklist = form_dropdown('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr", array("status " => "0")), '');
38 38
                             echo $trunklist; ?></div>
39 39
                            </div>
40 40
                            <div class="col-md-12 no-padding">
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 <?}?>    
89 89
         
90 90
 <?php
91
-    if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?>
91
+    if (isset($csv_tmp_data) && ! empty($csv_tmp_data)) { ?>
92 92
         
93 93
 <section class="slice color-three padding-b-20">
94 94
 	<div class="w-section inverse no-padding">
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
                 <div class="col-md-12 margin-t-10">  
98 98
             <form id="import_form" name="import_form" action="<?=base_url()?>rates/termination_rate_rates_import/<?= $trunkid?>/<?=$check_header?>/" method="POST">
99 99
             <table width="100%" border="1"  class="details_table table">
100
-                <?  $cnt =7;
101
-                    foreach($csv_tmp_data as $csv_key => $csv_value){
102
-                        if($csv_key <  15){
100
+                <?  $cnt = 7;
101
+                    foreach ($csv_tmp_data as $csv_key => $csv_value) {
102
+                        if ($csv_key < 15) {
103 103
                             echo "<tr>";
104
-                            foreach($csv_value as $field_name => $field_val){
105
-                                if($csv_key == 0){
104
+                            foreach ($csv_value as $field_name => $field_val) {
105
+                                if ($csv_key == 0) {
106 106
                                     echo "<th>".ucfirst($field_name)."</th>";
107
-                                }else{
107
+                                } else {
108 108
                                     echo "<td class='portlet-content'>".$field_val."</td>";   
109 109
                                 }
110 110
                             }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/views/view_import_error.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     </div> 
44 44
 <br/>
45 45
 
46
-<?php if(isset($trunkid) && $trunkid != ""){ ?>
46
+<?php if (isset($trunkid) && $trunkid != "") { ?>
47 47
 <div class="col-md-12 padding-b-10">
48 48
                    <div class="pull-right">
49 49
                         <a href="<?= base_url().'rates/termination_rates_list/'?>"><input class="btn btn-line-sky margin-x-10" id="ok" type="button" name="action" value="Back to Termination Rates List" /> </a>
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
                         <a href="<?= base_url().'rates/termination_rate_error_download/'?>"><input class="btn btn-line-parrot" id="ok" type="button" name="action" value="Download Errors" /> </a>
52 52
              </div></div>       <?}?>    
53 53
 
54
-                    <?php if(isset($pricelistid) && $pricelistid != ""){ ?>
54
+                    <?php if (isset($pricelistid) && $pricelistid != "") { ?>
55 55
 <div class="col-md-12 padding-b-10">
56 56
                    <div class="pull-right">
57 57
                         <a href="<?= base_url().'rates/origination_rates_list/'?>"><input class="btn btn-line-sky margin-x-10" id="back_to_list" type="button" name="action" value="Back to Origination Rates List" /> </a>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/models/rates_model.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 ASTPP  3.0 
33 33
 Batch Delete
34 34
 ********/
35
-        if($this->session->userdata('advance_batch_delete') == 1){
35
+        if ($this->session->userdata('advance_batch_delete') == 1) {
36 36
            $this->db->where(array("trunk_id >"=>"0"));
37 37
            $this->db->delete("outbound_routes");
38
-           $this->session->set_userdata('advance_batch_delete','0');
38
+           $this->session->set_userdata('advance_batch_delete', '0');
39 39
 	       $this->session->unset_userdata('advance_batch_delete');
40 40
 	   }
41 41
 /**************/
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             if ($export)
54 54
                 $this->db->limit($limit, $start);
55 55
             $result = $this->db->get();
56
-        }else {
56
+        } else {
57 57
             $result = $this->db->count_all_results();
58 58
         }
59 59
         return $result;
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
             if ($export)
75 75
                 $this->db->limit($limit, $start);
76 76
             $result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
77
-        }else {
77
+        } else {
78 78
             $result = $this->db_model->countQuery("*", "routes", $where);
79 79
         }
80 80
 // 	echo "<pre>";print_r($result->result());exit;
81 81
         return $result;
82 82
     }
83 83
 
84
-    function get_origination_rate_for_user($flag, $start = 0, $limit = 0,$export = true) {
84
+    function get_origination_rate_for_user($flag, $start = 0, $limit = 0, $export = true) {
85 85
         $this->db_model->build_search('origination_rate_list_search');
86 86
 
87 87
         $account_data = $this->session->userdata("accountinfo");
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             if ($export)
94 94
                 $this->db->limit($limit, $start);
95 95
             $result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
96
-        }else {
96
+        } else {
97 97
             $result = $this->db_model->countQuery("*", "routes", $where);
98 98
         }
99 99
         return $result;
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 ASTPP  3.0 
112 112
 Batch delete
113 113
 ************/
114
-        if($this->session->userdata('advance_batch_delete') == 1){
114
+        if ($this->session->userdata('advance_batch_delete') == 1) {
115 115
             $this->db->where($where);
116 116
 			$this->db->delete("routes");
117 117
 			//echo $this->db->last_query(); exit;
118
-			$this->session->set_userdata('advance_batch_delete','0');
118
+			$this->session->set_userdata('advance_batch_delete', '0');
119 119
 			$this->session->unset_userdata('advance_batch_delete');
120 120
 			
121 121
 		}
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
         //echo $this->db->last_query();
132 132
         return $query;
133 133
     }
134
-    function getunblocked_pattern_list($accountid,$flag, $start = 0, $limit = 0) {
134
+    function getunblocked_pattern_list($accountid, $flag, $start = 0, $limit = 0) {
135 135
         $this->db_model->build_search('origination_rate_list_search');
136 136
         if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
137 137
             $account_data = $this->session->userdata("accountinfo");
138 138
             $reseller = $account_data['id'];
139 139
             $where = array("reseller_id" => $reseller, "status" => "0");
140 140
         } else {
141
-            $where = array("status" => "0",'reseller_id'=>'0');
141
+            $where = array("status" => "0", 'reseller_id'=>'0');
142 142
         }
143 143
         $where1 = '(pattern NOT IN (select blocked_patterns from block_patterns where accountid = "'.$accountid.'"))';
144 144
         $this->db->where($where1);        
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
         }
151 151
         return $query;
152 152
     }
153
-    function getunblocked_package_pattern($accountid,$flag, $start = 0, $limit = 0) {
153
+    function getunblocked_package_pattern($accountid, $flag, $start = 0, $limit = 0) {
154 154
         $this->db_model->build_search('origination_rate_list_search');
155 155
         if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
156 156
             $account_data = $this->session->userdata("accountinfo");
157 157
             $reseller = $account_data['id'];
158 158
             $where = array("reseller_id" => $reseller, "status" => "0");
159 159
         } else {
160
-            $where = array("status" => "0",'reseller_id'=>'0');
160
+            $where = array("status" => "0", 'reseller_id'=>'0');
161 161
         }
162 162
         $where1 = '(pattern NOT IN (select DISTINCT patterns from package_patterns where package_id = "'.$accountid.'"))';
163 163
         $this->db->where($where1);       
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         $this->db_model->build_search('user_rates_list_search');
174 174
 
175 175
         $account_data = $this->session->userdata("accountinfo");
176
-        $where = array("pricelist_id" => $account_data["pricelist_id"],"status" => '0');
176
+        $where = array("pricelist_id" => $account_data["pricelist_id"], "status" => '0');
177 177
 
178 178
         $this->db_model->build_search('origination_rate_list_search');
179 179
         if ($flag) {
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
             $reseller = $account_data['id'];
193 193
             $add_array['reseller_id'] = $reseller;
194 194
         }
195
-        $add_array['pattern'] = "^" . $add_array['pattern'] . ".*";
195
+        $add_array['pattern'] = "^".$add_array['pattern'].".*";
196 196
         $add_array['prepend'] = $add_array['prepend'];
197 197
         /*
198 198
         ASTPP  3.0 
199 199
          add creation date.
200 200
         */
201
-        $add_array['creation_date']=gmdate('Y-m-d H:i:s');
201
+        $add_array['creation_date'] = gmdate('Y-m-d H:i:s');
202 202
         /*******************************************************/
203
-        $this->insert_if_not_exitst($add_array,"outbound_routes");
203
+        $this->insert_if_not_exitst($add_array, "outbound_routes");
204 204
         //$this->db->insert("outbound_routes", $add_array);
205 205
         return true;
206 206
     }
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
         ASTPP  3.0
212 212
          Edit time last modified date
213 213
         */
214
-        $data['last_modified_date']=gmdate('Y-m-d H:i:s');
214
+        $data['last_modified_date'] = gmdate('Y-m-d H:i:s');
215 215
         /***************************************************/
216
-        $data['pattern'] = "^" . $data['pattern'] . ".*";
216
+        $data['pattern'] = "^".$data['pattern'].".*";
217 217
         $this->db->where("id", $id);
218 218
         $this->db->update("outbound_routes", $data);
219 219
     }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         ASTPP  3.0 
232 232
         ADD time put creation date in routes table 
233 233
         */
234
-        $add_array['creation_date']=gmdate('Y-m-d H:i:s');
234
+        $add_array['creation_date'] = gmdate('Y-m-d H:i:s');
235 235
         /**********************************************/
236 236
         if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
237 237
             $account_data = $this->session->userdata("accountinfo");
@@ -239,12 +239,12 @@  discard block
 block discarded – undo
239 239
             $add_array['reseller_id'] = $reseller;
240 240
         }
241 241
 	
242
-        $add_array['pattern'] = "^" . $add_array['pattern'] . ".*";
242
+        $add_array['pattern'] = "^".$add_array['pattern'].".*";
243 243
 /*************
244 244
 ASTPP  3.0 
245 245
 Rate insert
246 246
 *************/
247
-        $this->insert_if_not_exitst($add_array,"routes");
247
+        $this->insert_if_not_exitst($add_array, "routes");
248 248
 //        $this->db->insert("routes", $add_array);
249 249
 /*******************************/
250 250
         return true;
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
         ASTPP  3.0
257 257
          Edit tile last modified date update
258 258
         */
259
-        $data['last_modified_date']=gmdate('Y-m-d H:i:s');
259
+        $data['last_modified_date'] = gmdate('Y-m-d H:i:s');
260 260
         /********************************************************/
261
-        $data['pattern'] = "^" . $data['pattern'] . ".*";
261
+        $data['pattern'] = "^".$data['pattern'].".*";
262 262
         $this->db->where("id", $id);
263 263
         $this->db->update("routes", $data);
264 264
     }
@@ -292,35 +292,35 @@  discard block
 block discarded – undo
292 292
         $affected_row = $this->db->affected_rows();
293 293
         return $affected_row;
294 294
     }
295
-    function termination_rate_batch_update($update_array){
295
+    function termination_rate_batch_update($update_array) {
296 296
         $this->db_model->build_search('termination_rates_list_search');
297 297
         if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
298 298
             $account_data = $this->session->userdata("accountinfo");
299
-            $this->db->where("reseller_id",$account_data['id']);
299
+            $this->db->where("reseller_id", $account_data['id']);
300 300
         }
301 301
         
302 302
         $updateflg = $this->db_model->build_batch_update_array($update_array);
303
-        if($updateflg)
303
+        if ($updateflg)
304 304
             return $this->db->update("outbound_routes");
305 305
         else
306 306
             return false;
307 307
     }
308
-    function origination_rate_batch_update($update_array){
308
+    function origination_rate_batch_update($update_array) {
309 309
         $this->db_model->build_search('origination_rate_list_search');
310 310
         if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
311 311
             $account_data = $this->session->userdata("accountinfo");
312
-            $this->db->where("reseller_id",$account_data['id']);
312
+            $this->db->where("reseller_id", $account_data['id']);
313 313
         }
314 314
         $updateflg = $this->db_model->build_batch_update_array($update_array);
315
-        if($updateflg)
315
+        if ($updateflg)
316 316
             return $this->db->update("routes");
317 317
         else
318 318
             return false;
319 319
     }
320
-    function getreseller_rates_list($flag, $start = 0, $limit = 0,$export=false) {
320
+    function getreseller_rates_list($flag, $start = 0, $limit = 0, $export = false) {
321 321
         $this->db_model->build_search('resellerrates_list_search');
322 322
         $account_data = $this->session->userdata("accountinfo");
323
-        $where = array("status"=>"0","pricelist_id" => $account_data["pricelist_id"]);
323
+        $where = array("status"=>"0", "pricelist_id" => $account_data["pricelist_id"]);
324 324
         if ($flag) {
325 325
             $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);            
326 326
         } else {
@@ -332,21 +332,21 @@  discard block
 block discarded – undo
332 332
 ASTPP  3.0
333 333
 Rate insert
334 334
 *************/
335
-    function insert_if_not_exitst($add_array,$table_name){
335
+    function insert_if_not_exitst($add_array, $table_name) {
336 336
         $insert_str = "Insert into $table_name (";
337 337
         $insert_key = "";
338 338
         $insert_value = "";
339 339
         $update_str = "";
340
-        foreach($add_array as $key => $value){
341
-           if($key != 'id'){
340
+        foreach ($add_array as $key => $value) {
341
+           if ($key != 'id') {
342 342
                    $insert_key .= $key.",";
343 343
                    $insert_value .= "'$value',";   
344 344
                    $update_str .= $key." = '$value',";
345 345
            }
346 346
         }
347
-        $insert_key = rtrim($insert_key,",");
348
-        $insert_value = rtrim($insert_value,",");
349
-        $update_str = rtrim($update_str,",");
347
+        $insert_key = rtrim($insert_key, ",");
348
+        $insert_value = rtrim($insert_value, ",");
349
+        $update_str = rtrim($update_str, ",");
350 350
         $insert_str .= $insert_key.") values"."(".$insert_value.")  ON DUPLICATE KEY UPDATE $update_str";
351 351
         $this->db->query($insert_str);
352 352
     }   
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/pricing/controllers/pricing.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $this->load->model('pricing_model');
34 34
 
35 35
         if ($this->session->userdata('user_login') == FALSE)
36
-            redirect(base_url() . '/astpp/login');
36
+            redirect(base_url().'/astpp/login');
37 37
     }
38 38
 
39 39
     function price_add($type = "") {
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
         foreach ($account->result_array() as $key => $value) {
53 53
             $edit_data = $value;
54 54
         }
55
-	$routing_data = $this->db_model->getSelect("trunk_id", "routing",array("pricelist_id"=>$edit_id));
56
-	if($routing_data->num_rows > 0){
57
-	  foreach($routing_data->result_array() as $trunkid){
55
+	$routing_data = $this->db_model->getSelect("trunk_id", "routing", array("pricelist_id"=>$edit_id));
56
+	if ($routing_data->num_rows > 0) {
57
+	  foreach ($routing_data->result_array() as $trunkid) {
58 58
 	    $edit_data["trunk_id"][] = $trunkid["trunk_id"];
59 59
 	  }
60 60
 	}
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
                 exit;
75 75
             } else {
76 76
 	  	  $where = array("pricelist_id"=>$add_array['id']);
77
-	  	  $this->db->delete("routing",$where);
78
-		if(isset($add_array['trunk_id']) && $add_array['trunk_id'] != ''){
79
-		  $this->set_force_routing($add_array['id'],$add_array['trunk_id']);
77
+	  	  $this->db->delete("routing", $where);
78
+		if (isset($add_array['trunk_id']) && $add_array['trunk_id'] != '') {
79
+		  $this->set_force_routing($add_array['id'], $add_array['trunk_id']);
80 80
 		  unset($add_array['trunk_id']);
81 81
 		}
82 82
                 $this->pricing_model->edit_price($add_array, $add_array['id']);
@@ -84,30 +84,30 @@  discard block
 block discarded – undo
84 84
                 exit;
85 85
             }
86 86
             $this->load->view('view_price_add_edit', $data);
87
-       }else {
87
+       } else {
88 88
             $data['page_title'] = 'Create Price Details';
89 89
             if ($this->form_validation->run() == FALSE) {
90 90
                 $data['validation_errors'] = validation_errors();
91 91
                 echo $data['validation_errors'];
92 92
                 exit;
93 93
             } else {
94
-		if(isset($add_array['trunk_id']) && !empty($add_array['trunk_id']))
95
-                $trunk_id=$add_array['trunk_id'];
94
+		if (isset($add_array['trunk_id']) && ! empty($add_array['trunk_id']))
95
+                $trunk_id = $add_array['trunk_id'];
96 96
                 unset($add_array['trunk_id']);
97
-                $priceid=$this->pricing_model->add_price($add_array);
98
-		if(isset($trunk_id) && $trunk_id != ''){
99
-		  $this->set_force_routing($priceid,$trunk_id);
97
+                $priceid = $this->pricing_model->add_price($add_array);
98
+		if (isset($trunk_id) && $trunk_id != '') {
99
+		  $this->set_force_routing($priceid, $trunk_id);
100 100
 		}
101 101
                 echo json_encode(array("SUCCESS"=> $add_array["name"]." rate group added successfully!"));
102 102
                 exit;
103 103
             }
104 104
         }
105 105
     }
106
-    function set_force_routing($priceid,$trunkid){
106
+    function set_force_routing($priceid, $trunkid) {
107 107
 // 	echo "<pre>".$priceid; print_r($trunkid);
108
-	foreach($trunkid as $id){
108
+	foreach ($trunkid as $id) {
109 109
 	  $routing_arr = array("trunk_id" => $id, "pricelist_id"=>$priceid);
110
-	  $this->db->insert("routing",$routing_arr);
110
+	  $this->db->insert("routing", $routing_arr);
111 111
 	}
112 112
     }
113 113
     function price_list_search() {
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             $this->session->set_userdata('price_list_search', $action);
122 122
         }
123 123
         if (@$ajax_search != 1) {
124
-            redirect(base_url() . 'accounts/customer_list/');
124
+            redirect(base_url().'accounts/customer_list/');
125 125
         }
126 126
     }
127 127
 
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
     function price_delete($pricelist_id) {
162 162
         $where = array("id" => $pricelist_id);
163 163
         $this->db_model->update("pricelists", array("status" => "2"), $where);
164
-	$this->db->delete("routing",array("pricelist_id"=>$pricelist_id));
164
+	$this->db->delete("routing", array("pricelist_id"=>$pricelist_id));
165 165
         $this->session->set_flashdata('astpp_notification', 'Rate group removed successfully!');
166
-        redirect(base_url() . 'pricing/price_list/');
166
+        redirect(base_url().'pricing/price_list/');
167 167
     }
168 168
 
169 169
  function price_delete_multiple() {
@@ -173,59 +173,59 @@  discard block
 block discarded – undo
173 173
             $update_data = array('status' => '2');
174 174
             $this->db->where('pricelist_id '.$where);
175 175
             $this->db->delete('routes');            
176
-            $this->db->delete("routing",array("pricelist_id"=>$where));
176
+            $this->db->delete("routing", array("pricelist_id"=>$where));
177 177
             $this->db->where('id '.$where);
178 178
             echo $this->db->update('pricelists', $update_data);
179 179
         } else {
180
-            $pricelist_arr=array();
180
+            $pricelist_arr = array();
181 181
             //Get selected Rategroup Name from database.
182 182
             $this->db->select('id,name');
183 183
             $this->db->where('id '.$where);
184
-            $pricelist_res=$this->db->get('pricelists');
185
-            $pricelist_res=$pricelist_res->result_array();
186
-            foreach($pricelist_res as $value){
187
-                $pricelist_arr[$value['id']]['name']=$value['name'];
184
+            $pricelist_res = $this->db->get('pricelists');
185
+            $pricelist_res = $pricelist_res->result_array();
186
+            foreach ($pricelist_res as $value) {
187
+                $pricelist_arr[$value['id']]['name'] = $value['name'];
188 188
             }
189 189
             //Get count of accounts which are using selected rategroups.
190 190
             $this->db->where('pricelist_id '.$where);
191
-            $this->db->where('deleted',0);
191
+            $this->db->where('deleted', 0);
192 192
             $this->db->select('count(id) as cnt,pricelist_id');
193 193
             $this->db->group_by('pricelist_id');
194
-            $account_res=$this->db->get('accounts');
195
-            if($account_res->num_rows() > 0){
196
-             $account_res=$account_res->result_array();
197
-             foreach($account_res as $key=>$value){
198
-                $pricelist_arr[$value['pricelist_id']]['account']=$value['cnt'];
194
+            $account_res = $this->db->get('accounts');
195
+            if ($account_res->num_rows() > 0) {
196
+             $account_res = $account_res->result_array();
197
+             foreach ($account_res as $key=>$value) {
198
+                $pricelist_arr[$value['pricelist_id']]['account'] = $value['cnt'];
199 199
              }
200 200
             }
201 201
             //Get count of routes which are using selected rategroups.
202 202
             $this->db->where('pricelist_id '.$where);
203 203
             $this->db->select('count(id) as cnt,pricelist_id');
204 204
             $this->db->group_by('pricelist_id');
205
-            $routes_res=$this->db->get('routes');
206
-            if($routes_res->num_rows() > 0){
207
-             $routes_res=$routes_res->result_array();
208
-             foreach($routes_res as $key=>$value){
209
-                $pricelist_arr[$value['pricelist_id']]['routes']=$value['cnt'];
205
+            $routes_res = $this->db->get('routes');
206
+            if ($routes_res->num_rows() > 0) {
207
+             $routes_res = $routes_res->result_array();
208
+             foreach ($routes_res as $key=>$value) {
209
+                $pricelist_arr[$value['pricelist_id']]['routes'] = $value['cnt'];
210 210
              }
211 211
             }
212
-            $str=null;
213
-            foreach($pricelist_arr as $key=>$value){
214
-               $custom_str=null;
215
-               if(isset($value['account']) || isset($value['routes'])){
216
-                 if(isset($value['account'])){
217
-                     $custom_str.= $value['account']." accounts and ";
212
+            $str = null;
213
+            foreach ($pricelist_arr as $key=>$value) {
214
+               $custom_str = null;
215
+               if (isset($value['account']) || isset($value['routes'])) {
216
+                 if (isset($value['account'])) {
217
+                     $custom_str .= $value['account']." accounts and ";
218 218
                  }
219
-                 if(isset($value['routes'])){
220
-                     $custom_str.= $value['routes']." origination rates and ";
219
+                 if (isset($value['routes'])) {
220
+                     $custom_str .= $value['routes']." origination rates and ";
221 221
                  }
222
-                 $str.=" Rate group Name : ".$value['name']." using by ".rtrim($custom_str," and ")."\n";
222
+                 $str .= " Rate group Name : ".$value['name']." using by ".rtrim($custom_str, " and ")."\n";
223 223
                }
224 224
             }
225
-            if(!empty($str)){
226
-                $data['str']=$str;
225
+            if ( ! empty($str)) {
226
+                $data['str'] = $str;
227 227
             }    
228
-            $data['selected_ids']=$add_array['selected_ids'];
228
+            $data['selected_ids'] = $add_array['selected_ids'];
229 229
             echo json_encode($data);
230 230
         }
231 231
     }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/pricing/libraries/pricing_form.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if ( ! defined('BASEPATH'))
25 25
     exit('No direct script access allowed');
26 26
 
27 27
 class pricing_form {
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
         $this->CI = & get_instance();
30 30
     }
31 31
     function get_pricing_form_fields() {
32
-	$form['forms'] = array(base_url() . 'pricing/price_save/', array('id' => 'pricing_form', 'method' => 'POST', 'name' => 'pricing_form'));
32
+	$form['forms'] = array(base_url().'pricing/price_save/', array('id' => 'pricing_form', 'method' => 'POST', 'name' => 'pricing_form'));
33 33
         if ($this->CI->session->userdata('logintype') == 1 || $this->CI->session->userdata('logintype') == 5) {
34 34
 	    $form['Rate Group Information'] = array(
35 35
 		array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
36 36
 		array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''),
37
-		array('Name', 'INPUT', array('name' => 'name', 'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
37
+		array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
38 38
 		array('Routing Type', 'routing_type', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_routetype'),
39 39
 		array('Initial Increment', 'INPUT', array('name' => 'initially_increment', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
40
-		array('Default Increment', 'INPUT', array('name' => 'inc', 'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
41
-		array('Markup(%)', 'INPUT', array('name' => 'markup', 'value' => "0" ,  'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
40
+		array('Default Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
41
+		array('Markup(%)', 'INPUT', array('name' => 'markup', 'value' => "0", 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
42 42
 		array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
43 43
 	    );
44 44
 	}
45
-	else{
45
+	else {
46 46
 	  $form['Rate Group Information'] = array(
47 47
 		array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
48 48
 		array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''),
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 		array('Routing Type', 'routing_type', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_routetype'),
51 51
 		array('Initial Increment', 'INPUT', array('name' => 'initially_increment', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
52 52
 		array('Default Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
53
-		array('Markup(%)', 'INPUT', array('name' => 'markup', 'value' => "0" , 'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
54
-		array('Trunks','trunk_id', 'SELECT', '','', 'tOOL TIP', 'Please Select Trunks', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status <" => "2"), 'multi'),
53
+		array('Markup(%)', 'INPUT', array('name' => 'markup', 'value' => "0", 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
54
+		array('Trunks', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Select Trunks', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status <" => "2"), 'multi'),
55 55
 		array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
56 56
 		  );
57 57
 	}
@@ -87,21 +87,21 @@  discard block
 block discarded – undo
87 87
             */
88 88
     function build_pricing_list_for_admin() {
89 89
         // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
90
-        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
90
+        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
91 91
 /**
92 92
 ASTPP  3.0 
93 93
 For Rategroup edit on Name
94 94
 **/
95
-            array(gettext("Name"), "110", "name", "", "", "","EDITABLE","true","center"),
95
+            array(gettext("Name"), "110", "name", "", "", "", "EDITABLE", "true", "center"),
96 96
 /***************************************/
97 97
             array(gettext("Routing Type"), "120", "routing_type", "routing_type", "routing_type", "get_routetype"),
98
-	    array(gettext("Initial Increment"), "140", "initially_increment", "", "", "","","true","center"),
99
-            array("Default Increment", "140", "inc", "", "", "","","true","center"),
100
-            array(gettext("Markup(%)"), "100", "markup", "", "", "","","true","center"),
101
-	    array(gettext("Rate Count"), "100", "id", "pricelist_id", "routes", "get_field_count","","true","center"),
102
-            array(gettext("Status"), "110", "status", "id", "pricelists", "get_status","","true","center"),
103
-            array(gettext("Created Date"), "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
104
-            array(gettext("Modified Date"), "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
98
+	    array(gettext("Initial Increment"), "140", "initially_increment", "", "", "", "", "true", "center"),
99
+            array("Default Increment", "140", "inc", "", "", "", "", "true", "center"),
100
+            array(gettext("Markup(%)"), "100", "markup", "", "", "", "", "true", "center"),
101
+	    array(gettext("Rate Count"), "100", "id", "pricelist_id", "routes", "get_field_count", "", "true", "center"),
102
+            array(gettext("Status"), "110", "status", "id", "pricelists", "get_status", "", "true", "center"),
103
+            array(gettext("Created Date"), "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"),
104
+            array(gettext("Modified Date"), "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
105 105
             array("Action", "150", "", "", "", array("EDIT" => array("url" => "pricing/price_edit/", "mode" => "popup"),
106 106
 
107 107
                     "DELETE" => array("url" => "pricing/price_delete/", "mode" => "single")))
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
     }
111 111
 
112 112
     function build_grid_buttons() {
113
-        $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn" ,"fa fa-plus-circle fa-lg", "button_action", "/pricing/price_add/", "popup"),
114
-            array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/pricing/price_delete_multiple/")
113
+        $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/pricing/price_add/", "popup"),
114
+            array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/pricing/price_delete_multiple/")
115 115
             ));
116 116
         return $buttons_json;
117 117
     }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/pricing/models/pricing_model.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         /*
50 50
         ASTPP  3.0  Add Rategroup add creation date.
51 51
         */
52
-        $add_array['creation_date']=gmdate("Y-m-d H:i:s");
52
+        $add_array['creation_date'] = gmdate("Y-m-d H:i:s");
53 53
         /************************************/
54 54
         if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
55 55
             $account_data = $this->session->userdata("accountinfo");
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         /*
68 68
         ASTPP  3.0  Edit Rategroup time update last mofied date.
69 69
         */
70
-        $data['last_modified_date']=gmdate("Y-m-d H:i:s");
70
+        $data['last_modified_date'] = gmdate("Y-m-d H:i:s");
71 71
         /*********************************************************/
72 72
         $this->db->where("id", $id);
73 73
         $this->db->update("pricelists", $data);
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/login/controllers/login.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -31,23 +31,23 @@  discard block
 block discarded – undo
31 31
         $this->load->model('db_model');
32 32
     }
33 33
     
34
-    function set_lang_global($post=false){ 
35
-	if(!is_array($post)){
36
-		$str=trim($post);
37
-		$new_arr[$str]=$str;
38
-		$post=$new_arr;
34
+    function set_lang_global($post = false) { 
35
+	if ( ! is_array($post)) {
36
+		$str = trim($post);
37
+		$new_arr[$str] = $str;
38
+		$post = $new_arr;
39 39
 	}
40
-	if(isset($post['fr_FR'])){
41
-	 $language=$post['fr_FR'];
40
+	if (isset($post['fr_FR'])) {
41
+	 $language = $post['fr_FR'];
42 42
 	 $this->session->set_userdata('user_language', $language);
43 43
 	}
44
-	if(isset($post['es_ES'])){
45
-	 $language=$post['es_ES'];
44
+	if (isset($post['es_ES'])) {
45
+	 $language = $post['es_ES'];
46 46
 	 $this->session->set_userdata('user_language', $language);         
47 47
 	}       
48
-	if(isset($post['en_EN'])){
49
-	 $language=$post['en_EN'];
50
-	 $this->session->unset_userdata('user_language',$language);
48
+	if (isset($post['en_EN'])) {
49
+	 $language = $post['en_EN'];
50
+	 $this->session->unset_userdata('user_language', $language);
51 51
 	} 
52 52
 	$this->locale->set_lang();
53 53
 	return true;
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 
56 56
     function index() {
57 57
         if ($this->session->userdata('user_login') == FALSE) {
58
-            if (!empty($_POST) && trim($_POST['username']) != '' && trim($_POST['password']) != '') {
59
-	        $_POST['password']=$this->common->encode($_POST['password']);
58
+            if ( ! empty($_POST) && trim($_POST['username']) != '' && trim($_POST['password']) != '') {
59
+	        $_POST['password'] = $this->common->encode($_POST['password']);
60 60
                 $user_valid = $this->Auth_model->verify_login($_POST['username'], $_POST['password']);
61 61
                 
62 62
                 if ($user_valid == 1) {
63 63
                     $this->session->set_userdata('user_login', TRUE);
64 64
 		    $where = "number = '".$this->db->escape_str($_POST['username'])."' OR email = '".$this->db->escape_str($_POST['username'])."'";
65
-                    $result = $this->db_model->getSelect("*", "accounts",$where);
65
+                    $result = $this->db_model->getSelect("*", "accounts", $where);
66 66
                     $result = $result->result_array();
67 67
                     $result = $result[0];
68
-                     $logintype=$result['type']== -1 ? 2: $result['type'];
68
+                     $logintype = $result['type'] == -1 ? 2 : $result['type'];
69 69
                     $this->session->set_userdata('logintype', $logintype);
70 70
                     $this->session->set_userdata('userlevel_logintype', $result['type']);
71 71
                     $this->session->set_userdata('username', $_POST['username']);
@@ -76,40 +76,40 @@  discard block
 block discarded – undo
76 76
 		*
77 77
 		*/
78 78
 		$this->db->select("*");
79
-		if($result['type'] == '2' || $result['type'] == '-1'){
79
+		if ($result['type'] == '2' || $result['type'] == '-1') {
80 80
 			$this->db->where(array("accountid"=>$result["id"]));
81
-		}else if($result['type'] == '0'){
82
-			if($result['reseller_id'] == 0){
81
+		} else if ($result['type'] == '0') {
82
+			if ($result['reseller_id'] == 0) {
83 83
 				$this->db->where(array("accountid"=>"1"));
84
-			}else{
84
+			} else {
85 85
 				$this->db->where(array("accountid"=>$result["reseller_id"]));
86 86
 			}
87
-		}else if($result['type'] == '1'){
88
-			if($result['reseller_id'] == 0){
89
-				$result_invoice = $this->common->get_field_name('id','invoice_conf', array("accountid" => $result['id']));
87
+		} else if ($result['type'] == '1') {
88
+			if ($result['reseller_id'] == 0) {
89
+				$result_invoice = $this->common->get_field_name('id', 'invoice_conf', array("accountid" => $result['id']));
90 90
 				
91
-				if($result_invoice){
91
+				if ($result_invoice) {
92 92
 					$this->db->where(array("accountid"=>$result["id"]));
93
-				}else{
93
+				} else {
94 94
 					$this->db->where(array("accountid"=>"1"));
95 95
 				}
96 96
 				
97
-			}else{
98
-				$result_invoice = $this->common->get_field_name('id','invoice_conf', array("accountid" => $result['reseller_id']));
99
-				if($result_invoice){
97
+			} else {
98
+				$result_invoice = $this->common->get_field_name('id', 'invoice_conf', array("accountid" => $result['reseller_id']));
99
+				if ($result_invoice) {
100 100
 					$this->db->where(array("accountid"=>$result["reseller_id"]));
101
-				}else{
101
+				} else {
102 102
 					$this->db->where(array("accountid"=>"1"));
103 103
 				}
104 104
 			}
105
-		}else {
105
+		} else {
106 106
 			$this->db->where(array("accountid"=>"1"));
107 107
 		}
108 108
 		$res = $this->db->get("invoice_conf");
109 109
 		$logo_arr = $res->result();
110
-	$data['user_logo'] = (isset($logo_arr[0]->logo) && $logo_arr[0]->logo != "" ) ? $logo_arr[0]->accountid."_".$logo_arr[0]->logo:"logo.png" ;
111
-		$data['user_header'] = (isset($logo_arr[0]->website_title) && $logo_arr[0]->website_title != "" ) ? $logo_arr[0]->website_title:"ASTPP - Open Source Voip Billing Solution" ;
112
-		$data['user_footer'] = (isset($logo_arr[0]->website_footer) && $logo_arr[0]->website_footer != "" ) ? $logo_arr[0]->website_footer:"Inextrix Technologies Pvt. Ltd All Rights Reserved." ;
110
+	$data['user_logo'] = (isset($logo_arr[0]->logo) && $logo_arr[0]->logo != "") ? $logo_arr[0]->accountid."_".$logo_arr[0]->logo : "logo.png";
111
+		$data['user_header'] = (isset($logo_arr[0]->website_title) && $logo_arr[0]->website_title != "") ? $logo_arr[0]->website_title : "ASTPP - Open Source Voip Billing Solution";
112
+		$data['user_footer'] = (isset($logo_arr[0]->website_footer) && $logo_arr[0]->website_footer != "") ? $logo_arr[0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved.";
113 113
 		$this->session->set_userdata('user_logo', $data['user_logo']);
114 114
 		$this->session->set_userdata('user_header', $data['user_header']);
115 115
 		$this->session->set_userdata('user_footer', $data['user_footer']);
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
                     if ($result['type'] == 0 || $result['type'] == 1) {
119 119
                         $menu_list = $this->permission->get_module_access($result['type']);
120 120
                         $this->session->set_userdata('mode_cur', 'user');
121
-                        if($result['type'] == 1){
122
-                            redirect(base_url() . 'dashboard/');
123
-                        }else{
124
-                            redirect(base_url() . 'user/user/');
121
+                        if ($result['type'] == 1) {
122
+                            redirect(base_url().'dashboard/');
123
+                        } else {
124
+                            redirect(base_url().'user/user/');
125 125
                         }
126 126
                     } else {
127 127
                         $menu_list = $this->permission->get_module_access($result['type']);
128 128
                         $this->session->set_userdata('mode_cur', 'admin');
129
-                        redirect(base_url() . 'dashboard/');
129
+                        redirect(base_url().'dashboard/');
130 130
                     }
131 131
                 } else {
132 132
 		   
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 	$this->db->where(array("domain"=>$_SERVER["HTTP_HOST"]));
141 141
 	$res = $this->db->get("invoice_conf");
142 142
 	$logo_arr = $res->result();
143
-	$data['user_logo'] = (isset($logo_arr[0]->logo) && $logo_arr[0]->logo != "" ) ? $logo_arr[0]->accountid."_".$logo_arr[0]->logo:"logo.png" ;
144
-	$data['website_header'] = (isset($logo_arr[0]->website_title) && $logo_arr[0]->website_title != "" ) ? $logo_arr[0]->website_title:"ASTPP - Open Source Voip Billing Solution" ;
145
-	$data['website_footer'] = (isset($logo_arr[0]->website_footer) && $logo_arr[0]->website_footer != "" ) ? $logo_arr[0]->website_footer:"Inextrix Technologies Pvt. Ltd All Rights Reserved." ;
143
+	$data['user_logo'] = (isset($logo_arr[0]->logo) && $logo_arr[0]->logo != "") ? $logo_arr[0]->accountid."_".$logo_arr[0]->logo : "logo.png";
144
+	$data['website_header'] = (isset($logo_arr[0]->website_title) && $logo_arr[0]->website_title != "") ? $logo_arr[0]->website_title : "ASTPP - Open Source Voip Billing Solution";
145
+	$data['website_footer'] = (isset($logo_arr[0]->website_footer) && $logo_arr[0]->website_footer != "") ? $logo_arr[0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved.";
146 146
 	$this->session->set_userdata('user_logo', $data['user_logo']);
147 147
 	$this->session->set_userdata('user_header', $data['website_header']);
148 148
 	$this->session->set_userdata('user_footer', $data['website_footer']);
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
             $this->session->set_userdata('user_login', FALSE);
152 152
             $data['app_name'] = 'ASTPP - Open Source Billing Solution';
153 153
             $this->load->view('view_login', $data);
154
-        }else {
154
+        } else {
155 155
 	/*
156 156
 	*
157 157
 	* Purpose : Display logo based on domain name
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 		  $logo_arr = $res->result();
164 164
 //print_r( $logo_arr );exit;
165 165
 
166
-	$data['user_logo'] = (isset($logo_arr[0]->logo) && $logo_arr[0]->logo != "" ) ? $logo_arr[0]->accountid."_".$logo_arr[0]->logo:"logo.png" ;
167
-		 $data['user_header'] = (isset($logo_arr[0]->website_title) && $logo_arr[0]->website_title != "" ) ? $logo_arr[0]->website_title:"ASTPP - Open Source Voip Billing Solution" ;
168
- $data['user_footer'] = (isset($logo_arr[0]->website_footer) && $logo_arr[0]->website_footer != "" ) ? $logo_arr[0]->website_footer:"Inextrix Technologies Pvt. Ltd All Rights Reserved." ;
166
+	$data['user_logo'] = (isset($logo_arr[0]->logo) && $logo_arr[0]->logo != "") ? $logo_arr[0]->accountid."_".$logo_arr[0]->logo : "logo.png";
167
+		 $data['user_header'] = (isset($logo_arr[0]->website_title) && $logo_arr[0]->website_title != "") ? $logo_arr[0]->website_title : "ASTPP - Open Source Voip Billing Solution";
168
+ $data['user_footer'] = (isset($logo_arr[0]->website_footer) && $logo_arr[0]->website_footer != "") ? $logo_arr[0]->website_footer : "Inextrix Technologies Pvt. Ltd All Rights Reserved.";
169 169
 		
170 170
 		$this->session->set_userdata('user_logo', $data['user_logo']);
171 171
 		 $this->session->set_userdata('user_header', $data['user_header']);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	//              echo $data['user_logo'];exit;
174 174
 /***************************************************************************************/
175 175
 	    if ($this->session->userdata('logintype') == '2') {
176
-		redirect(base_url() . 'dashboard/');
176
+		redirect(base_url().'dashboard/');
177 177
 	    } else {
178 178
 		redirect(base_url().'user/user/');
179 179
 	    }
@@ -184,25 +184,25 @@  discard block
 block discarded – undo
184 184
         $this->session->sess_destroy();
185 185
         redirect(base_url());
186 186
     }
187
-  function paypal_response(){
188
-      if(count($_POST)>0)
187
+  function paypal_response() {
188
+      if (count($_POST) > 0)
189 189
       {
190
-        $response_arr=$_POST;
191
-	    $fp=fopen("/var/log/astpp/astpp_payment.log","w+");
190
+        $response_arr = $_POST;
191
+	    $fp = fopen("/var/log/astpp/astpp_payment.log", "w+");
192 192
     	$date = date("Y-m-d H:i:s");
193
-	    fwrite($fp,"====================".$date."===============================\n");
194
-	    foreach($response_arr as $key => $value){	  
195
-		    fwrite($fp,$key.":::>".$value."\n");
193
+	    fwrite($fp, "====================".$date."===============================\n");
194
+	    foreach ($response_arr as $key => $value) {	  
195
+		    fwrite($fp, $key.":::>".$value."\n");
196 196
 	    }
197 197
     	$payment_check = $this->db_model->countQuery("txn_id", "payments", array("txn_id" => $response_arr['txn_id']));
198
-        if( ($response_arr["payment_status"] == "Pending" || $response_arr["payment_status"] == "Complete" || $response_arr["payment_status"] == "Completed" ) && $payment_check == 0){
198
+        if (($response_arr["payment_status"] == "Pending" || $response_arr["payment_status"] == "Complete" || $response_arr["payment_status"] == "Completed") && $payment_check == 0) {
199 199
 
200
-            $paypal_tax = (array)$this->db->get_where("system", array("name" => "paypal_tax","group_title"=>"paypal"))->first_row();
201
-            $paypal_tax =$paypal_tax['value'];
200
+            $paypal_tax = (array)$this->db->get_where("system", array("name" => "paypal_tax", "group_title"=>"paypal"))->first_row();
201
+            $paypal_tax = $paypal_tax['value'];
202 202
             $balance_amt = $actual_amount = $response_arr["custom"];
203
-            $paypal_fee = (array)$this->db->get_where("system", array("name" => "paypal_fee","group_title"=>"paypal"))->first_row();
203
+            $paypal_fee = (array)$this->db->get_where("system", array("name" => "paypal_fee", "group_title"=>"paypal"))->first_row();
204 204
             $paypal_fee = $paypal_fee['value'];
205
-            $paypalfee = ($paypal_fee == 0)?'0':$response_arr["mc_gross"];
205
+            $paypalfee = ($paypal_fee == 0) ? '0' : $response_arr["mc_gross"];
206 206
             $account_data = (array)$this->db->get_where("accounts", array("id" => $response_arr["item_number"]))->first_row();
207 207
             $currency = (array)$this->db->get_where('currency', array("id"=>$account_data["currency_id"]))->first_row();
208 208
             $date = date('Y-m-d H:i:s');
@@ -216,35 +216,35 @@  discard block
 block discarded – undo
216 216
                 			"currency_rate"=>$currency["currencyrate"],
217 217
                 			"transaction_details"=>json_encode($response_arr),
218 218
                 			"date"=>$date);
219
-             $paymentid=$this->db->insert('payment_transaction',$payment_trans_array);
220
-    	     $parent_id =$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : '-1';
219
+             $paymentid = $this->db->insert('payment_transaction', $payment_trans_array);
220
+    	     $parent_id = $account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : '-1';
221 221
 	     $payment_arr = array("accountid"=> $response_arr["item_number"],
222
-	     		"payment_mode"=>"1","credit"=>$balance_amt,
222
+	     		"payment_mode"=>"1", "credit"=>$balance_amt,
223 223
 	    		"type"=>"PAYPAL",
224 224
 	    		"payment_by"=>$parent_id,
225 225
 	    		"notes"=>"Payment Made by Paypal on date:-".$date,
226 226
 	    		"paypalid"=>$paymentid,
227 227
 		    	"txn_id"=>$response_arr["txn_id"],
228
-		    	'payment_date'=>gmdate('Y-m-d H:i:s',strtotime($response_arr['payment_date'])));
228
+		    	'payment_date'=>gmdate('Y-m-d H:i:s', strtotime($response_arr['payment_date'])));
229 229
 	     $this->db->insert('payments', $payment_arr);
230 230
 	     $this->db->select('invoiceid');
231
-	     $this->db->order_by('id','desc');
231
+	     $this->db->order_by('id', 'desc');
232 232
 	     $this->db->limit(1);
233
- 	     $last_invoice_result=(array)$this->db->get('invoices')->first_row();
234
- 	     $last_invoice_ID=isset($last_invoice_result['invoiceid'] ) && $last_invoice_result['invoiceid'] > 0 ?$last_invoice_result['invoiceid'] : 1;
235
- 	     $reseller_id=$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : 0;
236
-	     $where="accountid IN ('".$reseller_id."','1')";
233
+ 	     $last_invoice_result = (array)$this->db->get('invoices')->first_row();
234
+ 	     $last_invoice_ID = isset($last_invoice_result['invoiceid']) && $last_invoice_result['invoiceid'] > 0 ? $last_invoice_result['invoiceid'] : 1;
235
+ 	     $reseller_id = $account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : 0;
236
+	     $where = "accountid IN ('".$reseller_id."','1')";
237 237
 	     $this->db->where($where);
238 238
 	     $this->db->select('*');
239 239
 	     $this->db->order_by('accountid', 'desc');
240 240
 	     $this->db->limit(1);
241 241
              $invoiceconf = $this->db->get('invoice_conf');
242 242
              $invoiceconf = (array)$invoiceconf->first_row();
243
-	     $invoice_prefix=$invoiceconf['invoice_prefix'];
243
+	     $invoice_prefix = $invoiceconf['invoice_prefix'];
244 244
 
245
-	     $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days"));  
246
-	     $invoice_id=$this->generate_receipt($account_data['id'],$balance_amt,$account_data,$last_invoice_ID+1,$invoice_prefix,$due_date);
247
-	     $details_insert=array(
245
+	     $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days"));  
246
+	     $invoice_id = $this->generate_receipt($account_data['id'], $balance_amt, $account_data, $last_invoice_ID + 1, $invoice_prefix, $due_date);
247
+	     $details_insert = array(
248 248
 			'created_date'=>$date,
249 249
 			'credit'=>$balance_amt,
250 250
 			'debit'=>'-',
@@ -254,34 +254,34 @@  discard block
 block discarded – undo
254 254
 			'description'=>"Payment Made by Paypal on date:-".$date,
255 255
 			'item_type'=>'PAYMENT',
256 256
 	  	        'before_balance'=>$account_data['balance'],
257
-			'after_balance'=>$account_data['balance']+$balance_amt,
257
+			'after_balance'=>$account_data['balance'] + $balance_amt,
258 258
 			);
259 259
 		$this->db->insert("invoice_details", $details_insert); 
260
-		$this->db_model->update_balance($balance_amt,$account_data["id"],"credit");            
261
-		if($parent_id > 0){
262
-		      $reseller_ids=$this->common->get_parent_info($parent_id,0);
263
-		      $reseller_ids=rtrim($reseller_ids,",");
264
-		      $reseller_arr=explode(",",$reseller_ids);
265
-		      if(!empty($reseller_arr)){
266
-			foreach($reseller_arr as $key=>$reseller_id){
260
+		$this->db_model->update_balance($balance_amt, $account_data["id"], "credit");            
261
+		if ($parent_id > 0) {
262
+		      $reseller_ids = $this->common->get_parent_info($parent_id, 0);
263
+		      $reseller_ids = rtrim($reseller_ids, ",");
264
+		      $reseller_arr = explode(",", $reseller_ids);
265
+		      if ( ! empty($reseller_arr)) {
266
+			foreach ($reseller_arr as $key=>$reseller_id) {
267 267
 			  $account_data = (array)$this->db->get_where("accounts", array("id" => $reseller_id))->first_row();
268 268
 			  $this->db->select('invoiceid');
269
-		          $this->db->order_by('id','desc');
269
+		          $this->db->order_by('id', 'desc');
270 270
 		          $this->db->limit(1);
271
- 	                  $last_invoice_result=(array)$this->db->get('invoices')->first_row();
272
- 	                  $last_invoice_ID=$last_invoice_result['invoiceid'];
273
- 	     		  $reseller_id=$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : 0;
274
-	                  $where="accountid IN ('".$reseller_id."','1')";
271
+ 	                  $last_invoice_result = (array)$this->db->get('invoices')->first_row();
272
+ 	                  $last_invoice_ID = $last_invoice_result['invoiceid'];
273
+ 	     		  $reseller_id = $account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : 0;
274
+	                  $where = "accountid IN ('".$reseller_id."','1')";
275 275
 	                  $this->db->where($where);
276 276
 		          $this->db->select('*');
277 277
 		          $this->db->order_by('accountid', 'desc');
278 278
 		          $this->db->limit(1);
279 279
 		          $invoiceconf = $this->db->get('invoice_conf');
280 280
 		          $invoiceconf = (array)$invoiceconf->first_row();
281
-	                  $invoice_prefix=$invoiceconf['invoice_prefix'];
282
-	     		  $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days"));
283
-	     		  $invoice_id=$this->generate_receipt($account_data['id'],$balance_amt,$account_data,$last_invoice_ID+1,$invoice_prefix,$due_date);
284
-			  $parent_id=$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : -1;
281
+	                  $invoice_prefix = $invoiceconf['invoice_prefix'];
282
+	     		  $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days"));
283
+	     		  $invoice_id = $this->generate_receipt($account_data['id'], $balance_amt, $account_data, $last_invoice_ID + 1, $invoice_prefix, $due_date);
284
+			  $parent_id = $account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : -1;
285 285
 			  $payment_arr = array("accountid"=> $account_data["id"],
286 286
 	     					"payment_mode"=>"1",
287 287
 	     					"credit"=>$balance_amt,
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
 	    					"notes"=>"Your account has been credited due to your customer account recharge done by paypal",
291 291
 				    		"paypalid"=>$paymentid,
292 292
 		    				"txn_id"=>$response_arr["txn_id"],
293
-		    				'payment_date'=>gmdate('Y-m-d H:i:s',strtotime($response_arr['payment_date'])));
293
+		    				'payment_date'=>gmdate('Y-m-d H:i:s', strtotime($response_arr['payment_date'])));
294 294
 	 	          $this->db->insert('payments', $payment_arr);
295
-			  $details_insert=array(
295
+			  $details_insert = array(
296 296
 				'created_date'=>$date,
297 297
 				'credit'=>$balance_amt,
298 298
 				'debit'=>'-',
@@ -302,26 +302,26 @@  discard block
 block discarded – undo
302 302
 				'description'=>"Your account has been credited due to your customer account recharge done by paypal",
303 303
 				'item_type'=>'PAYMENT',
304 304
 		  	        'before_balance'=>$account_data['balance'],
305
-				'after_balance'=>$account_data['balance']+$balance_amt,
305
+				'after_balance'=>$account_data['balance'] + $balance_amt,
306 306
 			   );
307 307
 		          $this->db->insert("invoice_details", $details_insert); 
308
-	          	  $this->db_model->update_balance($balance_amt,$account_data["id"],"credit");  			         
308
+	          	  $this->db_model->update_balance($balance_amt, $account_data["id"], "credit");  			         
309 309
 			}
310 310
 		      }
311 311
 		}
312
-		redirect(base_url() . 'user/user/');
312
+		redirect(base_url().'user/user/');
313 313
         }
314 314
       }         
315
-	redirect(base_url() . 'user/user/');
315
+	redirect(base_url().'user/user/');
316 316
     }
317
-    function generate_receipt($accountid,$amount,$accountinfo,$last_invoice_ID,$invoice_prefix,$due_date){
318
-		$invoice_data = array("accountid"=>$accountid,"invoice_prefix" =>$invoice_prefix,"invoiceid"=>'0000'.$last_invoice_ID,"reseller_id"=>$accountinfo['reseller_id'],"invoice_date"=>gmdate("Y-m-d H:i:s"),"from_date"=>  gmdate("Y-m-d H:i:s"),"to_date"=>gmdate("Y-m-d H:i:s"),"due_date"=>$due_date,"status"=>1,"balance"=>$accountinfo['balance'],"amount"=>$amount,"type"=>'R',"confirm"=>'1');            
319
-        $this->db->insert("invoices",$invoice_data);
317
+    function generate_receipt($accountid, $amount, $accountinfo, $last_invoice_ID, $invoice_prefix, $due_date) {
318
+		$invoice_data = array("accountid"=>$accountid, "invoice_prefix" =>$invoice_prefix, "invoiceid"=>'0000'.$last_invoice_ID, "reseller_id"=>$accountinfo['reseller_id'], "invoice_date"=>gmdate("Y-m-d H:i:s"), "from_date"=>  gmdate("Y-m-d H:i:s"), "to_date"=>gmdate("Y-m-d H:i:s"), "due_date"=>$due_date, "status"=>1, "balance"=>$accountinfo['balance'], "amount"=>$amount, "type"=>'R', "confirm"=>'1');            
319
+        $this->db->insert("invoices", $invoice_data);
320 320
         $invoiceid = $this->db->insert_id();    
321 321
         return  $invoiceid;  
322 322
     }
323 323
     
324
-    function get_language_text(){
324
+    function get_language_text() {
325 325
    // echo '<pre>'; print_r($_POST); exit;
326 326
       echo gettext($_POST['display']); 
327 327
  	}  
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/login/views/view_login.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
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
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
             <div class="row">
37 37
                    
38 38
                         <div class="col-md-4 col-md-offset-4">&nbsp;<span class="login_error">
39
-                        <?php if (isset($astpp_notification)){ ?>
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 "&nbsp;";
43 43
                     } ?>
44 44
                     </span></div> <br/>
Please login to merge, or discard this patch.