[#4410] Replace Payment Terms with an Enumeration
Instead of using a hard coded value for Payment Terms, they will use Redmine's Enumeration table. This provides an admin gui to managing the value as well as ordering them.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
class AddPaymentTermIdToContracts < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :contracts, :payment_term_id, :integer
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :contracts, :payment_term_id
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class RemovePaymentTermsFromContracts < ActiveRecord::Migration
|
||||
def self.up
|
||||
remove_column :contracts, :payment_terms
|
||||
end
|
||||
|
||||
def self.down
|
||||
add_column :contracts, :payment_terms, :string
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class PopulatePaymentTerms < ActiveRecord::Migration
|
||||
def self.up
|
||||
[0, 15, 30, 45, 60, 75, 90].each_with_index do |days, index|
|
||||
name = "Net #{days}"
|
||||
unless PaymentTerm.find_by_name(name)
|
||||
PaymentTerm.create!(:name => name, :position => index + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
# No-op
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user