⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

top filter doesn't work with use or_where



matiasrj

matiasrj
  • profile picture
  • Member

Posted 21 December 2019 - 10:27 AM

Hello, 

 

I have problem when I want to use top filter after of implement an or_where condition.

 

$crud = new grocery_CRUD();

$crud->unset_edit();
$crud->unset_delete();
$crud->unset_read();
$crud->unset_add();
   
$crud->set_table("tbl_ope");
$crud->set_subject("Operaciones");
$crud->columns(["id","status","tbl_tipo_ope_id","tbl_client_id","dt_start", "dt_finish", "tbl_reg_name"]);

$crud->set_relation("status", "tbl_ope", "status");
$crud->set_relation("id", "tbl_ope", "id");
$crud->set_relation("tbl_client_id", "tbl_client", "name");
$crud->set_relation("tbl_tipo_ope_id", "tbl_tipo_ope", "name_tipo");

$client_list= $this->db->select("tbl_client_id")
                             ->distinct("tbl_client_id")
                            ->get_where("user_client",array ('users_id' => $user_id));
 
$array_aux=$client_list->result_array();
 
for ($i=0; $i<sizeof($array_aux); $i++)
        {
         if ($i==0) {
                   $crud->where('tbl_ope.tbl_client_id',$array_aux[$i]['tbl_client_id'] ) ;
                   
                     }
         else      $crud->or_where('tbl_ope.tbl_client_id',$array_aux[$i]['tbl_client_id']);
        }
$crud->display_as("tbl_reg_name", "Tabla de registro");
$crud->display_as("tbl_tipo_ope_id", "Tipo de Operacion");
$crud->display_as("tbl_client_id", "Cliente");

$crud->unset_clone();
$output = $crud->render();

 

    

 

 

When I use just where ($i==0), filters top works.

But the problem  appear when or_where is applied.