erp_inventory 3.0.5 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/app/models/inv_entry_reln.rb +1 -0
  2. data/app/models/inv_entry_reln_type.rb +3 -1
  3. data/app/models/inv_entry_role_type.rb +2 -0
  4. data/app/models/inventory_entry.rb +1 -0
  5. data/app/models/prod_instance_inv_entry.rb +2 -1
  6. data/lib/erp_inventory.rb +2 -0
  7. data/lib/erp_inventory/version.rb +2 -2
  8. data/spec/dummy/config/application.rb +6 -0
  9. data/spec/dummy/config/environments/spec.rb +3 -0
  10. data/spec/dummy/db/data_migrations/20101011152441_payment_gateway_actions.erp_commerce.rb +28 -0
  11. data/spec/dummy/db/data_migrations/20101014142230_financial_txn_types.erp_txns_and_accts.rb +16 -0
  12. data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +15 -0
  13. data/spec/dummy/db/data_migrations/20110324010232_product_role_types.erp_products.rb +24 -0
  14. data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +12 -0
  15. data/spec/dummy/db/data_migrations/20110527160807_add_default_prod_avail_types.erp_products.rb +27 -0
  16. data/spec/dummy/db/data_migrations/20110605231556_create_order_party_roles.erp_orders.rb +24 -0
  17. data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +19 -0
  18. data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +252 -0
  19. data/spec/dummy/db/data_migrations/20110728201730_create_desktop_app_product_manager.erp_products.rb +26 -0
  20. data/spec/dummy/db/data_migrations/20110728201731_create_desktop_app_order_manager.erp_orders.rb +26 -0
  21. data/spec/dummy/db/data_migrations/20110728201732_create_organizer_app_order_management.erp_orders.rb +15 -0
  22. data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +53 -0
  23. data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +16 -0
  24. data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +21 -0
  25. data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +32 -0
  26. data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +12 -0
  27. data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +23 -0
  28. data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +42 -0
  29. data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +22 -0
  30. data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +14 -0
  31. data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +29 -0
  32. data/spec/dummy/db/data_migrations/20120229174343_add_orders_widget.erp_orders.rb +29 -0
  33. data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +11 -0
  34. data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +19 -0
  35. data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +23 -0
  36. data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +20 -0
  37. data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +16 -0
  38. data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +24 -0
  39. data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +23 -0
  40. data/spec/dummy/db/migrate/20121213235616_base_erp_services.erp_base_erp_svcs.rb +461 -0
  41. data/spec/dummy/db/migrate/20121213235617_base_inventory.erp_inventory.rb +91 -0
  42. data/spec/dummy/db/migrate/20121213235618_base_inventory_indexes.erp_inventory.rb +48 -0
  43. data/spec/dummy/db/migrate/20121213235619_base_tech_services.erp_tech_svcs.rb +255 -0
  44. data/spec/dummy/db/migrate/20121213235620_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
  45. data/spec/dummy/db/migrate/20121213235621_base_orders.erp_orders.rb +178 -0
  46. data/spec/dummy/db/migrate/20121213235622_base_products.erp_products.rb +234 -0
  47. data/spec/dummy/db/migrate/20121213235623_base_products_indexes.erp_products.rb +59 -0
  48. data/spec/dummy/db/migrate/20121213235624_base_txns_and_accts.erp_txns_and_accts.rb +364 -0
  49. data/spec/dummy/db/migrate/20121213235625_agreements_services.erp_agreements.rb +160 -0
  50. data/spec/dummy/db/migrate/20121213235626_agreements_services_indexes.erp_agreements.rb +52 -0
  51. data/spec/dummy/db/migrate/20121213235627_base_app_framework.erp_app.rb +276 -0
  52. data/spec/dummy/db/migrate/20121213235628_erp_commerce_base.erp_commerce.rb +442 -0
  53. data/spec/dummy/db/migrate/20130107180714_create_groups.erp_tech_svcs.rb +19 -0
  54. data/spec/dummy/db/migrate/20130107180715_upgrade_security.erp_tech_svcs.rb +54 -0
  55. data/spec/dummy/db/migrate/20130107180716_upgrade_security2.erp_tech_svcs.rb +270 -0
  56. data/spec/dummy/db/schema.rb +1879 -0
  57. data/spec/dummy/db/spec.sqlite3 +0 -0
  58. data/spec/dummy/log/spec.log +9949 -0
  59. data/spec/spec_helper.rb +11 -3
  60. metadata +123 -9
