netsuite 0.7.9 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/Gemfile +7 -2
  5. data/README.md +164 -61
  6. data/circle.yml +33 -13
  7. data/lib/netsuite.rb +55 -19
  8. data/lib/netsuite/actions/login.rb +20 -1
  9. data/lib/netsuite/actions/search.rb +1 -6
  10. data/lib/netsuite/actions/update.rb +6 -2
  11. data/lib/netsuite/actions/update_list.rb +109 -0
  12. data/lib/netsuite/actions/upsert.rb +2 -0
  13. data/lib/netsuite/configuration.rb +21 -4
  14. data/lib/netsuite/errors.rb +3 -0
  15. data/lib/netsuite/records/assembly_build.rb +39 -0
  16. data/lib/netsuite/records/assembly_component.rb +28 -0
  17. data/lib/netsuite/records/assembly_component_list.rb +12 -0
  18. data/lib/netsuite/records/assembly_item.rb +1 -0
  19. data/lib/netsuite/records/assembly_unbuild.rb +40 -0
  20. data/lib/netsuite/records/bin_number.rb +18 -0
  21. data/lib/netsuite/records/bin_number_list.rb +1 -20
  22. data/lib/netsuite/records/bin_transfer.rb +38 -0
  23. data/lib/netsuite/records/bin_transfer_inventory.rb +20 -0
  24. data/lib/netsuite/records/bin_transfer_inventory_list.rb +10 -0
  25. data/lib/netsuite/records/cash_refund.rb +101 -3
  26. data/lib/netsuite/records/cash_refund_item.rb +1 -1
  27. data/lib/netsuite/records/cash_sale.rb +1 -0
  28. data/lib/netsuite/records/classification.rb +5 -2
  29. data/lib/netsuite/records/contact.rb +2 -1
  30. data/lib/netsuite/records/contact_addressbook.rb +64 -0
  31. data/lib/netsuite/records/contact_addressbook_list.rb +11 -0
  32. data/lib/netsuite/records/credit_memo.rb +1 -0
  33. data/lib/netsuite/records/currency_rate.rb +4 -3
  34. data/lib/netsuite/records/custom_field_list.rb +16 -3
  35. data/lib/netsuite/records/custom_record.rb +3 -3
  36. data/lib/netsuite/records/custom_record_ref.rb +1 -0
  37. data/lib/netsuite/records/customer.rb +5 -4
  38. data/lib/netsuite/records/customer_credit_cards.rb +36 -0
  39. data/lib/netsuite/records/customer_credit_cards_list.rb +10 -0
  40. data/lib/netsuite/records/customer_deposit.rb +6 -2
  41. data/lib/netsuite/records/customer_deposit_apply.rb +17 -0
  42. data/lib/netsuite/records/customer_deposit_apply_list.rb +12 -0
  43. data/lib/netsuite/records/customer_payment.rb +1 -0
  44. data/lib/netsuite/records/customer_sales_team.rb +24 -0
  45. data/lib/netsuite/records/customer_sales_team_list.rb +9 -0
  46. data/lib/netsuite/records/customer_status.rb +29 -0
  47. data/lib/netsuite/records/customer_subscription.rb +18 -0
  48. data/lib/netsuite/records/customer_subscriptions_list.rb +10 -0
  49. data/lib/netsuite/records/deposit_other.rb +0 -10
  50. data/lib/netsuite/records/employee.rb +3 -2
  51. data/lib/netsuite/records/entity_custom_field.rb +53 -0
  52. data/lib/netsuite/records/estimate.rb +42 -0
  53. data/lib/netsuite/records/estimate_item.rb +40 -0
  54. data/lib/netsuite/records/estimate_item_list.rb +11 -0
  55. data/lib/netsuite/records/inbound_shipment.rb +33 -0
  56. data/lib/netsuite/records/inbound_shipment_item.rb +39 -0
  57. data/lib/netsuite/records/inbound_shipment_item_list.rb +11 -0
  58. data/lib/netsuite/records/inter_company_journal_entry.rb +48 -0
  59. data/lib/netsuite/records/inter_company_journal_entry_line.rb +28 -0
  60. data/lib/netsuite/records/inter_company_journal_entry_line_list.rb +14 -0
  61. data/lib/netsuite/records/inventory_adjustment.rb +1 -1
  62. data/lib/netsuite/records/inventory_adjustment_inventory.rb +2 -2
  63. data/lib/netsuite/records/inventory_item.rb +2 -2
  64. data/lib/netsuite/records/inventory_number.rb +35 -0
  65. data/lib/netsuite/records/inventory_number_locations.rb +16 -0
  66. data/lib/netsuite/records/inventory_number_locations_list.rb +10 -0
  67. data/lib/netsuite/records/inventory_transfer.rb +2 -2
  68. data/lib/netsuite/records/inventory_transfer_inventory_list.rb +0 -2
  69. data/lib/netsuite/records/invoice.rb +4 -4
  70. data/lib/netsuite/records/item_fulfillment.rb +2 -1
  71. data/lib/netsuite/records/job.rb +2 -1
  72. data/lib/netsuite/records/lot_numbered_assembly_item.rb +64 -0
  73. data/lib/netsuite/records/lot_numbered_inventory_item.rb +116 -0
  74. data/lib/netsuite/records/matrix_option_list.rb +12 -4
  75. data/lib/netsuite/records/message.rb +30 -0
  76. data/lib/netsuite/records/non_inventory_resale_item.rb +3 -2
  77. data/lib/netsuite/records/non_inventory_sale_item.rb +2 -1
  78. data/lib/netsuite/records/other_charge_sale_item.rb +2 -2
  79. data/lib/netsuite/records/partner.rb +1 -1
  80. data/lib/netsuite/records/price.rb +17 -0
  81. data/lib/netsuite/records/price_level.rb +26 -0
  82. data/lib/netsuite/records/price_list.rb +9 -0
  83. data/lib/netsuite/records/pricing.rb +20 -0
  84. data/lib/netsuite/records/pricing_matrix.rb +2 -2
  85. data/lib/netsuite/records/promotions.rb +26 -0
  86. data/lib/netsuite/records/promotions_list.rb +9 -0
  87. data/lib/netsuite/records/return_authorization.rb +3 -2
  88. data/lib/netsuite/records/return_authorization_item.rb +43 -0
  89. data/lib/netsuite/records/return_authorization_item_list.rb +11 -0
  90. data/lib/netsuite/records/sales_order.rb +1 -0
  91. data/lib/netsuite/records/sales_order_item.rb +12 -5
  92. data/lib/netsuite/records/sales_role.rb +26 -0
  93. data/lib/netsuite/records/sales_tax_item.rb +3 -1
  94. data/lib/netsuite/records/serialized_assembly_item.rb +239 -0
  95. data/lib/netsuite/records/serialized_inventory_item.rb +2 -2
  96. data/lib/netsuite/records/serialized_inventory_item_location.rb +37 -0
  97. data/lib/netsuite/records/serialized_inventory_item_locations_list.rb +10 -0
  98. data/lib/netsuite/records/serialized_inventory_item_numbers.rb +15 -0
  99. data/lib/netsuite/records/serialized_inventory_item_numbers_list.rb +10 -0
  100. data/lib/netsuite/records/service_resale_item.rb +1 -1
  101. data/lib/netsuite/records/service_sale_item.rb +2 -1
  102. data/lib/netsuite/records/subsidiary.rb +1 -0
  103. data/lib/netsuite/records/support_case.rb +1 -1
  104. data/lib/netsuite/records/support_case_type.rb +26 -0
  105. data/lib/netsuite/records/task.rb +2 -1
  106. data/lib/netsuite/records/tax_group.rb +3 -1
  107. data/lib/netsuite/records/transaction_body_custom_field.rb +61 -0
  108. data/lib/netsuite/records/transaction_column_custom_field.rb +59 -0
  109. data/lib/netsuite/records/transfer_order_item.rb +2 -2
  110. data/lib/netsuite/records/vendor.rb +1 -0
  111. data/lib/netsuite/records/vendor_bill.rb +2 -1
  112. data/lib/netsuite/records/vendor_credit.rb +2 -0
  113. data/lib/netsuite/records/work_order.rb +8 -0
  114. data/lib/netsuite/support/actions.rb +2 -0
  115. data/lib/netsuite/support/country.rb +27 -14
  116. data/lib/netsuite/support/search_result.rb +20 -5
  117. data/lib/netsuite/utilities.rb +100 -43
  118. data/lib/netsuite/version.rb +2 -2
  119. data/netsuite.gemspec +5 -4
  120. data/spec/netsuite/actions/login_spec.rb +23 -0
  121. data/spec/netsuite/actions/update_list_spec.rb +107 -0
  122. data/spec/netsuite/actions/update_spec.rb +42 -0
  123. data/spec/netsuite/configuration_spec.rb +79 -6
  124. data/spec/netsuite/records/address_spec.rb +10 -0
  125. data/spec/netsuite/records/basic_record_spec.rb +18 -1
  126. data/spec/netsuite/records/bin_number_spec.rb +23 -0
  127. data/spec/netsuite/records/classification_spec.rb +10 -1
  128. data/spec/netsuite/records/custom_field_list_spec.rb +46 -5
  129. data/spec/netsuite/records/custom_record_spec.rb +1 -1
  130. data/spec/netsuite/records/customer_credit_cards_list_spec.rb +23 -0
  131. data/spec/netsuite/records/customer_sales_team_list_spec.rb +41 -0
  132. data/spec/netsuite/records/customer_spec.rb +44 -2
  133. data/spec/netsuite/records/customer_subscription_spec.rb +41 -0
  134. data/spec/netsuite/records/customer_subscriptions_list_spec.rb +19 -0
  135. data/spec/netsuite/records/employee_spec.rb +2 -2
  136. data/spec/netsuite/records/entity_custom_field_spec.rb +34 -0
  137. data/spec/netsuite/records/estimate_item_list_spec.rb +26 -0
  138. data/spec/netsuite/records/estimate_item_spec.rb +40 -0
  139. data/spec/netsuite/records/estimate_spec.rb +216 -0
  140. data/spec/netsuite/records/inter_company_journal_entry_line_list_spec.rb +26 -0
  141. data/spec/netsuite/records/inter_company_journal_entry_line_spec.rb +60 -0
  142. data/spec/netsuite/records/inter_company_journal_entry_spec.rb +156 -0
  143. data/spec/netsuite/records/inventory_item_spec.rb +57 -0
  144. data/spec/netsuite/records/inventory_transfer_spec.rb +21 -0
  145. data/spec/netsuite/records/invoice_spec.rb +4 -4
  146. data/spec/netsuite/records/matrix_option_list_spec.rb +15 -5
  147. data/spec/netsuite/records/message_spec.rb +49 -0
  148. data/spec/netsuite/records/non_inventory_resale_item_spec.rb +165 -0
  149. data/spec/netsuite/records/non_inventory_sale_item_spec.rb +1 -1
  150. data/spec/netsuite/records/partner_spec.rb +141 -0
  151. data/spec/netsuite/records/price_level_spec.rb +16 -0
  152. data/spec/netsuite/records/pricing_matrix_spec.rb +15 -13
  153. data/spec/netsuite/records/return_authorization_item_list_spec.rb +26 -0
  154. data/spec/netsuite/records/return_authorization_item_spec.rb +43 -0
  155. data/spec/netsuite/records/sales_order_item_spec.rb +11 -5
  156. data/spec/netsuite/records/service_resale_item_spec.rb +134 -0
  157. data/spec/netsuite/records/support_case_type_spec.rb +22 -0
  158. data/spec/netsuite/records/transaction_body_custom_field_spec.rb +32 -0
  159. data/spec/netsuite/records/transaction_column_custom_field_spec.rb +32 -0
  160. data/spec/netsuite/records/vendor_credit_spec.rb +29 -0
  161. data/spec/netsuite/support/search_result_spec.rb +24 -0
  162. data/spec/netsuite/utilities_spec.rb +50 -0
  163. data/spec/spec_helper.rb +5 -4
  164. data/spec/support/fixtures/update_list/update_list_items.xml +22 -0
  165. data/spec/support/fixtures/update_list/update_list_one_item.xml +18 -0
  166. data/spec/support/fixtures/update_list/update_list_with_errors.xml +32 -0
  167. metadata +123 -8
