summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2020-04-05 09:47:00 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2020-04-05 09:47:00 +0000
commit4b0ac7a78b31a409f51814303d6b40ecf24801a3 (patch)
treea3cc30182b90ba930b7e76ea855290e95ba464cb /app
parent0904708acf316543676ba36865c1d487eccb5af1 (diff)
downloadredmine-4b0ac7a78b31a409f51814303d6b40ecf24801a3.tar.gz
redmine-4b0ac7a78b31a409f51814303d6b40ecf24801a3.zip
Merged r19651 and r19652 to 4.1-stable (#32973).
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@19657 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/helpers/timelog_helper.rb1
-rw-r--r--app/models/time_entry.rb4
2 files changed, 4 insertions, 1 deletions
diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb
index e0cc51d27..f8f36fbdd 100644
--- a/app/helpers/timelog_helper.rb
+++ b/app/helpers/timelog_helper.rb
@@ -44,6 +44,7 @@ module TimelogHelper
def user_collection_for_select_options(time_entry)
collection = time_entry.assignable_users
+ collection << time_entry.user unless time_entry.user.nil? && !collection.include?(time_entry.user)
principals_options_for_select(collection, time_entry.user_id.to_s)
end
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb
index 38359294d..943613a82 100644
--- a/app/models/time_entry.rb
+++ b/app/models/time_entry.rb
@@ -146,7 +146,9 @@ class TimeEntry < ActiveRecord::Base
end
end
errors.add :project_id, :invalid if project.nil?
- errors.add :user_id, :invalid if user_id != author_id && !self.assignable_users.map(&:id).include?(user_id)
+ if user_id_changed? && user_id != author_id && !self.assignable_users.map(&:id).include?(user_id)
+ errors.add :user_id, :invalid
+ end
errors.add :issue_id, :invalid if (issue_id && !issue) || (issue && project!=issue.project) || @invalid_issue_id
errors.add :activity_id, :inclusion if activity_id_changed? && project && !project.activities.include?(activity)
if spent_on_changed? && user