@@ -189,6 +189,10 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | //Insert parent resellers cdr |
192 | +/** |
|
193 | + * @param string $provider_cost |
|
194 | + * @param boolean $flag_parent |
|
195 | + */ |
|
192 | 196 | function insert_parent_data($dataVariable,$actual_calltype,$parentid,$origination_rate,$actual_duration,$provider_cost,$flag_parent,$logger,$db,$decimal_points) |
193 | 197 | { |
194 | 198 | while($parentid > 0 ) |
@@ -250,6 +254,9 @@ discard block |
||
250 | 254 | } |
251 | 255 | |
252 | 256 | //Insert callee cdr entry for DID calls |
257 | +/** |
|
258 | + * @param boolean $flag_parent |
|
259 | + */ |
|
253 | 260 | function insert_extra_receiver_entry($dataVariable,$origination_rate,$termination_rate,$account_type,$actual_duration,$provider_cost,$parentid,$flag_parent,$accountid,$logger,$db,$decimal_points) |
254 | 261 | { |
255 | 262 | $localVariable = $dataVariable; |
@@ -318,6 +325,9 @@ discard block |
||
318 | 325 | } |
319 | 326 | |
320 | 327 | //Update user balance |
328 | +/** |
|
329 | + * @param integer $entity_id |
|
330 | + */ |
|
321 | 331 | function update_balance($user_id, $amount, $entity_id, $logger, $db) { |
322 | 332 | $math_sign = ($entity_id == 0 || $entity_id == 1) ? '-' : '+'; |
323 | 333 | $query = "UPDATE accounts SET balance=balance-" . $amount . " WHERE id=" . $user_id; |
@@ -457,6 +467,9 @@ discard block |
||
457 | 467 | } |
458 | 468 | |
459 | 469 | // String append prefix for checking rates |
470 | +/** |
|
471 | + * @param string $field |
|
472 | + */ |
|
460 | 473 | function number_loop($destination,$field,$db) |
461 | 474 | { |
462 | 475 | $max_len_prefix = strlen($destination); |
@@ -471,6 +484,9 @@ discard block |
||
471 | 484 | } |
472 | 485 | |
473 | 486 | //Convert current time to GMT |
487 | +/** |
|
488 | + * @param string $date |
|
489 | + */ |
|
474 | 490 | function convert_to_gmt($date) |
475 | 491 | { |
476 | 492 | return gmdate('Y-m-d H:i:s', strtotime($date) ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($dataVariable['billsec'] == 0 && $dataVariable['hangup_cause'] == 'NORMAL_CLEARING') |
48 | 48 | { |
49 | 49 | $hangup_cause = isset($dataVariable['last_bridge_hangup_cause'])?$dataVariable['last_bridge_hangup_cause']:$dataVariable['hangup_cause']; |
50 | - }else{ |
|
50 | + } else{ |
|
51 | 51 | $hangup_cause = $dataVariable['hangup_cause']; |
52 | 52 | } |
53 | 53 | |
@@ -86,10 +86,12 @@ discard block |
||
86 | 86 | $actual_calltype = $dataVariable['calltype']; |
87 | 87 | |
88 | 88 | //Normalize origination and termination rates array |
89 | - if(isset($dataVariable['origination_rates'])) |
|
90 | - $origination_rate = normalize_origination_rate($dataVariable['origination_rates']); |
|
91 | - if(isset($dataVariable['termination_rates'])) |
|
92 | - $termination_rate = normalize_rate($dataVariable['termination_rates']); |
|
89 | + if(isset($dataVariable['origination_rates'])) { |
|
90 | + $origination_rate = normalize_origination_rate($dataVariable['origination_rates']); |
|
91 | + } |
|
92 | + if(isset($dataVariable['termination_rates'])) { |
|
93 | + $termination_rate = normalize_rate($dataVariable['termination_rates']); |
|
94 | + } |
|
93 | 95 | |
94 | 96 | //If receiver account id found then explicitly set call direction and call type |
95 | 97 | if(isset($dataVariable['receiver_accid'])) |
@@ -230,7 +232,7 @@ discard block |
||
230 | 232 | $logger->log("********* IN RESELLER FOR RECEIVER ENTRY END ******"); |
231 | 233 | return true; |
232 | 234 | |
233 | - }else{ |
|
235 | + } else{ |
|
234 | 236 | |
235 | 237 | $cdr_string = get_reseller_cdr_string($dataVariable,$accountid,$account_type,$actual_duration,$termination_rate,$origination_rate,$provider_cost,$parentid,$debit,$cost); |
236 | 238 | |
@@ -262,11 +264,10 @@ discard block |
||
262 | 264 | $origination_rate[$accountid]['DESTINATION'] = $dataVariable['calltype']; |
263 | 265 | if($flag_parent == false){ |
264 | 266 | $cdr_string = get_cdr_string($localVariable,$accountid,$account_type,$actual_duration,$termination_rate,$origination_rate,$provider_cost,$parentid,0,0,$logger); |
265 | - } |
|
266 | - else{ |
|
267 | + } else{ |
|
267 | 268 | $cdr_string = get_reseller_cdr_string($dataVariable,$accountid,$account_type,$actual_duration,$termination_rate,$origination_rate,$provider_cost,$parentid,$debit,$cost); |
268 | 269 | } |
269 | - }else{ |
|
270 | + } else{ |
|
270 | 271 | |
271 | 272 | $origination_rate_did = normalize_origination_rate($dataVariable['origination_rates_did']); |
272 | 273 | $debit = calc_cost($dataVariable,$origination_rate_did[$accountid],$logger,$decimal_points); |
@@ -274,8 +275,7 @@ discard block |
||
274 | 275 | if($flag_parent == false){ |
275 | 276 | |
276 | 277 | $cdr_string = get_cdr_string($localVariable,$accountid,$account_type,$actual_duration,$termination_rate,$origination_rate_did,$provider_cost,$parentid,$debit,0,$logger); |
277 | - } |
|
278 | - else{ |
|
278 | + } else{ |
|
279 | 279 | $cdr_string = get_reseller_cdr_string($dataVariable,$accountid,$account_type,$actual_duration,$termination_rate,$origination_rate,$provider_cost,$parentid,$debit,$cost); |
280 | 280 | } |
281 | 281 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | if($flag_parent == false) |
284 | 284 | { |
285 | 285 | $query = "INSERT INTO cdrs(uniqueid,accountid,type,callerid,callednum,billseconds,trunk_id,trunkip,callerip,disposition,callstart,debit,cost,provider_id,pricelist_id,package_id,pattern,notes,rate_cost,reseller_id,reseller_code,reseller_code_destination,reseller_cost,provider_code,provider_code_destination,provider_cost,provider_call_cost,call_direction,calltype,profile_start_stamp,answer_stamp,bridge_stamp,progress_stamp,progress_media_stamp,end_stamp,billmsec,answermsec,waitmsec,progress_mediamsec,flow_billmsec) values ($cdr_string)"; |
286 | - }else{ |
|
286 | + } else{ |
|
287 | 287 | $query = "INSERT INTO reseller_cdrs (uniqueid,accountid,callerid,callednum,billseconds,disposition,callstart,debit,cost,pricelist_id,package_id,pattern,notes,rate_cost, |
288 | 288 | reseller_id,reseller_code,reseller_code_destination,reseller_cost,call_direction,calltype) values ($cdr_string)"; |
289 | 289 | } |
@@ -433,11 +433,12 @@ discard block |
||
433 | 433 | $query_counter = "SELECT id,seconds FROM counters WHERE accountid = ".$accountid." AND package_id = ".$package_id." AND status=1 LIMIT 1"; |
434 | 434 | $counter = $db->run($query_counter); |
435 | 435 | $logger->log("GET Counters : " . $query_counter); |
436 | - if($counter) |
|
437 | - return $counter[0]; |
|
438 | - else |
|
439 | - return ""; |
|
440 | -} |
|
436 | + if($counter) { |
|
437 | + return $counter[0]; |
|
438 | + } else { |
|
439 | + return ""; |
|
440 | + } |
|
441 | + } |
|
441 | 442 | |
442 | 443 | //Get user info |
443 | 444 | function get_accounts($parent_id,$logger, $db) { |
@@ -47,6 +47,9 @@ |
||
47 | 47 | echo $this->error; |
48 | 48 | } |
49 | 49 | |
50 | + /** |
|
51 | + * @param string $bind |
|
52 | + */ |
|
50 | 53 | public function cleanup($bind) { |
51 | 54 | if (!is_array($bind)) { |
52 | 55 | if (!empty($bind)) |
@@ -49,10 +49,11 @@ discard block |
||
49 | 49 | |
50 | 50 | public function cleanup($bind) { |
51 | 51 | if (!is_array($bind)) { |
52 | - if (!empty($bind)) |
|
53 | - $bind = array($bind); |
|
54 | - else |
|
55 | - $bind = array(); |
|
52 | + if (!empty($bind)) { |
|
53 | + $bind = array($bind); |
|
54 | + } else { |
|
55 | + $bind = array(); |
|
56 | + } |
|
56 | 57 | } |
57 | 58 | return $bind; |
58 | 59 | } |
@@ -65,10 +66,11 @@ discard block |
||
65 | 66 | try { |
66 | 67 | $pdostmt = $this->prepare($this->sql); |
67 | 68 | if ($pdostmt->execute($this->bind) !== false) { |
68 | - if (preg_match("/^(" . implode("|", array("select", "describe", "pragma")) . ") /i", $this->sql)) |
|
69 | - return $pdostmt->fetchAll(PDO::FETCH_ASSOC); |
|
70 | - elseif (preg_match("/^(" . implode("|", array("delete", "insert", "update")) . ") /i", $this->sql)) |
|
71 | - return $pdostmt->rowCount(); |
|
69 | + if (preg_match("/^(" . implode("|", array("select", "describe", "pragma")) . ") /i", $this->sql)) { |
|
70 | + return $pdostmt->fetchAll(PDO::FETCH_ASSOC); |
|
71 | + } elseif (preg_match("/^(" . implode("|", array("delete", "insert", "update")) . ") /i", $this->sql)) { |
|
72 | + return $pdostmt->rowCount(); |
|
73 | + } |
|
72 | 74 | } |
73 | 75 | } catch (PDOException $e) { |
74 | 76 | $this->error = $e->getMessage(); |
@@ -118,6 +118,9 @@ |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | //Update user balance |
121 | +/** |
|
122 | + * @param integer $entity_id |
|
123 | + */ |
|
121 | 124 | function update_balance($user_id, $amount, $entity_id, $logger, $db) { |
122 | 125 | if ($amount > 0) { |
123 | 126 | $math_sign = ($entity_id == 0 || $entity_id == 1) ? '-' : '+'; |
@@ -64,6 +64,10 @@ |
||
64 | 64 | redirect(base_url()."/systems/currency_list/"); |
65 | 65 | exit; |
66 | 66 | } |
67 | + |
|
68 | + /** |
|
69 | + * @param string $url |
|
70 | + */ |
|
67 | 71 | function curl_response($url) |
68 | 72 | { |
69 | 73 | $ch = curl_init(); // Initialising cURL |
@@ -89,6 +89,10 @@ discard block |
||
89 | 89 | return $last_invoice_date; |
90 | 90 | } |
91 | 91 | |
92 | + /** |
|
93 | + * @param string $start_date |
|
94 | + * @param string $end_date |
|
95 | + */ |
|
92 | 96 | function Generate_Daily_invoice($account_value, $start_date, $end_date) { |
93 | 97 | // echo "INVOICE SCRIPT-------start date :".$start_date."-------end date....".$end_date; |
94 | 98 | |
@@ -99,6 +103,10 @@ discard block |
||
99 | 103 | $this->process_invoice($account_value, $start_date, $end_date); |
100 | 104 | } |
101 | 105 | |
106 | + /** |
|
107 | + * @param string $start_date |
|
108 | + * @param string $end_date |
|
109 | + */ |
|
102 | 110 | function Generate_Monthly_invoice($account_value, $start_date, $end_date) { |
103 | 111 | require_once('updateBalance.php'); |
104 | 112 | $updateBalance = new updateBalance(); |
@@ -181,6 +189,9 @@ discard block |
||
181 | 189 | return true; |
182 | 190 | } |
183 | 191 | |
192 | + /** |
|
193 | + * @param string $last_invoice_ID |
|
194 | + */ |
|
184 | 195 | function create_invoice($account, $from_date, $to_date, $last_invoice_ID, $INVprefix, $invoiceconf) { |
185 | 196 | //$due_date = gmdate("Y-m-d H:i:s",strtotime($to_date." +".$invoiceconf['interval']." days")); |
186 | 197 | if ($invoiceconf['interval'] > 0) { |
@@ -234,6 +245,10 @@ discard block |
||
234 | 245 | } |
235 | 246 | } |
236 | 247 | |
248 | + /** |
|
249 | + * @param string $FilePath |
|
250 | + * @param string $Filenm |
|
251 | + */ |
|
237 | 252 | function send_email_notification($FilePath, $Filenm, $AccountData, $invoice_conf, $invData) { |
238 | 253 | $TemplateData = array(); |
239 | 254 | $where = array('name' => 'email_new_invoice'); |
@@ -208,7 +208,7 @@ |
||
208 | 208 | <?php |
209 | 209 | if($account_data['logo'] != ''){ |
210 | 210 | $logo=$account_data['file']; |
211 | - }else{ |
|
211 | + } else{ |
|
212 | 212 | $logo=$account_data['logo']; |
213 | 213 | } |
214 | 214 | if($logo != ''){ |
@@ -153,6 +153,10 @@ discard block |
||
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | + /** |
|
157 | + * @param string $fromdate |
|
158 | + * @param string $todate |
|
159 | + */ |
|
156 | 160 | function calculate_charges($AccountDATA, $itemArr, $charge, $fromdate, $todate, $pro_rate = "1") { |
157 | 161 | $lastdate = false; |
158 | 162 | $billing_cycle = ($AccountDATA['sweep_id'] == "0") ? "1 day" : "1 month"; |
@@ -217,6 +221,9 @@ discard block |
||
217 | 221 | return $lastdate; |
218 | 222 | } |
219 | 223 | |
224 | + /** |
|
225 | + * @param string $todate |
|
226 | + */ |
|
220 | 227 | function Manage_invoice_item($AccountData, $description, $item_id, $charge, $type, $fromdate, $todate, $invoicedate) { |
221 | 228 | $invoiceid = 0; |
222 | 229 | $Bal = "0.00"; |
@@ -263,6 +270,10 @@ discard block |
||
263 | 270 | $this->manage_invoice($invoice_item_arr); |
264 | 271 | } |
265 | 272 | |
273 | + /** |
|
274 | + * @param string $select |
|
275 | + * @param string $table |
|
276 | + */ |
|
266 | 277 | function get_table_data($select, $table, $where) { |
267 | 278 | $query = $this->db_model->getSelect($select, $table, $where); |
268 | 279 | if ($query->num_rows > 0) { |
@@ -92,8 +92,9 @@ discard block |
||
92 | 92 | "charge_upto"=>$accharges['charge_upto']); |
93 | 93 | //Add a new arguement ($accharges) which have all information of charges. |
94 | 94 | $lastdate = $this->calculate_charges($accountinfo, $itemArr, $charge_data["charge"], $fromdate, $todate, $charge_data["pro_rate"]); |
95 | - if ($lastdate) |
|
96 | - $this->db->update("charge_to_account", array("charge_upto" => $lastdate), array("charge_id" => $charge_data["id"], "accountid" => $accountinfo["id"])); |
|
95 | + if ($lastdate) { |
|
96 | + $this->db->update("charge_to_account", array("charge_upto" => $lastdate), array("charge_id" => $charge_data["id"], "accountid" => $accountinfo["id"])); |
|
97 | + } |
|
97 | 98 | } |
98 | 99 | } |
99 | 100 | } |
@@ -132,22 +133,25 @@ discard block |
||
132 | 133 | if (($parent_id == $reseller_dids['reseller_id'] && $did_value['accountid'] > 0) || $reseller_dids['parent_id'] == 0) { |
133 | 134 | //Apply charges to resellers customers. |
134 | 135 | $lastdate = $this->calculate_charges($reseller_acc_data, $itemArr, $reseller_dids["monthlycost"], $fromdate, $todate, "1"); |
135 | - if ($lastdate) |
|
136 | - $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"])); |
|
137 | - }else { |
|
136 | + if ($lastdate) { |
|
137 | + $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"])); |
|
138 | + } |
|
139 | + } else { |
|
138 | 140 | //Apply charges to Resellers. |
139 | 141 | $lastdate = $this->calculate_charges($reseller_acc_data, $itemArr, $reseller_dids["monthlycost"], $fromdate, $todate, "1"); |
140 | - if ($lastdate) |
|
141 | - $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"])); |
|
142 | + if ($lastdate) { |
|
143 | + $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"])); |
|
144 | + } |
|
142 | 145 | } |
143 | 146 | $parent_id = $reseller_dids['parent_id']; |
144 | 147 | } |
145 | 148 | } |
146 | 149 | // else{ |
147 | 150 | $lastdate = $this->calculate_charges($AccountDATA, $itemArr, $did_value["monthlycost"], $fromdate, $todate, "1"); |
148 | - if ($lastdate) |
|
149 | - $this->db->update("dids", array("charge_upto" => $lastdate), array("id" => $did_value["id"], "accountid" => $AccountDATA["id"])); |
|
150 | -// } |
|
151 | + if ($lastdate) { |
|
152 | + $this->db->update("dids", array("charge_upto" => $lastdate), array("id" => $did_value["id"], "accountid" => $AccountDATA["id"])); |
|
153 | + } |
|
154 | + // } |
|
151 | 155 | } |
152 | 156 | } |
153 | 157 | } |
@@ -209,9 +213,10 @@ discard block |
||
209 | 213 | $temp_charge = ($chrg_per_day * $days_diff); |
210 | 214 | } |
211 | 215 | |
212 | - if (strtotime($ChargeVal['start_date']) < strtotime($ChargeVal['end_date'])) |
|
213 | - $this->Manage_invoice_item($AccountDATA, $itemArr['description'], $itemArr['item_id'], $temp_charge, $itemArr['type'], $start_date, $lastdate, $todate); |
|
214 | -// echo "<br/> ORG CHARG : " . $charge . " Charges : " . $temp_charge . "<br/>"; |
|
216 | + if (strtotime($ChargeVal['start_date']) < strtotime($ChargeVal['end_date'])) { |
|
217 | + $this->Manage_invoice_item($AccountDATA, $itemArr['description'], $itemArr['item_id'], $temp_charge, $itemArr['type'], $start_date, $lastdate, $todate); |
|
218 | + } |
|
219 | + // echo "<br/> ORG CHARG : " . $charge . " Charges : " . $temp_charge . "<br/>"; |
|
215 | 220 | } |
216 | 221 | } |
217 | 222 | return $lastdate; |
@@ -44,8 +44,6 @@ discard block |
||
44 | 44 | // __construct |
45 | 45 | /** |
46 | 46 | * adds raw html to the field array |
47 | - * @param type $label |
|
48 | - * @param type $field add |
|
49 | 47 | */ |
50 | 48 | function generate_password() { |
51 | 49 | $pass = substr(md5(rand(0, 1000000000)), 0, common_model::$global_config['system_config']['pinlength']); |
@@ -93,6 +91,9 @@ discard block |
||
93 | 91 | return $uname; |
94 | 92 | } |
95 | 93 | |
94 | + /** |
|
95 | + * @param string $length |
|
96 | + */ |
|
96 | 97 | function random_string($length) { |
97 | 98 | $chars = "1234567890"; //length:36 |
98 | 99 | $final_rand = ''; |
@@ -132,6 +133,10 @@ discard block |
||
132 | 133 | return $number; |
133 | 134 | } |
134 | 135 | |
136 | + /** |
|
137 | + * @param string $select |
|
138 | + * @param string $table |
|
139 | + */ |
|
135 | 140 | function get_field_count($select, $table, $where) { |
136 | 141 | // echo $select."=====".$table."===".$where; |
137 | 142 | if (is_array($where)) { |
@@ -147,6 +152,10 @@ discard block |
||
147 | 152 | } |
148 | 153 | } |
149 | 154 | |
155 | + /** |
|
156 | + * @param string $select |
|
157 | + * @param string $table |
|
158 | + */ |
|
150 | 159 | function get_field_name($select, $table, $where) { |
151 | 160 | if (is_array($where)) { |
152 | 161 | $where = $where; |
@@ -162,6 +171,10 @@ discard block |
||
162 | 171 | } |
163 | 172 | } |
164 | 173 | |
174 | + /** |
|
175 | + * @param string $select |
|
176 | + * @param string $table |
|
177 | + */ |
|
165 | 178 | function get_field_name_coma_new($select, $table, $where) { |
166 | 179 | $value = ''; |
167 | 180 | if (is_array($where)) { |
@@ -504,6 +517,9 @@ discard block |
||
504 | 517 | } |
505 | 518 | |
506 | 519 | |
520 | + /** |
|
521 | + * @param string $select |
|
522 | + */ |
|
507 | 523 | function get_invoice_date($select, $accountid = 0, $reseller_id, $order_by = 'id') { |
508 | 524 | $where = array("reseller_id" => $reseller_id); |
509 | 525 | if ($accountid > 0) { |
@@ -1175,6 +1191,9 @@ discard block |
||
1175 | 1191 | |
1176 | 1192 | } |
1177 | 1193 | |
1194 | + /** |
|
1195 | + * @param string $message |
|
1196 | + */ |
|
1178 | 1197 | function emailFunction($from, $to, $subject, $message, $company_name = "", $attachment = "", $account_id, $reseller_id) { |
1179 | 1198 | $send_mail_details = array('from' => $from, |
1180 | 1199 | 'to' => $to, |
@@ -1373,12 +1392,18 @@ discard block |
||
1373 | 1392 | Password encode decode |
1374 | 1393 | * ******* */ |
1375 | 1394 | |
1395 | + /** |
|
1396 | + * @param string $string |
|
1397 | + */ |
|
1376 | 1398 | function encode_params($string) { |
1377 | 1399 | $data = base64_encode($string); |
1378 | 1400 | $data = str_replace(array('+', '/', '='), array('-', '$', ''), $data); |
1379 | 1401 | return $data; |
1380 | 1402 | } |
1381 | 1403 | |
1404 | + /** |
|
1405 | + * @param string $value |
|
1406 | + */ |
|
1382 | 1407 | function encode($value) { |
1383 | 1408 | $text = $value; |
1384 | 1409 | $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
@@ -1830,14 +1855,26 @@ discard block |
||
1830 | 1855 | } |
1831 | 1856 | } |
1832 | 1857 | |
1858 | + /** |
|
1859 | + * @param string $table_name |
|
1860 | + */ |
|
1833 | 1861 | function delete_data($table_name,$where_arr){ |
1834 | 1862 | $this->CI->db->where($where_arr); |
1835 | 1863 | $this->CI->db->delete($table_name); |
1836 | 1864 | } |
1865 | + |
|
1866 | + /** |
|
1867 | + * @param string $table_name |
|
1868 | + */ |
|
1837 | 1869 | function update_data($table_name,$where_arr,$update_arr){ |
1838 | 1870 | $this->CI->db->where($where_arr); |
1839 | 1871 | $this->CI->db->update($table_name,$update_arr); |
1840 | 1872 | } |
1873 | + |
|
1874 | + /** |
|
1875 | + * @param string $table_name |
|
1876 | + * @param string $select |
|
1877 | + */ |
|
1841 | 1878 | function select_data($table_name,$where_arr,$select){ |
1842 | 1879 | $this->CI->db->where($where_arr); |
1843 | 1880 | $this->CI->db->select($select); |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ############################################################################### |
24 | 24 | |
25 | -if (!defined('BASEPATH')) |
|
25 | +if (!defined('BASEPATH')) { |
|
26 | 26 | exit('No direct script access allowed'); |
27 | +} |
|
27 | 28 | |
28 | 29 | /** |
29 | 30 | * Dynamically build forms for display |
@@ -112,8 +113,9 @@ discard block |
||
112 | 113 | $flag = false; |
113 | 114 | $uname = $this->random_string($length); |
114 | 115 | $uname = strtolower($uname); |
115 | - if (isset($default)) |
|
116 | - $uname = $default . $uname; |
|
116 | + if (isset($default)) { |
|
117 | + $uname = $default . $uname; |
|
118 | + } |
|
117 | 119 | if (!in_array($uname, $number)) { |
118 | 120 | $where = array($field => $uname); |
119 | 121 | $acc_result = $this->CI->db_model->getSelect('Count(id) as count', $tablename, $where); |
@@ -230,15 +232,14 @@ discard block |
||
230 | 232 | $accountinfo=$this->CI->session->userdata('accountinfo'); |
231 | 233 | if($did_info['accountid'] ==0 && $did_info['parent_id']==0){ |
232 | 234 | $status='Not in use'; |
233 | - } |
|
234 | - elseif($accountinfo['type'] !=1){ |
|
235 | + } elseif($accountinfo['type'] !=1){ |
|
235 | 236 | if($did_info['accountid'] ==0 && $did_info['parent_id'] > 0){ |
236 | 237 | $status='Purchase by Reseller'; |
237 | 238 | } |
238 | 239 | if($did_info['accountid'] > 0 && $did_info['parent_id'] == 0){ |
239 | 240 | $status='Purchase by Customer'; |
240 | 241 | } |
241 | - }else{ |
|
242 | + } else{ |
|
242 | 243 | $where_arr=array('note'=>$did_info['number'],"parent_id"=>$accountinfo['id']); |
243 | 244 | $this->db->where($where); |
244 | 245 | $this->CI->db->select('reseller_id,parent_id'); |
@@ -261,10 +262,9 @@ discard block |
||
261 | 262 | $did_info=(array)$this->CI->db->get('dids')->first_row(); |
262 | 263 | if($did_info['accountid'] > 0 && $did_info['parent_id'] == $accountinfo['id']){ |
263 | 264 | $flag_status = "<a href='../did_list_release/" . $did_info['id'] . "' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(C)<span></a>"; |
264 | - } |
|
265 | - else if($accountinfo['type']!=1 && $did_info['parent_id'] != $accountinfo['id']){ |
|
265 | + } else if($accountinfo['type']!=1 && $did_info['parent_id'] != $accountinfo['id']){ |
|
266 | 266 | $flag_status = "<a href='../did_list_release/" . $did_info['id'] . "' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(R)</span></a>"; |
267 | - }else{ |
|
267 | + } else{ |
|
268 | 268 | $reseller_id= $accountinfo['type'] != 1 ? 0 : $accountinfo['id']; |
269 | 269 | $where = array("note" => $did_info['number'],'parent_id'=>$reseller_id); |
270 | 270 | $this->CI->db->where($where); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $reseller_pricing_info=(array)$this->CI->db->get('reseller_pricing')->first_row(); |
273 | 273 | if (isset($reseller_pricing_info) && !empty($reseller_pricing_info)) { |
274 | 274 | $flag_status="<a href='../did/did_reseller_edit/delete/".$reseller_pricing_info['id']."' title='Reliase' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(R)</span></a>"; |
275 | - }else{ |
|
275 | + } else{ |
|
276 | 276 | $flag_status="<span class=' label label-sm label-inverse arrowed-in' title='Not in use'>Not in use</span>"; |
277 | 277 | } |
278 | 278 | } |
@@ -474,13 +474,13 @@ discard block |
||
474 | 474 | <label class="onoffswitch-label" for=switch'.$status["id"].'> |
475 | 475 | <span class="onoffswitch-inner"></span> |
476 | 476 | </label></div>'; |
477 | - }else{ |
|
477 | + } else{ |
|
478 | 478 | $status_array = '<div style="width: 100%; text-align: -moz-center; padding: 0;"><input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id=switch'.$status['id'].' value='.$status['status'].' onclick="javascript:processForm('.$status['id'].','.$status['table'].')"> |
479 | 479 | <label class="onoffswitch-label" for=switch'.$status["id"].'> |
480 | 480 | <span class="onoffswitch-inner"></span> |
481 | 481 | </label></div>'; |
482 | 482 | } |
483 | - }else{ |
|
483 | + } else{ |
|
484 | 484 | return ($status == 0) ? "Active" : "Inactive"; |
485 | 485 | } |
486 | 486 | return $status_array; |
@@ -854,9 +854,9 @@ discard block |
||
854 | 854 | $rel = (isset($button_params->layout) && $button_params->layout != '')?"facebox_".$button_params->layout:"facebox"; |
855 | 855 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="'.$rel.'" title="Edit" ="small"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
856 | 856 | |
857 | - }else if(strpos($link,'customer_edit') !== false){ |
|
857 | + } else if(strpos($link,'customer_edit') !== false){ |
|
858 | 858 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
859 | - }else { |
|
859 | + } else { |
|
860 | 860 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
861 | 861 | } |
862 | 862 | } |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | } else { |
873 | 873 | return '<a href="' . $link . '" style="cursor:pointer;color:#005298;" title="Edit">' . $field . '</a> '; |
874 | 874 | } |
875 | - }else{ |
|
875 | + } else{ |
|
876 | 876 | if ($button_params->mode == 'popup') { |
877 | 877 | return '<a href="' . $link . '" style="cursor:pointer;color:#005298;" rel="facebox" title="Update">' . $field . '</a> '; |
878 | 878 | } else { |
@@ -897,14 +897,18 @@ discard block |
||
897 | 897 | $data= explode("/",$url); |
898 | 898 | $link = base_url() . $url . "" . $linkid; |
899 | 899 | foreach($data as $key=>$value){ |
900 | - if($value == 'price_delete') |
|
901 | - $flag = '1'; |
|
902 | - if($value == 'trunk_remove') |
|
903 | - $flag='2'; |
|
904 | - if($value == 'customer_delete' ||$value =='provider_delete') |
|
905 | - $flag='3'; |
|
906 | - if($value == 'reseller_delete') |
|
907 | - $flag='4'; |
|
900 | + if($value == 'price_delete') { |
|
901 | + $flag = '1'; |
|
902 | + } |
|
903 | + if($value == 'trunk_remove') { |
|
904 | + $flag='2'; |
|
905 | + } |
|
906 | + if($value == 'customer_delete' ||$value =='provider_delete') { |
|
907 | + $flag='3'; |
|
908 | + } |
|
909 | + if($value == 'reseller_delete') { |
|
910 | + $flag='4'; |
|
911 | + } |
|
908 | 912 | } |
909 | 913 | if($flag=='1'){ |
910 | 914 | $where=array('pricelist_id'=>$linkid,'deleted !=' =>'1'); |
@@ -914,8 +918,7 @@ discard block |
||
914 | 918 | if($rategroup_cnt > 0 || $customer_cnt > 0 ){ |
915 | 919 | |
916 | 920 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_message('.$rategroup_cnt.','.$customer_cnt.','.$linkid.',1);"><i class="fa fa-trash fa-fw"></i></a>'; |
917 | - } |
|
918 | - else{ |
|
921 | + } else{ |
|
919 | 922 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"><i class="fa fa-trash fa-fw"></i></a>'; |
920 | 923 | } |
921 | 924 | } |
@@ -924,8 +927,7 @@ discard block |
||
924 | 927 | $trunk_cnt=$this->get_field_count('id','outbound_routes',$where); |
925 | 928 | if($trunk_cnt > 0){ |
926 | 929 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_message('.$trunk_cnt.',null,'.$linkid.',2);"><i class="fa fa-trash fa-fw"></i></a>'; |
927 | - } |
|
928 | - else{ |
|
930 | + } else{ |
|
929 | 931 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"><i class="fa fa-trash fa-fw"></i></a>'; |
930 | 932 | } |
931 | 933 | } |
@@ -1054,7 +1056,7 @@ discard block |
||
1054 | 1056 | $message = str_replace("</p>", "", $message); |
1055 | 1057 | if(isset($accountinfo['refill_amount']) && $accountinfo['refill_amount']!= ""){ |
1056 | 1058 | $refillamount = $accountinfo['refill_amount']; |
1057 | - }else{ |
|
1059 | + } else{ |
|
1058 | 1060 | $refillamount = "0"; |
1059 | 1061 | } |
1060 | 1062 | |
@@ -1133,9 +1135,9 @@ discard block |
||
1133 | 1135 | case 'email_add_did'; |
1134 | 1136 | if(isset($accountinfo['did_maxchannels']) && $accountinfo['did_maxchannels']!= ""){ |
1135 | 1137 | $accountinfo['did_maxchannels'] = $accountinfo['did_maxchannels']; |
1136 | - }else if($accountinfo['did_maxchannels'] == "0"){ |
|
1138 | + } else if($accountinfo['did_maxchannels'] == "0"){ |
|
1137 | 1139 | $accountinfo['did_maxchannels'] = "Unlimited"; |
1138 | - }else{ |
|
1140 | + } else{ |
|
1139 | 1141 | $accountinfo['did_maxchannels'] = "Unlimited"; |
1140 | 1142 | } |
1141 | 1143 | $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message); |
@@ -1230,8 +1232,9 @@ discard block |
||
1230 | 1232 | $select = "concat($cnt_str) as $select_params[0] "; |
1231 | 1233 | $drp_array = $this->CI->db_model->getSelect($select, $table, $where); |
1232 | 1234 | $drp_array = $drp_array->result(); |
1233 | - if (isset($drp_array[0])) |
|
1234 | - return $drp_array[0]->$select_params[0]; |
|
1235 | + if (isset($drp_array[0])) { |
|
1236 | + return $drp_array[0]->$select_params[0]; |
|
1237 | + } |
|
1235 | 1238 | } |
1236 | 1239 | |
1237 | 1240 | /* |
@@ -1248,10 +1251,10 @@ discard block |
||
1248 | 1251 | if($select == 'debit'){ |
1249 | 1252 | if($result[0]['item_type'] == 'POSTCHARG'){ |
1250 | 1253 | return $this->convert_to_currency('', '', $result[0]['debit']); |
1251 | - }else{ |
|
1254 | + } else{ |
|
1252 | 1255 | return $this->convert_to_currency('', '', $result[0]['credit']); |
1253 | 1256 | } |
1254 | - }else{ |
|
1257 | + } else{ |
|
1255 | 1258 | return $result[0][$select]; |
1256 | 1259 | } |
1257 | 1260 | } else { |
@@ -1603,7 +1606,7 @@ discard block |
||
1603 | 1606 | } |
1604 | 1607 | if ($show_currency_flag){ |
1605 | 1608 | return $calculated_amount." ".$currency_info['user_currency']['currency']; |
1606 | - }else{ |
|
1609 | + } else{ |
|
1607 | 1610 | return $calculated_amount; |
1608 | 1611 | } |
1609 | 1612 | } |
@@ -1823,7 +1826,7 @@ discard block |
||
1823 | 1826 | if($data['type']==1){ |
1824 | 1827 | $this->reseller_delete_dependencies($data['id']); |
1825 | 1828 | $this->subreseller_list($data['id']); |
1826 | - }else{ |
|
1829 | + } else{ |
|
1827 | 1830 | $this->customer_delete_dependencies($data['id']); |
1828 | 1831 | } |
1829 | 1832 | } |
@@ -1844,7 +1847,7 @@ discard block |
||
1844 | 1847 | $result=$this->CI->db->get($table_name); |
1845 | 1848 | if($result->num_rows() > 0){ |
1846 | 1849 | return $result->result_array(); |
1847 | - }else{ |
|
1850 | + } else{ |
|
1848 | 1851 | return false; |
1849 | 1852 | } |
1850 | 1853 | } |
@@ -1875,10 +1878,10 @@ discard block |
||
1875 | 1878 | $data["to_currency"] = Common_model::$global_config['system_config']['base_currency']; |
1876 | 1879 | if($login_info['type'] == -1){ |
1877 | 1880 | $currency = $data["to_currency"]; |
1878 | - }elseif($login_info['type'] == 1){ |
|
1881 | + } elseif($login_info['type'] == 1){ |
|
1879 | 1882 | $accountdata["currency_id"] = $this->get_field_name('currency', 'currency', $login_info["currency_id"]); |
1880 | 1883 | $currency = $accountdata["currency_id"]; |
1881 | - }else{ |
|
1884 | + } else{ |
|
1882 | 1885 | $currency = $accountdata["currency_id"]; |
1883 | 1886 | } |
1884 | 1887 | $decimal_amount=Common_model::$global_config['system_config']['decimalpoints']; |
@@ -2007,7 +2010,7 @@ discard block |
||
2007 | 2010 | |
2008 | 2011 | $ACCOUNT_DESCRIPTION .= '<td style="width:20%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;text-align:right;">'.$this->currency_decimal($this->CI->common_model->calculate_currency($charge_res['debit'])).'</td>'; |
2009 | 2012 | $ACCOUNT_DESCRIPTION .= '</tr>'; |
2010 | - }else{ |
|
2013 | + } else{ |
|
2011 | 2014 | $cdrs_data = $this->CI->db_model->getSelect("sum(billseconds) as billseconds,count(*) as count", "cdrs", array("accountid" => $charge_res['accountid'],"calltype" => $charge_res['item_type'])); |
2012 | 2015 | $cdrs_result = $cdrs_data->result_array(); |
2013 | 2016 | if($cdrs_result[0]['count'] > 0 ){ |
@@ -2054,7 +2057,7 @@ discard block |
||
2054 | 2057 | |
2055 | 2058 | } |
2056 | 2059 | $total_vat=$this->currency_decimal($this->CI->common_model->calculate_currency($total_vat)); |
2057 | - }else{ |
|
2060 | + } else{ |
|
2058 | 2061 | /********harsh_308***********/ |
2059 | 2062 | $ACCOUNT_TOTAL .= '<tr>'; |
2060 | 2063 | $ACCOUNT_TOTAL .= '<td style="width:20%;font-size: 12px;color:#000;font-family:arial; line-height: 22px;"></td>'; |
@@ -2101,10 +2104,10 @@ discard block |
||
2101 | 2104 | $invoice_notes=$invoice_notes->result_array(); |
2102 | 2105 | if(isset($invoice_notes[0]['notes'])){ |
2103 | 2106 | $invoice_notes=$invoice_notes[0]['notes']; |
2104 | - }else{ |
|
2107 | + } else{ |
|
2105 | 2108 | if($invoice_notes[0]['invoice_note'] == '0' ){ |
2106 | 2109 | $invoice_notes='THIS IS A 30 DAY ACCOUNT, SO PLEASE MAKE PAYMENT WITHIN THESE TERMS'; |
2107 | - }else{ |
|
2110 | + } else{ |
|
2108 | 2111 | $invoice_notes=$invoice_notes[0]['invoice_note']; |
2109 | 2112 | } |
2110 | 2113 | } |
@@ -2113,10 +2116,10 @@ discard block |
||
2113 | 2116 | if (file_exists(getcwd()."/upload/".$invoice_config[0]['accountid']."_".$invoice_config[0]['logo'])) { |
2114 | 2117 | if($invoice_config[0]['logo'] != ''){ |
2115 | 2118 | $content = str_replace("<LOGO>",base_url()."upload/".$invoice_config[0]['accountid']."_".$invoice_config[0]['logo'],$content); |
2116 | - }else{ |
|
2119 | + } else{ |
|
2117 | 2120 | $content = str_replace("<LOGO>",base_url().'/assets/images/logo.png',$content); |
2118 | 2121 | } |
2119 | - }else{ |
|
2122 | + } else{ |
|
2120 | 2123 | $content = str_replace("<LOGO>",base_url().'/assets/images/logo.png',$content); |
2121 | 2124 | } |
2122 | 2125 | |
@@ -2147,7 +2150,7 @@ discard block |
||
2147 | 2150 | $download_path = $invoicedata['invoice_prefix'].$invoicedata['invoiceid'].".pdf"; |
2148 | 2151 | |
2149 | 2152 | $this->CI->html2pdf->Output($download_path,"D"); |
2150 | - }else{ |
|
2153 | + } else{ |
|
2151 | 2154 | $current_dir = getcwd()."/invoices/"; |
2152 | 2155 | $dir_name = $accountdata["id"]; |
2153 | 2156 | if(!is_dir($current_dir.$dir_name)){ |
@@ -2170,16 +2173,17 @@ discard block |
||
2170 | 2173 | $select = "concat($cnt_str) as $select_params[2] "; |
2171 | 2174 | $drp_array = $this->CI->db_model->getSelect($select, $table, $where); |
2172 | 2175 | $drp_array = $drp_array->result(); |
2173 | - if (isset($drp_array[0])) |
|
2174 | - return $drp_array[0]->$select_params[2]; |
|
2175 | - else |
|
2176 | - return 'Admin'; |
|
2176 | + if (isset($drp_array[0])) { |
|
2177 | + return $drp_array[0]->$select_params[2]; |
|
2178 | + } else { |
|
2179 | + return 'Admin'; |
|
2180 | + } |
|
2177 | 2181 | } |
2178 | 2182 | |
2179 | 2183 | function get_subreseller_info($parent_id){ |
2180 | 2184 | if(!empty($parent_id)){ |
2181 | 2185 | $str=$parent_id.","; |
2182 | - }else{ |
|
2186 | + } else{ |
|
2183 | 2187 | $str=null; |
2184 | 2188 | } |
2185 | 2189 | $query = "select id from accounts where reseller_id = '$parent_id' AND deleted =0 AND type=1"; |
@@ -2197,7 +2201,7 @@ discard block |
||
2197 | 2201 | function get_parent_info($child_id,$parent_id){ |
2198 | 2202 | if(!empty($child_id)){ |
2199 | 2203 | $str=$child_id.","; |
2200 | - }else{ |
|
2204 | + } else{ |
|
2201 | 2205 | $str=null; |
2202 | 2206 | } |
2203 | 2207 | if($child_id > 0){ |
@@ -91,6 +91,9 @@ discard block |
||
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | |
94 | + /** |
|
95 | + * @param string $detail_type |
|
96 | + */ |
|
94 | 97 | function get_info($id,$detail_type) |
95 | 98 | { |
96 | 99 | $where = array('id' => $id); |
@@ -183,6 +186,10 @@ discard block |
||
183 | 186 | } |
184 | 187 | } |
185 | 188 | } |
189 | + |
|
190 | + /** |
|
191 | + * @param string $attachment |
|
192 | + */ |
|
186 | 193 | function mail_history($attachment) |
187 | 194 | { |
188 | 195 | $send_mail_details = array('from'=>$this->from, |
@@ -21,8 +21,9 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if (!defined('BASEPATH')) |
|
24 | +if (!defined('BASEPATH')) { |
|
25 | 25 | exit('No direct script access allowed'); |
26 | +} |
|
26 | 27 | |
27 | 28 | /** |
28 | 29 | * Dynamically build forms for display |
@@ -118,9 +119,9 @@ discard block |
||
118 | 119 | } |
119 | 120 | |
120 | 121 | function build_template($template_type,$detail,$detail_type='') { |
121 | - if(!is_array($template_type)) |
|
122 | - $this->get_template($template_type); |
|
123 | - else{ |
|
122 | + if(!is_array($template_type)) { |
|
123 | + $this->get_template($template_type); |
|
124 | + } else{ |
|
124 | 125 | $this->message=$template_type['message']; |
125 | 126 | $this->subject=$template_type['subject']; |
126 | 127 | $template_type=''; |
@@ -142,11 +143,11 @@ discard block |
||
142 | 143 | /*************/ |
143 | 144 | $this->account_id=$templateinfo['accountid']; |
144 | 145 | unset($templateinfo['number']); |
146 | + } else if(!is_array($detail) && $detail_type=='') { |
|
147 | + $templateinfo=$this->get_account_info($detail); |
|
148 | + } else { |
|
149 | + $templateinfo=$this->get_info($detail,$detail_type); |
|
145 | 150 | } |
146 | - else if(!is_array($detail) && $detail_type=='') |
|
147 | - $templateinfo=$this->get_account_info($detail); |
|
148 | - else |
|
149 | - $templateinfo=$this->get_info($detail,$detail_type); |
|
150 | 151 | |
151 | 152 | if($this->get_admin_details() && is_array($templateinfo) && isset($templateinfo['first_name']) && $templateinfo['first_name']!=''){ |
152 | 153 | $this->message = html_entity_decode($this->message); |
@@ -219,7 +220,9 @@ discard block |
||
219 | 220 | } |
220 | 221 | function get_smtp_details() |
221 | 222 | { |
222 | - if($this->smtp_port=='' || $this->smtp_host=='' || $this->smtp_user=='' || $this->smtp_pass=='')exit; |
|
223 | + if($this->smtp_port=='' || $this->smtp_host=='' || $this->smtp_user=='' || $this->smtp_pass=='') { |
|
224 | + exit; |
|
225 | + } |
|
223 | 226 | $config['protocol'] = "smtp"; |
224 | 227 | $config['smtp_host'] = $this->smtp_host; |
225 | 228 | $config['smtp_port'] = $this->smtp_port; |
@@ -236,14 +239,15 @@ discard block |
||
236 | 239 | if(!$this->email){ |
237 | 240 | if(!$resend){ |
238 | 241 | $this->build_template($template_type,$details,$detail_type); |
239 | - }else{ |
|
242 | + } else{ |
|
240 | 243 | $this->set_email_paramenters($details); |
241 | 244 | } |
242 | 245 | |
243 | - if(!$brodcast) |
|
244 | - $history_id=$this->mail_history($attachment); |
|
245 | - else |
|
246 | - $history_id=$details['history_id']; |
|
246 | + if(!$brodcast) { |
|
247 | + $history_id=$this->mail_history($attachment); |
|
248 | + } else { |
|
249 | + $history_id=$details['history_id']; |
|
250 | + } |
|
247 | 251 | if(isset($this->from) && $this->from!='' && isset($this->to) && $this->to!='' && !$mass_mail){ |
248 | 252 | if(!$this->smtp){ |
249 | 253 | $this->get_smtp_details(); |
@@ -280,14 +284,15 @@ discard block |
||
280 | 284 | |
281 | 285 | if(!$resend){ |
282 | 286 | $this->build_template($template_type,$details,$detail_type); |
283 | - }else{ |
|
287 | + } else{ |
|
284 | 288 | $this->set_email_paramenters($details); |
285 | 289 | } |
286 | 290 | |
287 | - if(!$brodcast) |
|
288 | - $history_id=$this->mail_history($attachment); |
|
289 | - else |
|
290 | - $history_id=$details['history_id']; |
|
291 | + if(!$brodcast) { |
|
292 | + $history_id=$this->mail_history($attachment); |
|
293 | + } else { |
|
294 | + $history_id=$details['history_id']; |
|
295 | + } |
|
291 | 296 | if(isset($this->from) && $this->from!='' && isset($this->to) && $this->to!='' && !$mass_mail){ |
292 | 297 | if(!$this->smtp){ |
293 | 298 | $this->get_smtp_details(); |
@@ -52,8 +52,6 @@ |
||
52 | 52 | // __construct |
53 | 53 | /** |
54 | 54 | * adds raw html to the field array |
55 | - * @param type $label |
|
56 | - * @param type $field add |
|
57 | 55 | */ |
58 | 56 | function check_permissions() { |
59 | 57 | if ($this->CI->session->userdata('user_login') == TRUE) { |
@@ -21,8 +21,9 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if (!defined('BASEPATH')) |
|
24 | +if (!defined('BASEPATH')) { |
|
25 | 25 | exit('No direct script access allowed'); |
26 | +} |
|
26 | 27 | |
27 | 28 | /** |
28 | 29 | * Dynamically build forms for display |
@@ -65,7 +66,7 @@ discard block |
||
65 | 66 | $file_name = explode("/", $url); |
66 | 67 | if(isset($file_name['1']) ){ |
67 | 68 | $module = explode('_', $file_name['1']); |
68 | - }else{ |
|
69 | + } else{ |
|
69 | 70 | $module=$file_name; |
70 | 71 | } |
71 | 72 | if($this->CI->session->userdata('userlevel_logintype')==1 ){ |
@@ -74,7 +75,7 @@ discard block |
||
74 | 75 | if (in_array($module[0], $module_info)) { |
75 | 76 | if($this->CI->session->userdata('userlevel_logintype')== 0 && $module[0] == 'customer' && isset($file_name[1]) && $file_name[1] !='customer_transfer'){ |
76 | 77 | redirect(base_url() . 'user/user/'); |
77 | - }else{ |
|
78 | + } else{ |
|
78 | 79 | return true; |
79 | 80 | } |
80 | 81 | } else { |
@@ -139,23 +140,23 @@ discard block |
||
139 | 140 | foreach ($form_fileds as $fieldkey => $fieldvalue) { |
140 | 141 | $form_contents.= '<li class="col-md-12">'; |
141 | 142 | if ($fieldvalue[1] == 'HIDDEN') { |
142 | - if (isset($this->CI->input->post)) |
|
143 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
144 | - else |
|
145 | - $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : ''):(isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] :''); |
|
143 | + if (isset($this->CI->input->post)) { |
|
144 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
145 | + } else { |
|
146 | + $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : ''):(isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] :''); |
|
147 | + } |
|
146 | 148 | $form_contents.= form_hidden($fieldvalue[2]['name'], $fieldvalue[2]['value']); |
147 | - }else { |
|
149 | + } else { |
|
148 | 150 | $validation_arr=array(); |
149 | 151 | if($fieldvalue[1]=='INPUT'){ |
150 | 152 | if(!empty($fieldvalue[3])){ |
151 | 153 | $validation_arr=explode("|",$fieldvalue[3]); |
152 | 154 | } |
153 | - } |
|
154 | - elseif($fieldvalue[2]=='SELECT'){ |
|
155 | + } elseif($fieldvalue[2]=='SELECT'){ |
|
155 | 156 | |
156 | 157 | if(is_array($fieldvalue[4])){ |
157 | 158 | $validation_arr=explode("|",$fieldvalue[4]['rules']); |
158 | - }else{ |
|
159 | + } else{ |
|
159 | 160 | $validation_arr=explode("|",$fieldvalue[4]); |
160 | 161 | } |
161 | 162 | } |
@@ -182,7 +183,7 @@ discard block |
||
182 | 183 | |
183 | 184 | if (isset($this->CI->input->post)){ |
184 | 185 | $fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
185 | - }else{ |
|
186 | + } else{ |
|
186 | 187 | if (is_array($fieldvalue[1])) { |
187 | 188 | $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]['name']] : @$fieldvalue[1]; |
188 | 189 | } else { |
@@ -201,16 +202,16 @@ discard block |
||
201 | 202 | |
202 | 203 | if(isset($fieldvalue[1]['name'])){ |
203 | 204 | $fieldvalue_pass=$fieldvalue[1]['name']; |
204 | - }else{ |
|
205 | + } else{ |
|
205 | 206 | $fieldvalue_pass=$fieldvalue[1]; |
206 | 207 | } |
207 | 208 | |
208 | 209 | $this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]['rules']); |
209 | - }else{ |
|
210 | + } else{ |
|
210 | 211 | |
211 | 212 | if(isset($fieldvalue[1]['name'])){ |
212 | 213 | $fieldvalue_pass=$fieldvalue[1]['name']; |
213 | - }else{ |
|
214 | + } else{ |
|
214 | 215 | $fieldvalue_pass=$fieldvalue[1]; |
215 | 216 | } |
216 | 217 | |
@@ -246,10 +247,11 @@ discard block |
||
246 | 247 | /* For multi select code */ |
247 | 248 | $str = $fieldvalue[7] . "," . $fieldvalue[8]; |
248 | 249 | |
249 | - if (isset($this->CI->input->post)) |
|
250 | - $fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
251 | - else |
|
252 | - $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
250 | + if (isset($this->CI->input->post)) { |
|
251 | + $fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
252 | + } else { |
|
253 | + $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
254 | + } |
|
253 | 255 | |
254 | 256 | $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
255 | 257 | if ($fieldset_key === 'System Configuration Information') { |
@@ -266,9 +268,9 @@ discard block |
||
266 | 268 | } else if ($fieldvalue[1] == 'INPUT') { |
267 | 269 | |
268 | 270 | |
269 | - if (isset($this->CI->input->post)) |
|
270 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? $fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
271 | - else{ |
|
271 | + if (isset($this->CI->input->post)) { |
|
272 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? $fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
273 | + } else{ |
|
272 | 274 | $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : ''):(isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] :''); |
273 | 275 | } |
274 | 276 | $form_contents.= form_input($fieldvalue[2], 'readonly'); |
@@ -284,11 +286,11 @@ discard block |
||
284 | 286 | * Image upload from invoice configuration code. |
285 | 287 | */ |
286 | 288 | else if ($fieldvalue[1] == 'IMAGE') { |
287 | - if (isset($this->CI->input->post)) |
|
288 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
289 | - |
|
290 | - else |
|
291 | - $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
289 | + if (isset($this->CI->input->post)) { |
|
290 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
291 | + } else { |
|
292 | + $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
293 | + } |
|
292 | 294 | $fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : ""; |
293 | 295 | $form_contents.= form_image($fieldvalue[2], 'readonly',$fieldvalue[2]['style']); |
294 | 296 | $form_contents.=@$fieldvalue[6]; |
@@ -296,13 +298,12 @@ discard block |
||
296 | 298 | $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
297 | 299 | $form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
298 | 300 | </span></div>'; |
299 | - } |
|
300 | - else if ($fieldvalue[1] == 'DEL_BUTTON') { |
|
301 | - if (isset($this->CI->input->post)) |
|
302 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
303 | - |
|
304 | - else |
|
305 | - $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
301 | + } else if ($fieldvalue[1] == 'DEL_BUTTON') { |
|
302 | + if (isset($this->CI->input->post)) { |
|
303 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
304 | + } else { |
|
305 | + $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
306 | + } |
|
306 | 307 | $fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : ""; |
307 | 308 | $form_contents.= form_img_delete($fieldvalue[2], 'readonly',$fieldvalue[2]['style']); |
308 | 309 | $form_contents.=@$fieldvalue[6]; |
@@ -313,10 +314,11 @@ discard block |
||
313 | 314 | } |
314 | 315 | /**********************************************************************************/ |
315 | 316 | else if ($fieldvalue[1] == 'PASSWORD') { |
316 | - if (isset($this->CI->input->post)) |
|
317 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
318 | - else |
|
319 | - $fieldvalue[2]['value'] = ($values) ?@$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
317 | + if (isset($this->CI->input->post)) { |
|
318 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
319 | + } else { |
|
320 | + $fieldvalue[2]['value'] = ($values) ?@$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
321 | + } |
|
320 | 322 | $form_contents.= form_password($fieldvalue[2]); |
321 | 323 | $this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]); |
322 | 324 | $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
@@ -325,12 +327,12 @@ discard block |
||
325 | 327 | } else if ($fieldvalue[2] == 'CHECKBOX') { |
326 | 328 | $OptionArray = array(); |
327 | 329 | |
328 | - if(isset($fieldvalue[7]) && $fieldvalue[7] != '') |
|
329 | - $OptionArray = call_user_func_array(array($this->CI->common, $fieldvalue[7]), array($fieldvalue[6])); |
|
330 | + if(isset($fieldvalue[7]) && $fieldvalue[7] != '') { |
|
331 | + $OptionArray = call_user_func_array(array($this->CI->common, $fieldvalue[7]), array($fieldvalue[6])); |
|
332 | + } |
|
330 | 333 | if (isset($this->CI->input->post)){ |
331 | 334 | $fieldvalue[3]['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[3]['value'] : $this->CI->input->post($fieldvalue[1]); |
332 | - } |
|
333 | - else |
|
335 | + } else |
|
334 | 336 | { |
335 | 337 | $fieldvalue[3]['value'] = ($values) ? (isset($values[$fieldvalue[1]]) && $values[$fieldvalue[1]] ? 1: 0) : @$fieldvalue[3]['value']; |
336 | 338 | } |
@@ -342,18 +344,18 @@ discard block |
||
342 | 344 | if(isset($fieldvalue[3]['table_name']) && $fieldvalue[3]['table_name'] != ""){ |
343 | 345 | |
344 | 346 | $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked , $OptionArray); |
345 | - }else{ |
|
347 | + } else{ |
|
346 | 348 | $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked ,$OptionArray); |
347 | 349 | } |
348 | 350 | } else if ($fieldvalue[1] == 'TEXTAREA') { |
349 | 351 | |
350 | - if (isset($this->CI->input->post)) |
|
351 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
352 | - else |
|
353 | - $fieldvalue[2]['value'] = ($values) ? $values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
352 | + if (isset($this->CI->input->post)) { |
|
353 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
354 | + } else { |
|
355 | + $fieldvalue[2]['value'] = ($values) ? $values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
356 | + } |
|
354 | 357 | $form_contents.= form_textarea($fieldvalue[2]); |
355 | - } |
|
356 | - else if ($fieldvalue[2] == 'RADIO') { |
|
358 | + } else if ($fieldvalue[2] == 'RADIO') { |
|
357 | 359 | |
358 | 360 | $form_contents.= form_radio($fieldvalue[1], $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
359 | 361 | } |
@@ -583,8 +585,9 @@ discard block |
||
583 | 585 | $json_data["json_paging"]['total'] = $config['total_rows']; |
584 | 586 | $perpage = $config['per_page']; |
585 | 587 | $start = ($page_no - 1) * $perpage; |
586 | - if ($start < 0) |
|
587 | - $start = 0; |
|
588 | + if ($start < 0) { |
|
589 | + $start = 0; |
|
590 | + } |
|
588 | 591 | $json_data["paging"]['start'] = $start; |
589 | 592 | $json_data["paging"]['page_no'] = $perpage; |
590 | 593 | return $json_data; |
@@ -613,7 +616,7 @@ discard block |
||
613 | 616 | if($field_arr[2]=="status"){ |
614 | 617 | $row['id'] = $row_id; |
615 | 618 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row)); |
616 | - }else{ |
|
619 | + } else{ |
|
617 | 620 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row[$field_arr[2]])); |
618 | 621 | } |
619 | 622 | |
@@ -638,13 +641,13 @@ discard block |
||
638 | 641 | $fieldstr = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]); |
639 | 642 | if($acctype != ''){ |
640 | 643 | $jsn_tmp[$field_key] = $fieldstr."<br/>".$acctype; |
641 | - }else{ |
|
644 | + } else{ |
|
642 | 645 | $jsn_tmp[$field_key] = $fieldstr; |
643 | 646 | } |
644 | 647 | |
645 | 648 | |
646 | 649 | /*********************************/ |
647 | - }else { |
|
650 | + } else { |
|
648 | 651 | $jsn_tmp[$field_key] = $row[$field_arr[2]]; |
649 | 652 | } |
650 | 653 | } else { |
@@ -678,15 +681,13 @@ discard block |
||
678 | 681 | */ |
679 | 682 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row_id); |
680 | 683 | /****************************************************************************/ |
681 | - } |
|
682 | - elseif($field_arr[0] == gettext("Profile Action")) |
|
684 | + } elseif($field_arr[0] == gettext("Profile Action")) |
|
683 | 685 | { |
684 | 686 | if(isset($field_arr[5]) && isset($field_arr[5]->START) && isset($field_arr[5]->STOP) && isset($field_arr[5]->RELOAD) && isset($field_arr[5]->RESCAN)){ |
685 | 687 | } |
686 | 688 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]); |
687 | 689 | |
688 | - } |
|
689 | - else { |
|
690 | + } else { |
|
690 | 691 | $className = (isset($field_arr['9']) && $field_arr['9'] != '')?$field_arr['9']:"chkRefNos"; |
691 | 692 | $jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id=' . $row['id'] . ' class="ace '.$className.'" onclick="clickchkbox(' . $row['id'] . ')" value=' . $row['id'] . '><lable class="lbl"></lable>'; } |
692 | 693 | } |
@@ -715,7 +716,7 @@ discard block |
||
715 | 716 | if($field_arr[2]=="status"){ |
716 | 717 | $row['id'] = $row_id; |
717 | 718 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row)); |
718 | - }else{ |
|
719 | + } else{ |
|
719 | 720 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row[$field_arr[2]])); |
720 | 721 | } |
721 | 722 | /** |
@@ -733,14 +734,13 @@ discard block |
||
733 | 734 | } |
734 | 735 | $jsn_tmp[$field_key] = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]); |
735 | 736 | /*******************************/ |
736 | - }else { |
|
737 | + } else { |
|
737 | 738 | $jsn_tmp[$field_key] = isset($row[$field_arr[2]]) ? $row[$field_arr[2]] : ""; |
738 | 739 | } |
739 | 740 | } else { |
740 | 741 | if ($field_arr[0] == "Action") { |
741 | 742 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]); |
742 | - } |
|
743 | - else { |
|
743 | + } else { |
|
744 | 744 | $jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id=' . $row['id'] . ' class="ace chkRefNos" onclick="clickchkbox(' . $row['id'] . ')" value=' . $row['id'] . '><lable class="lbl"></lable>'; |
745 | 745 | } |
746 | 746 | } |