erp_txns_and_accts 4.0.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v1/biz_txn_acct_roots_controller.rb +124 -0
- data/app/controllers/api/v1/biz_txn_acct_types_controller.rb +130 -0
- data/app/controllers/api/v1/biz_txn_events_controller.rb +53 -0
- data/app/controllers/api/v1/biz_txn_types_controller.rb +131 -0
- data/app/controllers/api/v1/financial_txns_controller.rb +53 -0
- data/app/models/biz_txn_acct_pty_rtype.rb +1 -0
- data/app/models/biz_txn_acct_root.rb +130 -6
- data/app/models/biz_txn_acct_type.rb +2 -0
- data/app/models/biz_txn_event.rb +229 -49
- data/app/models/biz_txn_party_role_type.rb +6 -0
- data/app/models/biz_txn_type.rb +23 -0
- data/app/models/extensions/party.rb +4 -2
- data/app/models/financial_txn.rb +108 -19
- data/config/routes.rb +13 -0
- data/db/data_migrations/20151216210147_add_default_gl_accounts.rb +33 -0
- data/db/migrate/20080805000030_base_txns_and_accts.rb +129 -127
- data/db/migrate/20151216202856_add_nested_set_to_biz_txn_acct_roots.rb +31 -0
- data/db/migrate/20151231185337_add_billable_to_finanical_txn.rb +13 -0
- data/db/migrate/20160310163051_add_created_by_updated_by_to_erp_txns_and_accts.rb +35 -0
- data/db/migrate/20160628145626_upgrade_biz_txn_events_entered_date_data_type.rb +21 -0
- data/lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_event.rb +29 -15
- data/lib/erp_txns_and_accts/version.rb +1 -1
- metadata +17 -10
- data/db/data_migrations/20101014142230_financial_txn_types.rb +0 -15
- data/db/migrate/20130408195119_add_biz_txn_acct_type_id_to_biz_txn_acct_root.rb +0 -5
- data/db/migrate/20140523095709_add_custom_fields_to_biz_txn_events.rb +0 -10
@@ -0,0 +1,31 @@
|
|
1
|
+
class AddNestedSetToBizTxnAcctRoots < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
unless column_exists? :biz_txn_acct_roots, :parent_id
|
4
|
+
add_column :biz_txn_acct_roots, :parent_id, :integer
|
5
|
+
add_column :biz_txn_acct_roots, :lft, :integer
|
6
|
+
add_column :biz_txn_acct_roots, :rgt, :integer
|
7
|
+
|
8
|
+
add_index :biz_txn_acct_roots, :parent_id
|
9
|
+
add_index :biz_txn_acct_roots, :lft
|
10
|
+
add_index :biz_txn_acct_roots, :rgt
|
11
|
+
|
12
|
+
BizTxnAcctRoot.rebuild!
|
13
|
+
end
|
14
|
+
|
15
|
+
unless column_exists? :biz_txn_acct_roots, :internal_identifier
|
16
|
+
add_column :biz_txn_acct_roots, :internal_identifier, :string
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def down
|
21
|
+
if column_exists? :biz_txn_acct_roots, :parent_id
|
22
|
+
remove_column :biz_txn_acct_roots, :parent_id
|
23
|
+
remove_column :biz_txn_acct_roots, :lft
|
24
|
+
remove_column :biz_txn_acct_roots, :rgt
|
25
|
+
end
|
26
|
+
|
27
|
+
if column_exists? :biz_txn_acct_roots, :internal_identifier
|
28
|
+
remove_column :biz_txn_acct_roots, :internal_identifier
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class AddBillableToFinanicalTxn < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
unless column_exists? :financial_txns, :billable
|
4
|
+
add_column :financial_txns, :billable, :boolean, default: false
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def down
|
9
|
+
if column_exists? :financial_txns, :billable
|
10
|
+
remove_column :financial_txns, :billable
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class AddCreatedByUpdatedByToErpTxnsAndAccts < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
%w{biz_txn_acct_roots biz_txn_events}.each do |table|
|
4
|
+
|
5
|
+
unless column_exists? table.to_sym, :created_by_party_id
|
6
|
+
add_column table.to_sym, :created_by_party_id, :integer
|
7
|
+
|
8
|
+
add_index table.to_sym, :created_by_party_id, name: "#{table}_created_by_pty_idx"
|
9
|
+
end
|
10
|
+
|
11
|
+
unless column_exists? table.to_sym, :updated_by_party_id
|
12
|
+
add_column table.to_sym, :updated_by_party_id, :integer
|
13
|
+
|
14
|
+
add_index table.to_sym, :updated_by_party_id, name: "#{table}_updated_by_pty_idx"
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def down
|
22
|
+
%w{biz_txn_acct_roots biz_txn_events}.each do |table|
|
23
|
+
|
24
|
+
if column_exists? table.to_sym, :created_by_party_id
|
25
|
+
remove_column table.to_sym, :created_by_party_id
|
26
|
+
end
|
27
|
+
|
28
|
+
if column_exists? table.to_sym, :updated_by_party_id
|
29
|
+
remove_column table.to_sym, :updated_by_party_id
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class UpgradeBizTxnEventsEnteredDateDataType < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
if column_exists?(:biz_txn_events, :entered_date)
|
4
|
+
change_column :biz_txn_events, :entered_date, :date if BizTxnEvent.columns_hash['entered_date'].type == :datetime
|
5
|
+
end
|
6
|
+
|
7
|
+
if column_exists?(:biz_txn_events, :post_date)
|
8
|
+
change_column :biz_txn_events, :post_date, :date if BizTxnEvent.columns_hash['post_date'].type == :datetime
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
if column_exists?(:biz_txn_events, :entered_date)
|
14
|
+
change_column :biz_txn_events, :entered_date, :datetime if BizTxnEvent.columns_hash['entered_date'].type == :date
|
15
|
+
end
|
16
|
+
|
17
|
+
if column_exists?(:biz_txn_events, :post_date)
|
18
|
+
change_column :biz_txn_events, :post_date, :datetime if BizTxnEvent.columns_hash['post_date'].type == :date
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ErpTxnsAndAccts
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ActsAsBizTxnEvent
|
5
5
|
|
6
6
|
def self.included(base)
|
7
7
|
base.extend(ClassMethods)
|
@@ -21,20 +21,34 @@ module ErpTxnsAndAccts
|
|
21
21
|
belongs_to :biz_txn_acct_root
|
22
22
|
|
23
23
|
#from BizTxnEvent
|
24
|
-
[:txn_type
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
24
|
+
[:txn_type, :txn_type=,
|
25
|
+
:txn_type_iid, :txn_type_iid=,
|
26
|
+
:biz_txn_type_id, :biz_txn_type_id=,
|
27
|
+
:external_id_source, :external_id_source=,
|
28
|
+
:external_identifier, :external_identifier=,
|
29
|
+
:description, :description=,
|
30
|
+
:post_date, :post_date=,
|
31
|
+
:created_at, :created_at=,
|
32
|
+
:updated_at, :updated_at=,
|
33
|
+
:create_dependent_txns, :account,
|
34
|
+
#
|
35
|
+
# has_tracked_status delegations
|
36
|
+
#
|
37
|
+
:has_status?, :had_status?, :has_had_status?, :get_status_for_date_time,
|
38
|
+
:get_statuses_for_date_time_range, :current_status_application, :current_status_type,
|
39
|
+
:current_status, :current_status=, :previous_status, :add_status
|
40
|
+
].each { |m| delegate m, :to => :biz_txn_event }
|
34
41
|
end
|
35
42
|
end
|
36
43
|
|
37
44
|
module SingletonMethods
|
45
|
+
def with_current_status(status)
|
46
|
+
self.joins(:biz_txn_event).where("biz_txn_events.id in (#{BizTxnEvent.select('biz_txn_events.id').with_current_status(status).to_sql})")
|
47
|
+
end
|
48
|
+
|
49
|
+
def without_current_status(status)
|
50
|
+
self.joins(:biz_txn_event).where("biz_txn_events.id in (#{BizTxnEvent.select('biz_txn_events.id').without_current_status(status).to_sql})")
|
51
|
+
end
|
38
52
|
end
|
39
53
|
|
40
54
|
module InstanceMethods
|
@@ -65,8 +79,8 @@ module ErpTxnsAndAccts
|
|
65
79
|
end
|
66
80
|
|
67
81
|
def destroy_biz_txn_event
|
68
|
-
|
69
|
-
|
82
|
+
self.biz_txn_event.destroy if (self.biz_txn_event && !self.biz_txn_event.frozen?)
|
83
|
+
end
|
70
84
|
end
|
71
85
|
|
72
86
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erp_txns_and_accts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rick Koloski, Russell Holmes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erp_agreements
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '4.
|
19
|
+
version: '4.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '4.
|
26
|
+
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: erp_dev_svcs
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '4.
|
33
|
+
version: '4.2'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '4.
|
40
|
+
version: '4.2'
|
41
41
|
description: 'The Transactions and Accounts Engine implements the root classes for
|
42
42
|
adding business transactions and accounts to parties. The key marker interface classes
|
43
43
|
here are BizTxnEvent, which represents a common interface for all manner of management
|
@@ -53,6 +53,11 @@ files:
|
|
53
53
|
- GPL-3-LICENSE
|
54
54
|
- README.rdoc
|
55
55
|
- Rakefile
|
56
|
+
- app/controllers/api/v1/biz_txn_acct_roots_controller.rb
|
57
|
+
- app/controllers/api/v1/biz_txn_acct_types_controller.rb
|
58
|
+
- app/controllers/api/v1/biz_txn_events_controller.rb
|
59
|
+
- app/controllers/api/v1/biz_txn_types_controller.rb
|
60
|
+
- app/controllers/api/v1/financial_txns_controller.rb
|
56
61
|
- app/models/base_txn_context.rb
|
57
62
|
- app/models/biz_acct_txn_task.rb
|
58
63
|
- app/models/biz_txn_acct_party_role.rb
|
@@ -80,11 +85,13 @@ files:
|
|
80
85
|
- app/models/financial_txn.rb
|
81
86
|
- app/models/financial_txn_account.rb
|
82
87
|
- config/routes.rb
|
83
|
-
- db/data_migrations/20101014142230_financial_txn_types.rb
|
84
88
|
- db/data_migrations/20140202161941_add_account_owner.rb
|
89
|
+
- db/data_migrations/20151216210147_add_default_gl_accounts.rb
|
85
90
|
- db/migrate/20080805000030_base_txns_and_accts.rb
|
86
|
-
- db/migrate/
|
87
|
-
- db/migrate/
|
91
|
+
- db/migrate/20151216202856_add_nested_set_to_biz_txn_acct_roots.rb
|
92
|
+
- db/migrate/20151231185337_add_billable_to_finanical_txn.rb
|
93
|
+
- db/migrate/20160310163051_add_created_by_updated_by_to_erp_txns_and_accts.rb
|
94
|
+
- db/migrate/20160628145626_upgrade_biz_txn_events_entered_date_data_type.rb
|
88
95
|
- lib/erp_txns_and_accts.rb
|
89
96
|
- lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb
|
90
97
|
- lib/erp_txns_and_accts/engine.rb
|
@@ -165,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
172
|
version: '0'
|
166
173
|
requirements: []
|
167
174
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.
|
175
|
+
rubygems_version: 2.4.8
|
169
176
|
signing_key:
|
170
177
|
specification_version: 4
|
171
178
|
summary: The Transactions and Accounts Engine implements the root classes for adding
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class FinancialTxnTypes
|
2
|
-
|
3
|
-
def self.up
|
4
|
-
BizTxnType.create(
|
5
|
-
:description => "Payment Transaction",
|
6
|
-
:internal_identifier => 'payment_txn'
|
7
|
-
)
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.down
|
11
|
-
type = BizTxnType.iid('payment_txn')
|
12
|
-
type.destroy unless type.nil?
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
class AddCustomFieldsToBizTxnEvents < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
if ::ActiveRecord::Base.connection.instance_values["config"][:adapter] == 'postgresql'
|
4
|
-
add_column :biz_txn_events, :custom_fields, :hstore
|
5
|
-
add_hstore_index :biz_txn_events, :custom_fields
|
6
|
-
else
|
7
|
-
add_column :biz_txn_events, :custom_fields, :text
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|