cats_core 1.4.7 → 1.4.8
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_requisition.rb +12 -0
- data/lib/cats/core/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 626e9d30bfefd23124b2110a3b10c4a6dcf58ac6aeb660b50803843ececd2517
|
4
|
+
data.tar.gz: e59fa35f07c89486a5840e613389dd75ed6613077cb0ae3648295134dbff7ffe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 440d92d2388b2816b1c76b0040d4c6d2a2fe0588b94e4ba134be56058cb74344ad55510e074a9d87ee04b1bf5336a705dd98bc7de5facc7250f3638f17e9ddfd
|
7
|
+
data.tar.gz: f3adb1d2cc5edd7cf7baf0eeb4b9624602f0987bea3cb5d1b7700af7b894ac43143fc2c0108daed5622e55e5581fc789ae97bd073a2246fdd02836bcb060784a
|
@@ -24,6 +24,18 @@ module Cats
|
|
24
24
|
quantities = transport_requisition_items.map { |item| UnitConversion.convert(item.unit, unit, item.quantity) }
|
25
25
|
quantities.sum
|
26
26
|
end
|
27
|
+
|
28
|
+
def approve
|
29
|
+
raise(StandardError, 'Transport requisition is already approved.') if status == APPROVED
|
30
|
+
|
31
|
+
if transport_requisition_items.count.zero?
|
32
|
+
raise(StandardError, 'Transport requisition has no requisition items.')
|
33
|
+
end
|
34
|
+
|
35
|
+
self.status = APPROVED
|
36
|
+
save!
|
37
|
+
self
|
38
|
+
end
|
27
39
|
end
|
28
40
|
end
|
29
41
|
end
|
data/lib/cats/core/version.rb
CHANGED