Project

General

Profile

Guide to upgrade to 1.2.0 - Oracle ยป patch-redmine_1.2.0_Oracle.diff

patch for redmine 1.2.0 and Oracle - Juan G, 2011-06-03 09:15

View differences:

app/models/time_entry.rb (revisi?n: 2706)
107 107
    end
108 108
    TimeEntry.maximum(:spent_on, :include => :project, :conditions => finder_conditions.conditions)
109 109
  end
110
 if ActiveRecord::Base.connection.adapter_name == 'OracleEnhanced'
111
   set_date_columns :spent_on, :created_on, :updated_on
112
 end
110 113
end
app/models/version.rb (revisi?n: 2706)
78 78
    if completed_pourcent == 100
79 79
      return false
80 80
    elsif due_date && start_date
81
      done_date = start_date + ((due_date - start_date+1)* completed_pourcent/100).floor
81
      done_date = start_date.to_date + ((due_date.to_date - start_date.to_date+1)* completed_pourcent/100).floor
82 82
      return done_date <= Date.today
83 83
    else
84 84
      false # No issues so it's not late
app/models/project.rb (revisi?n: 2706)
477 477
  # The earliest start date of a project, based on it's issues and versions
478 478
  def start_date
479 479
    [
480
     issues.minimum('start_date'),
480
     (issues.minimum('start_date')).to_date,
481 481
     shared_versions.collect(&:effective_date),
482 482
     shared_versions.collect(&:start_date)
483 483
    ].flatten.compact.min
......
486 486
  # The latest due date of an issue or version
487 487
  def due_date
488 488
    [
489
     issues.maximum('due_date'),
489
     (issues.maximum('due_date')).to_date,
490 490
     shared_versions.collect(&:effective_date),
491
     shared_versions.collect {|v| v.fixed_issues.maximum('due_date')}
491
     shared_versions.collect {|v| (v.fixed_issues.maximum('due_date')).to_date}
492 492
    ].flatten.compact.max
493 493
  end
494 494

  
db/migrate/20100129193402_change_users_mail_notification_to_string.rb (revisi?n: 2706)
1
class ChangeUsersMailNotificationToString < ActiveRecord::Migration
2
  def self.up
3
    rename_column :users, :mail_notification, :mail_notification_bool
4
    add_column :users, :mail_notification, :string, :default => '', :null => false
5
    User.update_all("mail_notification = 'all'", "mail_notification_bool = #{connection.quoted_true}")
6
    User.update_all("mail_notification = 'selected'", "EXISTS (SELECT 1 FROM #{Member.table_name} WHERE #{Member.table_name}.mail_notification = #{connection.quoted_true} AND #{Member.table_name}.user_id = #{User.table_name}.id)")
7
    User.update_all("mail_notification = 'only_my_events'", "mail_notification NOT IN ('all', 'selected')")
8
    remove_column :users, :mail_notification_bool
9
  end
10

  
11
  def self.down
12
    rename_column :users, :mail_notification, :mail_notification_char
13
    add_column :users, :mail_notification, :boolean, :default => true, :null => false
14
    User.update_all("mail_notification = #{connection.quoted_false}", "mail_notification_char <> 'all'")
15
    remove_column :users, :mail_notification_char
16
  end
17
end
1
class ChangeUsersMailNotificationToString < ActiveRecord::Migration
2
  def self.up
3
    rename_column :users, :mail_notification, :mail_notification_bool
4
    add_column :users, :mail_notification, :string, :default => '', :null => true
5
    User.update_all("mail_notification = 'all'", "mail_notification_bool = #{connection.quoted_true}")
6
    User.update_all("mail_notification = 'selected'", "EXISTS (SELECT 1 FROM #{Member.table_name} WHERE #{Member.table_name}.mail_notification = #{connection.quoted_true} AND #{Member.table_name}.user_id = #{User.table_name}.id)")
7
    User.update_all("mail_notification = 'only_my_events'", "mail_notification NOT IN ('all', 'selected')")
8
    remove_column :users, :mail_notification_bool
9
  end
10

  
11
  def self.down
12
    rename_column :users, :mail_notification, :mail_notification_char
13
    add_column :users, :mail_notification, :boolean, :default => true, :null => true
14
    User.update_all("mail_notification = #{connection.quoted_false}", "mail_notification_char <> 'all'")
15
    remove_column :users, :mail_notification_char
16
  end
17
end
db/migrate/20110227125750_change_journal_details_values_to_text.rb (revisi?n: 2706)
1
class ChangeJournalDetailsValuesToText < ActiveRecord::Migration
2
  def self.up
3
    change_column :journal_details, :old_value, :text
4
    change_column :journal_details, :value, :text
5
  end
6

  
7
  def self.down
8
    change_column :journal_details, :old_value, :string
9
    change_column :journal_details, :value, :string
10
  end
11
end
1
class ChangeJournalDetailsValuesToText < ActiveRecord::Migration
2
  def self.up
3
    #change_column :journal_details, :old_value, :text
4
    #change_column :journal_details, :value, :text
5
  end
6

  
7
  def self.down
8
    change_column :journal_details, :old_value, :string
9
    change_column :journal_details, :value, :string
10
  end
11
end
config/initializers/oracle_enhanced.rb (revisi?n: 2706)
1
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates_by_column_name=true
2
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.instance_eval do
3
	self.string_to_date_format="%d/%m/%Y"
4
	self.string_to_time_format="%d/%m/%Y %H:%M:%S"
5
end
lib/redmine/codeset_util.rb (revisi?n: 2706)
17 17
        begin
18 18
          txtar += ic.iconv(str)
19 19
        rescue Iconv::IllegalSequence
20
          txtar += $!.success
21
          str = '?' + $!.failed[1,$!.failed.length]
20
          txtar += ($!.success).to_s
21
          str = '?' + (($!.failed).to_s[1,($!.failed).to_s.length]).to_s
22 22
          retry
23 23
        rescue
24 24
          txtar += $!.success
lib/redmine/helpers/gantt.rb (revisi?n: 2706)
66 66
        end
67 67

  
68 68
        @date_from = Date.civil(@year_from, @month_from, 1)
69
        @date_to = (@date_from >> @months) - 1
69
        @date_to = ((@date_from >> @months) - 1).to_date
70 70

  
71 71
        @subjects = ''
72 72
        @lines = ''
......
393 393
      # Generates a gantt image
394 394
      # Only defined if RMagick is avalaible
395 395
      def to_image(format='PNG')
396
        date_to = (@date_from >> @months)-1
396
        date_to = ((@date_from >> @months)-1).to_date
397 397
        show_weeks = @zoom > 1
398 398
        show_days = @zoom > 2
399 399

  
    (1-1/1)