toolhound-ruby 1.0.14 → 1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/toolhound-ruby/authentication.rb +2 -1
- data/lib/toolhound-ruby/base.rb +10 -1
- data/lib/toolhound-ruby/client.rb +2 -1
- data/lib/toolhound-ruby/transaction.rb +13 -3
- data/lib/toolhound-ruby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d565b36e473e2a0408b05d69a052857da5e905c0
|
4
|
+
data.tar.gz: 217bd08339369598c7a2a7b654e77fbfedd45630
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce7dbd7737c28fae30bed18cf0f5679fc253f480ab642891fbbcbe37ff63786f3682815b83abb1c8de3ef6a3e67505dded58527c4116746f0901f2e020dc4e98
|
7
|
+
data.tar.gz: 14094a0c2cc9e0fcae54378f1396a9cd8ac912692e542cde56c5c271324cddbf4e673434a5118b41a45fd54601994e8863c76001cc95ca3070984678fd886068
|
data/lib/toolhound-ruby/base.rb
CHANGED
@@ -298,6 +298,8 @@ module Toolhound
|
|
298
298
|
data << transform_attributes(row)
|
299
299
|
end
|
300
300
|
data
|
301
|
+
ensure
|
302
|
+
finish_statement_handle(results)
|
301
303
|
end
|
302
304
|
|
303
305
|
def build_and_query(options, query_options = {})
|
@@ -385,6 +387,13 @@ module Toolhound
|
|
385
387
|
|
386
388
|
end
|
387
389
|
|
388
|
-
|
390
|
+
protected
|
391
|
+
def finish_statement_handle(handle)
|
392
|
+
handle.cancel if handle
|
393
|
+
|
394
|
+
handle
|
395
|
+
end
|
396
|
+
|
397
|
+
end # Base
|
389
398
|
|
390
399
|
end
|
@@ -75,6 +75,7 @@ module Toolhound
|
|
75
75
|
|
76
76
|
def connection
|
77
77
|
if @connection && @connection.dead?
|
78
|
+
@connection.cancel
|
78
79
|
sign_in
|
79
80
|
end
|
80
81
|
@connection
|
@@ -108,7 +109,7 @@ module Toolhound
|
|
108
109
|
def transaction
|
109
110
|
@transaction ||= Toolhound::Transaction.new(self)
|
110
111
|
end
|
111
|
-
|
112
|
+
|
112
113
|
def inventory
|
113
114
|
@inventory ||= Toolhound::Inventory.new(self)
|
114
115
|
end
|
@@ -53,7 +53,14 @@ module Toolhound
|
|
53
53
|
end
|
54
54
|
|
55
55
|
|
56
|
-
def
|
56
|
+
def return_periods(options = {})
|
57
|
+
entity_id = options.delete :entity_id
|
58
|
+
damaged_only = options.delete :damaged_only
|
59
|
+
|
60
|
+
wheres = []
|
61
|
+
|
62
|
+
wheres << {'transaction.int_entity_id' => entity_id} if entity_id
|
63
|
+
|
57
64
|
selects = {
|
58
65
|
transaction: [
|
59
66
|
{dte_transaction_date: {as: :min_date, agg: :min} },
|
@@ -66,9 +73,12 @@ module Toolhound
|
|
66
73
|
tblTransactionType.intTransactionTypeID = tblTransactionDetail.intTransactionTypeID
|
67
74
|
AND tblTransactionType.bolReturn = 'true'
|
68
75
|
"
|
76
|
+
if damaged_only
|
77
|
+
joins << "INNER JOIN tblReturnStatus ON tblReturnStatus.intReturnStatusID = tblTransactionDetail.intReturnStatusID"
|
78
|
+
wheres << "(tblReturnStatus.bolCreateWO = 1 OR tblReturnStatus.bolRetire = 1)"
|
79
|
+
end
|
69
80
|
|
70
|
-
|
71
|
-
build_and_query(joins: joins, selects: selects, where: [{'transaction.int_entity_id' => entity_id}], from: 'tblTransactionDetail').first
|
81
|
+
build_and_query(joins: joins, selects: selects, where: wheres, from: 'tblTransactionDetail').first
|
72
82
|
|
73
83
|
end
|
74
84
|
|