cats_core 1.5.29 → 1.5.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/cats/core/transport_contract.rb +5 -0
- data/app/models/cats/core/transport_order.rb +6 -1
- data/app/models/cats/core/transport_order_item.rb +11 -2
- data/db/migrate/20240125051557_add_status_unit_and_quantity_to_transport_order_item.rb +18 -0
- data/db/migrate/20240125051632_add_status_to_transport_order.rb +6 -0
- data/db/migrate/20240125051644_add_status_to_contract.rb +5 -0
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/transport_contracts.rb +1 -0
- data/spec/factories/cats/core/transport_order_items.rb +4 -0
- data/spec/factories/cats/core/transport_orders.rb +2 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03b358ca3dc8a8908dc00309ca843ab82e9703f9224c5d726cf1762034bf76ed
|
4
|
+
data.tar.gz: 3e0da8d5c95a1bd32c90f76d78bd17bd3b70e2c5466916945b96d6292c3ae3f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb22c2473633590d0c8f760b2a8dd178d19646e6ff9193b79f7536c0bbe9e3f2c16e3a860b9de66938d13279a1bcd0a3855b9593ff48ac5662ce10c9bc071c6c
|
7
|
+
data.tar.gz: 73fe0f22b150696c145d28eb4343145f033643ec7259f6865f6b725e2c052880e1905c28b78ea860858da58bb5d0753b96a16fa358e9a7cd2319b3376de27f4f
|
@@ -1,12 +1,17 @@
|
|
1
1
|
module Cats
|
2
2
|
module Core
|
3
3
|
class TransportContract < ApplicationRecord
|
4
|
+
ACTIVE = "Active".freeze
|
5
|
+
CANCELLED = "Cancelled".freeze
|
6
|
+
CONTRACT_STATUSES = [ACTIVE, CANCELLED].freeze
|
7
|
+
|
4
8
|
belongs_to :transporter
|
5
9
|
belongs_to :transport_bid
|
6
10
|
has_many :contract_items
|
7
11
|
|
8
12
|
validates :contract_no, presence: true, uniqueness: true
|
9
13
|
validates :contract_date, :expires_on, presence: true
|
14
|
+
validates :status, presence: true, inclusion: {in: CONTRACT_STATUSES}
|
10
15
|
|
11
16
|
delegate(:name, to: :transporter, prefix: true)
|
12
17
|
delegate(:reference_no, to: :transport_bid, prefix: :bid)
|
@@ -5,6 +5,10 @@ module Cats
|
|
5
5
|
APPROVED = "Approved".freeze
|
6
6
|
STATUSES = [DRAFT, APPROVED].freeze
|
7
7
|
|
8
|
+
ACTIVE = "Active".freeze
|
9
|
+
CANCELLED = "Cancelled".freeze
|
10
|
+
ORDER_STATUSES = [ACTIVE, CANCELLED].freeze
|
11
|
+
|
8
12
|
belongs_to :transport_requisition
|
9
13
|
belongs_to :prepared_by, class_name: "Cats::Core::User"
|
10
14
|
belongs_to :approved_by, class_name: "Cats::Core::User", optional: true
|
@@ -12,7 +16,8 @@ module Cats
|
|
12
16
|
has_many :transport_order_items
|
13
17
|
|
14
18
|
validates :status, presence: true, inclusion: {in: STATUSES}
|
15
|
-
validates :
|
19
|
+
validates :order_status, presence: true, inclusion: {in: ORDER_STATUSES}
|
20
|
+
validates :order_date, :order_no, presence: true
|
16
21
|
validate :validate_against_requisition, :validate_status
|
17
22
|
|
18
23
|
delegate(:full_name, to: :prepared_by, prefix: true)
|
@@ -1,18 +1,27 @@
|
|
1
1
|
module Cats
|
2
2
|
module Core
|
3
3
|
class TransportOrderItem < ApplicationRecord
|
4
|
+
ACTIVE = "Active".freeze
|
5
|
+
CANCELLED = "Cancelled".freeze
|
6
|
+
|
7
|
+
ORDER_ITEM_STATUSES = [ACTIVE, CANCELLED].freeze
|
4
8
|
belongs_to :transport_order
|
5
9
|
belongs_to :transporter
|
6
10
|
belongs_to :transport_requisition_item
|
7
11
|
belongs_to :transport_contract, optional: true
|
12
|
+
belongs_to :unit, class_name: "Cats::Core::UnitOfMeasure"
|
13
|
+
belongs_to :route
|
8
14
|
|
9
|
-
validates :valid_for, presence: true
|
15
|
+
validates :valid_for, :quantity, presence: true
|
10
16
|
validates :valid_for, numericality: {greater_than: 0}
|
17
|
+
validates :status, presence: true, inclusion: {in: ORDER_ITEM_STATUSES}
|
11
18
|
validates :transport_requisition_item_id, uniqueness: true
|
12
19
|
validate :validate_requisition
|
13
20
|
|
14
21
|
delegate(:name, to: :transporter, prefix: true)
|
15
|
-
delegate(:
|
22
|
+
delegate(:name, to: :route, prefix: true)
|
23
|
+
delegate(:abbreviation, to: :unit, prefix: true)
|
24
|
+
delegate(:contract_no, to: :transport_contract, prefix: false, allow_nil: true)
|
16
25
|
|
17
26
|
def validate_requisition
|
18
27
|
return unless transport_requisition_item
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class AddStatusUnitAndQuantityToTransportOrderItem < ActiveRecord::Migration[7.0]
|
2
|
+
def change
|
3
|
+
add_column :cats_core_transport_order_items, :unit_id, :integer
|
4
|
+
add_foreign_key :cats_core_transport_order_items,
|
5
|
+
:cats_core_unit_of_measures,
|
6
|
+
column: :unit_id, null: false,
|
7
|
+
index: {name: "unit_on_toi_indx"}
|
8
|
+
add_column :cats_core_transport_order_items, :route_id, :integer
|
9
|
+
add_foreign_key :cats_core_transport_order_items,
|
10
|
+
:cats_core_routes,
|
11
|
+
column: :route_id, null: false,
|
12
|
+
index: {name: "route_on_toi_indx"}
|
13
|
+
add_column :cats_core_transport_order_items, :quantity, :float, null: false
|
14
|
+
add_column :cats_core_transport_order_items, :status, :string, null: false
|
15
|
+
remove_index :cats_core_transport_order_items, :transport_requisition_item_id,
|
16
|
+
name: "tri_on_toi_uniq_indx"
|
17
|
+
end
|
18
|
+
end
|
data/lib/cats/core/version.rb
CHANGED
@@ -5,5 +5,9 @@ FactoryBot.define do
|
|
5
5
|
transport_contract
|
6
6
|
transport_requisition_item { transport_order.transport_requisition.transport_requisition_items.first }
|
7
7
|
valid_for { 10 }
|
8
|
+
quantity { 12 }
|
9
|
+
status { Cats::Core::TransportOrderItem::ACTIVE }
|
10
|
+
unit factory: :unit_of_measure
|
11
|
+
route
|
8
12
|
end
|
9
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cats_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01
|
11
|
+
date: 2024-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -532,6 +532,9 @@ files:
|
|
532
532
|
- db/migrate/20230102064317_add_receipt_number_to_cats_core_receipt_transactions.rb
|
533
533
|
- db/migrate/20231129071520_create_cats_core_inventory_adjustments.rb
|
534
534
|
- db/migrate/20231227114358_add_beneficiaries_to_cats_core_dispatch_plan_items.rb
|
535
|
+
- db/migrate/20240125051557_add_status_unit_and_quantity_to_transport_order_item.rb
|
536
|
+
- db/migrate/20240125051632_add_status_to_transport_order.rb
|
537
|
+
- db/migrate/20240125051644_add_status_to_contract.rb
|
535
538
|
- lib/cats/core.rb
|
536
539
|
- lib/cats/core/engine.rb
|
537
540
|
- lib/cats/core/version.rb
|