def issues
if @project && params[:query_id]
query = Query.find(params[:query_id])
+ query.executed_by = @user
# ignore query if it's not valid
query = nil unless query.valid?
# override with query conditions
def history
if @project && params[:query_id]
query = Query.find(params[:query_id])
+ query.executed_by = @user
# ignore query if it's not valid
query = nil unless query.valid?
# override with query conditions
def retrieve_query
if params[:query_id]
@query = @project.queries.find(params[:query_id])
+ @query.executed_by = logged_in_user
session[:query] = @query
else
if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id
# Give it a name, required to be valid
- @query = Query.new(:name => "_")
+ @query = Query.new(:name => "_", :executed_by => logged_in_user)
@query.project = @project
if params[:fields] and params[:fields].is_a? Array
params[:fields].each do |field|
private
def find_query
@query = Query.find(params[:id])
+ @query.executed_by = logged_in_user
@project = @query.project
# check if user is allowed to manage queries (same permission as add_query)
authorize('projects', 'add_query')
serialize :filters
attr_protected :project, :user
+ attr_accessor :executed_by
validates_presence_of :name, :on => :save
self.is_public = true
end
+ def executed_by=(user)
+ @executed_by = user
+ set_language_if_valid(user.language) if user
+ end
+
def validate
filters.each_key do |field|
errors.add label_for(field), :activerecord_error_blank unless
"due_date" => { :type => :date, :order => 12 } }
unless project.nil?
# project specific filters
- @available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => @project.users.collect{|s| [s.name, s.id.to_s] } }
- @available_filters["author_id"] = { :type => :list, :order => 5, :values => @project.users.collect{|s| [s.name, s.id.to_s] } }
+ user_values = []
+ user_values << ["<< #{l(:label_me)} >>", "me"] if executed_by
+ user_values += @project.users.collect{|s| [s.name, s.id.to_s] }
+
+ @available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => user_values }
+ @available_filters["author_id"] = { :type => :list, :order => 5, :values => user_values }
@available_filters["category_id"] = { :type => :list_optional, :order => 6, :values => @project.issue_categories.collect{|s| [s.name, s.id.to_s] } }
@available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => @project.versions.collect{|s| [s.name, s.id.to_s] } }
unless @project.children.empty?
end
filters.each_key do |field|
next if field == "subproject_id"
- v = values_for field
+ v = values_for(field).clone
next unless v and !v.empty?
sql = sql + " AND " unless sql.empty?
db_field = field
end
+ # "me" value subsitution
+ if %w(assigned_to_id author_id).include?(field)
+ v.push(executed_by ? executed_by.id.to_s : "0") if v.delete("me")
+ end
+
case operator_for field
when "="
sql = sql + "#{db_table}.#{db_field} IN (" + v.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")"
label_stay_logged_in: Stay logged in
label_disabled: disabled
label_show_completed_versions: Show completed versions
+label_me: me
button_login: Вход
button_submit: Изпращане
label_stay_logged_in: Stay logged in
label_disabled: disabled
label_show_completed_versions: Show completed versions
+label_me: me
button_login: Einloggen
button_submit: OK
label_stay_logged_in: Stay logged in
label_disabled: disabled
label_show_completed_versions: Show completed versions
+label_me: me
button_login: Login
button_submit: Submit
label_stay_logged_in: Stay logged in
label_disabled: disabled
label_show_completed_versions: Show completed versions
+label_me: me
button_login: Conexión
button_submit: Someter
label_stay_logged_in: Rester connecté
label_disabled: désactivé
label_show_completed_versions: Voire les versions passées
+label_me: moi
button_login: Connexion
button_submit: Soumettre
label_stay_logged_in: Stay logged in
label_disabled: disabled
label_show_completed_versions: Show completed versions
+label_me: me
button_login: Login
button_submit: Invia
label_stay_logged_in: Stay logged in
label_disabled: disabled
label_show_completed_versions: Show completed versions
+label_me: me
button_login: ログイン
button_submit: 変更
label_stay_logged_in: Stay logged in\r
label_disabled: disabled\r
label_show_completed_versions: Show completed versions\r
+label_me: me\r
\r
button_login: Login\r
button_submit: Enviar\r
label_stay_logged_in: Rester connecté
label_disabled: désactivé
label_show_completed_versions: Voire les versions passées
+label_me: me
button_login: Login
button_submit: Enviar
label_stay_logged_in: Stay logged in
label_disabled: disabled
label_show_completed_versions: Show completed versions
+label_me: me
button_login: 登录
button_submit: 提交