@@ -0,0 +1,38 @@
1
+ module NetSuite
2
+ module Records
3
+ class BinTransfer
4
+ include Support::Fields
5
+ include Support::RecordRefs
6
+ include Support::Records
7
+ include Support::Actions
8
+ include Namespaces::TranInvt
9
+
10
+ actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search
11
+
12
+ fields :created_date, :last_modified_date, :memo, :subsidiary, :tran_date, :tran_id
13
+
14
+ record_refs :location
15
+
16
+ field :custom_field_list, CustomFieldList
17
+ field :inventory_list, BinTransferInventoryList
18
+
19
+ attr_reader :internal_id
20
+ attr_accessor :external_id
21
+
22
+ def initialize(attributes = {})
23
+ @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
24
+ @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
25
+ initialize_from_attributes_hash(attributes)
26
+ end
27
+
28
+ def self.search_class_name
29
+ "Transaction"
30
+ end
31
+
32
+ def self.search_class_namespace
33
+ 'tranSales'
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,20 @@
1
+ module NetSuite
2
+ module Records
3
+ class BinTransferInventory
4
+ include Support::Records
5
+ include Support::Fields
6
+ include Support::RecordRefs
7
+ include Namespaces::TranInvt
8
+
9
+ fields :description, :from_bins, :item_units_label, :line, :preferred_bin, :quantity, :to_bins
10
+
11
+ field :inventory_detail, InventoryDetail
12
+
13
+ record_refs :item
14
+
15
+ def initialize(attributes = {})
16
+ initialize_from_attributes_hash(attributes)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,10 @@
1
+ module NetSuite
2
+ module Records
3
+ class BinTransferInventoryList < Support::Sublist
4
+ include Namespaces::TranInvt
5
+
6
+ sublist :inventory, BinTransferInventory
7
+
8
+ end
9
+ end
10
+ end
@@ -7,17 +7,115 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::TranCust
9
9
 
