erp_invoicing 3.1.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +7 -0
  2. data/app/models/extensions/party.rb +15 -3
  3. data/app/models/invoice.rb +33 -1
  4. data/app/models/invoice_party_role.rb +16 -0
  5. data/app/models/payment_application.rb +17 -1
  6. data/lib/erp_invoicing/engine.rb +1 -1
  7. data/lib/erp_invoicing/version.rb +6 -2
  8. metadata +31 -234
  9. data/app/assets/javascripts/erp_invoicing/application.js +0 -9
  10. data/app/assets/stylesheets/erp_invoicing/application.css +0 -7
  11. data/app/controllers/erp_invoicing/erp_app/organizer/bill_pay/accounts_controller.rb +0 -166
  12. data/app/controllers/erp_invoicing/erp_app/organizer/bill_pay/base_controller.rb +0 -22
  13. data/app/controllers/erp_invoicing/erp_app/shared/billing_accounts_controller.rb +0 -111
  14. data/app/controllers/erp_invoicing/erp_app/shared/files_controller.rb +0 -52
  15. data/app/controllers/erp_invoicing/erp_app/shared/invoices_controller.rb +0 -208
  16. data/app/controllers/erp_invoicing/sms_controller.rb +0 -156
  17. data/app/helpers/erp_invoicing/application_helper.rb +0 -4
  18. data/app/views/layouts/erp_invoicing/application.html.erb +0 -14
  19. data/db/data_migrations/20111121153349_create_bill_pay_organizer_application.rb +0 -14
  20. data/db/data_migrations/20120118181839_create_invoice_management_desktop_application.rb +0 -26
  21. data/db/data_migrations/20120229174322_add_billpay_widget.rb +0 -26
  22. data/public/javascripts/erp_app/desktop/applications/invoice_management/billing_accounts_panel.js +0 -79
  23. data/public/javascripts/erp_app/desktop/applications/invoice_management/invoices_panel.js +0 -48
  24. data/public/javascripts/erp_app/desktop/applications/invoice_management/module.js +0 -36
  25. data/public/javascripts/erp_app/organizer/applications/bill_pay/base.js +0 -146
  26. data/public/javascripts/erp_app/organizer/applications/bill_pay/extensions.js +0 -21
  27. data/public/javascripts/erp_app/organizer/applications/bill_pay/make_payment_window.js +0 -109
  28. data/public/javascripts/erp_app/organizer/applications/bill_pay/payment_accounts_grid_panel.js +0 -105
  29. data/public/javascripts/erp_app/organizer/applications/bill_pay/transactions_grid_panel.js +0 -84
  30. data/public/javascripts/erp_app/shared/add_invoice_window.js +0 -220
  31. data/public/javascripts/erp_app/shared/billing_accounts_grid_panel.js +0 -316
  32. data/public/javascripts/erp_app/shared/invoice_items_grid_panel.js +0 -152
  33. data/public/javascripts/erp_app/shared/invoices_grid_panel.js +0 -361
  34. data/public/javascripts/erp_app/shared/payments_grid_panel.js +0 -74
  35. data/spec/dummy/db/data_migrations/20101011152441_payment_gateway_actions.erp_commerce.rb +0 -28
  36. data/spec/dummy/db/data_migrations/20101014142230_financial_txn_types.erp_txns_and_accts.rb +0 -16
  37. data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +0 -15
  38. data/spec/dummy/db/data_migrations/20110324010232_product_role_types.erp_products.rb +0 -24
  39. data/spec/dummy/db/data_migrations/20110509223702_add_publisher_role.knitkit.rb +0 -22
  40. data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +0 -12
  41. data/spec/dummy/db/data_migrations/20110527160807_add_default_prod_avail_types.erp_products.rb +0 -27
  42. data/spec/dummy/db/data_migrations/20110605231556_create_order_party_roles.erp_orders.rb +0 -24
  43. data/spec/dummy/db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.erp_forms.rb +0 -33
  44. data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +0 -19
  45. data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +0 -252
  46. data/spec/dummy/db/data_migrations/20110728201730_create_desktop_app_product_manager.erp_products.rb +0 -26
  47. data/spec/dummy/db/data_migrations/20110728201731_create_desktop_app_order_manager.erp_orders.rb +0 -26
  48. data/spec/dummy/db/data_migrations/20110728201732_create_organizer_app_order_management.erp_orders.rb +0 -15
  49. data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +0 -53
  50. data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
  51. data/spec/dummy/db/data_migrations/20110816153456_add_knitkit_application.knitkit.rb +0 -32
  52. data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +0 -21
  53. data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +0 -32
  54. data/spec/dummy/db/data_migrations/20110828190913_create_desktop_app_dynamic_forms.erp_forms.rb +0 -19
  55. data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -12
  56. data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +0 -23
  57. data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +0 -42
  58. data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +0 -22
  59. data/spec/dummy/db/data_migrations/20111118182910_setup_knitkit_capabilities.knitkit.rb +0 -128
  60. data/spec/dummy/db/data_migrations/20111121153349_create_bill_pay_organizer_application.erp_invoicing.rb +0 -15
  61. data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +0 -14
  62. data/spec/dummy/db/data_migrations/20120118181839_create_invoice_management_desktop_application.erp_invoicing.rb +0 -27
  63. data/spec/dummy/db/data_migrations/20120127144444_create_website_role_types.knitkit.rb +0 -14
  64. data/spec/dummy/db/data_migrations/20120127150505_create_website_default_configuration.knitkit.rb +0 -73
  65. data/spec/dummy/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.knitkit.rb +0 -34
  66. data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +0 -29
  67. data/spec/dummy/db/data_migrations/20120229174322_add_billpay_widget.erp_invoicing.rb +0 -27
  68. data/spec/dummy/db/data_migrations/20120229174343_add_orders_widget.erp_orders.rb +0 -29
  69. data/spec/dummy/db/data_migrations/20120316150424_add_is_template_to_default_website_config.knitkit.rb +0 -17
  70. data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +0 -11
  71. data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +0 -19
  72. data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +0 -23
  73. data/spec/dummy/db/data_migrations/20120605154637_add_calculate_balance_strategy_types.erp_invoicing.rb +0 -21
  74. data/spec/dummy/db/data_migrations/20120809020508_update_website_and_configuration.knitkit.rb +0 -78
  75. data/spec/dummy/db/data_migrations/20120824013449_create_ticket_form.erp_forms.rb +0 -67
  76. data/spec/dummy/db/data_migrations/20121026013449_update_ticket_form.erp_forms.rb +0 -65
  77. data/spec/dummy/db/data_migrations/20121026191738_update_contact_form.erp_forms.rb +0 -27
  78. data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
  79. data/spec/dummy/db/data_migrations/20121129185611_upgrade_website_role_iid.knitkit.rb +0 -21
  80. data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +0 -16
  81. data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +0 -24
  82. data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +0 -23
  83. data/spec/dummy/db/migrate/20121214000230_base_erp_services.erp_base_erp_svcs.rb +0 -461
  84. data/spec/dummy/db/migrate/20121214000231_base_tech_services.erp_tech_svcs.rb +0 -255
  85. data/spec/dummy/db/migrate/20121214000232_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
  86. data/spec/dummy/db/migrate/20121214000233_base_app_framework.erp_app.rb +0 -276
  87. data/spec/dummy/db/migrate/20121214000234_dynamic_forms.erp_forms.rb +0 -95
  88. data/spec/dummy/db/migrate/20121214000235_create_tickets.erp_forms.rb +0 -19
  89. data/spec/dummy/db/migrate/20121214000236_upgrade_dynamic_forms_table.erp_forms.rb +0 -32
  90. data/spec/dummy/db/migrate/20121214000237_setup_knitkit.knitkit.rb +0 -316
  91. data/spec/dummy/db/migrate/20121214000238_invoicing_services.erp_invoicing.rb +0 -277
  92. data/spec/dummy/db/migrate/20121214000239_base_inventory.erp_inventory.rb +0 -91
  93. data/spec/dummy/db/migrate/20121214000240_base_inventory_indexes.erp_inventory.rb +0 -48
  94. data/spec/dummy/db/migrate/20121214000241_base_txns_and_accts.erp_txns_and_accts.rb +0 -364
  95. data/spec/dummy/db/migrate/20121214000242_agreements_services.erp_agreements.rb +0 -160
  96. data/spec/dummy/db/migrate/20121214000243_agreements_services_indexes.erp_agreements.rb +0 -52
  97. data/spec/dummy/db/migrate/20121214000244_base_orders.erp_orders.rb +0 -178
  98. data/spec/dummy/db/migrate/20121214000245_base_products.erp_products.rb +0 -234
  99. data/spec/dummy/db/migrate/20121214000246_base_products_indexes.erp_products.rb +0 -59
  100. data/spec/dummy/db/migrate/20121214000247_erp_commerce_base.erp_commerce.rb +0 -442
  101. data/spec/dummy/db/migrate/20121214000248_base_work_efforts.erp_work_effort.rb +0 -211
  102. data/spec/dummy/db/migrate/20130107181155_create_groups.erp_tech_svcs.rb +0 -19
  103. data/spec/dummy/db/migrate/20130107181156_upgrade_security.erp_tech_svcs.rb +0 -54
  104. data/spec/dummy/db/migrate/20130107181157_upgrade_security2.erp_tech_svcs.rb +0 -270
  105. data/spec/dummy/db/schema.rb +0 -2569
  106. data/spec/dummy/db/spec.sqlite3 +0 -0
  107. data/spec/dummy/log/spec.log +0 -64744
