Defect #2533
closedstart_date in 2008, submit in 2009 cause ":activerecord_error_invalid"
0%
Description
I'm trying to update this record, with revision 2282 :
mysql> select * from issues where id=124\G *************************** 1. row *************************** id: 124 tracker_id: 11 project_id: 1 subject: zzzzzzzzz description: zzzzzzzzz due_date: 2009-01-01 category_id: NULL status_id: 10 assigned_to_id: 9 priority_id: 4 fixed_version_id: 7 author_id: 9 lock_version: 3 created_on: 2008-12-03 09:36:20 updated_on: 2009-01-15 10:35:47 start_date: 2008-12-12 done_ratio: 100 estimated_hours: 35 1 row in set (0.00 sec)
and got error "activerecord_error_invalid" on start_date. I don't have this error when updating a ticket created in 2009.
Updated by Grégory Duchatelet about 16 years ago
I have removed related issues, and now I can update start date...
Updated by Jean-Baptiste Barth almost 15 years ago
Did you find the explanation to this problem ? It's strange but we don't have much info to investigate. Let us know if we can close, thank you.
Updated by Grégory Duchatelet almost 15 years ago
No I didn't found. However I've faced another bug on updating an issue, it was a bug with i18n handling. I've do some patches :
Index: lib/redmine/i18n.rb =================================================================== --- lib/redmine/i18n.rb (revision 3733) +++ lib/redmine/i18n.rb (working copy) @@ -7,15 +7,23 @@ def l(*args) case args.size when 1 - ::I18n.t(*args) + begin + ::I18n.t(*args) + rescue + args + end when 2 - if args.last.is_a?(Hash) - ::I18n.t(*args) - elsif args.last.is_a?(String) - ::I18n.t(args.first, :value => args.last) - else - ::I18n.t(args.first, :count => args.last) - end + begin + if args.last.is_a?(Hash) + ::I18n.t(*args) + elsif args.last.is_a?(String) + ::I18n.t(args.first, :value => args.last) + else + ::I18n.t(args.first, :count => args.last) + end + rescue + args + end else raise "Translation string with multiple values: #{args.first}" end Index: lib/redmine/export/pdf.rb =================================================================== --- lib/redmine/export/pdf.rb (revision 3733) +++ lib/redmine/export/pdf.rb (working copy) @@ -91,7 +91,7 @@ def Cell(w,h=0,txt='',border=0,ln=0,align='',fill=0,link='') @ic ||= Iconv.new(l(:general_pdf_encoding), 'UTF-8') # these quotation marks are not correctly rendered in the pdf - txt = txt.gsub(/[“�]/, '"') if txt + #txt = txt.gsub(/[“�]/, '"') if txt txt = begin # 0x5c char handling txtar = txt.split('\\') Index: lib/redmine/helpers/gantt.rb =================================================================== --- lib/redmine/helpers/gantt.rb (revision 3733) +++ lib/redmine/helpers/gantt.rb (working copy) @@ -52,29 +52,23 @@ @date_to = (@date_from >> @months) - 1 end - def events=(e) - @events = e - # Adds all ancestors - root_ids = e.select {|i| i.is_a?(Issue) && i.parent_id? }.collect(&:root_id).uniq - if root_ids.any? - # Retrieves all nodes - parents = Issue.find_all_by_root_id(root_ids, :conditions => ["rgt - lft > 1"]) - # Only add ancestors - @events += parents.select {|p| @events.detect {|i| i.is_a?(Issue) && p.is_ancestor_of?(i)}} - end - @events.uniq! - # Sort issues by hierarchy and start dates - @events.sort! {|x,y| - if x.is_a?(Issue) && y.is_a?(Issue) - gantt_issue_compare(x, y, @events) - else - gantt_start_compare(x, y) - end - } - # Removes issues that have no start or end date - @events.reject! {|i| i.is_a?(Issue) && (i.start_date.nil? || i.due_before.nil?) } - @events + #@events = e.sort {|x,y| x.start_date <=> y.start_date } + @events = e.sort {|x,y| + if x.kind_of?(Issue) and y.kind_of?(Issue) + if x.assigned_to == y.assigned_to + x.start_date <=> y.start_date + else + x.assigned_to <=> y.assigned_to + end + else + if x.class == y.class + x.start_date <=> y.start_date + else + x.class.to_s <=> y.class.to_s + end + end + } end def params @@ -239,36 +233,6 @@ imgl.format = format imgl.to_blob end if Object.const_defined?(:Magick) - - private - - def gantt_issue_compare(x, y, issues) - if x.parent_id == y.parent_id - gantt_start_compare(x, y) - elsif x.is_ancestor_of?(y) - -1 - elsif y.is_ancestor_of?(x) - 1 - else - ax = issues.select {|i| i.is_a?(Issue) && i.is_ancestor_of?(x) && !i.is_ancestor_of?(y) }.sort_by(&:lft).first - ay = issues.select {|i| i.is_a?(Issue) && i.is_ancestor_of?(y) && !i.is_ancestor_of?(x) }.sort_by(&:lft).first - if ax.nil? && ay.nil? - gantt_start_compare(x, y) - else - gantt_issue_compare(ax || x, ay || y, issues) - end - end - end - - def gantt_start_compare(x, y) - if x.start_date.nil? - -1 - elsif y.start_date.nil? - 1 - else - x.start_date <=> y.start_date - end - end end end end
Updated by Felix Schäfer almost 15 years ago
- Status changed from New to Closed
- Resolution set to Cant reproduce
Grégory Duchatelet wrote:
No I didn't found. However I've faced another bug on updating an issue, it was a bug with i18n handling.
Be sure to have the right version, i.e. the I18n version 0.4 gem is too new and isn't supported in redmine/rails-we-use yet. If you still think this is a bug, please open a new issue with a description of what problem you had and what the patch solves.
As to your original submission, I'd wager it was some issue with a related issue disallowing some timeframe for the issue you were trying to edit, closing this.