[#4409] Convert contracts with the billable rate of 50.
This commit is contained in:
@@ -29,7 +29,9 @@ module RedmineContracts
|
||||
end
|
||||
|
||||
# * old_data - YAML string of deliverables to migrate
|
||||
def self.migrate(old_data)
|
||||
def self.migrate(old_data, options={})
|
||||
@contract_rate = options[:contract_rate] ? options[:contract_rate].to_f : 150.0
|
||||
|
||||
@@data = YAML.load(old_data)
|
||||
|
||||
# Map old deliverable ids to the new ones
|
||||
@@ -106,6 +108,7 @@ module RedmineContracts
|
||||
c.account_executive = project.users.first
|
||||
c.start_date ||= Date.today
|
||||
c.end_date ||= Date.today
|
||||
c.billable_rate = @contract_rate
|
||||
end
|
||||
|
||||
contract.save!
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
namespace :redmine_contracts do
|
||||
desc "Migrate data from the budget_plugin to redmine_contracts"
|
||||
task :budget_migration => :environment do
|
||||
options = {}
|
||||
options[:contract_rate] = ENV['contract_rate']
|
||||
|
||||
RedmineContracts::BudgetPluginMigration.check_for_installed_budget_plugin
|
||||
data = RedmineContracts::BudgetPluginMigration.export_data
|
||||
RedmineContracts::BudgetPluginMigration.rename_old_tables
|
||||
RedmineContracts::BudgetPluginMigration.migrate_contracts
|
||||
RedmineContracts::BudgetPluginMigration.migrate(data)
|
||||
RedmineContracts::BudgetPluginMigration.migrate(data, options)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user