10
- actions :add, :get, :delete, :initialize, :upsert, :search
10
+ actions :get, :add, :initialize, :delete, :update, :upsert, :search
11
11
 
12
- fields :tran_id, :tran_date, :to_be_emailed, :memo, :total, :currency_name, :exchange_rate, :source, :tax_rate
12
+ fields :alt_handling_cost,
13
+ :alt_shipping_cost,
14
+ :cc_approved,
15
+ :cc_expire_date,
16
+ :cc_is_purchase_card_bin,
17
+ :cc_name,
18
+ :cc_number,
19
+ :cc_process_as_purchase_card,
20
+ :cc_street,
21
+ :cc_zip_code,
22
+ :charge_it,
23
+ :contrib_pct,
24
+ :created_date,
25
+ :currency_name,
26
+ :debit_card_issue_no,
27
+ :deferred_revenue,
28
+ :discount_rate,
29
+ :discount_total,
30
+ :email,
31
+ :est_gross_profit,
32
+ :est_gross_profit_percent,
33
+ :exchange_rate,
34
+ :exclude_commission,
35
+ :fax,
36
+ :gift_cert_applied,
37
+ :gift_cert_available,
38
+ :gift_cert_total,
39
+ :handling_cost,
40
+ :handling_tax1_rate,
41
+ :handling_tax2_rate,
42
+ :is_taxable,
43
+ :last_modified_date,
44
+ :memo,
45
+ :message,
46
+ :other_ref_num,
47
+ :pay_pal_auth_id,
48
+ :pay_pal_process,
49
+ :pay_pal_status,
50
+ :pay_pal_tran_id,
51
+ :pn_ref_num,
52
+ :recognized_revenue,
53
+ :refund_check,
54
+ :rev_rec_on_rev_commitment,
55
+ :sales_effective_date,
56
+ :shipping_cost,
57
+ :shipping_tax1_rate,
58
+ :shipping_tax2_rate,
59
+ :source,
60
+ :status,
61
+ :sub_total,
62
+ :sync_partner_teams,
63
+ :sync_sales_teams,
64
+ :tax2_total,
65
+ :tax_rate,
66
+ :tax_total,
67
+ :to_be_emailed,
68
+ :to_be_faxed,
69
+ :to_be_printed,
70
+ :to_print2,
71
+ :total,
72
+ :total_cost_estimate,
73
+ :tran_date,
74
+ :tran_id,
75
+ :tran_is_vsoe_bundle,
76
+ :valid_from,
77
+ :vat_reg_num,
78
+ :vsoe_auto_calc
79
+
80
+ # NOTE only `Address` record in >= 2014_2
81
+ field :billing_address, Address
13
82
 
