@@ -42,18 +42,18 @@ |
||
| 42 | 42 | </div> |
| 43 | 43 | </div> |
| 44 | 44 | <?php |
| 45 | - $astpp_msg = false; |
|
| 46 | - $msg_type = ""; |
|
| 47 | - $astpp_err_msg = $this->session->flashdata('astpp_errormsg');
|
|
| 48 | - if ($astpp_err_msg) {
|
|
| 49 | - $astpp_msg = $astpp_err_msg; |
|
| 50 | - $msg_type = "error"; |
|
| 51 | - } |
|
| 45 | + $astpp_msg = false; |
|
| 46 | + $msg_type = ""; |
|
| 47 | + $astpp_err_msg = $this->session->flashdata('astpp_errormsg');
|
|
| 48 | + if ($astpp_err_msg) {
|
|
| 49 | + $astpp_msg = $astpp_err_msg; |
|
| 50 | + $msg_type = "error"; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | $astpp_notify_msg = $this->session->flashdata('astpp_notification');
|
| 54 | 54 | if ($astpp_notify_msg) {
|
| 55 | - $astpp_msg = $astpp_notify_msg; |
|
| 56 | - $msg_type = "notification"; |
|
| 55 | + $astpp_msg = $astpp_notify_msg; |
|
| 56 | + $msg_type = "notification"; |
|
| 57 | 57 | } |
| 58 | 58 | if($astpp_msg){
|
| 59 | 59 | ?> |
@@ -131,32 +131,32 @@ discard block |
||
| 131 | 131 | <li> |
| 132 | 132 | |
| 133 | 133 | <?php |
| 134 | - $acc_info=$this->session->userdata('accountinfo'); |
|
| 135 | - if($this->session->userdata('userlevel_logintype') != '0'){?> |
|
| 134 | + $acc_info=$this->session->userdata('accountinfo'); |
|
| 135 | + if($this->session->userdata('userlevel_logintype') != '0'){?> |
|
| 136 | 136 | <a href="<?php echo base_url();?>dashboard/" class=""> <? } else{?> |
| 137 | 137 | <a href="<?php echo base_url();?>user/user/" class=""> |
| 138 | 138 | <? } |
| 139 | - if($this->session->userdata('logintype')!=2){ |
|
| 140 | - $result=(array)$this->db->get_where('accounts',array("id"=>$acc_info['id']),1)->first_row(); |
|
| 139 | + if($this->session->userdata('logintype')!=2){ |
|
| 140 | + $result=(array)$this->db->get_where('accounts',array("id"=>$acc_info['id']),1)->first_row(); |
|
| 141 | 141 | $variable =$result['posttoexternal']==1 ? 'Credit' : gettext('Bal'); |
| 142 | 142 | $amount=$result['posttoexternal']==1 ? $result['credit_limit'] :$result['balance']; |
| 143 | - $value= $this->common_model->calculate_currency($amount,'','',true); |
|
| 144 | - if($value >0){ |
|
| 145 | - $color='#397A13'; |
|
| 146 | - } |
|
| 147 | - if($value < 0){ |
|
| 148 | - $color='#EE0E43'; |
|
| 149 | - } |
|
| 150 | - if($value == 0){ |
|
| 151 | - $color='#1A1919'; |
|
| 152 | - } |
|
| 153 | - $balance_str = '<span style="color:'.$color.'; font-size: 10px;"><b>('.$variable.' : '.$value.')</b></span>'; |
|
| 154 | - }else{ |
|
| 155 | - $balance_str = ''; |
|
| 156 | - } |
|
| 143 | + $value= $this->common_model->calculate_currency($amount,'','',true); |
|
| 144 | + if($value >0){ |
|
| 145 | + $color='#397A13'; |
|
| 146 | + } |
|
| 147 | + if($value < 0){ |
|
| 148 | + $color='#EE0E43'; |
|
| 149 | + } |
|
| 150 | + if($value == 0){ |
|
| 151 | + $color='#1A1919'; |
|
| 152 | + } |
|
| 153 | + $balance_str = '<span style="color:'.$color.'; font-size: 10px;"><b>('.$variable.' : '.$value.')</b></span>'; |
|
| 154 | + }else{ |
|
| 155 | + $balance_str = ''; |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | 158 | $logged_user=$acc_info['first_name']." ".$acc_info['last_name']; |
| 159 | - ?> |
|
| 159 | + ?> |
|
| 160 | 160 | <span> |
| 161 | 161 | <span class="profile_name"> |
| 162 | 162 | <?= $logged_user?> |
@@ -203,27 +203,27 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | <?php |
| 205 | 205 | $menu_info = unserialize($this->session->userdata("menuinfo")); |
| 206 | - foreach($menu_info as $menu_key => $menu_values){ |
|
| 206 | + foreach($menu_info as $menu_key => $menu_values){ |
|
| 207 | 207 | ?> |
| 208 | 208 | |
| 209 | 209 | <?php |
| 210 | 210 | if(common_model::$global_config['system_config']['opensips']== 0 && $menu_key !='SIP Devices'){ |
| 211 | - echo '<li><a href="">'.gettext($menu_key).'<b class="caret"></b></a>'; |
|
| 211 | + echo '<li><a href="">'.gettext($menu_key).'<b class="caret"></b></a>'; |
|
| 212 | 212 | } |
| 213 | 213 | if(common_model::$global_config['system_config']['opensips']== 1 && $menu_key != 'Opensips'){ |
| 214 | - echo '<li><a href="">'.gettext($menu_key).'<b class="caret"></b></a>'; |
|
| 214 | + echo '<li><a href="">'.gettext($menu_key).'<b class="caret"></b></a>'; |
|
| 215 | 215 | } |
| 216 | - ?> |
|
| 216 | + ?> |
|
| 217 | 217 | |
| 218 | 218 | <ul class="dropdown-menu"> |
| 219 | 219 | <? foreach($menu_values as $sub_menu_key => $sub_menu_values){?> |
| 220 | 220 | |
| 221 | 221 | <? if($sub_menu_key === 0){ ?> |
| 222 | 222 | <? foreach($sub_menu_values as $sub_key => $sub_menu_lables){ |
| 223 | - if((common_model::$global_config['system_config']['paypal_status']== 1 && strtolower($sub_menu_lables["menu_label"]) =='recharge') ||(common_model::$global_config['system_config']['opensips']== 1 && $sub_menu_lables["menu_label"] =='Opensips')|| |
|
| 224 | - (common_model::$global_config['system_config']['opensips']== 0 && $sub_menu_lables["menu_label"] =='SIP Devices') || |
|
| 225 | - (($acc_info['type'] == '3' || $acc_info['type'] == '0') && $acc_info['allow_ip_management'] == '1' && strtolower($sub_menu_lables["menu_label"]) == 'ip settings')){ |
|
| 226 | - }else{?> |
|
| 223 | + if((common_model::$global_config['system_config']['paypal_status']== 1 && strtolower($sub_menu_lables["menu_label"]) =='recharge') ||(common_model::$global_config['system_config']['opensips']== 1 && $sub_menu_lables["menu_label"] =='Opensips')|| |
|
| 224 | + (common_model::$global_config['system_config']['opensips']== 0 && $sub_menu_lables["menu_label"] =='SIP Devices') || |
|
| 225 | + (($acc_info['type'] == '3' || $acc_info['type'] == '0') && $acc_info['allow_ip_management'] == '1' && strtolower($sub_menu_lables["menu_label"]) == 'ip settings')){ |
|
| 226 | + }else{?> |
|
| 227 | 227 | <li><a href="<?php echo base_url().$sub_menu_lables["module_url"];?>"><?php echo gettext($sub_menu_lables["menu_label"]);?></a></li> |
| 228 | 228 | <?}?> |
| 229 | 229 | <?} ?> |
@@ -235,13 +235,13 @@ discard block |
||
| 235 | 235 | <?php }if(($acc_info['type']==3 || $acc_info['type']== 0) && $acc_info['allow_ip_management']== 1 && strtolower($sub_menu_lables["menu_label"]) !='ip settings'){ ?> |
| 236 | 236 | <li><a href=""><span><?=$sub_menu_key;?></span><i class="fa fa-caret-right pull-right"></i></a> |
| 237 | 237 | <? } |
| 238 | - ?> |
|
| 238 | + ?> |
|
| 239 | 239 | <div class="col-4"><div class="col-md-6 no-padding"> |
| 240 | 240 | <ul class="col-12 padding-x-8"> |
| 241 | 241 | <? foreach($sub_menu_values as $sub_menu_lables){ |
| 242 | - if($sub_menu_lables['menu_label'] != 'Configuration'){ |
|
| 242 | + if($sub_menu_lables['menu_label'] != 'Configuration'){ |
|
| 243 | 243 | if(common_model::$global_config['system_config']['opensips']==0 && $sub_menu_lables["menu_label"] !='SIP Devices'){ |
| 244 | - ?> |
|
| 244 | + ?> |
|
| 245 | 245 | <li><a href="<?php echo base_url().$sub_menu_lables["module_url"];?>"><?php echo gettext($sub_menu_lables["menu_label"]);?></a></li> |
| 246 | 246 | <? } |
| 247 | 247 | if(common_model::$global_config['system_config']['opensips']== 1 && $sub_menu_key !='opensips'){ ?> |
@@ -251,12 +251,12 @@ discard block |
||
| 251 | 251 | } ?> |
| 252 | 252 | </ul></div></div> |
| 253 | 253 | <?} |
| 254 | - } ?> |
|
| 254 | + } ?> |
|
| 255 | 255 | </ul> |
| 256 | 256 | </li> |
| 257 | 257 | <? } |
| 258 | - echo '<li> </li>'; |
|
| 259 | - ?> |
|
| 258 | + echo '<li> </li>'; |
|
| 259 | + ?> |
|
| 260 | 260 | </ul> |
| 261 | 261 | </div> |
| 262 | 262 | </div> |
@@ -31,18 +31,18 @@ discard block |
||
| 31 | 31 | </div> |
| 32 | 32 | </div> |
| 33 | 33 | <?php |
| 34 | - $astpp_msg = false; |
|
| 35 | - $msg_type = ""; |
|
| 36 | - $astpp_err_msg = $this->session->flashdata('astpp_errormsg');
|
|
| 37 | - if ($astpp_err_msg) {
|
|
| 38 | - $astpp_msg = $astpp_err_msg; |
|
| 39 | - $msg_type = "error"; |
|
| 40 | - } |
|
| 34 | + $astpp_msg = false; |
|
| 35 | + $msg_type = ""; |
|
| 36 | + $astpp_err_msg = $this->session->flashdata('astpp_errormsg');
|
|
| 37 | + if ($astpp_err_msg) {
|
|
| 38 | + $astpp_msg = $astpp_err_msg; |
|
| 39 | + $msg_type = "error"; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | $astpp_notify_msg = $this->session->flashdata('astpp_notification');
|
| 43 | 43 | if ($astpp_notify_msg) {
|
| 44 | - $astpp_msg = $astpp_notify_msg; |
|
| 45 | - $msg_type = "notification"; |
|
| 44 | + $astpp_msg = $astpp_notify_msg; |
|
| 45 | + $msg_type = "notification"; |
|
| 46 | 46 | } |
| 47 | 47 | if($astpp_msg){
|
| 48 | 48 | ?> |
@@ -61,92 +61,92 @@ discard block |
||
| 61 | 61 | <div class="sidebar collapse"> |
| 62 | 62 | |
| 63 | 63 | <?php |
| 64 | - $uri_string= uri_string(); |
|
| 65 | - $uri_arr=explode("/",$uri_string);
|
|
| 66 | - $entity_name=false; |
|
| 67 | - if(isset($uri_arr[1]) && !empty($uri_arr[1])){
|
|
| 68 | - $function_explode=explode("_",$uri_arr[1]);
|
|
| 69 | - $entity_name = isset($function_explode[1]) && !empty($function_explode[1]) ? $function_explode[0] : false; |
|
| 70 | - } |
|
| 64 | + $uri_string= uri_string(); |
|
| 65 | + $uri_arr=explode("/",$uri_string);
|
|
| 66 | + $entity_name=false; |
|
| 67 | + if(isset($uri_arr[1]) && !empty($uri_arr[1])){
|
|
| 68 | + $function_explode=explode("_",$uri_arr[1]);
|
|
| 69 | + $entity_name = isset($function_explode[1]) && !empty($function_explode[1]) ? $function_explode[0] : false; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - $accountinfo=$this->session->userdata('accountinfo');
|
|
| 73 | - if($accountinfo['type'] != 0 && $accountinfo['type'] !=3){
|
|
| 74 | - $menu_info= ($uri_arr[0]=="user" |
|
| 75 | - ? unserialize(RESELLERPROFILE_ARRAY):($uri_arr[0]=="accounts"&& $entity_name =='customer' |
|
| 76 | - ? unserialize(CUSTOMEREDIT_ARRAY) :($uri_arr[0]=="accounts"&& $entity_name =='provider' |
|
| 77 | - ? unserialize(PROVIDEREDIT_ARRAY) :($uri_arr[0]=="accounts"&& $entity_name =='reseller' |
|
| 78 | - ? unserialize(RESELLEREDIT_ARRAY) : ($uri_arr[0] =="package" ? unserialize(PACKAGEEDIT_ARRAY):false) )))); |
|
| 79 | - }else{
|
|
| 80 | - $menu_info=null; |
|
| 81 | - $current_menu_url=$uri_arr[0]."/".$uri_arr[1]."/"; |
|
| 82 | - $new_menu_info=array(); |
|
| 83 | - $menus= unserialize($this->session->userdata('menuinfo'));
|
|
| 84 | - foreach($menus as $entity_key=>$entity_menu){
|
|
| 85 | - foreach($entity_menu as $entity_subkey=>$entity_submenu){
|
|
| 86 | - foreach($entity_submenu as $subkey=>$submenus){
|
|
| 87 | - if($submenus['module_url']==$current_menu_url){
|
|
| 88 | - $new_menu_info=$entity_menu; |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - } |
|
| 93 | - foreach($new_menu_info as $key=>$value){
|
|
| 94 | - foreach($value as $subvalue){
|
|
| 95 | - $menu_info[$subvalue['menu_label']]=$subvalue['module_url']; |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - } |
|
| 99 | - if($accountinfo['type']==0 || $accountinfo['type']==3){
|
|
| 100 | - if($uri_arr[0]=='user' && $uri_arr[1] =='user_myprofile' || $uri_arr[0]=='user' && $uri_arr[1]=='user_change_password'){
|
|
| 72 | + $accountinfo=$this->session->userdata('accountinfo');
|
|
| 73 | + if($accountinfo['type'] != 0 && $accountinfo['type'] !=3){
|
|
| 74 | + $menu_info= ($uri_arr[0]=="user" |
|
| 75 | + ? unserialize(RESELLERPROFILE_ARRAY):($uri_arr[0]=="accounts"&& $entity_name =='customer' |
|
| 76 | + ? unserialize(CUSTOMEREDIT_ARRAY) :($uri_arr[0]=="accounts"&& $entity_name =='provider' |
|
| 77 | + ? unserialize(PROVIDEREDIT_ARRAY) :($uri_arr[0]=="accounts"&& $entity_name =='reseller' |
|
| 78 | + ? unserialize(RESELLEREDIT_ARRAY) : ($uri_arr[0] =="package" ? unserialize(PACKAGEEDIT_ARRAY):false) )))); |
|
| 79 | + }else{
|
|
| 80 | + $menu_info=null; |
|
| 81 | + $current_menu_url=$uri_arr[0]."/".$uri_arr[1]."/"; |
|
| 82 | + $new_menu_info=array(); |
|
| 83 | + $menus= unserialize($this->session->userdata('menuinfo'));
|
|
| 84 | + foreach($menus as $entity_key=>$entity_menu){
|
|
| 85 | + foreach($entity_menu as $entity_subkey=>$entity_submenu){
|
|
| 86 | + foreach($entity_submenu as $subkey=>$submenus){
|
|
| 87 | + if($submenus['module_url']==$current_menu_url){
|
|
| 88 | + $new_menu_info=$entity_menu; |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | + foreach($new_menu_info as $key=>$value){
|
|
| 94 | + foreach($value as $subvalue){
|
|
| 95 | + $menu_info[$subvalue['menu_label']]=$subvalue['module_url']; |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | + if($accountinfo['type']==0 || $accountinfo['type']==3){
|
|
| 100 | + if($uri_arr[0]=='user' && $uri_arr[1] =='user_myprofile' || $uri_arr[0]=='user' && $uri_arr[1]=='user_change_password'){
|
|
| 101 | 101 | $menu_info=unserialize(CUSTOMERPROFILE_ARRAY); |
| 102 | - } |
|
| 103 | - } |
|
| 104 | - if(!empty($menu_info)){
|
|
| 105 | - echo "<ul class='sidemenu'>"; |
|
| 106 | - $i=0; |
|
| 107 | - foreach($menu_info as $key=>$value){
|
|
| 108 | - $url=($entity_name=='provider'||$entity_name =='customer' || $entity_name =='reseller' || $uri_arr[0] =="package") && isset($uri_arr[2]) && !empty($uri_arr[2]) |
|
| 109 | - ? |
|
| 110 | - base_url().$value.$uri_arr[2]."/" : |
|
| 111 | - base_url().$value; |
|
| 112 | - $value_flag=false; |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | + if(!empty($menu_info)){
|
|
| 105 | + echo "<ul class='sidemenu'>"; |
|
| 106 | + $i=0; |
|
| 107 | + foreach($menu_info as $key=>$value){
|
|
| 108 | + $url=($entity_name=='provider'||$entity_name =='customer' || $entity_name =='reseller' || $uri_arr[0] =="package") && isset($uri_arr[2]) && !empty($uri_arr[2]) |
|
| 109 | + ? |
|
| 110 | + base_url().$value.$uri_arr[2]."/" : |
|
| 111 | + base_url().$value; |
|
| 112 | + $value_flag=false; |
|
| 113 | 113 | if($acc_info['type'] == '3' || $acc_info['type'] == '0'){
|
| 114 | 114 | if($value == "user/user_ipmap/" && $acc_info['allow_ip_management'] == '1'){
|
| 115 | - $value_flag=false; |
|
| 115 | + $value_flag=false; |
|
| 116 | 116 | }elseif(in_array('user/user_sipdevices/',$menu_info) && $value == "user/user_sipdevices/" && common_model::$global_config['system_config']['opensips']== 0){
|
| 117 | - $value_flag=false; |
|
| 117 | + $value_flag=false; |
|
| 118 | 118 | }else{
|
| 119 | - $value_flag=true; |
|
| 119 | + $value_flag=true; |
|
| 120 | 120 | } |
| 121 | - }else{
|
|
| 121 | + }else{
|
|
| 122 | 122 | if(common_model::$global_config['system_config']['opensips'] == 1 ){
|
| 123 | - if($value != "accounts/".$entity_name."_opensips/"){
|
|
| 123 | + if($value != "accounts/".$entity_name."_opensips/"){
|
|
| 124 | 124 | $value_flag=true; |
| 125 | - }else{
|
|
| 125 | + }else{
|
|
| 126 | 126 | $value_flag=false; |
| 127 | - } |
|
| 127 | + } |
|
| 128 | 128 | } |
| 129 | 129 | if(common_model::$global_config['system_config']['opensips']== 0 ){
|
| 130 | - if($value != "accounts/".$entity_name."_sipdevices/"){
|
|
| 130 | + if($value != "accounts/".$entity_name."_sipdevices/"){
|
|
| 131 | 131 | $value_flag=true; |
| 132 | - }else{
|
|
| 132 | + }else{
|
|
| 133 | 133 | $value_flag=false; |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | } |
| 136 | - } |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - if($value_flag){
|
|
| 139 | - $class = ($value == $uri_arr[0]."/".$uri_arr[1]."/" ) ? 'active' : ''; |
|
| 140 | - if($i==0) |
|
| 141 | - $class=($uri_arr[1]== $entity_name."_save") ? 'active': $class; |
|
| 138 | + if($value_flag){
|
|
| 139 | + $class = ($value == $uri_arr[0]."/".$uri_arr[1]."/" ) ? 'active' : ''; |
|
| 140 | + if($i==0) |
|
| 141 | + $class=($uri_arr[1]== $entity_name."_save") ? 'active': $class; |
|
| 142 | 142 | |
| 143 | - echo "<li class='$class'><a href ='$url'>$key</a></li>"; |
|
| 144 | - } |
|
| 145 | - $i++; |
|
| 146 | - } |
|
| 147 | - echo "</ul>"; |
|
| 148 | - } |
|
| 149 | - ?> |
|
| 143 | + echo "<li class='$class'><a href ='$url'>$key</a></li>"; |
|
| 144 | + } |
|
| 145 | + $i++; |
|
| 146 | + } |
|
| 147 | + echo "</ul>"; |
|
| 148 | + } |
|
| 149 | + ?> |
|
| 150 | 150 | </div> |
| 151 | 151 | <? start_block_marker('content') ?><? end_block_marker() ?>
|
| 152 | 152 | |
@@ -10,8 +10,8 @@ |
||
| 10 | 10 | $this->db->where('domain',$_SERVER['HTTP_HOST']); |
| 11 | 11 | $result=$this->db->get('invoice_conf'); |
| 12 | 12 | if($result->num_rows() > 0){ |
| 13 | - $result=$result->result_array(); |
|
| 14 | - $footer = $result[0]['website_footer']; |
|
| 13 | + $result=$result->result_array(); |
|
| 14 | + $footer = $result[0]['website_footer']; |
|
| 15 | 15 | }else{ |
| 16 | 16 | $footer = ''; |
| 17 | 17 | } |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | public static $routes, $registry, $locations; |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * Run a module controller method |
|
| 54 | - * Output from module is buffered and returned. |
|
| 55 | - **/ |
|
| 53 | + * Run a module controller method |
|
| 54 | + * Output from module is buffered and returned. |
|
| 55 | + **/ |
|
| 56 | 56 | public static function run($module) { |
| 57 | 57 | |
| 58 | 58 | $method = 'index'; |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | - * Find a file |
|
| 164 | - * Scans for files located within modules directories. |
|
| 165 | - * Also scans application directories for models, plugins and views. |
|
| 166 | - * Generates fatal error if file not found. |
|
| 167 | - **/ |
|
| 163 | + * Find a file |
|
| 164 | + * Scans for files located within modules directories. |
|
| 165 | + * Also scans application directories for models, plugins and views. |
|
| 166 | + * Generates fatal error if file not found. |
|
| 167 | + **/ |
|
| 168 | 168 | public static function find($file, $module, $base) { |
| 169 | 169 | |
| 170 | 170 | $segments = explode('/', $file); |
@@ -167,7 +167,7 @@ |
||
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | return CI::$APP->$_alias; |
| 170 | - } |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | 172 | /** Load an array of libraries **/ |
| 173 | 173 | public function libraries($libraries) {
|
@@ -23,459 +23,459 @@ |
||
| 23 | 23 | |
| 24 | 24 | class System_model extends CI_Model { |
| 25 | 25 | |
| 26 | - function System_model() { |
|
| 27 | - parent::__construct(); |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - function add_config($data) { |
|
| 31 | - $this->load->library("curl"); |
|
| 32 | - $url = "astpp-wraper.cgi"; |
|
| 33 | - $data['mode'] = "Configuration"; |
|
| 34 | - $data['action'] = "Add Item"; |
|
| 35 | - $data['logintype'] = $this->session->userdata('logintype'); |
|
| 36 | - $data['username'] = $this->session->userdata('username'); |
|
| 37 | - return $this->curl->sendRequestToPerlScript($url, $data); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - function edit_config($data) { |
|
| 41 | - $this->load->library("curl"); |
|
| 42 | - $url = "astpp-wraper.cgi"; |
|
| 43 | - $data['mode'] = "Configuration"; |
|
| 44 | - $data['action'] = "Save Item"; |
|
| 45 | - $data['logintype'] = $this->session->userdata('logintype'); |
|
| 46 | - $data['username'] = $this->session->userdata('username'); |
|
| 47 | - return $this->curl->sendRequestToPerlScript($url, $data); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - function get_config_by_id($id) { |
|
| 51 | - $this->db->where("id", $id); |
|
| 52 | - $query = $this->db->get("system"); |
|
| 53 | - |
|
| 54 | - if ($query->num_rows() > 0) |
|
| 55 | - return $query->row_array(); |
|
| 56 | - else |
|
| 57 | - return false; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - function remove_config($data) { |
|
| 61 | - $this->load->library("curl"); |
|
| 62 | - $url = "astpp-wraper.cgi"; |
|
| 63 | - $data['mode'] = "Configuration"; |
|
| 64 | - $data['action'] = "Delete"; |
|
| 65 | - $data['logintype'] = $this->session->userdata('logintype'); |
|
| 66 | - $data['username'] = $this->session->userdata('username'); |
|
| 67 | - return $this->curl->sendRequestToPerlScript($url, $data); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - function add_tax($data) { |
|
| 71 | - $this->load->library("curl"); |
|
| 72 | - $url = "astpp-wraper.cgi"; |
|
| 73 | - $data['mode'] = "Taxes"; |
|
| 74 | - $data['logintype'] = $this->session->userdata('logintype'); |
|
| 75 | - $data['username'] = $this->session->userdata('username'); |
|
| 76 | - $this->curl->sendRequestToPerlScript($url, $data); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - function edit_tax($data) { |
|
| 80 | - $this->load->library("curl"); |
|
| 81 | - $url = "astpp-wraper.cgi"; |
|
| 82 | - $data['mode'] = "Taxes"; |
|
| 83 | - $data['logintype'] = $this->session->userdata('logintype'); |
|
| 84 | - $data['username'] = $this->session->userdata('username'); |
|
| 85 | - $this->curl->sendRequestToPerlScript($url, $data); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - function get_tax_by_id($id) { |
|
| 89 | - $this->db->where("taxes_id", $id); |
|
| 90 | - $query = $this->db->get("taxes"); |
|
| 91 | - |
|
| 92 | - if ($query->num_rows() > 0) |
|
| 93 | - return $query->row_array(); |
|
| 94 | - else |
|
| 95 | - return false; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - function remove_tax($data) { |
|
| 99 | - $this->load->library("curl"); |
|
| 100 | - $url = "astpp-wraper.cgi"; |
|
| 101 | - $data['mode'] = "Taxes"; |
|
| 102 | - $data['action'] = "Delete"; |
|
| 103 | - $data['logintype'] = $this->session->userdata('logintype'); |
|
| 104 | - $data['username'] = $this->session->userdata('username'); |
|
| 105 | - $this->curl->sendRequestToPerlScript($url, $data); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - function purge_deactivated_records() { |
|
| 109 | - $this->load->library("curl"); |
|
| 110 | - $url = "astpp-wraper.cgi"; |
|
| 111 | - $data['mode'] = "Purge Deactivated"; |
|
| 112 | - $data['action'] = "Yes, Drop Them"; |
|
| 113 | - $data['logintype'] = $this->session->userdata('logintype'); |
|
| 114 | - $data['username'] = $this->session->userdata('username'); |
|
| 115 | - $feedback = $this->curl->sendRequestToPerlScript($url, $data); |
|
| 116 | - |
|
| 117 | - return $feedback = str_replace(".", ".<br />", $feedback); |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - function getTaxesCount() { |
|
| 121 | - if ($this->session->userdata('advance_search') == 1) { |
|
| 122 | - |
|
| 123 | - $taxes_search = $this->session->userdata('taxes_search'); |
|
| 124 | - |
|
| 125 | - $amount_operator = $taxes_search['amount_operator']; |
|
| 126 | - |
|
| 127 | - if (!empty($taxes_search['amount'])) { |
|
| 128 | - switch ($amount_operator) { |
|
| 129 | - case "1": |
|
| 130 | - $this->db->where('taxes_amount ', $taxes_search['amount']); |
|
| 131 | - break; |
|
| 132 | - case "2": |
|
| 133 | - $this->db->where('taxes_amount <>', $taxes_search['amount']); |
|
| 134 | - break; |
|
| 135 | - case "3": |
|
| 136 | - $this->db->where('taxes_amount > ', $taxes_search['amount']); |
|
| 137 | - break; |
|
| 138 | - case "4": |
|
| 139 | - $this->db->where('taxes_amount < ', $taxes_search['amount']); |
|
| 140 | - break; |
|
| 141 | - case "5": |
|
| 142 | - $this->db->where('taxes_amount >= ', $taxes_search['amount']); |
|
| 143 | - break; |
|
| 144 | - case "6": |
|
| 145 | - $this->db->where('taxes_amount <= ', $taxes_search['amount']); |
|
| 146 | - break; |
|
| 147 | - } |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - $rate_operator = $taxes_search['rate_operator']; |
|
| 151 | - |
|
| 152 | - if (!empty($taxes_search['rate'])) { |
|
| 153 | - switch ($rate_operator) { |
|
| 154 | - case "1": |
|
| 155 | - $this->db->where('taxes_rate ', $taxes_search['rate']); |
|
| 156 | - break; |
|
| 157 | - case "2": |
|
| 158 | - $this->db->where('taxes_rate <>', $taxes_search['rate']); |
|
| 159 | - break; |
|
| 160 | - case "3": |
|
| 161 | - $this->db->where('taxes_rate > ', $taxes_search['rate']); |
|
| 162 | - break; |
|
| 163 | - case "4": |
|
| 164 | - $this->db->where('taxes_rate < ', $taxes_search['rate']); |
|
| 165 | - break; |
|
| 166 | - case "5": |
|
| 167 | - $this->db->where('taxes_rate >= ', $taxes_search['rate']); |
|
| 168 | - break; |
|
| 169 | - case "6": |
|
| 170 | - $this->db->where('taxes_rate <= ', $taxes_search['rate']); |
|
| 171 | - break; |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - $description_operator = $taxes_search['description_operator']; |
|
| 176 | - if (!empty($taxes_search['description'])) { |
|
| 177 | - switch ($description_operator) { |
|
| 178 | - case "1": |
|
| 179 | - $this->db->like('taxes_description', $taxes_search['description']); |
|
| 180 | - break; |
|
| 181 | - case "2": |
|
| 182 | - $this->db->not_like('taxes_description', $taxes_search['description']); |
|
| 183 | - break; |
|
| 184 | - case "3": |
|
| 185 | - $this->db->where('taxes_description', $taxes_search['description']); |
|
| 186 | - break; |
|
| 187 | - case "4": |
|
| 188 | - $this->db->where('taxes_description <>', $taxes_search['description']); |
|
| 189 | - break; |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - } |
|
| 193 | - $this->db->from('taxes'); |
|
| 194 | - $providercnt = $this->db->count_all_results(); |
|
| 195 | - return $providercnt; |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - function getTaxesList($start, $limit) { |
|
| 199 | - if ($this->session->userdata('advance_search') == 1) { |
|
| 200 | - |
|
| 201 | - $taxes_search = $this->session->userdata('taxes_search'); |
|
| 202 | - |
|
| 203 | - $amount_operator = $taxes_search['amount_operator']; |
|
| 204 | - |
|
| 205 | - if (!empty($taxes_search['amount'])) { |
|
| 206 | - switch ($amount_operator) { |
|
| 207 | - case "1": |
|
| 208 | - $this->db->where('taxes_amount =', $taxes_search['amount']); |
|
| 209 | - break; |
|
| 210 | - case "2": |
|
| 211 | - $this->db->where('taxes_amount <>', $taxes_search['amount']); |
|
| 212 | - break; |
|
| 213 | - case "3": |
|
| 214 | - $this->db->where('taxes_amount > ', $taxes_search['amount']); |
|
| 215 | - break; |
|
| 216 | - case "4": |
|
| 217 | - $this->db->where('taxes_amount < ', $taxes_search['amount']); |
|
| 218 | - break; |
|
| 219 | - case "5": |
|
| 220 | - $this->db->where('taxes_amount >= ', $taxes_search['amount']); |
|
| 221 | - break; |
|
| 222 | - case "6": |
|
| 223 | - $this->db->where('taxes_amount <= ', $taxes_search['amount']); |
|
| 224 | - break; |
|
| 225 | - } |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - $rate_operator = $taxes_search['rate_operator']; |
|
| 229 | - |
|
| 230 | - if (!empty($taxes_search['rate'])) { |
|
| 231 | - switch ($rate_operator) { |
|
| 232 | - case "1": |
|
| 233 | - $this->db->where('taxes_rate == ', $taxes_search['rate']); |
|
| 234 | - break; |
|
| 235 | - case "2": |
|
| 236 | - $this->db->where('taxes_rate <>', $taxes_search['rate']); |
|
| 237 | - break; |
|
| 238 | - case "3": |
|
| 239 | - $this->db->where('taxes_rate > ', $taxes_search['rate']); |
|
| 240 | - break; |
|
| 241 | - case "4": |
|
| 242 | - $this->db->where('taxes_rate < ', $taxes_search['rate']); |
|
| 243 | - break; |
|
| 244 | - case "5": |
|
| 245 | - $this->db->where('taxes_rate >= ', $taxes_search['rate']); |
|
| 246 | - break; |
|
| 247 | - case "6": |
|
| 248 | - $this->db->where('taxes_rate <= ', $taxes_search['rate']); |
|
| 249 | - break; |
|
| 250 | - } |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - $description_operator = $taxes_search['description_operator']; |
|
| 254 | - if (!empty($taxes_search['description'])) { |
|
| 255 | - switch ($description_operator) { |
|
| 256 | - case "1": |
|
| 257 | - $this->db->like('taxes_description', $taxes_search['description']); |
|
| 258 | - break; |
|
| 259 | - case "2": |
|
| 260 | - $this->db->not_like('taxes_description', $taxes_search['description']); |
|
| 261 | - break; |
|
| 262 | - case "3": |
|
| 263 | - $this->db->where('taxes_description', $taxes_search['description']); |
|
| 264 | - break; |
|
| 265 | - case "4": |
|
| 266 | - $this->db->where('taxes_description <>', $taxes_search['description']); |
|
| 267 | - break; |
|
| 268 | - } |
|
| 269 | - } |
|
| 270 | - } |
|
| 271 | - $this->db->limit($limit, $start); |
|
| 272 | - $this->db->order_by("taxes_priority,taxes_description desc"); |
|
| 273 | - $this->db->from('taxes'); |
|
| 274 | - $query = $this->db->get(); |
|
| 275 | - //echo $this->db->last_query(); |
|
| 276 | - return $query; |
|
| 277 | - } |
|
| 278 | - |
|
| 279 | - function getAuthInfo() { |
|
| 280 | - $this->db->where('name', 'auth'); |
|
| 281 | - $this->db->limit(1); |
|
| 282 | - $query = $this->db->get('system'); |
|
| 283 | - if ($query->num_rows() > 0) { |
|
| 284 | - return $query->result(); |
|
| 285 | - } |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - function get_template_count() { |
|
| 289 | - if ($this->session->userdata['userlevel_logintype'] == 1 || $this->session->userdata['userlevel_logintype'] == 4 || $this->session->userdata['userlevel_logintype'] == 5) { |
|
| 290 | - $acountid = $this->session->userdata['accountinfo']['accountid']; |
|
| 291 | - $this->db->where('accountid', $acountid); |
|
| 292 | - } |
|
| 293 | - return $this->db->get('templates'); |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - function get_templates() { |
|
| 297 | - if ($this->session->userdata('advance_search') == 1) { |
|
| 298 | - $templatesearch = $this->session->userdata('template_search'); |
|
| 299 | - $template_name_operator = $templatesearch['template_name_operator']; |
|
| 300 | - |
|
| 301 | - |
|
| 302 | - if (!empty($templatesearch['template_name'])) { |
|
| 303 | - switch ($template_name_operator) { |
|
| 304 | - case "1": |
|
| 305 | - $this->db->like('name', $templatesearch['template_name']); |
|
| 306 | - break; |
|
| 307 | - case "2": |
|
| 308 | - $this->db->not_like('name', $templatesearch['template_name']); |
|
| 309 | - break; |
|
| 310 | - case "3": |
|
| 311 | - $this->db->where('name', $templatesearch['template_name']); |
|
| 312 | - break; |
|
| 313 | - case "4": |
|
| 314 | - $this->db->where('name <>', $templatesearch['template_name']); |
|
| 315 | - break; |
|
| 316 | - } |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - $template_subject = $templatesearch['subject_operator']; |
|
| 320 | - if (!empty($templatesearch['subject'])) { |
|
| 321 | - switch ($template_subject) { |
|
| 322 | - case "1": |
|
| 323 | - $this->db->like('subject', $templatesearch['subject']); |
|
| 324 | - break; |
|
| 325 | - case "2": |
|
| 326 | - $this->db->not_like('subject', $templatesearch['subject']); |
|
| 327 | - break; |
|
| 328 | - case "3": |
|
| 329 | - $this->db->where('subject', $templatesearch['subject']); |
|
| 330 | - break; |
|
| 331 | - case "4": |
|
| 332 | - $this->db->where('subject <>', $templatesearch['subject']); |
|
| 333 | - break; |
|
| 334 | - } |
|
| 335 | - } |
|
| 336 | - $template_op = $templatesearch['template_operator']; |
|
| 337 | - if (!empty($templatesearch['template_desc'])) { |
|
| 338 | - |
|
| 339 | - switch ($template_op) { |
|
| 340 | - case "1": |
|
| 341 | - $this->db->like('template', mysql_real_escape_string(($templatesearch['template_desc']))); |
|
| 342 | - break; |
|
| 343 | - case "2": |
|
| 344 | - $this->db->not_like('template', mysql_real_escape_string($templatesearch['template_desc'])); |
|
| 345 | - break; |
|
| 346 | - case "3": |
|
| 347 | - $this->db->where('template', mysql_real_escape_string($templatesearch['template_desc'])); |
|
| 348 | - break; |
|
| 349 | - case "4": |
|
| 350 | - $this->db->where('template <>', mysql_real_escape_string($templatesearch['template_desc'])); |
|
| 351 | - break; |
|
| 352 | - } |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - |
|
| 356 | - if (!empty($templatesearch['accountid'])) { |
|
| 357 | - $this->db->like('accountid', $templatesearch['accountid']); |
|
| 358 | - } |
|
| 359 | - } |
|
| 360 | - |
|
| 361 | - if ($this->session->userdata['userlevel_logintype'] == 1 || $this->session->userdata['userlevel_logintype'] == 4 || $this->session->userdata['userlevel_logintype'] == 5) { |
|
| 362 | - $acountid = $this->session->userdata['accountinfo']['accountid']; |
|
| 363 | - $this->db->where('accountid', $acountid); |
|
| 364 | - } |
|
| 365 | - return $this->db->get('templates'); |
|
| 366 | - } |
|
| 367 | - |
|
| 368 | - function get_template_by_id($id) { |
|
| 369 | - $this->db->delete('templates', array('id' => $id)); |
|
| 370 | - return true; |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - function get_template_by_id_all($id) { |
|
| 374 | - $this->db->where('id', $id); |
|
| 375 | - $query = $this->db->get('templates'); |
|
| 376 | - if ($query->num_rows() > 0) |
|
| 377 | - return $query->row_array(); |
|
| 378 | - else |
|
| 379 | - return false; |
|
| 380 | - } |
|
| 381 | - |
|
| 382 | - function edit_template($edit_id, $data) { |
|
| 383 | - $updatedata = array( |
|
| 384 | - "name" => trim($data['tem_name']), |
|
| 385 | - "template" => trim($data['template']), |
|
| 386 | - "subject" => trim($data['subject']), |
|
| 387 | - "modified_date" => trim(date('Y-m-d H:i:s')) |
|
| 388 | - ); |
|
| 389 | - $this->db->where('id', $edit_id); |
|
| 390 | - $this->db->update('templates', $updatedata); |
|
| 391 | - return true; |
|
| 392 | - } |
|
| 393 | - |
|
| 394 | - function build_systems_configuration() { |
|
| 395 | - if ($this->session->userdata('advance_search') == 1) { |
|
| 396 | - $configuration_search = $this->session->userdata('configuration_search'); |
|
| 397 | - |
|
| 398 | - if (!empty($configuration_search['reseller'])) { |
|
| 399 | - $this->db->where('reseller ', $configuration_search['reseller']); |
|
| 400 | - } |
|
| 401 | - if (!empty($configuration_search['brand'])) { |
|
| 402 | - $this->db->where('brand', $configuration_search['brand']); |
|
| 403 | - } |
|
| 404 | - if (!empty($configuration_search['group_title'])) { |
|
| 405 | - $this->db->where('group_title', $configuration_search['group_title']); |
|
| 406 | - } |
|
| 407 | - |
|
| 408 | - $name_operator = $configuration_search['name_operator']; |
|
| 409 | - |
|
| 410 | - if (!empty($configuration_search['name'])) { |
|
| 411 | - switch ($name_operator) { |
|
| 412 | - case "1": |
|
| 413 | - $this->db->like('name', $configuration_search['name']); |
|
| 414 | - break; |
|
| 415 | - case "2": |
|
| 416 | - $this->db->not_like('name', $configuration_search['name']); |
|
| 417 | - break; |
|
| 418 | - case "3": |
|
| 419 | - $this->db->where('name', $configuration_search['name']); |
|
| 420 | - break; |
|
| 421 | - case "4": |
|
| 422 | - $this->db->where('name <>', $configuration_search['name']); |
|
| 423 | - break; |
|
| 424 | - } |
|
| 425 | - } |
|
| 426 | - |
|
| 427 | - $value_operator = $configuration_search['value_operator']; |
|
| 428 | - |
|
| 429 | - if (!empty($configuration_search['value'])) { |
|
| 430 | - switch ($value_operator) { |
|
| 431 | - case "1": |
|
| 432 | - $this->db->like('value', $configuration_search['value']); |
|
| 433 | - break; |
|
| 434 | - case "2": |
|
| 435 | - $this->db->not_like('value', $configuration_search['value']); |
|
| 436 | - break; |
|
| 437 | - case "3": |
|
| 438 | - $this->db->where('value', $configuration_search['value']); |
|
| 439 | - break; |
|
| 440 | - case "4": |
|
| 441 | - $this->db->where('value <>', $configuration_search['value']); |
|
| 442 | - break; |
|
| 443 | - } |
|
| 444 | - } |
|
| 445 | - |
|
| 446 | - $comment_operator = $configuration_search['comment_operator']; |
|
| 447 | - |
|
| 448 | - if (!empty($configuration_search['comment'])) { |
|
| 449 | - switch ($comment_operator) { |
|
| 450 | - case "1": |
|
| 451 | - $this->db->like('comment', $configuration_search['comment']); |
|
| 452 | - break; |
|
| 453 | - case "2": |
|
| 454 | - $this->db->not_like('comment', $configuration_search['comment']); |
|
| 455 | - break; |
|
| 456 | - case "3": |
|
| 457 | - $this->db->where('comment', $configuration_search['comment']); |
|
| 458 | - break; |
|
| 459 | - case "4": |
|
| 460 | - $this->db->where('comment <>', $configuration_search['comment']); |
|
| 461 | - break; |
|
| 462 | - } |
|
| 463 | - } |
|
| 464 | - } |
|
| 465 | - } |
|
| 466 | - |
|
| 467 | - function systems_configuration($flag, $start = '', $limit = '') { |
|
| 468 | - $this->build_systems_configuration(); |
|
| 469 | - $this->db->from('system'); |
|
| 470 | - if ($flag) { |
|
| 471 | - $this->db->order_by("id ASC"); |
|
| 472 | - $this->db->limit($limit, $start); |
|
| 473 | - $query = $this->db->get(); |
|
| 474 | - } else { |
|
| 475 | - $query = $this->db->count_all_results(); |
|
| 476 | - } |
|
| 477 | - return $query; |
|
| 478 | - } |
|
| 26 | + function System_model() { |
|
| 27 | + parent::__construct(); |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + function add_config($data) { |
|
| 31 | + $this->load->library("curl"); |
|
| 32 | + $url = "astpp-wraper.cgi"; |
|
| 33 | + $data['mode'] = "Configuration"; |
|
| 34 | + $data['action'] = "Add Item"; |
|
| 35 | + $data['logintype'] = $this->session->userdata('logintype'); |
|
| 36 | + $data['username'] = $this->session->userdata('username'); |
|
| 37 | + return $this->curl->sendRequestToPerlScript($url, $data); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + function edit_config($data) { |
|
| 41 | + $this->load->library("curl"); |
|
| 42 | + $url = "astpp-wraper.cgi"; |
|
| 43 | + $data['mode'] = "Configuration"; |
|
| 44 | + $data['action'] = "Save Item"; |
|
| 45 | + $data['logintype'] = $this->session->userdata('logintype'); |
|
| 46 | + $data['username'] = $this->session->userdata('username'); |
|
| 47 | + return $this->curl->sendRequestToPerlScript($url, $data); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + function get_config_by_id($id) { |
|
| 51 | + $this->db->where("id", $id); |
|
| 52 | + $query = $this->db->get("system"); |
|
| 53 | + |
|
| 54 | + if ($query->num_rows() > 0) |
|
| 55 | + return $query->row_array(); |
|
| 56 | + else |
|
| 57 | + return false; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + function remove_config($data) { |
|
| 61 | + $this->load->library("curl"); |
|
| 62 | + $url = "astpp-wraper.cgi"; |
|
| 63 | + $data['mode'] = "Configuration"; |
|
| 64 | + $data['action'] = "Delete"; |
|
| 65 | + $data['logintype'] = $this->session->userdata('logintype'); |
|
| 66 | + $data['username'] = $this->session->userdata('username'); |
|
| 67 | + return $this->curl->sendRequestToPerlScript($url, $data); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + function add_tax($data) { |
|
| 71 | + $this->load->library("curl"); |
|
| 72 | + $url = "astpp-wraper.cgi"; |
|
| 73 | + $data['mode'] = "Taxes"; |
|
| 74 | + $data['logintype'] = $this->session->userdata('logintype'); |
|
| 75 | + $data['username'] = $this->session->userdata('username'); |
|
| 76 | + $this->curl->sendRequestToPerlScript($url, $data); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + function edit_tax($data) { |
|
| 80 | + $this->load->library("curl"); |
|
| 81 | + $url = "astpp-wraper.cgi"; |
|
| 82 | + $data['mode'] = "Taxes"; |
|
| 83 | + $data['logintype'] = $this->session->userdata('logintype'); |
|
| 84 | + $data['username'] = $this->session->userdata('username'); |
|
| 85 | + $this->curl->sendRequestToPerlScript($url, $data); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + function get_tax_by_id($id) { |
|
| 89 | + $this->db->where("taxes_id", $id); |
|
| 90 | + $query = $this->db->get("taxes"); |
|
| 91 | + |
|
| 92 | + if ($query->num_rows() > 0) |
|
| 93 | + return $query->row_array(); |
|
| 94 | + else |
|
| 95 | + return false; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + function remove_tax($data) { |
|
| 99 | + $this->load->library("curl"); |
|
| 100 | + $url = "astpp-wraper.cgi"; |
|
| 101 | + $data['mode'] = "Taxes"; |
|
| 102 | + $data['action'] = "Delete"; |
|
| 103 | + $data['logintype'] = $this->session->userdata('logintype'); |
|
| 104 | + $data['username'] = $this->session->userdata('username'); |
|
| 105 | + $this->curl->sendRequestToPerlScript($url, $data); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + function purge_deactivated_records() { |
|
| 109 | + $this->load->library("curl"); |
|
| 110 | + $url = "astpp-wraper.cgi"; |
|
| 111 | + $data['mode'] = "Purge Deactivated"; |
|
| 112 | + $data['action'] = "Yes, Drop Them"; |
|
| 113 | + $data['logintype'] = $this->session->userdata('logintype'); |
|
| 114 | + $data['username'] = $this->session->userdata('username'); |
|
| 115 | + $feedback = $this->curl->sendRequestToPerlScript($url, $data); |
|
| 116 | + |
|
| 117 | + return $feedback = str_replace(".", ".<br />", $feedback); |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + function getTaxesCount() { |
|
| 121 | + if ($this->session->userdata('advance_search') == 1) { |
|
| 122 | + |
|
| 123 | + $taxes_search = $this->session->userdata('taxes_search'); |
|
| 124 | + |
|
| 125 | + $amount_operator = $taxes_search['amount_operator']; |
|
| 126 | + |
|
| 127 | + if (!empty($taxes_search['amount'])) { |
|
| 128 | + switch ($amount_operator) { |
|
| 129 | + case "1": |
|
| 130 | + $this->db->where('taxes_amount ', $taxes_search['amount']); |
|
| 131 | + break; |
|
| 132 | + case "2": |
|
| 133 | + $this->db->where('taxes_amount <>', $taxes_search['amount']); |
|
| 134 | + break; |
|
| 135 | + case "3": |
|
| 136 | + $this->db->where('taxes_amount > ', $taxes_search['amount']); |
|
| 137 | + break; |
|
| 138 | + case "4": |
|
| 139 | + $this->db->where('taxes_amount < ', $taxes_search['amount']); |
|
| 140 | + break; |
|
| 141 | + case "5": |
|
| 142 | + $this->db->where('taxes_amount >= ', $taxes_search['amount']); |
|
| 143 | + break; |
|
| 144 | + case "6": |
|
| 145 | + $this->db->where('taxes_amount <= ', $taxes_search['amount']); |
|
| 146 | + break; |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + $rate_operator = $taxes_search['rate_operator']; |
|
| 151 | + |
|
| 152 | + if (!empty($taxes_search['rate'])) { |
|
| 153 | + switch ($rate_operator) { |
|
| 154 | + case "1": |
|
| 155 | + $this->db->where('taxes_rate ', $taxes_search['rate']); |
|
| 156 | + break; |
|
| 157 | + case "2": |
|
| 158 | + $this->db->where('taxes_rate <>', $taxes_search['rate']); |
|
| 159 | + break; |
|
| 160 | + case "3": |
|
| 161 | + $this->db->where('taxes_rate > ', $taxes_search['rate']); |
|
| 162 | + break; |
|
| 163 | + case "4": |
|
| 164 | + $this->db->where('taxes_rate < ', $taxes_search['rate']); |
|
| 165 | + break; |
|
| 166 | + case "5": |
|
| 167 | + $this->db->where('taxes_rate >= ', $taxes_search['rate']); |
|
| 168 | + break; |
|
| 169 | + case "6": |
|
| 170 | + $this->db->where('taxes_rate <= ', $taxes_search['rate']); |
|
| 171 | + break; |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + $description_operator = $taxes_search['description_operator']; |
|
| 176 | + if (!empty($taxes_search['description'])) { |
|
| 177 | + switch ($description_operator) { |
|
| 178 | + case "1": |
|
| 179 | + $this->db->like('taxes_description', $taxes_search['description']); |
|
| 180 | + break; |
|
| 181 | + case "2": |
|
| 182 | + $this->db->not_like('taxes_description', $taxes_search['description']); |
|
| 183 | + break; |
|
| 184 | + case "3": |
|
| 185 | + $this->db->where('taxes_description', $taxes_search['description']); |
|
| 186 | + break; |
|
| 187 | + case "4": |
|
| 188 | + $this->db->where('taxes_description <>', $taxes_search['description']); |
|
| 189 | + break; |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + } |
|
| 193 | + $this->db->from('taxes'); |
|
| 194 | + $providercnt = $this->db->count_all_results(); |
|
| 195 | + return $providercnt; |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + function getTaxesList($start, $limit) { |
|
| 199 | + if ($this->session->userdata('advance_search') == 1) { |
|
| 200 | + |
|
| 201 | + $taxes_search = $this->session->userdata('taxes_search'); |
|
| 202 | + |
|
| 203 | + $amount_operator = $taxes_search['amount_operator']; |
|
| 204 | + |
|
| 205 | + if (!empty($taxes_search['amount'])) { |
|
| 206 | + switch ($amount_operator) { |
|
| 207 | + case "1": |
|
| 208 | + $this->db->where('taxes_amount =', $taxes_search['amount']); |
|
| 209 | + break; |
|
| 210 | + case "2": |
|
| 211 | + $this->db->where('taxes_amount <>', $taxes_search['amount']); |
|
| 212 | + break; |
|
| 213 | + case "3": |
|
| 214 | + $this->db->where('taxes_amount > ', $taxes_search['amount']); |
|
| 215 | + break; |
|
| 216 | + case "4": |
|
| 217 | + $this->db->where('taxes_amount < ', $taxes_search['amount']); |
|
| 218 | + break; |
|
| 219 | + case "5": |
|
| 220 | + $this->db->where('taxes_amount >= ', $taxes_search['amount']); |
|
| 221 | + break; |
|
| 222 | + case "6": |
|
| 223 | + $this->db->where('taxes_amount <= ', $taxes_search['amount']); |
|
| 224 | + break; |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + $rate_operator = $taxes_search['rate_operator']; |
|
| 229 | + |
|
| 230 | + if (!empty($taxes_search['rate'])) { |
|
| 231 | + switch ($rate_operator) { |
|
| 232 | + case "1": |
|
| 233 | + $this->db->where('taxes_rate == ', $taxes_search['rate']); |
|
| 234 | + break; |
|
| 235 | + case "2": |
|
| 236 | + $this->db->where('taxes_rate <>', $taxes_search['rate']); |
|
| 237 | + break; |
|
| 238 | + case "3": |
|
| 239 | + $this->db->where('taxes_rate > ', $taxes_search['rate']); |
|
| 240 | + break; |
|
| 241 | + case "4": |
|
| 242 | + $this->db->where('taxes_rate < ', $taxes_search['rate']); |
|
| 243 | + break; |
|
| 244 | + case "5": |
|
| 245 | + $this->db->where('taxes_rate >= ', $taxes_search['rate']); |
|
| 246 | + break; |
|
| 247 | + case "6": |
|
| 248 | + $this->db->where('taxes_rate <= ', $taxes_search['rate']); |
|
| 249 | + break; |
|
| 250 | + } |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + $description_operator = $taxes_search['description_operator']; |
|
| 254 | + if (!empty($taxes_search['description'])) { |
|
| 255 | + switch ($description_operator) { |
|
| 256 | + case "1": |
|
| 257 | + $this->db->like('taxes_description', $taxes_search['description']); |
|
| 258 | + break; |
|
| 259 | + case "2": |
|
| 260 | + $this->db->not_like('taxes_description', $taxes_search['description']); |
|
| 261 | + break; |
|
| 262 | + case "3": |
|
| 263 | + $this->db->where('taxes_description', $taxes_search['description']); |
|
| 264 | + break; |
|
| 265 | + case "4": |
|
| 266 | + $this->db->where('taxes_description <>', $taxes_search['description']); |
|
| 267 | + break; |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | + } |
|
| 271 | + $this->db->limit($limit, $start); |
|
| 272 | + $this->db->order_by("taxes_priority,taxes_description desc"); |
|
| 273 | + $this->db->from('taxes'); |
|
| 274 | + $query = $this->db->get(); |
|
| 275 | + //echo $this->db->last_query(); |
|
| 276 | + return $query; |
|
| 277 | + } |
|
| 278 | + |
|
| 279 | + function getAuthInfo() { |
|
| 280 | + $this->db->where('name', 'auth'); |
|
| 281 | + $this->db->limit(1); |
|
| 282 | + $query = $this->db->get('system'); |
|
| 283 | + if ($query->num_rows() > 0) { |
|
| 284 | + return $query->result(); |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + function get_template_count() { |
|
| 289 | + if ($this->session->userdata['userlevel_logintype'] == 1 || $this->session->userdata['userlevel_logintype'] == 4 || $this->session->userdata['userlevel_logintype'] == 5) { |
|
| 290 | + $acountid = $this->session->userdata['accountinfo']['accountid']; |
|
| 291 | + $this->db->where('accountid', $acountid); |
|
| 292 | + } |
|
| 293 | + return $this->db->get('templates'); |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + function get_templates() { |
|
| 297 | + if ($this->session->userdata('advance_search') == 1) { |
|
| 298 | + $templatesearch = $this->session->userdata('template_search'); |
|
| 299 | + $template_name_operator = $templatesearch['template_name_operator']; |
|
| 300 | + |
|
| 301 | + |
|
| 302 | + if (!empty($templatesearch['template_name'])) { |
|
| 303 | + switch ($template_name_operator) { |
|
| 304 | + case "1": |
|
| 305 | + $this->db->like('name', $templatesearch['template_name']); |
|
| 306 | + break; |
|
| 307 | + case "2": |
|
| 308 | + $this->db->not_like('name', $templatesearch['template_name']); |
|
| 309 | + break; |
|
| 310 | + case "3": |
|
| 311 | + $this->db->where('name', $templatesearch['template_name']); |
|
| 312 | + break; |
|
| 313 | + case "4": |
|
| 314 | + $this->db->where('name <>', $templatesearch['template_name']); |
|
| 315 | + break; |
|
| 316 | + } |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + $template_subject = $templatesearch['subject_operator']; |
|
| 320 | + if (!empty($templatesearch['subject'])) { |
|
| 321 | + switch ($template_subject) { |
|
| 322 | + case "1": |
|
| 323 | + $this->db->like('subject', $templatesearch['subject']); |
|
| 324 | + break; |
|
| 325 | + case "2": |
|
| 326 | + $this->db->not_like('subject', $templatesearch['subject']); |
|
| 327 | + break; |
|
| 328 | + case "3": |
|
| 329 | + $this->db->where('subject', $templatesearch['subject']); |
|
| 330 | + break; |
|
| 331 | + case "4": |
|
| 332 | + $this->db->where('subject <>', $templatesearch['subject']); |
|
| 333 | + break; |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + $template_op = $templatesearch['template_operator']; |
|
| 337 | + if (!empty($templatesearch['template_desc'])) { |
|
| 338 | + |
|
| 339 | + switch ($template_op) { |
|
| 340 | + case "1": |
|
| 341 | + $this->db->like('template', mysql_real_escape_string(($templatesearch['template_desc']))); |
|
| 342 | + break; |
|
| 343 | + case "2": |
|
| 344 | + $this->db->not_like('template', mysql_real_escape_string($templatesearch['template_desc'])); |
|
| 345 | + break; |
|
| 346 | + case "3": |
|
| 347 | + $this->db->where('template', mysql_real_escape_string($templatesearch['template_desc'])); |
|
| 348 | + break; |
|
| 349 | + case "4": |
|
| 350 | + $this->db->where('template <>', mysql_real_escape_string($templatesearch['template_desc'])); |
|
| 351 | + break; |
|
| 352 | + } |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + |
|
| 356 | + if (!empty($templatesearch['accountid'])) { |
|
| 357 | + $this->db->like('accountid', $templatesearch['accountid']); |
|
| 358 | + } |
|
| 359 | + } |
|
| 360 | + |
|
| 361 | + if ($this->session->userdata['userlevel_logintype'] == 1 || $this->session->userdata['userlevel_logintype'] == 4 || $this->session->userdata['userlevel_logintype'] == 5) { |
|
| 362 | + $acountid = $this->session->userdata['accountinfo']['accountid']; |
|
| 363 | + $this->db->where('accountid', $acountid); |
|
| 364 | + } |
|
| 365 | + return $this->db->get('templates'); |
|
| 366 | + } |
|
| 367 | + |
|
| 368 | + function get_template_by_id($id) { |
|
| 369 | + $this->db->delete('templates', array('id' => $id)); |
|
| 370 | + return true; |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + function get_template_by_id_all($id) { |
|
| 374 | + $this->db->where('id', $id); |
|
| 375 | + $query = $this->db->get('templates'); |
|
| 376 | + if ($query->num_rows() > 0) |
|
| 377 | + return $query->row_array(); |
|
| 378 | + else |
|
| 379 | + return false; |
|
| 380 | + } |
|
| 381 | + |
|
| 382 | + function edit_template($edit_id, $data) { |
|
| 383 | + $updatedata = array( |
|
| 384 | + "name" => trim($data['tem_name']), |
|
| 385 | + "template" => trim($data['template']), |
|
| 386 | + "subject" => trim($data['subject']), |
|
| 387 | + "modified_date" => trim(date('Y-m-d H:i:s')) |
|
| 388 | + ); |
|
| 389 | + $this->db->where('id', $edit_id); |
|
| 390 | + $this->db->update('templates', $updatedata); |
|
| 391 | + return true; |
|
| 392 | + } |
|
| 393 | + |
|
| 394 | + function build_systems_configuration() { |
|
| 395 | + if ($this->session->userdata('advance_search') == 1) { |
|
| 396 | + $configuration_search = $this->session->userdata('configuration_search'); |
|
| 397 | + |
|
| 398 | + if (!empty($configuration_search['reseller'])) { |
|
| 399 | + $this->db->where('reseller ', $configuration_search['reseller']); |
|
| 400 | + } |
|
| 401 | + if (!empty($configuration_search['brand'])) { |
|
| 402 | + $this->db->where('brand', $configuration_search['brand']); |
|
| 403 | + } |
|
| 404 | + if (!empty($configuration_search['group_title'])) { |
|
| 405 | + $this->db->where('group_title', $configuration_search['group_title']); |
|
| 406 | + } |
|
| 407 | + |
|
| 408 | + $name_operator = $configuration_search['name_operator']; |
|
| 409 | + |
|
| 410 | + if (!empty($configuration_search['name'])) { |
|
| 411 | + switch ($name_operator) { |
|
| 412 | + case "1": |
|
| 413 | + $this->db->like('name', $configuration_search['name']); |
|
| 414 | + break; |
|
| 415 | + case "2": |
|
| 416 | + $this->db->not_like('name', $configuration_search['name']); |
|
| 417 | + break; |
|
| 418 | + case "3": |
|
| 419 | + $this->db->where('name', $configuration_search['name']); |
|
| 420 | + break; |
|
| 421 | + case "4": |
|
| 422 | + $this->db->where('name <>', $configuration_search['name']); |
|
| 423 | + break; |
|
| 424 | + } |
|
| 425 | + } |
|
| 426 | + |
|
| 427 | + $value_operator = $configuration_search['value_operator']; |
|
| 428 | + |
|
| 429 | + if (!empty($configuration_search['value'])) { |
|
| 430 | + switch ($value_operator) { |
|
| 431 | + case "1": |
|
| 432 | + $this->db->like('value', $configuration_search['value']); |
|
| 433 | + break; |
|
| 434 | + case "2": |
|
| 435 | + $this->db->not_like('value', $configuration_search['value']); |
|
| 436 | + break; |
|
| 437 | + case "3": |
|
| 438 | + $this->db->where('value', $configuration_search['value']); |
|
| 439 | + break; |
|
| 440 | + case "4": |
|
| 441 | + $this->db->where('value <>', $configuration_search['value']); |
|
| 442 | + break; |
|
| 443 | + } |
|
| 444 | + } |
|
| 445 | + |
|
| 446 | + $comment_operator = $configuration_search['comment_operator']; |
|
| 447 | + |
|
| 448 | + if (!empty($configuration_search['comment'])) { |
|
| 449 | + switch ($comment_operator) { |
|
| 450 | + case "1": |
|
| 451 | + $this->db->like('comment', $configuration_search['comment']); |
|
| 452 | + break; |
|
| 453 | + case "2": |
|
| 454 | + $this->db->not_like('comment', $configuration_search['comment']); |
|
| 455 | + break; |
|
| 456 | + case "3": |
|
| 457 | + $this->db->where('comment', $configuration_search['comment']); |
|
| 458 | + break; |
|
| 459 | + case "4": |
|
| 460 | + $this->db->where('comment <>', $configuration_search['comment']); |
|
| 461 | + break; |
|
| 462 | + } |
|
| 463 | + } |
|
| 464 | + } |
|
| 465 | + } |
|
| 466 | + |
|
| 467 | + function systems_configuration($flag, $start = '', $limit = '') { |
|
| 468 | + $this->build_systems_configuration(); |
|
| 469 | + $this->db->from('system'); |
|
| 470 | + if ($flag) { |
|
| 471 | + $this->db->order_by("id ASC"); |
|
| 472 | + $this->db->limit($limit, $start); |
|
| 473 | + $query = $this->db->get(); |
|
| 474 | + } else { |
|
| 475 | + $query = $this->db->count_all_results(); |
|
| 476 | + } |
|
| 477 | + return $query; |
|
| 478 | + } |
|
| 479 | 479 | |
| 480 | 480 | } |
| 481 | 481 | |
@@ -23,438 +23,438 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | class Db_model extends CI_Model { |
| 25 | 25 | |
| 26 | - function Db_model() { |
|
| 26 | + function Db_model() { |
|
| 27 | 27 | // parent::Model(); |
| 28 | - parent::__construct(); |
|
| 29 | - $this->db->query("SET time_zone='+0:00'"); |
|
| 30 | - } |
|
| 28 | + parent::__construct(); |
|
| 29 | + $this->db->query("SET time_zone='+0:00'"); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /* * ******************************************************** |
|
| 32 | + /* * ******************************************************** |
|
| 33 | 33 | Function getCriteria(Where=Condition in Array Format) |
| 34 | 34 | * ******************************************************** */ |
| 35 | 35 | |
| 36 | - function getCriteria($condition = "", $tableName) { |
|
| 37 | - //print_r($condition); |
|
| 38 | - if ($condition != "") { |
|
| 39 | - $this->db->where($condition); |
|
| 40 | - } |
|
| 41 | - return $this->db->get($tableName); |
|
| 42 | - } |
|
| 36 | + function getCriteria($condition = "", $tableName) { |
|
| 37 | + //print_r($condition); |
|
| 38 | + if ($condition != "") { |
|
| 39 | + $this->db->where($condition); |
|
| 40 | + } |
|
| 41 | + return $this->db->get($tableName); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /* * ******************************************************** |
|
| 44 | + /* * ******************************************************** |
|
| 45 | 45 | Function save() for addingthe record |
| 46 | 46 | * ******************************************************** */ |
| 47 | 47 | |
| 48 | - function save($tableName, $arr, $val = 'false') { |
|
| 49 | - $str = $this->db->insert_string($tableName, $arr); |
|
| 50 | - $rs = $this->db->query($str); |
|
| 51 | - if ($val == true) |
|
| 52 | - return $this->db->insert_id(); |
|
| 53 | - else |
|
| 54 | - return $rs; |
|
| 55 | - } |
|
| 48 | + function save($tableName, $arr, $val = 'false') { |
|
| 49 | + $str = $this->db->insert_string($tableName, $arr); |
|
| 50 | + $rs = $this->db->query($str); |
|
| 51 | + if ($val == true) |
|
| 52 | + return $this->db->insert_id(); |
|
| 53 | + else |
|
| 54 | + return $rs; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /* * ******************************************************** |
|
| 57 | + /* * ******************************************************** |
|
| 58 | 58 | Function update() for editing the record |
| 59 | 59 | * ******************************************************** */ |
| 60 | 60 | |
| 61 | - function update($tableName, $arr, $where) { |
|
| 62 | - $str = $this->db->update_string($tableName, $arr, $where); |
|
| 63 | - $rs = $this->db->query($str); |
|
| 64 | - return $rs; |
|
| 65 | - } |
|
| 61 | + function update($tableName, $arr, $where) { |
|
| 62 | + $str = $this->db->update_string($tableName, $arr, $where); |
|
| 63 | + $rs = $this->db->query($str); |
|
| 64 | + return $rs; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /* * ******************************************************** |
|
| 67 | + /* * ******************************************************** |
|
| 68 | 68 | Function getSelect()n for displaying record |
| 69 | 69 | * ******************************************************** */ |
| 70 | 70 | |
| 71 | - function getSelect($select, $tableName, $where) { |
|
| 72 | - $this->db->select($select, false); |
|
| 73 | - $this->db->from($tableName); |
|
| 74 | - if ($where != '') { |
|
| 75 | - $this->db->where($where); |
|
| 76 | - } |
|
| 77 | - $query = $this->db->get(); |
|
| 78 | - return $query; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - /* * ******************************************************** |
|
| 71 | + function getSelect($select, $tableName, $where) { |
|
| 72 | + $this->db->select($select, false); |
|
| 73 | + $this->db->from($tableName); |
|
| 74 | + if ($where != '') { |
|
| 75 | + $this->db->where($where); |
|
| 76 | + } |
|
| 77 | + $query = $this->db->get(); |
|
| 78 | + return $query; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + /* * ******************************************************** |
|
| 82 | 82 | Function getSelectWithOrder()n for displaying record |
| 83 | 83 | * ******************************************************** */ |
| 84 | 84 | |
| 85 | - function getSelectWithOrder($select, $tableName, $where, $order_type, $order_by) { |
|
| 86 | - $this->db->select($select); |
|
| 87 | - $this->db->from($tableName); |
|
| 88 | - $this->db->where($where); |
|
| 89 | - $this->db->order_by($order_by,$order_type); |
|
| 90 | - $query = $this->db->get(); |
|
| 91 | - return $query; |
|
| 92 | - } |
|
| 85 | + function getSelectWithOrder($select, $tableName, $where, $order_type, $order_by) { |
|
| 86 | + $this->db->select($select); |
|
| 87 | + $this->db->from($tableName); |
|
| 88 | + $this->db->where($where); |
|
| 89 | + $this->db->order_by($order_by,$order_type); |
|
| 90 | + $query = $this->db->get(); |
|
| 91 | + return $query; |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /* * ******************************************************** |
|
| 94 | + /* * ******************************************************** |
|
| 95 | 95 | Function getSelectWithOrderAndLimit()n for displaying record |
| 96 | 96 | * ******************************************************** */ |
| 97 | 97 | |
| 98 | - function getSelectWithOrderAndLimit($select, $tableName, $where, $order_type, $order_by, $paging_limit) { |
|
| 99 | - $this->db->select($select); |
|
| 100 | - $this->db->from($tableName); |
|
| 101 | - $this->db->where($where); |
|
| 102 | - $this->db->order_by($order_by, $order_type); |
|
| 103 | - $this->db->limit($paging_limit); |
|
| 104 | - $query = $this->db->get(); |
|
| 105 | - return $query; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /* * ******************************************************** |
|
| 98 | + function getSelectWithOrderAndLimit($select, $tableName, $where, $order_type, $order_by, $paging_limit) { |
|
| 99 | + $this->db->select($select); |
|
| 100 | + $this->db->from($tableName); |
|
| 101 | + $this->db->where($where); |
|
| 102 | + $this->db->order_by($order_by, $order_type); |
|
| 103 | + $this->db->limit($paging_limit); |
|
| 104 | + $query = $this->db->get(); |
|
| 105 | + return $query; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /* * ******************************************************** |
|
| 109 | 109 | Function delete() for deletingthe record |
| 110 | 110 | * ******************************************************** */ |
| 111 | 111 | |
| 112 | - function delete($tableName, $where) { |
|
| 113 | - $this->db->where($where); |
|
| 114 | - $this->db->delete($tableName); |
|
| 115 | - } |
|
| 112 | + function delete($tableName, $where) { |
|
| 113 | + $this->db->where($where); |
|
| 114 | + $this->db->delete($tableName); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - /* * ******************************************************** |
|
| 117 | + /* * ******************************************************** |
|
| 118 | 118 | Function excecute() take compelet query |
| 119 | 119 | * ******************************************************** */ |
| 120 | 120 | |
| 121 | - function excecute($query) { |
|
| 122 | - $rs = $this->db->query($query); |
|
| 123 | - return $rs; |
|
| 124 | - } |
|
| 121 | + function excecute($query) { |
|
| 122 | + $rs = $this->db->query($query); |
|
| 123 | + return $rs; |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - /* * ******************************************************** |
|
| 126 | + /* * ******************************************************** |
|
| 127 | 127 | Function select() take full complete perms |
| 128 | 128 | * ******************************************************** */ |
| 129 | 129 | |
| 130 | - function select($select, $tableName, $where, $order_by, $order_type, $paging_limit = '', $start_limit = '', $groupby = '') { |
|
| 131 | - $this->db->select($select); |
|
| 132 | - $this->db->from($tableName); |
|
| 133 | - if ($where != "") { |
|
| 134 | - $this->db->where($where); |
|
| 135 | - } |
|
| 130 | + function select($select, $tableName, $where, $order_by, $order_type, $paging_limit = '', $start_limit = '', $groupby = '') { |
|
| 131 | + $this->db->select($select); |
|
| 132 | + $this->db->from($tableName); |
|
| 133 | + if ($where != "") { |
|
| 134 | + $this->db->where($where); |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - if ($paging_limit) |
|
| 138 | - $this->db->limit($paging_limit, $start_limit); |
|
| 139 | - if (!empty($groupby)) |
|
| 140 | - $this->db->group_by($groupby); |
|
| 141 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
| 142 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
| 143 | - }else{ |
|
| 144 | - if($order_by) |
|
| 145 | - $this->db->order_by($order_by, $order_type); |
|
| 146 | - } |
|
| 147 | - $query = $this->db->get(); |
|
| 148 | - return $query; |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - /* * ******************************************************** |
|
| 137 | + if ($paging_limit) |
|
| 138 | + $this->db->limit($paging_limit, $start_limit); |
|
| 139 | + if (!empty($groupby)) |
|
| 140 | + $this->db->group_by($groupby); |
|
| 141 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
| 142 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
| 143 | + }else{ |
|
| 144 | + if($order_by) |
|
| 145 | + $this->db->order_by($order_by, $order_type); |
|
| 146 | + } |
|
| 147 | + $query = $this->db->get(); |
|
| 148 | + return $query; |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + /* * ******************************************************** |
|
| 152 | 152 | Function select for In query () take full complete perms |
| 153 | 153 | * ******************************************************** */ |
| 154 | 154 | |
| 155 | - function select_by_in($select, $tableName, $where, $order_by, $order_type, $paging_limit, $start_limit, $groupby = '', $key, $where_in) { |
|
| 156 | - $this->db->select($select); |
|
| 157 | - $this->db->from($tableName); |
|
| 158 | - if ($where != "") { |
|
| 159 | - $this->db->where($where); |
|
| 160 | - } |
|
| 161 | - $this->db->where_in($key, $where_in); |
|
| 162 | - $this->db->order_by($order_by, $order_type); |
|
| 163 | - if ($paging_limit) |
|
| 164 | - $this->db->limit($paging_limit, $start_limit); |
|
| 165 | - if (!empty($groupby)) |
|
| 166 | - $this->db->groupby($groupby); |
|
| 167 | - $query = $this->db->get(); |
|
| 168 | - |
|
| 169 | - return $query; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - /* * ******************************************************** |
|
| 155 | + function select_by_in($select, $tableName, $where, $order_by, $order_type, $paging_limit, $start_limit, $groupby = '', $key, $where_in) { |
|
| 156 | + $this->db->select($select); |
|
| 157 | + $this->db->from($tableName); |
|
| 158 | + if ($where != "") { |
|
| 159 | + $this->db->where($where); |
|
| 160 | + } |
|
| 161 | + $this->db->where_in($key, $where_in); |
|
| 162 | + $this->db->order_by($order_by, $order_type); |
|
| 163 | + if ($paging_limit) |
|
| 164 | + $this->db->limit($paging_limit, $start_limit); |
|
| 165 | + if (!empty($groupby)) |
|
| 166 | + $this->db->groupby($groupby); |
|
| 167 | + $query = $this->db->get(); |
|
| 168 | + |
|
| 169 | + return $query; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + /* * ******************************************************** |
|
| 173 | 173 | Function countQuery() take table name and select feild |
| 174 | 174 | * ******************************************************** */ |
| 175 | 175 | |
| 176 | - function countQuery($select, $table, $where = "") { |
|
| 177 | - $this->db->select($select); |
|
| 178 | - if ($where != "") { |
|
| 179 | - $this->db->where($where); |
|
| 180 | - } |
|
| 181 | - $this->db->from($table); |
|
| 182 | - $query = $this->db->get(); |
|
| 183 | - return $query->num_rows(); |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /* * ******************************************************** |
|
| 176 | + function countQuery($select, $table, $where = "") { |
|
| 177 | + $this->db->select($select); |
|
| 178 | + if ($where != "") { |
|
| 179 | + $this->db->where($where); |
|
| 180 | + } |
|
| 181 | + $this->db->from($table); |
|
| 182 | + $query = $this->db->get(); |
|
| 183 | + return $query->num_rows(); |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /* * ******************************************************** |
|
| 187 | 187 | Function countQuery for where in query() take table name and select feild |
| 188 | 188 | * ******************************************************** */ |
| 189 | 189 | |
| 190 | - function countQuery_by_in($select, $table, $where = "", $key, $where_in) { |
|
| 191 | - $this->db->select($select); |
|
| 192 | - if ($where != "") { |
|
| 193 | - $this->db->where($where); |
|
| 194 | - } |
|
| 195 | - if (!empty($where_in)) { |
|
| 196 | - $this->db->where_in($key, $where_in); |
|
| 197 | - } |
|
| 198 | - $this->db->from($table); |
|
| 199 | - $query = $this->db->get(); |
|
| 200 | - return $query->num_rows(); |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - /* * ******************************************************** |
|
| 190 | + function countQuery_by_in($select, $table, $where = "", $key, $where_in) { |
|
| 191 | + $this->db->select($select); |
|
| 192 | + if ($where != "") { |
|
| 193 | + $this->db->where($where); |
|
| 194 | + } |
|
| 195 | + if (!empty($where_in)) { |
|
| 196 | + $this->db->where_in($key, $where_in); |
|
| 197 | + } |
|
| 198 | + $this->db->from($table); |
|
| 199 | + $query = $this->db->get(); |
|
| 200 | + return $query->num_rows(); |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + /* * ******************************************************** |
|
| 204 | 204 | Function maxQuery() take table name and select feild |
| 205 | 205 | * ******************************************************** */ |
| 206 | 206 | |
| 207 | - function maxQuery($table, $select, $where = "", $name) { |
|
| 208 | - |
|
| 209 | - $this->db->select($select); |
|
| 210 | - $this->db->from($table); |
|
| 211 | - if ($where != "") { |
|
| 212 | - $this->db->where($where); |
|
| 213 | - } |
|
| 214 | - $query = $this->db->get(); |
|
| 215 | - if ($query->num_rows() > 0) { |
|
| 216 | - $rowP = $query->row(); |
|
| 217 | - return $rowP->$name; |
|
| 218 | - } else { |
|
| 219 | - return 0; |
|
| 220 | - } |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - /* * ******************************************************** |
|
| 207 | + function maxQuery($table, $select, $where = "", $name) { |
|
| 208 | + |
|
| 209 | + $this->db->select($select); |
|
| 210 | + $this->db->from($table); |
|
| 211 | + if ($where != "") { |
|
| 212 | + $this->db->where($where); |
|
| 213 | + } |
|
| 214 | + $query = $this->db->get(); |
|
| 215 | + if ($query->num_rows() > 0) { |
|
| 216 | + $rowP = $query->row(); |
|
| 217 | + return $rowP->$name; |
|
| 218 | + } else { |
|
| 219 | + return 0; |
|
| 220 | + } |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + /* * ******************************************************** |
|
| 224 | 224 | Function getCurrent get current value of the feild |
| 225 | 225 | * ******************************************************** */ |
| 226 | 226 | |
| 227 | - function getCurrent($table, $feild, $where) { |
|
| 227 | + function getCurrent($table, $feild, $where) { |
|
| 228 | 228 | // echo "<pre>table====><br>".$table."field====><br>".$feild."where====><br>".print_r($where); |
| 229 | - $this->db->select($feild); |
|
| 230 | - $this->db->from($table); |
|
| 231 | - $this->db->where($where); |
|
| 232 | - $query = $this->db->get(); |
|
| 233 | - if ($query->num_rows() > 0) { |
|
| 234 | - |
|
| 235 | - $rowP = $query->row(); |
|
| 236 | - return $rowP->$feild; |
|
| 237 | - } else { |
|
| 238 | - return false; |
|
| 239 | - } |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - /* * ******************************************************** |
|
| 229 | + $this->db->select($feild); |
|
| 230 | + $this->db->from($table); |
|
| 231 | + $this->db->where($where); |
|
| 232 | + $query = $this->db->get(); |
|
| 233 | + if ($query->num_rows() > 0) { |
|
| 234 | + |
|
| 235 | + $rowP = $query->row(); |
|
| 236 | + return $rowP->$feild; |
|
| 237 | + } else { |
|
| 238 | + return false; |
|
| 239 | + } |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + /* * ******************************************************** |
|
| 243 | 243 | Function getJionQuery get result set on criteria |
| 244 | 244 | * ******************************************************** */ |
| 245 | 245 | |
| 246 | - function getJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') { |
|
| 247 | - $start = (int) $start; |
|
| 248 | - $end = (int) $end; |
|
| 249 | - $this->db->select($feild); |
|
| 250 | - $this->db->from($table); |
|
| 251 | - $this->db->join($jionTable, $jionCondition, $type); |
|
| 252 | - if ($where != "") { |
|
| 253 | - $this->db->where($where); |
|
| 254 | - } |
|
| 255 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
| 256 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
| 257 | - }else{ |
|
| 258 | - if($order_by) |
|
| 259 | - $this->db->order_by($order_by, $order_type); |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - if ($group_by != '') { |
|
| 263 | - $this->db->group_by($group_by); |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - $this->db->limit($start, $end); |
|
| 267 | - |
|
| 268 | - return $query = $this->db->get(); |
|
| 269 | - } |
|
| 270 | - |
|
| 271 | - function getJionQueryCount($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') { |
|
| 272 | - $start = (int) $start; |
|
| 273 | - $end = (int) $end; |
|
| 274 | - $this->db->select($feild); |
|
| 275 | - $this->db->from($table); |
|
| 276 | - $this->db->join($jionTable, $jionCondition, $type); |
|
| 277 | - if ($where != "") { |
|
| 278 | - $this->db->where($where); |
|
| 279 | - } |
|
| 280 | - |
|
| 281 | - if ($order_type != '' && $order_by != '') { |
|
| 282 | - $this->db->orderby($order_type, $order_by); |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - if ($group_by != '') { |
|
| 286 | - $this->db->group_by($group_by); |
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - |
|
| 290 | - $query = $this->db->get(); |
|
| 291 | - return $query->num_rows(); |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - function getAllJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type, $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') { |
|
| 295 | - $start = (int) $start; |
|
| 296 | - $end = (int) $end; |
|
| 297 | - $this->db->select($feild); |
|
| 298 | - $this->db->from($table); |
|
| 299 | - $jion_table_count = count($jionTable); |
|
| 300 | - for ($i = 0; $i < $jion_table_count; $i++) { |
|
| 301 | - $this->db->join($jionTable[$i], $jionCondition[$i], $type[$i]); |
|
| 302 | - } |
|
| 303 | - |
|
| 304 | - if ($where != "") { |
|
| 305 | - $this->db->where($where); |
|
| 306 | - } |
|
| 307 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
| 308 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
| 309 | - }else{ |
|
| 310 | - if($order_by) |
|
| 311 | - $this->db->order_by($order_by, $order_type); |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - if ($group_by != '') { |
|
| 315 | - $this->db->group_by($group_by); |
|
| 316 | - } |
|
| 317 | - |
|
| 318 | - if ($start != '' && $end != '') { |
|
| 319 | - $this->db->limit($start, $end); |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - if ($start != '' && $end == '') { |
|
| 323 | - $this->db->limit($start); |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - return $query = $this->db->get(); |
|
| 327 | - } |
|
| 328 | - |
|
| 329 | - function getCountWithJion($table, $feild, $where = "", $jionTable, $jionCondition, $type, $group_by = '') { |
|
| 330 | - $this->db->select($feild); |
|
| 331 | - $this->db->from($table); |
|
| 332 | - $jion_table_count = count($jionTable); |
|
| 333 | - for ($i = 0; $i < $jion_table_count; $i++) { |
|
| 334 | - $this->db->join($jionTable[$i], $jionCondition[$i], $type[$i]); |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - if ($where != "") { |
|
| 338 | - $this->db->where($where); |
|
| 339 | - } |
|
| 340 | - if ($group_by != '') { |
|
| 341 | - $this->db->group_by($group_by); |
|
| 342 | - } |
|
| 343 | - $query = $this->db->get(); |
|
| 344 | - if ($query->num_rows() > 0) { |
|
| 345 | - return $query->num_rows(); |
|
| 346 | - } else { |
|
| 347 | - return false; |
|
| 348 | - } |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - /* * ******************************************************** |
|
| 246 | + function getJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') { |
|
| 247 | + $start = (int) $start; |
|
| 248 | + $end = (int) $end; |
|
| 249 | + $this->db->select($feild); |
|
| 250 | + $this->db->from($table); |
|
| 251 | + $this->db->join($jionTable, $jionCondition, $type); |
|
| 252 | + if ($where != "") { |
|
| 253 | + $this->db->where($where); |
|
| 254 | + } |
|
| 255 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
| 256 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
| 257 | + }else{ |
|
| 258 | + if($order_by) |
|
| 259 | + $this->db->order_by($order_by, $order_type); |
|
| 260 | + } |
|
| 261 | + |
|
| 262 | + if ($group_by != '') { |
|
| 263 | + $this->db->group_by($group_by); |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + $this->db->limit($start, $end); |
|
| 267 | + |
|
| 268 | + return $query = $this->db->get(); |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + function getJionQueryCount($table, $feild, $where = "", $jionTable, $jionCondition, $type = 'inner', $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') { |
|
| 272 | + $start = (int) $start; |
|
| 273 | + $end = (int) $end; |
|
| 274 | + $this->db->select($feild); |
|
| 275 | + $this->db->from($table); |
|
| 276 | + $this->db->join($jionTable, $jionCondition, $type); |
|
| 277 | + if ($where != "") { |
|
| 278 | + $this->db->where($where); |
|
| 279 | + } |
|
| 280 | + |
|
| 281 | + if ($order_type != '' && $order_by != '') { |
|
| 282 | + $this->db->orderby($order_type, $order_by); |
|
| 283 | + } |
|
| 284 | + |
|
| 285 | + if ($group_by != '') { |
|
| 286 | + $this->db->group_by($group_by); |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + |
|
| 290 | + $query = $this->db->get(); |
|
| 291 | + return $query->num_rows(); |
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + function getAllJionQuery($table, $feild, $where = "", $jionTable, $jionCondition, $type, $start = '', $end = '', $order_type = '', $order_by = '', $group_by = '') { |
|
| 295 | + $start = (int) $start; |
|
| 296 | + $end = (int) $end; |
|
| 297 | + $this->db->select($feild); |
|
| 298 | + $this->db->from($table); |
|
| 299 | + $jion_table_count = count($jionTable); |
|
| 300 | + for ($i = 0; $i < $jion_table_count; $i++) { |
|
| 301 | + $this->db->join($jionTable[$i], $jionCondition[$i], $type[$i]); |
|
| 302 | + } |
|
| 303 | + |
|
| 304 | + if ($where != "") { |
|
| 305 | + $this->db->where($where); |
|
| 306 | + } |
|
| 307 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
| 308 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
| 309 | + }else{ |
|
| 310 | + if($order_by) |
|
| 311 | + $this->db->order_by($order_by, $order_type); |
|
| 312 | + } |
|
| 313 | + |
|
| 314 | + if ($group_by != '') { |
|
| 315 | + $this->db->group_by($group_by); |
|
| 316 | + } |
|
| 317 | + |
|
| 318 | + if ($start != '' && $end != '') { |
|
| 319 | + $this->db->limit($start, $end); |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + if ($start != '' && $end == '') { |
|
| 323 | + $this->db->limit($start); |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + return $query = $this->db->get(); |
|
| 327 | + } |
|
| 328 | + |
|
| 329 | + function getCountWithJion($table, $feild, $where = "", $jionTable, $jionCondition, $type, $group_by = '') { |
|
| 330 | + $this->db->select($feild); |
|
| 331 | + $this->db->from($table); |
|
| 332 | + $jion_table_count = count($jionTable); |
|
| 333 | + for ($i = 0; $i < $jion_table_count; $i++) { |
|
| 334 | + $this->db->join($jionTable[$i], $jionCondition[$i], $type[$i]); |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + if ($where != "") { |
|
| 338 | + $this->db->where($where); |
|
| 339 | + } |
|
| 340 | + if ($group_by != '') { |
|
| 341 | + $this->db->group_by($group_by); |
|
| 342 | + } |
|
| 343 | + $query = $this->db->get(); |
|
| 344 | + if ($query->num_rows() > 0) { |
|
| 345 | + return $query->num_rows(); |
|
| 346 | + } else { |
|
| 347 | + return false; |
|
| 348 | + } |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + /* * ******************************************************** |
|
| 352 | 352 | Function getCurrentWithOrder |
| 353 | 353 | * ******************************************************** */ |
| 354 | 354 | |
| 355 | - function getCurrentWithOrder($table, $feild, $where, $order, $order_by, $limit, $option) { |
|
| 356 | - $this->db->select($feild); |
|
| 357 | - $this->db->from($table); |
|
| 358 | - $this->db->where($where); |
|
| 359 | - $this->db->order_by($order, $order_by); |
|
| 360 | - if ($limit != 0) { |
|
| 361 | - $this->db->limit($limit); |
|
| 362 | - } |
|
| 363 | - $query = $this->db->get(); |
|
| 364 | - if ($query->num_rows() > 0) { |
|
| 365 | - $rowP = $query->row(); |
|
| 366 | - if ($option == 'yes') { |
|
| 367 | - return $rowP->$feild; |
|
| 368 | - } else { |
|
| 369 | - return $query; |
|
| 370 | - } |
|
| 371 | - } else { |
|
| 372 | - if ($option == 'no') { |
|
| 373 | - return $query; |
|
| 374 | - } else { |
|
| 375 | - return false; |
|
| 376 | - } |
|
| 377 | - } |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - /* * ******************************************************** |
|
| 355 | + function getCurrentWithOrder($table, $feild, $where, $order, $order_by, $limit, $option) { |
|
| 356 | + $this->db->select($feild); |
|
| 357 | + $this->db->from($table); |
|
| 358 | + $this->db->where($where); |
|
| 359 | + $this->db->order_by($order, $order_by); |
|
| 360 | + if ($limit != 0) { |
|
| 361 | + $this->db->limit($limit); |
|
| 362 | + } |
|
| 363 | + $query = $this->db->get(); |
|
| 364 | + if ($query->num_rows() > 0) { |
|
| 365 | + $rowP = $query->row(); |
|
| 366 | + if ($option == 'yes') { |
|
| 367 | + return $rowP->$feild; |
|
| 368 | + } else { |
|
| 369 | + return $query; |
|
| 370 | + } |
|
| 371 | + } else { |
|
| 372 | + if ($option == 'no') { |
|
| 373 | + return $query; |
|
| 374 | + } else { |
|
| 375 | + return false; |
|
| 376 | + } |
|
| 377 | + } |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + /* * ******************************************************** |
|
| 381 | 381 | Function getReferPatients |
| 382 | 382 | * ******************************************************** */ |
| 383 | 383 | |
| 384 | - function getAllWithOrder($table, $feild, $where) { |
|
| 385 | - $this->db->select($feild); |
|
| 386 | - $this->db->from($table); |
|
| 387 | - $this->db->where($where); |
|
| 388 | - $query = $this->db->get(); |
|
| 389 | - if ($query->num_rows() > 0) { |
|
| 390 | - $rowP = $query->row(); |
|
| 391 | - return $rowP->$feild; |
|
| 392 | - } else { |
|
| 393 | - return false; |
|
| 394 | - } |
|
| 395 | - } |
|
| 396 | - |
|
| 397 | - function getCommaSperated($table, $select, $where, $limit, $return_message = FALSE, $message = '') { |
|
| 398 | - if ($table != '') { |
|
| 399 | - $this->db->select($select); |
|
| 400 | - $this->db->from($table); |
|
| 401 | - $this->db->where($where); |
|
| 402 | - if ($limit != 0) { |
|
| 403 | - $this->db->limit($limit); |
|
| 404 | - } |
|
| 405 | - $query = $this->db->get(); |
|
| 406 | - $string = ''; |
|
| 407 | - if ($query->num_rows() > 0) { |
|
| 408 | - foreach ($query->result() as $rows) { |
|
| 409 | - $string .= $rows->$select . ','; |
|
| 410 | - } |
|
| 411 | - |
|
| 412 | - return substr($string, '', -1); |
|
| 413 | - } else { |
|
| 414 | - if ($return_message == FALSE) { |
|
| 415 | - return ''; |
|
| 416 | - } else { |
|
| 417 | - return $message; |
|
| 418 | - } |
|
| 419 | - } |
|
| 420 | - } else { |
|
| 421 | - return ''; |
|
| 422 | - } |
|
| 423 | - } |
|
| 424 | - |
|
| 425 | - function build_concat_dropdown($select, $table, $id_where = '', $id_value = '') { |
|
| 426 | - $select_params = explode(',', $select); |
|
| 427 | - if (isset($select_params[3])) { |
|
| 428 | - $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' "; |
|
| 429 | - } else { |
|
| 430 | - $cnt_str = " $select_params[1],' (',$select_params[2],')' "; |
|
| 431 | - } |
|
| 432 | - $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] "; |
|
| 433 | - $logintype = $this->session->userdata('logintype'); |
|
| 434 | - if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') { |
|
| 435 | - $account_data = $this->session->userdata("accountinfo"); |
|
| 436 | - $id_value['reseller_id'] = $account_data['id']; |
|
| 437 | - } |
|
| 438 | - if(isset($id_value['type']) && $id_value['type'] == '0,3'){ |
|
| 439 | - $twhere = "type IN (".$id_value["type"].")"; |
|
| 440 | - $this->db->where($twhere); |
|
| 441 | - unset($id_value['type']); |
|
| 442 | - } |
|
| 443 | - $where = $id_value; |
|
| 444 | - $drp_array = $this->getSelect($select, $table, $where); |
|
| 445 | - $drp_array = $drp_array->result(); |
|
| 446 | - |
|
| 447 | - $drp_list = array(); |
|
| 448 | - foreach ($drp_array as $drp_value) { |
|
| 449 | - $drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1]; |
|
| 450 | - } |
|
| 451 | - return $drp_list; |
|
| 452 | - } |
|
| 384 | + function getAllWithOrder($table, $feild, $where) { |
|
| 385 | + $this->db->select($feild); |
|
| 386 | + $this->db->from($table); |
|
| 387 | + $this->db->where($where); |
|
| 388 | + $query = $this->db->get(); |
|
| 389 | + if ($query->num_rows() > 0) { |
|
| 390 | + $rowP = $query->row(); |
|
| 391 | + return $rowP->$feild; |
|
| 392 | + } else { |
|
| 393 | + return false; |
|
| 394 | + } |
|
| 395 | + } |
|
| 396 | + |
|
| 397 | + function getCommaSperated($table, $select, $where, $limit, $return_message = FALSE, $message = '') { |
|
| 398 | + if ($table != '') { |
|
| 399 | + $this->db->select($select); |
|
| 400 | + $this->db->from($table); |
|
| 401 | + $this->db->where($where); |
|
| 402 | + if ($limit != 0) { |
|
| 403 | + $this->db->limit($limit); |
|
| 404 | + } |
|
| 405 | + $query = $this->db->get(); |
|
| 406 | + $string = ''; |
|
| 407 | + if ($query->num_rows() > 0) { |
|
| 408 | + foreach ($query->result() as $rows) { |
|
| 409 | + $string .= $rows->$select . ','; |
|
| 410 | + } |
|
| 411 | + |
|
| 412 | + return substr($string, '', -1); |
|
| 413 | + } else { |
|
| 414 | + if ($return_message == FALSE) { |
|
| 415 | + return ''; |
|
| 416 | + } else { |
|
| 417 | + return $message; |
|
| 418 | + } |
|
| 419 | + } |
|
| 420 | + } else { |
|
| 421 | + return ''; |
|
| 422 | + } |
|
| 423 | + } |
|
| 424 | + |
|
| 425 | + function build_concat_dropdown($select, $table, $id_where = '', $id_value = '') { |
|
| 426 | + $select_params = explode(',', $select); |
|
| 427 | + if (isset($select_params[3])) { |
|
| 428 | + $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' "; |
|
| 429 | + } else { |
|
| 430 | + $cnt_str = " $select_params[1],' (',$select_params[2],')' "; |
|
| 431 | + } |
|
| 432 | + $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] "; |
|
| 433 | + $logintype = $this->session->userdata('logintype'); |
|
| 434 | + if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') { |
|
| 435 | + $account_data = $this->session->userdata("accountinfo"); |
|
| 436 | + $id_value['reseller_id'] = $account_data['id']; |
|
| 437 | + } |
|
| 438 | + if(isset($id_value['type']) && $id_value['type'] == '0,3'){ |
|
| 439 | + $twhere = "type IN (".$id_value["type"].")"; |
|
| 440 | + $this->db->where($twhere); |
|
| 441 | + unset($id_value['type']); |
|
| 442 | + } |
|
| 443 | + $where = $id_value; |
|
| 444 | + $drp_array = $this->getSelect($select, $table, $where); |
|
| 445 | + $drp_array = $drp_array->result(); |
|
| 446 | + |
|
| 447 | + $drp_list = array(); |
|
| 448 | + foreach ($drp_array as $drp_value) { |
|
| 449 | + $drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1]; |
|
| 450 | + } |
|
| 451 | + return $drp_list; |
|
| 452 | + } |
|
| 453 | 453 | /****** |
| 454 | 454 | ASTPP 3.0 |
| 455 | 455 | Recording enable/disable dropdown |
| 456 | 456 | ****/ |
| 457 | - function build_concat_dropdown_refill_coupon($select, $table, $id_where = '', $id_value = '') { |
|
| 457 | + function build_concat_dropdown_refill_coupon($select, $table, $id_where = '', $id_value = '') { |
|
| 458 | 458 | $select_params = explode(',', $select); |
| 459 | 459 | $account_data = $this->session->userdata("accountinfo"); |
| 460 | 460 | if (isset($select_params[3])) { |
@@ -479,225 +479,225 @@ discard block |
||
| 479 | 479 | $drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1]; |
| 480 | 480 | } |
| 481 | 481 | return $drp_list; |
| 482 | - } |
|
| 482 | + } |
|
| 483 | 483 | /***********************************/ |
| 484 | 484 | function build_concat_select_dropdown($select, $table, $id_where = '', $id_value = '') { |
| 485 | - $select_params = explode(',', $select); |
|
| 486 | - if (isset($select_params[3])) { |
|
| 487 | - $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' "; |
|
| 488 | - } else { |
|
| 489 | - $cnt_str = " $select_params[1],' (',$select_params[2],')' "; |
|
| 490 | - } |
|
| 491 | - $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] "; |
|
| 485 | + $select_params = explode(',', $select); |
|
| 486 | + if (isset($select_params[3])) { |
|
| 487 | + $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' "; |
|
| 488 | + } else { |
|
| 489 | + $cnt_str = " $select_params[1],' (',$select_params[2],')' "; |
|
| 490 | + } |
|
| 491 | + $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] "; |
|
| 492 | 492 | $where = $id_value; |
| 493 | - $drp_array = $this->getSelect($select, $table, $id_value); |
|
| 494 | - $drp_array = $drp_array->result(); |
|
| 495 | - |
|
| 496 | - $drp_list = array(); |
|
| 497 | - $drp_list[0] = "--Select--"; |
|
| 498 | - foreach ($drp_array as $drp_value) { |
|
| 499 | - $drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1]; |
|
| 500 | - } |
|
| 501 | - return $drp_list; |
|
| 502 | - } |
|
| 503 | - function build_dropdown($select, $table, $id_where = '', $id_value = '') { |
|
| 504 | - $select_params = explode(',', $select); |
|
| 505 | - $where = ''; |
|
| 506 | - if(isset($id_value["type"]) && $id_value["type"] == "GLOBAL"){ |
|
| 507 | - $where = "type IN ('0','3')"; |
|
| 508 | - $this->db->where($where); |
|
| 509 | - unset($id_value["type"]); |
|
| 510 | - } |
|
| 511 | - if ($id_where != '' && $id_value != '') { |
|
| 512 | - if ($id_where == 'group_by') { |
|
| 513 | - $this->db->group_by($id_value); |
|
| 514 | - } else if ($id_where == "where_arr") { |
|
| 515 | - $logintype = $this->session->userdata('logintype'); |
|
| 516 | - if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr' && $this->db->field_exists('reseller_id',$table)) { |
|
| 517 | - $id_value['reseller_id'] = $this->session->userdata["accountinfo"]['id']; |
|
| 518 | - } |
|
| 519 | - $where = $id_value; |
|
| 520 | - } else { |
|
| 521 | - $logintype = $this->session->userdata('logintype'); |
|
| 522 | - if (($logintype == 1 || $logintype == 5) && $id_where == 'reseller_id') { |
|
| 523 | - $account_data = $this->session->userdata("accountinfo"); |
|
| 524 | - $id_value = $account_data['id']; |
|
| 525 | - } |
|
| 526 | - $where = array($id_where => $id_value); |
|
| 527 | - } |
|
| 528 | - } |
|
| 529 | - |
|
| 530 | - $drp_array = $this->getSelect($select, $table, $where); |
|
| 531 | - $drp_array = $drp_array->result(); |
|
| 532 | - |
|
| 533 | - $drp_list = array(); |
|
| 534 | - foreach ($drp_array as $drp_value) { |
|
| 535 | - $drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1]; |
|
| 536 | - } |
|
| 537 | - return $drp_list; |
|
| 538 | - } |
|
| 493 | + $drp_array = $this->getSelect($select, $table, $id_value); |
|
| 494 | + $drp_array = $drp_array->result(); |
|
| 495 | + |
|
| 496 | + $drp_list = array(); |
|
| 497 | + $drp_list[0] = "--Select--"; |
|
| 498 | + foreach ($drp_array as $drp_value) { |
|
| 499 | + $drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1]; |
|
| 500 | + } |
|
| 501 | + return $drp_list; |
|
| 502 | + } |
|
| 503 | + function build_dropdown($select, $table, $id_where = '', $id_value = '') { |
|
| 504 | + $select_params = explode(',', $select); |
|
| 505 | + $where = ''; |
|
| 506 | + if(isset($id_value["type"]) && $id_value["type"] == "GLOBAL"){ |
|
| 507 | + $where = "type IN ('0','3')"; |
|
| 508 | + $this->db->where($where); |
|
| 509 | + unset($id_value["type"]); |
|
| 510 | + } |
|
| 511 | + if ($id_where != '' && $id_value != '') { |
|
| 512 | + if ($id_where == 'group_by') { |
|
| 513 | + $this->db->group_by($id_value); |
|
| 514 | + } else if ($id_where == "where_arr") { |
|
| 515 | + $logintype = $this->session->userdata('logintype'); |
|
| 516 | + if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr' && $this->db->field_exists('reseller_id',$table)) { |
|
| 517 | + $id_value['reseller_id'] = $this->session->userdata["accountinfo"]['id']; |
|
| 518 | + } |
|
| 519 | + $where = $id_value; |
|
| 520 | + } else { |
|
| 521 | + $logintype = $this->session->userdata('logintype'); |
|
| 522 | + if (($logintype == 1 || $logintype == 5) && $id_where == 'reseller_id') { |
|
| 523 | + $account_data = $this->session->userdata("accountinfo"); |
|
| 524 | + $id_value = $account_data['id']; |
|
| 525 | + } |
|
| 526 | + $where = array($id_where => $id_value); |
|
| 527 | + } |
|
| 528 | + } |
|
| 529 | + |
|
| 530 | + $drp_array = $this->getSelect($select, $table, $where); |
|
| 531 | + $drp_array = $drp_array->result(); |
|
| 532 | + |
|
| 533 | + $drp_list = array(); |
|
| 534 | + foreach ($drp_array as $drp_value) { |
|
| 535 | + $drp_list[$drp_value->$select_params[0]] = $drp_value->$select_params[1]; |
|
| 536 | + } |
|
| 537 | + return $drp_list; |
|
| 538 | + } |
|
| 539 | 539 | function build_dropdown_deleted($select, $table, $id_where = '', $id_value = '') { |
| 540 | - $select_params = explode(',', $select); |
|
| 541 | - if(isset($id_value["type"]) ){ |
|
| 542 | - $where = $id_value["type"] == "GLOBAL" ? "type IN ('0','3')": "type IN (".$id_value["type"].")"; |
|
| 543 | - $this->db->where($where); |
|
| 544 | - unset($id_value["type"]); |
|
| 545 | - } |
|
| 546 | - $where = ''; |
|
| 547 | - if ($id_where != '' && $id_value != '') { |
|
| 548 | - if ($id_where == 'group_by') { |
|
| 549 | - $this->db->group_by($id_value); |
|
| 540 | + $select_params = explode(',', $select); |
|
| 541 | + if(isset($id_value["type"]) ){ |
|
| 542 | + $where = $id_value["type"] == "GLOBAL" ? "type IN ('0','3')": "type IN (".$id_value["type"].")"; |
|
| 543 | + $this->db->where($where); |
|
| 544 | + unset($id_value["type"]); |
|
| 545 | + } |
|
| 546 | + $where = ''; |
|
| 547 | + if ($id_where != '' && $id_value != '') { |
|
| 548 | + if ($id_where == 'group_by') { |
|
| 549 | + $this->db->group_by($id_value); |
|
| 550 | 550 | |
| 551 | 551 | } else if ($id_where == "where_arr") { |
| 552 | - $logintype = $this->session->userdata('logintype'); |
|
| 553 | - if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') { |
|
| 554 | - $account_data = $this->session->userdata("accountinfo"); |
|
| 555 | - $id_value['reseller_id'] = $account_data['id']; |
|
| 556 | - } |
|
| 557 | - $where = $id_value; |
|
| 558 | - } else { |
|
| 559 | - $logintype = $this->session->userdata('logintype'); |
|
| 560 | - if (($logintype == 1 || $logintype == 5) && $id_where == 'reseller_id') { |
|
| 561 | - $account_data = $this->session->userdata("accountinfo"); |
|
| 562 | - $id_value = $account_data['id']; |
|
| 563 | - } |
|
| 564 | - $where = array($id_where => $id_value); |
|
| 565 | - } |
|
| 566 | - } |
|
| 567 | - |
|
| 568 | - $drp_array = $this->getSelect($select, $table, $where); |
|
| 569 | - |
|
| 570 | - $drp_array = $drp_array->result(); |
|
| 571 | - |
|
| 572 | - $name=explode("as",$select); |
|
| 573 | - if(isset($name[3])){ |
|
| 574 | - $name=trim($name[3]); |
|
| 575 | - }else{ |
|
| 576 | - $name=trim($name[1]); |
|
| 577 | - } |
|
| 578 | - |
|
| 579 | - $drp_list = array(); |
|
| 580 | - $dele =array(); |
|
| 581 | - foreach ($drp_array as $drp_value) { |
|
| 582 | - $dele=explode("^",$drp_value->$name); |
|
| 583 | - if(isset($dele[1])) |
|
| 584 | - { |
|
| 585 | - $drp_list['Deleted'][$drp_value->$select_params[0]] = str_replace("^","",$drp_value->$name); |
|
| 586 | - }else{ |
|
| 587 | - $drp_list['Active'][$drp_value->$select_params[0]] = $drp_value->$name; |
|
| 588 | - } |
|
| 589 | - } |
|
| 552 | + $logintype = $this->session->userdata('logintype'); |
|
| 553 | + if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') { |
|
| 554 | + $account_data = $this->session->userdata("accountinfo"); |
|
| 555 | + $id_value['reseller_id'] = $account_data['id']; |
|
| 556 | + } |
|
| 557 | + $where = $id_value; |
|
| 558 | + } else { |
|
| 559 | + $logintype = $this->session->userdata('logintype'); |
|
| 560 | + if (($logintype == 1 || $logintype == 5) && $id_where == 'reseller_id') { |
|
| 561 | + $account_data = $this->session->userdata("accountinfo"); |
|
| 562 | + $id_value = $account_data['id']; |
|
| 563 | + } |
|
| 564 | + $where = array($id_where => $id_value); |
|
| 565 | + } |
|
| 566 | + } |
|
| 567 | + |
|
| 568 | + $drp_array = $this->getSelect($select, $table, $where); |
|
| 569 | + |
|
| 570 | + $drp_array = $drp_array->result(); |
|
| 571 | + |
|
| 572 | + $name=explode("as",$select); |
|
| 573 | + if(isset($name[3])){ |
|
| 574 | + $name=trim($name[3]); |
|
| 575 | + }else{ |
|
| 576 | + $name=trim($name[1]); |
|
| 577 | + } |
|
| 578 | + |
|
| 579 | + $drp_list = array(); |
|
| 580 | + $dele =array(); |
|
| 581 | + foreach ($drp_array as $drp_value) { |
|
| 582 | + $dele=explode("^",$drp_value->$name); |
|
| 583 | + if(isset($dele[1])) |
|
| 584 | + { |
|
| 585 | + $drp_list['Deleted'][$drp_value->$select_params[0]] = str_replace("^","",$drp_value->$name); |
|
| 586 | + }else{ |
|
| 587 | + $drp_list['Active'][$drp_value->$select_params[0]] = $drp_value->$name; |
|
| 588 | + } |
|
| 589 | + } |
|
| 590 | 590 | ksort($drp_list); |
| 591 | - return $drp_list; |
|
| 592 | - } |
|
| 593 | - |
|
| 594 | - function build_search($accounts_list_search) { |
|
| 595 | - if ($this->session->userdata('advance_search') == 1) { |
|
| 596 | - $account_search = $this->session->userdata($accounts_list_search); |
|
| 597 | - unset($account_search["ajax_search"]); |
|
| 598 | - unset($account_search["advance_search"]); |
|
| 599 | - /* ASTPP 3.0 |
|
| 591 | + return $drp_list; |
|
| 592 | + } |
|
| 593 | + |
|
| 594 | + function build_search($accounts_list_search) { |
|
| 595 | + if ($this->session->userdata('advance_search') == 1) { |
|
| 596 | + $account_search = $this->session->userdata($accounts_list_search); |
|
| 597 | + unset($account_search["ajax_search"]); |
|
| 598 | + unset($account_search["advance_search"]); |
|
| 599 | + /* ASTPP 3.0 |
|
| 600 | 600 | Display Records in |
| 601 | 601 | */ |
| 602 | - unset($account_search['search_in'],$account_search['time']); |
|
| 603 | - if (!empty($account_search)) { |
|
| 604 | - foreach ($account_search as $key => $value) { |
|
| 605 | - if ($value != "") { |
|
| 606 | - if (is_array($value)) { |
|
| 607 | - if (array_key_exists($key . "-integer", $value)) { |
|
| 608 | - $this->get_interger_array($key, $value[$key . "-integer"], $value[$key]); |
|
| 609 | - } |
|
| 610 | - if (array_key_exists($key . "-string", $value)) { |
|
| 611 | - $this->get_string_array($key, $value[$key . "-string"], $value[$key]); |
|
| 612 | - } |
|
| 602 | + unset($account_search['search_in'],$account_search['time']); |
|
| 603 | + if (!empty($account_search)) { |
|
| 604 | + foreach ($account_search as $key => $value) { |
|
| 605 | + if ($value != "") { |
|
| 606 | + if (is_array($value)) { |
|
| 607 | + if (array_key_exists($key . "-integer", $value)) { |
|
| 608 | + $this->get_interger_array($key, $value[$key . "-integer"], $value[$key]); |
|
| 609 | + } |
|
| 610 | + if (array_key_exists($key . "-string", $value)) { |
|
| 611 | + $this->get_string_array($key, $value[$key . "-string"], $value[$key]); |
|
| 612 | + } |
|
| 613 | 613 | |
| 614 | - /** |
|
| 614 | + /** |
|
| 615 | 615 | ASTPP 3.0 |
| 616 | 616 | first used,creation,expiry search date picker |
| 617 | - **/ |
|
| 618 | - if ($key == 'callstart'|| |
|
| 619 | - $key == 'date'|| |
|
| 620 | - $key =='payment_date' || |
|
| 621 | - $key == 'first_used' || |
|
| 622 | - $key == 'creation' || |
|
| 623 | - $key =='from_date'|| |
|
| 624 | - $key =='invoice_date' || |
|
| 625 | - $key =='expiry' || |
|
| 626 | - $key =='created_date' || |
|
| 627 | - $key=='to_date') { |
|
| 628 | - /***********************************************/ |
|
| 629 | - $this->get_date_array($key, $value); |
|
| 630 | - } |
|
| 631 | - } else { |
|
| 632 | - $this->db->where($key, $value); |
|
| 633 | - } |
|
| 617 | + **/ |
|
| 618 | + if ($key == 'callstart'|| |
|
| 619 | + $key == 'date'|| |
|
| 620 | + $key =='payment_date' || |
|
| 621 | + $key == 'first_used' || |
|
| 622 | + $key == 'creation' || |
|
| 623 | + $key =='from_date'|| |
|
| 624 | + $key =='invoice_date' || |
|
| 625 | + $key =='expiry' || |
|
| 626 | + $key =='created_date' || |
|
| 627 | + $key=='to_date') { |
|
| 628 | + /***********************************************/ |
|
| 629 | + $this->get_date_array($key, $value); |
|
| 630 | + } |
|
| 631 | + } else { |
|
| 632 | + $this->db->where($key, $value); |
|
| 633 | + } |
|
| 634 | 634 | |
| 635 | - } |
|
| 636 | - } |
|
| 635 | + } |
|
| 636 | + } |
|
| 637 | 637 | return true; |
| 638 | - } |
|
| 639 | - } |
|
| 640 | - } |
|
| 638 | + } |
|
| 639 | + } |
|
| 640 | + } |
|
| 641 | 641 | |
| 642 | - function get_date_array($field, $value) { |
|
| 643 | - if ($value != '') { |
|
| 644 | - if (!empty($value[0])) { |
|
| 642 | + function get_date_array($field, $value) { |
|
| 643 | + if ($value != '') { |
|
| 644 | + if (!empty($value[0])) { |
|
| 645 | 645 | if($field == 'invoice_date'){ |
| 646 | 646 | $this->db->where($field . ' >= ', gmdate("Y-m-d", strtotime($value['0']))." 00:00:01"); |
| 647 | 647 | $this->db->where($field . ' <= ', gmdate("Y-m-d", strtotime($value['0']))." 23:59:59"); |
| 648 | 648 | }else{ |
| 649 | - $this->db->where($field . ' >= ', gmdate('Y-m-d H:i:s',strtotime($value[0]))); |
|
| 649 | + $this->db->where($field . ' >= ', gmdate('Y-m-d H:i:s',strtotime($value[0]))); |
|
| 650 | 650 | } |
| 651 | 651 | } |
| 652 | - if (!empty($value[1])) { |
|
| 653 | - $this->db->where($field . ' <= ', gmdate('Y-m-d H:i:s',strtotime($value[1]))); |
|
| 654 | - } |
|
| 655 | - } |
|
| 656 | - } |
|
| 657 | - |
|
| 658 | - function get_interger_array($field, $value, $search_array) { |
|
| 659 | - if ($search_array != '') { |
|
| 660 | - switch ($value) { |
|
| 661 | - case "1": |
|
| 662 | - $this->db->where($field, $search_array); |
|
| 663 | - break; |
|
| 664 | - case "2": |
|
| 665 | - $this->db->where($field . ' <>', $search_array); |
|
| 666 | - break; |
|
| 667 | - case "3": |
|
| 668 | - $this->db->where($field . ' > ', $search_array); |
|
| 669 | - break; |
|
| 670 | - case "4": |
|
| 671 | - $this->db->where($field . ' < ', $search_array); |
|
| 672 | - break; |
|
| 673 | - case "5": |
|
| 674 | - $this->db->where($field . ' >= ', $search_array); |
|
| 675 | - break; |
|
| 676 | - case "6": |
|
| 677 | - $this->db->where($field . ' <= ', $search_array); |
|
| 678 | - break; |
|
| 679 | - } |
|
| 680 | - } |
|
| 681 | - } |
|
| 682 | - |
|
| 683 | - function get_string_array($field, $value, $search_array) { |
|
| 684 | - if ($search_array != '') { |
|
| 685 | - switch ($value) { |
|
| 686 | - case "1": |
|
| 687 | - $str1 = $field . " LIKE '%$search_array%'"; |
|
| 688 | - $this->db->where($str1); |
|
| 689 | - break; |
|
| 690 | - case "2": |
|
| 691 | - $str1 = $field . " NOT LIKE '%$search_array%'"; |
|
| 692 | - $this->db->where($str1); |
|
| 693 | - break; |
|
| 694 | - case "3": |
|
| 695 | - $this->db->where($field, $search_array); |
|
| 696 | - break; |
|
| 697 | - case "4": |
|
| 698 | - $this->db->where($field . ' <>', $search_array); |
|
| 699 | - break; |
|
| 700 | - case "5": |
|
| 652 | + if (!empty($value[1])) { |
|
| 653 | + $this->db->where($field . ' <= ', gmdate('Y-m-d H:i:s',strtotime($value[1]))); |
|
| 654 | + } |
|
| 655 | + } |
|
| 656 | + } |
|
| 657 | + |
|
| 658 | + function get_interger_array($field, $value, $search_array) { |
|
| 659 | + if ($search_array != '') { |
|
| 660 | + switch ($value) { |
|
| 661 | + case "1": |
|
| 662 | + $this->db->where($field, $search_array); |
|
| 663 | + break; |
|
| 664 | + case "2": |
|
| 665 | + $this->db->where($field . ' <>', $search_array); |
|
| 666 | + break; |
|
| 667 | + case "3": |
|
| 668 | + $this->db->where($field . ' > ', $search_array); |
|
| 669 | + break; |
|
| 670 | + case "4": |
|
| 671 | + $this->db->where($field . ' < ', $search_array); |
|
| 672 | + break; |
|
| 673 | + case "5": |
|
| 674 | + $this->db->where($field . ' >= ', $search_array); |
|
| 675 | + break; |
|
| 676 | + case "6": |
|
| 677 | + $this->db->where($field . ' <= ', $search_array); |
|
| 678 | + break; |
|
| 679 | + } |
|
| 680 | + } |
|
| 681 | + } |
|
| 682 | + |
|
| 683 | + function get_string_array($field, $value, $search_array) { |
|
| 684 | + if ($search_array != '') { |
|
| 685 | + switch ($value) { |
|
| 686 | + case "1": |
|
| 687 | + $str1 = $field . " LIKE '%$search_array%'"; |
|
| 688 | + $this->db->where($str1); |
|
| 689 | + break; |
|
| 690 | + case "2": |
|
| 691 | + $str1 = $field . " NOT LIKE '%$search_array%'"; |
|
| 692 | + $this->db->where($str1); |
|
| 693 | + break; |
|
| 694 | + case "3": |
|
| 695 | + $this->db->where($field, $search_array); |
|
| 696 | + break; |
|
| 697 | + case "4": |
|
| 698 | + $this->db->where($field . ' <>', $search_array); |
|
| 699 | + break; |
|
| 700 | + case "5": |
|
| 701 | 701 | if($field == "pattern"){ |
| 702 | 702 | $str1 = $field . " LIKE '^".$search_array."%'"; |
| 703 | 703 | $this->db->where($str1); |
@@ -706,8 +706,8 @@ discard block |
||
| 706 | 706 | $this->db->where($str1); |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - break; |
|
| 710 | - case "6": |
|
| 709 | + break; |
|
| 710 | + case "6": |
|
| 711 | 711 | if($field == "pattern"){ |
| 712 | 712 | $str1 = $field . " LIKE '%".$search_array.".*'"; |
| 713 | 713 | $this->db->where($str1); |
@@ -716,293 +716,293 @@ discard block |
||
| 716 | 716 | $this->db->where($str1); |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | - break; |
|
| 720 | - } |
|
| 721 | - } |
|
| 722 | - } |
|
| 719 | + break; |
|
| 720 | + } |
|
| 721 | + } |
|
| 722 | + } |
|
| 723 | 723 | function build_search_string($accounts_list_search) { |
| 724 | 724 | $where = null; |
| 725 | 725 | $search=$this->session->userdata($accounts_list_search); |
| 726 | - if ($this->session->userdata('advance_search') == 1) { |
|
| 727 | - $account_search = $this->session->userdata($accounts_list_search); |
|
| 728 | - unset($account_search["ajax_search"]); |
|
| 729 | - unset($account_search["advance_search"]); |
|
| 730 | - if (!empty($account_search)) { |
|
| 731 | - foreach ($account_search as $key => $value) { |
|
| 732 | - if ($value != "") { |
|
| 733 | - if (is_array($value)) { |
|
| 734 | - if (array_key_exists($key . "-integer", $value)) { |
|
| 726 | + if ($this->session->userdata('advance_search') == 1) { |
|
| 727 | + $account_search = $this->session->userdata($accounts_list_search); |
|
| 728 | + unset($account_search["ajax_search"]); |
|
| 729 | + unset($account_search["advance_search"]); |
|
| 730 | + if (!empty($account_search)) { |
|
| 731 | + foreach ($account_search as $key => $value) { |
|
| 732 | + if ($value != "") { |
|
| 733 | + if (is_array($value)) { |
|
| 734 | + if (array_key_exists($key . "-integer", $value)) { |
|
| 735 | 735 | $string=null; |
| 736 | - $string =$this->build_interger_where($key, $value[$key . "-integer"], $value[$key]); |
|
| 737 | - if($string) |
|
| 738 | - $where.= "$string AND "; |
|
| 739 | - } |
|
| 740 | - if (array_key_exists($key . "-string", $value)) { |
|
| 736 | + $string =$this->build_interger_where($key, $value[$key . "-integer"], $value[$key]); |
|
| 737 | + if($string) |
|
| 738 | + $where.= "$string AND "; |
|
| 739 | + } |
|
| 740 | + if (array_key_exists($key . "-string", $value)) { |
|
| 741 | 741 | $string=null; |
| 742 | - $string=$this->build_string_where($key, $value[$key . "-string"], $value[$key]); |
|
| 743 | - if($string) |
|
| 744 | - $where.= "$string AND "; |
|
| 745 | - } |
|
| 746 | - if ($key == 'callstart'|| $key == 'date'||$key== 'log_time') { |
|
| 742 | + $string=$this->build_string_where($key, $value[$key . "-string"], $value[$key]); |
|
| 743 | + if($string) |
|
| 744 | + $where.= "$string AND "; |
|
| 745 | + } |
|
| 746 | + if ($key == 'callstart'|| $key == 'date'||$key== 'log_time') { |
|
| 747 | 747 | $string=null; |
| 748 | - $string=$this->build_date_where($key, $value); |
|
| 749 | - if($string) |
|
| 750 | - $where.= "$string AND "; |
|
| 751 | - } |
|
| 752 | - } else { |
|
| 753 | - $where.="$key = '$value'AND "; |
|
| 754 | - } |
|
| 755 | - } |
|
| 756 | - } |
|
| 757 | - } |
|
| 758 | - } |
|
| 759 | - $where =rtrim($where ," AND "); |
|
| 760 | - return $where; |
|
| 761 | - } |
|
| 762 | - // This function using by reports module don't delete it |
|
| 763 | - function build_string_where($field, $value, $search_array){ |
|
| 748 | + $string=$this->build_date_where($key, $value); |
|
| 749 | + if($string) |
|
| 750 | + $where.= "$string AND "; |
|
| 751 | + } |
|
| 752 | + } else { |
|
| 753 | + $where.="$key = '$value'AND "; |
|
| 754 | + } |
|
| 755 | + } |
|
| 756 | + } |
|
| 757 | + } |
|
| 758 | + } |
|
| 759 | + $where =rtrim($where ," AND "); |
|
| 760 | + return $where; |
|
| 761 | + } |
|
| 762 | + // This function using by reports module don't delete it |
|
| 763 | + function build_string_where($field, $value, $search_array){ |
|
| 764 | 764 | $where=null; |
| 765 | - if ($search_array != '') { |
|
| 766 | - switch ($value) { |
|
| 767 | - case "1": |
|
| 768 | - $where = "$field LIKE '%$search_array%'"; |
|
| 769 | - break; |
|
| 770 | - case "2": |
|
| 771 | - $where = "$field NOT LIKE '%$search_array%'"; |
|
| 772 | - break; |
|
| 773 | - case "3": |
|
| 774 | - $where = "$field = '$search_array'"; |
|
| 775 | - break; |
|
| 776 | - case "4": |
|
| 777 | - $where = "$field <> '$search_array'"; |
|
| 778 | - break; |
|
| 779 | - case "5": |
|
| 780 | - if($field == "pattern"){ |
|
| 781 | - $where = $field . " LIKE '^".$search_array."%'"; |
|
| 782 | - }else{ |
|
| 783 | - $where = $field . " LIKE '".$search_array."%'"; |
|
| 784 | - } |
|
| 785 | - break; |
|
| 786 | - case "6": |
|
| 787 | - if($field == "pattern"){ |
|
| 788 | - $str1 = $field . " LIKE '%".$search_array.".*'"; |
|
| 789 | - }else{ |
|
| 790 | - $str1 = $field . " LIKE '%".$search_array."'"; |
|
| 791 | - } |
|
| 792 | - break; |
|
| 793 | - } |
|
| 794 | - } |
|
| 795 | - return $where; |
|
| 796 | - } |
|
| 765 | + if ($search_array != '') { |
|
| 766 | + switch ($value) { |
|
| 767 | + case "1": |
|
| 768 | + $where = "$field LIKE '%$search_array%'"; |
|
| 769 | + break; |
|
| 770 | + case "2": |
|
| 771 | + $where = "$field NOT LIKE '%$search_array%'"; |
|
| 772 | + break; |
|
| 773 | + case "3": |
|
| 774 | + $where = "$field = '$search_array'"; |
|
| 775 | + break; |
|
| 776 | + case "4": |
|
| 777 | + $where = "$field <> '$search_array'"; |
|
| 778 | + break; |
|
| 779 | + case "5": |
|
| 780 | + if($field == "pattern"){ |
|
| 781 | + $where = $field . " LIKE '^".$search_array."%'"; |
|
| 782 | + }else{ |
|
| 783 | + $where = $field . " LIKE '".$search_array."%'"; |
|
| 784 | + } |
|
| 785 | + break; |
|
| 786 | + case "6": |
|
| 787 | + if($field == "pattern"){ |
|
| 788 | + $str1 = $field . " LIKE '%".$search_array.".*'"; |
|
| 789 | + }else{ |
|
| 790 | + $str1 = $field . " LIKE '%".$search_array."'"; |
|
| 791 | + } |
|
| 792 | + break; |
|
| 793 | + } |
|
| 794 | + } |
|
| 795 | + return $where; |
|
| 796 | + } |
|
| 797 | 797 | |
| 798 | - function build_interger_where($field, $value, $search_array) { |
|
| 798 | + function build_interger_where($field, $value, $search_array) { |
|
| 799 | 799 | $where=null; |
| 800 | - if ($search_array != '') { |
|
| 801 | - if(is_numeric($search_array)) |
|
| 802 | - { |
|
| 800 | + if ($search_array != '') { |
|
| 801 | + if(is_numeric($search_array)) |
|
| 802 | + { |
|
| 803 | 803 | switch ($value) { |
| 804 | - case "1": |
|
| 804 | + case "1": |
|
| 805 | 805 | $where = "$field = '$search_array'"; |
| 806 | 806 | break; |
| 807 | - case "2": |
|
| 807 | + case "2": |
|
| 808 | 808 | $where = "$field <> '$search_array'"; |
| 809 | 809 | break; |
| 810 | - case "3": |
|
| 810 | + case "3": |
|
| 811 | 811 | $where = "$field > '$search_array'"; |
| 812 | 812 | break; |
| 813 | - case "4": |
|
| 813 | + case "4": |
|
| 814 | 814 | $where = "$field < '$search_array'"; |
| 815 | 815 | break; |
| 816 | - case "5": |
|
| 816 | + case "5": |
|
| 817 | 817 | $where = "$field >= '$search_array'"; |
| 818 | 818 | break; |
| 819 | - case "6": |
|
| 819 | + case "6": |
|
| 820 | 820 | $where = "$field <= '$search_array'"; |
| 821 | 821 | break; |
| 822 | 822 | } |
| 823 | - } |
|
| 824 | - else |
|
| 825 | - { |
|
| 826 | - $this->db->where("$field IS NULL"); |
|
| 827 | - $where= "$field IS NULL"; |
|
| 828 | - } |
|
| 829 | - } |
|
| 830 | - return $where; |
|
| 831 | - } |
|
| 832 | - function build_date_where($field, $value) { |
|
| 823 | + } |
|
| 824 | + else |
|
| 825 | + { |
|
| 826 | + $this->db->where("$field IS NULL"); |
|
| 827 | + $where= "$field IS NULL"; |
|
| 828 | + } |
|
| 829 | + } |
|
| 830 | + return $where; |
|
| 831 | + } |
|
| 832 | + function build_date_where($field, $value) { |
|
| 833 | 833 | $where =null; |
| 834 | - if ($value != '') { |
|
| 835 | - if (!empty($value[0])) { |
|
| 834 | + if ($value != '') { |
|
| 835 | + if (!empty($value[0])) { |
|
| 836 | 836 | $string=null; |
| 837 | - $string="$field >= '$value[0]'"; |
|
| 838 | - if($string) |
|
| 839 | - $where.=$string." AND "; |
|
| 840 | - } |
|
| 841 | - if (!empty($value[1])) { |
|
| 837 | + $string="$field >= '$value[0]'"; |
|
| 838 | + if($string) |
|
| 839 | + $where.=$string." AND "; |
|
| 840 | + } |
|
| 841 | + if (!empty($value[1])) { |
|
| 842 | 842 | $string=null; |
| 843 | - $string="$field <= '$value[1]'"; |
|
| 844 | - if($string) |
|
| 845 | - $where.=$string." AND "; |
|
| 846 | - } |
|
| 847 | - } |
|
| 848 | - if($where){ |
|
| 843 | + $string="$field <= '$value[1]'"; |
|
| 844 | + if($string) |
|
| 845 | + $where.=$string." AND "; |
|
| 846 | + } |
|
| 847 | + } |
|
| 848 | + if($where){ |
|
| 849 | 849 | $where =rtrim($where," AND "); |
| 850 | - } |
|
| 851 | - return $where; |
|
| 852 | - } |
|
| 853 | - function get_available_bal($account_info) { |
|
| 854 | - $available_bal = 0; |
|
| 855 | - $available_bal = ($account_info["balance"]) + $account_info["posttoexternal"] * ($account_info["credit_limit"]); |
|
| 856 | - return $available_bal; |
|
| 857 | - } |
|
| 858 | - |
|
| 859 | - function update_balance($amount, $accountid, $payment_type) { |
|
| 860 | - if ($payment_type == "debit") { |
|
| 861 | - $query = 'UPDATE `accounts` SET `balance` = (balance - ' . $amount . ') WHERE `id` = ' . $accountid; |
|
| 862 | - return $this->db->query($query); |
|
| 863 | - } else { |
|
| 864 | - $query = 'UPDATE `accounts` SET `balance` = (balance + ' . $amount . ') WHERE `id` = ' . $accountid; |
|
| 865 | - return $this->db->query($query); |
|
| 866 | - } |
|
| 867 | - } |
|
| 868 | - |
|
| 869 | - function build_batch_update_array($update_array) { |
|
| 870 | - $updateflg = false; |
|
| 871 | - foreach ($update_array as $key => $update_fields) { |
|
| 872 | - if (is_array($update_fields)) { |
|
| 873 | - switch ($update_fields["operator"]) { |
|
| 874 | - case "1": |
|
| 875 | - // $this->db->where($field, $search_array); |
|
| 876 | - break; |
|
| 877 | - case "2": |
|
| 878 | - if($update_fields[$key] != ''){ |
|
| 879 | - $updateflg = true; |
|
| 880 | - $this->db->set($key,$update_fields[$key]); |
|
| 881 | - } |
|
| 882 | - break; |
|
| 883 | - case "3": |
|
| 884 | - $this->db->set($key, $key . "+" . $update_fields[$key], FALSE); |
|
| 885 | - $updateflg = true; |
|
| 886 | - break; |
|
| 887 | - case "4": |
|
| 888 | - $this->db->set($key, $key . "-" . $update_fields[$key], FALSE); |
|
| 889 | - $updateflg = true; |
|
| 890 | - break; |
|
| 891 | - } |
|
| 892 | - } else { |
|
| 893 | - if ($update_fields != ""){ |
|
| 894 | - $this->db->set($key,$update_fields); |
|
| 895 | - $updateflg = true; |
|
| 896 | - } |
|
| 897 | - } |
|
| 898 | - } |
|
| 899 | - return $updateflg; |
|
| 900 | - } |
|
| 901 | - function build_search_opensips($opensips_db_obj,$accounts_list_search) { |
|
| 902 | - if ($this->session->userdata('advance_search') == 1) { |
|
| 903 | - $account_search = $this->session->userdata($accounts_list_search); |
|
| 904 | - unset($account_search["ajax_search"]); |
|
| 905 | - unset($account_search["advance_search"]); |
|
| 906 | - foreach ($account_search as $key => $value) { |
|
| 907 | - if ($value != "") { |
|
| 908 | - if (is_array($value)) { |
|
| 909 | - if (array_key_exists($key . "-integer", $value)) { |
|
| 910 | - $this->get_opensips_interger_array($opensips_db_obj,$key, $value[$key . "-integer"], $value[$key]); |
|
| 911 | - } |
|
| 912 | - if (array_key_exists($key . "-string", $value)) { |
|
| 913 | - $this->get_opensips_string_array($opensips_db_obj,$key, $value[$key . "-string"], $value[$key]); |
|
| 914 | - } |
|
| 915 | - } else { |
|
| 916 | - $opensips_db_obj->where($key, $value); |
|
| 917 | - } |
|
| 918 | - } |
|
| 919 | - } |
|
| 920 | - } |
|
| 921 | - } |
|
| 922 | - |
|
| 923 | - function get_opensips_interger_array($opensips_db_obj,$field, $value, $search_array) { |
|
| 924 | - if ($search_array != '') { |
|
| 925 | - switch ($value) { |
|
| 926 | - case "1": |
|
| 927 | - $opensips_db_obj->where($field, $search_array); |
|
| 928 | - break; |
|
| 929 | - case "2": |
|
| 930 | - $opensips_db_obj->where($field . ' <>', $search_array); |
|
| 931 | - break; |
|
| 932 | - case "3": |
|
| 933 | - $opensips_db_obj->where($field . ' > ', $search_array); |
|
| 934 | - break; |
|
| 935 | - case "4": |
|
| 936 | - $opensips_db_obj->where($field . ' < ', $search_array); |
|
| 937 | - break; |
|
| 938 | - case "5": |
|
| 939 | - $opensips_db_obj->where($field . ' >= ', $search_array); |
|
| 940 | - break; |
|
| 941 | - case "6": |
|
| 942 | - $opensips_db_obj->where($field . ' <= ', $search_array); |
|
| 943 | - break; |
|
| 944 | - } |
|
| 945 | - } |
|
| 946 | - } |
|
| 947 | - |
|
| 948 | - function get_opensips_string_array($opensips_db_obj,$field, $value, $search_array) { |
|
| 949 | - if ($search_array != '') { |
|
| 950 | - switch ($value) { |
|
| 951 | - case "1": |
|
| 952 | - $opensips_db_obj->like($field, $search_array); |
|
| 953 | - break; |
|
| 954 | - case "2": |
|
| 955 | - $opensips_db_obj->not_like($field, $search_array); |
|
| 956 | - break; |
|
| 957 | - case "3": |
|
| 958 | - $opensips_db_obj->where($field, $search_array); |
|
| 959 | - break; |
|
| 960 | - case "4": |
|
| 961 | - $opensips_db_obj->where($field . ' <>', $search_array); |
|
| 962 | - break; |
|
| 963 | - case "5": |
|
| 964 | - $str1 = $field . " LIKE '".$search_array."%'"; |
|
| 965 | - $opensips_db_obj->where($str1); |
|
| 966 | - break; |
|
| 850 | + } |
|
| 851 | + return $where; |
|
| 852 | + } |
|
| 853 | + function get_available_bal($account_info) { |
|
| 854 | + $available_bal = 0; |
|
| 855 | + $available_bal = ($account_info["balance"]) + $account_info["posttoexternal"] * ($account_info["credit_limit"]); |
|
| 856 | + return $available_bal; |
|
| 857 | + } |
|
| 858 | + |
|
| 859 | + function update_balance($amount, $accountid, $payment_type) { |
|
| 860 | + if ($payment_type == "debit") { |
|
| 861 | + $query = 'UPDATE `accounts` SET `balance` = (balance - ' . $amount . ') WHERE `id` = ' . $accountid; |
|
| 862 | + return $this->db->query($query); |
|
| 863 | + } else { |
|
| 864 | + $query = 'UPDATE `accounts` SET `balance` = (balance + ' . $amount . ') WHERE `id` = ' . $accountid; |
|
| 865 | + return $this->db->query($query); |
|
| 866 | + } |
|
| 867 | + } |
|
| 868 | + |
|
| 869 | + function build_batch_update_array($update_array) { |
|
| 870 | + $updateflg = false; |
|
| 871 | + foreach ($update_array as $key => $update_fields) { |
|
| 872 | + if (is_array($update_fields)) { |
|
| 873 | + switch ($update_fields["operator"]) { |
|
| 874 | + case "1": |
|
| 875 | + // $this->db->where($field, $search_array); |
|
| 876 | + break; |
|
| 877 | + case "2": |
|
| 878 | + if($update_fields[$key] != ''){ |
|
| 879 | + $updateflg = true; |
|
| 880 | + $this->db->set($key,$update_fields[$key]); |
|
| 881 | + } |
|
| 882 | + break; |
|
| 883 | + case "3": |
|
| 884 | + $this->db->set($key, $key . "+" . $update_fields[$key], FALSE); |
|
| 885 | + $updateflg = true; |
|
| 886 | + break; |
|
| 887 | + case "4": |
|
| 888 | + $this->db->set($key, $key . "-" . $update_fields[$key], FALSE); |
|
| 889 | + $updateflg = true; |
|
| 890 | + break; |
|
| 891 | + } |
|
| 892 | + } else { |
|
| 893 | + if ($update_fields != ""){ |
|
| 894 | + $this->db->set($key,$update_fields); |
|
| 895 | + $updateflg = true; |
|
| 896 | + } |
|
| 897 | + } |
|
| 898 | + } |
|
| 899 | + return $updateflg; |
|
| 900 | + } |
|
| 901 | + function build_search_opensips($opensips_db_obj,$accounts_list_search) { |
|
| 902 | + if ($this->session->userdata('advance_search') == 1) { |
|
| 903 | + $account_search = $this->session->userdata($accounts_list_search); |
|
| 904 | + unset($account_search["ajax_search"]); |
|
| 905 | + unset($account_search["advance_search"]); |
|
| 906 | + foreach ($account_search as $key => $value) { |
|
| 907 | + if ($value != "") { |
|
| 908 | + if (is_array($value)) { |
|
| 909 | + if (array_key_exists($key . "-integer", $value)) { |
|
| 910 | + $this->get_opensips_interger_array($opensips_db_obj,$key, $value[$key . "-integer"], $value[$key]); |
|
| 911 | + } |
|
| 912 | + if (array_key_exists($key . "-string", $value)) { |
|
| 913 | + $this->get_opensips_string_array($opensips_db_obj,$key, $value[$key . "-string"], $value[$key]); |
|
| 914 | + } |
|
| 915 | + } else { |
|
| 916 | + $opensips_db_obj->where($key, $value); |
|
| 917 | + } |
|
| 918 | + } |
|
| 919 | + } |
|
| 920 | + } |
|
| 921 | + } |
|
| 922 | + |
|
| 923 | + function get_opensips_interger_array($opensips_db_obj,$field, $value, $search_array) { |
|
| 924 | + if ($search_array != '') { |
|
| 925 | + switch ($value) { |
|
| 926 | + case "1": |
|
| 927 | + $opensips_db_obj->where($field, $search_array); |
|
| 928 | + break; |
|
| 929 | + case "2": |
|
| 930 | + $opensips_db_obj->where($field . ' <>', $search_array); |
|
| 931 | + break; |
|
| 932 | + case "3": |
|
| 933 | + $opensips_db_obj->where($field . ' > ', $search_array); |
|
| 934 | + break; |
|
| 935 | + case "4": |
|
| 936 | + $opensips_db_obj->where($field . ' < ', $search_array); |
|
| 937 | + break; |
|
| 938 | + case "5": |
|
| 939 | + $opensips_db_obj->where($field . ' >= ', $search_array); |
|
| 940 | + break; |
|
| 941 | + case "6": |
|
| 942 | + $opensips_db_obj->where($field . ' <= ', $search_array); |
|
| 943 | + break; |
|
| 944 | + } |
|
| 945 | + } |
|
| 946 | + } |
|
| 947 | + |
|
| 948 | + function get_opensips_string_array($opensips_db_obj,$field, $value, $search_array) { |
|
| 949 | + if ($search_array != '') { |
|
| 950 | + switch ($value) { |
|
| 951 | + case "1": |
|
| 952 | + $opensips_db_obj->like($field, $search_array); |
|
| 953 | + break; |
|
| 954 | + case "2": |
|
| 955 | + $opensips_db_obj->not_like($field, $search_array); |
|
| 956 | + break; |
|
| 957 | + case "3": |
|
| 958 | + $opensips_db_obj->where($field, $search_array); |
|
| 959 | + break; |
|
| 960 | + case "4": |
|
| 961 | + $opensips_db_obj->where($field . ' <>', $search_array); |
|
| 962 | + break; |
|
| 963 | + case "5": |
|
| 964 | + $str1 = $field . " LIKE '".$search_array."%'"; |
|
| 965 | + $opensips_db_obj->where($str1); |
|
| 966 | + break; |
|
| 967 | 967 | case "6": |
| 968 | - $str1 = $field . " LIKE '%".$search_array."'"; |
|
| 969 | - $opensips_db_obj->where($str1); |
|
| 970 | - break; |
|
| 971 | - } |
|
| 972 | - } |
|
| 973 | - } |
|
| 968 | + $str1 = $field . " LIKE '%".$search_array."'"; |
|
| 969 | + $opensips_db_obj->where($str1); |
|
| 970 | + break; |
|
| 971 | + } |
|
| 972 | + } |
|
| 973 | + } |
|
| 974 | 974 | /********invoice changes *********/ |
| 975 | 975 | function build_dropdown_invoices($select, $table, $id_where = '', $id_value = '') { |
| 976 | - $select_params = explode(',', $select); |
|
| 977 | - $select_params = explode(',', $select); |
|
| 978 | - if (isset($select_params[3])) { |
|
| 979 | - $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' "; |
|
| 980 | - } else { |
|
| 981 | - $cnt_str = " $select_params[1],' (',$select_params[2],')' "; |
|
| 982 | - } |
|
| 983 | - $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ,".$select_params[4] ; |
|
| 984 | - $logintype = $this->session->userdata('logintype'); |
|
| 985 | - if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') { |
|
| 986 | - $account_data = $this->session->userdata("accountinfo"); |
|
| 987 | - $id_value['reseller_id'] = $account_data['id']; |
|
| 988 | - } |
|
| 989 | - $where = $id_value; |
|
| 990 | - $drp_array = $this->getSelect($select, $table, $where); |
|
| 991 | - $drp_array = $drp_array->result(); |
|
| 992 | - $drp_list = array(); |
|
| 993 | - foreach ($drp_array as $drp_value) { |
|
| 994 | - if($drp_value->type == 3) |
|
| 995 | - { |
|
| 996 | - $drp_list['Provider'][$drp_value->id] = $drp_value->first_name; |
|
| 997 | - }elseif($drp_value->type == 1){ |
|
| 998 | - $drp_list['Reseller'][$drp_value->id] = $drp_value->first_name; |
|
| 999 | - }else{ |
|
| 1000 | - $drp_list['Customer'][$drp_value->id] = $drp_value->first_name; |
|
| 1001 | - } |
|
| 1002 | - } |
|
| 976 | + $select_params = explode(',', $select); |
|
| 977 | + $select_params = explode(',', $select); |
|
| 978 | + if (isset($select_params[3])) { |
|
| 979 | + $cnt_str = " $select_params[1],' ',$select_params[2],' ','(',$select_params[3],')' "; |
|
| 980 | + } else { |
|
| 981 | + $cnt_str = " $select_params[1],' (',$select_params[2],')' "; |
|
| 982 | + } |
|
| 983 | + $select = $select_params[0] . ", concat($cnt_str) as $select_params[1] ,".$select_params[4] ; |
|
| 984 | + $logintype = $this->session->userdata('logintype'); |
|
| 985 | + if (($logintype == 1 || $logintype == 5) && $id_where == 'where_arr') { |
|
| 986 | + $account_data = $this->session->userdata("accountinfo"); |
|
| 987 | + $id_value['reseller_id'] = $account_data['id']; |
|
| 988 | + } |
|
| 989 | + $where = $id_value; |
|
| 990 | + $drp_array = $this->getSelect($select, $table, $where); |
|
| 991 | + $drp_array = $drp_array->result(); |
|
| 992 | + $drp_list = array(); |
|
| 993 | + foreach ($drp_array as $drp_value) { |
|
| 994 | + if($drp_value->type == 3) |
|
| 995 | + { |
|
| 996 | + $drp_list['Provider'][$drp_value->id] = $drp_value->first_name; |
|
| 997 | + }elseif($drp_value->type == 1){ |
|
| 998 | + $drp_list['Reseller'][$drp_value->id] = $drp_value->first_name; |
|
| 999 | + }else{ |
|
| 1000 | + $drp_list['Customer'][$drp_value->id] = $drp_value->first_name; |
|
| 1001 | + } |
|
| 1002 | + } |
|
| 1003 | 1003 | ksort($drp_list); |
| 1004 | - return $drp_list; |
|
| 1005 | - } |
|
| 1004 | + return $drp_list; |
|
| 1005 | + } |
|
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | ?> |
@@ -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 If 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 If 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 |