diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8183ed7ad..56777fd22 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -377,7 +377,7 @@ class UsersController < ApplicationController } scope = User.logged.status(@status) @search_by = params[:search_by] ? params[:search_by][:id] : 0 - scope = scope.like(params[:name],@search_by) if params[:name].present? + scope = scope.like(params[:name],"0") if params[:name].present? @user_count = scope.count @user_pages = Paginator.new @user_count, @limit, params['page'] @user_base_tag = params[:id] ? 'base_users':'users_base' diff --git a/app/models/user.rb b/app/models/user.rb index cae5f1aa2..e966742f1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -206,11 +206,11 @@ class User < Principal pattern = "%#{arg.to_s.strip.downcase}%" #where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) if type == "0" - where(" LOWER(login) LIKE :p ", :p => pattern) + where(" LOWER(login) LIKE '#{pattern}' ") elsif type == "1" - where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) + where(" LOWER(concat(lastname, firstname)) LIKE '#{pattern}' ") else - where(" LOWER(mail) LIKE :p ", :p => pattern) + where(" LOWER(mail) LIKE '#{pattern}' ") end end }