14
83
  field :item_list, CashRefundItemList
15
84
  field :custom_field_list, CustomFieldList
85
+ # partnersList CashRefundPartnersList
86
+ # salesTeamList CashRefundSalesTeamList
16
87
 
17
- record_refs :entity, :custom_form, :payment_method, :created_from, :klass, :account, :currency, :posting_period
88
+ record_refs :account,
89
+ :bill_address_list,
90
+ :klass,
91
+ :created_from,
92
+ :credit_card,
93
+ :credit_card_processor,
94
+ :currency,
95
+ :custom_form,
96
+ :department,
97
+ :discount_item,
98
+ :entity,
99
+ :gift_cert,
100
+ :handling_tax_code,
101
+ :job,
102
+ :lead_source,
103
+ :location,
104
+ :message_sel,
105
+ :partner,
106
+ :payment_method,
107
+ :posting_period,
108
+ :promo_code,
109
+ :sales_group,
110
+ :sales_rep,
111
+ :ship_method,
112
+ :shipping_tax_code,
113
+ :subsidiary,
114
+ :tax_item
18
115
 
19
116
  attr_reader :internal_id
20
117
  attr_accessor :external_id
118
+ attr_accessor :search_joins
21
119
 
22
120
  def initialize(attributes = {})
23
121
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -6,7 +6,7 @@ module NetSuite
6
6
  include Support::Records
