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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d805f7cd2610f4eb8ebfbe333ee7a1c2f1bbb7c
4
- data.tar.gz: 41e60e242c01ba995bef8ad7a807fadc33942070
3
+ metadata.gz: d565b36e473e2a0408b05d69a052857da5e905c0
4
+ data.tar.gz: 217bd08339369598c7a2a7b654e77fbfedd45630
5
5
  SHA512:
6
- metadata.gz: 6766bab4a1f3640263fd06224dec835c83cd1bcc4f6921af22d11f35e03548d306087e94031fad46d5f8fcb144cbb68fd8838768e2a19bb502bd2c2505f7847b
7
- data.tar.gz: 114688fb921a19ff062e15f4d0a3db0a0f762cd66ada32df401919d3202ec76f4810bf2b5e01f3476f84bf6d023bd1be9e45fa4f9632c33c6ab0ea42def391b7
6
+ metadata.gz: ce7dbd7737c28fae30bed18cf0f5679fc253f480ab642891fbbcbe37ff63786f3682815b83abb1c8de3ef6a3e67505dded58527c4116746f0901f2e020dc4e98
7
+ data.tar.gz: 14094a0c2cc9e0fcae54378f1396a9cd8ac912692e542cde56c5c271324cddbf4e673434a5118b41a45fd54601994e8863c76001cc95ca3070984678fd886068
@@ -19,7 +19,8 @@ module Toolhound
19
19
  dataserver: @dataserver,
20
20
  port: @port,
21
21
  username: @username,
22
- password: @password
22
+ password: @password,
23
+ timeout: 10
23
24
  )
24
25
  end
25
26
 
@@ -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
- end
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 return_periods_for_entity(entity_id)
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
 
@@ -1,3 +1,3 @@
1
1
  module Toolhound
2
- VERSION = "1.0.14"
2
+ VERSION = "1.0.15"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toolhound-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.14
4
+ version: 1.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Klooth