Completed
Pull Request — v3.0 (#136)
by
unknown
25:07
created
web_interface/astpp/application/models/db_model.php 3 patches
Indentation   +823 added lines, -823 removed lines patch added patch discarded remove patch
@@ -23,438 +23,438 @@  discard block
 block discarded – undo
23 23
 
24 24
 class Db_model extends CI_Model {
25 25
 
26
-    function Db_model() {
26
+	function Db_model() {
27 27
 //		parent::Model();		
28
-        parent::__construct();
29
-        $this->db->query("SET time_zone='+0:00'");
30
-    }
28
+		parent::__construct();
29
+		$this->db->query("SET time_zone='+0:00'");
30
+	}
31 31
 
32
-    /*     * ********************************************************
32
+	/*     * ********************************************************
33 33
       Function getCriteria(Where=Condition in Array Format)
34 34
      * ******************************************************** */
35 35
 
36
-    function getCriteria($condition = "", $tableName) {
37
-        //print_r($condition);
38
-        if ($condition != "") {
39
-            $this->db->where($condition);
40
-        }
41
-        return $this->db->get($tableName);
42
-    }
36
+	function getCriteria($condition = "", $tableName) {
37
+		//print_r($condition);
38
+		if ($condition != "") {
39
+			$this->db->where($condition);
40
+		}
41
+		return $this->db->get($tableName);
42
+	}
43 43
 
44
-    /*     * ********************************************************
44
+	/*     * ********************************************************
45 45
       Function save() for addingthe record
46 46
      * ******************************************************** */
47 47
 
48
-    function save($tableName, $arr, $val = 'false') {
49
-        $str = $this->db->insert_string($tableName, $arr);
50
-        $rs = $this->db->query($str);
51
-        if ($val == true)
52
-            return $this->db->insert_id();
53
-        else
54
-            return $rs;
55
-    }
48
+	function save($tableName, $arr, $val = 'false') {
49
+		$str = $this->db->insert_string($tableName, $arr);
50
+		$rs = $this->db->query($str);
51
+		if ($val == true)
52
+			return $this->db->insert_id();
53
+		else
54
+			return $rs;
55
+	}
56 56
 
57
-    /*     * ********************************************************
57
+	/*     * ********************************************************
58 58
       Function update() for editing the record
59 59
      * ******************************************************** */
60 60
 
61
-    function update($tableName, $arr, $where) {
62
-        $str = $this->db->update_string($tableName, $arr, $where);
63
-        $rs = $this->db->query($str);
64
-        return $rs;
65
-    }
61
+	function update($tableName, $arr, $where) {
62
+		$str = $this->db->update_string($tableName, $arr, $where);
63
+		$rs = $this->db->query($str);
64
+		return $rs;
65
+	}
66 66
 
67
-    /*     * ********************************************************
67
+	/*     * ********************************************************
68 68
       Function getSelect()n for displaying record
69 69
      * ******************************************************** */
70 70
 
71
-    function getSelect($select, $tableName, $where) {
72
-        $this->db->select($select, false);
73
-        $this->db->from($tableName);
74
-        if ($where != '') {
75
-            $this->db->where($where);
76
-        }
77
-        $query = $this->db->get();
78
-        return $query;
79
-    }
80
-
81
-    /*     * ********************************************************
71
+	function getSelect($select, $tableName, $where) {
72
+		$this->db->select($select, false);
73
+		$this->db->from($tableName);
74
+		if ($where != '') {
75
+			$this->db->where($where);
76
+		}
77
+		$query = $this->db->get();
78
+		return $query;
79
+	}
80
+
81
+	/*     * ********************************************************
82 82
       Function getSelectWithOrder()n for displaying record
83 83
      * ******************************************************** */
84 84
 
85
-    function getSelectWithOrder($select, $tableName, $where, $order_type, $order_by) {
86
-        $this->db->select($select);
87
-        $this->db->from($tableName);
88
-        $this->db->where($where);
89
-        $this->db->order_by($order_by,$order_type);
90
-        $query = $this->db->get();
91
-        return $query;
92
-    }
85
+	function getSelectWithOrder($select, $tableName, $where, $order_type, $order_by) {
86
+		$this->db->select($select);
87
+		$this->db->from($tableName);
88
+		$this->db->where($where);
89
+		$this->db->order_by($order_by,$order_type);
90
+		$query = $this->db->get();
91
+		return $query;
92
+	}
93 93
 
94
-    /*     * ********************************************************
94
+	/*     * ********************************************************
95 95
       Function getSelectWithOrderAndLimit()n for displaying record
96 96
      * ******************************************************** */
97 97
 
98
-    function getSelectWithOrderAndLimit($select, $tableName, $where, $order_type, $order_by, $paging_limit) {
99
-        $this->db->select($select);
100
-        $this->db->from($tableName);
101
-        $this->db->where($where);
102
-        $this->db->order_by($order_by, $order_type);
103
-        $this->db->limit($paging_limit);
104
-        $query = $this->db->get();
105
-        return $query;
106
-    }
107
-
108
-    /*     * ********************************************************
98
+	function getSelectWithOrderAndLimit($select, $tableName, $where, $order_type, $order_by, $paging_limit) {
99
+		$this->db->select($select);
100
+		$this->db->from($tableName);
101
+		$this->db->where($where);
102
+		$this->db->order_by($order_by, $order_type);
103
+		$this->db->limit($paging_limit);
104
+		$query = $this->db->get();
105
+		return $query;
106
+	}
107
+
108
+	/*     * ********************************************************
109 109
       Function delete() for deletingthe record
110 110
      * ******************************************************** */
111 111
 
112
-    function delete($tableName, $where) {
113
-        $this->db->where($where);
114
-        $this->db->delete($tableName);
115
-    }
112
+	function delete($tableName, $where) {
113
+		$this->db->where($where);
114
+		$this->db->delete($tableName);
115
+	}
116 116
 
117
-    /*     * ********************************************************
117
+	/*     * ********************************************************
118 118
       Function excecute() take compelet query
119 119
      * ******************************************************** */
120 120
 
121
-    function excecute($query) {
122
-        $rs = $this->db->query($query);
123
-        return $rs;
124
-    }
121
+	function excecute($query) {
122
+		$rs = $this->db->query($query);
123
+		return $rs;
124
+	}
125 125
 
126
-    /*     * ********************************************************
126
+	/*     * ********************************************************
127 127
       Function select() take full complete perms
128 128
      * ******************************************************** */
129 129
      
130
-    function select($select, $tableName, $where, $order_by, $order_type, $paging_limit = '', $start_limit = '', $groupby = '') {
131
-        $this->db->select($select);
132
-        $this->db->from($tableName);
133
-        if ($where != "") {
134
-            $this->db->where($where);
135
-        }
130
+	function select($select, $tableName, $where, $order_by, $order_type, $paging_limit = '', $start_limit = '', $groupby = '') {
131
+		$this->db->select($select);
132
+		$this->db->from($tableName);
133
+		if ($where != "") {
134
+			$this->db->where($where);
135
+		}
136 136
         
137
-        if ($paging_limit)
138
-            $this->db->limit($paging_limit, $start_limit);
139
-        if (!empty($groupby))
140
-            $this->db->group_by($groupby);
141
-        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
142
-          $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
143
-        }else{
144
-           if($order_by)
145
-            $this->db->order_by($order_by, $order_type);
146
-        }        
147
-        $query = $this->db->get();
148
-        return $query;
149
-    }
150
-
151
-    /*     * ********************************************************
137
+		if ($paging_limit)
138
+			$this->db->limit($paging_limit, $start_limit);
139
+		if (!empty($groupby))
140
+			$this->db->group_by($groupby);
141
+		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
142
+		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
143
+		}else{
144
+		   if($order_by)
145
+			$this->db->order_by($order_by, $order_type);
146
+		}        
147
+		$query = $this->db->get();
148
+		return $query;
149
+	}
150
+
151
+	/*     * ********************************************************
152 152
       Function select for In query () take full complete perms
153 153
      * ******************************************************** */
154 154
 
155
-    function select_by_in($select, $tableName, $where, $order_by, $order_type, $paging_limit, $start_limit, $groupby = '', $key, $where_in) {
156
-        $this->db->select($select);
157
-        $this->db->from($tableName);
158
-        if ($where != "") {
159
-            $this->db->where($where);
160
-        }
161
-        $this->db->where_in($key, $where_in);
162
-        $this->db->order_by($order_by, $order_type);
163
-        if ($paging_limit)
164
-            $this->db->limit($paging_limit, $start_limit);
165
-        if (!empty($groupby))
166
-            $this->db->groupby($groupby);
167
-        $query = $this->db->get();
168
-
169
-        return $query;
170
-    }
171
-
172
-    /*     * ********************************************************
155
+	function select_by_in($select, $tableName, $where, $order_by, $order_type, $paging_limit, $start_limit, $groupby = '', $key, $where_in) {
156
+		$this->db->select($select);
157
+		$this->db->from($tableName);
158
+		if ($where != "") {
159
+			$this->db->where($where);
160
+		}
161
+		$this->db->where_in($key, $where_in);
162
+		$this->db->order_by($order_by, $order_type);
163
+		if ($paging_limit)
164
+			$this->db->limit($paging_limit, $start_limit);
165
+		if (!empty($groupby))
166
+			$this->db->groupby($groupby);
167
+		$query = $this->db->get();
168
+
169
+		return $query;
170
+	}
171
+
172
+	/*     * ********************************************************
173 173
       Function countQuery() take table name and select feild
174 174
      * ******************************************************** */
175 175
 
176
-    function countQuery($select, $table, $where = "") {
177
-        $this->db->select($select);
178
-        if ($where != "") {
179
-            $this->db->where($where);
180
-        }
181
-        $this->db->from($table);
182
-        $query = $this->db->get();
183
-        return $query->num_rows();
184
-    }
185
-
186
-    /*     * ********************************************************
176
+	function countQuery($select, $table, $where = "") {
177
+		$this->db->select($select);
178
+		if ($where != "") {
179
+			$this->db->where($where);
180
+		}
181
+		$this->db->from($table);
182
+		$query = $this->db->get();
183
+		return $query->num_rows();
184
+	}
185
+
186
+	/*     * ********************************************************
187 187
       Function countQuery for where in query() take table name and select feild
188 188
      * ******************************************************** */
189 189
 
190
-    function countQuery_by_in($select, $table, $where = "", $key, $where_in) {
191
-        $this->db->select($select);
192
-        if ($where != "") {
193
-            $this->db->where($where);
194
-        }
195
-        if (!empty($where_in)) {
196
-            $this->db->where_in($key, $where_in);
197
-        }
198
-        $this->db->from($table);
199
-        $query = $this->db->get();
200
-        return $query->num_rows();
201
-    }
202
-
203
-    /*     * ********************************************************
190
+	function countQuery_by_in($select, $table, $where = "", $key, $where_in) {
191
+		$this->db->select($select);
192
+		if ($where != "") {
193
+			$this->db->where($where);
194
+		}
195
+		if (!empty($where_in)) {
196
+			$this->db->where_in($key, $where_in);
197
+		}
198
+		$this->db->from($table);
199
+		$query = $this->db->get();
200
+		return $query->num_rows();
201
+	}
202
+
203
+	/*     * ********************************************************
204 204
       Function maxQuery() take table name and select feild
205 205
      * ******************************************************** */
206 206
 
207
-    function maxQuery($table, $select, $where = "", $name) {
208
-
209
-        $this->db->select($select);
210
-        $this->db->from($table);
211
-        if ($where != "") {
212
-            $this->db->where($where);
213
-        }
214
-        $query = $this->db->get();
215
-        if ($query->num_rows() > 0) {
216
-            $rowP = $query->row();
217
-            return $rowP->$name;
218
-        } else {
219
-            return 0;
220
-        }
221
-    }
222
-
223
-    /*     * ********************************************************
207
+	function maxQuery($table, $select, $where = "", $name) {
208
+
209
+		$this->db->select($select);
210
+		$this->db->from($table);
211
+		if ($where != "") {
212
+			$this->db->where($where);
213
+		}
214
+		$query = $this->db->get();
215
+		if ($query->num_rows() > 0) {
216
+			$rowP = $query->row();
217
+			return $rowP->$name;
218
+		} else {
219
+			return 0;
220
+		}
221
+	}
222
+
223
+	/*     * ********************************************************
224 224
       Function getCurrent get current value of the feild
225 225
      * ******************************************************** */
226 226
 
227
-    function getCurrent($table, $feild, $where) {
227
+	function getCurrent($table, $feild, $where) {
228 228
 //		echo "<pre>table====><br>".$table."field====><br>".$feild."where====><br>".print_r($where);
229
-        $this->db->select($feild);
230
-        $this->db->from($table);
231
-        $this->db->where($where);
232
-        $query = $this->db->get();
233
-        if ($query->num_rows() > 0) {
234
-
235
-            $rowP = $query->row();
236
-            return $rowP->$feild;
237
-        } else {
238
-            return false;
239
-        }
240
-    }
241
-
242
-    /*     * ********************************************************
229
+		$this->db->select($feild);
230
+		$this->db->from($table);
231
+		$this->db->where($where);
232
+		$query = $this->db->get();
233
+		if ($query->num_rows() > 0) {
234
+
235
+			$rowP = $query->row();
236
+			return $rowP->$feild;
237
+		} else {
238
+			return false;
239
+		}
240
+	}
241
+
242
+	/*     * ********************************************************
243 243
       Function getJionQuery get result set on criteria
244 244
      * ******************************************************** */
245 245
 
246
-    function getJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
247
-        $start = (int) $start;
248
-        $end = (int) $end;
249
-        $this->db->select($feild);
250
-        $this->db->from($table);
251
-        $this->db->join($jionTable, $jionCondition, $type);
252
-        if ($where != "") {
253
-            $this->db->where($where);
254
-        }
255
-        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
256
-          $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
257
-        }else{
258
-           if($order_by)
259
-            $this->db->order_by($order_by, $order_type);
260
-        }
261
-
262
-        if ($group_by != '') {
263
-            $this->db->group_by($group_by);
264
-        }
265
-
266
-        $this->db->limit($start, $end);
267
-
268
-        return $query = $this->db->get();
269
-    }
270
-
271
-    function getJionQueryCount($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
272
-        $start = (int) $start;
273
-        $end = (int) $end;
274
-        $this->db->select($feild);
275
-        $this->db->from($table);
276
-        $this->db->join($jionTable, $jionCondition, $type);
277
-        if ($where != "") {
278
-            $this->db->where($where);
279
-        }
280
-
281
-        if ($order_type != '' && $order_by != '') {
282
-            $this->db->orderby($order_type, $order_by);
283
-        }
284
-
285
-        if ($group_by != '') {
286
-            $this->db->group_by($group_by);
287
-        }
288
-
289
-
290
-        $query = $this->db->get();
291
-        return $query->num_rows();
292
-    }
293
-
294
-    function getAllJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type, $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
295
-        $start = (int) $start;
296
-        $end = (int) $end;
297
-        $this->db->select($feild);
298
-        $this->db->from($table);
299
-        $jion_table_count = count($jionTable);
300
-        for ($i = 0; $i < $jion_table_count; $i++) {
301
-            $this->db->join($jionTable[$i], $jionCondition[$i], $type[$i]);
302
-        }
303
-
304
-        if ($where != "") {
305
-            $this->db->where($where);
306
-        }
307
-        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
308
-          $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
309
-        }else{
310
-           if($order_by)
311
-            $this->db->order_by($order_by, $order_type);
312
-        }
313
-
314
-        if ($group_by != '') {
315
-            $this->db->group_by($group_by);
316
-        }
317
-
318
-        if ($start != '' && $end != '') {
319
-            $this->db->limit($start, $end);
320
-        }
321
-
322
-        if ($start != '' && $end == '') {
323
-            $this->db->limit($start);
324
-        }
325
-
326
-        return $query = $this->db->get();
327
-    }
328
-
329
-    function getCountWithJion($table, $feild, $where = "", $jionTable, $jionCondition, $type, $group_by = '') {
330
-        $this->db->select($feild);
331
-        $this->db->from($table);
332
-        $jion_table_count = count($jionTable);
333
-        for ($i = 0; $i < $jion_table_count; $i++) {
334
-            $this->db->join($jionTable[$i], $jionCondition[$i], $type[$i]);
335
-        }
336
-
337
-        if ($where != "") {
338
-            $this->db->where($where);
339
-        }
340
-        if ($group_by != '') {
341
-            $this->db->group_by($group_by);
342
-        }
343
-        $query = $this->db->get();
344
-        if ($query->num_rows() > 0) {
345
-            return $query->num_rows();	   
346
-        } else {
347
-            return false;
348
-        }
349
-    }
350
-
351
-    /*     * ********************************************************
246
+	function getJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
247
+		$start = (int) $start;
248
+		$end = (int) $end;
249
+		$this->db->select($feild);
250
+		$this->db->from($table);
251
+		$this->db->join($jionTable, $jionCondition, $type);
252
+		if ($where != "") {
253
+			$this->db->where($where);
254
+		}
255
+		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
256
+		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
257
+		}else{
258
+		   if($order_by)
259
+			$this->db->order_by($order_by, $order_type);
260
+		}
261
+
262
+		if ($group_by != '') {
263
+			$this->db->group_by($group_by);
264
+		}
265
+
266
+		$this->db->limit($start, $end);
267
+
268
+		return $query = $this->db->get();
269
+	}
270
+
271
+	function getJionQueryCount($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
272
+		$start = (int) $start;
273
+		$end = (int) $end;
274
+		$this->db->select($feild);
275
+		$this->db->from($table);
276
+		$this->db->join($jionTable, $jionCondition, $type);
277
+		if ($where != "") {
278
+			$this->db->where($where);
279
+		}
280
+
281
+		if ($order_type != '' && $order_by != '') {
282
+			$this->db->orderby($order_type, $order_by);
283
+		}
284
+
285
+		if ($group_by != '') {
286
+			$this->db->group_by($group_by);
287
+		}
288
+
289
+
290
+		$query = $this->db->get();
291
+		return $query->num_rows();
292
+	}
293
+
294
+	function getAllJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type, $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
295
+		$start = (int) $start;
296
+		$end = (int) $end;
297
+		$this->db->select($feild);
298
+		$this->db->from($table);
299
+		$jion_table_count = count($jionTable);
300
+		for ($i = 0; $i < $jion_table_count; $i++) {
301
+			$this->db->join($jionTable[$i], $jionCondition[$i], $type[$i]);
302
+		}
303
+
304
+		if ($where != "") {
305
+			$this->db->where($where);
306
+		}
307
+		if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
308
+		  $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
309
+		}else{
310
+		   if($order_by)
311
+			$this->db->order_by($order_by, $order_type);
312
+		}
313
+
314
+		if ($group_by != '') {
315
+			$this->db->group_by($group_by);
316
+		}
317
+
318
+		if ($start != '' && $end != '') {
319
+			$this->db->limit($start, $end);
320
+		}
321
+
322
+		if ($start != '' && $end == '') {
323
+			$this->db->limit($start);
324
+		}
325
+
326
+		return $query = $this->db->get();
327
+	}
328
+
329
+	function getCountWithJion($table, $feild, $where = "", $jionTable, $jionCondition, $type, $group_by = '') {
330
+		$this->db->select($feild);
331
+		$this->db->from($table);
332
+		$jion_table_count = count($jionTable);
333
+		for ($i = 0; $i < $jion_table_count; $i++) {
334
+			$this->db->join($jionTable[$i], $jionCondition[$i], $type[$i]);
335
+		}
336
+
337
+		if ($where != "") {
338
+			$this->db->where($where);
339
+		}
340
+		if ($group_by != '') {
341
+			$this->db->group_by($group_by);
342
+		}
343
+		$query = $this->db->get();
344
+		if ($query->num_rows() > 0) {
345
+			return $query->num_rows();	   
346
+		} else {
347
+			return false;
348
+		}
349
+	}
350
+
351
+	/*     * ********************************************************
352 352
       Function getCurrentWithOrder
353 353
      * ******************************************************** */
354 354
 
355
-    function getCurrentWithOrder($table, $feild, $where, $order, $order_by, $limit, $option) {
356
-        $this->db->select($feild);
357
-        $this->db->from($table);
358
-        $this->db->where($where);
359
-        $this->db->order_by($order, $order_by);
360
-        if ($limit != 0) {
361
-            $this->db->limit($limit);
362
-        }
363
-        $query = $this->db->get();
364
-        if ($query->num_rows() > 0) {
365
-            $rowP = $query->row();
366
-            if ($option == 'yes') {
367
-                return $rowP->$feild;
368
-            } else {
369
-                return $query;
370
-            }
371
-        } else {
372
-            if ($option == 'no') {
373
-                return $query;
374
-            } else {
375
-                return false;
376
-            }
377
-        }
378
-    }
379
-
380
-    /*     * ********************************************************
355
+	function getCurrentWithOrder($table, $feild, $where, $order, $order_by, $limit, $option) {
356
+		$this->db->select($feild);
357
+		$this->db->from($table);
358
+		$this->db->where($where);
359
+		$this->db->order_by($order, $order_by);
360
+		if ($limit != 0) {
361
+			$this->db->limit($limit);
362
+		}
363
+		$query = $this->db->get();
364
+		if ($query->num_rows() > 0) {
365
+			$rowP = $query->row();
366
+			if ($option == 'yes') {
367
+				return $rowP->$feild;
368
+			} else {
369
+				return $query;
370
+			}
371
+		} else {
372
+			if ($option == 'no') {
373
+				return $query;
374
+			} else {
375
+				return false;
376
+			}
377
+		}
378
+	}
379
+
380
+	/*     * ********************************************************
381 381
       Function getReferPatients
382 382
      * ******************************************************** */
383 383
 
