} unless activities.empty?
add_custom_fields_filters(TimeEntryCustomField.where(:is_filter => true).all)
- add_associations_custom_fields_filters :project, :user
+ add_associations_custom_fields_filters :project, :issue, :user
@available_filters.each do |field, options|
options[:name] ||= l(options[:label] || "field_#{field}".gsub(/_id$/, ''))
label_readonly: Read-only
label_required: Required
label_attribute_of_project: "Project's %{name}"
+ label_attribute_of_issue: "Issue's %{name}"
label_attribute_of_author: "Author's %{name}"
label_attribute_of_assigned_to: "Assignee's %{name}"
label_attribute_of_user: "User's %{name}"
label_readonly: Lecture
label_required: Obligatoire
label_attribute_of_project: "%{name} du projet"
+ label_attribute_of_issue: "%{name} de la demande"
label_attribute_of_author: "%{name} de l'auteur"
label_attribute_of_assigned_to: "%{name} de l'assigné"
label_attribute_of_user: "%{name} de l'utilisateur"
assert_equal [t3, t1, t2], assigns(:entries)
end
+ def test_index_with_filter_on_issue_custom_field
+ issue = Issue.generate!(:project_id => 1, :tracker_id => 1, :custom_field_values => {2 => 'filter_on_issue_custom_field'})
+ entry = TimeEntry.generate!(:issue => issue, :hours => 2.5)
+
+ get :index, :f => ['issue.cf_2'], :op => {'issue.cf_2' => '='}, :v => {'issue.cf_2' => ['filter_on_issue_custom_field']}
+ assert_response :success
+ assert_equal [entry], assigns(:entries)
+ end
+
def test_index_atom_feed
get :index, :project_id => 1, :format => 'atom'
assert_response :success
version
end
+ def TimeEntry.generate!(attributes={})
+ entry = TimeEntry.new(attributes)
+ entry.user ||= User.find(2)
+ entry.issue ||= Issue.find(1)
+ entry.project ||= entry.issue.project
+ entry.activity ||= TimeEntryActivity.first
+ entry.spent_on ||= Date.today
+ entry.save!
+ entry
+ end
+
def AuthSource.generate!(attributes={})
@generated_auth_source_name ||= 'Auth 0'
@generated_auth_source_name.succ!