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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3871baf3450e7366757ebaa26bbf157b8bed3d9445f8cedd32a384be3c085a75
4
- data.tar.gz: bade4250d1176e8ebc8bc99136dafcbab78761b8d2d8dab93d004f3eabbc49d4
3
+ metadata.gz: 03b358ca3dc8a8908dc00309ca843ab82e9703f9224c5d726cf1762034bf76ed
4
+ data.tar.gz: 3e0da8d5c95a1bd32c90f76d78bd17bd3b70e2c5466916945b96d6292c3ae3f7
5
5
  SHA512:
6
- metadata.gz: 87458b788af5a370a0fdc04ef9214ae4b2abefdb5c4a94e472bbccc71281c9d464a00fa5f6046a722946aaf9a30cbacbe5fe370ac3a236e88ae6705fe7a3fc89
7
- data.tar.gz: 3e618ea3300eb3b742668ccd3e694672545d9bef499a4bd46b4221505cc6fb396c0bee19dda5d0f65788fc50e70803cb167337f828013e55331b946fcea6b185
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 :order_date, presence: true
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(:contract_no, to: :transport_contract, prefix: false)
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
@@ -0,0 +1,6 @@
1
+ class AddStatusToTransportOrder < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_column :cats_core_transport_orders, :order_status, :string, null: false, default: "Active"
4
+ add_column :cats_core_transport_orders, :order_no, :string, null: false
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddStatusToContract < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_column :cats_core_transport_contracts, :status, :string, null: false, default: "Active"
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = "1.5.29".freeze
3
+ VERSION = "1.5.30".freeze
4
4
  end
5
5
  end
@@ -6,5 +6,6 @@ FactoryBot.define do
6
6
  contract_date { Date.today }
7
7
  expires_on { Date.today + 6.month }
8
8
  payment_term { FFaker::Name.name }
9
+ status { Cats::Core::TransportContract::ACTIVE }
9
10
  end
10
11
  end
@@ -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
@@ -5,5 +5,7 @@ FactoryBot.define do
5
5
  approved_by factory: :user
6
6
  order_date { Date.today }
7
7
  status { Cats::Core::TransportOrder::DRAFT }
8
+ order_status { Cats::Core::TransportOrder::ACTIVE }
9
+ order_no { "2/2024/TNA/REQ-001" }
8
10
  end
9
11
  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.29
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-03 00:00:00.000000000 Z
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