netsuite 0.8.8 → 0.8.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/dependabot.yml +14 -0
  4. data/.github/workflows/codeql-analysis.yml +70 -0
  5. data/.github/workflows/main.yml +7 -4
  6. data/Gemfile +5 -3
  7. data/HISTORY.md +42 -5
  8. data/README.md +18 -20
  9. data/lib/netsuite/actions/add.rb +5 -1
  10. data/lib/netsuite/actions/attach_file.rb +87 -0
  11. data/lib/netsuite/actions/search.rb +19 -6
  12. data/lib/netsuite/records/account.rb +0 -1
  13. data/lib/netsuite/records/accounting_period.rb +1 -1
  14. data/lib/netsuite/records/assembly_component.rb +0 -2
  15. data/lib/netsuite/records/assembly_item.rb +0 -1
  16. data/lib/netsuite/records/assembly_unbuild.rb +1 -4
  17. data/lib/netsuite/records/cash_refund.rb +0 -1
  18. data/lib/netsuite/records/cash_sale.rb +1 -2
  19. data/lib/netsuite/records/contact.rb +0 -1
  20. data/lib/netsuite/records/credit_memo.rb +0 -1
  21. data/lib/netsuite/records/currency_rate.rb +1 -2
  22. data/lib/netsuite/records/custom_record.rb +1 -1
  23. data/lib/netsuite/records/customer.rb +0 -1
  24. data/lib/netsuite/records/customer_deposit.rb +0 -1
  25. data/lib/netsuite/records/customer_payment.rb +0 -1
  26. data/lib/netsuite/records/customer_refund.rb +0 -1
  27. data/lib/netsuite/records/deposit.rb +0 -1
  28. data/lib/netsuite/records/deposit_application.rb +0 -1
  29. data/lib/netsuite/records/description_item.rb +1 -1
  30. data/lib/netsuite/records/estimate.rb +95 -15
  31. data/lib/netsuite/records/inbound_shipment.rb +0 -1
  32. data/lib/netsuite/records/inventory_item.rb +239 -40
  33. data/lib/netsuite/records/inventory_number.rb +1 -2
  34. data/lib/netsuite/records/inventory_transfer.rb +1 -0
  35. data/lib/netsuite/records/invoice.rb +7 -8
  36. data/lib/netsuite/records/invoice_item.rb +1 -1
  37. data/lib/netsuite/records/item_fulfillment.rb +0 -1
  38. data/lib/netsuite/records/item_fulfillment_item.rb +1 -1
  39. data/lib/netsuite/records/item_group.rb +1 -1
  40. data/lib/netsuite/records/item_option_custom_field.rb +52 -0
  41. data/lib/netsuite/records/item_receipt.rb +0 -1
  42. data/lib/netsuite/records/item_receipt_item.rb +3 -2
  43. data/lib/netsuite/records/item_vendor.rb +10 -1
  44. data/lib/netsuite/records/job.rb +0 -1
  45. data/lib/netsuite/records/kit_item.rb +1 -1
  46. data/lib/netsuite/records/location.rb +0 -1
  47. data/lib/netsuite/records/lot_numbered_inventory_item.rb +225 -81
  48. data/lib/netsuite/records/matrix_option_list.rb +16 -0
  49. data/lib/netsuite/records/member_list.rb +0 -2
  50. data/lib/netsuite/records/non_inventory_purchase_item.rb +1 -1
  51. data/lib/netsuite/records/non_inventory_resale_item.rb +156 -20
  52. data/lib/netsuite/records/non_inventory_sale_item.rb +133 -21
  53. data/lib/netsuite/records/opportunity.rb +2 -3
  54. data/lib/netsuite/records/other_charge_sale_item.rb +1 -1
  55. data/lib/netsuite/records/payment_item.rb +1 -1
  56. data/lib/netsuite/records/payroll_item.rb +0 -1
  57. data/lib/netsuite/records/phone_call.rb +1 -1
  58. data/lib/netsuite/records/purchase_order.rb +0 -1
  59. data/lib/netsuite/records/return_authorization.rb +1 -0
  60. data/lib/netsuite/records/sales_order.rb +1 -2
  61. data/lib/netsuite/records/serialized_assembly_item.rb +0 -1
  62. data/lib/netsuite/records/serialized_inventory_item.rb +1 -1
  63. data/lib/netsuite/records/serialized_inventory_item_location.rb +0 -1
  64. data/lib/netsuite/records/service_resale_item.rb +123 -19
  65. data/lib/netsuite/records/service_sale_item.rb +1 -2
  66. data/lib/netsuite/records/subsidiary.rb +0 -1
  67. data/lib/netsuite/records/subtotal_item.rb +1 -1
  68. data/lib/netsuite/records/transfer_order.rb +0 -1
  69. data/lib/netsuite/records/transfer_order_item.rb +1 -1
  70. data/lib/netsuite/records/translation.rb +17 -0
  71. data/lib/netsuite/records/translation_list.rb +11 -0
  72. data/lib/netsuite/records/vendor.rb +4 -5
  73. data/lib/netsuite/records/vendor_bill.rb +0 -1
  74. data/lib/netsuite/records/work_order.rb +0 -1
  75. data/lib/netsuite/records/work_order_item.rb +0 -1
  76. data/lib/netsuite/support/actions.rb +2 -0
  77. data/lib/netsuite/support/fields.rb +3 -0
  78. data/lib/netsuite/support/records.rb +9 -1
  79. data/lib/netsuite/utilities.rb +5 -0
  80. data/lib/netsuite/version.rb +1 -1
  81. data/lib/netsuite.rb +4 -0
  82. data/netsuite.gemspec +4 -3
  83. data/spec/netsuite/actions/add_spec.rb +36 -0
  84. data/spec/netsuite/actions/attach_file_spec.rb +59 -0
  85. data/spec/netsuite/actions/search_spec.rb +205 -0
  86. data/spec/netsuite/records/estimate_spec.rb +103 -13
  87. data/spec/netsuite/records/inventory_item_spec.rb +242 -25
  88. data/spec/netsuite/records/invoice_spec.rb +30 -1
  89. data/spec/netsuite/records/item_option_custom_field_spec.rb +27 -0
  90. data/spec/netsuite/records/item_vendor_list_spec.rb +2 -5
  91. data/spec/netsuite/records/item_vendor_spec.rb +14 -2
  92. data/spec/netsuite/records/lot_numbered_inventory_item_spec.rb +247 -0
  93. data/spec/netsuite/records/matrix_option_list_spec.rb +26 -0
  94. data/spec/netsuite/records/non_inventory_resale_item_spec.rb +159 -24
  95. data/spec/netsuite/records/non_inventory_sale_item_spec.rb +135 -22
  96. data/spec/netsuite/records/return_authorization_spec.rb +62 -0
  97. data/spec/netsuite/records/sales_order_spec.rb +29 -0
  98. data/spec/netsuite/records/service_resale_item_spec.rb +122 -17
  99. data/spec/netsuite/records/translation_list_spec.rb +34 -0
  100. data/spec/netsuite/records/translation_spec.rb +28 -0
  101. data/spec/netsuite/support/fields_spec.rb +48 -1
  102. data/spec/netsuite/support/search_result_spec.rb +12 -0
  103. data/spec/netsuite/utilities_spec.rb +10 -2
  104. data/spec/support/field_matcher.rb +8 -6
  105. data/spec/support/fixtures/add/add_file.xml +20 -0
  106. data/spec/support/fixtures/attach/attach_file_to_sales_order.xml +16 -0
  107. data/spec/support/fixtures/attach/attach_file_to_sales_order_error.xml +20 -0
  108. data/spec/support/fixtures/search/basic_search_contact.xml +39 -0
  109. data/spec/support/fixtures/search/single_search_result.xml +46 -0
  110. metadata +39 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: acf21d9a2b7a9ee0eedee971c7ebd1af50c05c28a1a5a03dea740fc1eb22529c