@@ -0,0 +1,442 @@
1
+ # This migration comes from erp_commerce (originally 20100823174238)
2
+ class ErpCommerceBase < ActiveRecord::Migration
3
+ def self.up
4
+ #fees
5
+ unless table_exists?(:fees)
6
+ create_table :fees do |t|
7
+ t.references :fee_record, :polymorphic => true
8
+ t.references :money
9
+ t.references :fee_type
10
+ t.string :description
11
+ t.datetime :start_date
12
+ t.datetime :end_date
13
+ t.string :external_identifier
14
+ t.string :external_id_source
15
+
16
+ t.timestamps
17
+ end
18
+
19
+ add_index :fees, [:fee_record_id, :fee_record_type], :name => 'fee_record_idx'
20
+ add_index :fees, :fee_type_id
21
+ add_index :fees, :money_id
22
+ end
23
+
24
+ unless table_exists?(:fee_types)
25
+ create_table :fee_types do |t|
26
+ t.string :internal_identifier
27
+ t.string :description
28
+ t.string :comments
29
+ t.string :external_identifier
30
+ t.string :external_id_source
31
+
32
+ #these columns are required to support the behavior of the plugin 'awesome_nested_set'
33
+ t.integer :parent_id
34
+ t.integer :lft
35
+ t.integer :rgt
36
+
37
+ t.timestamps
38
+ end
39
+ end
40
+
41
+ #pricing tables
42
+ unless table_exists?(:price_component_types)
43
+ create_table :price_component_types do |t|
44
+
45
+ t.string :description
46
+ t.string :internal_identifier
47
+ t.string :external_identifier
48
+ t.string :external_id_source
49
+
50
+ t.timestamps
51
+ end
52
+ end
53
+
54
+ unless table_exists?(:pricing_plans)
55
+ create_table :pricing_plans do |t|
56
+
57
+ t.string :description
58
+ t.string :comments
59
+
60
+ t.string :internal_identifier
61
+
62
+ t.string :external_identifier
63
+ t.string :external_id_source
64
+
65
+ t.date :from_date
66
+ t.date :thru_date
67
+
68
+ #this is here as a placeholder for an 'interpreter' or 'rule' pattern
69
+ t.string :matching_rules
70
+ #this is here as a placeholder for an 'interpreter' or 'rule' pattern
71
+ t.string :pricing_calculation
72
+
73
+ #support for simple assignment of a single money amount
74
+ t.boolean :is_simple_amount
75
+ t.integer :currency_id
76
+ t.decimal :money_amount, :precision => 8, :scale => 2
77
+
78
+ t.timestamps
79
+ end
80
+ end
81
+
82
+ unless table_exists?(:pricing_plan_components)
83
+ create_table :pricing_plan_components do |t|
84
+
85
+ t.integer :price_component_type_id
86
+ t.string :description
87
+ t.string :comments
88
+
89
+ t.string :internal_identifier
90
+ t.string :external_identifier
91
+ t.string :external_id_source
92
+
93
+
94
+ #this is here as a placeholder for an 'interpreter' or 'rule' pattern
95
+ t.string :matching_rules
96
+ #this is here as a placeholder for an 'interpreter' or 'rule' pattern
97
+ t.string :pricing_calculation
98
+
99
+ #support for simple assignment of a single money amount
100
+ t.boolean :is_simple_amount
101
+ t.integer :currency_id
102
+ t.decimal :money_amount, :precision => 8, :scale => 2
103
+
104
+ t.timestamps
105
+
106
+ end
107
+ add_index :pricing_plan_components, :price_component_type_id
108
+ end
109
+
110
+ unless table_exists?(:valid_price_plan_components)
111
+ create_table :valid_price_plan_components do |t|
112
+
113
+ t.references :pricing_plan
114
+ t.references :pricing_plan_component
115
+
116
+ t.timestamps
117
+
118
+ end
119
+ add_index :valid_price_plan_components, :pricing_plan_id
120
+ add_index :valid_price_plan_components, :pricing_plan_component_id
121
+ end
122
+
123
+ unless table_exists?(:pricing_plan_assignments)
124
+ create_table :pricing_plan_assignments do |t|
125
+
126
+ t.references :pricing_plan
127
+
128
+ #support a polymorhic interface to the thing we want to price
129
+ t.integer :priceable_item_id
130
+ t.string :priceable_item_type
131
+
132
+ t.integer :priority
133
+
134
+ t.timestamps
135
+
136
+ end
137
+ add_index :pricing_plan_assignments, :pricing_plan_id
138
+ add_index :pricing_plan_assignments, [:priceable_item_id,:priceable_item_type], :name => 'priceable_item_idx'
139
+ end
140
+
141
+ unless table_exists?(:prices)
142
+ create_table :prices do |t|
143
+
144
+ t.string :description
145
+
146
+ #support a polymorhic interface to the thing that HAS BEEN priced
147
+ t.integer :priced_item_id
148
+ t.string :priced_item_type
149
+
150
+ #refer to the pricing plan by which this price was calculated
151
+ t.references :pricing_plan
152
+
153
+ t.references :money
154
+
155
+ t.timestamps
156
+
157
+ end
158
+ add_index :prices, :money_id
159
+ add_index :prices, :pricing_plan_id
160
+ add_index :prices, [:priced_item_id,:priced_item_type], :name => 'priced_item_idx'
161
+ end
162
+
163
+ unless table_exists?(:price_components)
164
+ create_table :price_components do |t|
165
+
166
+ t.string :description
167
+ t.references :pricing_plan_component
168
+ t.references :price
169
+ t.references :money
170
+
171
+ #polymorphic relationship
172
+ t.integer :priced_component_id
173
+ t.string :priced_component_type
174
+
175
+ t.timestamps
176
+
177
+ end
178
+ add_index :price_components, :money_id
179
+ add_index :price_components, :pricing_plan_component_id
180
+ add_index :price_components, :price_id
181
+ add_index :price_components, [:priced_component_id,:priced_component_type], :name => 'priced_component_idx'
182
+ end
183
+
184
+ #payment tables
185
+ unless table_exists?(:payments)
186
+ create_table :payments do |t|
187
+
188
+ t.column :success, :boolean
189
+ t.column :reference_number, :string
190
+ t.column :financial_txn_id, :integer
191
+ t.column :current_state, :string
192
+ t.column :authorization_code, :string
193
+ t.string :external_identifier
194
+
195
+ t.timestamps
196
+ end
197
+
198
+ add_index :payments, :financial_txn_id
199
+ end
200
+
201
+ unless table_exists?(:payment_gateways)
202
+ create_table :payment_gateways do |t|
203
+
204
+ t.column :params, :string
205
+ t.column :payment_gateway_action_id, :integer
206
+ t.column :payment_id, :integer
207
+ t.column :response, :string
208
+
209
+ t.timestamps
210
+ end
211
+ end
212
+
213
+ unless table_exists?(:payment_gateway_actions)
214
+ create_table :payment_gateway_actions do |t|
215
+
216
+ t.column :internal_identifier, :string
217
+ t.column :description, :string
218
+
219
+ t.timestamps
220
+ end
221
+ end
222
+
223
+ add_index :payment_gateway_actions, :internal_identifier
224
+
225
+ #tables
226
+ unless table_exists?(:credit_cards)
227
+ create_table :credit_cards do |t|
228
+
229
+ t.column :crypted_private_card_number, :string
230
+ t.column :expiration_month, :integer
231
+ t.column :expiration_year, :integer
232
+
233
+ t.column :description, :string
234
+ t.column :first_name_on_card, :string
235
+ t.column :last_name_on_card, :string
236
+ t.column :card_type, :string
237
+
238
+ t.column :postal_address_id, :integer
239
+ t.column :credit_card_account_purpose_id, :integer
240
+ t.column :credit_card_token, :string
241
+
242
+ t.timestamps
243
+ end
244
+ end
245
+
246
+ unless table_exists?(:credit_card_accounts)
247
+ create_table :credit_card_accounts do |t|
248
+
249
+ t.timestamps
250
+ end
251
+ end
252
+
253
+ unless table_exists?(:credit_card_account_party_roles)
254
+ create_table :credit_card_account_party_roles do |t|
255
+ t.column :credit_card_account_id, :integer
256
+ t.column :role_type_id, :integer
257
+ t.column :party_id, :integer
258
+ t.column :credit_card_id, :integer
259
+
260
+ t.timestamps
261
+ end
262
+
263
+ add_index :credit_card_account_party_roles, :credit_card_account_id
264
+ add_index :credit_card_account_party_roles, :role_type_id
265
+ add_index :credit_card_account_party_roles, :party_id
266
+ add_index :credit_card_account_party_roles, :credit_card_id
267
+ end
268
+
269
+ unless table_exists?(:credit_card_account_purposes)
270
+ create_table :credit_card_account_purposes do |t|
271
+
272
+ t.column :parent_id, :integer
273
+ t.column :lft, :integer
274
+ t.column :rgt, :integer
275
+
276
+ #custom columns go here
277
+
278
+ t.column :description, :string
279
+ t.column :comments, :string
280
+
281
+ t.column :internal_identifier, :string
282
+ t.column :external_identifier, :string
283
+ t.column :external_id_source, :string
284
+
285
+ t.timestamps
286
+ end
287
+ end
288
+
289
+ unless table_exists?(:accepted_credit_cards)
290
+ create_table :accepted_credit_cards do |t|
291
+
292
+ t.references :organization
293
+ t.string :card_type
294
+
295
+ t.timestamps
296
+ end
297
+ end
298
+
299
+ unless table_exists?(:bank_account_types)
300
+ create_table :bank_account_types do |t|
301
+ t.string :description
302
+ t.string :internal_identifier
303
+
304
+ t.timestamps
305
+ end
306
+ end
307
+
308
+ unless table_exists?(:bank_accounts)
309
+ create_table :bank_accounts do |t|
310
+ t.string :routing_number
311
+ t.string :crypted_private_account_number
312
+ t.string :name_on_account
313
+ t.references :bank_account_type
314
+
315
+ t.timestamps
316
+ end
317
+
318
+ add_index :bank_accounts, :bank_account_type_id, :name => 'bank_accounts_account_type_idx'
319
+ end
320
+ #end tables
321
+
322
+ #columns
323
+ unless columns(:order_txns).collect {|c| c.name}.include?('payment_gateway_txn_id')
324
+ add_column :order_txns, :payment_gateway_txn_id, :string
325
+ end
326
+
327
+ unless columns(:order_txns).collect {|c| c.name}.include?('credit_card_id')
328
+ add_column :order_txns, :credit_card_id, :integer
329
+ end
330
+
331
+ unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_first_name')
332
+ add_column :order_txns, :bill_to_first_name, :string
333
+ end
334
+
335
+ unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_last_name')
336
+ add_column :order_txns, :bill_to_last_name, :string
337
+ end
338
+
339
+ unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_address_line_1')
340
+ add_column :order_txns, :bill_to_address_line_1, :string
341
+ end
342
+
343
+ unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_address_line_2')
344
+ add_column :order_txns, :bill_to_address_line_2, :string
345
+ end
346
+
347
+ unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_city')
348
+ add_column :order_txns, :bill_to_city, :string
349
+ end
350
+
351
+ unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_state')
352
+ add_column :order_txns, :bill_to_state, :string
353
+ end
354
+
355
+ unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_postal_code')
356
+ add_column :order_txns, :bill_to_postal_code, :string
357
+ end
358
+
359
+ unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_country')
360
+ add_column :order_txns, :bill_to_country, :string
361
+ end
362
+
363
+ unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_country_name')
364
+ rename_column :order_txns, :bill_to_country, :bill_to_country_name
365
+ rename_column :order_txns, :ship_to_country, :ship_to_country_name
366
+ add_column :order_txns, :bill_to_country, :string
367
+ add_column :order_txns, :ship_to_country, :string
368
+ end
369
+ #end
370
+ end
371
+
372
+ def self.down
373
+
374
+ if columns(:order_txns).collect {|c| c.name}.include?('payment_gateway_txn_id')
375
+ remove_column :order_txns, :payment_gateway_txn_id
376
+ end
377
+
378
+ if columns(:order_txns).collect {|c| c.name}.include?('credit_card_id')
379
+ remove_column :order_txns, :credit_card_id, :integer
380
+ end
381
+
382
+ if columns(:order_txns).collect {|c| c.name}.include?('bill_to_first_name')
383
+ remove_column :order_txns, :bill_to_first_name, :string
384
+ end
385
+
386
+ if columns(:order_txns).collect {|c| c.name}.include?('bill_to_last_name')
387
+ remove_column :order_txns, :bill_to_last_name, :string
388
+ end
389
+
390
+ if columns(:order_txns).collect {|c| c.name}.include?('bill_to_address')
391
+ remove_column :order_txns, :bill_to_address, :string
392
+ end
393
+
394
+ if columns(:order_txns).collect {|c| c.name}.include?('bill_to_city')
395
+ remove_column :order_txns, :bill_to_city, :string
396
+ end
397
+
398
+ if columns(:order_txns).collect {|c| c.name}.include?('bill_to_state')
399
+ remove_column :order_txns, :bill_to_state, :string
400
+ end
401
+
402
+ if columns(:order_txns).collect {|c| c.name}.include?('bill_to_postal_code')
403
+ remove_column :order_txns, :bill_to_postal_code, :string
404
+ end
405
+
406
+ if columns(:order_txns).collect {|c| c.name}.include?('bill_to_country')
407
+ remove_column :order_txns, :bill_to_country, :string
408
+ end
409
+
410
+ if columns(:order_txns).collect {|c| c.name}.include?('bill_to_country_name')
411
+ remove_column :order_txns, :bill_to_country, :bill_to_country_name
412
+ remove_column :order_txns, :ship_to_country, :ship_to_country_name
413
+ end
414
+
415
+ #tables
416
+ drop_tables = [
417
+ :bank_account_types,
418
+ :bank_accounts,
419
+ :credit_cards,
420
+ :credit_card_accounts,
421
+ :credit_card_account_party_roles,
422
+ :credit_card_account_purposes,
423
+ :payments,
424
+ :payment_gateways,
425
+ :payment_gateway_actions,
426
+ :pricing_plans,
427
+ :pricing_plan_components,
428
+ :valid_price_plan_components,
429
+ :pricing_plan_assignments,
430
+ :prices,
431
+ :price_components,
432
+ :price_component_types,
433
+ :fees,:fee_types
434
+ ]
435
+ drop_tables.each do |table|
436
+ if table_exists?(table)
437
+ drop_table table
438
+ end
439
+ end
440
+
441
+ end
442
+ end
@@ -0,0 +1,19 @@
1
+ # This migration comes from erp_tech_svcs (originally 20121116151510)
2
+ class CreateGroups < ActiveRecord::Migration
3
+ def self.up
4
+ unless table_exists?(:groups)
5
+ create_table :groups do |t|
6
+ t.column :description, :string
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ [ :groups ].each do |tbl|
14
+ if table_exists?(tbl)
15
+ drop_table tbl
16
+ end
17
+ end
18
+ end
19
+ end