erp_commerce 3.0.9 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/accepted_credit_card.rb +2 -0
- data/app/models/bank_account.rb +2 -0
- data/app/models/bank_account_type.rb +2 -0
- data/app/models/credit_card.rb +2 -1
- data/app/models/credit_card_account.rb +2 -0
- data/app/models/credit_card_account_party_role.rb +2 -0
- data/app/models/credit_card_account_purpose.rb +5 -3
- data/app/models/fee.rb +1 -0
- data/app/models/fee_type.rb +2 -0
- data/app/models/payment.rb +2 -0
- data/app/models/payment_gateway.rb +4 -2
- data/app/models/payment_gateway_action.rb +1 -0
- data/app/models/price.rb +2 -1
- data/app/models/price_component.rb +2 -1
- data/app/models/price_component_type.rb +2 -0
- data/app/models/pricing_plan.rb +1 -0
- data/app/models/pricing_plan_assignment.rb +2 -1
- data/app/models/pricing_plan_component.rb +1 -0
- data/app/models/valid_price_plan_component.rb +1 -0
- data/db/migrate/20100823174238_erp_commerce_base.rb +243 -1
- data/lib/erp_commerce/version.rb +2 -2
- data/lib/erp_commerce.rb +7 -1
- data/spec/dummy/config/application.rb +6 -0
- data/spec/dummy/config/environments/spec.rb +3 -0
- data/spec/dummy/db/data_migrations/20101011152441_payment_gateway_actions.erp_commerce.rb +28 -0
- data/spec/dummy/db/data_migrations/20101014142230_financial_txn_types.erp_txns_and_accts.rb +16 -0
- data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +15 -0
- data/spec/dummy/db/data_migrations/20110324010232_product_role_types.erp_products.rb +24 -0
- data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +12 -0
- data/spec/dummy/db/data_migrations/20110527160807_add_default_prod_avail_types.erp_products.rb +27 -0
- data/spec/dummy/db/data_migrations/20110605231556_create_order_party_roles.erp_orders.rb +24 -0
- data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +19 -0
- data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +252 -0
- data/spec/dummy/db/data_migrations/20110728201730_create_desktop_app_product_manager.erp_products.rb +26 -0
- data/spec/dummy/db/data_migrations/20110728201731_create_desktop_app_order_manager.erp_orders.rb +26 -0
- data/spec/dummy/db/data_migrations/20110728201732_create_organizer_app_order_management.erp_orders.rb +15 -0
- data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +53 -0
- data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +16 -0
- data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +21 -0
- data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +32 -0
- data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +12 -0
- data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +23 -0
- data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +42 -0
- data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +22 -0
- data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +14 -0
- data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +29 -0
- data/spec/dummy/db/data_migrations/20120229174343_add_orders_widget.erp_orders.rb +29 -0
- data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +11 -0
- data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +19 -0
- data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +23 -0
- data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +20 -0
- data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +16 -0
- data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +24 -0
- data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +23 -0
- data/spec/dummy/db/migrate/20130107214952_base_erp_services.erp_base_erp_svcs.rb +461 -0
- data/spec/dummy/db/migrate/20130107214953_base_tech_services.erp_tech_svcs.rb +271 -0
- data/spec/dummy/db/migrate/20130107214954_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
- data/spec/dummy/db/migrate/20130107214955_create_groups.erp_tech_svcs.rb +19 -0
- data/spec/dummy/db/migrate/20130107214956_upgrade_security.erp_tech_svcs.rb +54 -0
- data/spec/dummy/db/migrate/20130107214957_upgrade_security2.erp_tech_svcs.rb +270 -0
- data/spec/dummy/db/migrate/20130107214958_base_app_framework.erp_app.rb +276 -0
- data/spec/dummy/db/migrate/20130107214959_base_txns_and_accts.erp_txns_and_accts.rb +364 -0
- data/spec/dummy/db/migrate/20130107214960_agreements_services.erp_agreements.rb +160 -0
- data/spec/dummy/db/migrate/20130107214961_agreements_services_indexes.erp_agreements.rb +52 -0
- data/spec/dummy/db/migrate/20130107214962_base_products.erp_products.rb +234 -0
- data/spec/dummy/db/migrate/20130107214963_base_products_indexes.erp_products.rb +59 -0
- data/spec/dummy/db/migrate/20130107214964_base_orders.erp_orders.rb +178 -0
- data/spec/dummy/db/migrate/20130107214965_erp_commerce_base.erp_commerce.rb +442 -0
- data/spec/dummy/db/schema.rb +1821 -0
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/spec.log +16021 -0
- data/spec/models/credit_card_spec.rb +7 -1
- data/spec/spec_helper.rb +12 -3
- metadata +110 -37
- data/db/data_migrations/20130408200643_add_credit_card_biz_txn_acct_types.rb +0 -57
- data/db/migrate/20100913154134_setup_payments.rb +0 -57
- data/db/migrate/20101103132342_pricing_migrations.rb +0 -169
- data/db/migrate/20110921150854_create_fees.rb +0 -50
- data/db/migrate/20120308220606_add_external_identifier_to_payments.rb +0 -5
- data/db/migrate/20120618144337_create_accepted_credit_cards.rb +0 -11
- data/db/migrate/upgrade/20120117170037_add_bank_account.rb +0 -34
- data/db/migrate/upgrade/20120117190924_add_credit_card_to_account_roles.rb +0 -7
- data/lib/erp_commerce/active_merchant_wrappers/bank_wrapper.rb +0 -17
- data/lib/erp_commerce/active_merchant_wrappers/prismpay_wrapper.rb +0 -106
- data/public/javascripts/extensions/compass_ae/erp_app/desktop/applications/product_manager/product_pricing_panel.js +0 -329
data/app/models/bank_account.rb
CHANGED
data/app/models/credit_card.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
class CreditCardAccountPurpose < ActiveRecord::Base
|
2
|
-
|
3
|
-
include ErpTechSvcs::Utils::DefaultNestedSetMethods
|
2
|
+
attr_protected :created_at, :updated_at
|
4
3
|
|
5
|
-
|
4
|
+
acts_as_nested_set
|
5
|
+
include ErpTechSvcs::Utils::DefaultNestedSetMethods
|
6
|
+
|
7
|
+
has_many :credit_card_accounts
|
6
8
|
end
|
data/app/models/fee.rb
CHANGED
data/app/models/fee_type.rb
CHANGED
data/app/models/payment.rb
CHANGED
data/app/models/price.rb
CHANGED
data/app/models/pricing_plan.rb
CHANGED
@@ -1,5 +1,226 @@
|
|
1
1
|
class ErpCommerceBase < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
+
#fees
|
4
|
+
unless table_exists?(:fees)
|
5
|
+
create_table :fees do |t|
|
6
|
+
t.references :fee_record, :polymorphic => true
|
7
|
+
t.references :money
|
8
|
+
t.references :fee_type
|
9
|
+
t.string :description
|
10
|
+
t.datetime :start_date
|
11
|
+
t.datetime :end_date
|
12
|
+
t.string :external_identifier
|
13
|
+
t.string :external_id_source
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
|
18
|
+
add_index :fees, [:fee_record_id, :fee_record_type], :name => 'fee_record_idx'
|
19
|
+
add_index :fees, :fee_type_id
|
20
|
+
add_index :fees, :money_id
|
21
|
+
end
|
22
|
+
|
23
|
+
unless table_exists?(:fee_types)
|
24
|
+
create_table :fee_types do |t|
|
25
|
+
t.string :internal_identifier
|
26
|
+
t.string :description
|
27
|
+
t.string :comments
|
28
|
+
t.string :external_identifier
|
29
|
+
t.string :external_id_source
|
30
|
+
|
31
|
+
#these columns are required to support the behavior of the plugin 'awesome_nested_set'
|
32
|
+
t.integer :parent_id
|
33
|
+
t.integer :lft
|
34
|
+
t.integer :rgt
|
35
|
+
|
36
|
+
t.timestamps
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
#pricing tables
|
41
|
+
unless table_exists?(:price_component_types)
|
42
|
+
create_table :price_component_types do |t|
|
43
|
+
|
44
|
+
t.string :description
|
45
|
+
t.string :internal_identifier
|
46
|
+
t.string :external_identifier
|
47
|
+
t.string :external_id_source
|
48
|
+
|
49
|
+
t.timestamps
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
unless table_exists?(:pricing_plans)
|
54
|
+
create_table :pricing_plans do |t|
|
55
|
+
|
56
|
+
t.string :description
|
57
|
+
t.string :comments
|
58
|
+
|
59
|
+
t.string :internal_identifier
|
60
|
+
|
61
|
+
t.string :external_identifier
|
62
|
+
t.string :external_id_source
|
63
|
+
|
64
|
+
t.date :from_date
|
65
|
+
t.date :thru_date
|
66
|
+
|
67
|
+
#this is here as a placeholder for an 'interpreter' or 'rule' pattern
|
68
|
+
t.string :matching_rules
|
69
|
+
#this is here as a placeholder for an 'interpreter' or 'rule' pattern
|
70
|
+
t.string :pricing_calculation
|
71
|
+
|
72
|
+
#support for simple assignment of a single money amount
|
73
|
+
t.boolean :is_simple_amount
|
74
|
+
t.integer :currency_id
|
75
|
+
t.decimal :money_amount, :precision => 8, :scale => 2
|
76
|
+
|
77
|
+
t.timestamps
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
unless table_exists?(:pricing_plan_components)
|
82
|
+
create_table :pricing_plan_components do |t|
|
83
|
+
|
84
|
+
t.integer :price_component_type_id
|
85
|
+
t.string :description
|
86
|
+
t.string :comments
|
87
|
+
|
88
|
+
t.string :internal_identifier
|
89
|
+
t.string :external_identifier
|
90
|
+
t.string :external_id_source
|
91
|
+
|
92
|
+
|
93
|
+
#this is here as a placeholder for an 'interpreter' or 'rule' pattern
|
94
|
+
t.string :matching_rules
|
95
|
+
#this is here as a placeholder for an 'interpreter' or 'rule' pattern
|
96
|
+
t.string :pricing_calculation
|
97
|
+
|
98
|
+
#support for simple assignment of a single money amount
|
99
|
+
t.boolean :is_simple_amount
|
100
|
+
t.integer :currency_id
|
101
|
+
t.decimal :money_amount, :precision => 8, :scale => 2
|
102
|
+
|
103
|
+
t.timestamps
|
104
|
+
|
105
|
+
end
|
106
|
+
add_index :pricing_plan_components, :price_component_type_id
|
107
|
+
end
|
108
|
+
|
109
|
+
unless table_exists?(:valid_price_plan_components)
|
110
|
+
create_table :valid_price_plan_components do |t|
|
111
|
+
|
112
|
+
t.references :pricing_plan
|
113
|
+
t.references :pricing_plan_component
|
114
|
+
|
115
|
+
t.timestamps
|
116
|
+
|
117
|
+
end
|
118
|
+
add_index :valid_price_plan_components, :pricing_plan_id
|
119
|
+
add_index :valid_price_plan_components, :pricing_plan_component_id
|
120
|
+
end
|
121
|
+
|
122
|
+
unless table_exists?(:pricing_plan_assignments)
|
123
|
+
create_table :pricing_plan_assignments do |t|
|
124
|
+
|
125
|
+
t.references :pricing_plan
|
126
|
+
|
127
|
+
#support a polymorhic interface to the thing we want to price
|
128
|
+
t.integer :priceable_item_id
|
129
|
+
t.string :priceable_item_type
|
130
|
+
|
131
|
+
t.integer :priority
|
132
|
+
|
133
|
+
t.timestamps
|
134
|
+
|
135
|
+
end
|
136
|
+
add_index :pricing_plan_assignments, :pricing_plan_id
|
137
|
+
add_index :pricing_plan_assignments, [:priceable_item_id,:priceable_item_type], :name => 'priceable_item_idx'
|
138
|
+
end
|
139
|
+
|
140
|
+
unless table_exists?(:prices)
|
141
|
+
create_table :prices do |t|
|
142
|
+
|
143
|
+
t.string :description
|
144
|
+
|
145
|
+
#support a polymorhic interface to the thing that HAS BEEN priced
|
146
|
+
t.integer :priced_item_id
|
147
|
+
t.string :priced_item_type
|
148
|
+
|
149
|
+
#refer to the pricing plan by which this price was calculated
|
150
|
+
t.references :pricing_plan
|
151
|
+
|
152
|
+
t.references :money
|
153
|
+
|
154
|
+
t.timestamps
|
155
|
+
|
156
|
+
end
|
157
|
+
add_index :prices, :money_id
|
158
|
+
add_index :prices, :pricing_plan_id
|
159
|
+
add_index :prices, [:priced_item_id,:priced_item_type], :name => 'priced_item_idx'
|
160
|
+
end
|
161
|
+
|
162
|
+
unless table_exists?(:price_components)
|
163
|
+
create_table :price_components do |t|
|
164
|
+
|
165
|
+
t.string :description
|
166
|
+
t.references :pricing_plan_component
|
167
|
+
t.references :price
|
168
|
+
t.references :money
|
169
|
+
|
170
|
+
#polymorphic relationship
|
171
|
+
t.integer :priced_component_id
|
172
|
+
t.string :priced_component_type
|
173
|
+
|
174
|
+
t.timestamps
|
175
|
+
|
176
|
+
end
|
177
|
+
add_index :price_components, :money_id
|
178
|
+
add_index :price_components, :pricing_plan_component_id
|
179
|
+
add_index :price_components, :price_id
|
180
|
+
add_index :price_components, [:priced_component_id,:priced_component_type], :name => 'priced_component_idx'
|
181
|
+
end
|
182
|
+
|
183
|
+
#payment tables
|
184
|
+
unless table_exists?(:payments)
|
185
|
+
create_table :payments do |t|
|
186
|
+
|
187
|
+
t.column :success, :boolean
|
188
|
+
t.column :reference_number, :string
|
189
|
+
t.column :financial_txn_id, :integer
|
190
|
+
t.column :current_state, :string
|
191
|
+
t.column :authorization_code, :string
|
192
|
+
t.string :external_identifier
|
193
|
+
|
194
|
+
t.timestamps
|
195
|
+
end
|
196
|
+
|
197
|
+
add_index :payments, :financial_txn_id
|
198
|
+
end
|
199
|
+
|
200
|
+
unless table_exists?(:payment_gateways)
|
201
|
+
create_table :payment_gateways do |t|
|
202
|
+
|
203
|
+
t.column :params, :string
|
204
|
+
t.column :payment_gateway_action_id, :integer
|
205
|
+
t.column :payment_id, :integer
|
206
|
+
t.column :response, :string
|
207
|
+
|
208
|
+
t.timestamps
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
unless table_exists?(:payment_gateway_actions)
|
213
|
+
create_table :payment_gateway_actions do |t|
|
214
|
+
|
215
|
+
t.column :internal_identifier, :string
|
216
|
+
t.column :description, :string
|
217
|
+
|
218
|
+
t.timestamps
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
add_index :payment_gateway_actions, :internal_identifier
|
223
|
+
|
3
224
|
#tables
|
4
225
|
unless table_exists?(:credit_cards)
|
5
226
|
create_table :credit_cards do |t|
|
@@ -63,6 +284,16 @@ class ErpCommerceBase < ActiveRecord::Migration
|
|
63
284
|
t.timestamps
|
64
285
|
end
|
65
286
|
end
|
287
|
+
|
288
|
+
unless table_exists?(:accepted_credit_cards)
|
289
|
+
create_table :accepted_credit_cards do |t|
|
290
|
+
|
291
|
+
t.references :organization
|
292
|
+
t.string :card_type
|
293
|
+
|
294
|
+
t.timestamps
|
295
|
+
end
|
296
|
+
end
|
66
297
|
|
67
298
|
unless table_exists?(:bank_account_types)
|
68
299
|
create_table :bank_account_types do |t|
|
@@ -187,7 +418,18 @@ class ErpCommerceBase < ActiveRecord::Migration
|
|
187
418
|
:credit_cards,
|
188
419
|
:credit_card_accounts,
|
189
420
|
:credit_card_account_party_roles,
|
190
|
-
:credit_card_account_purposes
|
421
|
+
:credit_card_account_purposes,
|
422
|
+
:payments,
|
423
|
+
:payment_gateways,
|
424
|
+
:payment_gateway_actions,
|
425
|
+
:pricing_plans,
|
426
|
+
:pricing_plan_components,
|
427
|
+
:valid_price_plan_components,
|
428
|
+
:pricing_plan_assignments,
|
429
|
+
:prices,
|
430
|
+
:price_components,
|
431
|
+
:price_component_types,
|
432
|
+
:fees,:fee_types
|
191
433
|
]
|
192
434
|
drop_tables.each do |table|
|
193
435
|
if table_exists?(table)
|
data/lib/erp_commerce/version.rb
CHANGED
data/lib/erp_commerce.rb
CHANGED
@@ -1,14 +1,20 @@
|
|
1
|
+
require 'aasm'
|
2
|
+
|
3
|
+
#compass engines
|
4
|
+
require 'erp_base_erp_svcs'
|
5
|
+
require 'erp_tech_svcs'
|
6
|
+
require 'erp_app'
|
1
7
|
require 'erp_txns_and_accts'
|
2
8
|
require 'erp_agreements'
|
3
9
|
require 'erp_products'
|
4
10
|
require 'erp_orders'
|
11
|
+
|
5
12
|
require "erp_commerce/version"
|
6
13
|
require 'erp_commerce/active_merchant_wrappers'
|
7
14
|
require 'erp_commerce/extensions'
|
8
15
|
require 'erp_commerce/config'
|
9
16
|
require "erp_commerce/engine"
|
10
17
|
require 'erp_commerce/order_helper'
|
11
|
-
require 'aasm'
|
12
18
|
|
13
19
|
module ErpCommerce
|
14
20
|
end
|
@@ -44,6 +44,12 @@ module Dummy
|
|
44
44
|
|
45
45
|
# Enable the asset pipeline
|
46
46
|
config.assets.enabled = true
|
47
|
+
|
48
|
+
# Enforce whitelist mode for mass assignment.
|
49
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
50
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
51
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
52
|
+
config.active_record.whitelist_attributes = true
|
47
53
|
end
|
48
54
|
end
|
49
55
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
Dummy::Application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
|
+
# Raise exception on mass assignment protection for Active Record models
|
5
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
6
|
+
|
4
7
|
# In the development environment your application's code is reloaded on
|
5
8
|
# every request. This slows down response time but is perfect for development
|
6
9
|
# since you don't have to restart the web server when you make code changes.
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# This migration comes from erp_commerce (originally 20101011152441)
|
2
|
+
class PaymentGatewayActions
|
3
|
+
|
4
|
+
def self.up
|
5
|
+
PaymentGatewayAction.create(
|
6
|
+
:internal_identifier => 'capture',
|
7
|
+
:description => 'capture'
|
8
|
+
)
|
9
|
+
|
10
|
+
PaymentGatewayAction.create(
|
11
|
+
:internal_identifier => 'authorize',
|
12
|
+
:description => 'Authorize'
|
13
|
+
)
|
14
|
+
|
15
|
+
PaymentGatewayAction.create(
|
16
|
+
:internal_identifier => 'full_reverse_of_authorization',
|
17
|
+
:description => 'Full Reverse Of Authorization'
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.down
|
22
|
+
['sale','void_sale','authorize'].each do |iid|
|
23
|
+
type = PaymentGatewayAction.find_by_internal_identifier(iid)
|
24
|
+
type.destroy unless type.nil?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This migration comes from erp_txns_and_accts (originally 20101014142230)
|
2
|
+
class FinancialTxnTypes
|
3
|
+
|
4
|
+
def self.up
|
5
|
+
BizTxnType.create(
|
6
|
+
:description => "Payment Transaction",
|
7
|
+
:internal_identifier => 'payment_txn'
|
8
|
+
)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.down
|
12
|
+
type = BizTxnType.iid('payment_txn')
|
13
|
+
type.destroy unless type.nil?
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# This migration comes from erp_tech_svcs (originally 20110109173616)
|
2
|
+
class CreateCapabilityScopeTypes
|
3
|
+
|
4
|
+
def self.up
|
5
|
+
CapabilityType.create(:internal_identifier => 'download', :description => 'Download') if CapabilityType.where("internal_identifier = 'download'").first.nil?
|
6
|
+
|
7
|
+
ScopeType.create(:description => 'Instance', :internal_identifier => 'instance') if ScopeType.where("internal_identifier = 'instance'").first.nil?
|
8
|
+
ScopeType.create(:description => 'Class', :internal_identifier => 'class') if ScopeType.where("internal_identifier = 'class'").first.nil?
|
9
|
+
ScopeType.create(:description => 'Query', :internal_identifier => 'query') if ScopeType.where("internal_identifier = 'query'").first.nil?
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This migration comes from erp_products (originally 20110324010232)
|
2
|
+
class ProductRoleTypes
|
3
|
+
|
4
|
+
def self.up
|
5
|
+
ProdTypeRelnType.create(:internal_identifier => 'product_type_package_reln', :description => 'Product Type Package Relationship')
|
6
|
+
ProdTypeRoleType.create(:internal_identifier => 'product_type_package', :description => 'Product Type Package')
|
7
|
+
ProdTypeRoleType.create(:internal_identifier => 'packaged_product_type', :description => 'Packaged Product Type')
|
8
|
+
|
9
|
+
ProdInstanceRelnType.create(:internal_identifier => 'product_instance_package_reln', :description => 'Product Instance Package Relantionship')
|
10
|
+
ProdInstanceRoleType.create(:internal_identifier => 'product_instance_package', :description => 'Product Instance Package')
|
11
|
+
ProdInstanceRoleType.create(:internal_identifier => 'packaged_product_instance', :description => 'Packaged Product Instance')
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
['product_type_package_reln','product_type_package','packaged_product_type'].each do |iid|
|
16
|
+
ProdTypeRelnType.iid(iid).destroy
|
17
|
+
end
|
18
|
+
|
19
|
+
['product_instance_package_reln','product_instance_package','packaged_product_instance'].each do |iid|
|
20
|
+
ProdInstanceRoleType.iid(iid).destroy
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This migration comes from erp_base_erp_svcs (originally 20110525001935)
|
2
|
+
class AddUsdCurrency
|
3
|
+
|
4
|
+
def self.up
|
5
|
+
Currency.create(:name => 'US Dollar', :internal_identifier => 'USD', :major_unit_symbol => "$")
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
Currency.usd.destroy
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
data/spec/dummy/db/data_migrations/20110527160807_add_default_prod_avail_types.erp_products.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# This migration comes from erp_products (originally 20110527160807)
|
2
|
+
class AddDefaultProdAvailTypes
|
3
|
+
|
4
|
+
def self.up
|
5
|
+
ProdAvailabilityStatusType.create(
|
6
|
+
:description => 'Available',
|
7
|
+
:internal_identifier => 'available'
|
8
|
+
)
|
9
|
+
|
10
|
+
ProdAvailabilityStatusType.create(
|
11
|
+
:description => 'Sold',
|
12
|
+
:internal_identifier => 'sold'
|
13
|
+
)
|
14
|
+
|
15
|
+
ProdAvailabilityStatusType.create(
|
16
|
+
:description => 'Shipped',
|
17
|
+
:internal_identifier => 'shipped'
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.down
|
22
|
+
%w(available sold shipped).each do |iid|
|
23
|
+
ProdAvailabilityStatusType.find_by_internal_identifier(iid).destroy
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This migration comes from erp_orders (originally 20110605231556)
|
2
|
+
class CreateOrderPartyRoles
|
3
|
+
|
4
|
+
def self.up
|
5
|
+
order_roles = BizTxnPartyRoleType.create(
|
6
|
+
:description => 'Order Roles',
|
7
|
+
:internal_identifier => 'order_roles'
|
8
|
+
)
|
9
|
+
|
10
|
+
buyor_role = BizTxnPartyRoleType.create(
|
11
|
+
:description => 'Payor',
|
12
|
+
:internal_identifier => 'payor'
|
13
|
+
)
|
14
|
+
|
15
|
+
buyor_role.move_to_child_of(order_roles)
|
16
|
+
buyor_role.save
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.down
|
20
|
+
BizTxnPartyRoleType.find_by_internal_identifier('payor').destroy
|
21
|
+
BizTxnPartyRoleType.find_by_internal_identifier('order_roles').destroy
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# This migration comes from erp_base_erp_svcs (originally 20110609150135)
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
class AddIsoCodes
|
5
|
+
|
6
|
+
def self.up
|
7
|
+
#find the erp_base_erp_svcs engine
|
8
|
+
engine_path = Rails::Application::Railties.engines.find{|item| item.engine_name == 'erp_base_erp_svcs'}.config.root.to_s
|
9
|
+
|
10
|
+
GeoCountry.load_from_file(File.join(engine_path,'db/data_sets/geo_countries.yml'))
|
11
|
+
GeoZone.load_from_file(File.join(engine_path,'db/data_sets/geo_zones.yml'))
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
GeoCountry.delete_all
|
16
|
+
GeoZone.delete_all
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|