erp_invoicing 3.0.6 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/models/billing_account.rb +5 -3
- data/app/models/calculate_balance_strategy_type.rb +2 -0
- data/app/models/invoice.rb +2 -0
- data/app/models/invoice_item.rb +1 -0
- data/app/models/invoice_item_type.rb +1 -0
- data/app/models/invoice_party_role.rb +1 -0
- data/app/models/invoice_payment_strategy_type.rb +2 -0
- data/app/models/invoice_payment_term.rb +2 -0
- data/app/models/invoice_payment_term_set.rb +2 -0
- data/app/models/invoice_payment_term_type.rb +2 -0
- data/app/models/invoice_type.rb +1 -0
- data/app/models/payment_application.rb +2 -1
- data/app/models/recurring_payment.rb +2 -0
- data/db/migrate/20111121000000_invoicing_services.rb +13 -1
- data/lib/erp_invoicing/version.rb +2 -2
- data/lib/erp_invoicing.rb +4 -0
- data/public/javascripts/erp_app/desktop/applications/invoice_management/billing_accounts_panel.js +0 -1
- data/public/javascripts/erp_app/shared/invoices_grid_panel.js +1 -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/20110509223702_add_publisher_role.knitkit.rb +22 -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/20110608185830_create_default_dynamic_models_and_forms.erp_forms.rb +33 -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/20110816153456_add_knitkit_application.knitkit.rb +32 -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/20110828190913_create_desktop_app_dynamic_forms.erp_forms.rb +19 -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/20111118182910_setup_knitkit_capabilities.knitkit.rb +128 -0
- data/spec/dummy/db/data_migrations/20111121153349_create_bill_pay_organizer_application.erp_invoicing.rb +15 -0
- data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +14 -0
- data/spec/dummy/db/data_migrations/20120118181839_create_invoice_management_desktop_application.erp_invoicing.rb +27 -0
- data/spec/dummy/db/data_migrations/20120127144444_create_website_role_types.knitkit.rb +14 -0
- data/spec/dummy/db/data_migrations/20120127150505_create_website_default_configuration.knitkit.rb +73 -0
- data/spec/dummy/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.knitkit.rb +34 -0
- data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +29 -0
- data/spec/dummy/db/data_migrations/20120229174322_add_billpay_widget.erp_invoicing.rb +27 -0
- data/spec/dummy/db/data_migrations/20120229174343_add_orders_widget.erp_orders.rb +29 -0
- data/spec/dummy/db/data_migrations/20120316150424_add_is_template_to_default_website_config.knitkit.rb +17 -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/20120605154637_add_calculate_balance_strategy_types.erp_invoicing.rb +21 -0
- data/spec/dummy/db/data_migrations/20120809020508_update_website_and_configuration.knitkit.rb +78 -0
- data/spec/dummy/db/data_migrations/20120824013449_create_ticket_form.erp_forms.rb +67 -0
- data/spec/dummy/db/data_migrations/20121026013449_update_ticket_form.erp_forms.rb +65 -0
- data/spec/dummy/db/data_migrations/20121026191738_update_contact_form.erp_forms.rb +27 -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/20121129185611_upgrade_website_role_iid.knitkit.rb +21 -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/20121214000230_base_erp_services.erp_base_erp_svcs.rb +461 -0
- data/spec/dummy/db/migrate/20121214000231_base_tech_services.erp_tech_svcs.rb +255 -0
- data/spec/dummy/db/migrate/20121214000232_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
- data/spec/dummy/db/migrate/20121214000233_base_app_framework.erp_app.rb +276 -0
- data/spec/dummy/db/migrate/20121214000234_dynamic_forms.erp_forms.rb +95 -0
- data/spec/dummy/db/migrate/20121214000235_create_tickets.erp_forms.rb +19 -0
- data/spec/dummy/db/migrate/20121214000236_upgrade_dynamic_forms_table.erp_forms.rb +32 -0
- data/spec/dummy/db/migrate/20121214000237_setup_knitkit.knitkit.rb +316 -0
- data/spec/dummy/db/migrate/20121214000238_invoicing_services.erp_invoicing.rb +277 -0
- data/spec/dummy/db/migrate/20121214000239_base_inventory.erp_inventory.rb +91 -0
- data/spec/dummy/db/migrate/20121214000240_base_inventory_indexes.erp_inventory.rb +48 -0
- data/spec/dummy/db/migrate/20121214000241_base_txns_and_accts.erp_txns_and_accts.rb +364 -0
- data/spec/dummy/db/migrate/20121214000242_agreements_services.erp_agreements.rb +160 -0
- data/spec/dummy/db/migrate/20121214000243_agreements_services_indexes.erp_agreements.rb +52 -0
- data/spec/dummy/db/migrate/20121214000244_base_orders.erp_orders.rb +178 -0
- data/spec/dummy/db/migrate/20121214000245_base_products.erp_products.rb +234 -0
- data/spec/dummy/db/migrate/20121214000246_base_products_indexes.erp_products.rb +59 -0
- data/spec/dummy/db/migrate/20121214000247_erp_commerce_base.erp_commerce.rb +442 -0
- data/spec/dummy/db/migrate/20121214000248_base_work_efforts.erp_work_effort.rb +211 -0
- data/spec/dummy/db/migrate/20130107181155_create_groups.erp_tech_svcs.rb +19 -0
- data/spec/dummy/db/migrate/20130107181156_upgrade_security.erp_tech_svcs.rb +54 -0
- data/spec/dummy/db/migrate/20130107181157_upgrade_security2.erp_tech_svcs.rb +270 -0
- data/spec/dummy/db/schema.rb +2569 -0
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/spec.log +64744 -0
- data/spec/models/billing_account_spec.rb +1 -7
- data/spec/models/invoice_spec.rb +2 -1
- data/spec/models/payment_application_spec.rb +1 -1
- data/spec/spec_helper.rb +18 -10
- metadata +203 -20
- data/db/migrate/20120228184317_add_text_to_pay_to_recurring_payments.rb +0 -13
- data/db/migrate/20120301155722_add_billing_date_to_billing_account.rb +0 -13
- data/db/migrate/20120605144227_create_calcuate_balance_strategy_type.rb +0 -18
- data/db/migrate/20120605144900_add_calculate_balance_strategy_to_billing_account.rb +0 -7
- data/db/migrate/20120605150425_add_balance_to_invoice.rb +0 -9
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
class BillingAccount < ActiveRecord::Base
|
|
2
|
+
attr_protected :created_at, :updated_at
|
|
3
|
+
|
|
2
4
|
acts_as_financial_txn_account
|
|
3
5
|
|
|
4
6
|
belongs_to :calculate_balance_strategy_type
|
|
@@ -148,10 +150,10 @@ class BillingAccount < ActiveRecord::Base
|
|
|
148
150
|
|
|
149
151
|
#override balance_date for today if calculate_balance is set to true
|
|
150
152
|
def balance_date
|
|
151
|
-
if self.
|
|
152
|
-
|
|
153
|
+
if self.calculate_balance_strategy_type.nil?
|
|
154
|
+
self.financial_txn_account.balance_date
|
|
153
155
|
else
|
|
154
|
-
|
|
156
|
+
if self.calculate_balance_strategy_type.iid == 'invoices_and_payments' and self.invoices.empty?
|
|
155
157
|
current_invoice.invoice_date
|
|
156
158
|
else
|
|
157
159
|
self.financial_txn_account.balance_date
|
data/app/models/invoice.rb
CHANGED
data/app/models/invoice_item.rb
CHANGED
data/app/models/invoice_type.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
class PaymentApplication < ActiveRecord::Base
|
|
2
|
+
attr_protected :created_at, :updated_at
|
|
2
3
|
|
|
3
4
|
belongs_to :financial_txn
|
|
4
5
|
belongs_to :payment_applied_to, :polymorphic => true
|
|
@@ -7,7 +8,7 @@ class PaymentApplication < ActiveRecord::Base
|
|
|
7
8
|
before_destroy :unapply_payment
|
|
8
9
|
|
|
9
10
|
def is_pending?
|
|
10
|
-
|
|
11
|
+
self.financial_txn.nil? or (self.financial_txn.is_scheduled? or self.financial_txn.is_pending?)
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
def apply_payment
|
|
@@ -22,6 +22,8 @@ class InvoicingServices < ActiveRecord::Migration
|
|
|
22
22
|
t.references :invoice_type
|
|
23
23
|
t.references :billing_account
|
|
24
24
|
t.references :invoice_payment_strategy_type
|
|
25
|
+
t.references :balance
|
|
26
|
+
t.references :calculate_balance_strategy_type
|
|
25
27
|
|
|
26
28
|
t.timestamps
|
|
27
29
|
end
|
|
@@ -128,6 +130,7 @@ class InvoicingServices < ActiveRecord::Migration
|
|
|
128
130
|
t.boolean :send_paper_bills, :default => false
|
|
129
131
|
t.boolean :payable_online, :default => false
|
|
130
132
|
t.date :billing_date
|
|
133
|
+
t.integer :calculate_balance_strategy_type_id
|
|
131
134
|
|
|
132
135
|
t.timestamps
|
|
133
136
|
end
|
|
@@ -157,6 +160,7 @@ class InvoicingServices < ActiveRecord::Migration
|
|
|
157
160
|
t.date :from_date
|
|
158
161
|
t.date :thru_date
|
|
159
162
|
t.boolean :enabled
|
|
163
|
+
t.boolean :text_to_pay
|
|
160
164
|
|
|
161
165
|
t.timestamps
|
|
162
166
|
end
|
|
@@ -244,6 +248,14 @@ class InvoicingServices < ActiveRecord::Migration
|
|
|
244
248
|
end
|
|
245
249
|
end
|
|
246
250
|
|
|
251
|
+
unless table_exists?(:calculate_balance_strategy_types)
|
|
252
|
+
create_table :calculate_balance_strategy_types do |t|
|
|
253
|
+
t.string :internal_identifier
|
|
254
|
+
t.string :description
|
|
255
|
+
|
|
256
|
+
t.timestamps
|
|
257
|
+
end
|
|
258
|
+
end
|
|
247
259
|
|
|
248
260
|
end
|
|
249
261
|
|
|
@@ -253,7 +265,7 @@ class InvoicingServices < ActiveRecord::Migration
|
|
|
253
265
|
:invoice_items, :invoice_item_types, :invoice_party_roles,
|
|
254
266
|
:billing_accounts, :billing_contact_mechanisms,
|
|
255
267
|
:payment_applications, :payment_party_roles, :recurring_payments,
|
|
256
|
-
:invoice_payment_term_sets,:invoice_payment_terms,:invoice_payment_term_types
|
|
268
|
+
:invoice_payment_term_sets,:invoice_payment_terms,:invoice_payment_term_types, :calculate_balance_strategy_types
|
|
257
269
|
].each do |tbl|
|
|
258
270
|
if table_exists?(tbl)
|
|
259
271
|
drop_table tbl
|
data/lib/erp_invoicing.rb
CHANGED
|
@@ -118,7 +118,7 @@ Ext.define("Compass.ErpApp.Shared.InvoicesGridPanel",{
|
|
|
118
118
|
var self = this;
|
|
119
119
|
|
|
120
120
|
var store = Ext.create('Ext.data.Store', {
|
|
121
|
-
fields:['billed_to_party', 'billed_from_party', 'invoice_number','description', 'message', 'invoice_date', 'due_date', 'payment_due', 'id', 'billing_account'],
|
|
121
|
+
fields:['billed_to_party', 'billed_from_party', 'invoice_number','description', 'message', 'invoice_date', 'due_date', {name:'payment_due',type:'float'}, 'id', 'billing_account'],
|
|
122
122
|
autoLoad: Compass.ErpApp.Utility.isBlank(config['autoLoad']) ? true : config['autoLoad'],
|
|
123
123
|
autoSync: true,
|
|
124
124
|
proxy: {
|
|
@@ -45,6 +45,12 @@ module Dummy
|
|
|
45
45
|
|
|
46
46
|
# Enable the asset pipeline
|
|
47
47
|
config.assets.enabled = true
|
|
48
|
+
|
|
49
|
+
# Enforce whitelist mode for mass assignment.
|
|
50
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
|
51
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
|
52
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
|
53
|
+
config.active_record.whitelist_attributes = true
|
|
48
54
|
end
|
|
49
55
|
end
|
|
50
56
|
|
|
@@ -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,22 @@
|
|
|
1
|
+
# This migration comes from knitkit (originally 20110509223702)
|
|
2
|
+
class AddPublisherRole
|
|
3
|
+
|
|
4
|
+
def self.up
|
|
5
|
+
SecurityRole.create(:internal_identifier => 'publisher', :description => 'Publisher')
|
|
6
|
+
SecurityRole.create(:internal_identifier => 'content_author', :description => 'Content Author')
|
|
7
|
+
SecurityRole.create(:internal_identifier => 'layout_author', :description => 'Layout Author')
|
|
8
|
+
SecurityRole.create(:internal_identifier => 'editor', :description => 'Editor')
|
|
9
|
+
SecurityRole.create(:internal_identifier => 'designer', :description => 'Designer')
|
|
10
|
+
SecurityRole.create(:internal_identifier => 'website_author', :description => 'Website Author')
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.down
|
|
14
|
+
SecurityRole.iid('publisher').destroy
|
|
15
|
+
SecurityRole.iid('content_author').destroy
|
|
16
|
+
SecurityRole.iid('layout_author').destroy
|
|
17
|
+
SecurityRole.iid('editor').destroy
|
|
18
|
+
SecurityRole.iid('designer').destroy
|
|
19
|
+
SecurityRole.iid('website_author').destroy
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
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,33 @@
|
|
|
1
|
+
# This migration comes from erp_forms (originally 20110608185830)
|
|
2
|
+
class CreateDefaultDynamicModelsAndForms
|
|
3
|
+
|
|
4
|
+
def self.up
|
|
5
|
+
#insert data here
|
|
6
|
+
DynamicFormModel.create(:model_name => 'DynamicFormDocument')
|
|
7
|
+
|
|
8
|
+
fields = []
|
|
9
|
+
|
|
10
|
+
fields << DynamicFormField.textfield({:fieldLabel => 'First Name', :name => 'first_name', :width => 250, :allowBlank => false })
|
|
11
|
+
fields << DynamicFormField.textfield({:fieldLabel => 'Last Name', :name => 'last_name', :width => 250, :allowBlank => false })
|
|
12
|
+
fields << DynamicFormField.email({:fieldLabel => 'Email', :name => 'email', :width => 250, :allowBlank => false })
|
|
13
|
+
fields << DynamicFormField.textarea({:fieldLabel => 'Message', :name => 'message', :width => 400, :height => 200, :allowBlank => false })
|
|
14
|
+
|
|
15
|
+
d = DynamicForm.new
|
|
16
|
+
d.description = 'Contact Form'
|
|
17
|
+
d.definition = fields.to_json
|
|
18
|
+
d.model_name = 'WebsiteInquiry'
|
|
19
|
+
d.internal_identifier = 'contact_us'
|
|
20
|
+
d.default = true
|
|
21
|
+
d.dynamic_form_model = DynamicFormModel.create(:model_name => 'WebsiteInquiry')
|
|
22
|
+
d.comment = "This is the default form used by Knitkit's Contact Us Widget for Website Inquiries. NOTE: The Contact Us Widget uses Knitkit's website configuration options for email behavior & not the Dynamic Forms Widget Action setting."
|
|
23
|
+
d.msg_target = 'qtip'
|
|
24
|
+
d.save
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.down
|
|
28
|
+
#remove data here
|
|
29
|
+
DynamicFormModel.delete_all
|
|
30
|
+
DynamicForm.delete_all
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|