Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
mah0001 committed Jul 22, 2019
1 parent de938b6 commit 307127e
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions application/models/Catalog_admin_search_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,30 +185,28 @@ function _build_search_query()
$tags=$this->get_param('tag');

$tags_sql=NULL;

if (is_array($tags))
{
$tags_sub_query=NULL;

if (is_array($tags)){
foreach($tags as $key=>$value)
{
if (trim($value)!='')
{
if (trim($value)!=''){
$tags_sql[$key]=sprintf('tag=%s',$this->db->escape($value));
}
}

if ( is_array($tags_sql) && count($tags_sql)>0)
{
if ( is_array($tags_sql) && count($tags_sql)>0){
$tags_sub_query='select sid from survey_tags where '.implode(' OR ',$tags_sql);
}

if ( trim($where_clause)!='')
{
$where_clause.= sprintf(' AND surveys.id in (%s)',$tags_sub_query);
}
else
{
$where_clause.= sprintf(' surveys.id in (%s)',$tags_sub_query);
}
if ( !empty($tags_sub_query)){
if ( trim($where_clause)!=''){
$where_clause.= sprintf(' AND surveys.id in (%s)',$tags_sub_query);
}
else{
$where_clause.= sprintf(' surveys.id in (%s)',$tags_sub_query);
}
}
}

$active_repo_filter='';
Expand Down

0 comments on commit 307127e

Please sign in to comment.