384
-    function getAllWithOrder($table, $feild, $where) {
385
-        $this->db->select($feild);
386
-        $this->db->from($table);
387
-        $this->db->where($where);
388
-        $query = $this->db->get();
389
-        if ($query->num_rows() > 0) {
390
-            $rowP = $query->row();
391
-            return $rowP->$feild;
392
-        } else {
393
-            return false;
394
-        }
395
-    }
396
-
397
-    function getCommaSperated($table, $select, $where, $limit, $return_message = FALSE, $message = '') {
398
-        if ($table != '') {
399
-            $this->db->select($select);
400
-            $this->db->from($table);
401
-            $this->db->where($where);
402
-            if ($limit != 0) {
403
-                $this->db->limit($limit);
404
-            }
405
-            $query = $this->db->get();
406
-            $string = '';
407
-            if ($query->num_rows() > 0) {
408
-                foreach ($query->result() as $rows) {
409
-                    $string .= $rows->$select . ',';
410
-                }
411
-
412
-                return substr($string, '', -1);
413
-            } else {
414
-                if ($return_message == FALSE) {
415
-                    return '';
416
-                } else {
417
-                    return $message;
418
-                }
419
-            }
420
-        } else {
421
-            return '';
422
-        }
423
-    }
424
-
425
-    function build_concat_dropdown($select, $table, $id_where = '', $id_value = '') {
426
-        $select_params = explode(',', $select);
427
-        if (isset($select_params[3])) {
428
-            $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' ";
429
-        } else {
430
-            $cnt_str = " $select_params[1],' (',$select_params[2],')' ";
431
-        }
432
-        $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ";
433
-        $logintype = $this->session->userdata('logintype');
434
-        if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') {
435
-            $account_data = $this->session->userdata("accountinfo");
436
-            $id_value['reseller_id'] = $account_data['id'];
437
-        }
438
-        if(isset($id_value['type']) && $id_value['type'] == '0,3'){
439
-            $twhere = "type IN (".$id_value["type"].")";
440
-            $this->db->where($twhere);
441
-            unset($id_value['type']);
442
-        }        
443
-        $where = $id_value;
444
-        $drp_array = $this->getSelect($select, $table, $where);
445
-        $drp_array = $drp_array->result();
446
-
447
-        $drp_list = array();
448
-        foreach ($drp_array as $drp_value) {
449
-            $drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1];
450
-        }
451
-        return $drp_list;
452
-    }
384
+	function getAllWithOrder($table, $feild, $where) {
385
+		$this->db->select($feild);
386
+		$this->db->from($table);
387
+		$this->db->where($where);
388
+		$query = $this->db->get();
389
+		if ($query->num_rows() > 0) {
390
+			$rowP = $query->row();
391
+			return $rowP->$feild;
392
+		} else {
393
+			return false;
394
+		}
395
+	}
396
+
397
+	function getCommaSperated($table, $select, $where, $limit, $return_message = FALSE, $message = '') {
398
+		if ($table != '') {
399
+			$this->db->select($select);
400
+			$this->db->from($table);
401
+			$this->db->where($where);
402
+			if ($limit != 0) {
403
+				$this->db->limit($limit);
404
+			}
405
+			$query = $this->db->get();
406
+			$string = '';
407
+			if ($query->num_rows() > 0) {
408
+				foreach ($query->result() as $rows) {
409
+					$string .= $rows->$select . ',';
410
+				}
411
+
412
+				return substr($string, '', -1);
413
+			} else {
414
+				if ($return_message == FALSE) {
415
+					return '';
416
+				} else {
417
+					return $message;
418
+				}
419
+			}
420
+		} else {
421
+			return '';
422
+		}
423
+	}
424
+
425
+	function build_concat_dropdown($select, $table, $id_where = '', $id_value = '') {
426
+		$select_params = explode(',', $select);
427
+		if (isset($select_params[3])) {
428
+			$cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' ";
429
+		} else {
430
+			$cnt_str = " $select_params[1],' (',$select_params[2],')' ";
431
+		}
432
+		$select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ";
433
+		$logintype = $this->session->userdata('logintype');
434
+		if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') {
435
+			$account_data = $this->session->userdata("accountinfo");
436
+			$id_value['reseller_id'] = $account_data['id'];
437
+		}
438
+		if(isset($id_value['type']) && $id_value['type'] == '0,3'){
439
+			$twhere = "type IN (".$id_value["type"].")";
440
+			$this->db->where($twhere);
441
+			unset($id_value['type']);
442
+		}        
443
+		$where = $id_value;
444
+		$drp_array = $this->getSelect($select, $table, $where);
445
+		$drp_array = $drp_array->result();
446
+
447
+		$drp_list = array();
448
+		foreach ($drp_array as $drp_value) {
449
+			$drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1];
450
+		}
451
+		return $drp_list;
452
+	}
453 453
 /******
454 454
 ASTPP  3.0 
455 455
 Recording enable/disable dropdown
456 456
 ****/
457
-    function build_concat_dropdown_refill_coupon($select, $table, $id_where = '', $id_value = '') {
457
+	function build_concat_dropdown_refill_coupon($select, $table, $id_where = '', $id_value = '') {
458 458
 	$select_params = explode(',', $select);
459 459
 	$account_data = $this->session->userdata("accountinfo");
460 460
 	if (isset($select_params[3])) {
@@ -479,225 +479,225 @@  discard block
 block discarded – undo
479 479
 		$drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1];
480 480
 	}
481 481
 	return $drp_list;
482
-    }
482
+	}
483 483
 /***********************************/
484 484
 function build_concat_select_dropdown($select, $table, $id_where = '', $id_value = '') {         
485
-        $select_params = explode(',', $select);
486
-        if (isset($select_params[3])) {
487
-            $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' ";
488
-        } else {
489
-            $cnt_str = " $select_params[1],' (',$select_params[2],')' ";
490
-        }
491
-        $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ";
485
+		$select_params = explode(',', $select);
486
+		if (isset($select_params[3])) {
487
+			$cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' ";
488
+		} else {
489
+			$cnt_str = " $select_params[1],' (',$select_params[2],')' ";
490
+		}
491
+		$select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ";
492 492
 	$where = $id_value;
493
-        $drp_array = $this->getSelect($select, $table, $id_value);
494
-        $drp_array = $drp_array->result();
495
-
496
-        $drp_list = array();
497
-        $drp_list[0] = "--Select--";
498
-        foreach ($drp_array as $drp_value) {
499
-            $drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1];
500
-        }
501
-        return $drp_list;
502
-    }
503
-    function build_dropdown($select, $table, $id_where = '', $id_value = '') {
504
-        $select_params = explode(',', $select);
505
-        $where = '';
506
-        if(isset($id_value["type"]) && $id_value["type"] == "GLOBAL"){
507
-            $where = "type IN ('0','3')";
508
-            $this->db->where($where);
509
-            unset($id_value["type"]);
510
-        }
511
-        if ($id_where != '' && $id_value != '') {
512
-            if ($id_where == 'group_by') {
513
-                $this->db->group_by($id_value);
514
-            } else if ($id_where == "where_arr") {
515
-                $logintype = $this->session->userdata('logintype');
516
-                if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr' && $this->db->field_exists('reseller_id',$table)) {
517
-                    $id_value['reseller_id'] = $this->session->userdata["accountinfo"]['id'];
518
-                }
519
-                $where = $id_value;
520
-            } else {
521
-                $logintype = $this->session->userdata('logintype');
522
-                if (($logintype == 1 || $logintype == 5) && $id_where == 'reseller_id') {
523
-                    $account_data = $this->session->userdata("accountinfo");
524
-                    $id_value = $account_data['id'];
525
-                }
526
-                $where = array($id_where => $id_value);
527
-            }
528
-        }
529
-
530
-        $drp_array = $this->getSelect($select, $table, $where);
531
-        $drp_array = $drp_array->result();
532
-
533
-        $drp_list = array();
534
-        foreach ($drp_array as $drp_value) {
535
-            $drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1];
536
-        }
537
-        return $drp_list;
538
-    }
493
+		$drp_array = $this->getSelect($select, $table, $id_value);
494
+		$drp_array = $drp_array->result();
495
+
496
+		$drp_list = array();
497
+		$drp_list[0] = "--Select--";
498
+		foreach ($drp_array as $drp_value) {
499
+			$drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1];
500
+		}
501
+		return $drp_list;
502
+	}
503
+	function build_dropdown($select, $table, $id_where = '', $id_value = '') {
504
+		$select_params = explode(',', $select);
505
+		$where = '';
506
+		if(isset($id_value["type"]) && $id_value["type"] == "GLOBAL"){
507
+			$where = "type IN ('0','3')";
508
+			$this->db->where($where);
509
+			unset($id_value["type"]);
510
+		}
511
+		if ($id_where != '' && $id_value != '') {
512
+			if ($id_where == 'group_by') {
513
+				$this->db->group_by($id_value);
514
+			} else if ($id_where == "where_arr") {
515
+				$logintype = $this->session->userdata('logintype');
516
+				if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr' && $this->db->field_exists('reseller_id',$table)) {
517
+					$id_value['reseller_id'] = $this->session->userdata["accountinfo"]['id'];
518
+				}
519
+				$where = $id_value;
520
+			} else {
521
+				$logintype = $this->session->userdata('logintype');
522
+				if (($logintype == 1 || $logintype == 5) && $id_where == 'reseller_id') {
523
+					$account_data = $this->session->userdata("accountinfo");
524
+					$id_value = $account_data['id'];
525
+				}
526
+				$where = array($id_where => $id_value);
527
+			}
528
+		}
529
+
530
+		$drp_array = $this->getSelect($select, $table, $where);
531
+		$drp_array = $drp_array->result();
532
+
533
+		$drp_list = array();
534
+		foreach ($drp_array as $drp_value) {
535
+			$drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1];
536
+		}
537
+		return $drp_list;
538
+	}
539 539
   function build_dropdown_deleted($select, $table, $id_where = '', $id_value = '') {
540
-        $select_params = explode(',', $select);
541
-        if(isset($id_value["type"]) ){
542
-            $where = $id_value["type"] == "GLOBAL" ? "type IN ('0','3')": "type IN (".$id_value["type"].")";
543
-            $this->db->where($where);
544
-            unset($id_value["type"]);
545
-        }
546
-        $where = '';
547
-        if ($id_where != '' && $id_value != '') {
548
-            if ($id_where == 'group_by') {
549
-                $this->db->group_by($id_value);
540
+		$select_params = explode(',', $select);
541
+		if(isset($id_value["type"]) ){
542
+			$where = $id_value["type"] == "GLOBAL" ? "type IN ('0','3')": "type IN (".$id_value["type"].")";
543
+			$this->db->where($where);
544
+			unset($id_value["type"]);
545
+		}
546
+		$where = '';
547
+		if ($id_where != '' && $id_value != '') {
548
+			if ($id_where == 'group_by') {
549
+				$this->db->group_by($id_value);
550 550
 
551 551
 	 } else if ($id_where == "where_arr") {
552
-                $logintype = $this->session->userdata('logintype');
553
-                if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') {
554
-                    $account_data = $this->session->userdata("accountinfo");
555
-                    $id_value['reseller_id'] = $account_data['id'];
556
-                }
557
-                $where = $id_value;
558
-            } else {
559
-                $logintype = $this->session->userdata('logintype');
560
-                if (($logintype == 1 || $logintype == 5) && $id_where == 'reseller_id') {
561
-                    $account_data = $this->session->userdata("accountinfo");
562
-                    $id_value = $account_data['id'];
563
-                }
564
-                $where = array($id_where => $id_value);
565
-            }
566
-        }
567
-
568
-        $drp_array = $this->getSelect($select, $table, $where);
569
-
570
-        $drp_array = $drp_array->result();
571
-
572
-        $name=explode("as",$select);
573
-        if(isset($name[3])){
574
-            $name=trim($name[3]);
575
-        }else{
576
-            $name=trim($name[1]);
577
-        }
578
-
579
-        $drp_list = array();
580
-        $dele =array();
581
-        foreach ($drp_array as $drp_value) {
582
-            $dele=explode("^",$drp_value->$name);
583
-            if(isset($dele[1]))
584
-            {
585
-               $drp_list['Deleted'][$drp_value->$select_params[0]] =  str_replace("^","",$drp_value->$name);
586
-            }else{
587
-               $drp_list['Active'][$drp_value->$select_params[0]] = $drp_value->$name;
588
-            }
589
-        }
552
+				$logintype = $this->session->userdata('logintype');
553
+				if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') {
554
+					$account_data = $this->session->userdata("accountinfo");
555
+					$id_value['reseller_id'] = $account_data['id'];
556
+				}
557
+				$where = $id_value;
558
+			} else {
559
+				$logintype = $this->session->userdata('logintype');
560
+				if (($logintype == 1 || $logintype == 5) && $id_where == 'reseller_id') {
561
+					$account_data = $this->session->userdata("accountinfo");
562
+					$id_value = $account_data['id'];
563
+				}
564
+				$where = array($id_where => $id_value);
565
+			}
566
+		}
567
+
568
+		$drp_array = $this->getSelect($select, $table, $where);
569
+
570
+		$drp_array = $drp_array->result();
571
+
572
+		$name=explode("as",$select);
573
+		if(isset($name[3])){
574
+			$name=trim($name[3]);
575
+		}else{
576
+			$name=trim($name[1]);
577
+		}
578
+
579
+		$drp_list = array();
580
+		$dele =array();
581
+		foreach ($drp_array as $drp_value) {
582
+			$dele=explode("^",$drp_value->$name);
583
+			if(isset($dele[1]))
584
+			{
585
+			   $drp_list['Deleted'][$drp_value->$select_params[0]] =  str_replace("^","",$drp_value->$name);
586
+			}else{
587
+			   $drp_list['Active'][$drp_value->$select_params[0]] = $drp_value->$name;
588
+			}
589
+		}
590 590
 	ksort($drp_list);
591
-        return $drp_list;
592
-    }
593
-
594
-    function build_search($accounts_list_search) {
595
-        if ($this->session->userdata('advance_search') == 1) {
596
-            $account_search = $this->session->userdata($accounts_list_search);
597
-            unset($account_search["ajax_search"]);
598
-            unset($account_search["advance_search"]);
599
-            /* ASTPP  3.0 
591
+		return $drp_list;
592
+	}
593
+
594
+	function build_search($accounts_list_search) {
595
+		if ($this->session->userdata('advance_search') == 1) {
596
+			$account_search = $this->session->userdata($accounts_list_search);
597
+			unset($account_search["ajax_search"]);
598
+			unset($account_search["advance_search"]);
599
+			/* ASTPP  3.0 
600 600
              Display Records in
601 601
             */
602
-            unset($account_search['search_in'],$account_search['time']);
603
-            if (!empty($account_search)) {
604
-                foreach ($account_search as $key => $value) {
605
-                    if ($value != "") {
606
-                        if (is_array($value)) {
607
-                            if (array_key_exists($key . "-integer", $value)) {
608
-                                $this->get_interger_array($key, $value[$key . "-integer"], $value[$key]);
609
-                            }
610
-                            if (array_key_exists($key . "-string", $value)) {
611
-                                $this->get_string_array($key, $value[$key . "-string"], $value[$key]);
612
-                            }
602
+			unset($account_search['search_in'],$account_search['time']);
603
+			if (!empty($account_search)) {
604
+				foreach ($account_search as $key => $value) {
605
+					if ($value != "") {
606
+						if (is_array($value)) {
607
+							if (array_key_exists($key . "-integer", $value)) {
608
+								$this->get_interger_array($key, $value[$key . "-integer"], $value[$key]);
609
+							}
610
+							if (array_key_exists($key . "-string", $value)) {
611
+								$this->get_string_array($key, $value[$key . "-string"], $value[$key]);
612
+							}
613 613
                             
614
-                            /**
614
+							/**
615 615
                             ASTPP  3.0 
616 616
                             first used,creation,expiry search date picker
617
-                            **/ 
618
-                            if ($key == 'callstart'||
619
-                                $key == 'date'||
620
-                                $key =='payment_date' ||
621
-                                $key == 'first_used'  ||
622
-                                $key == 'creation'  ||
623
-                                $key =='from_date'||
624
-                                $key =='invoice_date' ||
625
-                                $key =='expiry' ||
626
-                                $key =='created_date' ||
627
-                                $key=='to_date') {
628
-                            /***********************************************/
629
-                                $this->get_date_array($key, $value);
630
-                            }
631
-                        } else {
632
-                            $this->db->where($key, $value);
633
-                        }
617
+							 **/ 
618
+							if ($key == 'callstart'||
619
+								$key == 'date'||
620
+								$key =='payment_date' ||
621
+								$key == 'first_used'  ||
622
+								$key == 'creation'  ||
623
+								$key =='from_date'||
624
+								$key =='invoice_date' ||
625
+								$key =='expiry' ||
626
+								$key =='created_date' ||
627
+								$key=='to_date') {
628
+							/***********************************************/
629
+								$this->get_date_array($key, $value);
630
+							}
631
+						} else {
632
+							$this->db->where($key, $value);
633
+						}
634 634
                         
635
-                    }
636
-                }
635
+					}
636
+				}
637 637
 		return true;
638
-            }
639
-        }
640
-    }
638
+			}
639
+		}
640
+	}
641 641
 
642
-    function get_date_array($field, $value) {
643
-        if ($value != '') {
644
-             if (!empty($value[0])) {
642
+	function get_date_array($field, $value) {
643
+		if ($value != '') {
644
+			 if (!empty($value[0])) {
645 645
 				if($field == 'invoice_date'){
646 646
 					$this->db->where($field . ' >= ', gmdate("Y-m-d", strtotime($value['0']))." 00:00:01");
647 647
 					$this->db->where($field . ' <= ', gmdate("Y-m-d", strtotime($value['0']))." 23:59:59");
648 648
 				}else{
649
-                $this->db->where($field . ' >= ', gmdate('Y-m-d H:i:s',strtotime($value[0])));
649
+				$this->db->where($field . ' >= ', gmdate('Y-m-d H:i:s',strtotime($value[0])));
650 650
 				}
651 651
 			}
652
-            if (!empty($value[1])) {
653
-                $this->db->where($field . ' <= ', gmdate('Y-m-d H:i:s',strtotime($value[1])));
654
-            }
655
-        }
656
-    }
657
-
658
-    function get_interger_array($field, $value, $search_array) {	
659
-        if ($search_array != '') {
660
-            switch ($value) {
661
-                case "1":
662
-                    $this->db->where($field, $search_array);
663
-                    break;
664
-                case "2":
665
-                    $this->db->where($field . ' <>', $search_array);
666
-                    break;
667
-                case "3":
668
-                    $this->db->where($field . ' > ', $search_array);
669
-                    break;
670
-                case "4":
671
-                    $this->db->where($field . ' < ', $search_array);
672
-                    break;
673
-                case "5":
674
-                    $this->db->where($field . ' >= ', $search_array);
675
-                    break;
676
-                case "6":
677
-                    $this->db->where($field . ' <= ', $search_array);
678
-                    break;
679
-            }
680
-        }
681
-    }
682
-
683
-    function get_string_array($field, $value, $search_array) {
684
-        if ($search_array != '') {
685
-            switch ($value) {
686
-                case "1":
687
-                    $str1 = $field . " LIKE '%$search_array%'";
688
-                    $this->db->where($str1);
689
-                    break;
690
-                case "2":
691
-                    $str1 = $field . " NOT LIKE '%$search_array%'";
692
-                    $this->db->where($str1);
693
-                    break;
694
-                case "3":
695
-                    $this->db->where($field, $search_array);
696
-                    break;
697
-                case "4":
698
-                    $this->db->where($field . ' <>', $search_array);
699
-                    break;
700
-                case "5":
652
+			if (!empty($value[1])) {
653
+				$this->db->where($field . ' <= ', gmdate('Y-m-d H:i:s',strtotime($value[1])));
654
+			}
655
+		}
656
+	}
657
+
658
+	function get_interger_array($field, $value, $search_array) {	
659
+		if ($search_array != '') {
660
+			switch ($value) {
661
+				case "1":
662
+					$this->db->where($field, $search_array);
663
+					break;
664
+				case "2":
665
+					$this->db->where($field . ' <>', $search_array);
666
+					break;
667
+				case "3":
668
+					$this->db->where($field . ' > ', $search_array);
669
+					break;
670
+				case "4":
671
+					$this->db->where($field . ' < ', $search_array);
672
+					break;
673
+				case "5":
674
+					$this->db->where($field . ' >= ', $search_array);
675
+					break;
676
+				case "6":
677
+					$this->db->where($field . ' <= ', $search_array);
678
+					break;
679
+			}
680
+		}
681
+	}
682
+
683
+	function get_string_array($field, $value, $search_array) {
684
+		if ($search_array != '') {
685
+			switch ($value) {
686
+				case "1":
687
+					$str1 = $field . " LIKE '%$search_array%'";
688
+					$this->db->where($str1);
689
+					break;
690
+				case "2":
691
+					$str1 = $field . " NOT LIKE '%$search_array%'";
692
+					$this->db->where($str1);
693
+					break;
694
+				case "3":
695
+					$this->db->where($field, $search_array);
696
+					break;
697
+				case "4":
698
+					$this->db->where($field . ' <>', $search_array);
699
+					break;
700
+				case "5":
701 701
 					if($field == "pattern"){
702 702
 							$str1 = $field . " LIKE '^".$search_array."%'";
703 703
 							$this->db->where($str1);
@@ -706,8 +706,8 @@  discard block
 block discarded – undo
706 706
 							$this->db->where($str1);
707 707
 					}
708 708
 
709
-                    break;
710
-                case "6":
709
+					break;
710
+				case "6":
711 711
 					if($field == "pattern"){
712 712
 							$str1 = $field . " LIKE '%".$search_array.".*'";
713 713
 							$this->db->where($str1);
@@ -716,293 +716,293 @@  discard block
 block discarded – undo
716 716
 							$this->db->where($str1);
717 717
 					}		
718 718
 
719
-                    break;
720
-            }       
721
-        }
722
-    }
719
+					break;
720
+			}       
721
+		}
722
+	}
723 723
   function build_search_string($accounts_list_search) {
724 724
 	 $where = null;
725 725
 	 $search=$this->session->userdata($accounts_list_search);
726
-        if ($this->session->userdata('advance_search') == 1) {
727
-            $account_search = $this->session->userdata($accounts_list_search);
728
-            unset($account_search["ajax_search"]);
729
-            unset($account_search["advance_search"]);
730
-            if (!empty($account_search)) {
731
-                foreach ($account_search as $key => $value) {
732
-                    if ($value != "") {
733
-                        if (is_array($value)) {
734
-                            if (array_key_exists($key . "-integer", $value)) {
726
+		if ($this->session->userdata('advance_search') == 1) {
727
+			$account_search = $this->session->userdata($accounts_list_search);
728
+			unset($account_search["ajax_search"]);
729
+			unset($account_search["advance_search"]);
730
+			if (!empty($account_search)) {
731
+				foreach ($account_search as $key => $value) {
732
+					if ($value != "") {
733
+						if (is_array($value)) {
734
+							if (array_key_exists($key . "-integer", $value)) {
735 735
 				$string=null;
736
-                                $string =$this->build_interger_where($key, $value[$key . "-integer"], $value[$key]);
737
-                                if($string)
738
-                                $where.= "$string AND ";
739
-                            }
740
-                            if (array_key_exists($key . "-string", $value)) {
736
+								$string =$this->build_interger_where($key, $value[$key . "-integer"], $value[$key]);
737
+								if($string)
738
+								$where.= "$string AND ";
739
+							}
740
+							if (array_key_exists($key . "-string", $value)) {
741 741
 				$string=null;
742
-                                $string=$this->build_string_where($key, $value[$key . "-string"], $value[$key]);
743
-                                if($string)
744
-                                $where.= "$string AND ";
745
-                            }
746
-                            if ($key == 'callstart'|| $key == 'date'||$key== 'log_time') {
742
+								$string=$this->build_string_where($key, $value[$key . "-string"], $value[$key]);
743
+								if($string)
744
+								$where.= "$string AND ";
745
+							}
746
+							if ($key == 'callstart'|| $key == 'date'||$key== 'log_time') {
747 747
 				$string=null;
748
-                                $string=$this->build_date_where($key, $value);
749
-                                if($string)
750
-                                $where.= "$string AND ";
751
-                            }
752
-                        } else {
753
-			      $where.="$key = '$value'AND ";
754
-                        }
755
-                    }
756
-                }
757
-            }
758
-        }
759
-        $where =rtrim($where ," AND ");
760
-        return $where;
761
-    }
762
-    // This function using by reports module don't delete it
763
-    function build_string_where($field, $value, $search_array){
748
+								$string=$this->build_date_where($key, $value);
749
+								if($string)
750
+								$where.= "$string AND ";
751
+							}
752
+						} else {
753
+				  $where.="$key = '$value'AND ";
754
+						}
755
+					}
756
+				}
757
+			}
758
+		}
759
+		$where =rtrim($where ," AND ");
760
+		return $where;
761
+	}
762
+	// This function using by reports module don't delete it
763
+	function build_string_where($field, $value, $search_array){
764 764
 	$where=null;
765
-         if ($search_array != '') {
766
-            switch ($value) {
767
-                case "1":
768
-                    $where = "$field LIKE '%$search_array%'";
769
-                    break;
770
-                case "2":
771
-                    $where = "$field NOT LIKE '%$search_array%'";
772
-                    break;
773
-                case "3":
774
-                    $where = "$field = '$search_array'";
775
-                    break;
776
-                case "4":
777
-                    $where = "$field <> '$search_array'";
778
-                    break;
779
-                case "5":
780
-		    if($field == "pattern"){
781
-		      $where = $field . " LIKE '^".$search_array."%'";
782
-		    }else{
783
-		      $where = $field . " LIKE '".$search_array."%'";
784
-		    }
785
-                    break;
786
-                case "6":
787
-		    if($field == "pattern"){
788
-		       $str1 = $field . " LIKE '%".$search_array.".*'";
789
-		    }else{
790
-		       $str1 = $field . " LIKE '%".$search_array."'";
791
-		    }
792
-		    break;
793
-            }
794
-        }
795
-        return $where;
796
-    }
765
+		 if ($search_array != '') {
766
+			switch ($value) {
767
+				case "1":
768
+					$where = "$field LIKE '%$search_array%'";
769
+					break;
770
+				case "2":
771
+					$where = "$field NOT LIKE '%$search_array%'";
772
+					break;
773
+				case "3":
774
+					$where = "$field = '$search_array'";
775
+					break;
776
+				case "4":
777
+					$where = "$field <> '$search_array'";
778
+					break;
779
+				case "5":
780
+			if($field == "pattern"){
781
+			  $where = $field . " LIKE '^".$search_array."%'";
782
+			}else{
783
+			  $where = $field . " LIKE '".$search_array."%'";
784
+			}
785
+					break;
786
+				case "6":
787
+			if($field == "pattern"){
788
+			   $str1 = $field . " LIKE '%".$search_array.".*'";
789
+			}else{
790
+			   $str1 = $field . " LIKE '%".$search_array."'";
791
+			}
792
+			break;
793
+			}
794
+		}
795
+		return $where;
796
+	}
797 797
     