7
7
  include Namespaces::TranCust
8
8
 
9
- fields :amount, :rate, :quantity
9
+ fields :amount, :rate, :quantity, :is_taxable, :order_line, :line, :description
10
10
  field :custom_field_list, CustomFieldList
11
11
 
12
12
  record_refs :item, :klass, :price
@@ -36,6 +36,7 @@ module NetSuite
36
36
 
37
37
  attr_reader :internal_id
38
38
  attr_accessor :external_id
39
+ attr_accessor :search_joins
39
40
 
40
41
  def initialize(attributes = {})
41
42
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -7,11 +7,14 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListAcct
9
9
 
10
- actions :get, :get_list, :delete, :upsert, :search
10
+ actions :add, :get, :get_list, :delete, :upsert, :search
11
11
 
12
- fields :name, :include_children, :is_inactive, :class_translation_list, :custom_field_list
12
+ fields :name, :include_children, :is_inactive, :class_translation_list
13
13
 
14
14
  field :subsidiary_list, RecordRefList
15
+ field :custom_field_list, CustomFieldList
16
+
17
+ record_refs :parent
15
18
 
16
19
  attr_reader :internal_id
17
20
  attr_accessor :external_id
@@ -13,7 +13,7 @@ module NetSuite
13
13
  :entity_id, :phonetic_name, :alt_email, :office_phone, :home_phone, :mobile_phone, :supervisor_phone,
14
14
  :assistant_phone, :comments, :bill_pay, :is_private, :is_inactive
15
15
 
16
- field :addressbook_list, CustomerAddressbookList
16
+ field :addressbook_list, ContactAddressbookList
17
17
  field :custom_field_list, CustomFieldList
18
18
  # field :subscriptions_list, SubscriptionsList
19
19
  # field :category_list, CategoryList
@@ -24,6 +24,7 @@ module NetSuite
24
24
 
25
25
  attr_reader :internal_id
26
26
  attr_accessor :external_id
27
+ attr_accessor :search_joins
27
28
 
28
29
  def initialize(attributes = {})
