erp_txns_and_accts 3.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/biz_txn_acct_root.rb +15 -14
- data/db/migrate/20130408195119_add_biz_txn_acct_type_id_to_biz_txn_acct_root.rb +5 -0
- data/lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_account.rb +9 -8
- data/lib/erp_txns_and_accts/version.rb +1 -1
- data/spec/dummy/db/data_migrations/20130422155332_upgrade_compass_ae_instances_data.erp_base_erp_svcs.rb +19 -0
- data/spec/dummy/db/data_migrations/20130422155333_add_guid_to_instances.erp_base_erp_svcs.rb +10 -0
- data/spec/dummy/db/data_migrations/20130422155334_create_job_tracker_desktop_application.erp_app.rb +23 -0
- data/spec/dummy/db/data_migrations/20130422155335_created_tracked_jobs.erp_app.rb +15 -0
- data/spec/dummy/db/data_migrations/20130422155336_add_job_tracker_mobile_app.erp_app.rb +17 -0
- data/spec/dummy/db/data_migrations/20130422155337_add_credit_card_biz_txn_acct_types.erp_commerce.rb +58 -0
- data/spec/dummy/db/migrate/{20130107214858_base_erp_services.erp_base_erp_svcs.rb → 20130107205642_base_erp_services.erp_base_erp_svcs.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214859_base_txns_and_accts.erp_txns_and_accts.rb → 20130107205643_base_txns_and_accts.erp_txns_and_accts.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214860_base_tech_services.erp_tech_svcs.rb → 20130107205644_base_tech_services.erp_tech_svcs.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214861_create_has_attribute_tables.erp_tech_svcs.rb → 20130107205645_create_has_attribute_tables.erp_tech_svcs.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214862_create_groups.erp_tech_svcs.rb → 20130107205646_create_groups.erp_tech_svcs.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214863_upgrade_security.erp_tech_svcs.rb → 20130107205647_upgrade_security.erp_tech_svcs.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214864_upgrade_security2.erp_tech_svcs.rb → 20130107205648_upgrade_security2.erp_tech_svcs.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214865_agreements_services.erp_agreements.rb → 20130107205649_agreements_services.erp_agreements.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214866_agreements_services_indexes.erp_agreements.rb → 20130107205650_agreements_services_indexes.erp_agreements.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214867_base_app_framework.erp_app.rb → 20130107205651_base_app_framework.erp_app.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214868_base_products.erp_products.rb → 20130107205652_base_products.erp_products.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214869_base_products_indexes.erp_products.rb → 20130107205653_base_products_indexes.erp_products.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214870_base_orders.erp_orders.rb → 20130107205654_base_orders.erp_orders.rb} +0 -0
- data/spec/dummy/db/migrate/{20130107214871_erp_commerce_base.erp_commerce.rb → 20130107205655_erp_commerce_base.erp_commerce.rb} +0 -0
- data/spec/dummy/db/migrate/20130422155324_add_txn_status.erp_base_erp_svcs.rb +37 -0
- data/spec/dummy/db/migrate/20130422155325_upgrade_compass_ae_instances.erp_base_erp_svcs.rb +34 -0
- data/spec/dummy/db/migrate/20130422155326_add_uuid_compass_ae_instance.erp_base_erp_svcs.rb +17 -0
- data/spec/dummy/db/migrate/20130422155327_add_long_lat_to_address.erp_base_erp_svcs.rb +16 -0
- data/spec/dummy/db/migrate/20130422155328_add_biz_txn_acct_type_id_to_biz_txn_acct_root.erp_txns_and_accts.rb +6 -0
- data/spec/dummy/db/migrate/20130422155329_add_queue_to_delayed_jobs.erp_tech_svcs.rb +14 -0
- data/spec/dummy/db/migrate/20130422155330_add_job_tracker.erp_app.rb +20 -0
- data/spec/dummy/db/migrate/20130422155331_update_mobile_application.erp_app.rb +28 -0
- data/spec/dummy/db/migrate/20130422155332_add_product_instances_nested_set_indexes.erp_products.rb +10 -0
- data/spec/dummy/db/schema.rb +72 -9
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/spec.log +4095 -10563
- metadata +62 -39
- data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +0 -14
@@ -1,21 +1,22 @@
|
|
1
1
|
class BizTxnAcctRoot < ActiveRecord::Base
|
2
2
|
attr_protected :created_at, :updated_at
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
4
|
+
belongs_to :biz_txn_acct, :polymorphic => true
|
5
|
+
belongs_to :txn_account_type, :class_name => 'BizTxnAcctType', :foreign_key => 'biz_txn_acct_type_id'
|
6
|
+
has_many :biz_txn_events, :dependent => :destroy
|
7
|
+
has_many :biz_txn_acct_party_roles, :dependent => :destroy
|
8
|
+
|
9
|
+
alias :account :biz_txn_acct
|
10
|
+
alias :txn_events :biz_txn_events
|
11
|
+
alias :txns :biz_txn_events
|
12
|
+
|
13
|
+
def to_label
|
13
14
|
"#{description}"
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_s
|
17
18
|
"#{description}"
|
18
|
-
|
19
|
+
end
|
19
20
|
|
20
21
|
def add_party_with_role(party, biz_txn_acct_pty_rtype, description=nil)
|
21
22
|
biz_txn_acct_pty_rtype = BizTxnAcctPtyRtype.iid(biz_txn_acct_pty_rtype) if biz_txn_acct_pty_rtype.is_a? String
|
@@ -30,5 +31,5 @@ class BizTxnAcctRoot < ActiveRecord::Base
|
|
30
31
|
raise "BizTxnAcctPtyRtype #{biz_txn_acct_pty_rtype.to_s} does not exist" if biz_txn_acct_pty_rtype.nil?
|
31
32
|
self.biz_txn_acct_party_roles.where('biz_txn_acct_pty_rtype_id = ?', biz_txn_acct_pty_rtype.id).collect(&:party)
|
32
33
|
end
|
33
|
-
|
34
|
+
|
34
35
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module ErpTxnsAndAccts
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ActsAsBizTxnAccount
|
5
|
+
|
6
6
|
def self.included(base)
|
7
7
|
base.extend(ClassMethods)
|
8
8
|
end
|
@@ -21,6 +21,7 @@ module ErpTxnsAndAccts
|
|
21
21
|
|
22
22
|
[
|
23
23
|
:biz_txn_acct_type,
|
24
|
+
:txn_account_type,:txn_account_type=,
|
24
25
|
:biz_txn_events,
|
25
26
|
:biz_txn_acct_party_roles,
|
26
27
|
:txn_events,:add_party_with_role,
|
@@ -52,13 +53,13 @@ module ErpTxnsAndAccts
|
|
52
53
|
end
|
53
54
|
|
54
55
|
def destroy_biz_txn_account
|
55
|
-
|
56
|
-
|
56
|
+
self.biz_txn_acct_root.destroy if (self.biz_txn_acct_root && !self.biz_txn_acct_root.frozen?)
|
57
|
+
end
|
57
58
|
end
|
58
|
-
|
59
|
+
|
59
60
|
module SingletonMethods
|
60
61
|
end
|
61
|
-
|
62
|
+
|
62
63
|
end#ActsAsBizTxnAccount
|
63
64
|
end#ActiveRecord
|
64
65
|
end#Extensions
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# This migration comes from erp_base_erp_svcs (originally 20130211555555)
|
2
|
+
class UpgradeCompassAeInstancesData < ActiveRecord::Migration
|
3
|
+
def self.up
|
4
|
+
if CompassAeInstance.find_by_internal_identifier('base').nil?
|
5
|
+
c = CompassAeInstance.order('id ASC').first
|
6
|
+
c.description = 'Base CompassAE Instance'
|
7
|
+
c.internal_identifier = 'base'
|
8
|
+
c.schema = 'public'
|
9
|
+
c.save
|
10
|
+
end
|
11
|
+
|
12
|
+
if RoleType.find_by_internal_identifier('compass_ae_instance_owner').nil?
|
13
|
+
rt = RoleType.new
|
14
|
+
rt.description = 'CompassAE Instance Owner'
|
15
|
+
rt.internal_identifier = 'compass_ae_instance_owner'
|
16
|
+
rt.save
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/dummy/db/data_migrations/20130422155334_create_job_tracker_desktop_application.erp_app.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# This migration comes from erp_app (originally 20121018143910)
|
2
|
+
class CreateJobTrackerDesktopApplication
|
3
|
+
def self.up
|
4
|
+
app = DesktopApplication.create(
|
5
|
+
:description => 'Job Tracker',
|
6
|
+
:icon => 'icon-calendar',
|
7
|
+
:javascript_class_name => 'Compass.ErpApp.Desktop.Applications.JobTracker',
|
8
|
+
:internal_identifier => 'job_tracker',
|
9
|
+
:shortcut_id => 'job_tracker-win'
|
10
|
+
)
|
11
|
+
pt1 = PreferenceType.iid('desktop_shortcut')
|
12
|
+
pt1.preferenced_records << app
|
13
|
+
pt1.save
|
14
|
+
|
15
|
+
pt2 = PreferenceType.iid('autoload_application')
|
16
|
+
pt2.preferenced_records << app
|
17
|
+
pt2.save
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.down
|
21
|
+
DesktopApplication.destroy_all(['internal_identifier = ?','job_tracker'])
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This migration comes from erp_app (originally 20121018172347)
|
2
|
+
class CreatedTrackedJobs
|
3
|
+
|
4
|
+
def self.up
|
5
|
+
JobTracker.create(
|
6
|
+
:job_name => 'Delete Expired Sessions',
|
7
|
+
:job_klass => 'ErpTechSvcs::Sessions::DeleteExpiredSessionsJob'
|
8
|
+
)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.down
|
12
|
+
#remove data here
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# This migration comes from erp_app (originally 20130411200351)
|
2
|
+
class AddJobTrackerMobileApp
|
3
|
+
|
4
|
+
def self.up
|
5
|
+
MobileApplication.create(
|
6
|
+
:description => 'Jobs',
|
7
|
+
:icon => 'icon-tasks',
|
8
|
+
:internal_identifier => 'job_tracker',
|
9
|
+
:xtype => 'compass-erpapp-mobile-jobtracker-application'
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
MobileApplication.destroy_all("internal_identifier = 'job_tracker'")
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/spec/dummy/db/data_migrations/20130422155337_add_credit_card_biz_txn_acct_types.erp_commerce.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# This migration comes from erp_commerce (originally 20130408200643)
|
2
|
+
class AddCreditCardBizTxnAcctTypes
|
3
|
+
|
4
|
+
def self.up
|
5
|
+
# add credit card account types as biz txn account types
|
6
|
+
if (BizTxnAcctType.find_by_internal_identifier('credit_card_account').nil?)
|
7
|
+
@credit_card_account = BizTxnAcctType.create(
|
8
|
+
:description => 'Credit Card Account',
|
9
|
+
:internal_identifier => 'credit_card_account',
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
if (BizTxnAcctType.find_by_internal_identifier('amex').nil?)
|
14
|
+
@type = BizTxnAcctType.create(
|
15
|
+
:description => 'American Express',
|
16
|
+
:internal_identifier => 'amex',
|
17
|
+
)
|
18
|
+
@type.move_to_child_of @credit_card_account
|
19
|
+
end
|
20
|
+
|
21
|
+
if (BizTxnAcctType.find_by_internal_identifier('dinersclub').nil?)
|
22
|
+
@type = BizTxnAcctType.create(
|
23
|
+
:description => 'Diners Club',
|
24
|
+
:internal_identifier => 'dinersclub',
|
25
|
+
)
|
26
|
+
@type.move_to_child_of @credit_card_account
|
27
|
+
end
|
28
|
+
|
29
|
+
if (BizTxnAcctType.find_by_internal_identifier('discover').nil?)
|
30
|
+
@type = BizTxnAcctType.create(
|
31
|
+
:description => 'Discover',
|
32
|
+
:internal_identifier => 'discover',
|
33
|
+
)
|
34
|
+
@type.move_to_child_of @credit_card_account
|
35
|
+
end
|
36
|
+
|
37
|
+
if (BizTxnAcctType.find_by_internal_identifier('mastercard').nil?)
|
38
|
+
@type = BizTxnAcctType.create(
|
39
|
+
:description => 'MasterCard',
|
40
|
+
:internal_identifier => 'mastercard',
|
41
|
+
)
|
42
|
+
@type.move_to_child_of @credit_card_account
|
43
|
+
end
|
44
|
+
|
45
|
+
if (BizTxnAcctType.find_by_internal_identifier('visa').nil?)
|
46
|
+
@type = BizTxnAcctType.create(
|
47
|
+
:description => 'Visa',
|
48
|
+
:internal_identifier => 'visa',
|
49
|
+
)
|
50
|
+
@type.move_to_child_of @credit_card_account
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.down
|
55
|
+
#remove data here
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# This migration comes from erp_base_erp_svcs (originally 20120606183856)
|
2
|
+
class AddTxnStatus < ActiveRecord::Migration
|
3
|
+
def up
|
4
|
+
unless table_exists?(:status_applications)
|
5
|
+
create_table :status_applications do |t|
|
6
|
+
t.references :tracked_status_type
|
7
|
+
t.references :status_application_record, :polymorphic => true
|
8
|
+
t.datetime :from_date
|
9
|
+
t.datetime :thru_date
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :status_applications, [:status_application_record_id, :status_application_record_type], :name => 'status_applications_record_idx'
|
15
|
+
add_index :status_applications, :tracked_status_type_id, :name => 'tracked_status_type_id_idx'
|
16
|
+
add_index :status_applications, :from_date, :name => 'from_date_idx'
|
17
|
+
add_index :status_applications, :thru_date, :name => 'thru_date_idx'
|
18
|
+
end
|
19
|
+
|
20
|
+
unless table_exists?(:tracked_status_types)
|
21
|
+
create_table :tracked_status_types do |t|
|
22
|
+
t.string :description
|
23
|
+
t.string :internal_identifier
|
24
|
+
t.string :external_identifier
|
25
|
+
|
26
|
+
t.timestamps
|
27
|
+
end
|
28
|
+
|
29
|
+
add_index :tracked_status_types, :internal_identifier, :name => 'tracked_status_types_iid_idx'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def down
|
34
|
+
drop_table :status_applications if table_exists?(:status_applications)
|
35
|
+
drop_table :tracked_status_types if table_exists?(:tracked_status_types)
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# This migration comes from erp_base_erp_svcs (originally 20130211444444)
|
2
|
+
# This migration comes from erp_base_erp_svcs (originally 20130211444444)
|
3
|
+
class UpgradeCompassAeInstances < ActiveRecord::Migration
|
4
|
+
def self.up
|
5
|
+
unless columns(:compass_ae_instances).collect {|c| c.name}.include?('type')
|
6
|
+
add_column :compass_ae_instances, :description, :string
|
7
|
+
add_column :compass_ae_instances, :internal_identifier, :string
|
8
|
+
add_column :compass_ae_instances, :type, :string
|
9
|
+
add_column :compass_ae_instances, :schema, :string, :default => 'public'
|
10
|
+
add_column :compass_ae_instances, :parent_id, :integer
|
11
|
+
|
12
|
+
add_index :compass_ae_instances, :internal_identifier, :name => "iid_idx"
|
13
|
+
add_index :compass_ae_instances, :schema, :name => "schema_idx"
|
14
|
+
add_index :compass_ae_instances, :type, :name => "type_idx"
|
15
|
+
add_index :compass_ae_instances, :parent_id, :name => "parent_id_idx"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
unless table_exists?(:compass_ae_instance_party_roles)
|
20
|
+
create_table :compass_ae_instance_party_roles do |t|
|
21
|
+
t.string :description
|
22
|
+
t.integer :compass_ae_instance_id
|
23
|
+
t.integer :party_id
|
24
|
+
t.integer :role_type_id
|
25
|
+
|
26
|
+
t.timestamps
|
27
|
+
end
|
28
|
+
|
29
|
+
add_index :compass_ae_instance_party_roles, :compass_ae_instance_id, :name => "compass_ae_instance_id_idx"
|
30
|
+
add_index :compass_ae_instance_party_roles, :party_id, :name => "party_id_idx"
|
31
|
+
add_index :compass_ae_instance_party_roles, :role_type_id, :name => "role_type_id_idx"
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# This migration comes from erp_base_erp_svcs (originally 20130404171435)
|
2
|
+
require 'uuid'
|
3
|
+
|
4
|
+
class AddUuidCompassAeInstance < ActiveRecord::Migration
|
5
|
+
def self.up
|
6
|
+
unless columns(:compass_ae_instances).collect {|c| c.name}.include?('guid')
|
7
|
+
add_column :compass_ae_instances, :guid, :string
|
8
|
+
add_index :compass_ae_instances, :guid, :name => "guid_idx"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
if columns(:compass_ae_instances).collect {|c| c.name}.include?('guid')
|
14
|
+
remove_column :compass_ae_instances, :guid
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This migration comes from erp_base_erp_svcs (originally 20130411125210)
|
2
|
+
class AddLongLatToAddress < ActiveRecord::Migration
|
3
|
+
def up
|
4
|
+
unless columns(:postal_addresses).collect {|c| c.name}.include?('latitude')
|
5
|
+
add_column :postal_addresses, :latitude, :decimal, :precision => 12, :scale => 8
|
6
|
+
add_column :postal_addresses, :longitude, :decimal, :precision => 12, :scale => 8
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
if columns(:postal_addresses).collect {|c| c.name}.include?('latitude')
|
12
|
+
remove_column :postal_addresses, :latitude
|
13
|
+
remove_column :postal_addresses, :longitude
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# This migration comes from erp_tech_svcs (originally 20130410135419)
|
2
|
+
class AddQueueToDelayedJobs < ActiveRecord::Migration
|
3
|
+
def up
|
4
|
+
unless columns(:delayed_jobs).collect {|c| c.name}.include?('queue')
|
5
|
+
add_column :delayed_jobs, :queue, :string
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
if columns(:delayed_jobs).collect {|c| c.name}.include?('queue')
|
11
|
+
remove_column :delayed_jobs, :queue, :string
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# This migration comes from erp_app (originally 20120920145259)
|
2
|
+
class AddJobTracker < ActiveRecord::Migration
|
3
|
+
def up
|
4
|
+
unless table_exists?(:job_trackers)
|
5
|
+
create_table :job_trackers do |t|
|
6
|
+
t.string :job_name
|
7
|
+
t.string :job_klass
|
8
|
+
t.string :run_time
|
9
|
+
t.datetime :last_run_at
|
10
|
+
t.datetime :next_run_at
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def down
|
16
|
+
if table_exists?(:job_trackers)
|
17
|
+
drop_table :job_trackers
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|