798
-    function build_interger_where($field, $value, $search_array) {
798
+	function build_interger_where($field, $value, $search_array) {
799 799
 	$where=null;
800
-        if ($search_array != '') {
801
-	    if(is_numeric($search_array))
802
-	    {
800
+		if ($search_array != '') {
801
+		if(is_numeric($search_array))
802
+		{
803 803
 		switch ($value) {
804
-		    case "1":
804
+			case "1":
805 805
 			$where = "$field = '$search_array'";
806 806
 			break;
807
-		    case "2":
807
+			case "2":
808 808
 			$where = "$field <> '$search_array'";
809 809
 			break;
810
-		    case "3":
810
+			case "3":
811 811
 			$where = "$field > '$search_array'";
812 812
 			break;
813
-		    case "4":
813
+			case "4":
814 814
 			$where = "$field < '$search_array'";
815 815
 			break;
816
-		    case "5":
816
+			case "5":
817 817
 			$where = "$field >= '$search_array'";
818 818
 			break;
819
-		    case "6":
819
+			case "6":
820 820
 			$where = "$field <= '$search_array'";
821 821
 			break;
822 822
 		}
823
-            }
824
-            else
825
-            {
826
-	      $this->db->where("$field IS NULL");
827
-	      $where= "$field IS NULL";
828
-            }
829
-        }
830
-        return $where;
831
-    }
832
-    function build_date_where($field, $value) {
823
+			}
824
+			else
825
+			{
826
+		  $this->db->where("$field IS NULL");
827
+		  $where= "$field IS NULL";
828
+			}
829
+		}
830
+		return $where;
831
+	}
832
+	function build_date_where($field, $value) {
833 833
 	$where =null;
834
-        if ($value != '') {
835
-            if (!empty($value[0])) {
834
+		if ($value != '') {
835
+			if (!empty($value[0])) {
836 836
 		$string=null;
837
-                $string="$field >= '$value[0]'";
838
-                if($string)
839
-                $where.=$string." AND ";
840
-            }
841
-            if (!empty($value[1])) {
837
+				$string="$field >= '$value[0]'";
838
+				if($string)
839
+				$where.=$string." AND ";
840
+			}
841
+			if (!empty($value[1])) {
842 842
 		$string=null;
843
-                $string="$field <= '$value[1]'";
844
-                if($string)
845
-                $where.=$string." AND ";
846
-            }
847
-        }
848
-        if($where){
843
+				$string="$field <= '$value[1]'";
844
+				if($string)
845
+				$where.=$string." AND ";
846
+			}
847
+		}
848
+		if($where){
849 849
 	  $where =rtrim($where," AND ");
850
-        }
851
-        return $where;
852
-    }
853
-    function get_available_bal($account_info) {
854
-        $available_bal = 0;
855
-        $available_bal = ($account_info["balance"]) + $account_info["posttoexternal"] * ($account_info["credit_limit"]);
856
-        return $available_bal;
857
-    }
858
-
859
-    function update_balance($amount, $accountid, $payment_type) {
860
-        if ($payment_type == "debit") {
861
-            $query = 'UPDATE `accounts` SET `balance` = (balance - ' . $amount . ') WHERE `id` = ' . $accountid;
862
-            return $this->db->query($query);
863
-        } else {
864
-            $query = 'UPDATE `accounts` SET `balance` = (balance + ' . $amount . ') WHERE `id` = ' . $accountid;
865
-            return $this->db->query($query);
866
-        }
867
-    }
868
-
869
-    function build_batch_update_array($update_array) {
870
-        $updateflg = false;
871
-        foreach ($update_array as $key => $update_fields) {
872
-            if (is_array($update_fields)) {
873
-                switch ($update_fields["operator"]) {
874
-                    case "1":
875
-                        //                        $this->db->where($field, $search_array);
876
-                        break;
877
-                    case "2":
878
-                        if($update_fields[$key] != ''){
879
-                            $updateflg = true;
880
-                            $this->db->set($key,$update_fields[$key]);    
881
-                        }
882
-                        break;
883
-                    case "3":
884
-                        $this->db->set($key, $key . "+" . $update_fields[$key], FALSE);
885
-                        $updateflg = true;
886
-                        break;
887
-                    case "4":
888
-                        $this->db->set($key, $key . "-" . $update_fields[$key], FALSE);
889
-                        $updateflg = true;
890
-                        break;
891
-                }
892
-            } else {
893
-                if ($update_fields != ""){
894
-                    $this->db->set($key,$update_fields);
895
-                    $updateflg = true;
896
-                }
897
-            }
898
-        }
899
-        return $updateflg;
900
-    }
901
-    function build_search_opensips($opensips_db_obj,$accounts_list_search) {
902
-        if ($this->session->userdata('advance_search') == 1) {
903
-            $account_search = $this->session->userdata($accounts_list_search);
904
-            unset($account_search["ajax_search"]);
905
-            unset($account_search["advance_search"]);
906
-            foreach ($account_search as $key => $value) {
907
-                if ($value != "") {
908
-                    if (is_array($value)) {
909
-                        if (array_key_exists($key . "-integer", $value)) {
910
-                            $this->get_opensips_interger_array($opensips_db_obj,$key, $value[$key . "-integer"], $value[$key]);
911
-                        }
912
-                        if (array_key_exists($key . "-string", $value)) {
913
-                            $this->get_opensips_string_array($opensips_db_obj,$key, $value[$key . "-string"], $value[$key]);
914
-                        }
915
-                    } else {
916
-                        $opensips_db_obj->where($key, $value);
917
-                    }
918
-                }
919
-            }
920
-        }
921
-    }
922
-
923
-    function get_opensips_interger_array($opensips_db_obj,$field, $value, $search_array) {
924
-        if ($search_array != '') {
925
-            switch ($value) {
926
-                case "1":
927
-                    $opensips_db_obj->where($field, $search_array);
928
-                    break;
929
-                case "2":
930
-                    $opensips_db_obj->where($field . ' <>', $search_array);
931
-                    break;
932
-                case "3":
933
-                    $opensips_db_obj->where($field . ' > ', $search_array);
934
-                    break;
935
-                case "4":
936
-                    $opensips_db_obj->where($field . ' < ', $search_array);
937
-                    break;
938
-                case "5":
939
-                    $opensips_db_obj->where($field . ' >= ', $search_array);
940
-                    break;
941
-                case "6":
942
-                    $opensips_db_obj->where($field . ' <= ', $search_array);
943
-                    break;
944
-            }
945
-        }
946
-    }
947
-
948
-    function get_opensips_string_array($opensips_db_obj,$field, $value, $search_array) {
949
-        if ($search_array != '') {
950
-            switch ($value) {
951
-                case "1":
952
-                    $opensips_db_obj->like($field, $search_array);
953
-                    break;
954
-                case "2":
955
-                    $opensips_db_obj->not_like($field, $search_array);
956
-                    break;
957
-                case "3":
958
-                    $opensips_db_obj->where($field, $search_array);
959
-                    break;
960
-                case "4":
961
-                    $opensips_db_obj->where($field . ' <>', $search_array);
962
-                    break;
963
-                case "5":
964
-		    $str1 = $field . " LIKE '".$search_array."%'";
965
-		    $opensips_db_obj->where($str1);
966
-		    break;
850
+		}
851
+		return $where;
852
+	}
853
+	function get_available_bal($account_info) {
854
+		$available_bal = 0;
855
+		$available_bal = ($account_info["balance"]) + $account_info["posttoexternal"] * ($account_info["credit_limit"]);
856
+		return $available_bal;
857
+	}
858
+
859
+	function update_balance($amount, $accountid, $payment_type) {
860
+		if ($payment_type == "debit") {
861
+			$query = 'UPDATE `accounts` SET `balance` = (balance - ' . $amount . ') WHERE `id` = ' . $accountid;
862
+			return $this->db->query($query);
863
+		} else {
864
+			$query = 'UPDATE `accounts` SET `balance` = (balance + ' . $amount . ') WHERE `id` = ' . $accountid;
865
+			return $this->db->query($query);
866
+		}
867
+	}
868
+
869
+	function build_batch_update_array($update_array) {
870
+		$updateflg = false;
871
+		foreach ($update_array as $key => $update_fields) {
872
+			if (is_array($update_fields)) {
873
+				switch ($update_fields["operator"]) {
874
+					case "1":
875
+						//                        $this->db->where($field, $search_array);
876
+						break;
877
+					case "2":
878
+						if($update_fields[$key] != ''){
879
+							$updateflg = true;
880
+							$this->db->set($key,$update_fields[$key]);    
881
+						}
882
+						break;
883
+					case "3":
884
+						$this->db->set($key, $key . "+" . $update_fields[$key], FALSE);
885
+						$updateflg = true;
886
+						break;
887
+					case "4":
888
+						$this->db->set($key, $key . "-" . $update_fields[$key], FALSE);
889
+						$updateflg = true;
890
+						break;
891
+				}
892
+			} else {
893
+				if ($update_fields != ""){
894
+					$this->db->set($key,$update_fields);
895
+					$updateflg = true;
896
+				}
897
+			}
898
+		}
899
+		return $updateflg;
900
+	}
901
+	function build_search_opensips($opensips_db_obj,$accounts_list_search) {
902
+		if ($this->session->userdata('advance_search') == 1) {
903
+			$account_search = $this->session->userdata($accounts_list_search);
904
+			unset($account_search["ajax_search"]);
905
+			unset($account_search["advance_search"]);
906
+			foreach ($account_search as $key => $value) {
907
+				if ($value != "") {
908
+					if (is_array($value)) {
909
+						if (array_key_exists($key . "-integer", $value)) {
910
+							$this->get_opensips_interger_array($opensips_db_obj,$key, $value[$key . "-integer"], $value[$key]);
911
+						}
912
+						if (array_key_exists($key . "-string", $value)) {
913
+							$this->get_opensips_string_array($opensips_db_obj,$key, $value[$key . "-string"], $value[$key]);
914
+						}
915
+					} else {
916
+						$opensips_db_obj->where($key, $value);
917
+					}
918
+				}
919
+			}
920
+		}
921
+	}
922
+
923
+	function get_opensips_interger_array($opensips_db_obj,$field, $value, $search_array) {
924
+		if ($search_array != '') {
925
+			switch ($value) {
926
+				case "1":
927
+					$opensips_db_obj->where($field, $search_array);
928
+					break;
929
+				case "2":
930
+					$opensips_db_obj->where($field . ' <>', $search_array);
931
+					break;
932
+				case "3":
933
+					$opensips_db_obj->where($field . ' > ', $search_array);
934
+					break;
935
+				case "4":
936
+					$opensips_db_obj->where($field . ' < ', $search_array);
937
+					break;
938
+				case "5":
939
+					$opensips_db_obj->where($field . ' >= ', $search_array);
940
+					break;
941
+				case "6":
942
+					$opensips_db_obj->where($field . ' <= ', $search_array);
943
+					break;
944
+			}
945
+		}
946
+	}
947
+
948
+	function get_opensips_string_array($opensips_db_obj,$field, $value, $search_array) {
949
+		if ($search_array != '') {
950
+			switch ($value) {
951
+				case "1":
952
+					$opensips_db_obj->like($field, $search_array);
953
+					break;
954
+				case "2":
955
+					$opensips_db_obj->not_like($field, $search_array);
956
+					break;
957
+				case "3":
958
+					$opensips_db_obj->where($field, $search_array);
959
+					break;
960
+				case "4":
961
+					$opensips_db_obj->where($field . ' <>', $search_array);
962
+					break;
963
+				case "5":
964
+			$str1 = $field . " LIKE '".$search_array."%'";
965
+			$opensips_db_obj->where($str1);
966
+			break;
967 967
 		case "6":
968
-		    $str1 = $field . " LIKE '%".$search_array."'";
969
-		    $opensips_db_obj->where($str1);
970
-		    break;
971
-            }
972
-        }
973
-    }
968
+			$str1 = $field . " LIKE '%".$search_array."'";
969
+			$opensips_db_obj->where($str1);
970
+			break;
971
+			}
972
+		}
973
+	}
974 974
 /********invoice changes *********/
975 975
   function build_dropdown_invoices($select, $table, $id_where = '', $id_value = '') {
976
-        $select_params = explode(',', $select);
977
-        $select_params = explode(',', $select);
978
-        if (isset($select_params[3])) {
979
-            $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' ";
980
-        } else {
981
-            $cnt_str = " $select_params[1],' (',$select_params[2],')' ";
982
-        }
983
-        $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ,".$select_params[4] ;
984
-        $logintype = $this->session->userdata('logintype');
985
-        if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') {
986
-            $account_data = $this->session->userdata("accountinfo");
987
-            $id_value['reseller_id'] = $account_data['id'];
988
-        }
989
-        $where = $id_value;
990
-        $drp_array = $this->getSelect($select, $table, $where);
991
-        $drp_array = $drp_array->result();
992
-        $drp_list = array();
993
-        foreach ($drp_array as $drp_value) {
994
-            if($drp_value->type == 3)
995
-            {
996
-               $drp_list['Provider'][$drp_value->id] = $drp_value->first_name;
997
-            }elseif($drp_value->type == 1){
998
-               $drp_list['Reseller'][$drp_value->id] = $drp_value->first_name;
999
-            }else{
1000
-               $drp_list['Customer'][$drp_value->id] = $drp_value->first_name;
1001
-            }
1002
-        }
976
+		$select_params = explode(',', $select);
977
+		$select_params = explode(',', $select);
978
+		if (isset($select_params[3])) {
979
+			$cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' ";
980
+		} else {
981
+			$cnt_str = " $select_params[1],' (',$select_params[2],')' ";
982
+		}
983
+		$select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ,".$select_params[4] ;
984
+		$logintype = $this->session->userdata('logintype');
985
+		if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') {
986
+			$account_data = $this->session->userdata("accountinfo");
987
+			$id_value['reseller_id'] = $account_data['id'];
988
+		}
989
+		$where = $id_value;
990
+		$drp_array = $this->getSelect($select, $table, $where);
991
+		$drp_array = $drp_array->result();
992
+		$drp_list = array();
993
+		foreach ($drp_array as $drp_value) {
994
+			if($drp_value->type == 3)
995
+			{
996
+			   $drp_list['Provider'][$drp_value->id] = $drp_value->first_name;
997
+			}elseif($drp_value->type == 1){
998
+			   $drp_list['Reseller'][$drp_value->id] = $drp_value->first_name;
999
+			}else{
1000
+			   $drp_list['Customer'][$drp_value->id] = $drp_value->first_name;
1001
+			}
1002
+		}
1003 1003
 	ksort($drp_list);
1004
-        return $drp_list;
1005
-    }
1004
+		return $drp_list;
1005
+	}
1006 1006
 }
1007 1007
 
1008 1008
 ?>
Please login to merge, or discard this patch.
Spacing   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $this->db->select($select);
87 87
         $this->db->from($tableName);
88 88
         $this->db->where($where);
89
-        $this->db->order_by($order_by,$order_type);
89
+        $this->db->order_by($order_by, $order_type);
90 90
         $query = $this->db->get();
91 91
         return $query;
92 92
     }
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
         
137 137
         if ($paging_limit)
138 138
             $this->db->limit($paging_limit, $start_limit);
139
-        if (!empty($groupby))
139
+        if ( ! empty($groupby))
140 140
             $this->db->group_by($groupby);
141
-        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
142
-          $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
143
-        }else{
144
-           if($order_by)
141
+        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
142
+          $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
143
+        } else {
144
+           if ($order_by)
145 145
             $this->db->order_by($order_by, $order_type);
146 146
         }        
147 147
         $query = $this->db->get();
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         $this->db->order_by($order_by, $order_type);
163 163
         if ($paging_limit)
164 164
             $this->db->limit($paging_limit, $start_limit);
165
-        if (!empty($groupby))
165
+        if ( ! empty($groupby))
166 166
             $this->db->groupby($groupby);
167 167
         $query = $this->db->get();
168 168
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         if ($where != "") {
193 193
             $this->db->where($where);
194 194
         }
195
-        if (!empty($where_in)) {
195
+        if ( ! empty($where_in)) {
196 196
             $this->db->where_in($key, $where_in);
197 197
         }
198 198
         $this->db->from($table);
@@ -244,18 +244,18 @@  discard block
 block discarded – undo
244 244
      * ******************************************************** */
245 245
 
246 246
     function getJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
247
-        $start = (int) $start;
248
-        $end = (int) $end;
247
+        $start = (int)$start;
248
+        $end = (int)$end;
249 249
         $this->db->select($feild);
250 250
         $this->db->from($table);
251 251
         $this->db->join($jionTable, $jionCondition, $type);
252 252
         if ($where != "") {
253 253
             $this->db->where($where);
254 254
         }
255
-        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
256
-          $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
257
-        }else{
258
-           if($order_by)
255
+        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
256
+          $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
257
+        } else {
258
+           if ($order_by)
259 259
             $this->db->order_by($order_by, $order_type);
260 260
         }
261 261
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
     }
270 270
 
271 271
     function getJionQueryCount($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
272
-        $start = (int) $start;
273
-        $end = (int) $end;
272
+        $start = (int)$start;
273
+        $end = (int)$end;
274 274
         $this->db->select($feild);
275 275
         $this->db->from($table);
276 276
         $this->db->join($jionTable, $jionCondition, $type);
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
     }
293 293
 
294 294
     function getAllJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type, $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') {
295
-        $start = (int) $start;
296
-        $end = (int) $end;
295
+        $start = (int)$start;
296
+        $end = (int)$end;
297 297
         $this->db->select($feild);
298 298
         $this->db->from($table);
299 299
         $jion_table_count = count($jionTable);
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
         if ($where != "") {
305 305
             $this->db->where($where);
306 306
         }
307
-        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
308
-          $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
309
-        }else{
310
-           if($order_by)
307
+        if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') {
308
+          $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']);
309
+        } else {
310
+           if ($order_by)
311 311
             $this->db->order_by($order_by, $order_type);
312 312
         }
313 313
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
             $string = '';
407 407
             if ($query->num_rows() > 0) {
408 408
                 foreach ($query->result() as $rows) {
409
-                    $string .= $rows->$select . ',';
409
+                    $string .= $rows->$select.',';
410 410
                 }
411 411
 
412 412
                 return substr($string, '', -1);
@@ -429,13 +429,13 @@  discard block
 block discarded – undo
429 429
         } else {
430 430
             $cnt_str = " $select_params[1],' (',$select_params[2],')' ";
431 431
         }
432
-        $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ";
432
+        $select = $select_params[0].", concat($cnt_str) as $select_params[1] ";
433 433
         $logintype = $this->session->userdata('logintype');
434 434
         if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') {
435 435
             $account_data = $this->session->userdata("accountinfo");
436 436
             $id_value['reseller_id'] = $account_data['id'];
437 437
         }
438
-        if(isset($id_value['type']) && $id_value['type'] == '0,3'){
438
+        if (isset($id_value['type']) && $id_value['type'] == '0,3') {
439 439
             $twhere = "type IN (".$id_value["type"].")";
440 440
             $this->db->where($twhere);
441 441
             unset($id_value['type']);
@@ -462,12 +462,12 @@  discard block
 block discarded – undo
462 462
 	} else {
463 463
 		$cnt_str = " $select_params[1],' (',$select_params[2],')' ";
464 464
 	}
465
-	$select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ";
465
+	$select = $select_params[0].", concat($cnt_str) as $select_params[1] ";
466 466
 	$logintype = $this->session->userdata('logintype');
467 467
 	if ($account_data['type'] == 1 && $id_where == 'where_arr') {
468 468
 	  $id_value['reseller_id'] = $account_data['id'];
469
-	}else{
470
-	  $this->db->or_where('type',3);
469
+	} else {
470
+	  $this->db->or_where('type', 3);
471 471
 	}
472 472
 	$where = $id_value;
473 473
 	$this->db->where($where);
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
         } else {
489 489
             $cnt_str = " $select_params[1],' (',$select_params[2],')' ";
490 490
         }
491
-        $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ";
491
+        $select = $select_params[0].", concat($cnt_str) as $select_params[1] ";
492 492
 	$where = $id_value;
493 493
         $drp_array = $this->getSelect($select, $table, $id_value);
