BugFix : Admin search user don't return anyone (because all parameter is in condition query)

This commit is contained in:
Adrien Ponchelet 2017-01-30 16:24:57 +01:00
parent 146b9dd6ee
commit 8df1c129ce
2 changed files with 19 additions and 18 deletions

View file

@ -32,6 +32,7 @@
<label for="status">Status</label> <label for="status">Status</label>
<select name="status" id="status" class="form-control"> <select name="status" id="status" class="form-control">
<option value="" {if $smarty.get.status==''} selected="selected"{/if}>------</option>
<option value="Ok" {if $smarty.get.status=='Ok'} selected="selected"{/if}>Active</option> <option value="Ok" {if $smarty.get.status=='Ok'} selected="selected"{/if}>Active</option>
<option value="ToActivate" {if $smarty.get.status=='ToActivate'} selected="selected"{/if}>Inactive</option> <option value="ToActivate" {if $smarty.get.status=='ToActivate'} selected="selected"{/if}>Inactive</option>
</select> </select>
@ -45,6 +46,7 @@
<label for="banned">Banned</label> <label for="banned">Banned</label>
<select name="ban" id="ban" class="form-control"> <select name="ban" id="ban" class="form-control">
<option value="" {if $smarty.get.status==''} selected="selected"{/if}>------</option>
<option value="no" {if $smarty.get.ban=='no'} selected="selected"{/if}>No</option> <option value="no" {if $smarty.get.ban=='no'} selected="selected"{/if}>No</option>
<option value="yes" {if $smarty.get.ban=='yes'} selected="selected"{/if}>Yes</option> <option value="yes" {if $smarty.get.ban=='yes'} selected="selected"{/if}>Yes</option>
</select> </select>
@ -54,7 +56,8 @@
<div class="form-group"> <div class="form-group">
<label for="featured">Featured</label> <label for="featured">Featured</label>
<select name="featured" id="featured" class="form-control"> <select name="featured" id="featured" class="form-control">
<option value="" {if $smarty.get.status==''} selected="selected"{/if}>------</option>
<option value="No" {if $smarty.get.featured=='No'} selected="selected"{/if}>No</option> <option value="No" {if $smarty.get.featured=='No'} selected="selected"{/if}>No</option>
<option value="Yes" {if $smarty.get.featured=='Yes'} selected="selected"{/if}>Yes</option> <option value="Yes" {if $smarty.get.featured=='Yes'} selected="selected"{/if}>Yes</option>
</select> </select>

View file

@ -3849,18 +3849,19 @@ class userquery extends CBCategory{
{ {
global $db; global $db;
$limit = isset($params['limit']);
$order = isset($params['order']); $limit = isset($params['limit']) ? $params['limit'] : NULL;
$order = isset($params['order']) ? $params['order'] : NULL;
$cond = ""; $cond = "";
if(!has_access('admin_access',TRUE) && !$force_admin) if(!has_access('admin_access',TRUE) && !$force_admin)
$cond .= " users.usr_status='Ok' AND users.ban_status ='no' "; $cond .= " users.usr_status='Ok' AND users.ban_status ='no' ";
else else
{ {
if(isset($params['ban'])) if(isset($params['ban']) && $params['ban'])
$cond .= " users.ban_status ='".$params['ban']."'"; $cond .= " users.ban_status ='".$params['ban']."'";
if(isset($params['status'])) if(isset($params['status']) && $params['status'])
{ {
if($cond!='') if($cond!='')
$cond .=" AND "; $cond .=" AND ";
@ -3958,7 +3959,7 @@ class userquery extends CBCategory{
}*/ }*/
//FEATURED //FEATURED
if(isset($params['featured'])) if(isset($params['featured']) && $params['featured'])
{ {
if($cond!='') if($cond!='')
$cond .= ' AND '; $cond .= ' AND ';
@ -3966,7 +3967,7 @@ class userquery extends CBCategory{
} }
//Email //Email
if(isset($params['username'])) if(isset($params['username']) && $params['username'])
{ {
if($cond!='') if($cond!='')
$cond .= ' AND '; $cond .= ' AND ';
@ -3974,7 +3975,7 @@ class userquery extends CBCategory{
} }
//Email //Email
if(isset($params['email'])) if(isset($params['email']) && $params['email'])
{ {
if($cond!='') if($cond!='')
$cond .= ' AND '; $cond .= ' AND ';
@ -3982,7 +3983,7 @@ class userquery extends CBCategory{
} }
//Exclude Users //Exclude Users
if(isset($params['exclude'])) if(isset($params['exclude']) && $params['exclude'])
{ {
if($cond!='') if($cond!='')
$cond .= ' AND '; $cond .= ' AND ';
@ -3990,7 +3991,7 @@ class userquery extends CBCategory{
} }
//Getting specific User //Getting specific User
if(isset($params['userid'])) if(isset($params['userid']) && $params['userid'])
{ {
if($cond!='') if($cond!='')
$cond .= ' AND '; $cond .= ' AND ';
@ -3998,7 +3999,7 @@ class userquery extends CBCategory{
} }
//Sex //Sex
if(isset($params['gender'])) if(isset($params['gender']) && $params['gender'])
{ {
if($cond!='') if($cond!='')
$cond .= ' AND '; $cond .= ' AND ';
@ -4006,7 +4007,7 @@ class userquery extends CBCategory{
} }
//Level //Level
if(isset($params['level'])) if(isset($params['level']) && $params['level'])
{ {
if($cond!='') if($cond!='')
$cond .= ' AND '; $cond .= ' AND ';
@ -4020,10 +4021,8 @@ class userquery extends CBCategory{
$cond .= " ".$params['cond']." "; $cond .= " ".$params['cond']." ";
} }
if(isset($params['count_only']) && !$params['count_only']) if(!isset($params['count_only']) || !$params['count_only'])
{ {
$fields = array( $fields = array(
@ -4046,12 +4045,11 @@ class userquery extends CBCategory{
if( $limit ) if( $limit )
$query .= " LIMIT ".$limit; $query .= " LIMIT ".$limit;
//$result = $db->select(tbl('users'),'*',$cond,$limit,$order);
$result = select( $query ); //$result = $db->select(tbl('users'),'*',$cond,$limit,$order);
$result = select( $query );
} }
if(isset($params['count_only'])){ if(isset($params['count_only'])){
//$cond= substr($cond,8); //$cond= substr($cond,8);