diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-06-07 19:56:22 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-06-07 19:56:22 +0000 |
commit | c513037c6edce0d039b2f6ab602be8a309e2b68c (patch) | |
tree | a173d1dae9fc492f1cd7a411351aa9f65e914e8a | |
parent | 78147729187f2394ed73ac9dbe0745d4faacec62 (diff) | |
download | redmine-c513037c6edce0d039b2f6ab602be8a309e2b68c.tar.gz redmine-c513037c6edce0d039b2f6ab602be8a309e2b68c.zip |
DOn't show time entries when query is invalid (#23912).
git-svn-id: http://svn.redmine.org/redmine/trunk@16635 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/views/timelog/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/timelog/report.html.erb | 2 | ||||
-rw-r--r-- | test/functional/timelog_controller_test.rb | 8 |
3 files changed, 12 insertions, 0 deletions
diff --git a/app/views/timelog/index.html.erb b/app/views/timelog/index.html.erb index b863ee40f..0932c58ae 100644 --- a/app/views/timelog/index.html.erb +++ b/app/views/timelog/index.html.erb @@ -10,6 +10,7 @@ <%= render :partial => 'date_range' %> <% end %> +<% if @query.valid? %> <% if @entries.empty? %> <p class="nodata"><%= l(:label_no_data) %></p> <% else %> @@ -37,6 +38,7 @@ <% end %> </div> <% end %> +<% end %> <% content_for :sidebar do %> <%= render_sidebar_queries(TimeEntryQuery, @project) %> diff --git a/app/views/timelog/report.html.erb b/app/views/timelog/report.html.erb index a06b219be..0565c662b 100644 --- a/app/views/timelog/report.html.erb +++ b/app/views/timelog/report.html.erb @@ -26,6 +26,7 @@ <%= link_to l(:button_clear), {:params => request.query_parameters.merge(:criteria => nil)}, :class => 'icon icon-reload' %></p> <% end %> +<% if @query.valid? %> <% unless @report.criteria.empty? %> <% if @report.hours.empty? %> <p class="nodata"><%= l(:label_no_data) %></p> @@ -65,6 +66,7 @@ <% end %> <% end %> <% end %> +<% end %> <% content_for :sidebar do %> <%= render_sidebar_queries(TimeEntryQuery, @project) %> diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb index 4e6df7e1b..b450f5129 100644 --- a/test/functional/timelog_controller_test.rb +++ b/test/functional/timelog_controller_test.rb @@ -989,6 +989,14 @@ class TimelogControllerTest < Redmine::ControllerTest assert_equal 3, values.size end + def test_index_with_invalid_date_filter_should_not_validate + @request.session[:user_id] = 2 + + get :index, :params => {:set_filter => '1', :f => ['spent_on'], :op => {'spent_on' => '='}, :v => {'spent_on' => ['2016-09-010']}} + assert_select_error 'Date is invalid' + assert_select 'table.time-entries', 0 + end + def test_index_with_query query = TimeEntryQuery.new(:project_id => 1, :name => 'Time Entry Query', :visibility => 2) query.save! |