29
30
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -0,0 +1,64 @@
1
+ module NetSuite
2
+ module Records
3
+ class ContactAddressbook
4
+ include Support::Fields
5
+ include Support::Records
6
+ include Namespaces::ListRel
7
+
8
+ # address implementation changed
9
+ # https://github.com/NetSweet/netsuite/pull/213
10
+
11
+ # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2015_1/schema/other/customeraddressbook.html?mode=package
12
+
13
+ fields :default_shipping, :default_billing, :is_residential, :label, :internal_id
14
+
15
+ # NOTE API < 2014_2
16
+ fields :attention, :addressee, :phone, :addr1, :addr2, :addr3, :city, :zip, :override, :state
17
+ field :country, NetSuite::Support::Country
18
+ read_only_fields :addr_text
19
+
20
+ # NOTE API >= 2014_2
21
+ field :addressbook_address, NetSuite::Records::Address
22
+
23
+ def initialize(attributes_or_record = {})
24
+ case attributes_or_record
25
+ when self.class
26
+ initialize_from_record(attributes_or_record)
27
+ when Hash
28
+ attributes_or_record = attributes_or_record[:addressbook] if attributes_or_record[:addressbook]
29
+ initialize_from_attributes_hash(attributes_or_record)
30
+ end
31
+ end
32
+
33
+ def initialize_from_record(obj)
34
+ if NetSuite::Configuration.api_version < "2014_2"
35
+ self.default_shipping = obj.default_shipping
36
+ self.default_billing = obj.default_billing
37
+ self.is_residential = obj.is_residential
38
+ self.label = obj.label
39
+ self.attention = obj.attention
40
+ self.addressee = obj.addressee
41
+ self.phone = obj.phone
42
+ self.addr1 = obj.addr1
43
+ self.addr2 = obj.addr2
44
+ self.addr3 = obj.addr3
45
+ self.city = obj.city
46
+ self.zip = obj.zip
47
+ self.country = obj.country
48
+ self.addr_text = obj.addr_text
49
+ self.override = obj.override
50
+ self.state = obj.state
51
+ self.internal_id = obj.internal_id
52
+ else
53
+ self.addressbook_address = obj.addressbook_address
54
+ self.default_billing = obj.default_billing
55
+ self.default_shipping = obj.default_shipping
56
+ self.internal_id = obj.internal_id
57
+ self.is_residential = obj.is_residential
58
+ self.label = obj.label
59
+ end
60
+ end
61
+
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,11 @@
1
+ module NetSuite
2
+ module Records
3
+ class ContactAddressbookList < Support::Sublist
4
+ include Namespaces::ListRel
5
+
6
+ sublist :addressbook, ContactAddressbook
7
+
8
+ alias :addressbooks :addressbook
9
+ end
10
+ end
11
+ end
@@ -38,6 +38,7 @@ module NetSuite
38
38
 
39
39
  attr_reader :internal_id
40
40
  attr_accessor :external_id
41
+ attr_accessor :search_joins
41
42
 
42
43
  def initialize(attributes = {})
43
44
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -13,14 +13,15 @@ module NetSuite
13
13
  actions :get, :get_list, :search
14
14
 
15
15
  fields :base_currency, :effective_date, :exchange_rate, :transaction_currency
16
-
16
+
17
17
  record_refs :base_currency, :transaction_currency
18
-
18
+
19
19
  #field :base_currency, Currency
20
20
  #field :transaction_currency, Currency
21
21
 
22
22
  attr_reader :internal_id
23
23
  attr_accessor :external_id
24
+ attr_accessor :search_joins
24
25
 
25
26
  def initialize(attributes = {})
26
27
  @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
@@ -31,4 +32,4 @@ module NetSuite
31
32
 
32
33
  end
33
34
  end
34
- end
35
+ end
@@ -13,7 +13,9 @@ module NetSuite
13
13
 
14
14
  @custom_fields_assoc = Hash.new
15
15
  custom_fields.each do |custom_field|
16
- # not all custom fields have an id; https://github.com/NetSweet/netsuite/issues/182
16
+ # not all custom fields have an id
17
+ # https://github.com/NetSweet/netsuite/issues/182
18
+
17
19
  if reference_id = custom_field.send(reference_id_type)
18
20
  @custom_fields_assoc[reference_id.to_sym] = custom_field
19
21
  end
@@ -25,7 +27,12 @@ module NetSuite
25
27
  end
26
28
 
27
29
  def delete_custom_field(field)
28
- custom_fields.delete_if { |c| c.send(reference_id_type).to_sym == field }
30
+ custom_fields.delete_if do |c|
31
+ # https://github.com/NetSweet/netsuite/issues/325
32
+ c.send(reference_id_type) &&
33
+ c.send(reference_id_type).to_sym == field
34
+ end
35
+
29
36
  @custom_fields_assoc.delete(field)
30
37
  end
31
38
 
@@ -91,6 +98,7 @@ module NetSuite
91
98
  end
92
99
 
93
100
  private
101
+
94
102
  def reference_id_type
95
103
  @reference_id_type ||= Configuration.api_version >= '2013_2' ? :script_id : :internal_id
96
104
  end
@@ -100,9 +108,14 @@ module NetSuite
100
108
  custom_fields << custom_field_data
101
109
  else
102
110
  attrs = custom_field_data.clone
111
+ type = (custom_field_data[:"@xsi:type"] || custom_field_data[:type])
103
112
 
104
- if (custom_field_data[:"@xsi:type"] || custom_field_data[:type]) == "platformCore:SelectCustomFieldRef"
113
+ if type == "platformCore:SelectCustomFieldRef"
105
114
  attrs[:value] = CustomRecordRef.new(custom_field_data[:value])
