From 5882629e26abcc6dcf7d1f0a0e62982ea1a308ca Mon Sep 17 00:00:00 2001
From: Jean-Philippe Lang
Date: Mon, 21 Sep 2015 21:00:06 +0000
Subject: [PATCH] Raises time entries comments limit to 1024 (#19885).
git-svn-id: http://svn.redmine.org/redmine/trunk@14621 e93f8b46-1217-0410-a6f0-8f06a7374b81
---
app/models/time_entry.rb | 2 +-
app/views/timelog/_form.html.erb | 2 +-
...1204850_change_time_entries_comments_limit_to_1024.rb | 9 +++++++++
3 files changed, 11 insertions(+), 2 deletions(-)
create mode 100644 db/migrate/20150921204850_change_time_entries_comments_limit_to_1024.rb
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb
index 062e9c80b..b133f502a 100644
--- a/app/models/time_entry.rb
+++ b/app/models/time_entry.rb
@@ -39,7 +39,7 @@ class TimeEntry < ActiveRecord::Base
validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on
validates_numericality_of :hours, :allow_nil => true, :message => :invalid
- validates_length_of :comments, :maximum => 255, :allow_nil => true
+ validates_length_of :comments, :maximum => 1024, :allow_nil => true
validates :spent_on, :date => true
before_validation :set_project_if_nil
validate :validate_time_entry
diff --git a/app/views/timelog/_form.html.erb b/app/views/timelog/_form.html.erb
index cf665cb63..84fb94787 100644
--- a/app/views/timelog/_form.html.erb
+++ b/app/views/timelog/_form.html.erb
@@ -17,7 +17,7 @@
<%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %>
<%= f.text_field :hours, :size => 6, :required => true %>
- <%= f.text_field :comments, :size => 100, :maxlength => 255 %>
+ <%= f.text_field :comments, :size => 100, :maxlength => 1024 %>
<%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %>
<% @time_entry.custom_field_values.each do |value| %>
<%= custom_field_tag_with_label :time_entry, value %>
diff --git a/db/migrate/20150921204850_change_time_entries_comments_limit_to_1024.rb b/db/migrate/20150921204850_change_time_entries_comments_limit_to_1024.rb
new file mode 100644
index 000000000..8366e8f10
--- /dev/null
+++ b/db/migrate/20150921204850_change_time_entries_comments_limit_to_1024.rb
@@ -0,0 +1,9 @@
+class ChangeTimeEntriesCommentsLimitTo1024 < ActiveRecord::Migration
+ def self.up
+ change_column :time_entries, :comments, :string, :limit => 1024
+ end
+
+ def self.down
+ change_column :time_entries, :comments, :string, :limit => 255
+ end
+end
--
2.39.5