4
- data.tar.gz: 6b740ed5e9b8d76926d63ca2895d0370b11b0c0656bd2581f15b9133f7d7edec
3
+ metadata.gz: 6137faebee57aa9e3bdaa9cca35d82765f5e9943075eb09bc8bd867b1893ad6b
4
+ data.tar.gz: 8ee0308ee67c2dcd440ea17a1107220e394b5b1e15829f76b47ca2769d4be9f2
5
5
  SHA512:
6
- metadata.gz: 2a7d9f98b1574b63a6da20d65376e1edb936f8d16d44019871b8d7e2e7f1354956eac101d038f756bc8a2256977c6afbd0742c7f7badbd6ec89a8165fdde77f8
7
- data.tar.gz: 6a268c38ec15d63e50f5c713363b7cf9f8b5faf67b1a4f40c4cdadc8728a27b1d2928d36debab70db278b26d36661d5e908ba04a3235464f0b23487ac1c6b91c
6
+ metadata.gz: a297cc64a543bdf34c086432c78a36b038205998794ae67a968c3c9bdd506a99bfd7a1048bb8aec821fd2edd1c2d89ce715719f035e1a09e5f4b38b560df98b6
7
+ data.tar.gz: a536956ed7da89d0fa0e7ec2dcaeba3539ec5dcbddbb3c9249a3b17b93caadaa13b9cba9b7cbe6f0a9b9de786541e4bc190e2771bef03c6cec71d1881c79f7e9
@@ -0,0 +1 @@
1
+ github: [NetSweet]
@@ -0,0 +1,14 @@
1
+ version: 2
2
+ updates:
3
+
4
+ # Maintain dependencies for GitHub Actions
5
+ - package-ecosystem: "github-actions"
6
+ directory: "/"
7
+ schedule:
8
+ interval: "daily"
9
+
10
+ # Maintain dependencies for rubygems
11
+ - package-ecosystem: "bundler"
12
+ directory: "/"
13
+ schedule:
14
+ interval: "daily"
@@ -0,0 +1,70 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ master ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ master ]
20
+ schedule:
21
+ - cron: '32 15 * * 6'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://git.io/codeql-language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v2
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v1
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
52
+
53
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54
+ # If this step fails, then you should remove it and run the build manually (see below)
55
+ - name: Autobuild
56
+ uses: github/codeql-action/autobuild@v1
57
+
58
+ # ℹ️ Command-line programs to run using the OS shell.
59
+ # 📚 https://git.io/JvXDl
60
+
61
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62
+ # and modify them (or add more) to build your code if your project
63
+ # uses a compiled language
64
+
65
+ #- run: |
66
+ # make bootstrap
67
+ # make release
68
+
69
+ - name: Perform CodeQL Analysis
70
+ uses: github/codeql-action/analyze@v1
@@ -1,15 +1,18 @@
1
1
  name: Ruby
