@@ -52,24 +52,24 @@ |
||
52 | 52 | <div class="col-md-12 no-padding color-three border_box"> |
53 | 53 | <div class="pull-left"> |
54 | 54 | <ul class="breadcrumb"> |
55 | - <?php $accountinfo=$this->session->userdata('accountinfo'); |
|
56 | - if($accountinfo['type']==1){ ?> |
|
57 | - <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li> |
|
58 | - <?php } else{ ?> |
|
55 | + <?php $accountinfo = $this->session->userdata('accountinfo'); |
|
56 | + if ($accountinfo['type'] == 1) { ?> |
|
57 | + <li><a href="<?= base_url()."user/user_myprofile/"; ?>">My Profile</a></li> |
|
58 | + <?php } else { ?> |
|
59 | 59 | <li><a href="#"><?php echo gettext('Billing')?></a></li> |
60 | 60 | <?php } |
61 | 61 | ?> |
62 | 62 | |
63 | 63 | <li class='active'> |
64 | - <a href="<?= base_url() . "user/user_invoices_list/"; ?>"> <?php echo gettext('Invoices')?> </a> |
|
64 | + <a href="<?= base_url()."user/user_invoices_list/"; ?>"> <?php echo gettext('Invoices')?> </a> |
|
65 | 65 | </li> |
66 | 66 | </ul> |
67 | 67 | </div> |
68 | - <?php if($accountinfo['type']==1) { ?> |
|
68 | + <?php if ($accountinfo['type'] == 1) { ?> |
|
69 | 69 | <div class="pull-right"> |
70 | 70 | <ul class="breadcrumb"> |
71 | 71 | <li class="active pull-right"> |
72 | - <a href="<?= base_url() . "user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
72 | + <a href="<?= base_url()."user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
73 | 73 | </ul> |
74 | 74 | </div> |
75 | 75 | <?php }?> |
@@ -43,24 +43,24 @@ |
||
43 | 43 | <div class="col-md-12 no-padding color-three border_box"> |
44 | 44 | <div class="pull-left"> |
45 | 45 | <ul class="breadcrumb"> |
46 | - <?php $accountinfo=$this->session->userdata('accountinfo'); |
|
47 | - if($accountinfo['type']==1){ ?> |
|
48 | - <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li> |
|
49 | - <?php } else{ ?> |
|
46 | + <?php $accountinfo = $this->session->userdata('accountinfo'); |
|
47 | + if ($accountinfo['type'] == 1) { ?> |
|
48 | + <li><a href="<?= base_url()."user/user_myprofile/"; ?>">My Profile</a></li> |
|
49 | + <?php } else { ?> |
|
50 | 50 | <li><a href="#"><?php echo gettext('Configuration')?></a></li> |
51 | 51 | <?php } |
52 | 52 | ?> |
53 | 53 | |
54 | 54 | <li class='active'> |
55 | - <a href="<?= base_url() . "user/user_animap_list/"; ?>"><?php echo gettext('Caller ID')?></a> |
|
55 | + <a href="<?= base_url()."user/user_animap_list/"; ?>"><?php echo gettext('Caller ID')?></a> |
|
56 | 56 | </li> |
57 | 57 | </ul> |
58 | 58 | </div> |
59 | - <?php if($accountinfo['type']==1) { ?> |
|
59 | + <?php if ($accountinfo['type'] == 1) { ?> |
|
60 | 60 | <div class="pull-right"> |
61 | 61 | <ul class="breadcrumb"> |
62 | 62 | <li class="active pull-right"> |
63 | - <a href="<?= base_url() . "user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
63 | + <a href="<?= base_url()."user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
64 | 64 | </ul> |
65 | 65 | </div> |
66 | 66 | <?php }?> |
@@ -110,8 +110,8 @@ |
||
110 | 110 | <div class="col-md-3"> |
111 | 111 | <label class="col-md-2" name="speed_dial" size="16"> |
112 | 112 | <?php if ($result[$i]['speed_num'] == $i) { |
113 | - //echo $result[$i]['number']; |
|
114 | - echo $speeddial[$i]; |
|
113 | + //echo $result[$i]['number']; |
|
114 | + echo $speeddial[$i]; |
|
115 | 115 | } ?> |
116 | 116 | </label> |
117 | 117 | </div> |
@@ -133,7 +133,7 @@ |
||
133 | 133 | </label> |
134 | 134 | </div> |
135 | 135 | <div class="col-md-3"> |
136 | - <input class="col-md-2 form-control" name="speed_dial_<?php echo $i; ?>" id="speed_dial_<?php echo $i; ?>" size="16" type="text" onkeypress="return isNumberKey(event)" value="<?php if (isset($speeddial[$i]) && !empty($speeddial[$i])) { |
|
136 | + <input class="col-md-2 form-control" name="speed_dial_<?php echo $i; ?>" id="speed_dial_<?php echo $i; ?>" size="16" type="text" onkeypress="return isNumberKey(event)" value="<?php if (isset($speeddial[$i]) && ! empty($speeddial[$i])) { |
|
137 | 137 | echo $speeddial[$i]; |
138 | 138 | } ?>"> |
139 | 139 | </div> |
@@ -31,22 +31,22 @@ |
||
31 | 31 | <div class="col-md-12 no-padding color-three border_box"> |
32 | 32 | <div class="pull-left"> |
33 | 33 | <ul class="breadcrumb"> |
34 | - <?php $accountinfo=$this->session->userdata('accountinfo'); |
|
35 | - if($accountinfo['type']==1){ ?> |
|
36 | - <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li> |
|
37 | - <?php } else{ ?> |
|
34 | + <?php $accountinfo = $this->session->userdata('accountinfo'); |
|
35 | + if ($accountinfo['type'] == 1) { ?> |
|
36 | + <li><a href="<?= base_url()."user/user_myprofile/"; ?>">My Profile</a></li> |
|
37 | + <?php } else { ?> |
|
38 | 38 | <li><a href="#"><?php echo gettext('Configuration')?></a></li> |
39 | 39 | <?php } ?> |
40 | 40 | <li class='active'> |
41 | - <a href="<?= base_url() . "user/user_alert_threshold/"; ?>"><?php echo gettext('Alert Threshold')?></a> |
|
41 | + <a href="<?= base_url()."user/user_alert_threshold/"; ?>"><?php echo gettext('Alert Threshold')?></a> |
|
42 | 42 | </li> |
43 | 43 | </ul> |
44 | 44 | </div> |
45 | - <?php if($accountinfo['type']==1) { ?> |
|
45 | + <?php if ($accountinfo['type'] == 1) { ?> |
|
46 | 46 | <div class="pull-right"> |
47 | 47 | <ul class="breadcrumb"> |
48 | 48 | <li class="active pull-right"> |
49 | - <a href="<?= base_url() . "user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
49 | + <a href="<?= base_url()."user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
50 | 50 | </ul> |
51 | 51 | </div> |
52 | 52 | <?php }?> |
@@ -27,24 +27,24 @@ |
||
27 | 27 | <div class="col-md-12 no-padding color-three border_box"> |
28 | 28 | <div class="pull-left"> |
29 | 29 | <ul class="breadcrumb"> |
30 | - <?php $accountinfo=$this->session->userdata('accountinfo'); |
|
31 | - if($accountinfo['type']==1){ ?> |
|
32 | - <li><a href="<?= base_url() . "user/user_myprofile/"; ?>">My Profile</a></li> |
|
33 | - <?php } else{ ?> |
|
30 | + <?php $accountinfo = $this->session->userdata('accountinfo'); |
|
31 | + if ($accountinfo['type'] == 1) { ?> |
|
32 | + <li><a href="<?= base_url()."user/user_myprofile/"; ?>">My Profile</a></li> |
|
33 | + <?php } else { ?> |
|
34 | 34 | <li><a href="#"><?php echo gettext('Configuration')?></a></li> |
35 | 35 | <?php } |
36 | 36 | ?> |
37 | 37 | |
38 | 38 | <li class='active'> |
39 | - <a href="<?= base_url() . "user/user_sipdevices/"; ?>"><?php echo gettext('SIP Devices')?></a> |
|
39 | + <a href="<?= base_url()."user/user_sipdevices/"; ?>"><?php echo gettext('SIP Devices')?></a> |
|
40 | 40 | </li> |
41 | 41 | </ul> |
42 | 42 | </div> |
43 | - <?php if($accountinfo['type']==1) { ?> |
|
43 | + <?php if ($accountinfo['type'] == 1) { ?> |
|
44 | 44 | <div class="pull-right"> |
45 | 45 | <ul class="breadcrumb"> |
46 | 46 | <li class="active pull-right"> |
47 | - <a href="<?= base_url() . "user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
47 | + <a href="<?= base_url()."user/user_myprofile/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
48 | 48 | </ul> |
49 | 49 | </div> |
50 | 50 | <?php }?> |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | class Db_model extends CI_Model { |
24 | 24 | function Db_model() { |
25 | 25 | // parent::Model(); |
26 | - parent::__construct (); |
|
27 | - $this->db->query ( "SET time_zone='+0:00'" ); |
|
26 | + parent::__construct(); |
|
27 | + $this->db->query("SET time_zone='+0:00'"); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /* |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | function getCriteria($condition = "", $tableName) { |
36 | 36 | // print_r($condition); |
37 | 37 | if ($condition != "") { |
38 | - $this->db->where ( $condition ); |
|
38 | + $this->db->where($condition); |
|
39 | 39 | } |
40 | - return $this->db->get ( $tableName ); |
|
40 | + return $this->db->get($tableName); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /* |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | * ******************************************************** |
47 | 47 | */ |
48 | 48 | function save($tableName, $arr, $val = 'false') { |
49 | - $str = $this->db->insert_string ( $tableName, $arr ); |
|
50 | - $rs = $this->db->query ( $str ); |
|
49 | + $str = $this->db->insert_string($tableName, $arr); |
|
50 | + $rs = $this->db->query($str); |
|
51 | 51 | if ($val == true) |
52 | - return $this->db->insert_id (); |
|
52 | + return $this->db->insert_id(); |
|
53 | 53 | else |
54 | 54 | return $rs; |
55 | 55 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * ******************************************************** |
61 | 61 | */ |
62 | 62 | function update($tableName, $arr, $where) { |
63 | - $str = $this->db->update_string ( $tableName, $arr, $where ); |
|
64 | - $rs = $this->db->query ( $str ); |
|
63 | + $str = $this->db->update_string($tableName, $arr, $where); |
|
64 | + $rs = $this->db->query($str); |
|
65 | 65 | return $rs; |
66 | 66 | } |
67 | 67 | |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | * ******************************************************** |
72 | 72 | */ |
73 | 73 | function getSelect($select, $tableName, $where) { |
74 | - $this->db->select ( $select, false ); |
|
75 | - $this->db->from ( $tableName ); |
|
74 | + $this->db->select($select, false); |
|
75 | + $this->db->from($tableName); |
|
76 | 76 | if ($where != '') { |
77 | - $this->db->where ( $where ); |
|
77 | + $this->db->where($where); |
|
78 | 78 | } |
79 | - $query = $this->db->get (); |
|
79 | + $query = $this->db->get(); |
|
80 | 80 | return $query; |
81 | 81 | } |
82 | 82 | |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | * ******************************************************** |
87 | 87 | */ |
88 | 88 | function getSelectWithOrder($select, $tableName, $where, $order_type, $order_by) { |
89 | - $this->db->select ( $select ); |
|
90 | - $this->db->from ( $tableName ); |
|
91 | - $this->db->where ( $where ); |
|
92 | - $this->db->order_by ( $order_by, $order_type ); |
|
93 | - $query = $this->db->get (); |
|
89 | + $this->db->select($select); |
|
90 | + $this->db->from($tableName); |
|
91 | + $this->db->where($where); |
|
92 | + $this->db->order_by($order_by, $order_type); |
|
93 | + $query = $this->db->get(); |
|
94 | 94 | return $query; |
95 | 95 | } |
96 | 96 | |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | * ******************************************************** |
101 | 101 | */ |
102 | 102 | function getSelectWithOrderAndLimit($select, $tableName, $where, $order_type, $order_by, $paging_limit) { |
103 | - $this->db->select ( $select ); |
|
104 | - $this->db->from ( $tableName ); |
|
105 | - $this->db->where ( $where ); |
|
106 | - $this->db->order_by ( $order_by, $order_type ); |
|
107 | - $this->db->limit ( $paging_limit ); |
|
108 | - $query = $this->db->get (); |
|
103 | + $this->db->select($select); |
|
104 | + $this->db->from($tableName); |
|
105 | + $this->db->where($where); |
|
106 | + $this->db->order_by($order_by, $order_type); |
|
107 | + $this->db->limit($paging_limit); |
|
108 | + $query = $this->db->get(); |
|
109 | 109 | return $query; |
110 | 110 | } |
111 | 111 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * ******************************************************** |
116 | 116 | */ |
117 | 117 | function delete($tableName, $where) { |
118 | - $this->db->where ( $where ); |
|
119 | - $this->db->delete ( $tableName ); |
|
118 | + $this->db->where($where); |
|
119 | + $this->db->delete($tableName); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /* |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * ******************************************************** |
126 | 126 | */ |
127 | 127 | function excecute($query) { |
128 | - $rs = $this->db->query ( $query ); |
|
128 | + $rs = $this->db->query($query); |
|
129 | 129 | return $rs; |
130 | 130 | } |
131 | 131 | |
@@ -135,23 +135,23 @@ discard block |
||
135 | 135 | * ******************************************************** |
136 | 136 | */ |
137 | 137 | function select($select, $tableName, $where, $order_by, $order_type, $paging_limit = '', $start_limit = '', $groupby = '') { |
138 | - $this->db->select ( $select ); |
|
139 | - $this->db->from ( $tableName ); |
|
138 | + $this->db->select($select); |
|
139 | + $this->db->from($tableName); |
|
140 | 140 | if ($where != "") { |
141 | - $this->db->where ( $where ); |
|
141 | + $this->db->where($where); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | if ($paging_limit) |
145 | - $this->db->limit ( $paging_limit, $start_limit ); |
|
146 | - if (! empty ( $groupby )) |
|
147 | - $this->db->group_by ( $groupby ); |
|
148 | - if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') { |
|
149 | - $this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] ); |
|
145 | + $this->db->limit($paging_limit, $start_limit); |
|
146 | + if ( ! empty ($groupby)) |
|
147 | + $this->db->group_by($groupby); |
|
148 | + if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') { |
|
149 | + $this->db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']); |
|
150 | 150 | } else { |
151 | 151 | if ($order_by) |
152 | - $this->db->order_by ( $order_by, $order_type ); |
|
152 | + $this->db->order_by($order_by, $order_type); |
|
153 | 153 | } |
154 | - $query = $this->db->get (); |
|
154 | + $query = $this->db->get(); |
|
155 | 155 | return $query; |
156 | 156 | } |
157 | 157 | |
@@ -161,18 +161,18 @@ discard block |
||
161 | 161 | * ******************************************************** |
162 | 162 | */ |
163 | 163 | function select_by_in($select, $tableName, $where, $order_by, $order_type, $paging_limit, $start_limit, $groupby = '', $key, $where_in) { |
164 | - $this->db->select ( $select ); |
|
165 | - $this->db->from ( $tableName ); |
|
164 | + $this->db->select($select); |
|
165 | + $this->db->from($tableName); |
|
166 | 166 | if ($where != "") { |
167 | - $this->db->where ( $where ); |
|
167 | + $this->db->where($where); |
|
168 | 168 | } |
169 | - $this->db->where_in ( $key, $where_in ); |
|
170 | - $this->db->order_by ( $order_by, $order_type ); |
|
169 | + $this->db->where_in($key, $where_in); |
|
170 | + $this->db->order_by($order_by, $order_type); |
|
171 | 171 | if ($paging_limit) |
172 | - $this->db->limit ( $paging_limit, $start_limit ); |
|
173 | - if (! empty ( $groupby )) |
|
174 | - $this->db->groupby ( $groupby ); |
|
175 | - $query = $this->db->get (); |
|
172 | + $this->db->limit($paging_limit, $start_limit); |
|
173 | + if ( ! empty ($groupby)) |
|
174 | + $this->db->groupby($groupby); |
|
175 | + $query = $this->db->get(); |
|
176 | 176 | |
177 | 177 | return $query; |
178 | 178 | } |
@@ -183,13 +183,13 @@ discard block |
||
183 | 183 | * ******************************************************** |
184 | 184 | */ |
185 | 185 | function countQuery($select, $table, $where = "") { |
186 | - $this->db->select ( $select ); |
|
186 | + $this->db->select($select); |
|
187 | 187 | if ($where != "") { |
188 | - $this->db->where ( $where ); |
|
188 | + $this->db->where($where); |
|
189 | 189 | } |
190 | - $this->db->from ( $table ); |
|
191 | - $query = $this->db->get (); |
|
192 | - return $query->num_rows (); |
|
190 | + $this->db->from($table); |
|
191 | + $query = $this->db->get(); |
|
192 | + return $query->num_rows(); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /* |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | * ******************************************************** |
199 | 199 | */ |
200 | 200 | function countQuery_by_in($select, $table, $where = "", $key, $where_in) { |
201 | - $this->db->select ( $select ); |
|
201 | + $this->db->select($select); |
|
202 | 202 | if ($where != "") { |
203 | - $this->db->where ( $where ); |
|
203 | + $this->db->where($where); |
|
204 | 204 | } |
205 | - if (! empty ( $where_in )) { |
|
206 | - $this->db->where_in ( $key, $where_in ); |
|
205 | + if ( ! empty ($where_in)) { |
|
206 | + $this->db->where_in($key, $where_in); |
|
207 | 207 | } |
208 | - $this->db->from ( $table ); |
|
209 | - $query = $this->db->get (); |
|
210 | - return $query->num_rows (); |
|
208 | + $this->db->from($table); |
|
209 | + $query = $this->db->get(); |
|
210 | + return $query->num_rows(); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /* |
@@ -216,14 +216,14 @@ discard block |
||
216 | 216 | * ******************************************************** |
217 | 217 | */ |
218 | 218 | function maxQuery($table, $select, $where = "", $name) { |
219 | - $this->db->select ( $select ); |
|
220 | - $this->db->from ( $table ); |
|
219 | + $this->db->select($select); |
|
220 | + $this->db->from($table); |
|
221 | 221 | if ($where != "") { |
222 | - $this->db->where ( $where ); |
|
222 | + $this->db->where($where); |
|
223 | 223 | } |
224 | - $query = $this->db->get (); |
|
225 | - if ($query->num_rows () > 0) { |
|
226 | - $rowP = $query->row (); |
|
224 | + $query = $this->db->get(); |
|
225 | + if ($query->num_rows() > 0) { |
|
226 | + $rowP = $query->row(); |
|
227 | 227 | return $rowP->$name; |
228 | 228 | } else { |
229 | 229 | return 0; |
@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | */ |
238 | 238 | function getCurrent($table, $feild, $where) { |
239 | 239 | // echo "<pre>table====><br>".$table."field====><br>".$feild."where====><br>".print_r($where); |
240 | - $this->db->select ( $feild ); |
|
241 | - $this->db->from ( $table ); |
|
242 | - $this->db->where ( $where ); |
|
243 | - $query = $this->db->get (); |
|
244 | - if ($query->num_rows () > 0) { |
|
240 | + $this->db->select($feild); |
|
241 | + $this->db->from($table); |
|
242 | + $this->db->where($where); |
|
243 | + $query = $this->db->get(); |
|
244 | + if ($query->num_rows() > 0) { |
|
245 | 245 | |
246 | - $rowP = $query->row (); |
|
246 | + $rowP = $query->row(); |
|
247 | 247 | return $rowP->$feild; |
248 | 248 | } else { |
249 | 249 | return false; |
@@ -256,101 +256,101 @@ discard block |
||
256 | 256 | * ******************************************************** |
257 | 257 | */ |
258 | 258 | function getJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') { |
259 | - $start = ( int ) $start; |
|
260 | - $end = ( int ) $end; |
|
261 | - $this->db->select ( $feild ); |
|
262 | - $this->db->from ( $table ); |
|
263 | - $this->db->join ( $jionTable, $jionCondition, $type ); |
|
259 | + $start = (int)$start; |
|
260 | + $end = (int)$end; |
|
261 | + $this->db->select($feild); |
|
262 | + $this->db->from($table); |
|
263 | + $this->db->join($jionTable, $jionCondition, $type); |
|
264 | 264 | if ($where != "") { |
265 | - $this->db->where ( $where ); |
|
265 | + $this->db->where($where); |
|
266 | 266 | } |
267 | - if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') { |
|
268 | - $this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] ); |
|
267 | + if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') { |
|
268 | + $this->db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']); |
|
269 | 269 | } else { |
270 | 270 | if ($order_by) |
271 | - $this->db->order_by ( $order_by, $order_type ); |
|
271 | + $this->db->order_by($order_by, $order_type); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | if ($group_by != '') { |
275 | - $this->db->group_by ( $group_by ); |
|
275 | + $this->db->group_by($group_by); |
|
276 | 276 | } |
277 | 277 | |
278 | - $this->db->limit ( $start, $end ); |
|
278 | + $this->db->limit($start, $end); |
|
279 | 279 | |
280 | - return $query = $this->db->get (); |
|
280 | + return $query = $this->db->get(); |
|
281 | 281 | } |
282 | 282 | function getJionQueryCount($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') { |
283 | - $start = ( int ) $start; |
|
284 | - $end = ( int ) $end; |
|
285 | - $this->db->select ( $feild ); |
|
286 | - $this->db->from ( $table ); |
|
287 | - $this->db->join ( $jionTable, $jionCondition, $type ); |
|
283 | + $start = (int)$start; |
|
284 | + $end = (int)$end; |
|
285 | + $this->db->select($feild); |
|
286 | + $this->db->from($table); |
|
287 | + $this->db->join($jionTable, $jionCondition, $type); |
|
288 | 288 | if ($where != "") { |
289 | - $this->db->where ( $where ); |
|
289 | + $this->db->where($where); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | if ($order_type != '' && $order_by != '') { |
293 | - $this->db->orderby ( $order_type, $order_by ); |
|
293 | + $this->db->orderby($order_type, $order_by); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | if ($group_by != '') { |
297 | - $this->db->group_by ( $group_by ); |
|
297 | + $this->db->group_by($group_by); |
|
298 | 298 | } |
299 | 299 | |
300 | - $query = $this->db->get (); |
|
301 | - return $query->num_rows (); |
|
300 | + $query = $this->db->get(); |
|
301 | + return $query->num_rows(); |
|
302 | 302 | } |
303 | 303 | function getAllJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type, $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') { |
304 | - $start = ( int ) $start; |
|
305 | - $end = ( int ) $end; |
|
306 | - $this->db->select ( $feild ); |
|
307 | - $this->db->from ( $table ); |
|
308 | - $jion_table_count = count ( $jionTable ); |
|
309 | - for($i = 0; $i < $jion_table_count; $i ++) { |
|
310 | - $this->db->join ( $jionTable [$i], $jionCondition [$i], $type [$i] ); |
|
304 | + $start = (int)$start; |
|
305 | + $end = (int)$end; |
|
306 | + $this->db->select($feild); |
|
307 | + $this->db->from($table); |
|
308 | + $jion_table_count = count($jionTable); |
|
309 | + for ($i = 0; $i < $jion_table_count; $i++) { |
|
310 | + $this->db->join($jionTable [$i], $jionCondition [$i], $type [$i]); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | if ($where != "") { |
314 | - $this->db->where ( $where ); |
|
314 | + $this->db->where($where); |
|
315 | 315 | } |
316 | - if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') { |
|
317 | - $this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] ); |
|
316 | + if (isset ($_GET ['sortname']) && $_GET ['sortname'] != 'undefined') { |
|
317 | + $this->db->order_by($_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder']); |
|
318 | 318 | } else { |
319 | 319 | if ($order_by) |
320 | - $this->db->order_by ( $order_by, $order_type ); |
|
320 | + $this->db->order_by($order_by, $order_type); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | if ($group_by != '') { |
324 | - $this->db->group_by ( $group_by ); |
|
324 | + $this->db->group_by($group_by); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | if ($start != '' && $end != '') { |
328 | - $this->db->limit ( $start, $end ); |
|
328 | + $this->db->limit($start, $end); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | if ($start != '' && $end == '') { |
332 | - $this->db->limit ( $start ); |
|
332 | + $this->db->limit($start); |
|
333 | 333 | } |
334 | 334 | |
335 | - return $query = $this->db->get (); |
|
335 | + return $query = $this->db->get(); |
|
336 | 336 | } |
337 | 337 | function getCountWithJion($table, $feild, $where = "", $jionTable, $jionCondition, $type, $group_by = '') { |
338 | - $this->db->select ( $feild ); |
|
339 | - $this->db->from ( $table ); |
|
340 | - $jion_table_count = count ( $jionTable ); |
|
341 | - for($i = 0; $i < $jion_table_count; $i ++) { |
|
342 | - $this->db->join ( $jionTable [$i], $jionCondition [$i], $type [$i] ); |
|
338 | + $this->db->select($feild); |
|
339 | + $this->db->from($table); |
|
340 | + $jion_table_count = count($jionTable); |
|
341 | + for ($i = 0; $i < $jion_table_count; $i++) { |
|
342 | + $this->db->join($jionTable [$i], $jionCondition [$i], $type [$i]); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | if ($where != "") { |
346 | - $this->db->where ( $where ); |
|
346 | + $this->db->where($where); |
|
347 | 347 | } |
348 | 348 | if ($group_by != '') { |
349 | - $this->db->group_by ( $group_by ); |
|
349 | + $this->db->group_by($group_by); |
|
350 | 350 | } |
351 | - $query = $this->db->get (); |
|
352 | - if ($query->num_rows () > 0) { |
|
353 | - return $query->num_rows (); |
|
351 | + $query = $this->db->get(); |
|
352 | + if ($query->num_rows() > 0) { |
|
353 | + return $query->num_rows(); |
|
354 | 354 | } else { |
355 | 355 | return false; |
356 | 356 | } |
@@ -362,16 +362,16 @@ discard block |
||
362 | 362 | * ******************************************************** |
363 | 363 | */ |
364 | 364 | function getCurrentWithOrder($table, $feild, $where, $order, $order_by, $limit, $option) { |
365 | - $this->db->select ( $feild ); |
|
366 | - $this->db->from ( $table ); |
|
367 | - $this->db->where ( $where ); |
|
368 | - $this->db->order_by ( $order, $order_by ); |
|
365 | + $this->db->select($feild); |
|
366 | + $this->db->from($table); |
|
367 | + $this->db->where($where); |
|
368 | + $this->db->order_by($order, $order_by); |
|
369 | 369 | if ($limit != 0) { |
370 | - $this->db->limit ( $limit ); |
|
370 | + $this->db->limit($limit); |
|
371 | 371 | } |
372 | - $query = $this->db->get (); |
|
373 | - if ($query->num_rows () > 0) { |
|
374 | - $rowP = $query->row (); |
|
372 | + $query = $this->db->get(); |
|
373 | + if ($query->num_rows() > 0) { |
|
374 | + $rowP = $query->row(); |
|
375 | 375 | if ($option == 'yes') { |
376 | 376 | return $rowP->$feild; |
377 | 377 | } else { |
@@ -392,12 +392,12 @@ discard block |
||
392 | 392 | * ******************************************************** |
393 | 393 | */ |
394 | 394 | function getAllWithOrder($table, $feild, $where) { |
395 | - $this->db->select ( $feild ); |
|
396 | - $this->db->from ( $table ); |
|
397 | - $this->db->where ( $where ); |
|
398 | - $query = $this->db->get (); |
|
399 | - if ($query->num_rows () > 0) { |
|
400 | - $rowP = $query->row (); |
|
395 | + $this->db->select($feild); |
|
396 | + $this->db->from($table); |
|
397 | + $this->db->where($where); |
|
398 | + $query = $this->db->get(); |
|
399 | + if ($query->num_rows() > 0) { |
|
400 | + $rowP = $query->row(); |
|
401 | 401 | return $rowP->$feild; |
402 | 402 | } else { |
403 | 403 | return false; |
@@ -405,20 +405,20 @@ discard block |
||
405 | 405 | } |
406 | 406 | function getCommaSperated($table, $select, $where, $limit, $return_message = FALSE, $message = '') { |
407 | 407 | if ($table != '') { |
408 | - $this->db->select ( $select ); |
|
409 | - $this->db->from ( $table ); |
|
410 | - $this->db->where ( $where ); |
|
408 | + $this->db->select($select); |
|
409 | + $this->db->from($table); |
|
410 | + $this->db->where($where); |
|
411 | 411 | if ($limit != 0) { |
412 | - $this->db->limit ( $limit ); |
|
412 | + $this->db->limit($limit); |
|
413 | 413 | } |
414 | - $query = $this->db->get (); |
|
414 | + $query = $this->db->get(); |
|
415 | 415 | $string = ''; |
416 | - if ($query->num_rows () > 0) { |
|
417 | - foreach ( $query->result () as $rows ) { |
|
418 | - $string .= $rows->$select . ','; |
|
416 | + if ($query->num_rows() > 0) { |
|
417 | + foreach ($query->result() as $rows) { |
|
418 | + $string .= $rows->$select.','; |
|
419 | 419 | } |
420 | 420 | |
421 | - return substr ( $string, '', - 1 ); |
|
421 | + return substr($string, '', - 1); |
|
422 | 422 | } else { |
423 | 423 | if ($return_message == FALSE) { |
424 | 424 | return ''; |
@@ -431,29 +431,29 @@ discard block |
||
431 | 431 | } |
432 | 432 | } |
433 | 433 | function build_concat_dropdown($select, $table, $id_where = '', $id_value = '') { |
434 | - $select_params = explode ( ',', $select ); |
|
435 | - if (isset ( $select_params [3] )) { |
|
434 | + $select_params = explode(',', $select); |
|
435 | + if (isset ($select_params [3])) { |
|
436 | 436 | $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' "; |
437 | 437 | } else { |
438 | 438 | $cnt_str = " $select_params[1],' (',$select_params[2],')' "; |
439 | 439 | } |
440 | - $select = $select_params [0] . ", concat($cnt_str) as $select_params[1] "; |
|
441 | - $logintype = $this->session->userdata ( 'logintype' ); |
|
440 | + $select = $select_params [0].", concat($cnt_str) as $select_params[1] "; |
|
441 | + $logintype = $this->session->userdata('logintype'); |
|
442 | 442 | if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') { |
443 | - $account_data = $this->session->userdata ( "accountinfo" ); |
|
443 | + $account_data = $this->session->userdata("accountinfo"); |
|
444 | 444 | $id_value ['reseller_id'] = $account_data ['id']; |
445 | 445 | } |
446 | - if (isset ( $id_value ['type'] ) && $id_value ['type'] == '0,3') { |
|
447 | - $twhere = "type IN (" . $id_value ["type"] . ")"; |
|
448 | - $this->db->where ( $twhere ); |
|
449 | - unset ( $id_value ['type'] ); |
|
446 | + if (isset ($id_value ['type']) && $id_value ['type'] == '0,3') { |
|
447 | + $twhere = "type IN (".$id_value ["type"].")"; |
|
448 | + $this->db->where($twhere); |
|
449 | + unset ($id_value ['type']); |
|
450 | 450 | } |
451 | 451 | $where = $id_value; |
452 | - $drp_array = $this->getSelect ( $select, $table, $where ); |
|
453 | - $drp_array = $drp_array->result (); |
|
452 | + $drp_array = $this->getSelect($select, $table, $where); |
|
453 | + $drp_array = $drp_array->result(); |
|
454 | 454 | |
455 | - $drp_list = array (); |
|
456 | - foreach ( $drp_array as $drp_value ) { |
|
455 | + $drp_list = array(); |
|
456 | + foreach ($drp_array as $drp_value) { |
|
457 | 457 | $drp_list [$drp_value->$select_params [0]] = $drp_value->$select_params [1]; |
458 | 458 | } |
459 | 459 | return $drp_list; |
@@ -465,27 +465,27 @@ discard block |
||
465 | 465 | * *** |
466 | 466 | */ |
467 | 467 | function build_concat_dropdown_refill_coupon($select, $table, $id_where = '', $id_value = '') { |
468 | - $select_params = explode ( ',', $select ); |
|
469 | - $account_data = $this->session->userdata ( "accountinfo" ); |
|
470 | - if (isset ( $select_params [3] )) { |
|
468 | + $select_params = explode(',', $select); |
|
469 | + $account_data = $this->session->userdata("accountinfo"); |
|
470 | + if (isset ($select_params [3])) { |
|
471 | 471 | $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' "; |
472 | 472 | } else { |
473 | 473 | $cnt_str = " $select_params[1],' (',$select_params[2],')' "; |
474 | 474 | } |
475 | - $select = $select_params [0] . ", concat($cnt_str) as $select_params[1] "; |
|
476 | - $logintype = $this->session->userdata ( 'logintype' ); |
|
475 | + $select = $select_params [0].", concat($cnt_str) as $select_params[1] "; |
|
476 | + $logintype = $this->session->userdata('logintype'); |
|
477 | 477 | if ($account_data ['type'] == 1 && $id_where == 'where_arr') { |
478 | 478 | $id_value ['reseller_id'] = $account_data ['id']; |
479 | 479 | } else { |
480 | - $this->db->or_where ( 'type', 3 ); |
|
480 | + $this->db->or_where('type', 3); |
|
481 | 481 | } |
482 | 482 | $where = $id_value; |
483 | - $this->db->where ( $where ); |
|
484 | - $drp_array = $this->getSelect ( $select, $table, '' ); |
|
485 | - $drp_array = $drp_array->result (); |
|
486 | - $drp_list = array (); |
|
483 | + $this->db->where($where); |
|
484 | + $drp_array = $this->getSelect($select, $table, ''); |
|
485 | + $drp_array = $drp_array->result(); |
|
486 | + $drp_list = array(); |
|
487 | 487 | // $drp_list[0] = 'Admin'; |
488 | - foreach ( $drp_array as $drp_value ) { |
|
488 | + foreach ($drp_array as $drp_value) { |
|
489 | 489 | $drp_list [$drp_value->$select_params [0]] = $drp_value->$select_params [1]; |
490 | 490 | } |
491 | 491 | return $drp_list; |
@@ -494,135 +494,135 @@ discard block |
||
494 | 494 | * ******************************** |
495 | 495 | */ |
496 | 496 | function build_concat_select_dropdown($select, $table, $id_where = '', $id_value = '') { |
497 | - $select_params = explode ( ',', $select ); |
|
498 | - if (isset ( $select_params [3] )) { |
|
497 | + $select_params = explode(',', $select); |
|
498 | + if (isset ($select_params [3])) { |
|
499 | 499 | $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' "; |
500 | 500 | } else { |
501 | 501 | $cnt_str = " $select_params[1],' (',$select_params[2],')' "; |
502 | 502 | } |
503 | - $select = $select_params [0] . ", concat($cnt_str) as $select_params[1] "; |
|
503 | + $select = $select_params [0].", concat($cnt_str) as $select_params[1] "; |
|
504 | 504 | $where = $id_value; |
505 | - $drp_array = $this->getSelect ( $select, $table, $id_value ); |
|
506 | - $drp_array = $drp_array->result (); |
|
505 | + $drp_array = $this->getSelect($select, $table, $id_value); |
|
506 | + $drp_array = $drp_array->result(); |
|
507 | 507 | |
508 | - $drp_list = array (); |
|
508 | + $drp_list = array(); |
|
509 | 509 | $drp_list [0] = "--Select--"; |
510 | - foreach ( $drp_array as $drp_value ) { |
|
510 | + foreach ($drp_array as $drp_value) { |
|
511 | 511 | $drp_list [$drp_value->$select_params [0]] = $drp_value->$select_params [1]; |
512 | 512 | } |
513 | 513 | return $drp_list; |
514 | 514 | } |
515 | 515 | function build_dropdown($select, $table, $id_where = '', $id_value = '') { |
516 | - $select_params = explode ( ',', $select ); |
|
516 | + $select_params = explode(',', $select); |
|
517 | 517 | $where = ''; |
518 | - if (isset ( $id_value ["type"] ) && $id_value ["type"] == "GLOBAL") { |
|
518 | + if (isset ($id_value ["type"]) && $id_value ["type"] == "GLOBAL") { |
|
519 | 519 | $where = "type IN ('0','3')"; |
520 | - $this->db->where ( $where ); |
|
521 | - unset ( $id_value ["type"] ); |
|
520 | + $this->db->where($where); |
|
521 | + unset ($id_value ["type"]); |
|
522 | 522 | } |
523 | 523 | if ($id_where != '' && $id_value != '') { |
524 | 524 | if ($id_where == 'group_by') { |
525 | - $this->db->group_by ( $id_value ); |
|
525 | + $this->db->group_by($id_value); |
|
526 | 526 | } else if ($id_where == "where_arr") { |
527 | - $logintype = $this->session->userdata ( 'logintype' ); |
|
528 | - if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr' && $this->db->field_exists ( 'reseller_id', $table )) { |
|
527 | + $logintype = $this->session->userdata('logintype'); |
|
528 | + if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr' && $this->db->field_exists('reseller_id', $table)) { |
|
529 | 529 | $id_value ['reseller_id'] = $this->session->userdata ["accountinfo"] ['id']; |
530 | 530 | } |
531 | 531 | $where = $id_value; |
532 | 532 | } else { |
533 | - $logintype = $this->session->userdata ( 'logintype' ); |
|
533 | + $logintype = $this->session->userdata('logintype'); |
|
534 | 534 | if (($logintype == 1 || $logintype == 5) && $id_where == 'reseller_id') { |
535 | - $account_data = $this->session->userdata ( "accountinfo" ); |
|
535 | + $account_data = $this->session->userdata("accountinfo"); |
|
536 | 536 | $id_value = $account_data ['id']; |
537 | 537 | } |
538 | - $where = array ( |
|
538 | + $where = array( |
|
539 | 539 | $id_where => $id_value |
540 | 540 | ); |
541 | 541 | } |
542 | 542 | } |
543 | 543 | |
544 | - $drp_array = $this->getSelect ( $select, $table, $where ); |
|
545 | - $drp_array = $drp_array->result (); |
|
544 | + $drp_array = $this->getSelect($select, $table, $where); |
|
545 | + $drp_array = $drp_array->result(); |
|
546 | 546 | |
547 | - $drp_list = array (); |
|
548 | - foreach ( $drp_array as $drp_value ) { |
|
547 | + $drp_list = array(); |
|
548 | + foreach ($drp_array as $drp_value) { |
|
549 | 549 | $drp_list [$drp_value->$select_params [0]] = $drp_value->$select_params [1]; |
550 | 550 | } |
551 | 551 | return $drp_list; |
552 | 552 | } |
553 | 553 | function build_dropdown_deleted($select, $table, $id_where = '', $id_value = '') { |
554 | - $select_params = explode ( ',', $select ); |
|
555 | - if (isset ( $id_value ["type"] )) { |
|
556 | - $where = $id_value ["type"] == "GLOBAL" ? "type IN ('0','3')" : "type IN (" . $id_value ["type"] . ")"; |
|
557 | - $this->db->where ( $where ); |
|
558 | - unset ( $id_value ["type"] ); |
|
554 | + $select_params = explode(',', $select); |
|
555 | + if (isset ($id_value ["type"])) { |
|
556 | + $where = $id_value ["type"] == "GLOBAL" ? "type IN ('0','3')" : "type IN (".$id_value ["type"].")"; |
|
557 | + $this->db->where($where); |
|
558 | + unset ($id_value ["type"]); |
|
559 | 559 | } |
560 | 560 | $where = ''; |
561 | 561 | if ($id_where != '' && $id_value != '') { |
562 | 562 | if ($id_where == 'group_by') { |
563 | - $this->db->group_by ( $id_value ); |
|
563 | + $this->db->group_by($id_value); |
|
564 | 564 | } else if ($id_where == "where_arr") { |
565 | - $logintype = $this->session->userdata ( 'logintype' ); |
|
565 | + $logintype = $this->session->userdata('logintype'); |
|
566 | 566 | if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') { |
567 | - $account_data = $this->session->userdata ( "accountinfo" ); |
|
567 | + $account_data = $this->session->userdata("accountinfo"); |
|
568 | 568 | $id_value ['reseller_id'] = $account_data ['id']; |
569 | 569 | } |
570 | 570 | $where = $id_value; |
571 | 571 | } else { |
572 | - $logintype = $this->session->userdata ( 'logintype' ); |
|
572 | + $logintype = $this->session->userdata('logintype'); |
|
573 | 573 | if (($logintype == 1 || $logintype == 5) && $id_where == 'reseller_id') { |
574 | - $account_data = $this->session->userdata ( "accountinfo" ); |
|
574 | + $account_data = $this->session->userdata("accountinfo"); |
|
575 | 575 | $id_value = $account_data ['id']; |
576 | 576 | } |
577 | - $where = array ( |
|
577 | + $where = array( |
|
578 | 578 | $id_where => $id_value |
579 | 579 | ); |
580 | 580 | } |
581 | 581 | } |
582 | 582 | |
583 | - $drp_array = $this->getSelect ( $select, $table, $where ); |
|
583 | + $drp_array = $this->getSelect($select, $table, $where); |
|
584 | 584 | |
585 | - $drp_array = $drp_array->result (); |
|
585 | + $drp_array = $drp_array->result(); |
|
586 | 586 | |
587 | - $name = explode ( "as", $select ); |
|
588 | - if (isset ( $name [3] )) { |
|
589 | - $name = trim ( $name [3] ); |
|
587 | + $name = explode("as", $select); |
|
588 | + if (isset ($name [3])) { |
|
589 | + $name = trim($name [3]); |
|
590 | 590 | } else { |
591 | - $name = trim ( $name [1] ); |
|
591 | + $name = trim($name [1]); |
|
592 | 592 | } |
593 | 593 | |
594 | - $drp_list = array (); |
|
595 | - $dele = array (); |
|
596 | - foreach ( $drp_array as $drp_value ) { |
|
597 | - $dele = explode ( "^", $drp_value->$name ); |
|
598 | - if (isset ( $dele [1] )) { |
|
599 | - $drp_list ['Deleted'] [$drp_value->$select_params [0]] = str_replace ( "^", "", $drp_value->$name ); |
|
594 | + $drp_list = array(); |
|
595 | + $dele = array(); |
|
596 | + foreach ($drp_array as $drp_value) { |
|
597 | + $dele = explode("^", $drp_value->$name); |
|
598 | + if (isset ($dele [1])) { |
|
599 | + $drp_list ['Deleted'] [$drp_value->$select_params [0]] = str_replace("^", "", $drp_value->$name); |
|
600 | 600 | } else { |
601 | 601 | $drp_list ['Active'] [$drp_value->$select_params [0]] = $drp_value->$name; |
602 | 602 | } |
603 | 603 | } |
604 | - ksort ( $drp_list ); |
|
604 | + ksort($drp_list); |
|
605 | 605 | return $drp_list; |
606 | 606 | } |
607 | 607 | function build_search($accounts_list_search) { |
608 | - if ($this->session->userdata ( 'advance_search' ) == 1) { |
|
609 | - $account_search = $this->session->userdata ( $accounts_list_search ); |
|
610 | - unset ( $account_search ["ajax_search"] ); |
|
611 | - unset ( $account_search ["advance_search"] ); |
|
608 | + if ($this->session->userdata('advance_search') == 1) { |
|
609 | + $account_search = $this->session->userdata($accounts_list_search); |
|
610 | + unset ($account_search ["ajax_search"]); |
|
611 | + unset ($account_search ["advance_search"]); |
|
612 | 612 | /* |
613 | 613 | * ASTPP 3.0 |
614 | 614 | * Display Records in |
615 | 615 | */ |
616 | - unset ( $account_search ['search_in'], $account_search ['time'] ); |
|
617 | - if (! empty ( $account_search )) { |
|
618 | - foreach ( $account_search as $key => $value ) { |
|
616 | + unset ($account_search ['search_in'], $account_search ['time']); |
|
617 | + if ( ! empty ($account_search)) { |
|
618 | + foreach ($account_search as $key => $value) { |
|
619 | 619 | if ($value != "") { |
620 | - if (is_array ( $value )) { |
|
621 | - if (array_key_exists ( $key . "-integer", $value )) { |
|
622 | - $this->get_interger_array ( $key, $value [$key . "-integer"], $value [$key] ); |
|
620 | + if (is_array($value)) { |
|
621 | + if (array_key_exists($key."-integer", $value)) { |
|
622 | + $this->get_interger_array($key, $value [$key."-integer"], $value [$key]); |
|
623 | 623 | } |
624 | - if (array_key_exists ( $key . "-string", $value )) { |
|
625 | - $this->get_string_array ( $key, $value [$key . "-string"], $value [$key] ); |
|
624 | + if (array_key_exists($key."-string", $value)) { |
|
625 | + $this->get_string_array($key, $value [$key."-string"], $value [$key]); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | /** |
@@ -633,10 +633,10 @@ discard block |
||
633 | 633 | /** |
634 | 634 | * ******************************************** |
635 | 635 | */ |
636 | - $this->get_date_array ( $key, $value ); |
|
636 | + $this->get_date_array($key, $value); |
|
637 | 637 | } |
638 | 638 | } else { |
639 | - $this->db->where ( $key, $value ); |
|
639 | + $this->db->where($key, $value); |
|
640 | 640 | } |
641 | 641 | } |
642 | 642 | } |
@@ -646,20 +646,20 @@ discard block |
||
646 | 646 | } |
647 | 647 | function get_date_array($field, $value) { |
648 | 648 | if ($value != '') { |
649 | - if (! empty ( $value [0] )) { |
|
649 | + if ( ! empty ($value [0])) { |
|
650 | 650 | if ($field == 'invoice_date') { |
651 | - $this->db->where ( $field . ' >= ', gmdate ( "Y-m-d", strtotime ( $value ['0'] ) ) . " 00:00:01" ); |
|
652 | - $this->db->where ( $field . ' <= ', gmdate ( "Y-m-d", strtotime ( $value ['0'] ) ) . " 23:59:59" ); |
|
651 | + $this->db->where($field.' >= ', gmdate("Y-m-d", strtotime($value ['0']))." 00:00:01"); |
|
652 | + $this->db->where($field.' <= ', gmdate("Y-m-d", strtotime($value ['0']))." 23:59:59"); |
|
653 | 653 | // ITPLATP 22_05_2017 |
654 | 654 | } else if ($field == 'to_date') { |
655 | - $this->db->where ( $field . ' <= ', gmdate ( "Y-m-d", strtotime ( $value ['0'] ) ) . " 23:59:59" ); |
|
655 | + $this->db->where($field.' <= ', gmdate("Y-m-d", strtotime($value ['0']))." 23:59:59"); |
|
656 | 656 | // end |
657 | 657 | } else { |
658 | - $this->db->where ( $field . ' >= ', gmdate ( 'Y-m-d H:i:s', strtotime ( $value [0] ) ) ); |
|
658 | + $this->db->where($field.' >= ', gmdate('Y-m-d H:i:s', strtotime($value [0]))); |
|
659 | 659 | } |
660 | 660 | } |
661 | - if (! empty ( $value [1] )) { |
|
662 | - $this->db->where ( $field . ' <= ', gmdate ( 'Y-m-d H:i:s', strtotime ( $value [1] ) ) ); |
|
661 | + if ( ! empty ($value [1])) { |
|
662 | + $this->db->where($field.' <= ', gmdate('Y-m-d H:i:s', strtotime($value [1]))); |
|
663 | 663 | } |
664 | 664 | } |
665 | 665 | } |
@@ -667,22 +667,22 @@ discard block |
||
667 | 667 | if ($search_array != '') { |
668 | 668 | switch ($value) { |
669 | 669 | case "1" : |
670 | - $this->db->where ( $field, $search_array ); |
|
670 | + $this->db->where($field, $search_array); |
|
671 | 671 | break; |
672 | 672 | case "2" : |
673 | - $this->db->where ( $field . ' <>', $search_array ); |
|
673 | + $this->db->where($field.' <>', $search_array); |
|
674 | 674 | break; |
675 | 675 | case "3" : |
676 | - $this->db->where ( $field . ' > ', $search_array ); |
|
676 | + $this->db->where($field.' > ', $search_array); |
|
677 | 677 | break; |
678 | 678 | case "4" : |
679 | - $this->db->where ( $field . ' < ', $search_array ); |
|
679 | + $this->db->where($field.' < ', $search_array); |
|
680 | 680 | break; |
681 | 681 | case "5" : |
682 | - $this->db->where ( $field . ' >= ', $search_array ); |
|
682 | + $this->db->where($field.' >= ', $search_array); |
|
683 | 683 | break; |
684 | 684 | case "6" : |
685 | - $this->db->where ( $field . ' <= ', $search_array ); |
|
685 | + $this->db->where($field.' <= ', $search_array); |
|
686 | 686 | break; |
687 | 687 | } |
688 | 688 | } |
@@ -691,36 +691,36 @@ discard block |
||
691 | 691 | if ($search_array != '') { |
692 | 692 | switch ($value) { |
693 | 693 | case "1" : |
694 | - $str1 = $field . " LIKE '%$search_array%'"; |
|
695 | - $this->db->where ( $str1 ); |
|
694 | + $str1 = $field." LIKE '%$search_array%'"; |
|
695 | + $this->db->where($str1); |
|
696 | 696 | break; |
697 | 697 | case "2" : |
698 | - $str1 = $field . " NOT LIKE '%$search_array%'"; |
|
699 | - $this->db->where ( $str1 ); |
|
698 | + $str1 = $field." NOT LIKE '%$search_array%'"; |
|
699 | + $this->db->where($str1); |
|
700 | 700 | break; |
701 | 701 | case "3" : |
702 | - $this->db->where ( $field, $search_array ); |
|
702 | + $this->db->where($field, $search_array); |
|
703 | 703 | break; |
704 | 704 | case "4" : |
705 | - $this->db->where ( $field . ' <>', $search_array ); |
|
705 | + $this->db->where($field.' <>', $search_array); |
|
706 | 706 | break; |
707 | 707 | case "5" : |
708 | 708 | if ($field == "pattern") { |
709 | - $str1 = $field . " LIKE '^" . $search_array . "%'"; |
|
710 | - $this->db->where ( $str1 ); |
|
709 | + $str1 = $field." LIKE '^".$search_array."%'"; |
|
710 | + $this->db->where($str1); |
|
711 | 711 | } else { |
712 | - $str1 = $field . " LIKE '" . $search_array . "%'"; |
|
713 | - $this->db->where ( $str1 ); |
|
712 | + $str1 = $field." LIKE '".$search_array."%'"; |
|
713 | + $this->db->where($str1); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | break; |
717 | 717 | case "6" : |
718 | 718 | if ($field == "pattern") { |
719 | - $str1 = $field . " LIKE '%" . $search_array . ".*'"; |
|
720 | - $this->db->where ( $str1 ); |
|
719 | + $str1 = $field." LIKE '%".$search_array.".*'"; |
|
720 | + $this->db->where($str1); |
|
721 | 721 | } else { |
722 | - $str1 = $field . " LIKE '%" . $search_array . "'"; |
|
723 | - $this->db->where ( $str1 ); |
|
722 | + $str1 = $field." LIKE '%".$search_array."'"; |
|
723 | + $this->db->where($str1); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | break; |
@@ -729,30 +729,30 @@ discard block |
||
729 | 729 | } |
730 | 730 | function build_search_string($accounts_list_search) { |
731 | 731 | $where = null; |
732 | - $search = $this->session->userdata ( $accounts_list_search ); |
|
733 | - if ($this->session->userdata ( 'advance_search' ) == 1) { |
|
734 | - $account_search = $this->session->userdata ( $accounts_list_search ); |
|
735 | - unset ( $account_search ["ajax_search"] ); |
|
736 | - unset ( $account_search ["advance_search"] ); |
|
737 | - if (! empty ( $account_search )) { |
|
738 | - foreach ( $account_search as $key => $value ) { |
|
732 | + $search = $this->session->userdata($accounts_list_search); |
|
733 | + if ($this->session->userdata('advance_search') == 1) { |
|
734 | + $account_search = $this->session->userdata($accounts_list_search); |
|
735 | + unset ($account_search ["ajax_search"]); |
|
736 | + unset ($account_search ["advance_search"]); |
|
737 | + if ( ! empty ($account_search)) { |
|
738 | + foreach ($account_search as $key => $value) { |
|
739 | 739 | if ($value != "") { |
740 | - if (is_array ( $value )) { |
|
741 | - if (array_key_exists ( $key . "-integer", $value )) { |
|
740 | + if (is_array($value)) { |
|
741 | + if (array_key_exists($key."-integer", $value)) { |
|
742 | 742 | $string = null; |
743 | - $string = $this->build_interger_where ( $key, $value [$key . "-integer"], $value [$key] ); |
|
743 | + $string = $this->build_interger_where($key, $value [$key."-integer"], $value [$key]); |
|
744 | 744 | if ($string) |
745 | 745 | $where .= "$string AND "; |
746 | 746 | } |
747 | - if (array_key_exists ( $key . "-string", $value )) { |
|
747 | + if (array_key_exists($key."-string", $value)) { |
|
748 | 748 | $string = null; |
749 | - $string = $this->build_string_where ( $key, $value [$key . "-string"], $value [$key] ); |
|
749 | + $string = $this->build_string_where($key, $value [$key."-string"], $value [$key]); |
|
750 | 750 | if ($string) |
751 | 751 | $where .= "$string AND "; |
752 | 752 | } |
753 | 753 | if ($key == 'callstart' || $key == 'date' || $key == 'log_time') { |
754 | 754 | $string = null; |
755 | - $string = $this->build_date_where ( $key, $value ); |
|
755 | + $string = $this->build_date_where($key, $value); |
|
756 | 756 | if ($string) |
757 | 757 | $where .= "$string AND "; |
758 | 758 | } |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | } |
764 | 764 | } |
765 | 765 | } |
766 | - $where = rtrim ( $where, " AND " ); |
|
766 | + $where = rtrim($where, " AND "); |
|
767 | 767 | return $where; |
768 | 768 | } |
769 | 769 | // This function using by reports module don't delete it |
@@ -785,16 +785,16 @@ discard block |
||
785 | 785 | break; |
786 | 786 | case "5" : |
787 | 787 | if ($field == "pattern") { |
788 | - $where = $field . " LIKE '^" . $search_array . "%'"; |
|
788 | + $where = $field." LIKE '^".$search_array."%'"; |
|
789 | 789 | } else { |
790 | - $where = $field . " LIKE '" . $search_array . "%'"; |
|
790 | + $where = $field." LIKE '".$search_array."%'"; |
|
791 | 791 | } |
792 | 792 | break; |
793 | 793 | case "6" : |
794 | 794 | if ($field == "pattern") { |
795 | - $str1 = $field . " LIKE '%" . $search_array . ".*'"; |
|
795 | + $str1 = $field." LIKE '%".$search_array.".*'"; |
|
796 | 796 | } else { |
797 | - $str1 = $field . " LIKE '%" . $search_array . "'"; |
|
797 | + $str1 = $field." LIKE '%".$search_array."'"; |
|
798 | 798 | } |
799 | 799 | break; |
800 | 800 | } |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | function build_interger_where($field, $value, $search_array) { |
805 | 805 | $where = null; |
806 | 806 | if ($search_array != '') { |
807 | - if (is_numeric ( $search_array )) { |
|
807 | + if (is_numeric($search_array)) { |
|
808 | 808 | switch ($value) { |
809 | 809 | case "1" : |
810 | 810 | $where = "$field = '$search_array'"; |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | break; |
827 | 827 | } |
828 | 828 | } else { |
829 | - $this->db->where ( "$field IS NULL" ); |
|
829 | + $this->db->where("$field IS NULL"); |
|
830 | 830 | $where = "$field IS NULL"; |
831 | 831 | } |
832 | 832 | } |
@@ -835,21 +835,21 @@ discard block |
||
835 | 835 | function build_date_where($field, $value) { |
836 | 836 | $where = null; |
837 | 837 | if ($value != '') { |
838 | - if (! empty ( $value [0] )) { |
|
838 | + if ( ! empty ($value [0])) { |
|
839 | 839 | $string = null; |
840 | 840 | $string = "$field >= '$value[0]'"; |
841 | 841 | if ($string) |
842 | - $where .= $string . " AND "; |
|
842 | + $where .= $string." AND "; |
|
843 | 843 | } |
844 | - if (! empty ( $value [1] )) { |
|
844 | + if ( ! empty ($value [1])) { |
|
845 | 845 | $string = null; |
846 | 846 | $string = "$field <= '$value[1]'"; |
847 | 847 | if ($string) |
848 | - $where .= $string . " AND "; |
|
848 | + $where .= $string." AND "; |
|
849 | 849 | } |
850 | 850 | } |
851 | 851 | if ($where) { |
852 | - $where = rtrim ( $where, " AND " ); |
|
852 | + $where = rtrim($where, " AND "); |
|
853 | 853 | } |
854 | 854 | return $where; |
855 | 855 | } |
@@ -862,19 +862,19 @@ discard block |
||
862 | 862 | function update_balance($amount, $accountid, $payment_type) { |
863 | 863 | if ($payment_type == "debit" || $payment_type == "0") { |
864 | 864 | |
865 | - $query = "update accounts set balance = IF(posttoexternal=1,balance+" . $amount . ",balance-" . $amount . ") where id ='" . $accountid . "'"; |
|
865 | + $query = "update accounts set balance = IF(posttoexternal=1,balance+".$amount.",balance-".$amount.") where id ='".$accountid."'"; |
|
866 | 866 | |
867 | - return $this->db->query ( $query ); |
|
867 | + return $this->db->query($query); |
|
868 | 868 | } else { |
869 | - $query = "update accounts set balance = IF(posttoexternal=1,balance-" . $amount . ",balance+" . $amount . ") where id ='" . $accountid . "'"; |
|
869 | + $query = "update accounts set balance = IF(posttoexternal=1,balance-".$amount.",balance+".$amount.") where id ='".$accountid."'"; |
|
870 | 870 | |
871 | - return $this->db->query ( $query ); |
|
871 | + return $this->db->query($query); |
|
872 | 872 | } |
873 | 873 | } |
874 | 874 | function build_batch_update_array($update_array) { |
875 | 875 | $updateflg = false; |
876 | - foreach ( $update_array as $key => $update_fields ) { |
|
877 | - if (is_array ( $update_fields )) { |
|
876 | + foreach ($update_array as $key => $update_fields) { |
|
877 | + if (is_array($update_fields)) { |
|
878 | 878 | switch ($update_fields ["operator"]) { |
879 | 879 | case "1" : |
880 | 880 | // $this->db->where($field, $search_array); |
@@ -882,21 +882,21 @@ discard block |
||
882 | 882 | case "2" : |
883 | 883 | if ($update_fields [$key] != '') { |
884 | 884 | $updateflg = true; |
885 | - $this->db->set ( $key, $update_fields [$key] ); |
|
885 | + $this->db->set($key, $update_fields [$key]); |
|
886 | 886 | } |
887 | 887 | break; |
888 | 888 | case "3" : |
889 | - $this->db->set ( $key, $key . "+" . $update_fields [$key], FALSE ); |
|
889 | + $this->db->set($key, $key."+".$update_fields [$key], FALSE); |
|
890 | 890 | $updateflg = true; |
891 | 891 | break; |
892 | 892 | case "4" : |
893 | - $this->db->set ( $key, $key . "-" . $update_fields [$key], FALSE ); |
|
893 | + $this->db->set($key, $key."-".$update_fields [$key], FALSE); |
|
894 | 894 | $updateflg = true; |
895 | 895 | break; |
896 | 896 | } |
897 | 897 | } else { |
898 | 898 | if ($update_fields != "") { |
899 | - $this->db->set ( $key, $update_fields ); |
|
899 | + $this->db->set($key, $update_fields); |
|
900 | 900 | $updateflg = true; |
901 | 901 | } |
902 | 902 | } |
@@ -904,21 +904,21 @@ discard block |
||
904 | 904 | return $updateflg; |
905 | 905 | } |
906 | 906 | function build_search_opensips($opensips_db_obj, $accounts_list_search) { |
907 | - if ($this->session->userdata ( 'advance_search' ) == 1) { |
|
908 | - $account_search = $this->session->userdata ( $accounts_list_search ); |
|
909 | - unset ( $account_search ["ajax_search"] ); |
|
910 | - unset ( $account_search ["advance_search"] ); |
|
911 | - foreach ( $account_search as $key => $value ) { |
|
907 | + if ($this->session->userdata('advance_search') == 1) { |
|
908 | + $account_search = $this->session->userdata($accounts_list_search); |
|
909 | + unset ($account_search ["ajax_search"]); |
|
910 | + unset ($account_search ["advance_search"]); |
|
911 | + foreach ($account_search as $key => $value) { |
|
912 | 912 | if ($value != "") { |
913 | - if (is_array ( $value )) { |
|
914 | - if (array_key_exists ( $key . "-integer", $value )) { |
|
915 | - $this->get_opensips_interger_array ( $opensips_db_obj, $key, $value [$key . "-integer"], $value [$key] ); |
|
913 | + if (is_array($value)) { |
|
914 | + if (array_key_exists($key."-integer", $value)) { |
|
915 | + $this->get_opensips_interger_array($opensips_db_obj, $key, $value [$key."-integer"], $value [$key]); |
|
916 | 916 | } |
917 | - if (array_key_exists ( $key . "-string", $value )) { |
|
918 | - $this->get_opensips_string_array ( $opensips_db_obj, $key, $value [$key . "-string"], $value [$key] ); |
|
917 | + if (array_key_exists($key."-string", $value)) { |
|
918 | + $this->get_opensips_string_array($opensips_db_obj, $key, $value [$key."-string"], $value [$key]); |
|
919 | 919 | } |
920 | 920 | } else { |
921 | - $opensips_db_obj->where ( $key, $value ); |
|
921 | + $opensips_db_obj->where($key, $value); |
|
922 | 922 | } |
923 | 923 | } |
924 | 924 | } |
@@ -928,22 +928,22 @@ discard block |
||
928 | 928 | if ($search_array != '') { |
929 | 929 | switch ($value) { |
930 | 930 | case "1" : |
931 | - $opensips_db_obj->where ( $field, $search_array ); |
|
931 | + $opensips_db_obj->where($field, $search_array); |
|
932 | 932 | break; |
933 | 933 | case "2" : |
934 | - $opensips_db_obj->where ( $field . ' <>', $search_array ); |
|
934 | + $opensips_db_obj->where($field.' <>', $search_array); |
|
935 | 935 | break; |
936 | 936 | case "3" : |
937 | - $opensips_db_obj->where ( $field . ' > ', $search_array ); |
|
937 | + $opensips_db_obj->where($field.' > ', $search_array); |
|
938 | 938 | break; |
939 | 939 | case "4" : |
940 | - $opensips_db_obj->where ( $field . ' < ', $search_array ); |
|
940 | + $opensips_db_obj->where($field.' < ', $search_array); |
|
941 | 941 | break; |
942 | 942 | case "5" : |
943 | - $opensips_db_obj->where ( $field . ' >= ', $search_array ); |
|
943 | + $opensips_db_obj->where($field.' >= ', $search_array); |
|
944 | 944 | break; |
945 | 945 | case "6" : |
946 | - $opensips_db_obj->where ( $field . ' <= ', $search_array ); |
|
946 | + $opensips_db_obj->where($field.' <= ', $search_array); |
|
947 | 947 | break; |
948 | 948 | } |
949 | 949 | } |
@@ -952,24 +952,24 @@ discard block |
||
952 | 952 | if ($search_array != '') { |
953 | 953 | switch ($value) { |
954 | 954 | case "1" : |
955 | - $opensips_db_obj->like ( $field, $search_array ); |
|
955 | + $opensips_db_obj->like($field, $search_array); |
|
956 | 956 | break; |
957 | 957 | case "2" : |
958 | - $opensips_db_obj->not_like ( $field, $search_array ); |
|
958 | + $opensips_db_obj->not_like($field, $search_array); |
|
959 | 959 | break; |
960 | 960 | case "3" : |
961 | - $opensips_db_obj->where ( $field, $search_array ); |
|
961 | + $opensips_db_obj->where($field, $search_array); |
|
962 | 962 | break; |
963 | 963 | case "4" : |
964 | - $opensips_db_obj->where ( $field . ' <>', $search_array ); |
|
964 | + $opensips_db_obj->where($field.' <>', $search_array); |
|
965 | 965 | break; |
966 | 966 | case "5" : |
967 | - $str1 = $field . " LIKE '" . $search_array . "%'"; |
|
968 | - $opensips_db_obj->where ( $str1 ); |
|
967 | + $str1 = $field." LIKE '".$search_array."%'"; |
|
968 | + $opensips_db_obj->where($str1); |
|
969 | 969 | break; |
970 | 970 | case "6" : |
971 | - $str1 = $field . " LIKE '%" . $search_array . "'"; |
|
972 | - $opensips_db_obj->where ( $str1 ); |
|
971 | + $str1 = $field." LIKE '%".$search_array."'"; |
|
972 | + $opensips_db_obj->where($str1); |
|
973 | 973 | break; |
974 | 974 | } |
975 | 975 | } |
@@ -978,24 +978,24 @@ discard block |
||
978 | 978 | * ******invoice changes ******** |
979 | 979 | */ |
980 | 980 | function build_dropdown_invoices($select, $table, $id_where = '', $id_value = '') { |
981 | - $select_params = explode ( ',', $select ); |
|
982 | - $select_params = explode ( ',', $select ); |
|
983 | - if (isset ( $select_params [3] )) { |
|
981 | + $select_params = explode(',', $select); |
|
982 | + $select_params = explode(',', $select); |
|
983 | + if (isset ($select_params [3])) { |
|
984 | 984 | $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' "; |
985 | 985 | } else { |
986 | 986 | $cnt_str = " $select_params[1],' (',$select_params[2],')' "; |
987 | 987 | } |
988 | - $select = $select_params [0] . ", concat($cnt_str) as $select_params[1] ," . $select_params [4]; |
|
989 | - $logintype = $this->session->userdata ( 'logintype' ); |
|
988 | + $select = $select_params [0].", concat($cnt_str) as $select_params[1] ,".$select_params [4]; |
|
989 | + $logintype = $this->session->userdata('logintype'); |
|
990 | 990 | if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') { |
991 | - $account_data = $this->session->userdata ( "accountinfo" ); |
|
991 | + $account_data = $this->session->userdata("accountinfo"); |
|
992 | 992 | $id_value ['reseller_id'] = $account_data ['id']; |
993 | 993 | } |
994 | 994 | $where = $id_value; |
995 | - $drp_array = $this->getSelect ( $select, $table, $where ); |
|
996 | - $drp_array = $drp_array->result (); |
|
997 | - $drp_list = array (); |
|
998 | - foreach ( $drp_array as $drp_value ) { |
|
995 | + $drp_array = $this->getSelect($select, $table, $where); |
|
996 | + $drp_array = $drp_array->result(); |
|
997 | + $drp_list = array(); |
|
998 | + foreach ($drp_array as $drp_value) { |
|
999 | 999 | if ($drp_value->type == 3) { |
1000 | 1000 | $drp_list ['Provider'] [$drp_value->id] = $drp_value->first_name; |
1001 | 1001 | } elseif ($drp_value->type == 1) { |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | $drp_list ['Customer'] [$drp_value->id] = $drp_value->first_name; |
1005 | 1005 | } |
1006 | 1006 | } |
1007 | - ksort ( $drp_list ); |
|
1007 | + ksort($drp_list); |
|
1008 | 1008 | return $drp_list; |
1009 | 1009 | } |
1010 | 1010 | } |
@@ -48,10 +48,11 @@ discard block |
||
48 | 48 | function save($tableName, $arr, $val = 'false') { |
49 | 49 | $str = $this->db->insert_string ( $tableName, $arr ); |
50 | 50 | $rs = $this->db->query ( $str ); |
51 | - if ($val == true) |
|
52 | - return $this->db->insert_id (); |
|
53 | - else |
|
54 | - return $rs; |
|
51 | + if ($val == true) { |
|
52 | + return $this->db->insert_id (); |
|
53 | + } else { |
|
54 | + return $rs; |
|
55 | + } |
|
55 | 56 | } |
56 | 57 | |
57 | 58 | /* |
@@ -141,15 +142,18 @@ discard block |
||
141 | 142 | $this->db->where ( $where ); |
142 | 143 | } |
143 | 144 | |
144 | - if ($paging_limit) |
|
145 | - $this->db->limit ( $paging_limit, $start_limit ); |
|
146 | - if (! empty ( $groupby )) |
|
147 | - $this->db->group_by ( $groupby ); |
|
145 | + if ($paging_limit) { |
|
146 | + $this->db->limit ( $paging_limit, $start_limit ); |
|
147 | + } |
|
148 | + if (! empty ( $groupby )) { |
|
149 | + $this->db->group_by ( $groupby ); |
|
150 | + } |
|
148 | 151 | if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') { |
149 | 152 | $this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] ); |
150 | 153 | } else { |
151 | - if ($order_by) |
|
152 | - $this->db->order_by ( $order_by, $order_type ); |
|
154 | + if ($order_by) { |
|
155 | + $this->db->order_by ( $order_by, $order_type ); |
|
156 | + } |
|
153 | 157 | } |
154 | 158 | $query = $this->db->get (); |
155 | 159 | return $query; |
@@ -168,10 +172,12 @@ discard block |
||
168 | 172 | } |
169 | 173 | $this->db->where_in ( $key, $where_in ); |
170 | 174 | $this->db->order_by ( $order_by, $order_type ); |
171 | - if ($paging_limit) |
|
172 | - $this->db->limit ( $paging_limit, $start_limit ); |
|
173 | - if (! empty ( $groupby )) |
|
174 | - $this->db->groupby ( $groupby ); |
|
175 | + if ($paging_limit) { |
|
176 | + $this->db->limit ( $paging_limit, $start_limit ); |
|
177 | + } |
|
178 | + if (! empty ( $groupby )) { |
|
179 | + $this->db->groupby ( $groupby ); |
|
180 | + } |
|
175 | 181 | $query = $this->db->get (); |
176 | 182 | |
177 | 183 | return $query; |
@@ -267,8 +273,9 @@ discard block |
||
267 | 273 | if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') { |
268 | 274 | $this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] ); |
269 | 275 | } else { |
270 | - if ($order_by) |
|
271 | - $this->db->order_by ( $order_by, $order_type ); |
|
276 | + if ($order_by) { |
|
277 | + $this->db->order_by ( $order_by, $order_type ); |
|
278 | + } |
|
272 | 279 | } |
273 | 280 | |
274 | 281 | if ($group_by != '') { |
@@ -316,8 +323,9 @@ discard block |
||
316 | 323 | if (isset ( $_GET ['sortname'] ) && $_GET ['sortname'] != 'undefined') { |
317 | 324 | $this->db->order_by ( $_GET ['sortname'], ($_GET ['sortorder'] == 'undefined') ? 'desc' : $_GET ['sortorder'] ); |
318 | 325 | } else { |
319 | - if ($order_by) |
|
320 | - $this->db->order_by ( $order_by, $order_type ); |
|
326 | + if ($order_by) { |
|
327 | + $this->db->order_by ( $order_by, $order_type ); |
|
328 | + } |
|
321 | 329 | } |
322 | 330 | |
323 | 331 | if ($group_by != '') { |
@@ -741,20 +749,23 @@ discard block |
||
741 | 749 | if (array_key_exists ( $key . "-integer", $value )) { |
742 | 750 | $string = null; |
743 | 751 | $string = $this->build_interger_where ( $key, $value [$key . "-integer"], $value [$key] ); |
744 | - if ($string) |
|
745 | - $where .= "$string AND "; |
|
752 | + if ($string) { |
|
753 | + $where .= "$string AND "; |
|
754 | + } |
|
746 | 755 | } |
747 | 756 | if (array_key_exists ( $key . "-string", $value )) { |
748 | 757 | $string = null; |
749 | 758 | $string = $this->build_string_where ( $key, $value [$key . "-string"], $value [$key] ); |
750 | - if ($string) |
|
751 | - $where .= "$string AND "; |
|
759 | + if ($string) { |
|
760 | + $where .= "$string AND "; |
|
761 | + } |
|
752 | 762 | } |
753 | 763 | if ($key == 'callstart' || $key == 'date' || $key == 'log_time') { |
754 | 764 | $string = null; |
755 | 765 | $string = $this->build_date_where ( $key, $value ); |
756 | - if ($string) |
|
757 | - $where .= "$string AND "; |
|
766 | + if ($string) { |
|
767 | + $where .= "$string AND "; |
|
768 | + } |
|
758 | 769 | } |
759 | 770 | } else { |
760 | 771 | $where .= "$key = '$value'AND "; |
@@ -838,14 +849,16 @@ discard block |
||
838 | 849 | if (! empty ( $value [0] )) { |
839 | 850 | $string = null; |
840 | 851 | $string = "$field >= '$value[0]'"; |
841 | - if ($string) |
|
842 | - $where .= $string . " AND "; |
|
852 | + if ($string) { |
|
853 | + $where .= $string . " AND "; |
|
854 | + } |
|
843 | 855 | } |
844 | 856 | if (! empty ( $value [1] )) { |
845 | 857 | $string = null; |
846 | 858 | $string = "$field <= '$value[1]'"; |
847 | - if ($string) |
|
848 | - $where .= $string . " AND "; |
|
859 | + if ($string) { |
|
860 | + $where .= $string . " AND "; |
|
861 | + } |
|
849 | 862 | } |
850 | 863 | } |
851 | 864 | if ($where) { |
@@ -29,32 +29,32 @@ discard block |
||
29 | 29 | var $conn = false; |
30 | 30 | public static $global_config; |
31 | 31 | function Common_model() { |
32 | - parent::__construct (); |
|
33 | - $this->get_system_config (); |
|
34 | - $this->get_currencylist (); |
|
35 | - $this->get_language_list (); |
|
36 | - $this->get_country_list (); |
|
37 | - $this->get_admin_info (); |
|
38 | - $this->load->library ( 'astpp/common' ); |
|
39 | - $this->db->query ( 'SET time_zone = "+00:00"' ); |
|
32 | + parent::__construct(); |
|
33 | + $this->get_system_config(); |
|
34 | + $this->get_currencylist(); |
|
35 | + $this->get_language_list(); |
|
36 | + $this->get_country_list(); |
|
37 | + $this->get_admin_info(); |
|
38 | + $this->load->library('astpp/common'); |
|
39 | + $this->db->query('SET time_zone = "+00:00"'); |
|
40 | 40 | } |
41 | 41 | function get_language_list() { |
42 | - $query = $this->db->get ( "language" ); |
|
43 | - $result = $query->result_array (); |
|
44 | - $language_list = array (); |
|
45 | - foreach ( $result as $row ) { |
|
42 | + $query = $this->db->get("language"); |
|
43 | + $result = $query->result_array(); |
|
44 | + $language_list = array(); |
|
45 | + foreach ($result as $row) { |
|
46 | 46 | $language_list [$row ['language']] = $row ['languagename']; |
47 | 47 | } |
48 | 48 | self::$global_config ['language_list'] = $language_list; |
49 | 49 | return $language_list; |
50 | 50 | } |
51 | 51 | function get_system_config() { |
52 | - $query = $this->db->get ( "system" ); |
|
53 | - $config = array (); |
|
54 | - $result = $query->result_array (); |
|
55 | - foreach ( $result as $row ) { |
|
52 | + $query = $this->db->get("system"); |
|
53 | + $config = array(); |
|
54 | + $result = $query->result_array(); |
|
55 | + foreach ($result as $row) { |
|
56 | 56 | if ($row ['name'] == 'decimal_points' || $row ['name'] == 'starting_digit' || $row ['name'] == 'card_length' || $row ['name'] == 'pin_length') { |
57 | - $row ['name'] = str_replace ( "_", "", $row ['name'] ); |
|
57 | + $row ['name'] = str_replace("_", "", $row ['name']); |
|
58 | 58 | } |
59 | 59 | $config [$row ['name']] = $row ['value']; |
60 | 60 | } |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | return $config; |
63 | 63 | } |
64 | 64 | function get_country_list() { |
65 | - $query = $this->db->get ( "countrycode" ); |
|
66 | - $result = $query->result_array (); |
|
67 | - $country_list = array (); |
|
68 | - foreach ( $result as $row ) { |
|
65 | + $query = $this->db->get("countrycode"); |
|
66 | + $result = $query->result_array(); |
|
67 | + $country_list = array(); |
|
68 | + foreach ($result as $row) { |
|
69 | 69 | $country_list [$row ['id']] = $row ['country']; |
70 | 70 | } |
71 | 71 | self::$global_config ['country_list'] = $country_list; |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | |
75 | 75 | // Return list of currency with rate |
76 | 76 | function get_currencylist() { |
77 | - $query = $this->db->get ( "currency" ); |
|
78 | - $currencylist = array (); |
|
79 | - $result = $query->result_array (); |
|
80 | - foreach ( $result as $row ) { |
|
77 | + $query = $this->db->get("currency"); |
|
78 | + $currencylist = array(); |
|
79 | + $result = $query->result_array(); |
|
80 | + foreach ($result as $row) { |
|
81 | 81 | $currencylist [$row ['currency']] = $row ['currencyrate']; |
82 | 82 | } |
83 | 83 | self::$global_config ['currency_list'] = $currencylist; |
84 | 84 | return $currencylist; |
85 | 85 | } |
86 | 86 | function get_admin_info() { |
87 | - $result = $this->db->get_where ( 'accounts', array ( |
|
87 | + $result = $this->db->get_where('accounts', array( |
|
88 | 88 | 'type' => '-1' |
89 | - ) ); |
|
90 | - $result = $result->result_array (); |
|
89 | + )); |
|
90 | + $result = $result->result_array(); |
|
91 | 91 | self::$global_config ['admin_info'] = $result [0]; |
92 | 92 | return $result [0]; |
93 | 93 | } |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | * Changes for invoices |
97 | 97 | */ |
98 | 98 | function generate_receipt($accountid, $amount, $accountinfo, $last_invoice_ID, $invoice_prefix, $due_date) { |
99 | - $amount = str_replace ( ',', '', $amount ); |
|
100 | - $invoice_data = array ( |
|
99 | + $amount = str_replace(',', '', $amount); |
|
100 | + $invoice_data = array( |
|
101 | 101 | "accountid" => $accountid, |
102 | 102 | "invoice_prefix" => $invoice_prefix, |
103 | 103 | "invoiceid" => $last_invoice_ID, |
104 | 104 | "reseller_id" => $accountinfo ['reseller_id'], |
105 | - "invoice_date" => gmdate ( "Y-m-d H:i:s" ), |
|
106 | - "from_date" => gmdate ( "Y-m-d H:i:s" ), |
|
107 | - "to_date" => gmdate ( "Y-m-d H:i:s" ), |
|
105 | + "invoice_date" => gmdate("Y-m-d H:i:s"), |
|
106 | + "from_date" => gmdate("Y-m-d H:i:s"), |
|
107 | + "to_date" => gmdate("Y-m-d H:i:s"), |
|
108 | 108 | "due_date" => $due_date, |
109 | 109 | "status" => 1, |
110 | 110 | "balance" => $accountinfo ['balance'], |
@@ -112,26 +112,26 @@ discard block |
||
112 | 112 | "type" => 'R', |
113 | 113 | "confirm" => '1' |
114 | 114 | ); |
115 | - $this->db->insert ( "invoices", $invoice_data ); |
|
116 | - return $this->db->insert_id (); |
|
115 | + $this->db->insert("invoices", $invoice_data); |
|
116 | + return $this->db->insert_id(); |
|
117 | 117 | } |
118 | 118 | function calculate_currency($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) { |
119 | 119 | $from_currency = ($from_currency == '') ? self::$global_config ['system_config'] ['base_currency'] : $from_currency; |
120 | 120 | |
121 | 121 | if ($to_currency == '') { |
122 | 122 | $to_currency1 = $this->session->userdata ['accountinfo'] ['currency_id']; |
123 | - $to_currency = $this->common->get_field_name ( 'currency', 'currency', $to_currency1 ); |
|
123 | + $to_currency = $this->common->get_field_name('currency', 'currency', $to_currency1); |
|
124 | 124 | } |
125 | 125 | $from_cur_rate = (self::$global_config ['currency_list'] [$from_currency] > 0) ? self::$global_config ['currency_list'] [$from_currency] : 1; |
126 | 126 | $to_cur_rate = (self::$global_config ['currency_list'] [$to_currency]) ? self::$global_config ['currency_list'] [$to_currency] : 1; |
127 | - $amount = str_replace ( ',', '', $amount ); |
|
127 | + $amount = str_replace(',', '', $amount); |
|
128 | 128 | $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate; |
129 | 129 | if ($format_currency) |
130 | - $cal_amount = $this->format_currency ( $cal_amount ); |
|
130 | + $cal_amount = $this->format_currency($cal_amount); |
|
131 | 131 | if ($append_currency) { |
132 | - $cal_amount = $cal_amount . " " . $to_currency; |
|
132 | + $cal_amount = $cal_amount." ".$to_currency; |
|
133 | 133 | } |
134 | - $cal_amount = str_replace ( ',', '', $cal_amount ); |
|
134 | + $cal_amount = str_replace(',', '', $cal_amount); |
|
135 | 135 | return $cal_amount; |
136 | 136 | } |
137 | 137 | function calculate_currency_customer($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) { |
@@ -139,24 +139,24 @@ discard block |
||
139 | 139 | |
140 | 140 | if ($to_currency == '') { |
141 | 141 | $to_currency1 = $this->session->userdata ['accountinfo'] ['currency_id']; |
142 | - $to_currency = $this->common->get_field_name ( 'currency', 'currency', $to_currency1 ); |
|
142 | + $to_currency = $this->common->get_field_name('currency', 'currency', $to_currency1); |
|
143 | 143 | } |
144 | 144 | $from_cur_rate = (self::$global_config ['currency_list'] [$from_currency] > 0) ? self::$global_config ['currency_list'] [$from_currency] : 1; |
145 | 145 | $to_cur_rate = (self::$global_config ['currency_list'] [$to_currency]) ? self::$global_config ['currency_list'] [$to_currency] : 1; |
146 | - $amount = str_replace ( ',', '', $amount ); |
|
146 | + $amount = str_replace(',', '', $amount); |
|
147 | 147 | $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate; |
148 | 148 | if ($format_currency) |
149 | - $cal_amount = $this->format_currency ( $cal_amount ); |
|
149 | + $cal_amount = $this->format_currency($cal_amount); |
|
150 | 150 | if ($append_currency) |
151 | 151 | $cal_amount = $cal_amount; |
152 | - $cal_amount = str_replace ( ',', '', $cal_amount ); |
|
152 | + $cal_amount = str_replace(',', '', $cal_amount); |
|
153 | 153 | return $cal_amount; |
154 | 154 | } |
155 | 155 | function add_calculate_currency($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) { |
156 | - $amount = str_replace ( ',', '', $amount ); |
|
156 | + $amount = str_replace(',', '', $amount); |
|
157 | 157 | if ($from_currency == '') { |
158 | 158 | $from_currency1 = $this->session->userdata ['accountinfo'] ['currency_id']; |
159 | - $from_currency = $this->common->get_field_name ( 'currency', 'currency', $from_currency1 ); |
|
159 | + $from_currency = $this->common->get_field_name('currency', 'currency', $from_currency1); |
|
160 | 160 | } |
161 | 161 | $to_currency = ($to_currency == '') ? self::$global_config ['system_config'] ['base_currency'] : $to_currency; |
162 | 162 | if (self::$global_config ['currency_list'] [$from_currency] > 0) { |
@@ -165,54 +165,54 @@ discard block |
||
165 | 165 | $cal_amount = $amount; |
166 | 166 | } |
167 | 167 | if ($format_currency) |
168 | - $cal_amount = $this->format_currency ( $cal_amount ); |
|
168 | + $cal_amount = $this->format_currency($cal_amount); |
|
169 | 169 | if ($append_currency) |
170 | - $cal_amount = $cal_amount . " " . $to_currency; |
|
171 | - $cal_amount = str_replace ( ',', '', $cal_amount ); |
|
170 | + $cal_amount = $cal_amount." ".$to_currency; |
|
171 | + $cal_amount = str_replace(',', '', $cal_amount); |
|
172 | 172 | return $cal_amount; |
173 | 173 | } |
174 | 174 | function to_calculate_currency($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) { |
175 | 175 | if ($to_currency == '') { |
176 | 176 | $to_currency1 = $this->session->userdata ['accountinfo'] ['currency_id']; |
177 | - $to_currency = $this->common->get_field_name ( 'currency', 'currency', $to_currency1 ); |
|
177 | + $to_currency = $this->common->get_field_name('currency', 'currency', $to_currency1); |
|
178 | 178 | } |
179 | 179 | $from_currency = ($from_currency == '') ? self::$global_config ['system_config'] ['base_currency'] : $from_currency; |
180 | 180 | |
181 | 181 | $from_cur_rate = (self::$global_config ['currency_list'] [$from_currency] > 0) ? self::$global_config ['currency_list'] [$from_currency] : 1; |
182 | 182 | $to_cur_rate = (self::$global_config ['currency_list'] [$to_currency]) ? self::$global_config ['currency_list'] [$to_currency] : 1; |
183 | - $amount = str_replace ( ',', '', $amount ); |
|
183 | + $amount = str_replace(',', '', $amount); |
|
184 | 184 | $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate; |
185 | 185 | if ($format_currency) |
186 | - $cal_amount = $this->format_currency ( $cal_amount ); |
|
186 | + $cal_amount = $this->format_currency($cal_amount); |
|
187 | 187 | if ($append_currency) |
188 | - $cal_amount = $cal_amount . " " . $to_currency; |
|
189 | - $cal_amount = str_replace ( ',', '', $cal_amount ); |
|
188 | + $cal_amount = $cal_amount." ".$to_currency; |
|
189 | + $cal_amount = str_replace(',', '', $cal_amount); |
|
190 | 190 | return $cal_amount; |
191 | 191 | } |
192 | 192 | function format_currency($amount) { |
193 | - $amount = str_replace ( ',', '', $amount ); |
|
194 | - return number_format ( $amount, Common_model::$global_config ['system_config'] ['decimalpoints'] ); |
|
193 | + $amount = str_replace(',', '', $amount); |
|
194 | + return number_format($amount, Common_model::$global_config ['system_config'] ['decimalpoints']); |
|
195 | 195 | // return $amount; |
196 | 196 | } |
197 | 197 | function money_format($format, $number) { |
198 | - $regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?' . '(?:#([0-9]+))?(?:\.([0-9]+))?([in%])/'; |
|
199 | - if (setlocale ( LC_MONETARY, 0 ) == 'C') { |
|
200 | - setlocale ( LC_MONETARY, '' ); |
|
198 | + $regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?'.'(?:#([0-9]+))?(?:\.([0-9]+))?([in%])/'; |
|
199 | + if (setlocale(LC_MONETARY, 0) == 'C') { |
|
200 | + setlocale(LC_MONETARY, ''); |
|
201 | 201 | } |
202 | - $locale = localeconv (); |
|
203 | - preg_match_all ( $regex, $format, $matches, PREG_SET_ORDER ); |
|
204 | - foreach ( $matches as $fmatch ) { |
|
205 | - $value = floatval ( $number ); |
|
206 | - $flags = array ( |
|
207 | - 'fillchar' => preg_match ( '/\=(.)/', $fmatch [1], $match ) ? $match [1] : ' ', |
|
208 | - 'nogroup' => preg_match ( '/\^/', $fmatch [1] ) > 0, |
|
209 | - 'usesignal' => preg_match ( '/\+|\(/', $fmatch [1], $match ) ? $match [0] : '+', |
|
210 | - 'nosimbol' => preg_match ( '/\!/', $fmatch [1] ) > 0, |
|
211 | - 'isleft' => preg_match ( '/\-/', $fmatch [1] ) > 0 |
|
202 | + $locale = localeconv(); |
|
203 | + preg_match_all($regex, $format, $matches, PREG_SET_ORDER); |
|
204 | + foreach ($matches as $fmatch) { |
|
205 | + $value = floatval($number); |
|
206 | + $flags = array( |
|
207 | + 'fillchar' => preg_match('/\=(.)/', $fmatch [1], $match) ? $match [1] : ' ', |
|
208 | + 'nogroup' => preg_match('/\^/', $fmatch [1]) > 0, |
|
209 | + 'usesignal' => preg_match('/\+|\(/', $fmatch [1], $match) ? $match [0] : '+', |
|
210 | + 'nosimbol' => preg_match('/\!/', $fmatch [1]) > 0, |
|
211 | + 'isleft' => preg_match('/\-/', $fmatch [1]) > 0 |
|
212 | 212 | ); |
213 | - $width = trim ( $fmatch [2] ) ? ( int ) $fmatch [2] : 0; |
|
214 | - $left = trim ( $fmatch [3] ) ? ( int ) $fmatch [3] : 0; |
|
215 | - $right = trim ( $fmatch [4] ) ? ( int ) $fmatch [4] : $locale ['int_frac_digits']; |
|
213 | + $width = trim($fmatch [2]) ? (int)$fmatch [2] : 0; |
|
214 | + $left = trim($fmatch [3]) ? (int)$fmatch [3] : 0; |
|
215 | + $right = trim($fmatch [4]) ? (int)$fmatch [4] : $locale ['int_frac_digits']; |
|
216 | 216 | $conversion = $fmatch [5]; |
217 | 217 | |
218 | 218 | $positive = true; |
@@ -244,53 +244,53 @@ discard block |
||
244 | 244 | $suffix = ')'; |
245 | 245 | break; |
246 | 246 | } |
247 | - if (! $flags ['nosimbol']) { |
|
248 | - $currency = $cprefix . ($conversion == 'i' ? $locale ['int_curr_symbol'] : $locale ['currency_symbol']) . $csuffix; |
|
247 | + if ( ! $flags ['nosimbol']) { |
|
248 | + $currency = $cprefix.($conversion == 'i' ? $locale ['int_curr_symbol'] : $locale ['currency_symbol']).$csuffix; |
|
249 | 249 | } else { |
250 | 250 | $currency = ''; |
251 | 251 | } |
252 | 252 | $space = $locale ["{$letter}_sep_by_space"] ? ' ' : ''; |
253 | 253 | |
254 | - $value = number_format ( $value, $right, $locale ['mon_decimal_point'], $flags ['nogroup'] ? '' : $locale ['mon_thousands_sep'] ); |
|
255 | - $value = @explode ( $locale ['mon_decimal_point'], $value ); |
|
254 | + $value = number_format($value, $right, $locale ['mon_decimal_point'], $flags ['nogroup'] ? '' : $locale ['mon_thousands_sep']); |
|
255 | + $value = @explode($locale ['mon_decimal_point'], $value); |
|
256 | 256 | |
257 | - $n = strlen ( $prefix ) + strlen ( $currency ) + strlen ( $value [0] ); |
|
257 | + $n = strlen($prefix) + strlen($currency) + strlen($value [0]); |
|
258 | 258 | if ($left > 0 && $left > $n) { |
259 | - $value [0] = str_repeat ( $flags ['fillchar'], $left - $n ) . $value [0]; |
|
259 | + $value [0] = str_repeat($flags ['fillchar'], $left - $n).$value [0]; |
|
260 | 260 | } |
261 | - $value = implode ( $locale ['mon_decimal_point'], $value ); |
|
261 | + $value = implode($locale ['mon_decimal_point'], $value); |
|
262 | 262 | if ($locale ["{$letter}_cs_precedes"]) { |
263 | - $value = $prefix . $currency . $space . $value . $suffix; |
|
263 | + $value = $prefix.$currency.$space.$value.$suffix; |
|
264 | 264 | } else { |
265 | - $value = $prefix . $value . $space . $currency . $suffix; |
|
265 | + $value = $prefix.$value.$space.$currency.$suffix; |
|
266 | 266 | } |
267 | 267 | if ($width > 0) { |
268 | - $value = str_pad ( $value, $width, $flags ['fillchar'], $flags ['isleft'] ? STR_PAD_RIGHT : STR_PAD_LEFT ); |
|
268 | + $value = str_pad($value, $width, $flags ['fillchar'], $flags ['isleft'] ? STR_PAD_RIGHT : STR_PAD_LEFT); |
|
269 | 269 | } |
270 | 270 | |
271 | - $format = str_replace ( $fmatch [0], $value, $format ); |
|
271 | + $format = str_replace($fmatch [0], $value, $format); |
|
272 | 272 | } |
273 | 273 | return $format; |
274 | 274 | } |
275 | 275 | function get_list_taxes() { |
276 | - $this->db->select ( 'id,taxes_description' ); |
|
277 | - $query = $this->db->get ( "taxes" ); |
|
278 | - $taxesList = array (); |
|
279 | - if ($query->num_rows () > 0) { |
|
280 | - return $query->result (); |
|
276 | + $this->db->select('id,taxes_description'); |
|
277 | + $query = $this->db->get("taxes"); |
|
278 | + $taxesList = array(); |
|
279 | + if ($query->num_rows() > 0) { |
|
280 | + return $query->result(); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | function get_params($table_name, $select, $where) { |
284 | - if (is_array ( $select )) { |
|
284 | + if (is_array($select)) { |
|
285 | 285 | } else { |
286 | - $this->db->select ( $select ); |
|
286 | + $this->db->select($select); |
|
287 | 287 | } |
288 | - if (is_array ( $where )) { |
|
288 | + if (is_array($where)) { |
|
289 | 289 | } else { |
290 | - $this->db->where ( $where ); |
|
290 | + $this->db->where($where); |
|
291 | 291 | } |
292 | - $query = $this->db->get ( $table_name ); |
|
293 | - $query = $query->result (); |
|
292 | + $query = $this->db->get($table_name); |
|
293 | + $query = $query->result(); |
|
294 | 294 | return $query; |
295 | 295 | } |
296 | 296 | /* |
@@ -298,11 +298,11 @@ discard block |
||
298 | 298 | * Using for Payment Functionality from Admin/Reseller Login |
299 | 299 | */ |
300 | 300 | function get_parent_info($accountid) { |
301 | - $this->db->where ( 'id', $accountid ); |
|
302 | - $this->db->select ( 'reseller_id,type' ); |
|
303 | - $account_result = $this->db->get ( 'accounts' ); |
|
304 | - $account_result = ( array ) $account_result->first_row (); |
|
305 | - if (isset ( $account_result ['reseller_id'] ) && $account_result ['reseller_id'] > 0) { |
|
301 | + $this->db->where('id', $accountid); |
|
302 | + $this->db->select('reseller_id,type'); |
|
303 | + $account_result = $this->db->get('accounts'); |
|
304 | + $account_result = (array)$account_result->first_row(); |
|
305 | + if (isset ($account_result ['reseller_id']) && $account_result ['reseller_id'] > 0) { |
|
306 | 306 | return $account_result ['reseller_id']; |
307 | 307 | } else { |
308 | 308 | return '0'; |
@@ -310,31 +310,31 @@ discard block |
||
310 | 310 | } |
311 | 311 | function apply_invoice_taxes($invoiceid, $account, $start_date) { |
312 | 312 | $tax_priority = ""; |
313 | - $where = array ( |
|
313 | + $where = array( |
|
314 | 314 | "accountid" => $account ['id'] |
315 | 315 | ); |
316 | - $accounttax_query = $this->db_model->getSelectWithOrder ( "*", "taxes_to_accounts", $where, "ASC", "taxes_priority" ); |
|
316 | + $accounttax_query = $this->db_model->getSelectWithOrder("*", "taxes_to_accounts", $where, "ASC", "taxes_priority"); |
|
317 | 317 | if ($accounttax_query->num_rows > 0) { |
318 | - $accounttax_query = $accounttax_query->result_array (); |
|
319 | - foreach ( $accounttax_query as $tax_value ) { |
|
320 | - $taxes_info = $this->db->get_where ( 'taxes', array ( |
|
318 | + $accounttax_query = $accounttax_query->result_array(); |
|
319 | + foreach ($accounttax_query as $tax_value) { |
|
320 | + $taxes_info = $this->db->get_where('taxes', array( |
|
321 | 321 | 'id' => $tax_value ['taxes_id'] |
322 | - ) ); |
|
323 | - if ($taxes_info->num_rows () > 0) { |
|
324 | - $tax_value = $taxes_info->result_array (); |
|
322 | + )); |
|
323 | + if ($taxes_info->num_rows() > 0) { |
|
324 | + $tax_value = $taxes_info->result_array(); |
|
325 | 325 | $tax_value = $tax_value [0]; |
326 | 326 | if ($tax_value ["taxes_priority"] == "") { |
327 | 327 | $tax_priority = $tax_value ["taxes_priority"]; |
328 | 328 | } else if ($tax_value ["taxes_priority"] > $tax_priority) { |
329 | - $query = $this->db_model->getSelect ( "SUM(debit) as total", "invoice_details", array ( |
|
329 | + $query = $this->db_model->getSelect("SUM(debit) as total", "invoice_details", array( |
|
330 | 330 | "invoiceid" => $invoiceid |
331 | - ) ); |
|
332 | - $query = $query->result_array (); |
|
331 | + )); |
|
332 | + $query = $query->result_array(); |
|
333 | 333 | $sub_total = $query ["0"] ["total"]; |
334 | 334 | } |
335 | 335 | $tax_total = (($sub_total * ($tax_value ['taxes_rate'] / 100)) + $tax_value ['taxes_amount']); |
336 | - $tax_total = round ( $tax_total, self::$global_config ['system_config'] ['decimalpoints'] ); |
|
337 | - $tax_array = array ( |
|
336 | + $tax_total = round($tax_total, self::$global_config ['system_config'] ['decimalpoints']); |
|
337 | + $tax_array = array( |
|
338 | 338 | "accountid" => $account ['id'], |
339 | 339 | "reseller_id" => $account ['reseller_id'], |
340 | 340 | "invoiceid" => $invoiceid, |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | "item_type" => "TAX", |
346 | 346 | "created_date" => $start_date |
347 | 347 | ); |
348 | - $this->db->insert ( "invoice_details", $tax_array ); |
|
348 | + $this->db->insert("invoice_details", $tax_array); |
|
349 | 349 | } |
350 | 350 | } |
351 | 351 | } |
@@ -126,8 +126,9 @@ discard block |
||
126 | 126 | $to_cur_rate = (self::$global_config ['currency_list'] [$to_currency]) ? self::$global_config ['currency_list'] [$to_currency] : 1; |
127 | 127 | $amount = str_replace ( ',', '', $amount ); |
128 | 128 | $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate; |
129 | - if ($format_currency) |
|
130 | - $cal_amount = $this->format_currency ( $cal_amount ); |
|
129 | + if ($format_currency) { |
|
130 | + $cal_amount = $this->format_currency ( $cal_amount ); |
|
131 | + } |
|
131 | 132 | if ($append_currency) { |
132 | 133 | $cal_amount = $cal_amount . " " . $to_currency; |
133 | 134 | } |
@@ -145,10 +146,12 @@ discard block |
||
145 | 146 | $to_cur_rate = (self::$global_config ['currency_list'] [$to_currency]) ? self::$global_config ['currency_list'] [$to_currency] : 1; |
146 | 147 | $amount = str_replace ( ',', '', $amount ); |
147 | 148 | $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate; |
148 | - if ($format_currency) |
|
149 | - $cal_amount = $this->format_currency ( $cal_amount ); |
|
150 | - if ($append_currency) |
|
151 | - $cal_amount = $cal_amount; |
|
149 | + if ($format_currency) { |
|
150 | + $cal_amount = $this->format_currency ( $cal_amount ); |
|
151 | + } |
|
152 | + if ($append_currency) { |
|
153 | + $cal_amount = $cal_amount; |
|
154 | + } |
|
152 | 155 | $cal_amount = str_replace ( ',', '', $cal_amount ); |
153 | 156 | return $cal_amount; |
154 | 157 | } |
@@ -164,10 +167,12 @@ discard block |
||
164 | 167 | } else { |
165 | 168 | $cal_amount = $amount; |
166 | 169 | } |
167 | - if ($format_currency) |
|
168 | - $cal_amount = $this->format_currency ( $cal_amount ); |
|
169 | - if ($append_currency) |
|
170 | - $cal_amount = $cal_amount . " " . $to_currency; |
|
170 | + if ($format_currency) { |
|
171 | + $cal_amount = $this->format_currency ( $cal_amount ); |
|
172 | + } |
|
173 | + if ($append_currency) { |
|
174 | + $cal_amount = $cal_amount . " " . $to_currency; |
|
175 | + } |
|
171 | 176 | $cal_amount = str_replace ( ',', '', $cal_amount ); |
172 | 177 | return $cal_amount; |
173 | 178 | } |
@@ -182,10 +187,12 @@ discard block |
||
182 | 187 | $to_cur_rate = (self::$global_config ['currency_list'] [$to_currency]) ? self::$global_config ['currency_list'] [$to_currency] : 1; |
183 | 188 | $amount = str_replace ( ',', '', $amount ); |
184 | 189 | $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate; |
185 | - if ($format_currency) |
|
186 | - $cal_amount = $this->format_currency ( $cal_amount ); |
|
187 | - if ($append_currency) |
|
188 | - $cal_amount = $cal_amount . " " . $to_currency; |
|
190 | + if ($format_currency) { |
|
191 | + $cal_amount = $this->format_currency ( $cal_amount ); |
|
192 | + } |
|
193 | + if ($append_currency) { |
|
194 | + $cal_amount = $cal_amount . " " . $to_currency; |
|
195 | + } |
|
189 | 196 | $cal_amount = str_replace ( ',', '', $cal_amount ); |
190 | 197 | return $cal_amount; |
191 | 198 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return Usermodel |
29 | 29 | */ |
30 | 30 | function Astpp_common() { |
31 | - parent::__construct (); |
|
31 | + parent::__construct(); |
|
32 | 32 | } |
33 | 33 | /** |
34 | 34 | * -------Here we write code for model astpp_common_model functions list_applyable_charges------ |
@@ -39,23 +39,23 @@ discard block |
||
39 | 39 | * @return return array of applyable chargelist. |
40 | 40 | */ |
41 | 41 | function list_applyable_charges($accountid = '') { |
42 | - $accountinfo = $this->session->userdata ( 'accountinfo' ); |
|
42 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
43 | 43 | $reseller_id = $accountinfo ['type'] == 1 ? $accountinfo ['id'] : 0; |
44 | 44 | $q = " SELECT * FROM `charges` where reseller_id =$reseller_id and id NOT IN(select charge_id from charge_to_account where accountid =$accountid) AND pricelist_id = '0'"; |
45 | - $item_arr = array (); |
|
46 | - $query = $this->db->query ( $q ); |
|
47 | - if ($query->num_rows () > 0) { |
|
48 | - foreach ( $query->result_array () as $row ) { |
|
45 | + $item_arr = array(); |
|
46 | + $query = $this->db->query($q); |
|
47 | + if ($query->num_rows() > 0) { |
|
48 | + foreach ($query->result_array() as $row) { |
|
49 | 49 | if ($row ['charge'] > 0) { |
50 | - $row ['charge'] = $this->common_model->calculate_currency ( $row ['charge'] ); |
|
50 | + $row ['charge'] = $this->common_model->calculate_currency($row ['charge']); |
|
51 | 51 | } |
52 | - $item_arr [$row ['id']] = $row ['description'] . ' - ' . $row ['charge']; |
|
52 | + $item_arr [$row ['id']] = $row ['description'].' - '.$row ['charge']; |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | return $item_arr; |
56 | 56 | } |
57 | 57 | function quote($inp) { |
58 | - return "'" . $this->db->escape_str ( $inp ) . "'"; |
|
58 | + return "'".$this->db->escape_str($inp)."'"; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * @param string $colname |
65 | 65 | */ |
66 | 66 | function db_get_item($q, $colname) { |
67 | - $item_arr = array (); |
|
68 | - $query = $this->db->query ( $q ); |
|
69 | - if ($query->num_rows () > 0) { |
|
70 | - $row = $query->row_array (); |
|
67 | + $item_arr = array(); |
|
68 | + $query = $this->db->query($q); |
|
69 | + if ($query->num_rows() > 0) { |
|
70 | + $row = $query->row_array(); |
|
71 | 71 | return $row [$colname]; |
72 | 72 | } |
73 | 73 | return ''; |
@@ -75,24 +75,24 @@ discard block |
||
75 | 75 | // Return the balance for a specific ASTPP account. |
76 | 76 | function accountbalance($account) { |
77 | 77 | $debit = 0; |
78 | - $q = "SELECT SUM(debit) as val1 FROM cdrs WHERE accountid=" . $this->quote ( $account ) . " AND status NOT IN (1, 2)"; |
|
79 | - $query = $this->db->query ( $q ); |
|
80 | - if ($query->num_rows () > 0) { |
|
81 | - $row = $query->row_array (); |
|
78 | + $q = "SELECT SUM(debit) as val1 FROM cdrs WHERE accountid=".$this->quote($account)." AND status NOT IN (1, 2)"; |
|
79 | + $query = $this->db->query($q); |
|
80 | + if ($query->num_rows() > 0) { |
|
81 | + $row = $query->row_array(); |
|
82 | 82 | $debit = $row ['val1']; |
83 | 83 | } |
84 | 84 | $credit = 0; |
85 | - $q = "SELECT SUM(credit) as val1 FROM cdrs WHERE accountid= " . $this->quote ( $account ) . " AND status NOT IN (1, 2)"; |
|
86 | - $query = $this->db->query ( $q ); |
|
87 | - if ($query->num_rows () > 0) { |
|
88 | - $row = $query->row_array (); |
|
85 | + $q = "SELECT SUM(credit) as val1 FROM cdrs WHERE accountid= ".$this->quote($account)." AND status NOT IN (1, 2)"; |
|
86 | + $query = $this->db->query($q); |
|
87 | + if ($query->num_rows() > 0) { |
|
88 | + $row = $query->row_array(); |
|
89 | 89 | $credit = $row ['val1']; |
90 | 90 | } |
91 | 91 | $posted_balance = 0; |
92 | - $q = "SELECT * FROM accounts WHERE id = " . $this->quote ( $account ); |
|
93 | - $query = $this->db->query ( $q ); |
|
94 | - if ($query->num_rows () > 0) { |
|
95 | - $row = $query->row_array (); |
|
92 | + $q = "SELECT * FROM accounts WHERE id = ".$this->quote($account); |
|
93 | + $query = $this->db->query($q); |
|
94 | + if ($query->num_rows() > 0) { |
|
95 | + $row = $query->row_array(); |
|
96 | 96 | $posted_balance = $row ['balance']; |
97 | 97 | } |
98 | 98 | $balance = ($debit - $credit + $posted_balance); |
@@ -103,47 +103,47 @@ discard block |
||
103 | 103 | $credit = 0; |
104 | 104 | if ($reseller == "") { |
105 | 105 | $q = "SELECT SUM(debit) as val1 FROM cdrs WHERE status NOT IN (1, 2)"; |
106 | - $debit = $this->db_get_item ( $q, 'val1' ); |
|
106 | + $debit = $this->db_get_item($q, 'val1'); |
|
107 | 107 | |
108 | 108 | $q = "SELECT SUM(credit) as val1 FROM cdrs WHERE status NOT IN (1, 2)"; |
109 | - $credit = $this->db_get_item ( $q, 'val1' ); |
|
109 | + $credit = $this->db_get_item($q, 'val1'); |
|
110 | 110 | |
111 | 111 | $tmp = "SELECT SUM(balance) as val1 FROM accounts WHERE reseller_id = ''"; |
112 | 112 | } else { |
113 | - $tmp = "SELECT SUM(balance) as val1 FROM accounts WHERE reseller_id = " . $this->quote ( $reseller ); |
|
113 | + $tmp = "SELECT SUM(balance) as val1 FROM accounts WHERE reseller_id = ".$this->quote($reseller); |
|
114 | 114 | } |
115 | - $posted_balance = $this->db_get_item ( $tmp, "val1" ); |
|
115 | + $posted_balance = $this->db_get_item($tmp, "val1"); |
|
116 | 116 | |
117 | 117 | $balance = ($debit - $credit + $posted_balance); |
118 | 118 | return $balance; |
119 | 119 | } |
120 | 120 | function count_dids($test) { |
121 | - $tmp = "SELECT COUNT(*) as val1 FROM dids " . $test; |
|
122 | - return $this->db_get_item ( $tmp, 'val1' ); |
|
121 | + $tmp = "SELECT COUNT(*) as val1 FROM dids ".$test; |
|
122 | + return $this->db_get_item($tmp, 'val1'); |
|
123 | 123 | } |
124 | 124 | function count_callingcards($where, $field = 'COUNT(*)') { |
125 | - $tmp = "SELECT $field as val FROM callingcards " . $where; |
|
126 | - return $this->db_get_item ( $tmp, 'val' ); |
|
125 | + $tmp = "SELECT $field as val FROM callingcards ".$where; |
|
126 | + return $this->db_get_item($tmp, 'val'); |
|
127 | 127 | } |
128 | 128 | function count_accounts($test) { |
129 | - $tmp = "SELECT COUNT(*) as val1 FROM accounts " . $test; |
|
130 | - return $this->db_get_item ( $tmp, 'val1' ); |
|
129 | + $tmp = "SELECT COUNT(*) as val1 FROM accounts ".$test; |
|
130 | + return $this->db_get_item($tmp, 'val1'); |
|
131 | 131 | } |
132 | 132 | function count_rategroup($test) { |
133 | - $tmp = "SELECT COUNT(*) as val1 FROM pricelists " . $test; |
|
134 | - return $this->db_get_item ( $tmp, 'val1' ); |
|
133 | + $tmp = "SELECT COUNT(*) as val1 FROM pricelists ".$test; |
|
134 | + return $this->db_get_item($tmp, 'val1'); |
|
135 | 135 | } |
136 | 136 | function count_termination($test = '') { |
137 | - $tmp = "SELECT COUNT(*) as val1 FROM outbound_routes " . $test; |
|
138 | - return $this->db_get_item ( $tmp, 'val1' ); |
|
137 | + $tmp = "SELECT COUNT(*) as val1 FROM outbound_routes ".$test; |
|
138 | + return $this->db_get_item($tmp, 'val1'); |
|
139 | 139 | } |
140 | 140 | function count_trunk($test = '') { |
141 | - $tmp = "SELECT COUNT(*) as val1 FROM trunks " . $test; |
|
142 | - return $this->db_get_item ( $tmp, 'val1' ); |
|
141 | + $tmp = "SELECT COUNT(*) as val1 FROM trunks ".$test; |
|
142 | + return $this->db_get_item($tmp, 'val1'); |
|
143 | 143 | } |
144 | 144 | function count_origination($test = '') { |
145 | - $tmp = "SELECT COUNT(*) as val1 FROM routes " . $test; |
|
146 | - return $this->db_get_item ( $tmp, 'val1' ); |
|
145 | + $tmp = "SELECT COUNT(*) as val1 FROM routes ".$test; |
|
146 | + return $this->db_get_item($tmp, 'val1'); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | ?> |
@@ -22,436 +22,436 @@ |
||
22 | 22 | // ############################################################################## |
23 | 23 | class System_model extends CI_Model { |
24 | 24 | function System_model() { |
25 | - parent::__construct (); |
|
25 | + parent::__construct(); |
|
26 | 26 | } |
27 | 27 | function add_config($data) { |
28 | - $this->load->library ( "curl" ); |
|
28 | + $this->load->library("curl"); |
|
29 | 29 | $url = "astpp-wraper.cgi"; |
30 | 30 | $data ['mode'] = "Configuration"; |
31 | 31 | $data ['action'] = "Add Item"; |
32 | - $data ['logintype'] = $this->session->userdata ( 'logintype' ); |
|
33 | - $data ['username'] = $this->session->userdata ( 'username' ); |
|
34 | - return $this->curl->sendRequestToPerlScript ( $url, $data ); |
|
32 | + $data ['logintype'] = $this->session->userdata('logintype'); |
|
33 | + $data ['username'] = $this->session->userdata('username'); |
|
34 | + return $this->curl->sendRequestToPerlScript($url, $data); |
|
35 | 35 | } |
36 | 36 | function edit_config($data) { |
37 | - $this->load->library ( "curl" ); |
|
37 | + $this->load->library("curl"); |
|
38 | 38 | $url = "astpp-wraper.cgi"; |
39 | 39 | $data ['mode'] = "Configuration"; |
40 | 40 | $data ['action'] = "Save Item"; |
41 | - $data ['logintype'] = $this->session->userdata ( 'logintype' ); |
|
42 | - $data ['username'] = $this->session->userdata ( 'username' ); |
|
43 | - return $this->curl->sendRequestToPerlScript ( $url, $data ); |
|
41 | + $data ['logintype'] = $this->session->userdata('logintype'); |
|
42 | + $data ['username'] = $this->session->userdata('username'); |
|
43 | + return $this->curl->sendRequestToPerlScript($url, $data); |
|
44 | 44 | } |
45 | 45 | function get_config_by_id($id) { |
46 | - $this->db->where ( "id", $id ); |
|
47 | - $query = $this->db->get ( "system" ); |
|
46 | + $this->db->where("id", $id); |
|
47 | + $query = $this->db->get("system"); |
|
48 | 48 | |
49 | - if ($query->num_rows () > 0) |
|
50 | - return $query->row_array (); |
|
49 | + if ($query->num_rows() > 0) |
|
50 | + return $query->row_array(); |
|
51 | 51 | else |
52 | 52 | return false; |
53 | 53 | } |
54 | 54 | function remove_config($data) { |
55 | - $this->load->library ( "curl" ); |
|
55 | + $this->load->library("curl"); |
|
56 | 56 | $url = "astpp-wraper.cgi"; |
57 | 57 | $data ['mode'] = "Configuration"; |
58 | 58 | $data ['action'] = "Delete"; |
59 | - $data ['logintype'] = $this->session->userdata ( 'logintype' ); |
|
60 | - $data ['username'] = $this->session->userdata ( 'username' ); |
|
61 | - return $this->curl->sendRequestToPerlScript ( $url, $data ); |
|
59 | + $data ['logintype'] = $this->session->userdata('logintype'); |
|
60 | + $data ['username'] = $this->session->userdata('username'); |
|
61 | + return $this->curl->sendRequestToPerlScript($url, $data); |
|
62 | 62 | } |
63 | 63 | function add_tax($data) { |
64 | - $this->load->library ( "curl" ); |
|
64 | + $this->load->library("curl"); |
|
65 | 65 | $url = "astpp-wraper.cgi"; |
66 | 66 | $data ['mode'] = "Taxes"; |
67 | - $data ['logintype'] = $this->session->userdata ( 'logintype' ); |
|
68 | - $data ['username'] = $this->session->userdata ( 'username' ); |
|
69 | - $this->curl->sendRequestToPerlScript ( $url, $data ); |
|
67 | + $data ['logintype'] = $this->session->userdata('logintype'); |
|
68 | + $data ['username'] = $this->session->userdata('username'); |
|
69 | + $this->curl->sendRequestToPerlScript($url, $data); |
|
70 | 70 | } |
71 | 71 | function edit_tax($data) { |
72 | - $this->load->library ( "curl" ); |
|
72 | + $this->load->library("curl"); |
|
73 | 73 | $url = "astpp-wraper.cgi"; |
74 | 74 | $data ['mode'] = "Taxes"; |
75 | - $data ['logintype'] = $this->session->userdata ( 'logintype' ); |
|
76 | - $data ['username'] = $this->session->userdata ( 'username' ); |
|
77 | - $this->curl->sendRequestToPerlScript ( $url, $data ); |
|
75 | + $data ['logintype'] = $this->session->userdata('logintype'); |
|
76 | + $data ['username'] = $this->session->userdata('username'); |
|
77 | + $this->curl->sendRequestToPerlScript($url, $data); |
|
78 | 78 | } |
79 | 79 | function get_tax_by_id($id) { |
80 | - $this->db->where ( "taxes_id", $id ); |
|
81 | - $query = $this->db->get ( "taxes" ); |
|
80 | + $this->db->where("taxes_id", $id); |
|
81 | + $query = $this->db->get("taxes"); |
|
82 | 82 | |
83 | - if ($query->num_rows () > 0) |
|
84 | - return $query->row_array (); |
|
83 | + if ($query->num_rows() > 0) |
|
84 | + return $query->row_array(); |
|
85 | 85 | else |
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | function remove_tax($data) { |
89 | - $this->load->library ( "curl" ); |
|
89 | + $this->load->library("curl"); |
|
90 | 90 | $url = "astpp-wraper.cgi"; |
91 | 91 | $data ['mode'] = "Taxes"; |
92 | 92 | $data ['action'] = "Delete"; |
93 | - $data ['logintype'] = $this->session->userdata ( 'logintype' ); |
|
94 | - $data ['username'] = $this->session->userdata ( 'username' ); |
|
95 | - $this->curl->sendRequestToPerlScript ( $url, $data ); |
|
93 | + $data ['logintype'] = $this->session->userdata('logintype'); |
|
94 | + $data ['username'] = $this->session->userdata('username'); |
|
95 | + $this->curl->sendRequestToPerlScript($url, $data); |
|
96 | 96 | } |
97 | 97 | function purge_deactivated_records() { |
98 | - $this->load->library ( "curl" ); |
|
98 | + $this->load->library("curl"); |
|
99 | 99 | $url = "astpp-wraper.cgi"; |
100 | 100 | $data ['mode'] = "Purge Deactivated"; |
101 | 101 | $data ['action'] = "Yes, Drop Them"; |
102 | - $data ['logintype'] = $this->session->userdata ( 'logintype' ); |
|
103 | - $data ['username'] = $this->session->userdata ( 'username' ); |
|
104 | - $feedback = $this->curl->sendRequestToPerlScript ( $url, $data ); |
|
102 | + $data ['logintype'] = $this->session->userdata('logintype'); |
|
103 | + $data ['username'] = $this->session->userdata('username'); |
|
104 | + $feedback = $this->curl->sendRequestToPerlScript($url, $data); |
|
105 | 105 | |
106 | - return $feedback = str_replace ( ".", ".<br />", $feedback ); |
|
106 | + return $feedback = str_replace(".", ".<br />", $feedback); |
|
107 | 107 | } |
108 | 108 | function getTaxesCount() { |
109 | - if ($this->session->userdata ( 'advance_search' ) == 1) { |
|
109 | + if ($this->session->userdata('advance_search') == 1) { |
|
110 | 110 | |
111 | - $taxes_search = $this->session->userdata ( 'taxes_search' ); |
|
111 | + $taxes_search = $this->session->userdata('taxes_search'); |
|
112 | 112 | |
113 | 113 | $amount_operator = $taxes_search ['amount_operator']; |
114 | 114 | |
115 | - if (! empty ( $taxes_search ['amount'] )) { |
|
115 | + if ( ! empty ($taxes_search ['amount'])) { |
|
116 | 116 | switch ($amount_operator) { |
117 | 117 | case "1" : |
118 | - $this->db->where ( 'taxes_amount ', $taxes_search ['amount'] ); |
|
118 | + $this->db->where('taxes_amount ', $taxes_search ['amount']); |
|
119 | 119 | break; |
120 | 120 | case "2" : |
121 | - $this->db->where ( 'taxes_amount <>', $taxes_search ['amount'] ); |
|
121 | + $this->db->where('taxes_amount <>', $taxes_search ['amount']); |
|
122 | 122 | break; |
123 | 123 | case "3" : |
124 | - $this->db->where ( 'taxes_amount > ', $taxes_search ['amount'] ); |
|
124 | + $this->db->where('taxes_amount > ', $taxes_search ['amount']); |
|
125 | 125 | break; |
126 | 126 | case "4" : |
127 | - $this->db->where ( 'taxes_amount < ', $taxes_search ['amount'] ); |
|
127 | + $this->db->where('taxes_amount < ', $taxes_search ['amount']); |
|
128 | 128 | break; |
129 | 129 | case "5" : |
130 | - $this->db->where ( 'taxes_amount >= ', $taxes_search ['amount'] ); |
|
130 | + $this->db->where('taxes_amount >= ', $taxes_search ['amount']); |
|
131 | 131 | break; |
132 | 132 | case "6" : |
133 | - $this->db->where ( 'taxes_amount <= ', $taxes_search ['amount'] ); |
|
133 | + $this->db->where('taxes_amount <= ', $taxes_search ['amount']); |
|
134 | 134 | break; |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | 138 | $rate_operator = $taxes_search ['rate_operator']; |
139 | 139 | |
140 | - if (! empty ( $taxes_search ['rate'] )) { |
|
140 | + if ( ! empty ($taxes_search ['rate'])) { |
|
141 | 141 | switch ($rate_operator) { |
142 | 142 | case "1" : |
143 | - $this->db->where ( 'taxes_rate ', $taxes_search ['rate'] ); |
|
143 | + $this->db->where('taxes_rate ', $taxes_search ['rate']); |
|
144 | 144 | break; |
145 | 145 | case "2" : |
146 | - $this->db->where ( 'taxes_rate <>', $taxes_search ['rate'] ); |
|
146 | + $this->db->where('taxes_rate <>', $taxes_search ['rate']); |
|
147 | 147 | break; |
148 | 148 | case "3" : |
149 | - $this->db->where ( 'taxes_rate > ', $taxes_search ['rate'] ); |
|
149 | + $this->db->where('taxes_rate > ', $taxes_search ['rate']); |
|
150 | 150 | break; |
151 | 151 | case "4" : |
152 | - $this->db->where ( 'taxes_rate < ', $taxes_search ['rate'] ); |
|
152 | + $this->db->where('taxes_rate < ', $taxes_search ['rate']); |
|
153 | 153 | break; |
154 | 154 | case "5" : |
155 | - $this->db->where ( 'taxes_rate >= ', $taxes_search ['rate'] ); |
|
155 | + $this->db->where('taxes_rate >= ', $taxes_search ['rate']); |
|
156 | 156 | break; |
157 | 157 | case "6" : |
158 | - $this->db->where ( 'taxes_rate <= ', $taxes_search ['rate'] ); |
|
158 | + $this->db->where('taxes_rate <= ', $taxes_search ['rate']); |
|
159 | 159 | break; |
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | 163 | $description_operator = $taxes_search ['description_operator']; |
164 | - if (! empty ( $taxes_search ['description'] )) { |
|
164 | + if ( ! empty ($taxes_search ['description'])) { |
|
165 | 165 | switch ($description_operator) { |
166 | 166 | case "1" : |
167 | - $this->db->like ( 'taxes_description', $taxes_search ['description'] ); |
|
167 | + $this->db->like('taxes_description', $taxes_search ['description']); |
|
168 | 168 | break; |
169 | 169 | case "2" : |
170 | - $this->db->not_like ( 'taxes_description', $taxes_search ['description'] ); |
|
170 | + $this->db->not_like('taxes_description', $taxes_search ['description']); |
|
171 | 171 | break; |
172 | 172 | case "3" : |
173 | - $this->db->where ( 'taxes_description', $taxes_search ['description'] ); |
|
173 | + $this->db->where('taxes_description', $taxes_search ['description']); |
|
174 | 174 | break; |
175 | 175 | case "4" : |
176 | - $this->db->where ( 'taxes_description <>', $taxes_search ['description'] ); |
|
176 | + $this->db->where('taxes_description <>', $taxes_search ['description']); |
|
177 | 177 | break; |
178 | 178 | } |
179 | 179 | } |
180 | 180 | } |
181 | - $this->db->from ( 'taxes' ); |
|
182 | - $providercnt = $this->db->count_all_results (); |
|
181 | + $this->db->from('taxes'); |
|
182 | + $providercnt = $this->db->count_all_results(); |
|
183 | 183 | return $providercnt; |
184 | 184 | } |
185 | 185 | function getTaxesList($start, $limit) { |
186 | - if ($this->session->userdata ( 'advance_search' ) == 1) { |
|
186 | + if ($this->session->userdata('advance_search') == 1) { |
|
187 | 187 | |
188 | - $taxes_search = $this->session->userdata ( 'taxes_search' ); |
|
188 | + $taxes_search = $this->session->userdata('taxes_search'); |
|
189 | 189 | |
190 | 190 | $amount_operator = $taxes_search ['amount_operator']; |
191 | 191 | |
192 | - if (! empty ( $taxes_search ['amount'] )) { |
|
192 | + if ( ! empty ($taxes_search ['amount'])) { |
|
193 | 193 | switch ($amount_operator) { |
194 | 194 | case "1" : |
195 | - $this->db->where ( 'taxes_amount =', $taxes_search ['amount'] ); |
|
195 | + $this->db->where('taxes_amount =', $taxes_search ['amount']); |
|
196 | 196 | break; |
197 | 197 | case "2" : |
198 | - $this->db->where ( 'taxes_amount <>', $taxes_search ['amount'] ); |
|
198 | + $this->db->where('taxes_amount <>', $taxes_search ['amount']); |
|
199 | 199 | break; |
200 | 200 | case "3" : |
201 | - $this->db->where ( 'taxes_amount > ', $taxes_search ['amount'] ); |
|
201 | + $this->db->where('taxes_amount > ', $taxes_search ['amount']); |
|
202 | 202 | break; |
203 | 203 | case "4" : |
204 | - $this->db->where ( 'taxes_amount < ', $taxes_search ['amount'] ); |
|
204 | + $this->db->where('taxes_amount < ', $taxes_search ['amount']); |
|
205 | 205 | break; |
206 | 206 | case "5" : |
207 | - $this->db->where ( 'taxes_amount >= ', $taxes_search ['amount'] ); |
|
207 | + $this->db->where('taxes_amount >= ', $taxes_search ['amount']); |
|
208 | 208 | break; |
209 | 209 | case "6" : |
210 | - $this->db->where ( 'taxes_amount <= ', $taxes_search ['amount'] ); |
|
210 | + $this->db->where('taxes_amount <= ', $taxes_search ['amount']); |
|
211 | 211 | break; |
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | 215 | $rate_operator = $taxes_search ['rate_operator']; |
216 | 216 | |
217 | - if (! empty ( $taxes_search ['rate'] )) { |
|
217 | + if ( ! empty ($taxes_search ['rate'])) { |
|
218 | 218 | switch ($rate_operator) { |
219 | 219 | case "1" : |
220 | - $this->db->where ( 'taxes_rate == ', $taxes_search ['rate'] ); |
|
220 | + $this->db->where('taxes_rate == ', $taxes_search ['rate']); |
|
221 | 221 | break; |
222 | 222 | case "2" : |
223 | - $this->db->where ( 'taxes_rate <>', $taxes_search ['rate'] ); |
|
223 | + $this->db->where('taxes_rate <>', $taxes_search ['rate']); |
|
224 | 224 | break; |
225 | 225 | case "3" : |
226 | - $this->db->where ( 'taxes_rate > ', $taxes_search ['rate'] ); |
|
226 | + $this->db->where('taxes_rate > ', $taxes_search ['rate']); |
|
227 | 227 | break; |
228 | 228 | case "4" : |
229 | - $this->db->where ( 'taxes_rate < ', $taxes_search ['rate'] ); |
|
229 | + $this->db->where('taxes_rate < ', $taxes_search ['rate']); |
|
230 | 230 | break; |
231 | 231 | case "5" : |
232 | - $this->db->where ( 'taxes_rate >= ', $taxes_search ['rate'] ); |
|
232 | + $this->db->where('taxes_rate >= ', $taxes_search ['rate']); |
|
233 | 233 | break; |
234 | 234 | case "6" : |
235 | - $this->db->where ( 'taxes_rate <= ', $taxes_search ['rate'] ); |
|
235 | + $this->db->where('taxes_rate <= ', $taxes_search ['rate']); |
|
236 | 236 | break; |
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
240 | 240 | $description_operator = $taxes_search ['description_operator']; |
241 | - if (! empty ( $taxes_search ['description'] )) { |
|
241 | + if ( ! empty ($taxes_search ['description'])) { |
|
242 | 242 | switch ($description_operator) { |
243 | 243 | case "1" : |
244 | - $this->db->like ( 'taxes_description', $taxes_search ['description'] ); |
|
244 | + $this->db->like('taxes_description', $taxes_search ['description']); |
|
245 | 245 | break; |
246 | 246 | case "2" : |
247 | - $this->db->not_like ( 'taxes_description', $taxes_search ['description'] ); |
|
247 | + $this->db->not_like('taxes_description', $taxes_search ['description']); |
|
248 | 248 | break; |
249 | 249 | case "3" : |
250 | - $this->db->where ( 'taxes_description', $taxes_search ['description'] ); |
|
250 | + $this->db->where('taxes_description', $taxes_search ['description']); |
|
251 | 251 | break; |
252 | 252 | case "4" : |
253 | - $this->db->where ( 'taxes_description <>', $taxes_search ['description'] ); |
|
253 | + $this->db->where('taxes_description <>', $taxes_search ['description']); |
|
254 | 254 | break; |
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
258 | - $this->db->limit ( $limit, $start ); |
|
259 | - $this->db->order_by ( "taxes_priority,taxes_description desc" ); |
|
260 | - $this->db->from ( 'taxes' ); |
|
261 | - $query = $this->db->get (); |
|
258 | + $this->db->limit($limit, $start); |
|
259 | + $this->db->order_by("taxes_priority,taxes_description desc"); |
|
260 | + $this->db->from('taxes'); |
|
261 | + $query = $this->db->get(); |
|
262 | 262 | // echo $this->db->last_query(); |
263 | 263 | return $query; |
264 | 264 | } |
265 | 265 | function getAuthInfo() { |
266 | - $this->db->where ( 'name', 'auth' ); |
|
267 | - $this->db->limit ( 1 ); |
|
268 | - $query = $this->db->get ( 'system' ); |
|
269 | - if ($query->num_rows () > 0) { |
|
270 | - return $query->result (); |
|
266 | + $this->db->where('name', 'auth'); |
|
267 | + $this->db->limit(1); |
|
268 | + $query = $this->db->get('system'); |
|
269 | + if ($query->num_rows() > 0) { |
|
270 | + return $query->result(); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | function get_template_count() { |
274 | 274 | if ($this->session->userdata ['userlevel_logintype'] == 1 || $this->session->userdata ['userlevel_logintype'] == 4 || $this->session->userdata ['userlevel_logintype'] == 5) { |
275 | 275 | $acountid = $this->session->userdata ['accountinfo'] ['accountid']; |
276 | - $this->db->where ( 'accountid', $acountid ); |
|
276 | + $this->db->where('accountid', $acountid); |
|
277 | 277 | } |
278 | - return $this->db->get ( 'templates' ); |
|
278 | + return $this->db->get('templates'); |
|
279 | 279 | } |
280 | 280 | function get_templates() { |
281 | - if ($this->session->userdata ( 'advance_search' ) == 1) { |
|
282 | - $templatesearch = $this->session->userdata ( 'template_search' ); |
|
281 | + if ($this->session->userdata('advance_search') == 1) { |
|
282 | + $templatesearch = $this->session->userdata('template_search'); |
|
283 | 283 | $template_name_operator = $templatesearch ['template_name_operator']; |
284 | 284 | |
285 | - if (! empty ( $templatesearch ['template_name'] )) { |
|
285 | + if ( ! empty ($templatesearch ['template_name'])) { |
|
286 | 286 | switch ($template_name_operator) { |
287 | 287 | case "1" : |
288 | - $this->db->like ( 'name', $templatesearch ['template_name'] ); |
|
288 | + $this->db->like('name', $templatesearch ['template_name']); |
|
289 | 289 | break; |
290 | 290 | case "2" : |
291 | - $this->db->not_like ( 'name', $templatesearch ['template_name'] ); |
|
291 | + $this->db->not_like('name', $templatesearch ['template_name']); |
|
292 | 292 | break; |
293 | 293 | case "3" : |
294 | - $this->db->where ( 'name', $templatesearch ['template_name'] ); |
|
294 | + $this->db->where('name', $templatesearch ['template_name']); |
|
295 | 295 | break; |
296 | 296 | case "4" : |
297 | - $this->db->where ( 'name <>', $templatesearch ['template_name'] ); |
|
297 | + $this->db->where('name <>', $templatesearch ['template_name']); |
|
298 | 298 | break; |
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
302 | 302 | $template_subject = $templatesearch ['subject_operator']; |
303 | - if (! empty ( $templatesearch ['subject'] )) { |
|
303 | + if ( ! empty ($templatesearch ['subject'])) { |
|
304 | 304 | switch ($template_subject) { |
305 | 305 | case "1" : |
306 | - $this->db->like ( 'subject', $templatesearch ['subject'] ); |
|
306 | + $this->db->like('subject', $templatesearch ['subject']); |
|
307 | 307 | break; |
308 | 308 | case "2" : |
309 | - $this->db->not_like ( 'subject', $templatesearch ['subject'] ); |
|
309 | + $this->db->not_like('subject', $templatesearch ['subject']); |
|
310 | 310 | break; |
311 | 311 | case "3" : |
312 | - $this->db->where ( 'subject', $templatesearch ['subject'] ); |
|
312 | + $this->db->where('subject', $templatesearch ['subject']); |
|
313 | 313 | break; |
314 | 314 | case "4" : |
315 | - $this->db->where ( 'subject <>', $templatesearch ['subject'] ); |
|
315 | + $this->db->where('subject <>', $templatesearch ['subject']); |
|
316 | 316 | break; |
317 | 317 | } |
318 | 318 | } |
319 | 319 | $template_op = $templatesearch ['template_operator']; |
320 | - if (! empty ( $templatesearch ['template_desc'] )) { |
|
320 | + if ( ! empty ($templatesearch ['template_desc'])) { |
|
321 | 321 | |
322 | 322 | switch ($template_op) { |
323 | 323 | case "1" : |
324 | - $this->db->like ( 'template', mysql_real_escape_string ( ($templatesearch ['template_desc']) ) ); |
|
324 | + $this->db->like('template', mysql_real_escape_string(($templatesearch ['template_desc']))); |
|
325 | 325 | break; |
326 | 326 | case "2" : |
327 | - $this->db->not_like ( 'template', mysql_real_escape_string ( $templatesearch ['template_desc'] ) ); |
|
327 | + $this->db->not_like('template', mysql_real_escape_string($templatesearch ['template_desc'])); |
|
328 | 328 | break; |
329 | 329 | case "3" : |
330 | - $this->db->where ( 'template', mysql_real_escape_string ( $templatesearch ['template_desc'] ) ); |
|
330 | + $this->db->where('template', mysql_real_escape_string($templatesearch ['template_desc'])); |
|
331 | 331 | break; |
332 | 332 | case "4" : |
333 | - $this->db->where ( 'template <>', mysql_real_escape_string ( $templatesearch ['template_desc'] ) ); |
|
333 | + $this->db->where('template <>', mysql_real_escape_string($templatesearch ['template_desc'])); |
|
334 | 334 | break; |
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
338 | - if (! empty ( $templatesearch ['accountid'] )) { |
|
339 | - $this->db->like ( 'accountid', $templatesearch ['accountid'] ); |
|
338 | + if ( ! empty ($templatesearch ['accountid'])) { |
|
339 | + $this->db->like('accountid', $templatesearch ['accountid']); |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
343 | 343 | if ($this->session->userdata ['userlevel_logintype'] == 1 || $this->session->userdata ['userlevel_logintype'] == 4 || $this->session->userdata ['userlevel_logintype'] == 5) { |
344 | 344 | $acountid = $this->session->userdata ['accountinfo'] ['accountid']; |
345 | - $this->db->where ( 'accountid', $acountid ); |
|
345 | + $this->db->where('accountid', $acountid); |
|
346 | 346 | } |
347 | - return $this->db->get ( 'templates' ); |
|
347 | + return $this->db->get('templates'); |
|
348 | 348 | } |
349 | 349 | function get_template_by_id($id) { |
350 | - $this->db->delete ( 'templates', array ( |
|
350 | + $this->db->delete('templates', array( |
|
351 | 351 | 'id' => $id |
352 | - ) ); |
|
352 | + )); |
|
353 | 353 | return true; |
354 | 354 | } |
355 | 355 | function get_template_by_id_all($id) { |
356 | - $this->db->where ( 'id', $id ); |
|
357 | - $query = $this->db->get ( 'templates' ); |
|
358 | - if ($query->num_rows () > 0) |
|
359 | - return $query->row_array (); |
|
356 | + $this->db->where('id', $id); |
|
357 | + $query = $this->db->get('templates'); |
|
358 | + if ($query->num_rows() > 0) |
|
359 | + return $query->row_array(); |
|
360 | 360 | else |
361 | 361 | return false; |
362 | 362 | } |
363 | 363 | function edit_template($edit_id, $data) { |
364 | - $updatedata = array ( |
|
365 | - "name" => trim ( $data ['tem_name'] ), |
|
366 | - "template" => trim ( $data ['template'] ), |
|
367 | - "subject" => trim ( $data ['subject'] ), |
|
368 | - "modified_date" => trim ( date ( 'Y-m-d H:i:s' ) ) |
|
364 | + $updatedata = array( |
|
365 | + "name" => trim($data ['tem_name']), |
|
366 | + "template" => trim($data ['template']), |
|
367 | + "subject" => trim($data ['subject']), |
|
368 | + "modified_date" => trim(date('Y-m-d H:i:s')) |
|
369 | 369 | ); |
370 | - $this->db->where ( 'id', $edit_id ); |
|
371 | - $this->db->update ( 'templates', $updatedata ); |
|
370 | + $this->db->where('id', $edit_id); |
|
371 | + $this->db->update('templates', $updatedata); |
|
372 | 372 | return true; |
373 | 373 | } |
374 | 374 | function build_systems_configuration() { |
375 | - if ($this->session->userdata ( 'advance_search' ) == 1) { |
|
376 | - $configuration_search = $this->session->userdata ( 'configuration_search' ); |
|
375 | + if ($this->session->userdata('advance_search') == 1) { |
|
376 | + $configuration_search = $this->session->userdata('configuration_search'); |
|
377 | 377 | |
378 | - if (! empty ( $configuration_search ['reseller'] )) { |
|
379 | - $this->db->where ( 'reseller ', $configuration_search ['reseller'] ); |
|
378 | + if ( ! empty ($configuration_search ['reseller'])) { |
|
379 | + $this->db->where('reseller ', $configuration_search ['reseller']); |
|
380 | 380 | } |
381 | - if (! empty ( $configuration_search ['brand'] )) { |
|
382 | - $this->db->where ( 'brand', $configuration_search ['brand'] ); |
|
381 | + if ( ! empty ($configuration_search ['brand'])) { |
|
382 | + $this->db->where('brand', $configuration_search ['brand']); |
|
383 | 383 | } |
384 | - if (! empty ( $configuration_search ['group_title'] )) { |
|
385 | - $this->db->where ( 'group_title', $configuration_search ['group_title'] ); |
|
384 | + if ( ! empty ($configuration_search ['group_title'])) { |
|
385 | + $this->db->where('group_title', $configuration_search ['group_title']); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | $name_operator = $configuration_search ['name_operator']; |
389 | 389 | |
390 | - if (! empty ( $configuration_search ['name'] )) { |
|
390 | + if ( ! empty ($configuration_search ['name'])) { |
|
391 | 391 | switch ($name_operator) { |
392 | 392 | case "1" : |
393 | - $this->db->like ( 'name', $configuration_search ['name'] ); |
|
393 | + $this->db->like('name', $configuration_search ['name']); |
|
394 | 394 | break; |
395 | 395 | case "2" : |
396 | - $this->db->not_like ( 'name', $configuration_search ['name'] ); |
|
396 | + $this->db->not_like('name', $configuration_search ['name']); |
|
397 | 397 | break; |
398 | 398 | case "3" : |
399 | - $this->db->where ( 'name', $configuration_search ['name'] ); |
|
399 | + $this->db->where('name', $configuration_search ['name']); |
|
400 | 400 | break; |
401 | 401 | case "4" : |
402 | - $this->db->where ( 'name <>', $configuration_search ['name'] ); |
|
402 | + $this->db->where('name <>', $configuration_search ['name']); |
|
403 | 403 | break; |
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
407 | 407 | $value_operator = $configuration_search ['value_operator']; |
408 | 408 | |
409 | - if (! empty ( $configuration_search ['value'] )) { |
|
409 | + if ( ! empty ($configuration_search ['value'])) { |
|
410 | 410 | switch ($value_operator) { |
411 | 411 | case "1" : |
412 | - $this->db->like ( 'value', $configuration_search ['value'] ); |
|
412 | + $this->db->like('value', $configuration_search ['value']); |
|
413 | 413 | break; |
414 | 414 | case "2" : |
415 | - $this->db->not_like ( 'value', $configuration_search ['value'] ); |
|
415 | + $this->db->not_like('value', $configuration_search ['value']); |
|
416 | 416 | break; |
417 | 417 | case "3" : |
418 | - $this->db->where ( 'value', $configuration_search ['value'] ); |
|
418 | + $this->db->where('value', $configuration_search ['value']); |
|
419 | 419 | break; |
420 | 420 | case "4" : |
421 | - $this->db->where ( 'value <>', $configuration_search ['value'] ); |
|
421 | + $this->db->where('value <>', $configuration_search ['value']); |
|
422 | 422 | break; |
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | 426 | $comment_operator = $configuration_search ['comment_operator']; |
427 | 427 | |
428 | - if (! empty ( $configuration_search ['comment'] )) { |
|
428 | + if ( ! empty ($configuration_search ['comment'])) { |
|
429 | 429 | switch ($comment_operator) { |
430 | 430 | case "1" : |
431 | - $this->db->like ( 'comment', $configuration_search ['comment'] ); |
|
431 | + $this->db->like('comment', $configuration_search ['comment']); |
|
432 | 432 | break; |
433 | 433 | case "2" : |
434 | - $this->db->not_like ( 'comment', $configuration_search ['comment'] ); |
|
434 | + $this->db->not_like('comment', $configuration_search ['comment']); |
|
435 | 435 | break; |
436 | 436 | case "3" : |
437 | - $this->db->where ( 'comment', $configuration_search ['comment'] ); |
|
437 | + $this->db->where('comment', $configuration_search ['comment']); |
|
438 | 438 | break; |
439 | 439 | case "4" : |
440 | - $this->db->where ( 'comment <>', $configuration_search ['comment'] ); |
|
440 | + $this->db->where('comment <>', $configuration_search ['comment']); |
|
441 | 441 | break; |
442 | 442 | } |
443 | 443 | } |
444 | 444 | } |
445 | 445 | } |
446 | 446 | function systems_configuration($flag, $start = '', $limit = '') { |
447 | - $this->build_systems_configuration (); |
|
448 | - $this->db->from ( 'system' ); |
|
447 | + $this->build_systems_configuration(); |
|
448 | + $this->db->from('system'); |
|
449 | 449 | if ($flag) { |
450 | - $this->db->order_by ( "id ASC" ); |
|
451 | - $this->db->limit ( $limit, $start ); |
|
452 | - $query = $this->db->get (); |
|
450 | + $this->db->order_by("id ASC"); |
|
451 | + $this->db->limit($limit, $start); |
|
452 | + $query = $this->db->get(); |
|
453 | 453 | } else { |
454 | - $query = $this->db->count_all_results (); |
|
454 | + $query = $this->db->count_all_results(); |
|
455 | 455 | } |
456 | 456 | return $query; |
457 | 457 | } |
@@ -46,10 +46,11 @@ discard block |
||
46 | 46 | $this->db->where ( "id", $id ); |
47 | 47 | $query = $this->db->get ( "system" ); |
48 | 48 | |
49 | - if ($query->num_rows () > 0) |
|
50 | - return $query->row_array (); |
|
51 | - else |
|
52 | - return false; |
|
49 | + if ($query->num_rows () > 0) { |
|
50 | + return $query->row_array (); |
|
51 | + } else { |
|
52 | + return false; |
|
53 | + } |
|
53 | 54 | } |
54 | 55 | function remove_config($data) { |
55 | 56 | $this->load->library ( "curl" ); |
@@ -80,10 +81,11 @@ discard block |
||
80 | 81 | $this->db->where ( "taxes_id", $id ); |
81 | 82 | $query = $this->db->get ( "taxes" ); |
82 | 83 | |
83 | - if ($query->num_rows () > 0) |
|
84 | - return $query->row_array (); |
|
85 | - else |
|
86 | - return false; |
|
84 | + if ($query->num_rows () > 0) { |
|
85 | + return $query->row_array (); |
|
86 | + } else { |
|
87 | + return false; |
|
88 | + } |
|
87 | 89 | } |
88 | 90 | function remove_tax($data) { |
89 | 91 | $this->load->library ( "curl" ); |
@@ -355,10 +357,11 @@ discard block |
||
355 | 357 | function get_template_by_id_all($id) { |
356 | 358 | $this->db->where ( 'id', $id ); |
357 | 359 | $query = $this->db->get ( 'templates' ); |
358 | - if ($query->num_rows () > 0) |
|
359 | - return $query->row_array (); |
|
360 | - else |
|
361 | - return false; |
|
360 | + if ($query->num_rows () > 0) { |
|
361 | + return $query->row_array (); |
|
362 | + } else { |
|
363 | + return false; |
|
364 | + } |
|
362 | 365 | } |
363 | 366 | function edit_template($edit_id, $data) { |
364 | 367 | $updatedata = array ( |