@@ -1,32 +0,0 @@
1
- # This migration comes from erp_forms (originally 20121007022323)
2
- class UpgradeDynamicFormsTable < ActiveRecord::Migration
3
- def self.up
4
- add_column :dynamic_form_models, :show_in_multitask, :boolean, :default => false unless columns(:dynamic_form_models).collect {|c| c.name}.include?('show_in_multitask')
5
- add_column :dynamic_form_models, :allow_comments, :boolean, :default => true unless columns(:dynamic_form_models).collect {|c| c.name}.include?('allow_comments')
6
- add_column :dynamic_form_models, :allow_files, :boolean, :default => true unless columns(:dynamic_form_models).collect {|c| c.name}.include?('allow_files')
7
- add_column :dynamic_form_models, :file_security_default, :string, :default => 'private' unless columns(:dynamic_form_models).collect {|c| c.name}.include?('file_security_default')
8
- add_column :dynamic_forms, :widget_action, :string, :default => 'save' unless columns(:dynamic_forms).collect {|c| c.name}.include?('widget_action')
9
- add_column :dynamic_forms, :widget_email_recipients, :string unless columns(:dynamic_forms).collect {|c| c.name}.include?('widget_email_recipients')
10
- add_column :dynamic_forms, :focus_first_field, :boolean, :default => true unless columns(:dynamic_forms).collect {|c| c.name}.include?('focus_first_field')
11
- add_column :dynamic_forms, :submit_empty_text, :boolean, :default => false unless columns(:dynamic_forms).collect {|c| c.name}.include?('submit_empty_text')
12
- add_column :dynamic_forms, :msg_target, :string, :default => 'qtip' unless columns(:dynamic_forms).collect {|c| c.name}.include?('msg_target')
13
- add_column :dynamic_forms, :submit_button_label, :string, :default => 'Submit' unless columns(:dynamic_forms).collect {|c| c.name}.include?('submit_button_label')
14
- add_column :dynamic_forms, :cancel_button_label, :string, :default => 'Cancel' unless columns(:dynamic_forms).collect {|c| c.name}.include?('cancel_button_label')
15
- add_column :dynamic_forms, :comment, :text unless columns(:dynamic_forms).collect {|c| c.name}.include?('comment')
16
- end
17
-
18
- def self.down
19
- remove_column :dynamic_form_models, :show_in_multitask if columns(:dynamic_form_models).collect {|c| c.name}.include?('show_in_multitask')
20
- remove_column :dynamic_form_models, :file_security_default if columns(:dynamic_form_models).collect {|c| c.name}.include?('file_security_default')
21
- remove_column :dynamic_form_models, :allow_files if columns(:dynamic_form_models).collect {|c| c.name}.include?('allow_files')
22
- remove_column :dynamic_form_models, :allow_comments if columns(:dynamic_form_models).collect {|c| c.name}.include?('allow_comments')
23
- remove_column :dynamic_forms, :widget_action if columns(:dynamic_forms).collect {|c| c.name}.include?('widget_action')
24
- remove_column :dynamic_forms, :widget_email_recipients if columns(:dynamic_forms).collect {|c| c.name}.include?('widget_email_recipients')
25
- remove_column :dynamic_forms, :focus_first_field if columns(:dynamic_forms).collect {|c| c.name}.include?('focus_first_field')
26
- remove_column :dynamic_forms, :submit_empty_text if columns(:dynamic_forms).collect {|c| c.name}.include?('submit_empty_text')
27
- remove_column :dynamic_forms, :msg_target if columns(:dynamic_forms).collect {|c| c.name}.include?('msg_target')
28
- remove_column :dynamic_forms, :submit_button_label if columns(:dynamic_forms).collect {|c| c.name}.include?('submit_button_label')
29
- remove_column :dynamic_forms, :cancel_button_label if columns(:dynamic_forms).collect {|c| c.name}.include?('cancel_button_label')
30
- remove_column :dynamic_forms, :comment if columns(:dynamic_forms).collect {|c| c.name}.include?('comment')
31
- end
32
- end
@@ -1,316 +0,0 @@
1
- # This migration comes from knitkit (originally 20110211002317)
2
- class SetupKnitkit < ActiveRecord::Migration
3
- def self.up
4
-
5
- unless table_exists?(:websites)
6
- create_table :websites do |t|
7
- t.string :name
8
- t.string :title
9
- t.string :subtitle
10
- t.string :internal_identifier
11
- t.string :email
12
- t.boolean :auto_activate_publication
13
- t.boolean :email_inquiries
14
-
15
- t.timestamps
16
- end
17
- end
18
-
19
- unless table_exists?(:website_hosts)
20
- create_table :website_hosts do |t|
21
- t.references :website
22
- t.string :host
23
-
24
- t.timestamps
25
- end
26
-
27
- add_index :website_hosts, :website_id
28
- end
29
-
30
- unless table_exists?(:website_inquiries)
31
- create_table :website_inquiries do |t|
32
- t.integer :website_id
33
-
34
- t.timestamps
35
- end
36
-
37
- add_index :website_inquiries, :website_id
38
- end
39
-
40
- unless table_exists?(:website_sections)
41
- create_table :website_sections do |t|
42
- t.string :title
43
- t.string :type
44
- t.references :website
45
- t.string :path
46
- t.string :permalink
47
- t.text :layout
48
- t.boolean :in_menu
49
- t.integer :position, :default => 0
50
- t.string :internal_identifier
51
- t.integer :version
52
- t.boolean :render_base_layout, :default => true
53
-
54
- #better nested set columns
55
- t.integer :parent_id
56
- t.integer :lft
57
- t.integer :rgt
58
-
59
- t.timestamps
60
- end
61
- #indexes
62
- add_index :website_sections, :permalink
63
- add_index :website_sections, :website_id
64
- add_index :website_sections, :position
65
- add_index :website_sections, :parent_id
66
- add_index :website_sections, :lft
67
- add_index :website_sections, :rgt
68
- add_index :website_sections, :version
69
- add_index :website_sections, :internal_identifier, :name => 'section_iid_idx'
70
-
71
- WebsiteSection.create_versioned_table
72
- end
73
-
74
- unless table_exists?(:contents)
75
- create_table :contents do |t|
76
- t.string :type
77
- t.string :title
78
- t.string :permalink
79
- t.text :excerpt_html
80
- t.text :body_html
81
- t.integer :created_by_id
82
- t.integer :updated_by_id
83
- t.string :internal_identifier
84
- t.boolean :display_title
85
- t.integer :version
86
-
87
- t.timestamps
88
- end
89
- #indexes
90
- add_index :contents, :type
91
- add_index :contents, :created_by_id
92
- add_index :contents, :updated_by_id
93
- add_index :contents, :permalink
94
- add_index :contents, :version
95
- add_index :contents, :internal_identifier, :name => 'contents_iid_idx'
96
-
97
- Content.create_versioned_table
98
- end
99
-
100
- unless table_exists?(:website_section_contents)
101
- create_table :website_section_contents do |t|
102
- t.integer :website_section_id
103
- t.integer :content_id
104
- t.string :content_area
105
- t.integer :position, :default => 0
106
-
107
- t.timestamps
108
- end
109
- #indexes
110
- add_index :website_section_contents, :website_section_id
111
- add_index :website_section_contents, :content_id
112
- add_index :website_section_contents, :position
113
- add_index :website_section_contents, :content_area
114
- end
115
-
116
- unless table_exists?(:themes)
117
- create_table :themes do |t|
118
- t.references :website
119
- t.string :name
120
- t.string :theme_id
121
- t.string :author
122
- t.integer :version
123
- t.string :homepage
124
- t.text :summary
125
- t.integer :active
126
-
127
- t.timestamps
128
- end
129
- #indexes
130
- add_index :themes, :website_id
131
- add_index :themes, :active
132
- end
133
-
134
- unless table_exists?(:published_websites)
135
- create_table :published_websites do |t|
136
- t.references :website
137
- t.text :comment
138
- t.decimal :version, :precision => 18, :scale => 6
139
- t.boolean :active
140
- t.integer :published_by_id
141
-
142
- t.timestamps
143
- end
144
-
145
- #indexes
146
- add_index :published_websites, :website_id
147
- add_index :published_websites, :version
148
- add_index :published_websites, :active
149
- add_index :published_websites, :published_by_id
150
- end
151
-
152
- unless table_exists?(:published_elements)
153
- create_table :published_elements do |t|
154
- t.references :published_website
155
- t.references :published_element_record, :polymorphic => true
156
- t.integer :version
157
- t.integer :published_by_id
158
-
159
- t.timestamps
160
- end
161
-
162
- #indexes
163
- add_index :published_elements, [:published_element_record_id, :published_element_record_type], :name => 'published_elm_idx'
164
- add_index :published_elements, :published_website_id
165
- add_index :published_elements, :version
166
- add_index :published_elements, :published_by_id
167
- end
168
-
169
- unless table_exists?(:comments)
170
- create_table :comments do |t|
171
- t.string :commentor_name
172
- t.string :email
173
- t.text :comment
174
- t.integer :approved
175
- t.datetime :approved_at
176
- t.references :user
177
- t.references :commented_record, :polymorphic => true
178
-
179
- t.timestamps
180
- end
181
-
182
- add_index :comments, [:commented_record_id, :commented_record_type], :name => 'commented_record_idx'
183
- add_index :comments, [:approved]
184
- add_index :comments, [:user_id]
185
- end
186
-
187
- unless table_exists?(:website_nav_items)
188
- create_table :website_nav_items do |t|
189
- t.references :website_nav
190
- t.string :title
191
- t.string :url
192
- t.integer :position, :default => 0
193
- t.references :linked_to_item, :polymorphic => true
194
-
195
- #better nested set columns
196
- t.integer :parent_id
197
- t.integer :lft
198
- t.integer :rgt
199
-
200
- t.timestamps
201
- end
202
-
203
- add_index :website_nav_items, [:linked_to_item_id, :linked_to_item_type], :name => 'linked_to_idx'
204
- add_index :website_nav_items, :website_nav_id
205
- add_index :website_nav_items, :position
206
- add_index :website_nav_items, :parent_id
207
- add_index :website_nav_items, :lft
208
- add_index :website_nav_items, :rgt
209
- end
210
-
211
- unless table_exists?(:website_navs)
212
- create_table :website_navs do |t|
213
- t.references :website
214
- t.string :name
215
-
216
- t.timestamps
217
- end
218
-
219
- add_index :website_navs, :website_id
220
- end
221
-
222
- unless table_exists?(:tags)
223
- create_table :tags do |t|
224
- t.column :name, :string
225
- end
226
- end
227
-
228
- unless table_exists?(:taggings)
229
- create_table :taggings do |t|
230
- t.column :tag_id, :integer
231
- t.column :taggable_id, :integer
232
- t.column :tagger_id, :integer
233
- t.column :tagger_type, :string
234
-
235
- # You should make sure that the column created is
236
- # long enough to store the required class names.
237
- t.column :taggable_type, :string
238
- t.column :context, :string
239
-
240
- t.column :created_at, :datetime
241
- end
242
-
243
- add_index :taggings, :tag_id
244
- add_index :taggings, [:taggable_id, :taggable_type, :context], :name => 'taggable_poly_idx'
245
- end
246
-
247
- unless table_exists? :website_party_roles
248
- create_table :website_party_roles do |t|
249
- #foreign keys
250
- t.references :website
251
- t.references :role_type
252
- t.references :party
253
-
254
- t.timestamps
255
- end
256
-
257
- add_index :website_party_roles, :website_id
258
- add_index :website_party_roles, :role_type_id
259
- add_index :website_party_roles, :party_id
260
- end
261
-
262
- create_table :documented_items, :force => true do |t|
263
- t.string :documented_klass, :null => true
264
- t.integer :documented_content_id, :null => true
265
- t.integer :online_document_section_id
266
- t.timestamps
267
- end
268
-
269
- create_table :documents do |t|
270
- t.string :external_identifier
271
- t.string :internal_identifier
272
- t.string :description
273
- t.datetime :document_date
274
- t.text :dynamic_attributes
275
-
276
- t.references :document_record, :polymorphic => true
277
- t.references :document_type
278
-
279
- t.timestamps
280
- end
281
-
282
- add_index :documents, [:document_record_type, :document_record_id], :name => 'document_record_poly_idx'
283
- add_index :documents, :document_type_id, :name => 'document_type_idx'
284
-
285
- create_table :document_types do |t|
286
- t.string :external_identifier
287
- t.string :internal_identifier
288
- t.string :description
289
-
290
- t.timestamps
291
- end
292
-
293
- create_table :valid_documents do |t|
294
- t.references :document
295
- t.references :documented_model, :polymorphic => true
296
- end
297
-
298
- add_index :valid_documents, :document_id
299
- add_index :valid_documents, [:documented_model_id, :documented_model_type], :name => 'valid_documents_model_idx'
300
-
301
- end
302
-
303
- def self.down
304
- WebsiteSection.drop_versioned_table
305
- Content.drop_versioned_table
306
-
307
- # check that each table exists before trying to delete it.
308
- [:websites, :website_sections, :contents, :website_section_contents, :documents, :document_types, :valid_documents,
309
- :themes, :theme_files, :published_websites, :published_elements, :website_party_roles,
310
- :comments,:website_hosts,:website_nav_items, :website_navs, :tags, :taggings, :documented_items].each do |tbl|
311
- if table_exists?(tbl)
312
- drop_table tbl
313
- end
314
- end
315
- end
316
- end
@@ -1,277 +0,0 @@
1
- # This migration comes from erp_invoicing (originally 20111121000000)
2
- #***********************************************************************************************************
3
- # TODO
4
- #
5
- # Should all amounts be using amount_ids? Particularly payments, which can be in multiple currencies
6
- # Money amounts in commerce are floats - that doesn't seem right????
7
- #***********************************************************************************************************
8
-
9
- class InvoicingServices < ActiveRecord::Migration
10
- def self.up
11
-
12
- # Create invoices
13
- unless table_exists?(:invoices)
14
- create_table :invoices do |t|
15
- t.string :invoice_number
16
- t.string :description
17
- t.string :message
18
- t.date :invoice_date
19
- t.date :due_date
20
- t.string :external_identifier
21
- t.string :external_id_source
22
- t.references :product
23
- t.references :invoice_type
24
- t.references :billing_account
25
- t.references :invoice_payment_strategy_type
26
- t.references :balance
27
- t.references :calculate_balance_strategy_type
28
-
29
- t.timestamps
30
- end
31
-
32
- add_index :invoices, :product_id, :name => 'prod_type_idx'
33
- add_index :invoices, :invoice_type_id, :name => 'invoice_type_idx'
34
- add_index :invoices, :billing_account_id, :name => 'invoice_billing_acct_idx'
35
- add_index :invoices, :invoice_payment_strategy_type_id, :name => 'invoice_payment_stragegy_idx'
36
- end
37
-
38
- # Create invoice types (not in silverston models - may be removed in future releases)
39
- unless table_exists?(:invoice_types)
40
-
41
- create_table :invoice_types do |t|
42
- t.integer :parent_id
43
- t.integer :lft
44
- t.integer :rgt
45
-
46
- #custom columns go here
47
- t.string :description
48
- t.string :comments
49
- t.string :internal_identifier
50
- t.string :external_identifier
51
- t.string :external_id_source
52
-
53
- t.timestamps
54
- end
55
- end
56
-
57
- unless table_exists?(:invoice_payment_strategy_types)
58
- create_table :invoice_payment_strategy_types do |t|
59
- t.string :description
60
- t.string :internal_identifier
61
- t.string :external_identifier
62
- t.string :external_id_source
63
-
64
- t.timestamps
65
- end
66
- end
67
-
68
- # Create invoice items
69
- unless table_exists?(:invoice_items)
70
- create_table :invoice_items do |t|
71
- #foreign keys
72
- t.references :invoice
73
- t.references :invoice_item_type
74
-
75
- #these columns support the polymporphic relationship to invoice-able items
76
- t.references :invoiceable_item, :polymorphic => true
77
-
78
- #non-key columns
79
- t.integer :item_seq_id
80
- t.string :item_description
81
- t.decimal :sales_tax, :precision => 8, :scale => 2
82
- t.decimal :quantity, :precision => 8, :scale => 2
83
- t.decimal :amount, :precision => 8, :scale => 2
84
-
85
- t.timestamps
86
- end
87
-
88
- add_index :invoice_items, [:invoiceable_item_id, :invoiceable_item_type], :name => 'invoiceable_item_idx'
89
- add_index :invoice_items, :invoice_id, :name => 'invoice_id_idx'
90
- add_index :invoice_items, :invoice_item_type_id, :name => 'invoice_item_type_id_idx'
91
- end
92
-
93
- # Create invoice item types
94
- unless table_exists?(:invoice_item_types)
95
- create_table :invoice_item_types do |t|
96
- t.integer :parent_id
97
- t.integer :lft
98
- t.integer :rgt
99
-
100
- #custom columns go here
101
- t.string :description
102
- t.string :comments
103
- t.string :internal_identifier
104
- t.string :external_identifier
105
- t.string :external_id_source
106
-
107
- t.timestamps
108
- end
109
- end
110
-
111
- # Create invoice_party_roles
112
- unless table_exists?(:invoice_party_roles)
113
- create_table :invoice_party_roles do |t|
114
- t.string :description
115
- t.integer :role_type_id
116
- t.string :external_identifier
117
- t.string :external_id_source
118
- t.references :invoice
119
- t.references :party
120
-
121
- t.timestamps
122
- end
123
-
124
- add_index :invoice_party_roles, :invoice_id, :name => 'invoice_party_invoice_id_idx'
125
- add_index :invoice_party_roles, :party_id, :name => 'invoice_party_party_id_idx'
126
- end
127
-
128
-
129
- unless table_exists?(:billing_accounts)
130
- create_table :billing_accounts do |t|
131
- t.boolean :send_paper_bills, :default => false
132
- t.boolean :payable_online, :default => false
133
- t.date :billing_date
134
- t.integer :calculate_balance_strategy_type_id
135
-
136
- t.timestamps
137
- end
138
- end
139
-
140
- # Create billing contact mechanisms
141
- unless table_exists?(:billing_contact_mechanisms)
142
- create_table :billing_contact_mechanisms do |t|
143
- t.string :description
144
- #these columns support a polymorphic relationship to the contact mechanism for an invoice and billing account
145
- #this allows for the use of email, postal addresses and other contact points to be used in billing
146
- t.references :contact_mechanism, :polymorphic => true
147
-
148
- t.timestamps
149
- end
150
-
151
- add_index :billing_contact_mechanisms, [:contact_mechanism_id, :contact_mechanism_type], :name => 'billing_contact_mechanism_idx'
152
- end
153
-
154
- unless table_exists?(:recurring_payments)
155
- create_table :recurring_payments do |t|
156
- t.references :payment_account, :polymorphic => true
157
- t.references :billing_account
158
- t.decimal :pay_up_to_amount, :precision => 8, :scale => 2
159
- t.decimal :payment_amount, :precision => 8, :scale => 2
160
- t.integer :payment_day
161
- t.date :from_date
162
- t.date :thru_date
163
- t.boolean :enabled
164
- t.boolean :text_to_pay
165
-
166
- t.timestamps
167
- end
168
-
169
- add_index :recurring_payments, [:payment_account_id, :payment_account_type], :name => 'payment_account_idx'
170
- add_index :recurring_payments, :billing_account_id
171
- end
172
-
173
- # Create payment applictions
174
- unless table_exists?(:payment_applications)
175
- create_table :payment_applications do |t|
176
-
177
- t.integer :financial_txn_id
178
-
179
- #these columns support the polymporphic relationship to the entities to which payments can be applied
180
- #this will be innvoices, invoice items or accounts
181
- t.references :payment_applied_to, :polymorphic => true
182
-
183
- #Payments here is set up to point to an amount which allows it to be
184
- #in multiple currencies
185
- t.integer :applied_money_amount_id
186
- t.string :comment
187
-
188
- t.timestamps
189
- end
190
-
191
- add_index :payment_applications, [:payment_applied_to_id, :payment_applied_to_type], :name => 'payment_applied_to_idx'
192
- add_index :payment_applications, :financial_txn_id
193
- add_index :payment_applications, :applied_money_amount_id
194
- end
195
-
196
- unless table_exists? :invoice_payment_term_sets
197
- create_table :invoice_payment_term_sets do |t|
198
- #foreign keys
199
- t.references :invoice
200
- t.references :invoice_item
201
-
202
- #custom columns go here
203
- t.string :description
204
- t.string :comments
205
- t.string :internal_identifier
206
- t.string :external_identifier
207
- t.string :external_id_source
208
-
209
- t.timestamps
210
- end
211
-
212
- add_index :invoice_payment_term_sets, :invoice_id
213
- add_index :invoice_payment_term_sets, :invoice_item_id
214
- end
215
-
216
- unless table_exists? :invoice_payment_terms
217
- create_table :invoice_payment_terms do |t|
218
- #foreign keys
219
- t.references :invoice_payment_term_type
220
- t.references :invoice_payment_term_set
221
-
222
- #non-key columns
223
- t.string :description
224
- t.date :pay_by
225
- t.decimal :amount, :precision => 8, :scale => 2
226
-
227
- t.timestamps
228
- end
229
-
230
- add_index :invoice_payment_terms, :invoice_payment_term_type_id
231
- add_index :invoice_payment_terms, :invoice_payment_term_set_id
232
- end
233
-
234
- unless table_exists? :invoice_payment_term_types
235
- create_table :invoice_payment_term_types do |t|
236
- #awesome nested set columns
237
- t.integer :parent_id
238
- t.integer :lft
239
- t.integer :rgt
240
-
241
- #custom columns go here
242
- t.string :description
243
- t.string :comments
244
- t.string :internal_identifier
245
- t.string :external_identifier
246
- t.string :external_id_source
247
-
248
- t.timestamps
249
- end
250
- end
251
-
252
- unless table_exists?(:calculate_balance_strategy_types)
253
- create_table :calculate_balance_strategy_types do |t|
254
- t.string :internal_identifier
255
- t.string :description
256
-
257
- t.timestamps
258
- end
259
- end
260
-
261
- end
262
-
263
- def self.down
264
- [
265
- :invoices, :invoice_types, :invoice_payment_strategy_types,
266
- :invoice_items, :invoice_item_types, :invoice_party_roles,
267
- :billing_accounts, :billing_contact_mechanisms,
268
- :payment_applications, :payment_party_roles, :recurring_payments,
269
- :invoice_payment_term_sets,:invoice_payment_terms,:invoice_payment_term_types, :calculate_balance_strategy_types
270
- ].each do |tbl|
271
- if table_exists?(tbl)
272
- drop_table tbl
273
- end
274
- end
275
-
276
- end
277
- end