@@ -381,6 +381,9 @@ |
||
| 381 | 381 | return $this->sendPayload($msg); |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | + /** |
|
| 385 | + * @param XML_RPC_Message $msg |
|
| 386 | + */ |
|
| 384 | 387 | function sendPayload($msg) |
| 385 | 388 | { |
| 386 | 389 | $fp = @fsockopen($this->server, $this->port, $this->errno, $this->errstr, $this->timeout); |
@@ -1234,11 +1234,11 @@ |
||
| 1234 | 1234 | /** |
| 1235 | 1235 | * @param integer $val |
| 1236 | 1236 | */ |
| 1237 | - function addScalar($val, $type='string') |
|
| 1237 | + function addScalar($val, $type = 'string') |
|
| 1238 | 1238 | { |
| 1239 | 1239 | $typeof = $this->xmlrpcTypes[$type]; |
| 1240 | 1240 | |
| 1241 | - if ($this->mytype==1) |
|
| 1241 | + if ($this->mytype == 1) |
|
| 1242 | 1242 | { |
| 1243 | 1243 | echo '<strong>XML_RPC_Values</strong>: scalar can have only one value<br />'; |
| 1244 | 1244 | return 0; |
@@ -443,14 +443,12 @@ discard block |
||
| 443 | 443 | // error |
| 444 | 444 | $this->errno = $code; |
| 445 | 445 | $this->errstr = htmlentities($fstr); |
| 446 | - } |
|
| 447 | - else if ( ! is_object($val)) |
|
| 446 | + } else if ( ! is_object($val)) |
|
| 448 | 447 | { |
| 449 | 448 | // programmer error, not an object |
| 450 | 449 | error_log("Invalid type '".gettype($val)."' (value: $val) passed to XML_RPC_Response. Defaulting to empty value."); |
| 451 | 450 | $this->val = new XML_RPC_Values(); |
| 452 | - } |
|
| 453 | - else |
|
| 451 | + } else |
|
| 454 | 452 | { |
| 455 | 453 | $this->val = $val; |
| 456 | 454 | } |
@@ -979,50 +977,42 @@ discard block |
||
| 979 | 977 | if ($name == 'STRING') |
| 980 | 978 | { |
| 981 | 979 | $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
| 982 | - } |
|
| 983 | - elseif ($name == 'DATETIME.ISO8601') |
|
| 980 | + } elseif ($name == 'DATETIME.ISO8601') |
|
| 984 | 981 | { |
| 985 | 982 | $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; |
| 986 | 983 | $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
| 987 | - } |
|
| 988 | - elseif ($name == 'BASE64') |
|
| 984 | + } elseif ($name == 'BASE64') |
|
| 989 | 985 | { |
| 990 | 986 | $this->xh[$the_parser]['value'] = base64_decode($this->xh[$the_parser]['ac']); |
| 991 | - } |
|
| 992 | - elseif ($name == 'BOOLEAN') |
|
| 987 | + } elseif ($name == 'BOOLEAN') |
|
| 993 | 988 | { |
| 994 | 989 | // Translated BOOLEAN values to TRUE AND FALSE |
| 995 | 990 | if ($this->xh[$the_parser]['ac'] == '1') |
| 996 | 991 | { |
| 997 | 992 | $this->xh[$the_parser]['value'] = TRUE; |
| 998 | - } |
|
| 999 | - else |
|
| 993 | + } else |
|
| 1000 | 994 | { |
| 1001 | 995 | $this->xh[$the_parser]['value'] = FALSE; |
| 1002 | 996 | } |
| 1003 | - } |
|
| 1004 | - elseif ($name == 'DOUBLE') |
|
| 997 | + } elseif ($name == 'DOUBLE') |
|
| 1005 | 998 | { |
| 1006 | 999 | // we have a DOUBLE |
| 1007 | 1000 | // we must check that only 0123456789-.<space> are characters here |
| 1008 | 1001 | if ( ! preg_match('/^[+-]?[eE0-9\t \.]+$/', $this->xh[$the_parser]['ac'])) |
| 1009 | 1002 | { |
| 1010 | 1003 | $this->xh[$the_parser]['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 1011 | - } |
|
| 1012 | - else |
|
| 1004 | + } else |
|
| 1013 | 1005 | { |
| 1014 | 1006 | $this->xh[$the_parser]['value'] = (double)$this->xh[$the_parser]['ac']; |
| 1015 | 1007 | } |
| 1016 | - } |
|
| 1017 | - else |
|
| 1008 | + } else |
|
| 1018 | 1009 | { |
| 1019 | 1010 | // we have an I4/INT |
| 1020 | 1011 | // we must check that only 0123456789-<space> are characters here |
| 1021 | 1012 | if ( ! preg_match('/^[+-]?[0-9\t ]+$/', $this->xh[$the_parser]['ac'])) |
| 1022 | 1013 | { |
| 1023 | 1014 | $this->xh[$the_parser]['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 1024 | - } |
|
| 1025 | - else |
|
| 1015 | + } else |
|
| 1026 | 1016 | { |
| 1027 | 1017 | $this->xh[$the_parser]['value'] = (int)$this->xh[$the_parser]['ac']; |
| 1028 | 1018 | } |
@@ -1219,12 +1209,10 @@ discard block |
||
| 1219 | 1209 | if ($this->xmlrpcTypes[$type] == 1) |
| 1220 | 1210 | { |
| 1221 | 1211 | $this->addScalar($val, $type); |
| 1222 | - } |
|
| 1223 | - elseif ($this->xmlrpcTypes[$type] == 2) |
|
| 1212 | + } elseif ($this->xmlrpcTypes[$type] == 2) |
|
| 1224 | 1213 | { |
| 1225 | 1214 | $this->addArray($val); |
| 1226 | - } |
|
| 1227 | - elseif ($this->xmlrpcTypes[$type] == 3) |
|
| 1215 | + } elseif ($this->xmlrpcTypes[$type] == 3) |
|
| 1228 | 1216 | { |
| 1229 | 1217 | $this->addStruct($val); |
| 1230 | 1218 | } |
@@ -22,133 +22,133 @@ |
||
| 22 | 22 | ############################################################################### |
| 23 | 23 | |
| 24 | 24 | class Astpp_common extends CI_Model { |
| 25 | - // ------------------------------------------------------------------------ |
|
| 26 | - /** |
|
| 27 | - * initialises the class inheriting the methods of the class Model |
|
| 28 | - * |
|
| 29 | - * @return Usermodel |
|
| 30 | - */ |
|
| 31 | - function Astpp_common() { |
|
| 32 | - parent::__construct(); |
|
| 33 | - } |
|
| 34 | - /** |
|
| 35 | - * -------Here we write code for model astpp_common_model functions list_applyable_charges------ |
|
| 36 | - * Purpose: build array for applyable charge dropdown list. |
|
| 37 | - * @param |
|
| 38 | - * @return return array of applyable chargelist. |
|
| 39 | - */ |
|
| 40 | - function list_applyable_charges($accountid = '') { |
|
| 41 | - $accountinfo = $this->session->userdata('accountinfo'); |
|
| 42 | - $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
| 25 | + // ------------------------------------------------------------------------ |
|
| 26 | + /** |
|
| 27 | + * initialises the class inheriting the methods of the class Model |
|
| 28 | + * |
|
| 29 | + * @return Usermodel |
|
| 30 | + */ |
|
| 31 | + function Astpp_common() { |
|
| 32 | + parent::__construct(); |
|
| 33 | + } |
|
| 34 | + /** |
|
| 35 | + * -------Here we write code for model astpp_common_model functions list_applyable_charges------ |
|
| 36 | + * Purpose: build array for applyable charge dropdown list. |
|
| 37 | + * @param |
|
| 38 | + * @return return array of applyable chargelist. |
|
| 39 | + */ |
|
| 40 | + function list_applyable_charges($accountid = '') { |
|
| 41 | + $accountinfo = $this->session->userdata('accountinfo'); |
|
| 42 | + $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0; |
|
| 43 | 43 | $q = " SELECT * FROM `charges` where reseller_id =$reseller_id and id NOT IN(select charge_id from charge_to_account where accountid =$accountid) AND pricelist_id = '0'"; |
| 44 | - $item_arr = array(); |
|
| 45 | - $query = $this->db->query($q); |
|
| 46 | - if ($query->num_rows() > 0) { |
|
| 47 | - foreach ($query->result_array() as $row) { |
|
| 48 | - if ($row['charge'] > 0) { |
|
| 49 | - $row['charge'] = $this->common_model->calculate_currency($row['charge']); |
|
| 50 | - } |
|
| 51 | - $item_arr[$row['id']] = $row['description'].' - '.$row['charge']; |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - return $item_arr; |
|
| 55 | - } |
|
| 56 | - function quote($inp) { |
|
| 57 | - return "'".$this->db->escape_str($inp)."'"; |
|
| 58 | - } |
|
| 44 | + $item_arr = array(); |
|
| 45 | + $query = $this->db->query($q); |
|
| 46 | + if ($query->num_rows() > 0) { |
|
| 47 | + foreach ($query->result_array() as $row) { |
|
| 48 | + if ($row['charge'] > 0) { |
|
| 49 | + $row['charge'] = $this->common_model->calculate_currency($row['charge']); |
|
| 50 | + } |
|
| 51 | + $item_arr[$row['id']] = $row['description'].' - '.$row['charge']; |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + return $item_arr; |
|
| 55 | + } |
|
| 56 | + function quote($inp) { |
|
| 57 | + return "'".$this->db->escape_str($inp)."'"; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @param string $q |
|
| 62 | - * @param string $colname |
|
| 63 | - */ |
|
| 64 | - function db_get_item($q, $colname) { |
|
| 65 | - $item_arr = array(); |
|
| 66 | - $query = $this->db->query($q); |
|
| 67 | - if ($query->num_rows() > 0) { |
|
| 68 | - $row = $query->row_array(); |
|
| 69 | - return $row[$colname]; |
|
| 70 | - } |
|
| 71 | - return ''; |
|
| 72 | - } |
|
| 73 | - // Return the balance for a specific ASTPP account. |
|
| 74 | - function accountbalance($account) { |
|
| 75 | - $debit = 0; |
|
| 76 | - $q = "SELECT SUM(debit) as val1 FROM cdrs WHERE accountid=".$this->quote($account)." AND status NOT IN (1, 2)"; |
|
| 77 | - $query = $this->db->query($q); |
|
| 78 | - if ($query->num_rows() > 0) { |
|
| 79 | - $row = $query->row_array(); |
|
| 80 | - $debit = $row['val1']; |
|
| 81 | - } |
|
| 82 | - $credit = 0; |
|
| 83 | - $q = "SELECT SUM(credit) as val1 FROM cdrs WHERE accountid= ".$this->quote($account)." AND status NOT IN (1, 2)"; |
|
| 84 | - $query = $this->db->query($q); |
|
| 85 | - if ($query->num_rows() > 0) { |
|
| 86 | - $row = $query->row_array(); |
|
| 87 | - $credit = $row['val1']; |
|
| 88 | - } |
|
| 89 | - $posted_balance = 0; |
|
| 90 | - $q = "SELECT * FROM accounts WHERE id = ".$this->quote($account); |
|
| 91 | - $query = $this->db->query($q); |
|
| 92 | - if ($query->num_rows() > 0) { |
|
| 93 | - $row = $query->row_array(); |
|
| 94 | - $posted_balance = $row['balance']; |
|
| 95 | - } |
|
| 96 | - $balance = ($debit - $credit + $posted_balance); |
|
| 97 | - return $balance; |
|
| 98 | - } |
|
| 99 | - function accounts_total_balance($reseller) { |
|
| 100 | - $debit = 0; |
|
| 101 | - $credit = 0; |
|
| 102 | - if ($reseller == "") { |
|
| 103 | - $q = "SELECT SUM(debit) as val1 FROM cdrs WHERE status NOT IN (1, 2)"; |
|
| 104 | - $debit = $this->db_get_item($q, 'val1'); |
|
| 60 | + /** |
|
| 61 | + * @param string $q |
|
| 62 | + * @param string $colname |
|
| 63 | + */ |
|
| 64 | + function db_get_item($q, $colname) { |
|
| 65 | + $item_arr = array(); |
|
| 66 | + $query = $this->db->query($q); |
|
| 67 | + if ($query->num_rows() > 0) { |
|
| 68 | + $row = $query->row_array(); |
|
| 69 | + return $row[$colname]; |
|
| 70 | + } |
|
| 71 | + return ''; |
|
| 72 | + } |
|
| 73 | + // Return the balance for a specific ASTPP account. |
|
| 74 | + function accountbalance($account) { |
|
| 75 | + $debit = 0; |
|
| 76 | + $q = "SELECT SUM(debit) as val1 FROM cdrs WHERE accountid=".$this->quote($account)." AND status NOT IN (1, 2)"; |
|
| 77 | + $query = $this->db->query($q); |
|
| 78 | + if ($query->num_rows() > 0) { |
|
| 79 | + $row = $query->row_array(); |
|
| 80 | + $debit = $row['val1']; |
|
| 81 | + } |
|
| 82 | + $credit = 0; |
|
| 83 | + $q = "SELECT SUM(credit) as val1 FROM cdrs WHERE accountid= ".$this->quote($account)." AND status NOT IN (1, 2)"; |
|
| 84 | + $query = $this->db->query($q); |
|
| 85 | + if ($query->num_rows() > 0) { |
|
| 86 | + $row = $query->row_array(); |
|
| 87 | + $credit = $row['val1']; |
|
| 88 | + } |
|
| 89 | + $posted_balance = 0; |
|
| 90 | + $q = "SELECT * FROM accounts WHERE id = ".$this->quote($account); |
|
| 91 | + $query = $this->db->query($q); |
|
| 92 | + if ($query->num_rows() > 0) { |
|
| 93 | + $row = $query->row_array(); |
|
| 94 | + $posted_balance = $row['balance']; |
|
| 95 | + } |
|
| 96 | + $balance = ($debit - $credit + $posted_balance); |
|
| 97 | + return $balance; |
|
| 98 | + } |
|
| 99 | + function accounts_total_balance($reseller) { |
|
| 100 | + $debit = 0; |
|
| 101 | + $credit = 0; |
|
| 102 | + if ($reseller == "") { |
|
| 103 | + $q = "SELECT SUM(debit) as val1 FROM cdrs WHERE status NOT IN (1, 2)"; |
|
| 104 | + $debit = $this->db_get_item($q, 'val1'); |
|
| 105 | 105 | |
| 106 | - $q = "SELECT SUM(credit) as val1 FROM cdrs WHERE status NOT IN (1, 2)"; |
|
| 107 | - $credit = $this->db_get_item($q, 'val1'); |
|
| 106 | + $q = "SELECT SUM(credit) as val1 FROM cdrs WHERE status NOT IN (1, 2)"; |
|
| 107 | + $credit = $this->db_get_item($q, 'val1'); |
|
| 108 | 108 | |
| 109 | - $tmp = "SELECT SUM(balance) as val1 FROM accounts WHERE reseller_id = ''"; |
|
| 110 | - } else { |
|
| 111 | - $tmp = "SELECT SUM(balance) as val1 FROM accounts WHERE reseller_id = ".$this->quote($reseller); |
|
| 112 | - } |
|
| 113 | - $posted_balance = $this->db_get_item($tmp, "val1"); |
|
| 109 | + $tmp = "SELECT SUM(balance) as val1 FROM accounts WHERE reseller_id = ''"; |
|
| 110 | + } else { |
|
| 111 | + $tmp = "SELECT SUM(balance) as val1 FROM accounts WHERE reseller_id = ".$this->quote($reseller); |
|
| 112 | + } |
|
| 113 | + $posted_balance = $this->db_get_item($tmp, "val1"); |
|
| 114 | 114 | |
| 115 | - $balance = ($debit - $credit + $posted_balance); |
|
| 116 | - return $balance; |
|
| 117 | - } |
|
| 118 | - function count_dids($test) { |
|
| 119 | - $tmp = "SELECT COUNT(*) as val1 FROM dids ".$test; |
|
| 120 | - return $this->db_get_item($tmp, 'val1'); |
|
| 121 | - } |
|
| 115 | + $balance = ($debit - $credit + $posted_balance); |
|
| 116 | + return $balance; |
|
| 117 | + } |
|
| 118 | + function count_dids($test) { |
|
| 119 | + $tmp = "SELECT COUNT(*) as val1 FROM dids ".$test; |
|
| 120 | + return $this->db_get_item($tmp, 'val1'); |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - function count_callingcards($where, $field = 'COUNT(*)') { |
|
| 124 | - $tmp = "SELECT $field as val FROM callingcards ".$where; |
|
| 125 | - return $this->db_get_item($tmp, 'val'); |
|
| 126 | - } |
|
| 123 | + function count_callingcards($where, $field = 'COUNT(*)') { |
|
| 124 | + $tmp = "SELECT $field as val FROM callingcards ".$where; |
|
| 125 | + return $this->db_get_item($tmp, 'val'); |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - function count_accounts($test) { |
|
| 129 | - $tmp = "SELECT COUNT(*) as val1 FROM accounts ".$test; |
|
| 130 | - return $this->db_get_item($tmp, 'val1'); |
|
| 131 | - } |
|
| 128 | + function count_accounts($test) { |
|
| 129 | + $tmp = "SELECT COUNT(*) as val1 FROM accounts ".$test; |
|
| 130 | + return $this->db_get_item($tmp, 'val1'); |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - function count_rategroup($test) { |
|
| 133 | + function count_rategroup($test) { |
|
| 134 | 134 | $tmp = "SELECT COUNT(*) as val1 FROM pricelists ".$test; |
| 135 | - return $this->db_get_item($tmp, 'val1'); |
|
| 136 | - } |
|
| 135 | + return $this->db_get_item($tmp, 'val1'); |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - function count_termination($test = '') { |
|
| 138 | + function count_termination($test = '') { |
|
| 139 | 139 | $tmp = "SELECT COUNT(*) as val1 FROM outbound_routes ".$test; |
| 140 | - return $this->db_get_item($tmp, 'val1'); |
|
| 141 | - } |
|
| 140 | + return $this->db_get_item($tmp, 'val1'); |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - function count_trunk($test = '') { |
|
| 143 | + function count_trunk($test = '') { |
|
| 144 | 144 | $tmp = "SELECT COUNT(*) as val1 FROM trunks ".$test; |
| 145 | - return $this->db_get_item($tmp, 'val1'); |
|
| 146 | - } |
|
| 145 | + return $this->db_get_item($tmp, 'val1'); |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - function count_origination($test = '') { |
|
| 148 | + function count_origination($test = '') { |
|
| 149 | 149 | $tmp = "SELECT COUNT(*) as val1 FROM routes ".$test; |
| 150 | - return $this->db_get_item($tmp, 'val1'); |
|
| 151 | - } |
|
| 150 | + return $this->db_get_item($tmp, 'val1'); |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | } |
| 154 | 154 | ?> |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $amount_operator = $taxes_search['amount_operator']; |
| 126 | 126 | |
| 127 | - if (!empty($taxes_search['amount'])) { |
|
| 127 | + if ( ! empty($taxes_search['amount'])) { |
|
| 128 | 128 | switch ($amount_operator) { |
| 129 | 129 | case "1": |
| 130 | 130 | $this->db->where('taxes_amount ', $taxes_search['amount']); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $rate_operator = $taxes_search['rate_operator']; |
| 151 | 151 | |
| 152 | - if (!empty($taxes_search['rate'])) { |
|
| 152 | + if ( ! empty($taxes_search['rate'])) { |
|
| 153 | 153 | switch ($rate_operator) { |
| 154 | 154 | case "1": |
| 155 | 155 | $this->db->where('taxes_rate ', $taxes_search['rate']); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $description_operator = $taxes_search['description_operator']; |
| 176 | - if (!empty($taxes_search['description'])) { |
|
| 176 | + if ( ! empty($taxes_search['description'])) { |
|
| 177 | 177 | switch ($description_operator) { |
| 178 | 178 | case "1": |
| 179 | 179 | $this->db->like('taxes_description', $taxes_search['description']); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | $amount_operator = $taxes_search['amount_operator']; |
| 204 | 204 | |
| 205 | - if (!empty($taxes_search['amount'])) { |
|
| 205 | + if ( ! empty($taxes_search['amount'])) { |
|
| 206 | 206 | switch ($amount_operator) { |
| 207 | 207 | case "1": |
| 208 | 208 | $this->db->where('taxes_amount =', $taxes_search['amount']); |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | $rate_operator = $taxes_search['rate_operator']; |
| 229 | 229 | |
| 230 | - if (!empty($taxes_search['rate'])) { |
|
| 230 | + if ( ! empty($taxes_search['rate'])) { |
|
| 231 | 231 | switch ($rate_operator) { |
| 232 | 232 | case "1": |
| 233 | 233 | $this->db->where('taxes_rate == ', $taxes_search['rate']); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | $description_operator = $taxes_search['description_operator']; |
| 254 | - if (!empty($taxes_search['description'])) { |
|
| 254 | + if ( ! empty($taxes_search['description'])) { |
|
| 255 | 255 | switch ($description_operator) { |
| 256 | 256 | case "1": |
| 257 | 257 | $this->db->like('taxes_description', $taxes_search['description']); |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | $template_name_operator = $templatesearch['template_name_operator']; |
| 300 | 300 | |
| 301 | 301 | |
| 302 | - if (!empty($templatesearch['template_name'])) { |
|
| 302 | + if ( ! empty($templatesearch['template_name'])) { |
|
| 303 | 303 | switch ($template_name_operator) { |
| 304 | 304 | case "1": |
| 305 | 305 | $this->db->like('name', $templatesearch['template_name']); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | $template_subject = $templatesearch['subject_operator']; |
| 320 | - if (!empty($templatesearch['subject'])) { |
|
| 320 | + if ( ! empty($templatesearch['subject'])) { |
|
| 321 | 321 | switch ($template_subject) { |
| 322 | 322 | case "1": |
| 323 | 323 | $this->db->like('subject', $templatesearch['subject']); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | $template_op = $templatesearch['template_operator']; |
| 337 | - if (!empty($templatesearch['template_desc'])) { |
|
| 337 | + if ( ! empty($templatesearch['template_desc'])) { |
|
| 338 | 338 | |
| 339 | 339 | switch ($template_op) { |
| 340 | 340 | case "1": |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | |
| 356 | - if (!empty($templatesearch['accountid'])) { |
|
| 356 | + if ( ! empty($templatesearch['accountid'])) { |
|
| 357 | 357 | $this->db->like('accountid', $templatesearch['accountid']); |
| 358 | 358 | } |
| 359 | 359 | } |
@@ -395,19 +395,19 @@ discard block |
||
| 395 | 395 | if ($this->session->userdata('advance_search') == 1) { |
| 396 | 396 | $configuration_search = $this->session->userdata('configuration_search'); |
| 397 | 397 | |
| 398 | - if (!empty($configuration_search['reseller'])) { |
|
| 398 | + if ( ! empty($configuration_search['reseller'])) { |
|
| 399 | 399 | $this->db->where('reseller ', $configuration_search['reseller']); |
| 400 | 400 | } |
| 401 | - if (!empty($configuration_search['brand'])) { |
|
| 401 | + if ( ! empty($configuration_search['brand'])) { |
|
| 402 | 402 | $this->db->where('brand', $configuration_search['brand']); |
| 403 | 403 | } |
| 404 | - if (!empty($configuration_search['group_title'])) { |
|
| 404 | + if ( ! empty($configuration_search['group_title'])) { |
|
| 405 | 405 | $this->db->where('group_title', $configuration_search['group_title']); |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | $name_operator = $configuration_search['name_operator']; |
| 409 | 409 | |
| 410 | - if (!empty($configuration_search['name'])) { |
|
| 410 | + if ( ! empty($configuration_search['name'])) { |
|
| 411 | 411 | switch ($name_operator) { |
| 412 | 412 | case "1": |
| 413 | 413 | $this->db->like('name', $configuration_search['name']); |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | $value_operator = $configuration_search['value_operator']; |
| 428 | 428 | |
| 429 | - if (!empty($configuration_search['value'])) { |
|
| 429 | + if ( ! empty($configuration_search['value'])) { |
|
| 430 | 430 | switch ($value_operator) { |
| 431 | 431 | case "1": |
| 432 | 432 | $this->db->like('value', $configuration_search['value']); |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | |
| 446 | 446 | $comment_operator = $configuration_search['comment_operator']; |
| 447 | 447 | |
| 448 | - if (!empty($configuration_search['comment'])) { |
|
| 448 | + if ( ! empty($configuration_search['comment'])) { |
|
| 449 | 449 | switch ($comment_operator) { |
| 450 | 450 | case "1": |
| 451 | 451 | $this->db->like('comment', $configuration_search['comment']); |
@@ -51,10 +51,11 @@ discard block |
||
| 51 | 51 | $this->db->where("id", $id); |
| 52 | 52 | $query = $this->db->get("system"); |
| 53 | 53 | |
| 54 | - if ($query->num_rows() > 0) |
|
| 55 | - return $query->row_array(); |
|
| 56 | - else |
|
| 57 | - return false; |
|
| 54 | + if ($query->num_rows() > 0) { |
|
| 55 | + return $query->row_array(); |
|
| 56 | + } else { |
|
| 57 | + return false; |
|
| 58 | + } |
|
| 58 | 59 | } |
| 59 | 60 | |
| 60 | 61 | function remove_config($data) { |
@@ -89,10 +90,11 @@ discard block |
||
| 89 | 90 | $this->db->where("taxes_id", $id); |
| 90 | 91 | $query = $this->db->get("taxes"); |
| 91 | 92 | |
| 92 | - if ($query->num_rows() > 0) |
|
| 93 | - return $query->row_array(); |
|
| 94 | - else |
|
| 95 | - return false; |
|
| 93 | + if ($query->num_rows() > 0) { |
|
| 94 | + return $query->row_array(); |
|
| 95 | + } else { |
|
| 96 | + return false; |
|
| 97 | + } |
|
| 96 | 98 | } |
| 97 | 99 | |
| 98 | 100 | function remove_tax($data) { |
@@ -373,10 +375,11 @@ discard block |
||
| 373 | 375 | function get_template_by_id_all($id) { |
| 374 | 376 | $this->db->where('id', $id); |
| 375 | 377 | $query = $this->db->get('templates'); |
| 376 | - if ($query->num_rows() > 0) |
|
| 377 | - return $query->row_array(); |
|
| 378 | - else |
|
| 379 | - return false; |
|
| 378 | + if ($query->num_rows() > 0) { |
|
| 379 | + return $query->row_array(); |
|
| 380 | + } else { |
|
| 381 | + return false; |
|
| 382 | + } |
|
| 380 | 383 | } |
| 381 | 384 | |
| 382 | 385 | function edit_template($edit_id, $data) { |
@@ -86,7 +86,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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']); |
@@ -488,7 +488,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -48,10 +48,11 @@ discard block |
||
| 48 | 48 | function save($tableName, $arr, $val = 'false') { |
| 49 | 49 | $str = $this->db->insert_string($tableName, $arr); |
| 50 | 50 | $rs = $this->db->query($str); |
| 51 | - if ($val == true) |
|
| 52 | - return $this->db->insert_id(); |
|
| 53 | - else |
|
| 54 | - return $rs; |
|
| 51 | + if ($val == true) { |
|
| 52 | + return $this->db->insert_id(); |
|
| 53 | + } else { |
|
| 54 | + return $rs; |
|
| 55 | + } |
|
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | /* * ******************************************************** |
@@ -134,15 +135,18 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 != '') { |
@@ -572,7 +580,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -734,20 +742,23 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -23,33 +23,33 @@ |
||
| 23 | 23 | |
| 24 | 24 | class Auth_model extends CI_Model { |
| 25 | 25 | |
| 26 | - function Auth_model() { |
|
| 27 | - parent::__construct(); |
|
| 28 | - } |
|
| 29 | - /** |
|
| 30 | - * -------Here we write code for model auth_model functions verify_login------ |
|
| 31 | - * Purpose: Validate Login Name and Password. |
|
| 32 | - * @param $username,$password. |
|
| 33 | - * @return integer login user name and password is valid then return true else return false. |
|
| 34 | - */ |
|
| 35 | - function verify_login($username, $password) { |
|
| 36 | - $q = "SELECT COUNT(*) as cnt FROM accounts WHERE (number = '".$this->db->escape_str($username)."'"; |
|
| 26 | + function Auth_model() { |
|
| 27 | + parent::__construct(); |
|
| 28 | + } |
|
| 29 | + /** |
|
| 30 | + * -------Here we write code for model auth_model functions verify_login------ |
|
| 31 | + * Purpose: Validate Login Name and Password. |
|
| 32 | + * @param $username,$password. |
|
| 33 | + * @return integer login user name and password is valid then return true else return false. |
|
| 34 | + */ |
|
| 35 | + function verify_login($username, $password) { |
|
| 36 | + $q = "SELECT COUNT(*) as cnt FROM accounts WHERE (number = '".$this->db->escape_str($username)."'"; |
|
| 37 | 37 | $q .= " OR email = '".$this->db->escape_str($username)."')"; |
| 38 | - $q .= " AND password = '".$this->db->escape_str($password)."'"; |
|
| 39 | - $q .= " AND status = 0 AND type IN (1,2,3,4,5,0,-1) AND deleted = 0"; |
|
| 40 | - $query = $this->db->query($q); |
|
| 41 | - if ($query->num_rows() > 0) { |
|
| 42 | - $row = $query->row(); |
|
| 43 | - if ($row->cnt > 0) { |
|
| 44 | - $this->session->set_userdata('user_name', $username); |
|
| 45 | - return 1; |
|
| 46 | - } else { |
|
| 47 | - return 0; |
|
| 48 | - } |
|
| 49 | - } |
|
| 38 | + $q .= " AND password = '".$this->db->escape_str($password)."'"; |
|
| 39 | + $q .= " AND status = 0 AND type IN (1,2,3,4,5,0,-1) AND deleted = 0"; |
|
| 40 | + $query = $this->db->query($q); |
|
| 41 | + if ($query->num_rows() > 0) { |
|
| 42 | + $row = $query->row(); |
|
| 43 | + if ($row->cnt > 0) { |
|
| 44 | + $this->session->set_userdata('user_name', $username); |
|
| 45 | + return 1; |
|
| 46 | + } else { |
|
| 47 | + return 0; |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - return 0; |
|
| 52 | - } |
|
| 51 | + return 0; |
|
| 52 | + } |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | //end class |
@@ -56,8 +56,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -127,8 +127,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -38,27 +38,34 @@ |
||
| 38 | 38 | public function load($langfile, $lang = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '', $_module = '') {
|
| 39 | 39 | |
| 40 | 40 | if (is_array($langfile)) {
|
| 41 | - foreach ($langfile as $_lang) $this->load($_lang); |
|
| 41 | + foreach ($langfile as $_lang) { |
|
| 42 | + $this->load($_lang); |
|
| 43 | + } |
|
| 42 | 44 | return $this->language; |
| 43 | 45 | } |
| 44 | 46 | |
| 45 | 47 | $deft_lang = CI::$APP->config->item('language');
|
| 46 | 48 | $idiom = ($lang == '') ? $deft_lang : $lang; |
| 47 | 49 | |
| 48 | - if (in_array($langfile.'_lang'.EXT, $this->is_loaded, TRUE)) |
|
| 49 | - return $this->language; |
|
| 50 | + if (in_array($langfile.'_lang'.EXT, $this->is_loaded, TRUE)) { |
|
| 51 | + return $this->language; |
|
| 52 | + } |
|
| 50 | 53 | |
| 51 | 54 | $_module OR $_module = CI::$APP->router->fetch_module(); |
| 52 | 55 | list($path, $_langfile) = Modules::find($langfile.'_lang', $_module, 'language/'.$idiom.'/'); |
| 53 | 56 | |
| 54 | 57 | if ($path === FALSE) {
|
| 55 | 58 | |
| 56 | - if ($lang = parent::load($langfile, $lang, $return, $add_suffix, $alt_path)) return $lang; |
|
| 59 | + if ($lang = parent::load($langfile, $lang, $return, $add_suffix, $alt_path)) { |
|
| 60 | + return $lang; |
|
| 61 | + } |
|
| 57 | 62 | |
| 58 | 63 | } else {
|
| 59 | 64 | |
| 60 | 65 | if ($lang = Modules::load_file($_langfile, $path, 'lang')) {
|
| 61 | - if ($return) return $lang; |
|
| 66 | + if ($return) { |
|
| 67 | + return $lang; |
|
| 68 | + } |
|
| 62 | 69 | $this->language = array_merge($this->language, $lang); |
| 63 | 70 | $this->is_loaded[] = $langfile.'_lang'.EXT; |
| 64 | 71 | unset($lang); |
@@ -141,18 +141,23 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | public function languages($languages) {
|
| 144 | - foreach ($languages as $_language) $this->language($_language); |
|
| 144 | + foreach ($languages as $_language) { |
|
| 145 | + $this->language($_language); |
|
| 146 | + } |
|
| 145 | 147 | } |
| 146 | 148 | |
| 147 | 149 | /** Load a module library **/ |
| 148 | 150 | public function library($library = '', $params = NULL, $object_name = NULL) {
|
| 149 | 151 | |
| 150 | - if (is_array($library)) return $this->libraries($library); |
|
| 152 | + if (is_array($library)) { |
|
| 153 | + return $this->libraries($library); |
|
| 154 | + } |
|
| 151 | 155 | |
| 152 | 156 | $class = strtolower(basename($library)); |
| 153 | 157 | |
| 154 | - if (isset($this->_ci_classes[$class]) AND $_alias = $this->_ci_classes[$class]) |
|
| 155 | - return CI::$APP->$_alias; |
|
| 158 | + if (isset($this->_ci_classes[$class]) AND $_alias = $this->_ci_classes[$class]) { |
|
| 159 | + return CI::$APP->$_alias; |
|
| 160 | + } |
|
| 156 | 161 | |
| 157 | 162 | ($_alias = strtolower($object_name)) OR $_alias = $class; |
| 158 | 163 | |
@@ -234,13 +239,17 @@ discard block |
||
| 234 | 239 | |
| 235 | 240 | /** Load an array of models **/ |
| 236 | 241 | public function models($models) {
|
| 237 | - foreach ($models as $_model) $this->model($_model); |
|
| 242 | + foreach ($models as $_model) { |
|
| 243 | + $this->model($_model); |
|
| 244 | + } |
|
| 238 | 245 | } |
| 239 | 246 | |
| 240 | 247 | /** Load a module controller **/ |
| 241 | 248 | public function module($module, $params = NULL) {
|
| 242 | 249 | |
| 243 | - if (is_array($module)) return $this->modules($module); |
|
| 250 | + if (is_array($module)) { |
|
| 251 | + return $this->modules($module); |
|
| 252 | + } |
|
| 244 | 253 | |
| 245 | 254 | $_alias = strtolower(basename($module)); |
| 246 | 255 | CI::$APP->$_alias = Modules::load(array($module => $params)); |
@@ -249,16 +258,21 @@ discard block |
||
| 249 | 258 | |
| 250 | 259 | /** Load an array of controllers **/ |
| 251 | 260 | public function modules($modules) {
|
| 252 | - foreach ($modules as $_module) $this->module($_module); |
|
| 261 | + foreach ($modules as $_module) { |
|
| 262 | + $this->module($_module); |
|
| 263 | + } |
|
| 253 | 264 | } |
| 254 | 265 | |
| 255 | 266 | /** Load a module plugin **/ |
| 256 | 267 | public function plugin($plugin) {
|
| 257 | 268 | |
| 258 | - if (is_array($plugin)) return $this->plugins($plugin); |
|
| 269 | + if (is_array($plugin)) { |
|
| 270 | + return $this->plugins($plugin); |
|
| 271 | + } |
|
| 259 | 272 | |
| 260 | - if (isset($this->_ci_plugins[$plugin])) |
|
| 261 | - return; |
|
| 273 | + if (isset($this->_ci_plugins[$plugin])) { |
|
| 274 | + return; |
|
| 275 | + } |
|
| 262 | 276 | |
| 263 | 277 | list($path, $_plugin) = Modules::find($plugin.'_pi', $this->_module, 'plugins/'); |
| 264 | 278 | |
@@ -314,20 +328,26 @@ discard block |
||
| 314 | 328 | break; |
| 315 | 329 | } |
| 316 | 330 | |
| 317 | - if ( ! $cascade) break; |
|
| 331 | + if ( ! $cascade) { |
|
| 332 | + break; |
|
| 333 | + } |
|
| 318 | 334 | } |
| 319 | 335 | |
| 320 | 336 | } elseif (isset($_ci_path)) {
|
| 321 | 337 | |
| 322 | 338 | $_ci_file = basename($_ci_path); |
| 323 | - if ( ! file_exists($_ci_path)) $_ci_path = ''; |
|
| 339 | + if ( ! file_exists($_ci_path)) { |
|
| 340 | + $_ci_path = ''; |
|
| 341 | + } |
|
| 324 | 342 | } |
| 325 | 343 | |
| 326 | - if (empty($_ci_path)) |
|
| 327 | - show_error('Unable to load the requested file: '.$_ci_file);
|
|
| 344 | + if (empty($_ci_path)) { |
|
| 345 | + show_error('Unable to load the requested file: '.$_ci_file); |
|
| 346 | + } |
|
| 328 | 347 | |
| 329 | - if (isset($_ci_vars)) |
|
| 330 | - $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, (array)$_ci_vars); |
|
| 348 | + if (isset($_ci_vars)) { |
|
| 349 | + $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, (array)$_ci_vars); |
|
| 350 | + } |
|
| 331 | 351 | |
| 332 | 352 | extract($this->_ci_cached_vars); |
| 333 | 353 | |
@@ -31,11 +31,11 @@ |
||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | - function customer_list_status($id){ |
|
| 34 | + function customer_list_status($id) { |
|
| 35 | 35 | $post_data = $this->input->post(); |
| 36 | - $post_data['table']=$this->common->decode($post_data['table']); |
|
| 37 | - $data['status']=$post_data['status'] =='true'? 0:1; |
|
| 38 | - $result=$post_data['table'] =='accounts' && $post_data['id'] == 1 ? null:$this->db->update($post_data['table'],$data,array("id"=>$post_data['id'])); |
|
| 36 | + $post_data['table'] = $this->common->decode($post_data['table']); |
|
| 37 | + $data['status'] = $post_data['status'] == 'true' ? 0 : 1; |
|
| 38 | + $result = $post_data['table'] == 'accounts' && $post_data['id'] == 1 ? null : $this->db->update($post_data['table'], $data, array("id"=>$post_data['id'])); |
|
| 39 | 39 | echo TRUE; |
| 40 | 40 | } |
| 41 | 41 | |