115
+ elsif type == 'platformCore:MultiSelectCustomFieldRef'
116
+ attrs[:value] = custom_field_data[:value].map do |entry|
117
+ CustomRecordRef.new(entry)
118
+ end
106
119
  end
107
120
 
108
121
  custom_fields << CustomField.new(attrs)
@@ -9,8 +9,8 @@ module NetSuite
9
9
 
10
10
  actions :get, :update, :get_list, :add, :delete, :search, :upsert
11
11
 
12
- fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :created,
13
- :custom_record_id, :description, :disclaimer, :enabl_email_merge, :enable_numbering, :include_name,
12
+ fields :allow_attachments, :allow_inline_editing, :allow_numbering_override, :allow_quick_search, :alt_name, :auto_name,
13
+ :created, :custom_record_id, :description, :disclaimer, :enabl_email_merge, :enable_numbering, :include_name,
14
14
  :is_available_offline, :is_inactive, :is_numbering_updateable, :is_ordered, :last_modified, :name,
15
15
  :numbering_current_number, :numbering_init, :numbering_min_digits, :numbering_prefix, :numbering_suffix,
16
16
  :record_name, :script_id, :show_creation_date, :show_creation_date_on_list, :show_id, :show_last_modified_on_list,
@@ -18,7 +18,7 @@ module NetSuite
18
18
 
19
19
  field :custom_field_list, CustomFieldList
20
20
 
21
- record_refs :custom_form, :owner, :rec_type
21
+ record_refs :custom_form, :owner, :rec_type, :parent
22
22
 
23
23
  attr_reader :internal_id
24
24
  attr_accessor :external_id
@@ -40,6 +40,7 @@ module NetSuite
40
40
  def to_record
41
41
  rec = super
42
42
  rec[:@internalId] = @internal_id if @internal_id
43
+ rec[:@externalId] = @external_id if @external_id
43
44
  rec[:@typeId] = @type_id if @type_id
44
45
  rec
45
46
  end
@@ -13,7 +13,7 @@ module NetSuite
13
13
 
14
14
  fields :account_number, :aging, :alt_email, :alt_name, :alt_phone, :bill_pay,
15
15
  :buying_reason, :buying_time_frame, :campaign_category, :click_stream, :comments, :company_name,
16
- :consol_aging, :consol_days_overdue, :contrib_pct, :credit_cards_list, :credit_hold_override,
16
+ :consol_aging, :consol_days_overdue, :contrib_pct, :credit_hold_override,
17
17
  :credit_limit, :date_created, :days_overdue, :default_address,
18
18
  :download_list, :email, :email_preference, :email_transactions, :end_date, :entity_id,
19
19
  :estimated_budget, :fax, :fax_transactions, :first_name, :first_visit, :give_access, :global_subscription_status,
@@ -22,18 +22,19 @@ module NetSuite
22
22
  :opening_balance, :opening_balance_account, :opening_balance_date,
23
23
  :password, :password2, :phone, :phonetic_name, :pref_cc_processor, :print_on_check_as,
24
24
  :print_transactions, :referrer, :reminder_days, :representing_subsidiary, :require_pwd_change, :resale_number,
25
- :sales_group, :sales_readiness, :sales_team_list, :salutation, :send_email, :ship_complete,
25
+ :sales_group, :sales_readiness, :salutation, :send_email, :ship_complete,
26
26
  :stage, :start_date, :sync_partner_teams, :tax_exempt, :taxable,
27
27
  :third_party_acct, :third_party_country, :third_party_zipcode, :title, :url,
28
28
  :vat_reg_number, :visits, :web_lead
29
29
 
30
30
  field :addressbook_list, CustomerAddressbookList
31
+ field :credit_cards_list, CustomerCreditCardsList
31
32
  field :custom_field_list, CustomFieldList
32
33
  field :contact_roles_list, ContactAccessRolesList
33
34
  field :currency_list, CustomerCurrencyList
34
35
  field :partners_list, CustomerPartnersList
35
-
36
- # TODO subscriptions_list
36
+ field :subscriptions_list, CustomerSubscriptionsList
37
+ field :sales_team_list, CustomerSalesTeamList
37
38
 
38
39
  read_only_fields :balance, :consol_balance, :deposit_balance, :consol_deposit_balance, :overdue_balance,
39
40
  :consol_overdue_balance, :unbilled_orders, :consol_unbilled_orders