Fixed: 'This week' condition in filter consider monday as the first day of the week even if language sets otherwise (closes #913).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1291 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
6936eb1022
commit
051875429e
|
@ -339,7 +339,12 @@ class Query < ActiveRecord::Base
|
||||||
when "t"
|
when "t"
|
||||||
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Date.today.to_time), connection.quoted_date((Date.today+1).to_time)]
|
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Date.today.to_time), connection.quoted_date((Date.today+1).to_time)]
|
||||||
when "w"
|
when "w"
|
||||||
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(Time.now.at_beginning_of_week), connection.quoted_date(Time.now.next_week.yesterday)]
|
from = l(:general_first_day_of_week) == '7' ?
|
||||||
|
# week starts on sunday
|
||||||
|
((Date.today.cwday == 7) ? Time.now.at_beginning_of_day : Time.now.at_beginning_of_week - 1.day) :
|
||||||
|
# week starts on monday (Rails default)
|
||||||
|
Time.now.at_beginning_of_week
|
||||||
|
sql = sql + "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(from), connection.quoted_date(from + 7.days)]
|
||||||
when "~"
|
when "~"
|
||||||
sql = sql + "#{db_table}.#{db_field} LIKE '%#{connection.quote_string(v.first)}%'"
|
sql = sql + "#{db_table}.#{db_field} LIKE '%#{connection.quote_string(v.first)}%'"
|
||||||
when "!~"
|
when "!~"
|
||||||
|
|
Loading…
Reference in New Issue