From: Jean-Philippe Lang Date: Wed, 7 Jun 2017 19:56:22 +0000 (+0000) Subject: DOn't show time entries when query is invalid (#23912). X-Git-Tag: 3.4.0~67 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c513037c6edce0d039b2f6ab602be8a309e2b68c;p=redmine.git 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 --- 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? %>

<%= l(:label_no_data) %>

<% else %> @@ -37,6 +38,7 @@ <% end %> <% 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' %>

<% end %> +<% if @query.valid? %> <% unless @report.criteria.empty? %> <% if @report.hours.empty? %>

<%= l(:label_no_data) %>

@@ -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!