494 494
         $drp_array = $drp_array->result();
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
     function build_dropdown($select, $table, $id_where = '', $id_value = '') {
504 504
         $select_params = explode(',', $select);
505 505
         $where = '';
506
-        if(isset($id_value["type"]) && $id_value["type"] == "GLOBAL"){
506
+        if (isset($id_value["type"]) && $id_value["type"] == "GLOBAL") {
507 507
             $where = "type IN ('0','3')";
508 508
             $this->db->where($where);
509 509
             unset($id_value["type"]);
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
                 $this->db->group_by($id_value);
514 514
             } else if ($id_where == "where_arr") {
515 515
                 $logintype = $this->session->userdata('logintype');
516
-                if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr' && $this->db->field_exists('reseller_id',$table)) {
516
+                if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr' && $this->db->field_exists('reseller_id', $table)) {
517 517
                     $id_value['reseller_id'] = $this->session->userdata["accountinfo"]['id'];
518 518
                 }
519 519
                 $where = $id_value;
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
     }
539 539
   function build_dropdown_deleted($select, $table, $id_where = '', $id_value = '') {
540 540
         $select_params = explode(',', $select);
541
-        if(isset($id_value["type"]) ){
542
-            $where = $id_value["type"] == "GLOBAL" ? "type IN ('0','3')": "type IN (".$id_value["type"].")";
541
+        if (isset($id_value["type"])) {
542
+            $where = $id_value["type"] == "GLOBAL" ? "type IN ('0','3')" : "type IN (".$id_value["type"].")";
543 543
             $this->db->where($where);
544 544
             unset($id_value["type"]);
545 545
         }
@@ -569,21 +569,21 @@  discard block
 block discarded – undo
569 569
 
570 570
         $drp_array = $drp_array->result();
571 571
 
572
-        $name=explode("as",$select);
573
-        if(isset($name[3])){
574
-            $name=trim($name[3]);
575
-        }else{
576
-            $name=trim($name[1]);
572
+        $name = explode("as", $select);
573
+        if (isset($name[3])) {
574
+            $name = trim($name[3]);
575
+        } else {
576
+            $name = trim($name[1]);
577 577
         }
578 578
 
579 579
         $drp_list = array();
580
-        $dele =array();
580
+        $dele = array();
581 581
         foreach ($drp_array as $drp_value) {
582
-            $dele=explode("^",$drp_value->$name);
583
-            if(isset($dele[1]))
582
+            $dele = explode("^", $drp_value->$name);
583
+            if (isset($dele[1]))
584 584
             {
585
-               $drp_list['Deleted'][$drp_value->$select_params[0]] =  str_replace("^","",$drp_value->$name);
586
-            }else{
585
+               $drp_list['Deleted'][$drp_value->$select_params[0]] = str_replace("^", "", $drp_value->$name);
586
+            } else {
587 587
                $drp_list['Active'][$drp_value->$select_params[0]] = $drp_value->$name;
588 588
             }
589 589
         }
@@ -599,32 +599,32 @@  discard block
 block discarded – undo
599 599
             /* ASTPP  3.0 
600 600
              Display Records in
601 601
             */
602
-            unset($account_search['search_in'],$account_search['time']);
603
-            if (!empty($account_search)) {
602
+            unset($account_search['search_in'], $account_search['time']);
603
+            if ( ! empty($account_search)) {
604 604
                 foreach ($account_search as $key => $value) {
605 605
                     if ($value != "") {
606 606
                         if (is_array($value)) {
607
-                            if (array_key_exists($key . "-integer", $value)) {
608
-                                $this->get_interger_array($key, $value[$key . "-integer"], $value[$key]);
607
+                            if (array_key_exists($key."-integer", $value)) {
608
+                                $this->get_interger_array($key, $value[$key."-integer"], $value[$key]);
609 609
                             }
610
-                            if (array_key_exists($key . "-string", $value)) {
611
-                                $this->get_string_array($key, $value[$key . "-string"], $value[$key]);
610
+                            if (array_key_exists($key."-string", $value)) {
611
+                                $this->get_string_array($key, $value[$key."-string"], $value[$key]);
612 612
                             }
613 613
                             
614 614
                             /**
615 615
                             ASTPP  3.0 
616 616
                             first used,creation,expiry search date picker
617 617
                             **/ 
618
-                            if ($key == 'callstart'||
619
-                                $key == 'date'||
620
-                                $key =='payment_date' ||
621
-                                $key == 'first_used'  ||
622
-                                $key == 'creation'  ||
623
-                                $key =='from_date'||
624
-                                $key =='invoice_date' ||
625
-                                $key =='expiry' ||
626
-                                $key =='created_date' ||
627
-                                $key=='to_date') {
618
+                            if ($key == 'callstart' ||
619
+                                $key == 'date' ||
620
+                                $key == 'payment_date' ||
621
+                                $key == 'first_used' ||
622
+                                $key == 'creation' ||
623
+                                $key == 'from_date' ||
624
+                                $key == 'invoice_date' ||
625
+                                $key == 'expiry' ||
626
+                                $key == 'created_date' ||
627
+                                $key == 'to_date') {
628 628
                             /***********************************************/
629 629
                                 $this->get_date_array($key, $value);
630 630
                             }
@@ -641,16 +641,16 @@  discard block
 block discarded – undo
641 641
 
642 642
     function get_date_array($field, $value) {
643 643
         if ($value != '') {
644
-             if (!empty($value[0])) {
645
-				if($field == 'invoice_date'){
646
-					$this->db->where($field . ' >= ', gmdate("Y-m-d", strtotime($value['0']))." 00:00:01");
647
-					$this->db->where($field . ' <= ', gmdate("Y-m-d", strtotime($value['0']))." 23:59:59");
648
-				}else{
649
-                $this->db->where($field . ' >= ', gmdate('Y-m-d H:i:s',strtotime($value[0])));
644
+             if ( ! empty($value[0])) {
645
+				if ($field == 'invoice_date') {
646
+					$this->db->where($field.' >= ', gmdate("Y-m-d", strtotime($value['0']))." 00:00:01");
647
+					$this->db->where($field.' <= ', gmdate("Y-m-d", strtotime($value['0']))." 23:59:59");
648
+				} else {
649
+                $this->db->where($field.' >= ', gmdate('Y-m-d H:i:s', strtotime($value[0])));
650 650
 				}
651 651
 			}
652
-            if (!empty($value[1])) {
653
-                $this->db->where($field . ' <= ', gmdate('Y-m-d H:i:s',strtotime($value[1])));
652
+            if ( ! empty($value[1])) {
653
+                $this->db->where($field.' <= ', gmdate('Y-m-d H:i:s', strtotime($value[1])));
654 654
             }
655 655
         }
656 656
     }
@@ -662,19 +662,19 @@  discard block
 block discarded – undo
662 662
                     $this->db->where($field, $search_array);
663 663
                     break;
664 664
                 case "2":
665
-                    $this->db->where($field . ' <>', $search_array);
665
+                    $this->db->where($field.' <>', $search_array);
666 666
                     break;
667 667
                 case "3":
668
-                    $this->db->where($field . ' > ', $search_array);
668
+                    $this->db->where($field.' > ', $search_array);
669 669
                     break;
670 670
                 case "4":
671
-                    $this->db->where($field . ' < ', $search_array);
671
+                    $this->db->where($field.' < ', $search_array);
672 672
                     break;
673 673
                 case "5":
674
-                    $this->db->where($field . ' >= ', $search_array);
674
+                    $this->db->where($field.' >= ', $search_array);
675 675
                     break;
676 676
                 case "6":
677
-                    $this->db->where($field . ' <= ', $search_array);
677
+                    $this->db->where($field.' <= ', $search_array);
678 678
                     break;
679 679
             }
680 680
         }
@@ -684,35 +684,35 @@  discard block
 block discarded – undo
684 684
         if ($search_array != '') {
685 685
             switch ($value) {
686 686
                 case "1":
687
-                    $str1 = $field . " LIKE '%$search_array%'";
687
+                    $str1 = $field." LIKE '%$search_array%'";
688 688
                     $this->db->where($str1);
689 689
                     break;
690 690
                 case "2":
691
-                    $str1 = $field . " NOT LIKE '%$search_array%'";
691
+                    $str1 = $field." NOT LIKE '%$search_array%'";
692 692
                     $this->db->where($str1);
693 693
                     break;
694 694
                 case "3":
695 695
                     $this->db->where($field, $search_array);
696 696
                     break;
697 697
                 case "4":
698
-                    $this->db->where($field . ' <>', $search_array);
698
+                    $this->db->where($field.' <>', $search_array);
699 699
                     break;
700 700
                 case "5":
701
-					if($field == "pattern"){
702
-							$str1 = $field . " LIKE '^".$search_array."%'";
701
+					if ($field == "pattern") {
702
+							$str1 = $field." LIKE '^".$search_array."%'";
703 703
 							$this->db->where($str1);
704
-					}else{
705
-							$str1 = $field . " LIKE '".$search_array."%'";
704
+					} else {
705
+							$str1 = $field." LIKE '".$search_array."%'";
706 706
 							$this->db->where($str1);
707 707
 					}
708 708
 
709 709
                     break;
710 710
                 case "6":
711
-					if($field == "pattern"){
712
-							$str1 = $field . " LIKE '%".$search_array.".*'";
711
+					if ($field == "pattern") {
712
+							$str1 = $field." LIKE '%".$search_array.".*'";
713 713
 							$this->db->where($str1);
714
-					}else{
715
-							$str1 = $field . " LIKE '%".$search_array."'";
714
+					} else {
715
+							$str1 = $field." LIKE '%".$search_array."'";
716 716
 							$this->db->where($str1);
717 717
 					}		
718 718
 
@@ -722,46 +722,46 @@  discard block
 block discarded – undo
722 722
     }
723 723
   function build_search_string($accounts_list_search) {
724 724
 	 $where = null;
725
-	 $search=$this->session->userdata($accounts_list_search);
725
+	 $search = $this->session->userdata($accounts_list_search);
726 726
         if ($this->session->userdata('advance_search') == 1) {
727 727
             $account_search = $this->session->userdata($accounts_list_search);
728 728
             unset($account_search["ajax_search"]);
729 729
             unset($account_search["advance_search"]);
730
-            if (!empty($account_search)) {
730
+            if ( ! empty($account_search)) {
731 731
                 foreach ($account_search as $key => $value) {
732 732
                     if ($value != "") {
733 733
                         if (is_array($value)) {
734
-                            if (array_key_exists($key . "-integer", $value)) {
735
-				$string=null;
736
-                                $string =$this->build_interger_where($key, $value[$key . "-integer"], $value[$key]);
737
-                                if($string)
738
-                                $where.= "$string AND ";
734
+                            if (array_key_exists($key."-integer", $value)) {
735
+				$string = null;
736
+                                $string = $this->build_interger_where($key, $value[$key."-integer"], $value[$key]);
737
+                                if ($string)
738
+                                $where .= "$string AND ";
739 739
                             }
740
-                            if (array_key_exists($key . "-string", $value)) {
741
-				$string=null;
742
-                                $string=$this->build_string_where($key, $value[$key . "-string"], $value[$key]);
743
-                                if($string)
744
-                                $where.= "$string AND ";
740
+                            if (array_key_exists($key."-string", $value)) {
741
+				$string = null;
742
+                                $string = $this->build_string_where($key, $value[$key."-string"], $value[$key]);
743
+                                if ($string)
744
+                                $where .= "$string AND ";
745 745
                             }
746
-                            if ($key == 'callstart'|| $key == 'date'||$key== 'log_time') {
747
-				$string=null;
748
-                                $string=$this->build_date_where($key, $value);
749
-                                if($string)
750
-                                $where.= "$string AND ";
746
+                            if ($key == 'callstart' || $key == 'date' || $key == 'log_time') {
747
+				$string = null;
748
+                                $string = $this->build_date_where($key, $value);
749
+                                if ($string)
750
+                                $where .= "$string AND ";
751 751
                             }
752 752
                         } else {
753
-			      $where.="$key = '$value'AND ";
753
+			      $where .= "$key = '$value'AND ";
754 754
                         }
755 755
                     }
756 756
                 }
757 757
             }
758 758
         }
759
-        $where =rtrim($where ," AND ");
759
+        $where = rtrim($where, " AND ");
760 760
         return $where;
761 761
     }
762 762
     // This function using by reports module don't delete it
763
-    function build_string_where($field, $value, $search_array){
764
-	$where=null;
763
+    function build_string_where($field, $value, $search_array) {
764
+	$where = null;
765 765
          if ($search_array != '') {
766 766
             switch ($value) {
767 767
                 case "1":
@@ -777,17 +777,17 @@  discard block
 block discarded – undo
777 777
                     $where = "$field <> '$search_array'";
778 778
                     break;
779 779
                 case "5":
780
-		    if($field == "pattern"){
781
-		      $where = $field . " LIKE '^".$search_array."%'";
782
-		    }else{
783
-		      $where = $field . " LIKE '".$search_array."%'";
780
+		    if ($field == "pattern") {
781
+		      $where = $field." LIKE '^".$search_array."%'";
782
+		    } else {
783
+		      $where = $field." LIKE '".$search_array."%'";
784 784
 		    }
785 785
                     break;
786 786
                 case "6":
787
-		    if($field == "pattern"){
788
-		       $str1 = $field . " LIKE '%".$search_array.".*'";
789
-		    }else{
790
-		       $str1 = $field . " LIKE '%".$search_array."'";
787
+		    if ($field == "pattern") {
788
+		       $str1 = $field." LIKE '%".$search_array.".*'";
789
+		    } else {
790
+		       $str1 = $field." LIKE '%".$search_array."'";
791 791
 		    }
792 792
 		    break;
793 793
             }
@@ -796,9 +796,9 @@  discard block
 block discarded – undo
796 796
     }
797 797
     
798 798
     function build_interger_where($field, $value, $search_array) {
799
-	$where=null;
799
+	$where = null;
800 800
         if ($search_array != '') {
801
-	    if(is_numeric($search_array))
801
+	    if (is_numeric($search_array))
802 802
 	    {
803 803
 		switch ($value) {
804 804
 		    case "1":
@@ -824,29 +824,29 @@  discard block
 block discarded – undo
824 824
             else
825 825
             {
826 826
 	      $this->db->where("$field IS NULL");
827
-	      $where= "$field IS NULL";
827
+	      $where = "$field IS NULL";
828 828
             }
829 829
         }
830 830
         return $where;
831 831
     }
832 832
     function build_date_where($field, $value) {
833
-	$where =null;
833
+	$where = null;
834 834
         if ($value != '') {
835
-            if (!empty($value[0])) {
836
-		$string=null;
837
-                $string="$field >= '$value[0]'";
838
-                if($string)
839
-                $where.=$string." AND ";
835
+            if ( ! empty($value[0])) {
836
+		$string = null;
837
+                $string = "$field >= '$value[0]'";
838
+                if ($string)
839
+                $where .= $string." AND ";
840 840
             }
841
-            if (!empty($value[1])) {
842
-		$string=null;
843
-                $string="$field <= '$value[1]'";
844
-                if($string)
845
-                $where.=$string." AND ";
841
+            if ( ! empty($value[1])) {
842
+		$string = null;
843
+                $string = "$field <= '$value[1]'";
844
+                if ($string)
845
+                $where .= $string." AND ";
846 846
             }
847 847
         }
848
-        if($where){
849
-	  $where =rtrim($where," AND ");
848
+        if ($where) {
849
+	  $where = rtrim($where, " AND ");
850 850
         }
851 851
         return $where;
852 852
     }
@@ -858,10 +858,10 @@  discard block
 block discarded – undo
858 858
 
859 859
     function update_balance($amount, $accountid, $payment_type) {
860 860
         if ($payment_type == "debit") {
861
-            $query = 'UPDATE `accounts` SET `balance` = (balance - ' . $amount . ') WHERE `id` = ' . $accountid;
861
+            $query = 'UPDATE `accounts` SET `balance` = (balance - '.$amount.') WHERE `id` = '.$accountid;
862 862
             return $this->db->query($query);
863 863
         } else {
864
-            $query = 'UPDATE `accounts` SET `balance` = (balance + ' . $amount . ') WHERE `id` = ' . $accountid;
864
+            $query = 'UPDATE `accounts` SET `balance` = (balance + '.$amount.') WHERE `id` = '.$accountid;
865 865
             return $this->db->query($query);
866 866
         }
867 867
     }
@@ -875,30 +875,30 @@  discard block
 block discarded – undo
875 875
                         //                        $this->db->where($field, $search_array);
876 876
                         break;
877 877
                     case "2":
878
-                        if($update_fields[$key] != ''){
878
+                        if ($update_fields[$key] != '') {
879 879
                             $updateflg = true;
880
-                            $this->db->set($key,$update_fields[$key]);    
880
+                            $this->db->set($key, $update_fields[$key]);    
881 881
                         }
882 882
                         break;
883 883
                     case "3":
884
-                        $this->db->set($key, $key . "+" . $update_fields[$key], FALSE);
884
+                        $this->db->set($key, $key."+".$update_fields[$key], FALSE);
885 885
                         $updateflg = true;
886 886
                         break;
887 887
                     case "4":
888
-                        $this->db->set($key, $key . "-" . $update_fields[$key], FALSE);
888
+                        $this->db->set($key, $key."-".$update_fields[$key], FALSE);
889 889
                         $updateflg = true;
890 890
                         break;
891 891
                 }
892 892
             } else {
893
-                if ($update_fields != ""){
894
-                    $this->db->set($key,$update_fields);
893
+                if ($update_fields != "") {
894
+                    $this->db->set($key, $update_fields);
895 895
                     $updateflg = true;
896 896
                 }
897 897
             }
898 898
         }
899 899
         return $updateflg;
900 900
     }
901
-    function build_search_opensips($opensips_db_obj,$accounts_list_search) {
901
+    function build_search_opensips($opensips_db_obj, $accounts_list_search) {
902 902
         if ($this->session->userdata('advance_search') == 1) {
903 903
             $account_search = $this->session->userdata($accounts_list_search);
904 904
             unset($account_search["ajax_search"]);
@@ -906,11 +906,11 @@  discard block
 block discarded – undo
906 906
             foreach ($account_search as $key => $value) {
907 907
                 if ($value != "") {
908 908
                     if (is_array($value)) {
909
-                        if (array_key_exists($key . "-integer", $value)) {
910
-                            $this->get_opensips_interger_array($opensips_db_obj,$key, $value[$key . "-integer"], $value[$key]);
909
+                        if (array_key_exists($key."-integer", $value)) {
910
+                            $this->get_opensips_interger_array($opensips_db_obj, $key, $value[$key."-integer"], $value[$key]);
911 911
                         }
912
-                        if (array_key_exists($key . "-string", $value)) {
913
-                            $this->get_opensips_string_array($opensips_db_obj,$key, $value[$key . "-string"], $value[$key]);
912
+                        if (array_key_exists($key."-string", $value)) {
913
+                            $this->get_opensips_string_array($opensips_db_obj, $key, $value[$key."-string"], $value[$key]);
914 914
                         }
915 915
                     } else {
916 916
                         $opensips_db_obj->where($key, $value);
@@ -920,32 +920,32 @@  discard block
 block discarded – undo
920 920
         }
921 921
     }
922 922
 
923
-    function get_opensips_interger_array($opensips_db_obj,$field, $value, $search_array) {
923
+    function get_opensips_interger_array($opensips_db_obj, $field, $value, $search_array) {
924 924
         if ($search_array != '') {
925 925
             switch ($value) {
926 926
                 case "1":
927 927
                     $opensips_db_obj->where($field, $search_array);
928 928
                     break;
929 929
                 case "2":
930
-                    $opensips_db_obj->where($field . ' <>', $search_array);
930
+                    $opensips_db_obj->where($field.' <>', $search_array);
931 931
                     break;
932 932
                 case "3":
933
-                    $opensips_db_obj->where($field . ' > ', $search_array);
933
+                    $opensips_db_obj->where($field.' > ', $search_array);
934 934
                     break;
935 935
                 case "4":
936
-                    $opensips_db_obj->where($field . ' < ', $search_array);
936
+                    $opensips_db_obj->where($field.' < ', $search_array);
937 937
                     break;
938 938
                 case "5":
939
-                    $opensips_db_obj->where($field . ' >= ', $search_array);
939
+                    $opensips_db_obj->where($field.' >= ', $search_array);
940 940
                     break;
941 941
                 case "6":
942
-                    $opensips_db_obj->where($field . ' <= ', $search_array);
942
+                    $opensips_db_obj->where($field.' <= ', $search_array);
943 943
                     break;
944 944
             }
945 945
         }
946 946
     }
947 947
 
948
-    function get_opensips_string_array($opensips_db_obj,$field, $value, $search_array) {
948
+    function get_opensips_string_array($opensips_db_obj, $field, $value, $search_array) {
949 949
         if ($search_array != '') {
950 950
             switch ($value) {
951 951
                 case "1":
@@ -958,14 +958,14 @@  discard block
 block discarded – undo
958 958
                     $opensips_db_obj->where($field, $search_array);
959 959
                     break;
960 960
                 case "4":
961
-                    $opensips_db_obj->where($field . ' <>', $search_array);
961
+                    $opensips_db_obj->where($field.' <>', $search_array);
962 962
                     break;
963 963
                 case "5":
964
-		    $str1 = $field . " LIKE '".$search_array."%'";
964
+		    $str1 = $field." LIKE '".$search_array."%'";
965 965
 		    $opensips_db_obj->where($str1);
966 966
 		    break;
967 967
 		case "6":
968
-		    $str1 = $field . " LIKE '%".$search_array."'";
968
+		    $str1 = $field." LIKE '%".$search_array."'";
969 969
 		    $opensips_db_obj->where($str1);
970 970
 		    break;
971 971
             }
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
         } else {
981 981
             $cnt_str = " $select_params[1],' (',$select_params[2],')' ";
982 982
         }
983
-        $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ,".$select_params[4] ;
983
+        $select = $select_params[0].", concat($cnt_str) as $select_params[1] ,".$select_params[4];
984 984
         $logintype = $this->session->userdata('logintype');
985 985
         if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') {
986 986
             $account_data = $this->session->userdata("accountinfo");
@@ -991,12 +991,12 @@  discard block
 block discarded – undo
991 991
         $drp_array = $drp_array->result();
992 992
         $drp_list = array();
993 993
         foreach ($drp_array as $drp_value) {
994
-            if($drp_value->type == 3)
994
+            if ($drp_value->type == 3)
995 995
             {
996 996
                $drp_list['Provider'][$drp_value->id] = $drp_value->first_name;
997
-            }elseif($drp_value->type == 1){
997
+            }elseif ($drp_value->type == 1) {
998 998
                $drp_list['Reseller'][$drp_value->id] = $drp_value->first_name;
999
-            }else{
999
+            } else {
1000 1000
                $drp_list['Customer'][$drp_value->id] = $drp_value->first_name;
1001 1001
             }
1002 1002
         }
Please login to merge, or discard this patch.
Braces   +55 added lines, -43 removed lines patch added patch discarded remove patch
@@ -48,10 +48,11 @@  discard block
 block discarded – undo
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
     /*     * ********************************************************
@@ -134,15 +135,18 @@  discard block
 block discarded – undo
134 135
             $this->db->where($where);
135 136
         }
136 137
         
137
-        if ($paging_limit)
138
-            $this->db->limit($paging_limit, $start_limit);
139
-        if (!empty($groupby))
140
-            $this->db->group_by($groupby);
138
+        if ($paging_limit) {
139
+                    $this->db->limit($paging_limit, $start_limit);
140
+        }
141
+        if (!empty($groupby)) {
142
+                    $this->db->group_by($groupby);
143
+        }
141 144
         if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
142 145
           $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
143
-        }else{
144
-           if($order_by)
145
-            $this->db->order_by($order_by, $order_type);
146
+        } else{
147
+           if($order_by) {
148
+                       $this->db->order_by($order_by, $order_type);
149
+           }
146 150
         }        
147 151
         $query = $this->db->get();
148 152
         return $query;
@@ -160,10 +164,12 @@  discard block
 block discarded – undo
160 164
         }
161 165
         $this->db->where_in($key, $where_in);
162 166
         $this->db->order_by($order_by, $order_type);
163
-        if ($paging_limit)
164
-            $this->db->limit($paging_limit, $start_limit);
165
-        if (!empty($groupby))
166
-            $this->db->groupby($groupby);
167
+        if ($paging_limit) {
168
+                    $this->db->limit($paging_limit, $start_limit);
169
+        }
170
+        if (!empty($groupby)) {
171
+                    $this->db->groupby($groupby);
172
+        }
167 173
         $query = $this->db->get();
168 174
 
169 175
         return $query;
@@ -254,9 +260,10 @@  discard block
 block discarded – undo
254 260
         }
255 261
         if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
256 262
           $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
257
-        }else{
258
-           if($order_by)
259
-            $this->db->order_by($order_by, $order_type);
263
+        } else{
264
+           if($order_by) {
265
+                       $this->db->order_by($order_by, $order_type);
266
+           }
260 267
         }
261 268
 
262 269
         if ($group_by != '') {
@@ -306,9 +313,10 @@  discard block
 block discarded – undo
306 313
         }
307 314
         if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){
308 315
           $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']);
309
-        }else{
310
-           if($order_by)
311
-            $this->db->order_by($order_by, $order_type);
316
+        } else{
317
+           if($order_by) {
318
+                       $this->db->order_by($order_by, $order_type);
319
+           }
312 320
         }
313 321
 
314 322
         if ($group_by != '') {
@@ -466,7 +474,7 @@  discard block
 block discarded – undo
466 474
 	$logintype = $this->session->userdata('logintype');
467 475
 	if ($account_data['type'] == 1 && $id_where == 'where_arr') {
468 476
 	  $id_value['reseller_id'] = $account_data['id'];
469
-	}else{
477
+	} else{
470 478
 	  $this->db->or_where('type',3);
471 479
 	}
472 480
 	$where = $id_value;
@@ -572,7 +580,7 @@  discard block
 block discarded – undo
572 580
         $name=explode("as",$select);
573 581
         if(isset($name[3])){
574 582
             $name=trim($name[3]);
575
-        }else{
583
+        } else{
576 584
             $name=trim($name[1]);
577 585
         }
578 586
 
@@ -583,7 +591,7 @@  discard block
 block discarded – undo
583 591
             if(isset($dele[1]))
584 592
             {
585 593
                $drp_list['Deleted'][$drp_value->$select_params[0]] =  str_replace("^","",$drp_value->$name);
586
-            }else{
594
+            } else{
587 595
                $drp_list['Active'][$drp_value->$select_params[0]] = $drp_value->$name;
588 596
             }
589 597
         }
@@ -645,7 +653,7 @@  discard block
 block discarded – undo
645 653
 				if($field == 'invoice_date'){
646 654
 					$this->db->where($field . ' >= ', gmdate("Y-m-d", strtotime($value['0']))." 00:00:01");
647 655
 					$this->db->where($field . ' <= ', gmdate("Y-m-d", strtotime($value['0']))." 23:59:59");
648
-				}else{
656
+				} else{
649 657
                 $this->db->where($field . ' >= ', gmdate('Y-m-d H:i:s',strtotime($value[0])));
650 658
 				}
651 659
 			}
@@ -701,7 +709,7 @@  discard block
 block discarded – undo
701 709
 					if($field == "pattern"){
702 710
 							$str1 = $field . " LIKE '^".$search_array."%'";
703 711
 							$this->db->where($str1);
704
-					}else{
712
+					} else{
705 713
 							$str1 = $field . " LIKE '".$search_array."%'";
706 714
 							$this->db->where($str1);
707 715
 					}
@@ -711,7 +719,7 @@  discard block
 block discarded – undo
711 719
 					if($field == "pattern"){
712 720
 							$str1 = $field . " LIKE '%".$search_array.".*'";
713 721
 							$this->db->where($str1);
714
-					}else{
722
+					} else{
715 723
 							$str1 = $field . " LIKE '%".$search_array."'";
716 724
 							$this->db->where($str1);
717 725
 					}		
@@ -734,20 +742,23 @@  discard block
 block discarded – undo
734 742
                             if (array_key_exists($key . "-integer", $value)) {
735 743
 				$string=null;
736 744
                                 $string =$this->build_interger_where($key, $value[$key . "-integer"], $value[$key]);
737
-                                if($string)
738
-                                $where.= "$string AND ";
745
+                                if($string) {
746
+                                                                $where.= "$string AND ";
747
+                                }
739 748
                             }
740 749
                             if (array_key_exists($key . "-string", $value)) {
741 750
 				$string=null;
742 751
                                 $string=$this->build_string_where($key, $value[$key . "-string"], $value[$key]);
743
-                                if($string)
744
-                                $where.= "$string AND ";
752
+                                if($string) {
753
+                                                                $where.= "$string AND ";
754
+                                }
745 755
                             }
746 756
                             if ($key == 'callstart'|| $key == 'date'||$key== 'log_time') {
747 757
 				$string=null;
748 758
                                 $string=$this->build_date_where($key, $value);
749
-                                if($string)
750
-                                $where.= "$string AND ";
759
+                                if($string) {
760
+                                                                $where.= "$string AND ";
761
+                                }
751 762
                             }
752 763
                         } else {
753 764
 			      $where.="$key = '$value'AND ";
@@ -779,14 +790,14 @@  discard block
 block discarded – undo
779 790
                 case "5":
780 791
 		    if($field == "pattern"){
781 792
 		      $where = $field . " LIKE '^".$search_array."%'";
782
-		    }else{
793
+		    } else{
783 794
 		      $where = $field . " LIKE '".$search_array."%'";
784 795
 		    }
785 796
                     break;
786 797
                 case "6":
787 798
 		    if($field == "pattern"){
788 799
 		       $str1 = $field . " LIKE '%".$search_array.".*'";
789
-		    }else{
800
+		    } else{
790 801
 		       $str1 = $field . " LIKE '%".$search_array."'";
791 802
 		    }
792 803
 		    break;
@@ -820,8 +831,7 @@  discard block
 block discarded – undo
820 831
 			$where = "$field <= '$search_array'";
821 832
 			break;
822 833
 		}
823
-            }
824
-            else
834
+            } else
825 835
             {
826 836
 	      $this->db->where("$field IS NULL");
827 837
 	      $where= "$field IS NULL";
@@ -835,14 +845,16 @@  discard block
 block discarded – undo
835 845
             if (!empty($value[0])) {
836 846
 		$string=null;
837 847
                 $string="$field >= '$value[0]'";
838
-                if($string)
839
-                $where.=$string." AND ";
848
+                if($string) {
849
+                                $where.=$string." AND ";
850
+                }
840 851
             }
841 852
             if (!empty($value[1])) {
842 853
 		$string=null;
843 854
                 $string="$field <= '$value[1]'";
844
-                if($string)
845
-                $where.=$string." AND ";
855
+                if($string) {
856
+                                $where.=$string." AND ";
857
+                }
846 858
             }
847 859
         }
848 860
         if($where){
@@ -994,9 +1006,9 @@  discard block
 block discarded – undo
994 1006
             if($drp_value->type == 3)
995 1007
             {
996 1008
                $drp_list['Provider'][$drp_value->id] = $drp_value->first_name;
997
-            }elseif($drp_value->type == 1){
1009
+            } elseif($drp_value->type == 1){
998 1010
                $drp_list['Reseller'][$drp_value->id] = $drp_value->first_name;
999
-            }else{
1011
+            } else{
1000 1012
                $drp_list['Customer'][$drp_value->id] = $drp_value->first_name;
1001 1013
             }
1002 1014
         }
Please login to merge, or discard this patch.
web_interface/astpp/application/models/common_model.php 3 patches
Indentation   +290 added lines, -290 removed lines patch added patch discarded remove patch
@@ -22,333 +22,333 @@
 block discarded – undo
22 22
 ###############################################################################
23 23
 class Common_model extends CI_Model {
24 24
 
25
-    var $host;
26
-    var $user;
27
-    var $pass;
28
-    var $db2;
29
-    var $db_link;
30
-    var $conn = false;
31
-    public static $global_config;
25
+	var $host;
26
+	var $user;
27
+	var $pass;
28
+	var $db2;
29
+	var $db_link;
30
+	var $conn = false;
31
+	public static $global_config;
32 32
 
33
-    function Common_model() {
34
-        parent::__construct();
35
-        $this->get_system_config();
36
-        $this->get_currencylist();
37
-        $this->get_language_list();
38
-        $this->get_country_list();
39
-        $this->get_admin_info();
40
-        $this->load->library('astpp/common');
41
-        $this->db->query('SET time_zone = "+00:00"');
42
-    }
33
+	function Common_model() {
34
+		parent::__construct();
35
+		$this->get_system_config();
36
+		$this->get_currencylist();
37
+		$this->get_language_list();
38
+		$this->get_country_list();
39
+		$this->get_admin_info();
40
+		$this->load->library('astpp/common');
41
+		$this->db->query('SET time_zone = "+00:00"');
42
+	}
43 43
 
44
-    function get_language_list() {
45
-        $query = $this->db->get("language");
46
-        $result = $query->result_array();
47
-        $language_list = array();
48
-        foreach ($result as $row) {
49
-            $language_list[$row['language']] = $row['languagename'];
50
-        }
51
-        self::$global_config['language_list'] = $language_list;
52
-        return $language_list;
53
-    }
54
-    function get_system_config() {
55
-        $query = $this->db->get("system");
56
-        $config = array();
57
-        $result = $query->result_array();
58
-        foreach ($result as $row) {
44
+	function get_language_list() {
45
+		$query = $this->db->get("language");
46
+		$result = $query->result_array();
47
+		$language_list = array();
48
+		foreach ($result as $row) {
49
+			$language_list[$row['language']] = $row['languagename'];
50
+		}
51
+		self::$global_config['language_list'] = $language_list;
52
+		return $language_list;
53
+	}
54
+	function get_system_config() {
55
+		$query = $this->db->get("system");
56
+		$config = array();
57
+		$result = $query->result_array();
58
+		foreach ($result as $row) {
59 59
 			if($row['name'] == 'decimal_points' || $row['name'] == 'starting_digit' || $row['name'] == 'card_length' || $row['name'] == 'pin_length'){
60 60
 				$row['name'] = str_replace("_","",$row['name']);
61 61
 			}
62
-            $config[$row['name']] = $row['value'];
63
-        }
64
-        self::$global_config['system_config'] = $config;
65
-        return $config;
66
-    }
67
-    function get_country_list() {
68
-        $query = $this->db->get("countrycode");
69
-        $result = $query->result_array();
70
-        $country_list = array();
71
-        foreach ($result as $row) {
72
-            $country_list[$row['id']] = $row['country'];
73
-        }
74
-        self::$global_config['country_list'] = $country_list;
75
-        return $country_list;
76
-    }
62
+			$config[$row['name']] = $row['value'];
63
+		}
64
+		self::$global_config['system_config'] = $config;
65
+		return $config;
66
+	}
67
+	function get_country_list() {
68
+		$query = $this->db->get("countrycode");
69
+		$result = $query->result_array();
70
+		$country_list = array();
71
+		foreach ($result as $row) {
72
+			$country_list[$row['id']] = $row['country'];
73
+		}
74
+		self::$global_config['country_list'] = $country_list;
75
+		return $country_list;
76
+	}
77 77
     
78
-        //Return list of currency with rate
78
+		//Return list of currency with rate
79 79
  function get_currencylist() {
80
-        $query = $this->db->get("currency");
81
-        $currencylist = array();
82
-        $result = $query->result_array();
83
-        foreach ($result as $row) {
84
-            $currencylist[$row['currency']] = $row['currencyrate'];
85
-        }
86
-        self::$global_config['currency_list'] = $currencylist;
87
-        return $currencylist;
88
-    }
80
+		$query = $this->db->get("currency");
81
+		$currencylist = array();
82
+		$result = $query->result_array();
83
+		foreach ($result as $row) {
84
+			$currencylist[$row['currency']] = $row['currencyrate'];
85
+		}
86
+		self::$global_config['currency_list'] = $currencylist;
87
+		return $currencylist;
88
+	}
89 89
     
90
-    function get_admin_info(){
91
-         $result=$this->db->get_where('accounts',array('type'=>'-1'));
92
-         $result=$result->result_array();
93
-         self::$global_config['admin_info'] = $result[0];
94
-         return $result[0];
95
-    }
96
-    /* ASTPP  3.0 
90
+	function get_admin_info(){
91
+		 $result=$this->db->get_where('accounts',array('type'=>'-1'));
92
+		 $result=$result->result_array();
93
+		 self::$global_config['admin_info'] = $result[0];
94
+		 return $result[0];
95
+	}
96
+	/* ASTPP  3.0 
97 97
      * Changes for invoices
98 98
      */
99
-     function generate_receipt($accountid, $amount, $accountinfo, $last_invoice_ID, $invoice_prefix, $due_date) {
99
+	 function generate_receipt($accountid, $amount, $accountinfo, $last_invoice_ID, $invoice_prefix, $due_date) {
100 100
 		$amount = str_replace( ',', '', $amount );
101
-        $invoice_data = array("accountid" => $accountid,
102
-                              "invoice_prefix" => $invoice_prefix,
103
-                              "invoiceid" => $last_invoice_ID,
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"),
108
-                              "due_date" => $due_date,
109
-                              "status" => 1,
110
-                              "balance" => $accountinfo['balance'],
111
-                              "amount" => $amount,
112
-                              "type" => 'R',
113
-			      "confirm"=>'1'
114
-                             );
115
-        $this->db->insert("invoices", $invoice_data);
116
-        return  $this->db->insert_id();
117
-    }
101
+		$invoice_data = array("accountid" => $accountid,
102
+							  "invoice_prefix" => $invoice_prefix,
103
+							  "invoiceid" => $last_invoice_ID,
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"),
108
+							  "due_date" => $due_date,
109
+							  "status" => 1,
110
+							  "balance" => $accountinfo['balance'],
111
+							  "amount" => $amount,
112
+							  "type" => 'R',
113
+				  "confirm"=>'1'
114
+							 );
115
+		$this->db->insert("invoices", $invoice_data);
116
+		return  $this->db->insert_id();
117
+	}
118 118
 
119
-    function calculate_currency($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) {
120
-        $from_currency = ($from_currency == '') ? self::$global_config['system_config']['base_currency'] : $from_currency;
119
+	function calculate_currency($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) {
120
+		$from_currency = ($from_currency == '') ? self::$global_config['system_config']['base_currency'] : $from_currency;
121 121
         
122
-        if ($to_currency == '') {
123
-                $to_currency1 = $this->session->userdata['accountinfo']['currency_id'];
124
-                $to_currency = $this->common->get_field_name('currency', 'currency', $to_currency1);
125
-        }
126
-        $from_cur_rate = (self::$global_config['currency_list'][$from_currency] > 0)?self::$global_config['currency_list'][$from_currency]:1;
127
-        $to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1;
128
-        $amount = str_replace( ',', '', $amount );
129
-        $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate;
130
-        if ($format_currency)
131
-            $cal_amount = $this->format_currency($cal_amount);
132
-        if ($append_currency){
133
-            $cal_amount = $cal_amount . " " . $to_currency;
134
-        }
135
-        $cal_amount = str_replace( ',', '', $cal_amount );
136
-        return $cal_amount;
137
-    }
138
-    function calculate_currency_customer($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) {
139
-        $from_currency = ($from_currency == '') ? self::$global_config['system_config']['base_currency'] : $from_currency;
122
+		if ($to_currency == '') {
123
+				$to_currency1 = $this->session->userdata['accountinfo']['currency_id'];
124
+				$to_currency = $this->common->get_field_name('currency', 'currency', $to_currency1);
125
+		}
126
+		$from_cur_rate = (self::$global_config['currency_list'][$from_currency] > 0)?self::$global_config['currency_list'][$from_currency]:1;
127
+		$to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1;
128
+		$amount = str_replace( ',', '', $amount );
129
+		$cal_amount = ($amount * $to_cur_rate) / $from_cur_rate;
130
+		if ($format_currency)
131
+			$cal_amount = $this->format_currency($cal_amount);
132
+		if ($append_currency){
133
+			$cal_amount = $cal_amount . " " . $to_currency;
134
+		}
135
+		$cal_amount = str_replace( ',', '', $cal_amount );
136
+		return $cal_amount;
137
+	}
138
+	function calculate_currency_customer($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) {
139
+		$from_currency = ($from_currency == '') ? self::$global_config['system_config']['base_currency'] : $from_currency;
140 140
         
141
-        if ($to_currency == '') {
142
-                $to_currency1 = $this->session->userdata['accountinfo']['currency_id'];
143
-                $to_currency = $this->common->get_field_name('currency', 'currency', $to_currency1);
144
-        }        
145
-        $from_cur_rate = (self::$global_config['currency_list'][$from_currency] > 0)?self::$global_config['currency_list'][$from_currency]:1;
146
-        $to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1;
147
-        $amount = str_replace( ',', '', $amount );
148
-        $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate;
149
-        if ($format_currency)
150
-            $cal_amount = $this->format_currency($cal_amount);
151
-        if ($append_currency)
152
-            $cal_amount = $cal_amount ;
153
-        $cal_amount = str_replace( ',', '', $cal_amount );
154
-        return $cal_amount;
155
-        }
141
+		if ($to_currency == '') {
142
+				$to_currency1 = $this->session->userdata['accountinfo']['currency_id'];
143
+				$to_currency = $this->common->get_field_name('currency', 'currency', $to_currency1);
144
+		}        
145
+		$from_cur_rate = (self::$global_config['currency_list'][$from_currency] > 0)?self::$global_config['currency_list'][$from_currency]:1;
146
+		$to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1;
147
+		$amount = str_replace( ',', '', $amount );
148
+		$cal_amount = ($amount * $to_cur_rate) / $from_cur_rate;
149
+		if ($format_currency)
150
+			$cal_amount = $this->format_currency($cal_amount);
151
+		if ($append_currency)
152
+			$cal_amount = $cal_amount ;
153
+		$cal_amount = str_replace( ',', '', $cal_amount );
154
+		return $cal_amount;
155
+		}
156 156
 
157
-    function add_calculate_currency($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) {
158
-        $amount = str_replace( ',', '', $amount );
159
-        if ($from_currency == '') {
160
-                $from_currency1 = $this->session->userdata['accountinfo']['currency_id'];
161
-                $from_currency = $this->common->get_field_name('currency', 'currency', $from_currency1);
162
-        }
163
-        $to_currency = ($to_currency == '') ? self::$global_config['system_config']['base_currency'] : $to_currency;
164
-        if(self::$global_config['currency_list'][$from_currency] > 0){
157
+	function add_calculate_currency($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) {
158
+		$amount = str_replace( ',', '', $amount );
159
+		if ($from_currency == '') {
160
+				$from_currency1 = $this->session->userdata['accountinfo']['currency_id'];
161
+				$from_currency = $this->common->get_field_name('currency', 'currency', $from_currency1);
162
+		}
163
+		$to_currency = ($to_currency == '') ? self::$global_config['system_config']['base_currency'] : $to_currency;
164
+		if(self::$global_config['currency_list'][$from_currency] > 0){
165 165
 			$cal_amount = ($amount * self::$global_config['currency_list'][$to_currency]) / self::$global_config['currency_list'][$from_currency];
166 166
 		}else{
167 167
 			$cal_amount=$amount;
168 168
 		}
169
-        if ($format_currency)
170
-            $cal_amount = $this->format_currency($cal_amount);
171
-        if ($append_currency)
172
-            $cal_amount = $cal_amount . " " . $to_currency;
173
-        $cal_amount = str_replace( ',', '', $cal_amount );
174
-        return $cal_amount;
175
-    }
169
+		if ($format_currency)
170
+			$cal_amount = $this->format_currency($cal_amount);
171
+		if ($append_currency)
172
+			$cal_amount = $cal_amount . " " . $to_currency;
173
+		$cal_amount = str_replace( ',', '', $cal_amount );
174
+		return $cal_amount;
175
+	}
176 176
 
177
-    function to_calculate_currency($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) {
178
-        if ($to_currency == '') {
179
-                $to_currency1 = $this->session->userdata['accountinfo']['currency_id'];
180
-                $to_currency = $this->common->get_field_name('currency', 'currency', $to_currency1);
181
-        }
182
-        $from_currency = ($from_currency == '') ? self::$global_config['system_config']['base_currency'] : $from_currency;
177
+	function to_calculate_currency($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) {
178
+		if ($to_currency == '') {
179
+				$to_currency1 = $this->session->userdata['accountinfo']['currency_id'];
180
+				$to_currency = $this->common->get_field_name('currency', 'currency', $to_currency1);
181
+		}
182
+		$from_currency = ($from_currency == '') ? self::$global_config['system_config']['base_currency'] : $from_currency;
183 183
 
184
-        $from_cur_rate = (self::$global_config['currency_list'][$from_currency] > 0)?self::$global_config['currency_list'][$from_currency]:1;
185
-        $to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1;
186
-        $amount = str_replace( ',', '', $amount );
187
-        $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate;
188
-        if ($format_currency)
189
-            $cal_amount = $this->format_currency($cal_amount);
190
-        if ($append_currency)
191
-            $cal_amount = $cal_amount . " " . $to_currency;
192
-        $cal_amount = str_replace( ',', '', $cal_amount );
193
-        return $cal_amount;
194
-    }
184
+		$from_cur_rate = (self::$global_config['currency_list'][$from_currency] > 0)?self::$global_config['currency_list'][$from_currency]:1;
185
+		$to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1;
186
+		$amount = str_replace( ',', '', $amount );
187
+		$cal_amount = ($amount * $to_cur_rate) / $from_cur_rate;
188
+		if ($format_currency)
189
+			$cal_amount = $this->format_currency($cal_amount);
190
+		if ($append_currency)
191
+			$cal_amount = $cal_amount . " " . $to_currency;
192
+		$cal_amount = str_replace( ',', '', $cal_amount );
193
+		return $cal_amount;
194
+	}
195 195
 
196
-    function format_currency($amount) {
196
+	function format_currency($amount) {
197 197
 		$amount = str_replace( ',', '', $amount );
198
-        return  number_format($amount,Common_model::$global_config['system_config']['decimalpoints']);
198
+		return  number_format($amount,Common_model::$global_config['system_config']['decimalpoints']);
199 199
 	//	return $amount;
200
-    }
200
+	}
201 201
 
202
-    function money_format($format, $number) {
203
-        $regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?' .
204
-                '(?:#([0-9]+))?(?:\.([0-9]+))?([in%])/';
205
-        if (setlocale(LC_MONETARY, 0) == 'C') {
206
-            setlocale(LC_MONETARY, '');
207
-        }
208
-        $locale = localeconv();
209
-        preg_match_all($regex, $format, $matches, PREG_SET_ORDER);
210
-        foreach ($matches as $fmatch) {
211
-            $value = floatval($number);
212
-            $flags = array(
213
-                'fillchar' => preg_match('/\=(.)/', $fmatch[1], $match) ?
214
-                        $match[1] : ' ',
215
-                'nogroup' => preg_match('/\^/', $fmatch[1]) > 0,
216
-                'usesignal' => preg_match('/\+|\(/', $fmatch[1], $match) ?
217
-                        $match[0] : '+',
218
-                'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0,
219
-                'isleft' => preg_match('/\-/', $fmatch[1]) > 0
220
-            );
221
-            $width = trim($fmatch[2]) ? (int) $fmatch[2] : 0;
222
-            $left = trim($fmatch[3]) ? (int) $fmatch[3] : 0;
223
-            $right = trim($fmatch[4]) ? (int) $fmatch[4] : $locale['int_frac_digits'];
224
-            $conversion = $fmatch[5];
202
+	function money_format($format, $number) {
203
+		$regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?' .
204
+				'(?:#([0-9]+))?(?:\.([0-9]+))?([in%])/';
205
+		if (setlocale(LC_MONETARY, 0) == 'C') {
206
+			setlocale(LC_MONETARY, '');
207
+		}
208
+		$locale = localeconv();
209
+		preg_match_all($regex, $format, $matches, PREG_SET_ORDER);
210
+		foreach ($matches as $fmatch) {
211
+			$value = floatval($number);
212
+			$flags = array(
213
+				'fillchar' => preg_match('/\=(.)/', $fmatch[1], $match) ?
214
+						$match[1] : ' ',
215
+				'nogroup' => preg_match('/\^/', $fmatch[1]) > 0,
216
+				'usesignal' => preg_match('/\+|\(/', $fmatch[1], $match) ?
217
+						$match[0] : '+',
218
+				'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0,
219
+				'isleft' => preg_match('/\-/', $fmatch[1]) > 0
220
+			);
221
+			$width = trim($fmatch[2]) ? (int) $fmatch[2] : 0;
222
+			$left = trim($fmatch[3]) ? (int) $fmatch[3] : 0;
223
+			$right = trim($fmatch[4]) ? (int) $fmatch[4] : $locale['int_frac_digits'];
224
+			$conversion = $fmatch[5];
225 225
 
226
-            $positive = true;
227
-            if ($value < 0) {
228
-                $positive = false;
229
-                $value *= -1;
230
-            }
231
-            $letter = $positive ? 'p' : 'n';
226
+			$positive = true;
227
+			if ($value < 0) {
228
+				$positive = false;
229
+				$value *= -1;
230
+			}
231
+			$letter = $positive ? 'p' : 'n';
232 232
 
233
-            $prefix = $suffix = $cprefix = $csuffix = $signal = '';
233
+			$prefix = $suffix = $cprefix = $csuffix = $signal = '';
234 234
 
235
-            $signal = $positive ? $locale['positive_sign'] : $locale['negative_sign'];
236
-            switch (true) {
237
-                case $locale["{$letter}_sign_posn"] == 1 && $flags['usesignal'] == '+':
238
-                    $prefix = $signal;
239
-                    break;
240
-                case $locale["{$letter}_sign_posn"] == 2 && $flags['usesignal'] == '+':
241
-                    $suffix = $signal;
242
-                    break;
243
-                case $locale["{$letter}_sign_posn"] == 3 && $flags['usesignal'] == '+':
244
-                    $cprefix = $signal;
245
-                    break;
246
-                case $locale["{$letter}_sign_posn"] == 4 && $flags['usesignal'] == '+':
247
-                    $csuffix = $signal;
248
-                    break;
249
-                case $flags['usesignal'] == '(':
250
-                case $locale["{$letter}_sign_posn"] == 0:
251
-                    $prefix = '(';
252
-                    $suffix = ')';
253
-                    break;
254
-            }
255
-            if (!$flags['nosimbol']) {
256
-                $currency = $cprefix .
257
-                        ($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']) .
258
-                        $csuffix;
259
-            } else {
260
-                $currency = '';
261
-            }
262
-            $space = $locale["{$letter}_sep_by_space"] ? ' ' : '';
235
+			$signal = $positive ? $locale['positive_sign'] : $locale['negative_sign'];
236
+			switch (true) {
237
+				case $locale["{$letter}_sign_posn"] == 1 && $flags['usesignal'] == '+':
238
+					$prefix = $signal;
239
+					break;
240
+				case $locale["{$letter}_sign_posn"] == 2 && $flags['usesignal'] == '+':
241
+					$suffix = $signal;
242
+					break;
243
+				case $locale["{$letter}_sign_posn"] == 3 && $flags['usesignal'] == '+':
244
+					$cprefix = $signal;
245
+					break;
246
+				case $locale["{$letter}_sign_posn"] == 4 && $flags['usesignal'] == '+':
247
+					$csuffix = $signal;
248
+					break;
249
+				case $flags['usesignal'] == '(':
250
+				case $locale["{$letter}_sign_posn"] == 0:
251
+					$prefix = '(';
252
+					$suffix = ')';
253
+					break;
254
+			}
255
+			if (!$flags['nosimbol']) {
256
+				$currency = $cprefix .
257
+						($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']) .
258
+						$csuffix;
259
+			} else {
260
+				$currency = '';
261
+			}
262
+			$space = $locale["{$letter}_sep_by_space"] ? ' ' : '';
263 263
 
264
-            $value = number_format($value, $right, $locale['mon_decimal_point'], $flags['nogroup'] ? '' : $locale['mon_thousands_sep']);
265
-            $value = @explode($locale['mon_decimal_point'], $value);
264
+			$value = number_format($value, $right, $locale['mon_decimal_point'], $flags['nogroup'] ? '' : $locale['mon_thousands_sep']);
265
+			$value = @explode($locale['mon_decimal_point'], $value);
266 266
 
267
-            $n = strlen($prefix) + strlen($currency) + strlen($value[0]);
268
-            if ($left > 0 && $left > $n) {
269
-                $value[0] = str_repeat($flags['fillchar'], $left - $n) . $value[0];
270
-            }
271
-            $value = implode($locale['mon_decimal_point'], $value);
272
-            if ($locale["{$letter}_cs_precedes"]) {
273
-                $value = $prefix . $currency . $space . $value . $suffix;
274
-            } else {
275
-                $value = $prefix . $value . $space . $currency . $suffix;
276
-            }
277
-            if ($width > 0) {
278
-                $value = str_pad($value, $width, $flags['fillchar'], $flags['isleft'] ?
279
-                                STR_PAD_RIGHT : STR_PAD_LEFT);
280
-            }
267
+			$n = strlen($prefix) + strlen($currency) + strlen($value[0]);
268
+			if ($left > 0 && $left > $n) {
269
+				$value[0] = str_repeat($flags['fillchar'], $left - $n) . $value[0];
270
+			}
271
+			$value = implode($locale['mon_decimal_point'], $value);
272
+			if ($locale["{$letter}_cs_precedes"]) {
273
+				$value = $prefix . $currency . $space . $value . $suffix;
274
+			} else {
275
+				$value = $prefix . $value . $space . $currency . $suffix;
276
+			}
277
+			if ($width > 0) {
278
+				$value = str_pad($value, $width, $flags['fillchar'], $flags['isleft'] ?
279
+								STR_PAD_RIGHT : STR_PAD_LEFT);
280
+			}
281 281
 
282
-            $format = str_replace($fmatch[0], $value, $format);
283
-        }
284
-        return $format;
285
-    }
282
+			$format = str_replace($fmatch[0], $value, $format);
283
+		}
284
+		return $format;
285
+	}
286 286
 
287
-    function get_list_taxes() {
288
-        $this->db->select('id,taxes_description');
289
-        $query = $this->db->get("taxes");
290
-        $taxesList = array();
291
-        if ($query->num_rows() > 0) {
292
-            return $query->result();
293
-        }
294
-    }
287
+	function get_list_taxes() {
288
+		$this->db->select('id,taxes_description');
289
+		$query = $this->db->get("taxes");
290
+		$taxesList = array();
291
+		if ($query->num_rows() > 0) {
292
+			return $query->result();
293
+		}
294
+	}
295 295
 
296
-    function get_params($table_name, $select, $where) {
297
-        if (is_array($select)) {
296
+	function get_params($table_name, $select, $where) {
297
+		if (is_array($select)) {
298 298
             
299
-        } else {
300
-            $this->db->select($select);
301
-        }
302
-        if (is_array($where)) {
299
+		} else {
300
+			$this->db->select($select);
301
+		}
302
+		if (is_array($where)) {
303 303
             
304
-        } else {
305
-            $this->db->where($where);
306
-        }
307
-        $query = $this->db->get($table_name);
308
-        $query = $query->result();
309
-        return $query;
310
-    }
311
-    /* ASTPP  3.0 
304
+		} else {
305
+			$this->db->where($where);
306
+		}
307
+		$query = $this->db->get($table_name);
308
+		$query = $query->result();
309
+		return $query;
310
+	}
311
+	/* ASTPP  3.0 
312 312
      * Using for Payment Functionality from Admin/Reseller Login
313 313
      */
314
-    function get_parent_info($accountid){
315
-        $this->db->where('id',$accountid);
316
-        $this->db->select('reseller_id,type');
317
-        $account_result=$this->db->get('accounts');
318
-        $account_result=(array)$account_result->first_row();
319
-        if(isset($account_result['reseller_id']) && $account_result['reseller_id']> 0){
320
-            return $account_result['reseller_id'];
321
-        }else{
322
-            return '0';
323
-        }
314
+	function get_parent_info($accountid){
315
+		$this->db->where('id',$accountid);
316
+		$this->db->select('reseller_id,type');
317
+		$account_result=$this->db->get('accounts');
318
+		$account_result=(array)$account_result->first_row();
319
+		if(isset($account_result['reseller_id']) && $account_result['reseller_id']> 0){
320
+			return $account_result['reseller_id'];
321
+		}else{
322
+			return '0';
323
+		}
324 324
         
325
-    }
326
-    function apply_invoice_taxes($invoiceid, $account, $start_date) {
327
-        $tax_priority = "";
328
-        $where = array("accountid" => $account['id']);
329
-        $accounttax_query = $this->db_model->getSelectWithOrder("*", "taxes_to_accounts", $where, "ASC", "taxes_priority");
330
-        if ($accounttax_query->num_rows > 0) {
331
-            $accounttax_query = $accounttax_query->result_array();
332
-            foreach ($accounttax_query as $tax_value) {
333
-                $taxes_info = $this->db->get_where('taxes', array('id' => $tax_value['taxes_id']));
334
-                if ($taxes_info->num_rows() > 0) {
335
-                    $tax_value = $taxes_info->result_array();
336
-                    $tax_value = $tax_value[0];
337
-                    if ($tax_value["taxes_priority"] == "") {
338
-                        $tax_priority = $tax_value["taxes_priority"];
339
-                    } else if ($tax_value["taxes_priority"] > $tax_priority) {
340
-                        $query = $this->db_model->getSelect("SUM(debit) as total", "invoice_details", array("invoiceid" => $invoiceid));
341
-                        $query = $query->result_array();
342
-                        $sub_total = $query["0"]["total"];
343
-                    }
344
-                    $tax_total = (($sub_total * ( $tax_value['taxes_rate'] / 100 )) + $tax_value['taxes_amount'] );
345
-                    $tax_total = round($tax_total, self::$global_config['system_config']['decimalpoints']);
346
-                    $tax_array = array("accountid" => $account['id'], "reseller_id" => $account['reseller_id'], "invoiceid" => $invoiceid, "item_id" => "0", "description" => $tax_value['taxes_description'], "debit" => $tax_total, "credit" => "", "item_type" => "TAX", "created_date" => $start_date);
347
-                    $this->db->insert("invoice_details", $tax_array);
348
-                }
349
-            }
350
-        }
351
-        return TRUE;
352
-    }
325
+	}
326
+	function apply_invoice_taxes($invoiceid, $account, $start_date) {
327
+		$tax_priority = "";
328
+		$where = array("accountid" => $account['id']);
329
+		$accounttax_query = $this->db_model->getSelectWithOrder("*", "taxes_to_accounts", $where, "ASC", "taxes_priority");
330
+		if ($accounttax_query->num_rows > 0) {
331
+			$accounttax_query = $accounttax_query->result_array();
332
+			foreach ($accounttax_query as $tax_value) {
333
+				$taxes_info = $this->db->get_where('taxes', array('id' => $tax_value['taxes_id']));
334
+				if ($taxes_info->num_rows() > 0) {
335
+					$tax_value = $taxes_info->result_array();
336
+					$tax_value = $tax_value[0];
337
+					if ($tax_value["taxes_priority"] == "") {
338
+						$tax_priority = $tax_value["taxes_priority"];
339
+					} else if ($tax_value["taxes_priority"] > $tax_priority) {
340
+						$query = $this->db_model->getSelect("SUM(debit) as total", "invoice_details", array("invoiceid" => $invoiceid));
341
+						$query = $query->result_array();
342
+						$sub_total = $query["0"]["total"];
343
+					}
344
+					$tax_total = (($sub_total * ( $tax_value['taxes_rate'] / 100 )) + $tax_value['taxes_amount'] );
345
+					$tax_total = round($tax_total, self::$global_config['system_config']['decimalpoints']);
346
+					$tax_array = array("accountid" => $account['id'], "reseller_id" => $account['reseller_id'], "invoiceid" => $invoiceid, "item_id" => "0", "description" => $tax_value['taxes_description'], "debit" => $tax_total, "credit" => "", "item_type" => "TAX", "created_date" => $start_date);
347
+					$this->db->insert("invoice_details", $tax_array);
348
+				}
349
+			}
350
+		}
351
+		return TRUE;
352
+	}
353 353
     
354 354
 }
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
         $config = array();
57 57
         $result = $query->result_array();
58 58
         foreach ($result as $row) {
59
-			if($row['name'] == 'decimal_points' || $row['name'] == 'starting_digit' || $row['name'] == 'card_length' || $row['name'] == 'pin_length'){
60
-				$row['name'] = str_replace("_","",$row['name']);
59
+			if ($row['name'] == 'decimal_points' || $row['name'] == 'starting_digit' || $row['name'] == 'card_length' || $row['name'] == 'pin_length') {
60
+				$row['name'] = str_replace("_", "", $row['name']);
61 61
 			}
62 62
             $config[$row['name']] = $row['value'];
63 63
         }
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
         return $currencylist;
88 88
     }
89 89
     
90
-    function get_admin_info(){
91
-         $result=$this->db->get_where('accounts',array('type'=>'-1'));
92
-         $result=$result->result_array();
90
+    function get_admin_info() {
91
+         $result = $this->db->get_where('accounts', array('type'=>'-1'));
92
+         $result = $result->result_array();
93 93
          self::$global_config['admin_info'] = $result[0];
94 94
          return $result[0];
95 95
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * Changes for invoices
98 98
      */
99 99
      function generate_receipt($accountid, $amount, $accountinfo, $last_invoice_ID, $invoice_prefix, $due_date) {
100
-		$amount = str_replace( ',', '', $amount );
100
+		$amount = str_replace(',', '', $amount);
101 101
         $invoice_data = array("accountid" => $accountid,
102 102
                               "invoice_prefix" => $invoice_prefix,
103 103
                               "invoiceid" => $last_invoice_ID,
@@ -123,16 +123,16 @@  discard block
 block discarded – undo
123 123
                 $to_currency1 = $this->session->userdata['accountinfo']['currency_id'];
124 124
                 $to_currency = $this->common->get_field_name('currency', 'currency', $to_currency1);
125 125
         }
126
-        $from_cur_rate = (self::$global_config['currency_list'][$from_currency] > 0)?self::$global_config['currency_list'][$from_currency]:1;
127
-        $to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1;
128
-        $amount = str_replace( ',', '', $amount );
126
+        $from_cur_rate = (self::$global_config['currency_list'][$from_currency] > 0) ? self::$global_config['currency_list'][$from_currency] : 1;
127
+        $to_cur_rate = (self::$global_config['currency_list'][$to_currency]) ? self::$global_config['currency_list'][$to_currency] : 1;
128
+        $amount = str_replace(',', '', $amount);
129 129
         $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate;
130 130
         if ($format_currency)
131 131
             $cal_amount = $this->format_currency($cal_amount);
132
-        if ($append_currency){
133
-            $cal_amount = $cal_amount . " " . $to_currency;
132
+        if ($append_currency) {
133
+            $cal_amount = $cal_amount." ".$to_currency;
134 134
         }
135
-        $cal_amount = str_replace( ',', '', $cal_amount );
135
+        $cal_amount = str_replace(',', '', $cal_amount);
136 136
         return $cal_amount;
137 137
     }
138 138
     function calculate_currency_customer($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) {
@@ -142,35 +142,35 @@  discard block
 block discarded – undo
142 142
                 $to_currency1 = $this->session->userdata['accountinfo']['currency_id'];
143 143
                 $to_currency = $this->common->get_field_name('currency', 'currency', $to_currency1);
144 144
         }        
145
-        $from_cur_rate = (self::$global_config['currency_list'][$from_currency] > 0)?self::$global_config['currency_list'][$from_currency]:1;
146
-        $to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1;
147
-        $amount = str_replace( ',', '', $amount );
145
+        $from_cur_rate = (self::$global_config['currency_list'][$from_currency] > 0) ? self::$global_config['currency_list'][$from_currency] : 1;
146
+        $to_cur_rate = (self::$global_config['currency_list'][$to_currency]) ? self::$global_config['currency_list'][$to_currency] : 1;
147
+        $amount = str_replace(',', '', $amount);
148 148
         $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate;
149 149
         if ($format_currency)
150 150
             $cal_amount = $this->format_currency($cal_amount);
151 151
         if ($append_currency)
152
-            $cal_amount = $cal_amount ;
153
-        $cal_amount = str_replace( ',', '', $cal_amount );
152
+            $cal_amount = $cal_amount;
153
+        $cal_amount = str_replace(',', '', $cal_amount);
154 154
         return $cal_amount;
155 155
         }
156 156
 
157 157
     function add_calculate_currency($amount = 0, $from_currency = '', $to_currency = '', $format_currency = true, $append_currency = true) {
158
-        $amount = str_replace( ',', '', $amount );
158
+        $amount = str_replace(',', '', $amount);
159 159
         if ($from_currency == '') {
160 160
                 $from_currency1 = $this->session->userdata['accountinfo']['currency_id'];
161 161
                 $from_currency = $this->common->get_field_name('currency', 'currency', $from_currency1);
162 162
         }
163 163
         $to_currency = ($to_currency == '') ? self::$global_config['system_config']['base_currency'] : $to_currency;
164
-        if(self::$global_config['currency_list'][$from_currency] > 0){
164
+        if (self::$global_config['currency_list'][$from_currency] > 0) {
165 165
 			$cal_amount = ($amount * self::$global_config['currency_list'][$to_currency]) / self::$global_config['currency_list'][$from_currency];
166
-		}else{
167
-			$cal_amount=$amount;
166
+		} else {
167
+			$cal_amount = $amount;
168 168
 		}
169 169
         if ($format_currency)
170 170
             $cal_amount = $this->format_currency($cal_amount);
171 171
         if ($append_currency)
172
-            $cal_amount = $cal_amount . " " . $to_currency;
173
-        $cal_amount = str_replace( ',', '', $cal_amount );
172
+            $cal_amount = $cal_amount." ".$to_currency;
173
+        $cal_amount = str_replace(',', '', $cal_amount);
174 174
         return $cal_amount;
175 175
     }
176 176
 
@@ -181,26 +181,26 @@  discard block
 block discarded – undo
181 181
         }
182 182
         $from_currency = ($from_currency == '') ? self::$global_config['system_config']['base_currency'] : $from_currency;
183 183
 
184
-        $from_cur_rate = (self::$global_config['currency_list'][$from_currency] > 0)?self::$global_config['currency_list'][$from_currency]:1;
185
-        $to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1;
186
-        $amount = str_replace( ',', '', $amount );
184
+        $from_cur_rate = (self::$global_config['currency_list'][$from_currency] > 0) ? self::$global_config['currency_list'][$from_currency] : 1;
185
+        $to_cur_rate = (self::$global_config['currency_list'][$to_currency]) ? self::$global_config['currency_list'][$to_currency] : 1;
186
+        $amount = str_replace(',', '', $amount);
187 187
         $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate;
188 188
         if ($format_currency)
189 189
             $cal_amount = $this->format_currency($cal_amount);
190 190
         if ($append_currency)
191
-            $cal_amount = $cal_amount . " " . $to_currency;
192
-        $cal_amount = str_replace( ',', '', $cal_amount );
191
+            $cal_amount = $cal_amount." ".$to_currency;
192
+        $cal_amount = str_replace(',', '', $cal_amount);
193 193
         return $cal_amount;
194 194
     }
195 195
 
196 196
     function format_currency($amount) {
197
-		$amount = str_replace( ',', '', $amount );
198
-        return  number_format($amount,Common_model::$global_config['system_config']['decimalpoints']);
197
+		$amount = str_replace(',', '', $amount);
198
+        return  number_format($amount, Common_model::$global_config['system_config']['decimalpoints']);
199 199
 	//	return $amount;
200 200
     }
201 201
 
202 202
     function money_format($format, $number) {
203
-        $regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?' .
203
+        $regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?'.
204 204
                 '(?:#([0-9]+))?(?:\.([0-9]+))?([in%])/';
205 205
         if (setlocale(LC_MONETARY, 0) == 'C') {
206 206
             setlocale(LC_MONETARY, '');
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
                 'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0,
219 219
                 'isleft' => preg_match('/\-/', $fmatch[1]) > 0
220 220
             );
221
-            $width = trim($fmatch[2]) ? (int) $fmatch[2] : 0;
222
-            $left = trim($fmatch[3]) ? (int) $fmatch[3] : 0;
223
-            $right = trim($fmatch[4]) ? (int) $fmatch[4] : $locale['int_frac_digits'];
221
+            $width = trim($fmatch[2]) ? (int)$fmatch[2] : 0;
222
+            $left = trim($fmatch[3]) ? (int)$fmatch[3] : 0;
223
+            $right = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits'];
224 224
             $conversion = $fmatch[5];
225 225
 
226 226
             $positive = true;
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
                     $suffix = ')';
253 253
                     break;
254 254
             }
255
-            if (!$flags['nosimbol']) {
256
-                $currency = $cprefix .
257
-                        ($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']) .
255
+            if ( ! $flags['nosimbol']) {
256
+                $currency = $cprefix.
257
+                        ($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']).
258 258
                         $csuffix;
259 259
             } else {
260 260
                 $currency = '';
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
 
267 267
             $n = strlen($prefix) + strlen($currency) + strlen($value[0]);
268 268
             if ($left > 0 && $left > $n) {
269
-                $value[0] = str_repeat($flags['fillchar'], $left - $n) . $value[0];
269
+                $value[0] = str_repeat($flags['fillchar'], $left - $n).$value[0];
270 270
             }
271 271
             $value = implode($locale['mon_decimal_point'], $value);
272 272
             if ($locale["{$letter}_cs_precedes"]) {
273
-                $value = $prefix . $currency . $space . $value . $suffix;
273
+                $value = $prefix.$currency.$space.$value.$suffix;
274 274
             } else {
275
-                $value = $prefix . $value . $space . $currency . $suffix;
275
+                $value = $prefix.$value.$space.$currency.$suffix;
276 276
             }
277 277
             if ($width > 0) {
278 278
                 $value = str_pad($value, $width, $flags['fillchar'], $flags['isleft'] ?
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
     /* ASTPP  3.0 
312 312
      * Using for Payment Functionality from Admin/Reseller Login
313 313
      */
314
-    function get_parent_info($accountid){
315
-        $this->db->where('id',$accountid);
314
+    function get_parent_info($accountid) {
315
+        $this->db->where('id', $accountid);
316 316
         $this->db->select('reseller_id,type');
317
-        $account_result=$this->db->get('accounts');
318
-        $account_result=(array)$account_result->first_row();
319
-        if(isset($account_result['reseller_id']) && $account_result['reseller_id']> 0){
317
+        $account_result = $this->db->get('accounts');
318
+        $account_result = (array)$account_result->first_row();
319
+        if (isset($account_result['reseller_id']) && $account_result['reseller_id'] > 0) {
320 320
             return $account_result['reseller_id'];
321
-        }else{
321
+        } else {
322 322
             return '0';
323 323
         }
324 324
         
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
                         $query = $query->result_array();
342 342
                         $sub_total = $query["0"]["total"];
343 343
                     }
344
-                    $tax_total = (($sub_total * ( $tax_value['taxes_rate'] / 100 )) + $tax_value['taxes_amount'] );
344
+                    $tax_total = (($sub_total * ($tax_value['taxes_rate'] / 100)) + $tax_value['taxes_amount']);
345 345
                     $tax_total = round($tax_total, self::$global_config['system_config']['decimalpoints']);
346 346
                     $tax_array = array("accountid" => $account['id'], "reseller_id" => $account['reseller_id'], "invoiceid" => $invoiceid, "item_id" => "0", "description" => $tax_value['taxes_description'], "debit" => $tax_total, "credit" => "", "item_type" => "TAX", "created_date" => $start_date);
347 347
                     $this->db->insert("invoice_details", $tax_array);
Please login to merge, or discard this patch.
Braces   +23 added lines, -16 removed lines patch added patch discarded remove patch
@@ -127,8 +127,9 @@  discard block
 block discarded – undo
127 127
         $to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1;
128 128
         $amount = str_replace( ',', '', $amount );
129 129
         $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate;
130
-        if ($format_currency)
131
-            $cal_amount = $this->format_currency($cal_amount);
130
+        if ($format_currency) {
131
+                    $cal_amount = $this->format_currency($cal_amount);
132
+        }
132 133
         if ($append_currency){
133 134
             $cal_amount = $cal_amount . " " . $to_currency;
134 135
         }
@@ -146,10 +147,12 @@  discard block
 block discarded – undo
146 147
         $to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1;
147 148
         $amount = str_replace( ',', '', $amount );
148 149
         $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate;
149
-        if ($format_currency)
150
-            $cal_amount = $this->format_currency($cal_amount);
151
-        if ($append_currency)
152
-            $cal_amount = $cal_amount ;
150
+        if ($format_currency) {
151
+                    $cal_amount = $this->format_currency($cal_amount);
152
+        }
153
+        if ($append_currency) {
154
+                    $cal_amount = $cal_amount ;
155
+        }
153 156
         $cal_amount = str_replace( ',', '', $cal_amount );
154 157
         return $cal_amount;
155 158
         }
@@ -163,13 +166,15 @@  discard block
 block discarded – undo
163 166
         $to_currency = ($to_currency == '') ? self::$global_config['system_config']['base_currency'] : $to_currency;
164 167
         if(self::$global_config['currency_list'][$from_currency] > 0){
165 168
 			$cal_amount = ($amount * self::$global_config['currency_list'][$to_currency]) / self::$global_config['currency_list'][$from_currency];
166
-		}else{
169
+		} else{
167 170
 			$cal_amount=$amount;
168 171
 		}
169
-        if ($format_currency)
170
-            $cal_amount = $this->format_currency($cal_amount);
171
-        if ($append_currency)
172
-            $cal_amount = $cal_amount . " " . $to_currency;
172
+        if ($format_currency) {
173
+                    $cal_amount = $this->format_currency($cal_amount);
174
+        }
175
+        if ($append_currency) {
176
+                    $cal_amount = $cal_amount . " " . $to_currency;
177
+        }
173 178
         $cal_amount = str_replace( ',', '', $cal_amount );
174 179
         return $cal_amount;
175 180
     }
@@ -185,10 +190,12 @@  discard block
 block discarded – undo
185 190
         $to_cur_rate = (self::$global_config['currency_list'][$to_currency])?self::$global_config['currency_list'][$to_currency]:1;
186 191
         $amount = str_replace( ',', '', $amount );
187 192
         $cal_amount = ($amount * $to_cur_rate) / $from_cur_rate;
188
-        if ($format_currency)
189
-            $cal_amount = $this->format_currency($cal_amount);
190
-        if ($append_currency)
191
-            $cal_amount = $cal_amount . " " . $to_currency;
193
+        if ($format_currency) {
194
+                    $cal_amount = $this->format_currency($cal_amount);
195
+        }
196
+        if ($append_currency) {
197
+                    $cal_amount = $cal_amount . " " . $to_currency;
198
+        }
192 199
         $cal_amount = str_replace( ',', '', $cal_amount );
193 200
         return $cal_amount;
194 201
     }
@@ -318,7 +325,7 @@  discard block
 block discarded – undo
318 325
         $account_result=(array)$account_result->first_row();
319 326
         if(isset($account_result['reseller_id']) && $account_result['reseller_id']> 0){
320 327
             return $account_result['reseller_id'];
321
-        }else{
328
+        } else{
322 329
             return '0';
323 330
         }
324 331
         
Please login to merge, or discard this patch.
web_interface/astpp/application/helpers/csv_helper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 			header('Content-type: text/csv; charset=UTF-8');
36 36
 			header('Content-Encoding: UTF-8');
37 37
 // 			header('Content-Type: application/csv');
38
-			header('Content-Disposition: attachement; filename="' . $download . '"');
38
+			header('Content-Disposition: attachement; filename="'.$download.'"');
39 39
 			echo "\xEF\xBB\xBF"; // UTF-8 BOM
40 40
 			header("Pragma: no-cache");
41 41
 			header("Expires: 0");
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 
3 5
 // ------------------------------------------------------------------------
4 6
 
@@ -59,8 +61,7 @@  discard block
 block discarded – undo
59 61
 		if ($download == "")
60 62
 		{
61 63
 			return $str;	
62
-		}
63
-		else
64
+		} else
64 65
 		{	
65 66
 			echo $str;
66 67
 		}		
Please login to merge, or discard this patch.
web_interface/astpp/application/helpers/email_csv_helper.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
 function send_csv_mail ($csvData, $body, $to, $subject,$file_name) {
11 11
 	//print_r($csvData);
12 12
 	$where = array('group_title' =>'email');
13
-        $query = $this->CI->db_model->getSelect("*", "system", $where);
14
-        $query = $query->result_array();
13
+		$query = $this->CI->db_model->getSelect("*", "system", $where);
14
+		$query = $query->result_array();
15 15
 	foreach($query as $key=>$val){
16 16
 		$from=$val['value'];
17 17
 	}
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2 2
 
3 3
 function create_csv_string($data) {
4
-	if (!$fp = fopen('php://temp', 'w+')) return FALSE;
4
+	if ( ! $fp = fopen('php://temp', 'w+')) return FALSE;
5 5
 	foreach ($data as $line) fputcsv($fp, $line);
6 6
 	rewind($fp);
7 7
 	return stream_get_contents($fp);
8 8
 }
9 9
 
10
-function send_csv_mail ($csvData, $body, $to, $subject,$file_name) {
10
+function send_csv_mail($csvData, $body, $to, $subject, $file_name) {
11 11
 	//print_r($csvData);
12 12
 	$where = array('group_title' =>'email');
13 13
         $query = $this->CI->db_model->getSelect("*", "system", $where);
14 14
         $query = $query->result_array();
15
-	foreach($query as $key=>$val){
16
-		$from=$val['value'];
15
+	foreach ($query as $key=>$val) {
16
+		$from = $val['value'];
17 17
 	}
18 18
 	$multipartSep = '-----'.md5(time()).'-----';
19 19
 	$headers = array(
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,14 @@
 block discarded – undo
1
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 
3 5
 function create_csv_string($data) {
4
-	if (!$fp = fopen('php://temp', 'w+')) return FALSE;
5
-	foreach ($data as $line) fputcsv($fp, $line);
6
+	if (!$fp = fopen('php://temp', 'w+')) {
7
+		return FALSE;
8
+	}
9
+	foreach ($data as $line) {
10
+		fputcsv($fp, $line);
11
+	}
6 12
 	rewind($fp);
7 13
 	return stream_get_contents($fp);
8 14
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/helpers/MY_form_helper.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 			if(strtolower(trim($value)) == strtolower(trim($selected)))
38 38
 			{
39 39
                             
40
-                            $form .= ' selected="selected" >';
40
+							$form .= ' selected="selected" >';
41 41
                                 
42 42
 			}
43 43
 			else
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2 2
 	
3 3
 // ------------------------------------------------------------------------
4 4
 
@@ -12,29 +12,29 @@  discard block
 block discarded – undo
12 12
  * @return	string
13 13
  */
14 14
 
15
-if( !function_exists( 'form_countries' ) )
15
+if ( ! function_exists('form_countries'))
16 16
 {
17
-	function form_countries( $name, $selected = FALSE, $attributes, $form_name="" )
17
+	function form_countries($name, $selected = FALSE, $attributes, $form_name = "")
18 18
 	{
19 19
 		$country_list = Common_model::$global_config['country_list'];
20 20
 		$form = '<select name="'.$name.'"';
21 21
 
22
-		foreach( $attributes as $key => $value )
22
+		foreach ($attributes as $key => $value)
23 23
 		{
24 24
 			$form .= " ".$key.'="'.$value.'"';
25 25
 		}
26 26
 
27 27
 		$form .= ">";
28 28
 		
29
-		if($form_name!=""){
29
+		if ($form_name != "") {
30 30
 			$form .= "\n".'<option value="" selected="selected" >'.$form_name.'</option>';
31 31
 		}
32 32
 
33
-		foreach( $country_list as $key => $value )
33
+		foreach ($country_list as $key => $value)
34 34
 		{
35
-			$form .= "\n".'<option value="'.ucwords( strtolower( $value ) ).'"';
35
+			$form .= "\n".'<option value="'.ucwords(strtolower($value)).'"';
36 36
 
37
-			if(strtolower(trim($value)) == strtolower(trim($selected)))
37
+			if (strtolower(trim($value)) == strtolower(trim($selected)))
38 38
 			{
39 39
                             
40 40
                             $form .= ' selected="selected" >';
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 				$form .= '>';
46 46
 			}
47 47
 			
48
-			$form .= ucwords( strtolower( $value ) ).'</option>';
48
+			$form .= ucwords(strtolower($value)).'</option>';
49 49
 		}
50 50
 
51 51
 		$form .= "\n</select>";
@@ -54,30 +54,30 @@  discard block
 block discarded – undo
54 54
 	}
55 55
 }
56 56
 
57
-if(!function_exists('form_devicetype'))
57
+if ( ! function_exists('form_devicetype'))
58 58
 {
59
-	function form_devicetype( $name, $selected = FALSE, $attributes )
59
+	function form_devicetype($name, $selected = FALSE, $attributes)
60 60
 	{
61
-		$CI =& get_instance();
61
+		$CI = & get_instance();
62 62
 
63
-		$CI->config->load( 'countries' );
63
+		$CI->config->load('countries');
64 64
 
65
-		$type_list = $CI->config->item( 'device_types' );
65
+		$type_list = $CI->config->item('device_types');
66 66
 
67 67
 		$form = '<select name="'.$name.'"';
68 68
 
69
-		foreach( $attributes as $key => $value )
69
+		foreach ($attributes as $key => $value)
70 70
 		{
71 71
 			$form .= " ".$key.'="'.$value.'"';
72 72
 		}
73 73
 
74 74
 		$form .= ">";
75 75
 
76
-		foreach( $type_list as $key => $value )
76
+		foreach ($type_list as $key => $value)
77 77
 		{
78 78
 			$form .= "\n".'<option value="'.$key.'"';
79 79
 
80
-			if( $key == $selected )
80
+			if ($key == $selected)
81 81
 			{
82 82
 				$form .= '  selected="selected">';
83 83
 			}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 				$form .= '>';
87 87
 			}
88 88
 
89
-			$form .= ucwords( strtolower( $value ) ).'</option>';
89
+			$form .= ucwords(strtolower($value)).'</option>';
90 90
 		}
91 91
 
92 92
 		$form .= "\n</select>";
@@ -96,30 +96,30 @@  discard block
 block discarded – undo
96 96
 }
97 97
 
98 98
 // ------------------------------------------------------------------------
99
-if( !function_exists( 'form_timezone' ) )
99
+if ( ! function_exists('form_timezone'))
100 100
 {
101
-	function form_timezone( $name, $selected = FALSE, $attributes )
101
+	function form_timezone($name, $selected = FALSE, $attributes)
102 102
 	{
103
-		$CI =& get_instance();
103
+		$CI = & get_instance();
104 104
 
105
-		$CI->config->load( 'countries' );
105
+		$CI->config->load('countries');
106 106
 
107
-		$country_list = $CI->config->item( 'timezone1_list' );
107
+		$country_list = $CI->config->item('timezone1_list');
108 108
 
109 109
 		$form = '<select name="'.$name.'"';
110 110
 
111
-		foreach( $attributes as $key => $value )
111
+		foreach ($attributes as $key => $value)
112 112
 		{
113 113
 			$form .= " ".$key.'="'.$value.'"';
114 114
 		}
115 115
 
116 116
 		$form .= ">";
117 117
 
118
-		foreach( $country_list as $key => $value )
118
+		foreach ($country_list as $key => $value)
119 119
 		{
120
-			$form .= "\n".'<option value="'.ucwords( strtolower( $value ) ).'"';
120
+			$form .= "\n".'<option value="'.ucwords(strtolower($value)).'"';
121 121
 
122
-			if( strtolower($value) == strtolower($selected) )
122
+			if (strtolower($value) == strtolower($selected))
123 123
 			{
124 124
 				$form .= '  selected="selected">';
125 125
 			}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 				$form .= '>';
129 129
 			}
130 130
 
131
-			$form .= ucwords( strtolower( $value ) ).'</option>';
131
+			$form .= ucwords(strtolower($value)).'</option>';
132 132
 		}
133 133
 
134 134
 		$form .= "\n</select>";
@@ -137,26 +137,26 @@  discard block
 block discarded – undo
137 137
 	}
138 138
 }
139 139
 //=========================================
140
-if( !function_exists( 'form_languagelist' ) )
140
+if ( ! function_exists('form_languagelist'))
141 141
 {
142
-	function form_languagelist( $name, $selected = FALSE, $attributes )
142
+	function form_languagelist($name, $selected = FALSE, $attributes)
143 143
 	{
144 144
 		$language_list = Common_model::$global_config['language_list'];
145 145
 
146 146
 		$form = '<select name="'.$name.'"';
147 147
 
148
-		foreach( $attributes as $key => $value )
148
+		foreach ($attributes as $key => $value)
149 149
 		{
150 150
 			$form .= " ".$key.'="'.$value.'"';
151 151
 		}
152 152
 
153 153
 		$form .= ">";
154 154
 
155
-		foreach( $language_list as $key => $value )
155
+		foreach ($language_list as $key => $value)
156 156
 		{
157
-			$form .= "\n".'<option value="'.( strtolower( $key ) ).'"';
157
+			$form .= "\n".'<option value="'.(strtolower($key)).'"';
158 158
 
159
-			if( $key == $selected )
159
+			if ($key == $selected)
160 160
 			{
161 161
 				$form .= ' selected>';
162 162
 			}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 				$form .= '>';
166 166
 			}
167 167
 
168
-			$form .=  ucfirst(strtolower($value)).'</option>';
168
+			$form .= ucfirst(strtolower($value)).'</option>';
169 169
 		}
170 170
 
171 171
 		$form .= "\n</select>";
@@ -175,28 +175,28 @@  discard block
 block discarded – undo
175 175
 }
176 176
 
177 177
 //-----------------------------------------
178
-if( !function_exists( 'form_select_default' ) )
178
+if ( ! function_exists('form_select_default'))
179 179
 {
180
-	function form_select_default( $name,$data, $selected = "", $attributes, $form_name="" )
180
+	function form_select_default($name, $data, $selected = "", $attributes, $form_name = "")
181 181
 	{
182 182
 		$form = '<select name="'.$name.'"';
183 183
 
184
-		foreach( $attributes as $key => $value )
184
+		foreach ($attributes as $key => $value)
185 185
 		{
186 186
 			$form .= " ".$key.'="'.$value.'"';
187 187
 		}
188 188
 
189 189
 		$form .= ">";
190 190
 		
191
-		if($form_name!=""){
191
+		if ($form_name != "") {
192 192
 			$form .= "\n".'<option value="" selected="selected" >'.$form_name.'</option>';
193 193
 		}
194 194
 		
195
-		foreach( $data as $key => $value )
195
+		foreach ($data as $key => $value)
196 196
 		{
197 197
 			$form .= "\n".'<option value="'.$key.'"';
198 198
 			
199
-			if( $key == $selected )
199
+			if ($key == $selected)
200 200
 			{
201 201
 				$form .= ' selected>';
202 202
 			}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 				$form .= '>';
206 206
 			}
207 207
 
208
-			$form .= ucwords( strtolower( $value ) ).'</option>';
208
+			$form .= ucwords(strtolower($value)).'</option>';
209 209
 		}
210 210
 
211 211
 		$form .= "\n</select>";
@@ -215,30 +215,30 @@  discard block
 block discarded – undo
215 215
 	}
216 216
 }	
217 217
 //-----------------------------------------
218
-if(!function_exists('form_disposition'))
218
+if ( ! function_exists('form_disposition'))
219 219
 {
220
-	function form_disposition( $name, $selected = FALSE, $attributes )
220
+	function form_disposition($name, $selected = FALSE, $attributes)
221 221
 	{
222
-		$CI =& get_instance();
222
+		$CI = & get_instance();
223 223
 
224
-		$CI->config->load( 'countries' );
224
+		$CI->config->load('countries');
225 225
 
226
-		$type_list = $CI->config->item( 'disposition' );
226
+		$type_list = $CI->config->item('disposition');
227 227
 
228 228
 		$form = '<select name="'.$name.'"';
229 229
 
230
-		foreach( $attributes as $key => $value )
230
+		foreach ($attributes as $key => $value)
231 231
 		{
232 232
 			$form .= " ".$key.'="'.$value.'"';
233 233
 		}
234 234
 
235 235
 		$form .= ">";
236 236
 
237
-		foreach( $type_list as $key => $value )
237
+		foreach ($type_list as $key => $value)
238 238
 		{
239 239
 			$form .= "\n".'<option value="'.$key.'"';
240 240
 
241
-			if( $key == $selected )
241
+			if ($key == $selected)
242 242
 			{
243 243
 				$form .= '  selected="selected">';
244 244
 			}
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 				$form .= '>';
248 248
 			}
249 249
 
250
-			$form .=  $value  .'</option>';
250
+			$form .= $value.'</option>';
251 251
 		}
252 252
 
253 253
 		$form .= "\n</select>";
@@ -257,27 +257,27 @@  discard block
 block discarded – undo
257 257
 }
258 258
 
259 259
 //-----------------------------------------
260
-if( !function_exists( 'form_table_row' ) )
260
+if ( ! function_exists('form_table_row'))
261 261
 {
262
-	function form_table_row($label,$field,$span){
262
+	function form_table_row($label, $field, $span) {
263 263
 		echo '<tr><th width="10%"><label>'.$label.'</label></th><td>';
264 264
 		echo $field;
265 265
 		echo '<br/><span class="helptext">'.$span.'</span>';
266 266
 		echo '</td></tr>';	
267 267
 	}
268 268
 }	
269
-if( !function_exists( 'form_table_row1' ) )
269
+if ( ! function_exists('form_table_row1'))
270 270
 {
271
-	function form_table_row1($label,$field,$span){
271
+	function form_table_row1($label, $field, $span) {
272 272
 		echo '<tr><th width="10%"><label>'.$label.'</label></th><td>';
273 273
 		echo $field;
274 274
 		echo '<br/><span class="helptext">'.$span.'</span>';
275 275
 		echo '</td>';	
276 276
 	}
277 277
 }
278
-if( !function_exists( 'form_table_row2' ) )
278
+if ( ! function_exists('form_table_row2'))
279 279
 {
280
-	function form_table_row2($label,$field,$span){
280
+	function form_table_row2($label, $field, $span) {
281 281
 		echo '<th width="10%" style="padding-left: 20px"><label>'.$label.'</label></th><td>';
282 282
 		echo $field;
283 283
 		echo '<br/><span class="helptext">'.$span.'</span>';
@@ -285,37 +285,37 @@  discard block
 block discarded – undo
285 285
 	}
286 286
 }
287 287
 //-------------------------------------		
288
-if( !function_exists( 'form_table_row_1' ) )
288
+if ( ! function_exists('form_table_row_1'))
289 289
 {
290
-	function form_table_row_1($label,$field,$span,$wh='5',$wd='15'){
290
+	function form_table_row_1($label, $field, $span, $wh = '5', $wd = '15') {
291 291
 		echo '<tr><th width="'.$wh.'%"><label>'.$label.'</label></th><td width="'.$wd.'%">';
292 292
 		echo $field;
293 293
 		echo '<br/><span class="helptext">'.$span.'</span>';
294 294
 		echo '</td>';	
295 295
 	}
296 296
 }
297
-if( !function_exists( 'form_table_row_2' ) )
297
+if ( ! function_exists('form_table_row_2'))
298 298
 {
299
-	function form_table_row_2($label,$field,$span,$wh='10',$wd='10'){
299
+	function form_table_row_2($label, $field, $span, $wh = '10', $wd = '10') {
300 300
 		echo '<th width="'.$wh.'%"><label>'.$label.'</label></th><td width="'.$wd.'%">';
301 301
 		echo $field;
302 302
 		echo '<br/><span class="helptext">'.$span.'</span>';
303 303
 		echo '</td>';	
304 304
 	}
305 305
 }
306
-if( !function_exists( 'form_table_row_3' ) )
306
+if ( ! function_exists('form_table_row_3'))
307 307
 {
308
-	function form_table_row_3($label,$field,$span,$wh='10',$wd='15'){
308
+	function form_table_row_3($label, $field, $span, $wh = '10', $wd = '15') {
309 309
 		echo '<th width="'.$wh.'%"><label>'.$label.'</label></th><td width="'.$wd.'%">';
310 310
 		echo $field;
311 311
 		echo '<br/><span class="helptext">'.$span.'</span>';
312 312
 		echo '</td>';	
313 313
 	}
314 314
 }
315
-if( !function_exists( 'form_table_row_4' ) )
315
+if ( ! function_exists('form_table_row_4'))
316 316
 {
317
-	function form_table_row_4($label,$field,$span,$wh='10',$wd=''){
318
-		if(wd == '')
317
+	function form_table_row_4($label, $field, $span, $wh = '10', $wd = '') {
318
+		if (wd == '')
319 319
 			echo '<th width="'.$wh.'%"><label>'.$label.'</label></th><td>';
320 320
 		else 
321 321
 			echo '<th width="'.$wh.'%"><label>'.$label.'</label></th><td width="'.$wd.'%">';
Please login to merge, or discard this patch.
Braces   +14 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if (!defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 	
3 5
 // ------------------------------------------------------------------------
4 6
 
@@ -39,8 +41,7 @@  discard block
 block discarded – undo
39 41
                             
40 42
                             $form .= ' selected="selected" >';
41 43
                                 
42
-			}
43
-			else
44
+			} else
44 45
 			{
45 46
 				$form .= '>';
46 47
 			}
@@ -80,8 +81,7 @@  discard block
 block discarded – undo
80 81
 			if( $key == $selected )
81 82
 			{
82 83
 				$form .= '  selected="selected">';
83
-			}
84
-			else
84
+			} else
85 85
 			{
86 86
 				$form .= '>';
87 87
 			}
@@ -122,8 +122,7 @@  discard block
 block discarded – undo
122 122
 			if( strtolower($value) == strtolower($selected) )
123 123
 			{
124 124
 				$form .= '  selected="selected">';
125
-			}
126
-			else
125
+			} else
127 126
 			{
128 127
 				$form .= '>';
129 128
 			}
@@ -159,8 +158,7 @@  discard block
 block discarded – undo
159 158
 			if( $key == $selected )
160 159
 			{
161 160
 				$form .= ' selected>';
162
-			}
163
-			else
161
+			} else
164 162
 			{
165 163
 				$form .= '>';
166 164
 			}
@@ -199,8 +197,7 @@  discard block
 block discarded – undo
199 197
 			if( $key == $selected )
200 198
 			{
201 199
 				$form .= ' selected>';
202
-			}
203
-			else
200
+			} else
204 201
 			{
205 202
 				$form .= '>';
206 203
 			}
@@ -241,8 +238,7 @@  discard block
 block discarded – undo
241 238
 			if( $key == $selected )
242 239
 			{
243 240
 				$form .= '  selected="selected">';
244
-			}
245
-			else
241
+			} else
246 242
 			{
247 243
 				$form .= '>';
248 244
 			}
@@ -315,10 +311,11 @@  discard block
 block discarded – undo
315 311
 if( !function_exists( 'form_table_row_4' ) )
316 312
 {
317 313
 	function form_table_row_4($label,$field,$span,$wh='10',$wd=''){
318
-		if(wd == '')
319
-			echo '<th width="'.$wh.'%"><label>'.$label.'</label></th><td>';
320
-		else 
321
-			echo '<th width="'.$wh.'%"><label>'.$label.'</label></th><td width="'.$wd.'%">';
314
+		if(wd == '') {
315
+					echo '<th width="'.$wh.'%"><label>'.$label.'</label></th><td>';
316
+		} else {
317
+					echo '<th width="'.$wh.'%"><label>'.$label.'</label></th><td width="'.$wd.'%">';
318
+		}
322 319
 		echo $field;
323 320
 		echo '<br/><span class="helptext">'.$span.'</span>';
324 321
 		echo '</td></tr>';	
Please login to merge, or discard this patch.
web_interface/astpp/application/language/spanish/footer_lang.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
2
-$lang['FOOTER.FOOTER']='Copyright © 2003 - 2012. ASTPP - Open Source Solución de Facturación VOIP. Todos los Derechos Reservados.';
1
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
+$lang['FOOTER.FOOTER'] = 'Copyright © 2003 - 2012. ASTPP - Open Source Solución de Facturación VOIP. Todos los Derechos Reservados.';
3 3
 ?>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php if (!defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 
3 5
 //DID list
4 6
 $lang['DID.MANAGE_DIDs']='Manage DIDs';
Please login to merge, or discard this patch.
web_interface/astpp/application/language/spanish/menu_lang.php 2 patches
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,97 +1,97 @@
 block discarded – undo
1
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2 2
 //Main Menu
3
-$lang['Home']='Casa';
4
-$lang['Global Accounts']='cuentas globales';
5
-$lang['Accounting']='contabilidad';
6
-$lang['Services']='servicios';
7
-$lang['DIDs']='DIDs';
8
-$lang['Routing']='Enrutamiento';
9
-$lang['Reports']='informes';
10
-$lang['System Configuration']='Configuración del sistema';
3
+$lang['Home'] = 'Casa';
4
+$lang['Global Accounts'] = 'cuentas globales';
5
+$lang['Accounting'] = 'contabilidad';
6
+$lang['Services'] = 'servicios';
7
+$lang['DIDs'] = 'DIDs';
8
+$lang['Routing'] = 'Enrutamiento';
9
+$lang['Reports'] = 'informes';
10
+$lang['System Configuration'] = 'Configuración del sistema';
11 11
 
12 12
 
13 13
 //gloabalAccounts useraccount Menu
14 14
 
15
-$lang['User Accounts']='Cuentas de usuario';
16
-$lang['Customer List']='Lista de clientes';
17
-$lang['Reseller List']='lista distribuidor';
18
-$lang['Callshop List']='lista locutorio';
15
+$lang['User Accounts'] = 'Cuentas de usuario';
16
+$lang['Customer List'] = 'Lista de clientes';
17
+$lang['Reseller List'] = 'lista distribuidor';
18
+$lang['Callshop List'] = 'lista locutorio';
19 19
 
20 20
 //gloabalAccounts  ProviderAccounts Menu
21
-$lang['Provider Accounts']='Cuentas de Proveedores';
22
-$lang['Provider List']='Lista de Proveedores';
21
+$lang['Provider Accounts'] = 'Cuentas de Proveedores';
22
+$lang['Provider List'] = 'Lista de Proveedores';
23 23
 //gloabalAccounts  System Accounts Menu
24
-$lang['System Accounts']='Cuentas del sistema';
25
-$lang['Admin List']='Lista de administración';
26
-$lang['Subadmin List']='Lista Subadmin';
24
+$lang['System Accounts'] = 'Cuentas del sistema';
25
+$lang['Admin List'] = 'Lista de administración';
26
+$lang['Subadmin List'] = 'Lista Subadmin';
27 27
 
28 28
 //Accounting Manage Invoices Menu
29
-$lang['Manage Invoice']='Gestione la factura';
30
-$lang['Invoice List']='Lista de facturas';
31
-$lang['Invoice Configuration']='Configuración de facturas';
29
+$lang['Manage Invoice'] = 'Gestione la factura';
30
+$lang['Invoice List'] = 'Lista de facturas';
31
+$lang['Invoice Configuration'] = 'Configuración de facturas';
32 32
 
33 33
 //Accounting Subscription Menu
34
-$lang['Subscriptions']='Suscripciones';
35
-$lang['Periodic Charges']='Cargos periódicos';
34
+$lang['Subscriptions'] = 'Suscripciones';
35
+$lang['Periodic Charges'] = 'Cargos periódicos';
36 36
 
37 37
 //Accounting Manage Taxes Menu
38
-$lang['Manage Taxes']='Gestione impuestos';
39
-$lang['Taxes']='Impuestos';
38
+$lang['Manage Taxes'] = 'Gestione impuestos';
39
+$lang['Taxes'] = 'Impuestos';
40 40
 
41 41
 //Services Calling Cards Menu
42 42
 
43
-$lang['Calling Cards']='Tarjetas de llamadas';
44
-$lang['List Cards']='Lista de Tarjetas';
45
-$lang['CC Brands']='CC Marcas';
46
-$lang['Calling Card CDRs']='Llamando CDRs Tarjeta';
43
+$lang['Calling Cards'] = 'Tarjetas de llamadas';
44
+$lang['List Cards'] = 'Lista de Tarjetas';
45
+$lang['CC Brands'] = 'CC Marcas';
46
+$lang['Calling Card CDRs'] = 'Llamando CDRs Tarjeta';
47 47
 
48 48
 //DID Menu
49
-$lang['Manage DID']='Gestione DID';
50
-$lang['Manage DIDs']='Gestione DIDs';
49
+$lang['Manage DID'] = 'Gestione DID';
50
+$lang['Manage DIDs'] = 'Gestione DIDs';
51 51
 
52 52
 //Routing Providers Menu
53 53
 
54
-$lang['Providers']='Proveedores';
55
-$lang['Trunks']='Baúles';
56
-$lang['Termination Rates']='Las tarifas de terminación';
57
-$lang['Gateways']='Entrada';
58
-$lang['Sip Profile']='Sip Perfil';
54
+$lang['Providers'] = 'Proveedores';
55
+$lang['Trunks'] = 'Baúles';
56
+$lang['Termination Rates'] = 'Las tarifas de terminación';
57
+$lang['Gateways'] = 'Entrada';
58
+$lang['Sip Profile'] = 'Sip Perfil';
59 59
 
60 60
 //Routing Clients Menu
61
-$lang['Clients']='Clientela';
62
-$lang['Rate Group']='Cambio de grupo';
63
-$lang['Origination Rates']='Creaciones de Cambio';
64
-$lang['Packages']='Paquetes';
65
-$lang['Package Usage Report']='Informe de uso del paquete';
61
+$lang['Clients'] = 'Clientela';
62
+$lang['Rate Group'] = 'Cambio de grupo';
63
+$lang['Origination Rates'] = 'Creaciones de Cambio';
64
+$lang['Packages'] = 'Paquetes';
65
+$lang['Package Usage Report'] = 'Informe de uso del paquete';
66 66
 
67 67
 //Reports->CallDetail Reports
68 68
 
69
-$lang['Call Detail Reports']='Llame informes de detalles';
70
-$lang['Customer Reports']='Informes Cliente';
71
-$lang['Reseller Report']='Informe distribuidor';
72
-$lang['Provider Report']='Reporte del Proveedor';
69
+$lang['Call Detail Reports'] = 'Llame informes de detalles';
70
+$lang['Customer Reports'] = 'Informes Cliente';
71
+$lang['Reseller Report'] = 'Informe distribuidor';
72
+$lang['Provider Report'] = 'Reporte del Proveedor';
73 73
 
74 74
 //Reports->Switch Reports Menu
75
-$lang['Switch Reports']='Informes interruptor';
76
-$lang['Live Call Report']='Vivir Informe de llamadas';
77
-$lang['Trunk Stats']='Estadísticas del tronco';
75
+$lang['Switch Reports'] = 'Informes interruptor';
76
+$lang['Live Call Report'] = 'Vivir Informe de llamadas';
77
+$lang['Trunk Stats'] = 'Estadísticas del tronco';
78 78
 
79 79
 //Reports->Summary Reports Menu
80
-$lang['Summary Reports']='Resumen del informe';
81
-$lang['Provider Reports']='Reporte del Proveedor';
82
-$lang['User Report']="Informe de usuario";
80
+$lang['Summary Reports'] = 'Resumen del informe';
81
+$lang['Provider Reports'] = 'Reporte del Proveedor';
82
+$lang['User Report'] = "Informe de usuario";
83 83
 
84 84
 //Reports->Payment Reports Menu
85
-$lang['Payment Reports']='Informes de pago';
86
-$lang['Payment Report']='Informe de Pago';
85
+$lang['Payment Reports'] = 'Informes de pago';
86
+$lang['Payment Report'] = 'Informe de Pago';
87 87
 
88 88
 
89
-$lang['Switch Config']='Cambiar configuración';
90
-$lang['System']='sistema';
91
-$lang['Freeswitch SIP Devices']='Dispositivos FreeSWITCH Sip';
92
-$lang['Freeswitch Server']='Freeswitch servidor';
93
-$lang['Configuration']='Configuración';
94
-$lang['Email Template']='Plantilla de correo electrónico';
95
-$lang['Freeswitch']='Freeswitch';
89
+$lang['Switch Config'] = 'Cambiar configuración';
90
+$lang['System'] = 'sistema';
91
+$lang['Freeswitch SIP Devices'] = 'Dispositivos FreeSWITCH Sip';
92
+$lang['Freeswitch Server'] = 'Freeswitch servidor';
93
+$lang['Configuration'] = 'Configuración';
94
+$lang['Email Template'] = 'Plantilla de correo electrónico';
95
+$lang['Freeswitch'] = 'Freeswitch';
96 96
 ?>
97 97
  
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php if (!defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 
3 5
 //DID list
4 6
 $lang['DID.MANAGE_DIDs']='Manage DIDs';
Please login to merge, or discard this patch.
web_interface/astpp/application/language/english/footer_lang.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
2
-$lang['FOOTER.FOOTER']='Copyright &copy; 2003 - 2012. ASTPP - Open Source VOIP Billing Solution. All Rights Reserved.';
1
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
+$lang['FOOTER.FOOTER'] = 'Copyright &copy; 2003 - 2012. ASTPP - Open Source VOIP Billing Solution. All Rights Reserved.';
3 3
 ?>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php if (!defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 
3 5
 //DID list
4 6
 $lang['DID.MANAGE_DIDs']='Manage DIDs';
Please login to merge, or discard this patch.
web_interface/astpp/application/language/english/menu_lang.php 2 patches
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -1,101 +1,101 @@
 block discarded – undo
1
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2 2
 //Main Menu
3
-$lang['Home']='Home';
4
-$lang['Global Accounts']='Global Accounts';
5
-$lang['Accounting']='Accounting';
6
-$lang['Services']='Services';
7
-$lang['DIDs']='DIDs';
8
-$lang['Routing']='Routing';
9
-$lang['Reports']='Reports';
10
-$lang['System Configuration']='System Configuration';
11
-$lang['Accounts']='Accounts';
12
-$lang['FS Devices']='FS Devices';
3
+$lang['Home'] = 'Home';
4
+$lang['Global Accounts'] = 'Global Accounts';
5
+$lang['Accounting'] = 'Accounting';
6
+$lang['Services'] = 'Services';
7
+$lang['DIDs'] = 'DIDs';
8
+$lang['Routing'] = 'Routing';
9
+$lang['Reports'] = 'Reports';
10
+$lang['System Configuration'] = 'System Configuration';
11
+$lang['Accounts'] = 'Accounts';
12
+$lang['FS Devices'] = 'FS Devices';
13 13
 //gloabalAccounts useraccount Menu
14 14
 
15
-$lang['User Accounts']='User Accounts';
16
-$lang['Customer List']='Customer List';
17
-$lang['Reseller List']='Reseller List';
18
-$lang['Callshop List']='Callshop List';
15
+$lang['User Accounts'] = 'User Accounts';
16
+$lang['Customer List'] = 'Customer List';
17
+$lang['Reseller List'] = 'Reseller List';
18
+$lang['Callshop List'] = 'Callshop List';
19 19
 
20 20
 //gloabalAccounts  ProviderAccounts Menu
21
-$lang['Provider Accounts']='Provider Accounts';
22
-$lang['Provider List']='Provider List';
21
+$lang['Provider Accounts'] = 'Provider Accounts';
22
+$lang['Provider List'] = 'Provider List';
23 23
 //gloabalAccounts  System Accounts Menu
24
-$lang['System Accounts']='System Accounts';
25
-$lang['Admin List']='Admin List';
26
-$lang['Subadmin List']='Subadmin List';
24
+$lang['System Accounts'] = 'System Accounts';
25
+$lang['Admin List'] = 'Admin List';
26
+$lang['Subadmin List'] = 'Subadmin List';
27 27
 
28 28
 //Accounting Manage Invoices Menu
29
-$lang['Manage Account']='Manage Account';
30
-$lang['Manage Invoice']='Manage Invoice';
29
+$lang['Manage Account'] = 'Manage Account';
30
+$lang['Manage Invoice'] = 'Manage Invoice';
31 31
 $lang['Invoices'] = 'Invoices';
32
-$lang['Invoice List']='Invoice List';
33
-$lang['Invoice Configuration']='Invoice Configuration';
32
+$lang['Invoice List'] = 'Invoice List';
33
+$lang['Invoice Configuration'] = 'Invoice Configuration';
34 34
 
35 35
 //Accounting Subscription Menu
36
-$lang['Subscriptions']='Subscriptions';
37
-$lang['Periodic Charges']='Periodic Charges';
36
+$lang['Subscriptions'] = 'Subscriptions';
37
+$lang['Periodic Charges'] = 'Periodic Charges';
38 38
 
39 39
 //Accounting Manage Taxes Menu
40
-$lang['Manage Taxes']='Manage Taxes';
41
-$lang['Taxes']='Taxes';
40
+$lang['Manage Taxes'] = 'Manage Taxes';
41
+$lang['Taxes'] = 'Taxes';
42 42
 
43 43
 //Services Calling Cards Menu
44 44
 
45
-$lang['Calling Cards']='Calling Cards';
46
-$lang['List Cards']='List Cards';
47
-$lang['CC Brands']='CC Brands';
48
-$lang['Calling Card CDRs']='Calling Card CDRs';
45
+$lang['Calling Cards'] = 'Calling Cards';
46
+$lang['List Cards'] = 'List Cards';
47
+$lang['CC Brands'] = 'CC Brands';
48
+$lang['Calling Card CDRs'] = 'Calling Card CDRs';
49 49
 
50 50
 //DID Menu
51
-$lang['Manage DID']='Manage DID';
52
-$lang['Manage DIDs']='Manage DIDs';
51
+$lang['Manage DID'] = 'Manage DID';
52
+$lang['Manage DIDs'] = 'Manage DIDs';
53 53
 
54 54
 //Routing Providers Menu
55 55
 $lang['Freeswitch Devices'] = 'Freeswitch Devices';
56
-$lang['Providers']='Providers';
57
-$lang['Trunks']='Trunks';
58
-$lang['Termination Rates']='Termination Rates';
59
-$lang['Gateways']='Gateways';
60
-$lang['Sip Profile']='Sip Profile';
61
-$lang['SIP Devices']='SIP Devices';
56
+$lang['Providers'] = 'Providers';
57
+$lang['Trunks'] = 'Trunks';
58
+$lang['Termination Rates'] = 'Termination Rates';
59
+$lang['Gateways'] = 'Gateways';
60
+$lang['Sip Profile'] = 'Sip Profile';
61
+$lang['SIP Devices'] = 'SIP Devices';
62 62
 
63 63
 //Routing Clients Menu
64
-$lang['Rates']='Rates';
65
-$lang['Clients']='Clients';
66
-$lang['Rate Group']='Rate Group';
67
-$lang['Origination Rates']='Origination Rates';
68
-$lang['Packages']='Packages';
69
-$lang['Package Usage Report']='Package Usage Report';
64
+$lang['Rates'] = 'Rates';
65
+$lang['Clients'] = 'Clients';
66
+$lang['Rate Group'] = 'Rate Group';
67
+$lang['Origination Rates'] = 'Origination Rates';
68
+$lang['Packages'] = 'Packages';
69
+$lang['Package Usage Report'] = 'Package Usage Report';
70 70
 
71 71
 //Reports->CallDetail Reports
72
-$lang['CDRs Reports']='CDRs Reports';
73
-$lang['Call Detail Reports']='Call Detail Reports';
74
-$lang['Customer Reports']='Customer Reports';
75
-$lang['Reseller Report']='Reseller Report';
76
-$lang['Provider Report']='Provider Report';
72
+$lang['CDRs Reports'] = 'CDRs Reports';
73
+$lang['Call Detail Reports'] = 'Call Detail Reports';
74
+$lang['Customer Reports'] = 'Customer Reports';
75
+$lang['Reseller Report'] = 'Reseller Report';
76
+$lang['Provider Report'] = 'Provider Report';
77 77
 
78 78
 //Reports->Switch Reports Menu
79
-$lang['Switch Reports']='Switch Reports';
80
-$lang['Live Call Report']='Live Call Report';
81
-$lang['Trunk Stats']='Trunk Stats';
79
+$lang['Switch Reports'] = 'Switch Reports';
80
+$lang['Live Call Report'] = 'Live Call Report';
81
+$lang['Trunk Stats'] = 'Trunk Stats';
82 82
 
83 83
 //Reports->Summary Reports Menu
84
-$lang['Summary Reports']='Summary Report';
85
-$lang['Provider Reports']='Provider Report';
86
-$lang['User Report']="User Report";
84
+$lang['Summary Reports'] = 'Summary Report';
85
+$lang['Provider Reports'] = 'Provider Report';
86
+$lang['User Report'] = "User Report";
87 87
 
88 88
 //Reports->Payment Reports Menu
89
-$lang['Payment Reports']='Payment Reports';
90
-$lang['Payment Report']='Payment Report';
91
-
92
-
93
-$lang['Switch Config']='Switch Config';
94
-$lang['Softswitch']='Softswitch';
95
-$lang['System']='System';
96
-$lang['Freeswitch SIP Devices']='Freeswitch SIP Devices';
97
-$lang['Freeswitch Server']='Freeswitch Server';
98
-$lang['Configuration']='Configuration';
99
-$lang['Email Template']='Email Template';
100
-$lang['Freeswitch']='Freeswitch';
89
+$lang['Payment Reports'] = 'Payment Reports';
90
+$lang['Payment Report'] = 'Payment Report';
91
+
92
+
93
+$lang['Switch Config'] = 'Switch Config';
94
+$lang['Softswitch'] = 'Softswitch';
95
+$lang['System'] = 'System';
96
+$lang['Freeswitch SIP Devices'] = 'Freeswitch SIP Devices';
97
+$lang['Freeswitch Server'] = 'Freeswitch Server';
98
+$lang['Configuration'] = 'Configuration';
99
+$lang['Email Template'] = 'Email Template';
100
+$lang['Freeswitch'] = 'Freeswitch';
101 101
 ?>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php if (!defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 
3 5
 //DID list
4 6
 $lang['DID.MANAGE_DIDs']='Manage DIDs';
Please login to merge, or discard this patch.