2
2
 
3
- on: [push,pull_request]
3
+ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  build:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  matrix:
10
- ruby-version: [2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1]
10
+ ruby-version: [3.1, 3.0, 2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1]
11
+ bundle-tzinfo: [true, false]
12
+ env:
13
+ BUNDLE_TZINFO: "${{ matrix.bundle-tzinfo }}"
11
14
  steps:
12
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v3
13
16
  - name: Set up Ruby ${{ matrix.ruby-version }}
14
17
  uses: ruby/setup-ruby@v1
15
18
  with:
@@ -17,4 +20,4 @@ jobs:
17
20
  - name: Install dependencies
18
21
  run: bundle install
19
22
  - name: Run tests
20
- run: bundle exec rake
23
+ run: bundle exec rake
data/Gemfile CHANGED
@@ -6,6 +6,8 @@ gem 'simplecov', :require => false
6
6
  gem 'pry-nav'
7
7
  gem 'pry-rescue'
8
8
 
9
- # optional dependency for more accurate timezone conversion
10
- gem 'tzinfo', '1.2.5'
11
- # gem 'tzinfo', '2.0.0'
9
+
10
+ if ENV.fetch('BUNDLE_TZINFO', 'false') == 'true'
11
+ # optional dependency for more accurate timezone conversion
12
+ gem 'tzinfo', '>= 1.2.5'
13
+ end
data/HISTORY.md CHANGED
@@ -2,13 +2,50 @@
2
2
 
3
3
  ### Added
4
4
 
