erp_work_effort 3.1.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/controllers/erp_work_effort/erp_app/organizer/tasks/base_controller.rb +13 -0
- data/app/controllers/erp_work_effort/erp_app/organizer/tasks/work_efforts_controller.rb +128 -0
- data/app/models/associated_transportation_route.rb +12 -0
- data/app/models/associated_work_effort.rb +12 -0
- data/app/models/deliverable.rb +7 -0
- data/app/models/deliverable_type.rb +9 -0
- data/app/models/extensions/party.rb +0 -2
- data/app/models/good_type.rb +11 -0
- data/app/models/party_fixed_asset_assignment.rb +12 -0
- data/app/models/party_skill.rb +6 -0
- data/app/models/requirement.rb +14 -0
- data/app/models/requirement_party_role.rb +8 -0
- data/app/models/requirement_type.rb +7 -0
- data/app/models/skill_type.rb +10 -0
- data/app/models/transportation_route.rb +71 -0
- data/app/models/transportation_route_segment.rb +9 -0
- data/app/models/transportation_route_stop.rb +6 -0
- data/app/models/work_effort.rb +82 -92
- data/app/models/work_effort_association.rb +16 -0
- data/app/models/work_effort_association_type.rb +14 -0
- data/app/models/work_effort_deliverable_produced.rb +6 -0
- data/app/models/work_effort_fixed_asset_assignment.rb +10 -0
- data/app/models/work_effort_fixed_asset_serviced.rb +6 -0
- data/app/models/work_effort_fixed_asset_standard.rb +7 -0
- data/app/models/work_effort_good_standard.rb +7 -0
- data/app/models/work_effort_inventory_assignment.rb +10 -0
- data/app/models/work_effort_inventory_produced.rb +7 -0
- data/app/models/work_effort_party_assignment.rb +12 -0
- data/app/models/work_effort_purpose_type.rb +11 -0
- data/app/models/work_effort_skill_standard.rb +7 -0
- data/app/models/work_effort_type.rb +9 -0
- data/app/models/work_effort_type_association.rb +10 -0
- data/app/models/work_order_item.rb +5 -0
- data/app/models/work_order_item_fulfillment.rb +11 -0
- data/app/models/work_requirement_fulfillment.rb +3 -0
- data/config/routes.rb +20 -0
- data/db/data_migrations/20131213151309_create_tasks_organizer_application.rb +14 -0
- data/db/data_migrations/20131215225329_add_task_work_effort_types.rb +11 -0
- data/db/data_migrations/20131215234936_add_task_statuses.rb +21 -0
- data/db/migrate/20100220000000_base_work_efforts.rb +506 -103
- data/db/migrate/20130829153419_base_routes.rb +93 -0
- data/db/migrate/20131213140617_add_work_effort_role_assignments.rb +16 -0
- data/db/migrate/20131213144223_add_work_item_to_work_effort.rb +8 -0
- data/db/migrate/20140106184615_update_work_effort_item_id_to_int.rb +27 -0
- data/lib/erp_work_effort.rb +1 -1
- data/lib/erp_work_effort/engine.rb +7 -5
- data/lib/erp_work_effort/extensions.rb +2 -4
- data/lib/erp_work_effort/extensions/active_record/acts_as_routable.rb +55 -0
- data/lib/erp_work_effort/extensions/active_record/acts_as_work_effort.rb +66 -0
- data/lib/erp_work_effort/version.rb +7 -3
- data/spec/models/deliverable_spec.rb +5 -0
- data/spec/models/deliverable_type_spec.rb +5 -0
- data/spec/models/facility_spec.rb +8 -0
- data/spec/models/facility_type_spec.rb +8 -0
- data/spec/models/fixed_asset_party_role_spec.rb +5 -0
- data/spec/models/fixed_asset_spec.rb +5 -0
- data/spec/models/fixed_asset_type_spec.rb +5 -0
- data/spec/models/good_type_spec.rb +5 -0
- data/spec/models/party_fixed_asset_assignment_spec.rb +5 -0
- data/spec/models/party_skill_spec.rb +5 -0
- data/spec/models/requirement_party_role_spec.rb +5 -0
- data/spec/models/requirement_spec.rb +5 -0
- data/spec/models/requirement_type_spec.rb +5 -0
- data/spec/models/skill_type_spec.rb +8 -0
- data/spec/models/work_effort_association_spec.rb +5 -0
- data/spec/models/work_effort_association_type_spec.rb +5 -0
- data/spec/models/work_effort_deliverable_produced_spec.rb +5 -0
- data/spec/models/work_effort_fixed_asset_assignment_spec.rb +5 -0
- data/spec/models/work_effort_fixed_asset_serviced_spec.rb +5 -0
- data/spec/models/work_effort_fixed_asset_standard_spec.rb +5 -0
- data/spec/models/work_effort_good_standard_spec.rb +5 -0
- data/spec/models/work_effort_inventory_assignment_spec.rb +5 -0
- data/spec/models/work_effort_inventory_produced_spec.rb +5 -0
- data/spec/models/work_effort_party_assignment_spec.rb +5 -0
- data/spec/models/work_effort_purpose_type_spec.rb +5 -0
- data/spec/models/work_effort_skill_standard_spec.rb +5 -0
- data/spec/models/work_effort_spec.rb +49 -0
- data/spec/models/work_effort_type_association_spec.rb +5 -0
- data/spec/models/work_effort_type_spec.rb +5 -0
- data/spec/models/work_order_item_fulfillment_spec.rb +5 -0
- data/spec/models/work_order_item_spec.rb +29 -0
- data/spec/models/work_requirement_fulfillment_spec.rb +5 -0
- metadata +141 -105
- data/app/assets/javascripts/erp_work_effort/application.js +0 -9
- data/app/assets/stylesheets/erp_work_effort/application.css +0 -7
- data/app/controllers/erp_work_effort/application_controller.rb +0 -4
- data/app/helpers/erp_work_effort/application_helper.rb +0 -4
- data/app/models/cost.rb +0 -5
- data/app/models/project_effort.rb +0 -2
- data/app/models/project_requirement.rb +0 -2
- data/app/models/support_effort.rb +0 -2
- data/app/models/support_requirement.rb +0 -2
- data/app/models/work_effort_assignment.rb +0 -12
- data/app/models/work_effort_status.rb +0 -6
- data/app/models/work_effort_status_type.rb +0 -15
- data/app/models/work_requirement.rb +0 -78
- data/app/models/work_requirement_work_effort_status_type.rb +0 -6
- data/app/views/layouts/erp_work_effort/application.html.erb +0 -14
- data/lib/erp_work_effort/extensions/active_record/acts_as_project_effort.rb +0 -66
- data/lib/erp_work_effort/extensions/active_record/acts_as_project_requirement.rb +0 -64
- data/lib/erp_work_effort/extensions/active_record/acts_as_support_effort.rb +0 -61
- data/lib/erp_work_effort/extensions/active_record/acts_as_support_requirement.rb +0 -68
- data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +0 -15
- data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +0 -12
- data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +0 -19
- data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
- data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -12
- data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +0 -22
- data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
- data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +0 -24
- data/spec/dummy/db/migrate/20130107204429_base_erp_services.erp_base_erp_svcs.rb +0 -461
- data/spec/dummy/db/migrate/20130107204430_base_work_efforts.erp_work_effort.rb +0 -211
- data/spec/dummy/db/migrate/20130107204431_base_tech_services.erp_tech_svcs.rb +0 -271
- data/spec/dummy/db/migrate/20130107204432_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
- data/spec/dummy/db/migrate/20130107204433_create_groups.erp_tech_svcs.rb +0 -19
- data/spec/dummy/db/migrate/20130107204434_upgrade_security.erp_tech_svcs.rb +0 -54
- data/spec/dummy/db/migrate/20130107204435_upgrade_security2.erp_tech_svcs.rb +0 -270
- data/spec/dummy/db/schema.rb +0 -750
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/models/cost_spec.rb +0 -11
- data/spec/models/project_effort_spec.rb +0 -11
- data/spec/models/project_requirement_spec.rb +0 -11
- data/spec/models/support_effort_spec.rb +0 -11
- data/spec/models/support_requirement_spec.rb +0 -11
- data/spec/models/valid_work_assignment_attribute_spec.rb +0 -11
- data/spec/models/valid_work_assignment_spec.rb +0 -11
- data/spec/models/work_effort_assignment_spec.rb +0 -13
- data/spec/models/work_effort_status_spec.rb +0 -11
- data/spec/models/work_effort_status_type_spec.rb +0 -11
- data/spec/models/work_requirement_spec.rb +0 -11
- data/spec/models/work_requirement_work_effort_status_type._spec.rb +0 -11
@@ -0,0 +1,93 @@
|
|
1
|
+
class BaseRoutes < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
# transportation_routes
|
4
|
+
unless table_exists?(:transportation_routes)
|
5
|
+
create_table :transportation_routes do |t|
|
6
|
+
|
7
|
+
t.string :internal_identifier
|
8
|
+
t.string :description
|
9
|
+
t.string :comments
|
10
|
+
|
11
|
+
#connection to external system
|
12
|
+
t.string :external_identifier
|
13
|
+
t.string :external_id_source
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# transportation_route_segments
|
20
|
+
unless table_exists?(:transportation_route_segments)
|
21
|
+
create_table :transportation_route_segments do |t|
|
22
|
+
|
23
|
+
t.string :internal_identifier
|
24
|
+
t.string :description
|
25
|
+
t.string :comments
|
26
|
+
|
27
|
+
#connection to external system
|
28
|
+
t.string :external_identifier
|
29
|
+
t.string :external_id_source
|
30
|
+
|
31
|
+
t.integer :sequence
|
32
|
+
t.datetime :estimated_start
|
33
|
+
t.datetime :estmated_arrival
|
34
|
+
t.datetime :actual_start
|
35
|
+
t.datetime :actual_arrival
|
36
|
+
t.integer :start_mileage
|
37
|
+
t.integer :end_milage
|
38
|
+
t.integer :fuel_used
|
39
|
+
|
40
|
+
#foreign keys
|
41
|
+
t.integer :transportation_route_id
|
42
|
+
t.integer :from_transportation_route_stop_id
|
43
|
+
t.integer :to_transportation_route_stop_id
|
44
|
+
|
45
|
+
t.timestamps
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# transportation_route_stops
|
50
|
+
unless table_exists?(:transportation_route_stops)
|
51
|
+
create_table :transportation_route_stops do |t|
|
52
|
+
|
53
|
+
t.string :internal_identifier
|
54
|
+
t.string :description
|
55
|
+
|
56
|
+
t.integer :postal_address_id
|
57
|
+
t.string :geoloc
|
58
|
+
t.integer :sequence
|
59
|
+
|
60
|
+
#connection to external system
|
61
|
+
t.string :external_identifier
|
62
|
+
t.string :external_id_source
|
63
|
+
|
64
|
+
#foreign keys
|
65
|
+
t.integer :transportation_route_id
|
66
|
+
|
67
|
+
t.timestamps
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# associated_transportation_routes
|
72
|
+
unless table_exists?(:associated_transportation_routes)
|
73
|
+
create_table :associated_transportation_routes do |t|
|
74
|
+
#foreign keys
|
75
|
+
t.integer :transportation_route_id
|
76
|
+
|
77
|
+
#polymorphic columns
|
78
|
+
t.integer :associated_record_id
|
79
|
+
t.string :associated_record_type
|
80
|
+
end
|
81
|
+
add_index :associated_transportation_routes, [:associated_record_id, :associated_record_type], :name => "associated_route_record_id_type_idx"
|
82
|
+
add_index :associated_transportation_routes, :transportation_route_id, :name => "associated_route_transportation_route_id_idx"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def down
|
87
|
+
[:transportation_routes, :transportation_route_segments, :transportation_route_stops, :associated_transportation_routes].each do |tbl|
|
88
|
+
if table_exists?(tbl)
|
89
|
+
drop_table tbl
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class AddWorkEffortRoleAssignments < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
|
4
|
+
create_table :role_types_work_efforts do |t|
|
5
|
+
t.references :role_type
|
6
|
+
t.references :work_effort
|
7
|
+
end
|
8
|
+
|
9
|
+
add_index :role_types_work_efforts, [:role_type_id, :work_effort_id], :name => 'role_type_work_effort_idx'
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
def down
|
14
|
+
drop_table :role_types_work_efforts
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddWorkItemToWorkEffort < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :work_efforts, :work_effort_item_type, :string
|
4
|
+
add_column :work_efforts, :work_effort_item_id, :string
|
5
|
+
|
6
|
+
add_index :work_efforts, [:work_effort_item_type, :work_effort_item_id], :name => 'work_item_idx'
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class UpdateWorkEffortItemIdToInt < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
remove_index :work_efforts, :name => 'work_item_idx'
|
4
|
+
|
5
|
+
# get current values
|
6
|
+
current_values = WorkEffort.select([:id, :work_effort_item_id])
|
7
|
+
.where('work_effort_item_id is not null')
|
8
|
+
.collect { |wf| {id: wf.id, work_effort_item_id: wf.work_effort_item_id} }
|
9
|
+
|
10
|
+
remove_column :work_efforts, :work_effort_item_id
|
11
|
+
add_column :work_efforts, :work_effort_item_id, :integer
|
12
|
+
|
13
|
+
current_values.each do |values|
|
14
|
+
|
15
|
+
wf = WorkEffort.find(values[:id])
|
16
|
+
wf.work_effort_item_id = values[:work_effort_item_id]
|
17
|
+
wf.save
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
add_index :work_efforts, [:work_effort_item_type, :work_effort_item_id], :name => 'work_item_idx'
|
22
|
+
end
|
23
|
+
|
24
|
+
def down
|
25
|
+
# no going back
|
26
|
+
end
|
27
|
+
end
|
data/lib/erp_work_effort.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
module ErpWorkEffort
|
2
2
|
class Engine < Rails::Engine
|
3
3
|
isolate_namespace ErpWorkEffort
|
4
|
-
|
4
|
+
|
5
|
+
initializer "erp_work_effort.merge_public" do |app|
|
6
|
+
app.middleware.insert_before Rack::Runtime, ::ActionDispatch::Static, "#{root}/public"
|
7
|
+
end
|
8
|
+
|
5
9
|
ActiveSupport.on_load(:active_record) do
|
6
|
-
include ErpWorkEffort::Extensions::ActiveRecord::
|
7
|
-
include ErpWorkEffort::Extensions::ActiveRecord::
|
8
|
-
include ErpWorkEffort::Extensions::ActiveRecord::ActsAsSupportEffort
|
9
|
-
include ErpWorkEffort::Extensions::ActiveRecord::ActsAsSupportRequirement
|
10
|
+
include ErpWorkEffort::Extensions::ActiveRecord::ActsAsWorkEffort
|
11
|
+
include ErpWorkEffort::Extensions::ActiveRecord::ActsAsRoutable
|
10
12
|
end
|
11
13
|
|
12
14
|
ErpBaseErpSvcs.register_as_compass_ae_engine(config, self)
|
@@ -1,4 +1,2 @@
|
|
1
|
-
require 'erp_work_effort/extensions/active_record/
|
2
|
-
require 'erp_work_effort/extensions/active_record/
|
3
|
-
require 'erp_work_effort/extensions/active_record/acts_as_support_effort'
|
4
|
-
require 'erp_work_effort/extensions/active_record/acts_as_support_requirement'
|
1
|
+
require 'erp_work_effort/extensions/active_record/acts_as_work_effort'
|
2
|
+
require 'erp_work_effort/extensions/active_record/acts_as_routable'
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module ErpWorkEffort
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ActsAsRoutable
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.extend(ClassMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def acts_as_routable
|
12
|
+
extend ActsAsRoutable::SingletonMethods
|
13
|
+
include ActsAsRoutable::InstanceMethods
|
14
|
+
|
15
|
+
# If we knew the models that would be routable, we could use Russell's has_many_polymorphic plugin
|
16
|
+
# to define the relationship between those models and TransportationRoutes. Since acts_as_routable
|
17
|
+
# is used on demand, we have to mimic the behavior of the plugin, but from the opposite direction,
|
18
|
+
# to properly form the bidirectional many-to-many relationship we want.
|
19
|
+
|
20
|
+
inheriting_class_name = self.name
|
21
|
+
|
22
|
+
# Add has_many_through association to the Routes table
|
23
|
+
TransportationRoute.class_exec do
|
24
|
+
has_many inheriting_class_name.tableize.to_sym,
|
25
|
+
:through => :associated_transportation_routes,
|
26
|
+
:source => inheriting_class_name.tableize.singularize.to_sym,
|
27
|
+
:conditions => ["associated_transportation_routes.associated_record_type = ?", inheriting_class_name],
|
28
|
+
:dependent => :destroy
|
29
|
+
|
30
|
+
@associated_models << inheriting_class_name.tableize
|
31
|
+
end
|
32
|
+
|
33
|
+
# Add linking association to the polymorphic join table
|
34
|
+
AssociatedTransportationRoute.class_exec do
|
35
|
+
belongs_to inheriting_class_name.tableize.singularize.to_sym,
|
36
|
+
:class_name => inheriting_class_name,
|
37
|
+
:foreign_key => "associated_record_id"
|
38
|
+
end
|
39
|
+
|
40
|
+
# Add associations back to routes to the class using this mixin
|
41
|
+
has_many :associated_transportation_routes, :as => "associated_record", :dependent => :destroy
|
42
|
+
has_many :routes, :through => :associated_transportation_routes, :source => :transportation_route, :dependent => :destroy
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
module SingletonMethods
|
47
|
+
end
|
48
|
+
|
49
|
+
module InstanceMethods
|
50
|
+
end
|
51
|
+
|
52
|
+
end #ActsAsRoutable
|
53
|
+
end #ActiveRecord
|
54
|
+
end #Extensions
|
55
|
+
end #ErpWorkEffort
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module ErpWorkEffort
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ActsAsWorkEffort
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.extend(ClassMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def acts_as_work_effort
|
12
|
+
extend ActsAsWorkEffort::SingletonMethods
|
13
|
+
include ActsAsWorkEffort::InstanceMethods
|
14
|
+
|
15
|
+
after_initialize :new_work_effort
|
16
|
+
after_update :save_work_effort
|
17
|
+
after_save :save_work_effort
|
18
|
+
after_destroy :destroy_work_effort
|
19
|
+
|
20
|
+
has_one :work_effort, :as => :work_effort_record
|
21
|
+
|
22
|
+
[ :description,
|
23
|
+
:description=,
|
24
|
+
:facility,
|
25
|
+
:facility=,
|
26
|
+
:work_effort_party_assignments,
|
27
|
+
:work_effort_inventory_assignments,
|
28
|
+
:work_effort_fixed_asset_assignments,
|
29
|
+
:projected_cost,
|
30
|
+
:projected_cost=,
|
31
|
+
:projected_completion_time,
|
32
|
+
:projected_completion_time=,
|
33
|
+
:actual_cost,
|
34
|
+
:start,
|
35
|
+
:started?,
|
36
|
+
:completed?
|
37
|
+
].each do |m|
|
38
|
+
delegate m, :to => :work_effort
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
module SingletonMethods
|
44
|
+
end
|
45
|
+
|
46
|
+
module InstanceMethods
|
47
|
+
def save_work_effort
|
48
|
+
self.work_effort.save
|
49
|
+
end
|
50
|
+
|
51
|
+
def destroy_work_effort
|
52
|
+
self.work_effort.destroy
|
53
|
+
end
|
54
|
+
|
55
|
+
def new_work_effort
|
56
|
+
if self.new_record? and self.work_effort.nil?
|
57
|
+
work_effort = WorkEffort.new
|
58
|
+
self.work_effort = work_effort
|
59
|
+
work_effort.work_effort_record = self
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|