5
- *
6
- *
5
+ ### Fixed
6
+
7
+ ## 0.8.11
8
+
9
+ ### Added
10
+
11
+ * Update ServiceResaleItem record fields/record refs for 2021.2. `item_options_list`, `presentation_item_list`, `site_category_list`, `translations_list` were all removed as fields as the are not simple fields, they require special classes. (#500)
12
+ * Dependabot to CI
13
+ * CI run for Ruby 3.0 & 3.1
14
+ * Add CI run for an environment with and without `tzinfo` installed
15
+ * Update NonInventorySaleItem record fields/record refs for 2021.2. `item_options_list`, `presentation_item_list`, `product_feed_list`, `site_category_list`, `translations_list` were all removed as fields as the are not simple fields, they require special classes. (#503)
16
+ * Implement MatrixOptionList#to_record (#504)
17
+ * Update ItemVendor record fields/record refs for 2021.1. `vendor` is now a record_ref instead of a field. (#505)
18
+ * Update InventoryItem record fields/record refs for 2021.2. `member_list` was removed as a field as it doesn't belong to InventoryItem. (#506)
19
+ * Update LotNumberedInventoryItem record fields/record refs for 2021.2. (#507)
20
+ * Update NonInventoryResaleItem record fields/record refs for 2021.2. `item_options_list`, `presentation_item_list`, `product_feed_list`, `site_category_list`, `translations_list` were all removed as fields as the are not simple fields, they require special classes. (#508)
21
+ * Add `attach_file` action for Invoice and SalesOrder. (#509)
22
+ * Add ItemOptionCustomField recrd (#512)
23
+ * Add Ship Address to Return Authorization (#525)
24
+ * Support translations records (#516)
25
+
26
+ ### Fixed
27
+
28
+ * Fix "undefined method `[]` for #<Nori::StringIOFile>" when adding File (#495)
29
+ * Moved definition of `search_joins` attribute from records to search action. The attribute was removed for AssemblyComponent, SerializedInventoryItemLocation, and WorkOrderItem as they don't offer the search action. (#511)
30
+ * Consider externalId in search criteria when using RecordRef as value (#517)
31
+ * Retry http client error subclasses
32
+ * Add upsert list action for cash sales (#523)
33
+
34
+ ## 0.8.10
35
+
36
+ ### Added
37
+
38
+ * Update Estimate record fields/record refs for 2021.2. `balance`, `bill_address`, `bill_is_residential`, and `is_multi_ship_to` were all removed as fields as either being incorrect, outdated, or a search-only field. (#496)
39
+
40
+ ### Fixed
41
+
42
+ * Savon 2.12 supported
43
+
44
+ ## 0.8.9
7
45
 
8
46
  ### Fixed
9
47
 
10
- *
11
- *
48
+ * Fixed issue where search only fields could be specified when an existing field exists. https://github.com/NetSweet/netsuite/pull/488
12
49
 
13
50
  ## 0.8.8
14
51
 
@@ -23,4 +60,4 @@
23
60
  * Fix accessing custom field values returned in advanced search results (#480)
24
61
  * Fixing bug where single-selection custom multi select fields would incorrectly be parsed 3377c971d0cb727d81f4b4bc6e30edfbdfaccfd1
25
62
  * Fixed some field definitions on serialized assembly item
26
- * Properly extract external_id from advanced search results (#478)
63
+ * Properly extract external_id from advanced search results (#478)
data/README.md CHANGED
@@ -1,21 +1,3 @@
1
- <!-- START doctoc generated TOC please keep comment here to allow auto update -->
2
- <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3
- **Table of Contents**
4
-
5
- - [NetSuite SuiteTalk API Ruby Gem](#netsuite-suitetalk-api-ruby-gem)
6
- - [Help & Support](#help--support)
7
- - [Testing](#testing)
8
- - [Installation](#installation)
9
- - [Configuration](#configuration)
10
- - [Token based Authentication](#token-based-authentication)
11
- - [Usage](#usage)
12
- - [CRUD Operations](#crud-operations)
13
- - [Custom Records & Fields](#custom-records--fields)
14
- - [Searching](#searching)
15
- - [Non-standard Operations](#non-standard-operations)
16
-
17
- <!-- END doctoc generated TOC please keep comment here to allow auto update -->
18
-
19
1
  [![Ruby](https://github.com/NetSweet/netsuite/actions/workflows/main.yml/badge.svg)](https://github.com/NetSweet/netsuite/actions/workflows/main.yml)
20
2
  [![Slack Status](https://opensuite-slackin.herokuapp.com/badge.svg)](http://opensuite-slackin.herokuapp.com)
21
3
  [![Gem Version](https://badge.fury.io/rb/netsuite.svg)](http://badge.fury.io/rb/netsuite)
@@ -215,7 +197,7 @@ task.update(message: 'New Message')
215
197
  task.delete
216
198
 
217
199
  # refresh/reload a record (helpful after adding the record for the first time)
218
- task.reload
200
+ task.refresh
219
201
 
220
202
  # using get_select_value with a standard record
221
203
  NetSuite::Records::BaseRefList.get_select_value(
@@ -238,6 +220,19 @@ options = NetSuite::Records::BaseRefList.get_select_value(
238
220
  options.base_refs.map(&:name)
239
221
  ```
240
222
 
223
+ ## Uploading/Attaching Files
224
+
225
+ ```ruby
226
+ file = NetSuite::Records::File.new(
227
+ content: Base64.encode64(File.read('/path/to/file')),
228
+ name: 'Invoice.pdf',
229
+ )
230
+ file.add
231
+
232
+ invoice = NetSuite::Records::Invoice.get(internal_id: 1)
233
+ invoice.attach_file(NetSuite::Records::RecordRef.new(internal_id: file.internal_id))
234
+ ```
235
+
241
236
  ## Custom Records & Fields
242
237
 
243
238
  ```ruby
@@ -421,7 +416,10 @@ NetSuite::Records::SalesOrder.search({
421
416
  'tranSales:basic' => [
422
417
  'platformCommon:internalId/' => {},
423
418
  'platformCommon:email/' => {},
424
- 'platformCommon:tranDate/' => {}
419
+ 'platformCommon:tranDate/' => {},
420
+ # If you include columns that are only part of the *SearchRowBasic (ie. TransactionSearchRowBasic),
421
+ # they'll be readable on the resulting record just like regular fields (my_record.close_date).
422
+ 'platformCommon:closeDate/' => {}
425
423
  ],
426
424
  'tranSales:accountJoin' => [
427
425
  'platformCommon:internalId/' => {}
@@ -49,7 +49,11 @@ module NetSuite
49
49
  end
50
50
 
51
51
  def response_body
52
- @response_body ||= response_hash[:base_ref]
52
+ @response_body ||= if response_hash[:base_ref].is_a?(Nori::StringIOFile)
53
+ { :@internal_id => Nokogiri::XML(@response.to_s).remove_namespaces!.at_xpath('//baseRef')[:internalId] }
54
+ else
55
+ response_hash[:base_ref]
56
+ end
53
57
  end
54
58
 
55
59
  def response_errors
@@ -0,0 +1,87 @@
1
+ module NetSuite
2
+ module Actions
3
+ class AttachFile
4
+ include Support::Requests
5
+
6
+ def initialize(object, file)
7
+ @object = object
8
+ @file = file
9
+ end
10
+
11
+ private
12
+
13
+ def request(credentials = {})
14
+ NetSuite::Configuration.connection({}, credentials).call(:attach, :message => request_body)
15
+ end
16
+
17
+ # <soap:Body>
18
+ # <platformMsgs:attach>
19
+ # <platformCore:attachReference xsi:type="platformCore:AttachContactReference">
20
+ # <platformCore::attachTo internalId="176" type="customer" xsi:type="platformCore::RecordRef">
21
+ # </platformCore:attachTo>
22
+ # <platformCore:attachRecord internalId="1467" type="file" xsi:type="platformCore:RecordRef"/>
23
+ # </platformCore:attachReference>
24
+ # </platformMsgs:attach>
25
+ # </soap:Body>
26
+
27
+ def request_body
28
+ {
29
+ 'platformCore:attachReference' => {
30
+ '@xsi:type' => 'platformCore:AttachBasicReference',
31
+ 'platformCore:attachTo' => {
32
+ '@internalId' => @object.internal_id,
33
+ '@type' => @object.netsuite_type,
34
+ '@xsi:type' => 'platformCore:RecordRef'
35
+ },
36
+ 'platformCore:attachedRecord' => {
37
+ '@internalId' => @file.internal_id,
38
+ '@type' => 'file',
39
+ '@xsi:type' => 'platformCore:RecordRef'
40
+ }
41
+ }
42
+ }
43
+ end
44
+
45
+ def success?
46
+ @success ||= response_hash[:status][:@is_success] == 'true'
47
+ end
48
+
49
+ def response_body
50
+ @response_body ||= response_hash[:base_ref]
51
+ end
52
+
53
+ def response_errors
54
+ if response_hash[:status] && response_hash[:status][:status_detail]
55
+ @response_errors ||= errors
56
+ end
57
+ end
58
+
59
+ def response_hash
60
+ @response_hash ||= @response.to_hash[:attach_response][:write_response]
61
+ end
62
+
63
+ def errors
64
+ error_obj = response_hash[:status][:status_detail]
65
+ error_obj = [error_obj] if error_obj.class == Hash
66
+ error_obj.map do |error|
67
+ NetSuite::Error.new(error)
68
+ end
69
+ end
70
+
71
+ module Support
72
+ def attach_file(file, credentials = {})
73
+ response = NetSuite::Actions::AttachFile.call([self, file], credentials)
74
+
75
+ @errors = response.errors
76
+
77
+ if response.success?
78
+ @internal_id = response.body[:@internal_id]
79
+ true
80
+ else
81
+ false
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -144,12 +144,23 @@ module NetSuite
144
144
  h[element_name] = {
145
145
  '@operator' => condition[:operator],
146
146
  '@xsi:type' => 'platformCore:SearchMultiSelectField',
147
- "platformCore:searchValue" => {
148
- :content! => condition[:value].map(&:to_record),
149
- '@internalId' => condition[:value].map(&:internal_id),
150
- '@xsi:type' => 'platformCore:RecordRef',
151
- '@type' => 'account'
152
- }
147
+ "platformCore:searchValue" => condition[:value].map do |value|
148
+ search_value = {
149
+ :content! => value.to_record,
150
+ '@xsi:type' => 'platformCore:RecordRef',
151
+ '@type' => 'account'
152
+ }
153
+
154
+ if value.internal_id
155
+ search_value['@internalId'] = value.internal_id
156
+ end
157
+
158
+ if value.external_id
159
+ search_value['@externalId'] = value.external_id
160
+ end
161
+
162
+ search_value
163
+ end
153
164
  }
154
165
  elsif condition[:value].is_a?(Array) && condition[:type] == 'SearchDateField'
155
166
  # date ranges are handled via searchValue (start range) and searchValue2 (end range)
@@ -235,6 +246,8 @@ module NetSuite
235
246
  module Support
236
247
  def self.included(base)
237
248
  base.extend(ClassMethods)
249
+
250
+ attr_accessor :search_joins
238
251
  end
239
252
 
240
253
  module ClassMethods
@@ -18,7 +18,6 @@ module NetSuite
18
18
 
19
19
  attr_reader :internal_id
20
20
  attr_accessor :external_id
21
- attr_accessor :search_joins
22
21
 
23
22
  def initialize(attributes = {})
24
23
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -13,7 +13,7 @@ module NetSuite
13
13
  record_refs :parent
14
14
 
15
15
  attr_reader :internal_id
16
- attr_accessor :external_id, :search_joins
16
+ attr_accessor :external_id
17
17
 
18
18
  def initialize(attributes = {})
19
19
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -15,7 +15,6 @@ module NetSuite
15
15
 
16
16
  attr_reader :internal_id
17
17
  attr_accessor :external_id
18
- attr_accessor :search_joins
19
18
 
20
19
  def initialize(attributes = {})
21
20
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -25,4 +24,3 @@ module NetSuite
25
24
  end
26
25
  end
27
26
  end
28
-
@@ -50,7 +50,6 @@ module NetSuite
50
50
 
51
51
  attr_reader :internal_id
52
52
  attr_accessor :external_id
53
- attr_accessor :search_joins
54
53
 
55
54
  def initialize(attributes = {})
56
55
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -12,7 +12,7 @@ module NetSuite
12
12
  :search
13
13
 
14
14
  fields :bin_numbers, :built, :created_date, :expiration_date,
15
- :last_modified_date, :memo, :quantity, :serial_numbers, :total,
15
+ :last_modified_date, :memo, :quantity, :serial_numbers,
16
16
  :tran_date, :tran_id
17
17
 
18
18
  read_only_fields :total
@@ -26,7 +26,6 @@ module NetSuite
26
26
 
27
27
  attr_reader :internal_id
28
28
  attr_accessor :external_id
29
- attr_accessor :search_joins
30
29
 
31
30
  def initialize(attributes = {})
32
31
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -36,5 +35,3 @@ module NetSuite
36
35
  end
37
36
  end
38
37
  end
39
-
40
-
@@ -115,7 +115,6 @@ module NetSuite
115
115
 
116
116
  attr_reader :internal_id
117
117
  attr_accessor :external_id
118
- attr_accessor :search_joins
119
118
 
120
119
  def initialize(attributes = {})
121
120
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::TranSales
9
9
 
10
- actions :get, :add, :initialize, :delete, :update, :upsert, :search
10
+ actions :get, :add, :initialize, :delete, :update, :upsert, :upsert_list, :search
11
11
 
12
12
  fields :alt_handling_cost, :alt_shipping_cost, :auth_code, :bill_address, :cc_approved, :cc_expire_date, :cc_is_purchase_card_bin,
13
13
  :cc_name, :cc_number, :cc_process_as_purchas_card, :cc_security_code, :cc_street, :cc_zip_code, :charge_it, :contrib_pct, :created_date,
@@ -36,7 +36,6 @@ module NetSuite
36
36
 
37
37
  attr_reader :internal_id
38
38
  attr_accessor :external_id
39
- attr_accessor :search_joins
40
39
 
41
40
  def initialize(attributes = {})
42
41
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -24,7 +24,6 @@ module NetSuite
24
24
 
25
25
  attr_reader :internal_id
26
26
  attr_accessor :external_id
27
- attr_accessor :search_joins
28
27
 
29
28
  def initialize(attributes = {})
30
29
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -38,7 +38,6 @@ module NetSuite
38
38
 
39
39
  attr_reader :internal_id
40
40
  attr_accessor :external_id
41
- attr_accessor :search_joins
42
41
 
43
42
  def initialize(attributes = {})
44
43
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -12,7 +12,7 @@ module NetSuite
12
12
 
13
13
  actions :get, :get_list, :search
14
14
 
15
- fields :base_currency, :effective_date, :exchange_rate, :transaction_currency
15
+ fields :effective_date, :exchange_rate
16
16
 
17
17
  record_refs :base_currency, :transaction_currency
18
18
 
@@ -21,7 +21,6 @@ module NetSuite
21
21
 
22
22
  attr_reader :internal_id
23
23
  attr_accessor :external_id
24
- attr_accessor :search_joins
25
24
 
26
25
  def initialize(attributes = {})
27
26
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -17,12 +17,12 @@ module NetSuite
17
17
  :show_last_modified, :show_notes, :show_owner, :show_owner_allow_change, :show_owner_on_list, :use_permissions
18
18
 
19
19
  field :custom_field_list, CustomFieldList
20
+ field :translations_list, TranslationList
20
21
 
21
22
  record_refs :custom_form, :owner, :rec_type, :parent
22
23
 
23
24
  attr_reader :internal_id
24
25
  attr_accessor :external_id
25
- attr_accessor :search_joins
26
26
 
27
27
  def initialize(attributes = {})
28
28
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -44,7 +44,6 @@ module NetSuite
44
44
 
45
45
  attr_reader :internal_id
46
46
  attr_accessor :external_id
47
- attr_accessor :search_joins
48
47
 
49
48
  def initialize(attributes = {})
50
49
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -29,7 +29,6 @@ module NetSuite
29
29
 
30
30
  attr_reader :internal_id
31
31
  attr_accessor :external_id
32
- attr_accessor :search_joins
33
32
 
34
33
  def initialize(attributes = {})
35
34
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -28,7 +28,6 @@ module NetSuite
28
28
 
29
29
  attr_reader :internal_id
30
30
  attr_accessor :external_id
31
- attr_accessor :search_joins
32
31
 
33
32
  def initialize(attributes = {})
34
33
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -24,7 +24,6 @@ module NetSuite
24
24
 
25
25
  attr_reader :internal_id
26
26
  attr_accessor :external_id
27
- attr_accessor :search_joins
28
27
 
29
28
  def initialize(attributes = {})
30
29
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -20,7 +20,6 @@ module NetSuite
20
20
 
21
21
  attr_reader :internal_id
22
22
  attr_accessor :external_id
23
- attr_accessor :search_joins
24
23
 
25
24
  def initialize(attributes = {})
26
25
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -37,7 +37,6 @@ module NetSuite
37
37
 
38
38
  attr_reader :internal_id
39
39
  attr_accessor :external_id
40
- attr_accessor :search_joins
41
40
 
42
41
  def initialize(attributes = {})
43
42
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -15,7 +15,7 @@ module NetSuite
15
15
 
16
16
  field :custom_field_list, CustomFieldList
17
17
  field :subsidiary_list, RecordRefList
18
- # TODO field :translations_list, TranslationList
18
+ field :translations_list, TranslationList
19
19
 
20
20
  attr_reader :internal_id
21
21
  attr_accessor :external_id