Commit b1c0def66fea3dad240e9d9e0b5901e759efbcb2
1 parent
f4259c1e
rubocop violation autofixes
Showing
41 changed files
with
527 additions
and
567 deletions
Show diff stats
lib/syspro.rb
@@ -94,7 +94,7 @@ module Syspro | @@ -94,7 +94,7 @@ module Syspro | ||
94 | end | 94 | end |
95 | 95 | ||
96 | def api_base=(url) | 96 | def api_base=(url) |
97 | - warn "[DEPRECATION] `api_base=` is deprecated. Please use `configuration.server_url=` instead." | 97 | + warn '[DEPRECATION] `api_base=` is deprecated. Please use `configuration.server_url=` instead.' |
98 | @api_base = url | 98 | @api_base = url |
99 | end | 99 | end |
100 | 100 |
lib/syspro/api_operations/setup.rb
@@ -33,11 +33,10 @@ module Syspro | @@ -33,11 +33,10 @@ module Syspro | ||
33 | 33 | ||
34 | protected | 34 | protected |
35 | 35 | ||
36 | - def request(method, url, params = {}, opts ={}) | 36 | + def request(method, url, params = {}, opts = {}) |
37 | opts = @opts.merge(Util.normalize_opts(opts)) | 37 | opts = @opts.merge(Util.normalize_opts(opts)) |
38 | Request.request(method, url, params, opts) | 38 | Request.request(method, url, params, opts) |
39 | end | 39 | end |
40 | end | 40 | end |
41 | end | 41 | end |
42 | end | 42 | end |
43 | - |
lib/syspro/api_operations/transaction.rb
@@ -25,11 +25,10 @@ module Syspro | @@ -25,11 +25,10 @@ module Syspro | ||
25 | 25 | ||
26 | protected | 26 | protected |
27 | 27 | ||
28 | - def request(method, url, params = {}, opts ={}) | 28 | + def request(method, url, params = {}, opts = {}) |
29 | opts = @opts.merge(Util.normalize_opts(opts)) | 29 | opts = @opts.merge(Util.normalize_opts(opts)) |
30 | Request.request(method, url, params, opts) | 30 | Request.request(method, url, params, opts) |
31 | end | 31 | end |
32 | end | 32 | end |
33 | end | 33 | end |
34 | end | 34 | end |
35 | - |
lib/syspro/business_objects/combrw.rb
@@ -16,10 +16,10 @@ module Syspro | @@ -16,10 +16,10 @@ module Syspro | ||
16 | xml_in = template.result(binding) | 16 | xml_in = template.result(binding) |
17 | params = { 'UserId' => user_id, 'XmlIn' => xml_in } | 17 | params = { 'UserId' => user_id, 'XmlIn' => xml_in } |
18 | resp = ComBrw.browse(params) | 18 | resp = ComBrw.browse(params) |
19 | - unless raw | ||
20 | - parse_response(resp) | ||
21 | - else | 19 | + if raw |
22 | resp | 20 | resp |
21 | + else | ||
22 | + parse_response(resp) | ||
23 | end | 23 | end |
24 | end | 24 | end |
25 | 25 |
lib/syspro/business_objects/comsfm.rb
@@ -17,9 +17,9 @@ module Syspro | @@ -17,9 +17,9 @@ module Syspro | ||
17 | xml_in = template.result(binding) | 17 | xml_in = template.result(binding) |
18 | business_object = 'COMSFM' | 18 | business_object = 'COMSFM' |
19 | params = { 'UserId' => user_id, | 19 | params = { 'UserId' => user_id, |
20 | - 'BusinessObject' => business_object, | ||
21 | - 'XmlParameters' => xml_parameters, | ||
22 | - 'XmlIn' => xml_in } | 20 | + 'BusinessObject' => business_object, |
21 | + 'XmlParameters' => xml_parameters, | ||
22 | + 'XmlIn' => xml_in } | ||
23 | resp = ComsFm.add(params) | 23 | resp = ComsFm.add(params) |
24 | 24 | ||
25 | parse_response(resp) | 25 | parse_response(resp) |
@@ -40,4 +40,4 @@ module Syspro | @@ -40,4 +40,4 @@ module Syspro | ||
40 | end | 40 | end |
41 | end | 41 | end |
42 | end | 42 | end |
43 | -end | ||
44 | \ No newline at end of file | 43 | \ No newline at end of file |
44 | +end |
lib/syspro/business_objects/invqry.rb
@@ -32,7 +32,7 @@ module Syspro | @@ -32,7 +32,7 @@ module Syspro | ||
32 | parser.parse | 32 | parser.parse |
33 | end | 33 | end |
34 | 34 | ||
35 | - def render_xml(inner_text, dflt_value = "") | 35 | + def render_xml(inner_text, dflt_value = '') |
36 | inner_text ? inner_text.to_s : dflt_value | 36 | inner_text ? inner_text.to_s : dflt_value |
37 | end | 37 | end |
38 | end | 38 | end |
lib/syspro/business_objects/invsws.rb
@@ -20,9 +20,9 @@ module Syspro | @@ -20,9 +20,9 @@ module Syspro | ||
20 | xml_in = template.result(binding) | 20 | xml_in = template.result(binding) |
21 | business_object = 'INVSWS' | 21 | business_object = 'INVSWS' |
22 | params = { 'UserId' => user_id, | 22 | params = { 'UserId' => user_id, |
23 | - 'BusinessObject' => business_object, | ||
24 | - 'XmlParameters' => xml_parameters, | ||
25 | - 'XmlIn' => xml_in } | 23 | + 'BusinessObject' => business_object, |
24 | + 'XmlParameters' => xml_parameters, | ||
25 | + 'XmlIn' => xml_in } | ||
26 | resp = InvSws.add(params) | 26 | resp = InvSws.add(params) |
27 | 27 | ||
28 | parse_response(resp) | 28 | parse_response(resp) |
@@ -42,7 +42,7 @@ module Syspro | @@ -42,7 +42,7 @@ module Syspro | ||
42 | parser.parse | 42 | parser.parse |
43 | end | 43 | end |
44 | 44 | ||
45 | - def render_xml(inner_text, dflt_value = "") | 45 | + def render_xml(inner_text, dflt_value = '') |
46 | inner_text ? inner_text.to_s : dflt_value | 46 | inner_text ? inner_text.to_s : dflt_value |
47 | end | 47 | end |
48 | end | 48 | end |
lib/syspro/business_objects/models/comsfm_item.rb
lib/syspro/business_objects/models/inv.rb
@@ -9,7 +9,7 @@ module Syspro | @@ -9,7 +9,7 @@ module Syspro | ||
9 | 9 | ||
10 | def initialize | 10 | def initialize |
11 | @warehouse_totals = WarehouseTotals.new | 11 | @warehouse_totals = WarehouseTotals.new |
12 | - @warehouse_items = [] | 12 | + @warehouse_items = [] |
13 | @stock_item = StockItem.new | 13 | @stock_item = StockItem.new |
14 | @system_information = SystemInformation.new | 14 | @system_information = SystemInformation.new |
15 | end | 15 | end |
@@ -19,7 +19,7 @@ module Syspro | @@ -19,7 +19,7 @@ module Syspro | ||
19 | 19 | ||
20 | # copy hash items that match into new warehouse item | 20 | # copy hash items that match into new warehouse item |
21 | new_hash.keys.each do |k| | 21 | new_hash.keys.each do |k| |
22 | - w.send("#{k.to_s}=", new_hash[k]) if w.methods.include? k | 22 | + w.send("#{k}=", new_hash[k]) if w.methods.include? k |
23 | end | 23 | end |
24 | 24 | ||
25 | @warehouse_items.push(w) | 25 | @warehouse_items.push(w) |
@@ -29,7 +29,7 @@ module Syspro | @@ -29,7 +29,7 @@ module Syspro | ||
29 | class WarehouseTotals | 29 | class WarehouseTotals |
30 | attr_accessor :qty_on_hand, | 30 | attr_accessor :qty_on_hand, |
31 | :available_qty | 31 | :available_qty |
32 | - | 32 | + |
33 | # Not all xml parsed, see https://infozone.syspro.com/Support/businessobjectslibrary/INVQRYOUT.XML | 33 | # Not all xml parsed, see https://infozone.syspro.com/Support/businessobjectslibrary/INVQRYOUT.XML |
34 | end | 34 | end |
35 | 35 | ||
@@ -80,4 +80,3 @@ module Syspro | @@ -80,4 +80,3 @@ module Syspro | ||
80 | end | 80 | end |
81 | end | 81 | end |
82 | end | 82 | end |
83 | - |
lib/syspro/business_objects/models/inv_qry_options.rb
lib/syspro/business_objects/models/inventory_inspection.rb
lib/syspro/business_objects/models/invsws_item.rb
@@ -39,9 +39,9 @@ module Syspro | @@ -39,9 +39,9 @@ module Syspro | ||
39 | :e_signature | 39 | :e_signature |
40 | end | 40 | end |
41 | 41 | ||
42 | - class InvSwsItemKey | ||
43 | - attr_accessor | ||
44 | - end | 42 | + class InvSwsItemKey |
43 | + attr_accessor | ||
44 | + end | ||
45 | end | 45 | end |
46 | end | 46 | end |
47 | -end | ||
48 | \ No newline at end of file | 47 | \ No newline at end of file |
48 | +end |
lib/syspro/business_objects/models/por_detail.rb
@@ -94,35 +94,33 @@ module Syspro | @@ -94,35 +94,33 @@ module Syspro | ||
94 | :edit_default_price, | 94 | :edit_default_price, |
95 | :default_prum, | 95 | :default_prum, |
96 | :costing_methods_available | 96 | :costing_methods_available |
97 | - | ||
98 | end # end of class MerchandiseDetail | 97 | end # end of class MerchandiseDetail |
99 | 98 | ||
100 | class CostingMethodsAvailable | 99 | class CostingMethodsAvailable |
101 | attr_accessor :manual_method_code, | 100 | attr_accessor :manual_method_code, |
102 | - :manual_method_desc, | ||
103 | - :manual_method_price, | ||
104 | - :edit__manual_method_price, | ||
105 | - :manual_method_costing_prum, | ||
106 | - :total_cost_method_code, | ||
107 | - :total_cost_method_desc, | ||
108 | - :total_cost_method_price, | ||
109 | - :edit__total_cost_method_price, | ||
110 | - :total_cost_costing_prum, | ||
111 | - :purchase_price_method_code, | ||
112 | - :purchase_price_method_desc, | ||
113 | - :purchase_price_method_price, | ||
114 | - :edit__purchase_price_method_price, | ||
115 | - :purchase_price_costing_prum, | ||
116 | - :price_tax_method_code, | ||
117 | - :price_tax_method_desc, | ||
118 | - :price_tax_method_price, | ||
119 | - :edit__price_tax_method_price, | ||
120 | - :price_tax_costing_prum | 101 | + :manual_method_desc, |
102 | + :manual_method_price, | ||
103 | + :edit__manual_method_price, | ||
104 | + :manual_method_costing_prum, | ||
105 | + :total_cost_method_code, | ||
106 | + :total_cost_method_desc, | ||
107 | + :total_cost_method_price, | ||
108 | + :edit__total_cost_method_price, | ||
109 | + :total_cost_costing_prum, | ||
110 | + :purchase_price_method_code, | ||
111 | + :purchase_price_method_desc, | ||
112 | + :purchase_price_method_price, | ||
113 | + :edit__purchase_price_method_price, | ||
114 | + :purchase_price_costing_prum, | ||
115 | + :price_tax_method_code, | ||
116 | + :price_tax_method_desc, | ||
117 | + :price_tax_method_price, | ||
118 | + :edit__price_tax_method_price, | ||
119 | + :price_tax_costing_prum | ||
121 | end # end of class CostingMethodsAvailable | 120 | end # end of class CostingMethodsAvailable |
122 | 121 | ||
123 | class PurchaseOrderTotals | 122 | class PurchaseOrderTotals |
124 | attr_accessor :local_values, :current_values, :first_receipt_date, :order_complete_date | 123 | attr_accessor :local_values, :current_values, :first_receipt_date, :order_complete_date |
125 | - | ||
126 | end | 124 | end |
127 | 125 | ||
128 | class PurchaseOrderTotalsLocalValues | 126 | class PurchaseOrderTotalsLocalValues |
@@ -136,7 +134,6 @@ module Syspro | @@ -136,7 +134,6 @@ module Syspro | ||
136 | :edited_current_order_value, :edited_current_received_to_date_value, | 134 | :edited_current_order_value, :edited_current_received_to_date_value, |
137 | :edited_current_outstanding_value | 135 | :edited_current_outstanding_value |
138 | end | 136 | end |
139 | - | ||
140 | end | 137 | end |
141 | end | 138 | end |
142 | end | 139 | end |
lib/syspro/business_objects/models/purchase_order.rb
lib/syspro/business_objects/models/purchase_orders/comment_line.rb
lib/syspro/business_objects/models/purchase_orders/freight_line.rb
@@ -8,9 +8,9 @@ module Syspro | @@ -8,9 +8,9 @@ module Syspro | ||
8 | :freight_value, | 8 | :freight_value, |
9 | :freight_tax_code, | 9 | :freight_tax_code, |
10 | :freight_taxable | 10 | :freight_taxable |
11 | - :freight_f_loc | 11 | + :freight_f_loc |
12 | end | 12 | end |
13 | end | 13 | end |
14 | end | 14 | end |
15 | end | 15 | end |
16 | -end | ||
17 | \ No newline at end of file | 16 | \ No newline at end of file |
17 | +end |
lib/syspro/business_objects/models/purchase_orders/header.rb
lib/syspro/business_objects/models/purchase_orders/misc_charge_line.rb
lib/syspro/business_objects/models/purchase_orders/order_details.rb
lib/syspro/business_objects/models/purchase_orders/stock_line.rb
@@ -4,45 +4,42 @@ module Syspro | @@ -4,45 +4,42 @@ module Syspro | ||
4 | module PurchaseOrders | 4 | module PurchaseOrders |
5 | class StockLine | 5 | class StockLine |
6 | attr_accessor :purchase_order_line, | 6 | attr_accessor :purchase_order_line, |
7 | - :line_action_type, | ||
8 | - :stock_code, | ||
9 | - :stock_description, | ||
10 | - :warehouse, | ||
11 | - :sup_catalogue, | ||
12 | - :order_qty, | ||
13 | - :order_uom, | ||
14 | - :units, | ||
15 | - :pieces, | ||
16 | - :price_method, | ||
17 | - :supplier_contract, | ||
18 | - :price, | ||
19 | - :price_uom, | ||
20 | - :line_disc_type, | ||
21 | - :line_disc_less_plus, | ||
22 | - :line_disc_percent1, | ||
23 | - :line_disc_percent2, | ||
24 | - :line_disc_percent3, | ||
25 | - :line_disc_value, | ||
26 | - :taxable, | ||
27 | - :tax_codev, | ||
28 | - :job, | ||
29 | - :version, | ||
30 | - :release, | ||
31 | - :latest_due_date, | ||
32 | - :original_due_date, | ||
33 | - :reschedule_due_date, | ||
34 | - :ledger_code, | ||
35 | - :password_for_ledger_code, | ||
36 | - :subcontract_op, | ||
37 | - :inspection_reqd, | ||
38 | - :product_class, | ||
39 | - :nons_unit_mass, | ||
40 | - :nons_unit_vol | 7 | + :line_action_type, |
8 | + :stock_code, | ||
9 | + :stock_description, | ||
10 | + :warehouse, | ||
11 | + :sup_catalogue, | ||
12 | + :order_qty, | ||
13 | + :order_uom, | ||
14 | + :units, | ||
15 | + :pieces, | ||
16 | + :price_method, | ||
17 | + :supplier_contract, | ||
18 | + :price, | ||
19 | + :price_uom, | ||
20 | + :line_disc_type, | ||
21 | + :line_disc_less_plus, | ||
22 | + :line_disc_percent1, | ||
23 | + :line_disc_percent2, | ||
24 | + :line_disc_percent3, | ||
25 | + :line_disc_value, | ||
26 | + :taxable, | ||
27 | + :tax_codev, | ||
28 | + :job, | ||
29 | + :version, | ||
30 | + :release, | ||
31 | + :latest_due_date, | ||
32 | + :original_due_date, | ||
33 | + :reschedule_due_date, | ||
34 | + :ledger_code, | ||
35 | + :password_for_ledger_code, | ||
36 | + :subcontract_op, | ||
37 | + :inspection_reqd, | ||
38 | + :product_class, | ||
39 | + :nons_unit_mass, | ||
40 | + :nons_unit_vol | ||
41 | end | 41 | end |
42 | end | 42 | end |
43 | end | 43 | end |
44 | end | 44 | end |
45 | end | 45 | end |
46 | - | ||
47 | - | ||
48 | - |
lib/syspro/business_objects/models/receipt_interospection.rb
lib/syspro/business_objects/models/sor.rb
lib/syspro/business_objects/parsers/porqry_parser.rb
@@ -11,7 +11,7 @@ module Syspro | @@ -11,7 +11,7 @@ module Syspro | ||
11 | end | 11 | end |
12 | 12 | ||
13 | def parse | 13 | def parse |
14 | - por = Syspro::BusinessObjects::Models::PorDetail.new() | 14 | + por = Syspro::BusinessObjects::Models::PorDetail.new |
15 | 15 | ||
16 | por.purchase_order = doc.first_element_child.xpath('PurchaseOrder').text | 16 | por.purchase_order = doc.first_element_child.xpath('PurchaseOrder').text |
17 | por.supplier = doc.first_element_child.xpath('Supplier').text | 17 | por.supplier = doc.first_element_child.xpath('Supplier').text |
@@ -65,156 +65,152 @@ module Syspro | @@ -65,156 +65,152 @@ module Syspro | ||
65 | por.document_format = doc.first_element_child.xpath('DocumentFormat').text | 65 | por.document_format = doc.first_element_child.xpath('DocumentFormat').text |
66 | por.include_in_mrp = doc.first_element_child.xpath('IncludeInMrp').text | 66 | por.include_in_mrp = doc.first_element_child.xpath('IncludeInMrp').text |
67 | 67 | ||
68 | - por.customform_fields = doc.first_element_child.xpath("CustomForm").children.select{|item| item.name === "Field"}.map do |field_el| | ||
69 | - if field_el && field_el.children.count > 0 | ||
70 | - Syspro::BusinessObjects::Models::PorDetail::CustomFormField.new.tap do |field_obj| | ||
71 | - field_obj.sequence = field_el.children.select{|el| el.name === "Sequence"}[0].children.text | ||
72 | - field_obj.name = field_el.children.select{|el| el.name === "Name"}[0].children.text | ||
73 | - field_obj.prompt = field_el.children.select{|el| el.name === "Prompt"}[0].children.text | ||
74 | - field_obj.column = field_el.children.select{|el| el.name === "Column"}[0].children.text | ||
75 | - field_obj.type = field_el.children.select{|el| el.name === "Type"}[0].children.text | ||
76 | - field_obj.length = field_el.children.select{|el| el.name === "Length"}[0].children.text | ||
77 | - field_obj.decimals = field_el.children.select{|el| el.name === "Decimals"}[0].children.text | ||
78 | - field_obj.default = field_el.children.select{|el| el.name === "Default"}[0].children.text | ||
79 | - field_obj.allow_null = field_el.children.select{|el| el.name === "AllowNull"}[0].children.text | ||
80 | - field_obj.validation_type = field_el.children.select{|el| el.name === "ValidationType"}[0].children.text | ||
81 | - field_obj.value_null = field_el.children.select{|el| el.name === "ValueNull"}[0].children.text | ||
82 | - end | 68 | + por.customform_fields = doc.first_element_child.xpath('CustomForm').children.select { |item| item.name === 'Field' }.map do |field_el| |
69 | + next unless field_el && field_el.children.count > 0 | ||
70 | + Syspro::BusinessObjects::Models::PorDetail::CustomFormField.new.tap do |field_obj| | ||
71 | + field_obj.sequence = field_el.children.select { |el| el.name === 'Sequence' }[0].children.text | ||
72 | + field_obj.name = field_el.children.select { |el| el.name === 'Name' }[0].children.text | ||
73 | + field_obj.prompt = field_el.children.select { |el| el.name === 'Prompt' }[0].children.text | ||
74 | + field_obj.column = field_el.children.select { |el| el.name === 'Column' }[0].children.text | ||
75 | + field_obj.type = field_el.children.select { |el| el.name === 'Type' }[0].children.text | ||
76 | + field_obj.length = field_el.children.select { |el| el.name === 'Length' }[0].children.text | ||
77 | + field_obj.decimals = field_el.children.select { |el| el.name === 'Decimals' }[0].children.text | ||
78 | + field_obj.default = field_el.children.select { |el| el.name === 'Default' }[0].children.text | ||
79 | + field_obj.allow_null = field_el.children.select { |el| el.name === 'AllowNull' }[0].children.text | ||
80 | + field_obj.validation_type = field_el.children.select { |el| el.name === 'ValidationType' }[0].children.text | ||
81 | + field_obj.value_null = field_el.children.select { |el| el.name === 'ValueNull' }[0].children.text | ||
83 | end | 82 | end |
84 | end.compact | 83 | end.compact |
85 | 84 | ||
86 | - por.purchase_order_line_merchandise = doc.first_element_child.xpath("PurchaseOrderLine").children.select{|item| item.name === "Merchandise"}.map do |merch_el| | ||
87 | - if merch_el && merch_el.children.count > 0 | ||
88 | - Syspro::BusinessObjects::Models::PorDetail::Merchandise.new.tap do |merch_obj| | ||
89 | - merch_obj.line = merch_el.children.select{|el| el.name === "Line"}[0].children.text | ||
90 | - merch_obj.line_type = merch_el.children.select{|el| el.name === "LineType"}[0].children.text | ||
91 | - merch_obj.line_Type_description = merch_el.children.select{|el| el.name === "LineTypeDescription"}[0].children.text | ||
92 | - merch_obj.m_stock_code = merch_el.children.select{|el| el.name === "MStockCode"}[0].children.text | ||
93 | - merch_obj.m_stock_des = merch_el.children.select{|el| el.name === "MStockDes"}[0].children.text | ||
94 | - merch_obj.long_desc = merch_el.children.select{|el| el.name === "LongDesc"}[0].children.text | ||
95 | - merch_obj.traceable_type = merch_el.children.select{|el| el.name === "TraceableType"}[0].children.text | ||
96 | - merch_obj.mass = merch_el.children.select{|el| el.name === "Mass"}[0].children.text | ||
97 | - merch_obj.volume = merch_el.children.select{|el| el.name === "Volume"}[0].children.text | ||
98 | - merch_obj.receipt_into_flag = merch_el.children.select{|el| el.name === "ReceiptIntoFlag"}[0].children.text | ||
99 | - merch_obj.m_warehouse = merch_el.children.select{|el| el.name === "MWarehouse"}[0].children.text | ||
100 | - merch_obj.m_warehouse_desc = merch_el.children.select{|el| el.name === "MWarehouseDesc"}[0].children.text | ||
101 | - merch_obj.m_outstanding_qty = merch_el.children.select{|el| el.name === "MOutstandingQty"}[0].children.text | ||
102 | - merch_obj.unedited__m_outstanding_qty = merch_el.children.select{|el| el.name === "Unedited_MOutstandingQty"}[0].children.text | ||
103 | - merch_obj.m_order_qty = merch_el.children.select{|el| el.name === "MOrderQty"}[0].children.text | ||
104 | - merch_obj.unedited__m_order_qty = merch_el.children.select{|el| el.name === "Unedited_MOrderQty"}[0].children.text | ||
105 | - merch_obj.m_received_qty = merch_el.children.select{|el| el.name === "MReceivedQty"}[0].children.text | ||
106 | - merch_obj.unedited__m_received_qty = merch_el.children.select{|el| el.name === "Unedited_MReceivedQty"}[0].children.text | ||
107 | - merch_obj.m_order_uom = merch_el.children.select{|el| el.name === "MOrderUom"}[0].children.text | ||
108 | - merch_obj.m_complete_flag = merch_el.children.select{|el| el.name === "MCompleteFlag"}[0].children.text | ||
109 | - merch_obj.m_job = merch_el.children.select{|el| el.name === "MJob"}[0].children.text | ||
110 | - merch_obj.include_in_mrp = merch_el.children.select{|el| el.name === "IncludeInMrp"}[0].children.text | ||
111 | - merch_obj.m_price = merch_el.children.select{|el| el.name === "MPrice"}[0].children.text | ||
112 | - merch_obj.edit_m_price = merch_el.children.select{|el| el.name === "Edit_MPrice"}[0].children.text | ||
113 | - merch_obj.order_value = merch_el.children.select{|el| el.name === "OrderValue"}[0].children.text | ||
114 | - merch_obj.m_disc_pct1 = merch_el.children.select{|el| el.name === "MDiscPct1"}[0].children.text | ||
115 | - merch_obj.m_disc_pct2 = merch_el.children.select{|el| el.name === "MDiscPct2"}[0].children.text | ||
116 | - merch_obj.m_disc_pct3 = merch_el.children.select{|el| el.name === "MDiscPct3"}[0].children.text | ||
117 | - merch_obj.m_disc_value = merch_el.children.select{|el| el.name === "MDiscValue"}[0].children.text | ||
118 | - merch_obj.m_disc_val_flag = merch_el.children.select{|el| el.name === "MDiscValFlag"}[0].children.text | ||
119 | - merch_obj.m_price_uom = merch_el.children.select{|el| el.name === "MPriceUom"}[0].children.text | ||
120 | - merch_obj.m_latest_due_date = merch_el.children.select{|el| el.name === "MLatestDueDate"}[0].children.text | ||
121 | - merch_obj.m_sup_catalogue = merch_el.children.select{|el| el.name === "MSupCatalogue"}[0].children.text | ||
122 | - merch_obj.m_product_class = merch_el.children.select{|el| el.name === "MProductClass"}[0].children.text | ||
123 | - merch_obj.m_product_class_description = merch_el.children.select{|el| el.name === "MProductClassDescription"}[0].children.text | ||
124 | - merch_obj.m_stocking_uom = merch_el.children.select{|el| el.name === "MStockingUom"}[0].children.text | ||
125 | - merch_obj.m_decimals_to_prt = merch_el.children.select{|el| el.name === "MDecimalsToPrt"}[0].children.text | ||
126 | - merch_obj.m_conv_fact_prc_um = merch_el.children.select{|el| el.name === "MConvFactPrcUm"}[0].children.text | ||
127 | - merch_obj.m_mul_div_prc = merch_el.children.select{|el| el.name === "MMulDivPrc"}[0].children.text | ||
128 | - merch_obj.m_tax_code = merch_el.children.select{|el| el.name === "MTaxCode"}[0].children.text | ||
129 | - merch_obj.m_tax_code_description = merch_el.children.select{|el| el.name === "MTaxCodeDescription"}[0].children.text | ||
130 | - merch_obj.m_conv_fact_ord_um = merch_el.children.select{|el| el.name === "MConvFactOrdUm"}[0].children.text | ||
131 | - merch_obj.m_mul_div_alloc = merch_el.children.select{|el| el.name === "MMulDivAlloc"}[0].children.text | ||
132 | - merch_obj.m_gl_code = merch_el.children.select{|el| el.name === "MGlCode"}[0].children.text | ||
133 | - merch_obj.m_gl_code_description = merch_el.children.select{|el| el.name === "MGlCodeDescription"}[0].children.text | ||
134 | - merch_obj.m_orig_due_date = merch_el.children.select{|el| el.name === "MOrigDueDate"}[0].children.text | ||
135 | - merch_obj.m_lct_confirmed = merch_el.children.select{|el| el.name === "MLctConfirmed"}[0].children.text | ||
136 | - merch_obj.m_subcontract_op = merch_el.children.select{|el| el.name === "MSubcontractOp"}[0].children.text | ||
137 | - merch_obj.m_version = merch_el.children.select{|el| el.name === "MVersion"}[0].children.text | ||
138 | - merch_obj.m_release = merch_el.children.select{|el| el.name === "MRelease"}[0].children.text | ||
139 | - merch_obj.asset_flag = merch_el.children.select{|el| el.name === "AssetFlag"}[0].children.text | ||
140 | - merch_obj.capex_code = merch_el.children.select{|el| el.name === "CapexCode"}[0].children.text | ||
141 | - merch_obj.asset_capex_line = merch_el.children.select{|el| el.name === "AssetCapexLine"}[0].children.text | ||
142 | - merch_obj.discount = merch_el.children.select{|el| el.name === "Discount"}[0].children.text | ||
143 | - merch_obj.last_receipt = merch_el.children.select{|el| el.name === "LastReceipt"}[0].children.text | ||
144 | - merch_obj.ledger = merch_el.children.select{|el| el.name === "Ledger"}[0].children.text | ||
145 | - merch_obj.requisition_line = merch_el.children.select{|el| el.name === "RequisitionLine"}[0].children.text | ||
146 | - merch_obj.requisition_no = merch_el.children.select{|el| el.name === "RequisitionNo"}[0].children.text | ||
147 | - merch_obj.requisition_user = merch_el.children.select{|el| el.name === "RequisitionUser"}[0].children.text | ||
148 | - merch_obj.reschedule = merch_el.children.select{|el| el.name === "Reschedule"}[0].children.text | ||
149 | - merch_obj.rev = merch_el.children.select{|el| el.name === "Rev"}[0].children.text | ||
150 | - merch_obj.release = merch_el.children.select{|el| el.name === "Release"}[0].children.text | ||
151 | - merch_obj.selection_code = merch_el.children.select{|el| el.name === "SelectionCode"}[0].children.text | ||
152 | - merch_obj.selection_type = merch_el.children.select{|el| el.name === "SelectionType"}[0].children.text | ||
153 | - merch_obj.currency = merch_el.children.select{|el| el.name === "Currency"}[0].children.text | ||
154 | - merch_obj.m_inspection_reqd = merch_el.children.select{|el| el.name === "MInspectionReqd"}[0].children.text | ||
155 | - merch_obj.inspected_received = merch_el.children.select{|el| el.name === "InspectedReceived"}[0].children.text | ||
156 | - merch_obj.stock_and_alt_um = merch_el.children.select{|el| el.name === "StockAndAltUm"}[0].children.text | ||
157 | - merch_obj.default_costing_method = merch_el.children.select{|el| el.name === "DefaultCostingMethod"}[0].children.text | ||
158 | - merch_obj.default_price = merch_el.children.select{|el| el.name === "DefaultPrice"}[0].children.text | ||
159 | - merch_obj.edit_default_price = merch_el.children.select{|el| el.name === "Edit_DefaultPrice"}[0].children.text | ||
160 | - merch_obj.default_prum = merch_el.children.select{|el| el.name === "DefaultPrum"}[0].children.text | ||
161 | - merch_obj.costing_methods_available = merch_el.children.select{|el| el.name === "CostingMethodsAvailable"}.map do |field_el_2| | ||
162 | - if field_el_2 && field_el_2.children.count > 0 | ||
163 | - Syspro::BusinessObjects::Models::PorDetail::CostingMethodsAvailable.new.tap do |avail_obj| | ||
164 | - avail_obj.manual_method_code = field_el_2.children.select{|el_2| el_2.name === "ManualMethodCode"}[0].children.text | ||
165 | - avail_obj.manual_method_desc = field_el_2.children.select{|el_2| el_2.name === "ManualMethodDesc"}[0].children.text | ||
166 | - avail_obj.manual_method_price = field_el_2.children.select{|el_2| el_2.name === "ManualMethodPrice"}[0].children.text | ||
167 | - avail_obj.edit__manual_method_price = field_el_2.children.select{|el_2| el_2.name === "Edit_ManualMethodPrice"}[0].children.text | ||
168 | - avail_obj.manual_method_costing_prum = field_el_2.children.select{|el_2| el_2.name === "ManualMethodCostingPrum"}[0].children.text | ||
169 | - avail_obj.total_cost_method_code = field_el_2.children.select{|el_2| el_2.name === "TotalCostMethodCode"}[0].children.text | ||
170 | - avail_obj.total_cost_method_desc = field_el_2.children.select{|el_2| el_2.name === "TotalCostMethodDesc"}[0].children.text | ||
171 | - avail_obj.total_cost_method_price = field_el_2.children.select{|el_2| el_2.name === "TotalCostMethodPrice"}[0].children.text | ||
172 | - avail_obj.edit__total_cost_method_price = field_el_2.children.select{|el_2| el_2.name === "Edit_TotalCostMethodPrice"}[0].children.text | ||
173 | - avail_obj.total_cost_costing_prum = field_el_2.children.select{|el_2| el_2.name === "TotalCostCostingPrum"}[0].children.text | ||
174 | - avail_obj.purchase_price_method_code = field_el_2.children.select{|el_2| el_2.name === "PurchasePriceMethodCode"}[0].children.text | ||
175 | - avail_obj.purchase_price_method_desc = field_el_2.children.select{|el_2| el_2.name === "PurchasePriceMethodDesc"}[0].children.text | ||
176 | - avail_obj.purchase_price_method_price = field_el_2.children.select{|el_2| el_2.name === "PurchasePriceMethodPrice"}[0].children.text | ||
177 | - avail_obj.edit__purchase_price_method_price = field_el_2.children.select{|el_2| el_2.name === "Edit_PurchasePriceMethodPrice"}[0].children.text | ||
178 | - avail_obj.purchase_price_costing_prum = field_el_2.children.select{|el_2| el_2.name === "PurchasePriceCostingPrum"}[0].children.text | ||
179 | - avail_obj.price_tax_method_code = field_el_2.children.select{|el_2| el_2.name === "PriceTaxMethodCode"}[0].children.text | ||
180 | - avail_obj.price_tax_method_desc = field_el_2.children.select{|el_2| el_2.name === "PriceTaxMethodDesc"}[0].children.text | ||
181 | - avail_obj.price_tax_method_price = field_el_2.children.select{|el_2| el_2.name === "PriceTaxMethodPrice"}[0].children.text | ||
182 | - avail_obj.edit__price_tax_method_price = field_el_2.children.select{|el_2| el_2.name === "Edit_PriceTaxMethodPrice"}[0].children.text | ||
183 | - avail_obj.price_tax_costing_prum = field_el_2.children.select{|el_2| el_2.name === "PriceTaxCostingPrum"}[0].children.text | ||
184 | - end | ||
185 | - end | ||
186 | - end.compact | ||
187 | - end | 85 | + por.purchase_order_line_merchandise = doc.first_element_child.xpath('PurchaseOrderLine').children.select { |item| item.name === 'Merchandise' }.map do |merch_el| |
86 | + next unless merch_el && merch_el.children.count > 0 | ||
87 | + Syspro::BusinessObjects::Models::PorDetail::Merchandise.new.tap do |merch_obj| | ||
88 | + merch_obj.line = merch_el.children.select { |el| el.name === 'Line' }[0].children.text | ||
89 | + merch_obj.line_type = merch_el.children.select { |el| el.name === 'LineType' }[0].children.text | ||
90 | + merch_obj.line_Type_description = merch_el.children.select { |el| el.name === 'LineTypeDescription' }[0].children.text | ||
91 | + merch_obj.m_stock_code = merch_el.children.select { |el| el.name === 'MStockCode' }[0].children.text | ||
92 | + merch_obj.m_stock_des = merch_el.children.select { |el| el.name === 'MStockDes' }[0].children.text | ||
93 | + merch_obj.long_desc = merch_el.children.select { |el| el.name === 'LongDesc' }[0].children.text | ||
94 | + merch_obj.traceable_type = merch_el.children.select { |el| el.name === 'TraceableType' }[0].children.text | ||
95 | + merch_obj.mass = merch_el.children.select { |el| el.name === 'Mass' }[0].children.text | ||
96 | + merch_obj.volume = merch_el.children.select { |el| el.name === 'Volume' }[0].children.text | ||
97 | + merch_obj.receipt_into_flag = merch_el.children.select { |el| el.name === 'ReceiptIntoFlag' }[0].children.text | ||
98 | + merch_obj.m_warehouse = merch_el.children.select { |el| el.name === 'MWarehouse' }[0].children.text | ||
99 | + merch_obj.m_warehouse_desc = merch_el.children.select { |el| el.name === 'MWarehouseDesc' }[0].children.text | ||
100 | + merch_obj.m_outstanding_qty = merch_el.children.select { |el| el.name === 'MOutstandingQty' }[0].children.text | ||
101 | + merch_obj.unedited__m_outstanding_qty = merch_el.children.select { |el| el.name === 'Unedited_MOutstandingQty' }[0].children.text | ||
102 | + merch_obj.m_order_qty = merch_el.children.select { |el| el.name === 'MOrderQty' }[0].children.text | ||
103 | + merch_obj.unedited__m_order_qty = merch_el.children.select { |el| el.name === 'Unedited_MOrderQty' }[0].children.text | ||
104 | + merch_obj.m_received_qty = merch_el.children.select { |el| el.name === 'MReceivedQty' }[0].children.text | ||
105 | + merch_obj.unedited__m_received_qty = merch_el.children.select { |el| el.name === 'Unedited_MReceivedQty' }[0].children.text | ||
106 | + merch_obj.m_order_uom = merch_el.children.select { |el| el.name === 'MOrderUom' }[0].children.text | ||
107 | + merch_obj.m_complete_flag = merch_el.children.select { |el| el.name === 'MCompleteFlag' }[0].children.text | ||
108 | + merch_obj.m_job = merch_el.children.select { |el| el.name === 'MJob' }[0].children.text | ||
109 | + merch_obj.include_in_mrp = merch_el.children.select { |el| el.name === 'IncludeInMrp' }[0].children.text | ||
110 | + merch_obj.m_price = merch_el.children.select { |el| el.name === 'MPrice' }[0].children.text | ||
111 | + merch_obj.edit_m_price = merch_el.children.select { |el| el.name === 'Edit_MPrice' }[0].children.text | ||
112 | + merch_obj.order_value = merch_el.children.select { |el| el.name === 'OrderValue' }[0].children.text | ||
113 | + merch_obj.m_disc_pct1 = merch_el.children.select { |el| el.name === 'MDiscPct1' }[0].children.text | ||
114 | + merch_obj.m_disc_pct2 = merch_el.children.select { |el| el.name === 'MDiscPct2' }[0].children.text | ||
115 | + merch_obj.m_disc_pct3 = merch_el.children.select { |el| el.name === 'MDiscPct3' }[0].children.text | ||
116 | + merch_obj.m_disc_value = merch_el.children.select { |el| el.name === 'MDiscValue' }[0].children.text | ||
117 | + merch_obj.m_disc_val_flag = merch_el.children.select { |el| el.name === 'MDiscValFlag' }[0].children.text | ||
118 | + merch_obj.m_price_uom = merch_el.children.select { |el| el.name === 'MPriceUom' }[0].children.text | ||
119 | + merch_obj.m_latest_due_date = merch_el.children.select { |el| el.name === 'MLatestDueDate' }[0].children.text | ||
120 | + merch_obj.m_sup_catalogue = merch_el.children.select { |el| el.name === 'MSupCatalogue' }[0].children.text | ||
121 | + merch_obj.m_product_class = merch_el.children.select { |el| el.name === 'MProductClass' }[0].children.text | ||
122 | + merch_obj.m_product_class_description = merch_el.children.select { |el| el.name === 'MProductClassDescription' }[0].children.text | ||
123 | + merch_obj.m_stocking_uom = merch_el.children.select { |el| el.name === 'MStockingUom' }[0].children.text | ||
124 | + merch_obj.m_decimals_to_prt = merch_el.children.select { |el| el.name === 'MDecimalsToPrt' }[0].children.text | ||
125 | + merch_obj.m_conv_fact_prc_um = merch_el.children.select { |el| el.name === 'MConvFactPrcUm' }[0].children.text | ||
126 | + merch_obj.m_mul_div_prc = merch_el.children.select { |el| el.name === 'MMulDivPrc' }[0].children.text | ||
127 | + merch_obj.m_tax_code = merch_el.children.select { |el| el.name === 'MTaxCode' }[0].children.text | ||
128 | + merch_obj.m_tax_code_description = merch_el.children.select { |el| el.name === 'MTaxCodeDescription' }[0].children.text | ||
129 | + merch_obj.m_conv_fact_ord_um = merch_el.children.select { |el| el.name === 'MConvFactOrdUm' }[0].children.text | ||
130 | + merch_obj.m_mul_div_alloc = merch_el.children.select { |el| el.name === 'MMulDivAlloc' }[0].children.text | ||
131 | + merch_obj.m_gl_code = merch_el.children.select { |el| el.name === 'MGlCode' }[0].children.text | ||
132 | + merch_obj.m_gl_code_description = merch_el.children.select { |el| el.name === 'MGlCodeDescription' }[0].children.text | ||
133 | + merch_obj.m_orig_due_date = merch_el.children.select { |el| el.name === 'MOrigDueDate' }[0].children.text | ||
134 | + merch_obj.m_lct_confirmed = merch_el.children.select { |el| el.name === 'MLctConfirmed' }[0].children.text | ||
135 | + merch_obj.m_subcontract_op = merch_el.children.select { |el| el.name === 'MSubcontractOp' }[0].children.text | ||
136 | + merch_obj.m_version = merch_el.children.select { |el| el.name === 'MVersion' }[0].children.text | ||
137 | + merch_obj.m_release = merch_el.children.select { |el| el.name === 'MRelease' }[0].children.text | ||
138 | + merch_obj.asset_flag = merch_el.children.select { |el| el.name === 'AssetFlag' }[0].children.text | ||
139 | + merch_obj.capex_code = merch_el.children.select { |el| el.name === 'CapexCode' }[0].children.text | ||
140 | + merch_obj.asset_capex_line = merch_el.children.select { |el| el.name === 'AssetCapexLine' }[0].children.text | ||
141 | + merch_obj.discount = merch_el.children.select { |el| el.name === 'Discount' }[0].children.text | ||
142 | + merch_obj.last_receipt = merch_el.children.select { |el| el.name === 'LastReceipt' }[0].children.text | ||
143 | + merch_obj.ledger = merch_el.children.select { |el| el.name === 'Ledger' }[0].children.text | ||
144 | + merch_obj.requisition_line = merch_el.children.select { |el| el.name === 'RequisitionLine' }[0].children.text | ||
145 | + merch_obj.requisition_no = merch_el.children.select { |el| el.name === 'RequisitionNo' }[0].children.text | ||
146 | + merch_obj.requisition_user = merch_el.children.select { |el| el.name === 'RequisitionUser' }[0].children.text | ||
147 | + merch_obj.reschedule = merch_el.children.select { |el| el.name === 'Reschedule' }[0].children.text | ||
148 | + merch_obj.rev = merch_el.children.select { |el| el.name === 'Rev' }[0].children.text | ||
149 | + merch_obj.release = merch_el.children.select { |el| el.name === 'Release' }[0].children.text | ||
150 | + merch_obj.selection_code = merch_el.children.select { |el| el.name === 'SelectionCode' }[0].children.text | ||
151 | + merch_obj.selection_type = merch_el.children.select { |el| el.name === 'SelectionType' }[0].children.text | ||
152 | + merch_obj.currency = merch_el.children.select { |el| el.name === 'Currency' }[0].children.text | ||
153 | + merch_obj.m_inspection_reqd = merch_el.children.select { |el| el.name === 'MInspectionReqd' }[0].children.text | ||
154 | + merch_obj.inspected_received = merch_el.children.select { |el| el.name === 'InspectedReceived' }[0].children.text | ||
155 | + merch_obj.stock_and_alt_um = merch_el.children.select { |el| el.name === 'StockAndAltUm' }[0].children.text | ||
156 | + merch_obj.default_costing_method = merch_el.children.select { |el| el.name === 'DefaultCostingMethod' }[0].children.text | ||
157 | + merch_obj.default_price = merch_el.children.select { |el| el.name === 'DefaultPrice' }[0].children.text | ||
158 | + merch_obj.edit_default_price = merch_el.children.select { |el| el.name === 'Edit_DefaultPrice' }[0].children.text | ||
159 | + merch_obj.default_prum = merch_el.children.select { |el| el.name === 'DefaultPrum' }[0].children.text | ||
160 | + merch_obj.costing_methods_available = merch_el.children.select { |el| el.name === 'CostingMethodsAvailable' }.map do |field_el_2| | ||
161 | + next unless field_el_2 && field_el_2.children.count > 0 | ||
162 | + Syspro::BusinessObjects::Models::PorDetail::CostingMethodsAvailable.new.tap do |avail_obj| | ||
163 | + avail_obj.manual_method_code = field_el_2.children.select { |el_2| el_2.name === 'ManualMethodCode' }[0].children.text | ||
164 | + avail_obj.manual_method_desc = field_el_2.children.select { |el_2| el_2.name === 'ManualMethodDesc' }[0].children.text | ||
165 | + avail_obj.manual_method_price = field_el_2.children.select { |el_2| el_2.name === 'ManualMethodPrice' }[0].children.text | ||
166 | + avail_obj.edit__manual_method_price = field_el_2.children.select { |el_2| el_2.name === 'Edit_ManualMethodPrice' }[0].children.text | ||
167 | + avail_obj.manual_method_costing_prum = field_el_2.children.select { |el_2| el_2.name === 'ManualMethodCostingPrum' }[0].children.text | ||
168 | + avail_obj.total_cost_method_code = field_el_2.children.select { |el_2| el_2.name === 'TotalCostMethodCode' }[0].children.text | ||
169 | + avail_obj.total_cost_method_desc = field_el_2.children.select { |el_2| el_2.name === 'TotalCostMethodDesc' }[0].children.text | ||
170 | + avail_obj.total_cost_method_price = field_el_2.children.select { |el_2| el_2.name === 'TotalCostMethodPrice' }[0].children.text | ||
171 | + avail_obj.edit__total_cost_method_price = field_el_2.children.select { |el_2| el_2.name === 'Edit_TotalCostMethodPrice' }[0].children.text | ||
172 | + avail_obj.total_cost_costing_prum = field_el_2.children.select { |el_2| el_2.name === 'TotalCostCostingPrum' }[0].children.text | ||
173 | + avail_obj.purchase_price_method_code = field_el_2.children.select { |el_2| el_2.name === 'PurchasePriceMethodCode' }[0].children.text | ||
174 | + avail_obj.purchase_price_method_desc = field_el_2.children.select { |el_2| el_2.name === 'PurchasePriceMethodDesc' }[0].children.text | ||
175 | + avail_obj.purchase_price_method_price = field_el_2.children.select { |el_2| el_2.name === 'PurchasePriceMethodPrice' }[0].children.text | ||
176 | + avail_obj.edit__purchase_price_method_price = field_el_2.children.select { |el_2| el_2.name === 'Edit_PurchasePriceMethodPrice' }[0].children.text | ||
177 | + avail_obj.purchase_price_costing_prum = field_el_2.children.select { |el_2| el_2.name === 'PurchasePriceCostingPrum' }[0].children.text | ||
178 | + avail_obj.price_tax_method_code = field_el_2.children.select { |el_2| el_2.name === 'PriceTaxMethodCode' }[0].children.text | ||
179 | + avail_obj.price_tax_method_desc = field_el_2.children.select { |el_2| el_2.name === 'PriceTaxMethodDesc' }[0].children.text | ||
180 | + avail_obj.price_tax_method_price = field_el_2.children.select { |el_2| el_2.name === 'PriceTaxMethodPrice' }[0].children.text | ||
181 | + avail_obj.edit__price_tax_method_price = field_el_2.children.select { |el_2| el_2.name === 'Edit_PriceTaxMethodPrice' }[0].children.text | ||
182 | + avail_obj.price_tax_costing_prum = field_el_2.children.select { |el_2| el_2.name === 'PriceTaxCostingPrum' }[0].children.text | ||
183 | + end | ||
184 | + end.compact | ||
188 | end | 185 | end |
189 | end.compact | 186 | end.compact |
190 | 187 | ||
191 | - por.purchase_order_totals = doc.first_element_child.xpath("PurchaseOrderTotals").map do |total_el| | 188 | + por.purchase_order_totals = doc.first_element_child.xpath('PurchaseOrderTotals').map do |total_el| |
192 | Syspro::BusinessObjects::Models::PorDetail::PurchaseOrderTotals.new.tap do |total_obj| | 189 | Syspro::BusinessObjects::Models::PorDetail::PurchaseOrderTotals.new.tap do |total_obj| |
193 | - | ||
194 | - total_obj.local_values = total_el.children.select{|el| el.name === "LocalValues"}.map do |loc_val_el| | 190 | + total_obj.local_values = total_el.children.select { |el| el.name === 'LocalValues' }.map do |loc_val_el| |
195 | Syspro::BusinessObjects::Models::PorDetail::PurchaseOrderTotalsLocalValues.new.tap do |loc_obj| | 191 | Syspro::BusinessObjects::Models::PorDetail::PurchaseOrderTotalsLocalValues.new.tap do |loc_obj| |
196 | - loc_obj.local_order_value = loc_val_el.children.select{|el_2| el_2.name === "LocalOrderValue"}[0].text | ||
197 | - loc_obj.local_received_to_date_value = loc_val_el.children.select{|el_2| el_2.name === "LocalReceivedToDateValue"}[0].text | ||
198 | - loc_obj.local_outstanding_value = loc_val_el.children.select{|el_2| el_2.name === "LocalOutstandingValue"}[0].text | ||
199 | - loc_obj.edited_local_order_value = loc_val_el.children.select{|el_2| el_2.name === "Edited_LocalOrderValue"}[0].text | ||
200 | - loc_obj.edited_local_received_to_date_value = loc_val_el.children.select{|el_2| el_2.name === "Edited_LocalReceivedToDateValue"}[0].text | ||
201 | - loc_obj.edited_local_outstanding_value = loc_val_el.children.select{|el_2| el_2.name === "Edited_LocalOutstandingValue"}[0].text | 192 | + loc_obj.local_order_value = loc_val_el.children.select { |el_2| el_2.name === 'LocalOrderValue' }[0].text |
193 | + loc_obj.local_received_to_date_value = loc_val_el.children.select { |el_2| el_2.name === 'LocalReceivedToDateValue' }[0].text | ||
194 | + loc_obj.local_outstanding_value = loc_val_el.children.select { |el_2| el_2.name === 'LocalOutstandingValue' }[0].text | ||
195 | + loc_obj.edited_local_order_value = loc_val_el.children.select { |el_2| el_2.name === 'Edited_LocalOrderValue' }[0].text | ||
196 | + loc_obj.edited_local_received_to_date_value = loc_val_el.children.select { |el_2| el_2.name === 'Edited_LocalReceivedToDateValue' }[0].text | ||
197 | + loc_obj.edited_local_outstanding_value = loc_val_el.children.select { |el_2| el_2.name === 'Edited_LocalOutstandingValue' }[0].text | ||
202 | end | 198 | end |
203 | end | 199 | end |
204 | 200 | ||
205 | - total_obj.current_values = total_el.children.select{|el| el.name === "CurrentValues"}.map do |cur_val_el| | 201 | + total_obj.current_values = total_el.children.select { |el| el.name === 'CurrentValues' }.map do |cur_val_el| |
206 | Syspro::BusinessObjects::Models::PorDetail::PurchaseOrderTotalsCurrentValues.new.tap do |cur_obj| | 202 | Syspro::BusinessObjects::Models::PorDetail::PurchaseOrderTotalsCurrentValues.new.tap do |cur_obj| |
207 | - cur_obj.current_order_value = cur_val_el.children.select{|el_2| el_2.name === "CurrentOrderValue"}[0].text | ||
208 | - cur_obj.current_received_to_date_value = cur_val_el.children.select{|el_2| el_2.name === "CurrentReceivedToDateValue"}[0].text | ||
209 | - cur_obj.current_outstanding_value = cur_val_el.children.select{|el_2| el_2.name === "CurrentOutstandingValue"}[0].text | ||
210 | - cur_obj.edited_current_order_value = cur_val_el.children.select{|el_2| el_2.name === "Edited_CurrentOrderValue"}[0].text | ||
211 | - cur_obj.edited_current_received_to_date_value = cur_val_el.children.select{|el_2| el_2.name === "Edited_CurrentReceivedToDateValue"}[0].text | ||
212 | - cur_obj.edited_current_outstanding_value = cur_val_el.children.select{|el_2| el_2.name === "Edited_CurrentOutstandingValue"}[0].text | 203 | + cur_obj.current_order_value = cur_val_el.children.select { |el_2| el_2.name === 'CurrentOrderValue' }[0].text |
204 | + cur_obj.current_received_to_date_value = cur_val_el.children.select { |el_2| el_2.name === 'CurrentReceivedToDateValue' }[0].text | ||
205 | + cur_obj.current_outstanding_value = cur_val_el.children.select { |el_2| el_2.name === 'CurrentOutstandingValue' }[0].text | ||
206 | + cur_obj.edited_current_order_value = cur_val_el.children.select { |el_2| el_2.name === 'Edited_CurrentOrderValue' }[0].text | ||
207 | + cur_obj.edited_current_received_to_date_value = cur_val_el.children.select { |el_2| el_2.name === 'Edited_CurrentReceivedToDateValue' }[0].text | ||
208 | + cur_obj.edited_current_outstanding_value = cur_val_el.children.select { |el_2| el_2.name === 'Edited_CurrentOutstandingValue' }[0].text | ||
213 | end | 209 | end |
214 | end | 210 | end |
215 | 211 | ||
216 | - total_obj.first_receipt_date = total_el.children.select{|el| el.name === "FirstReceiptDate"}[0].text | ||
217 | - total_obj.order_complete_date = total_el.children.select{|el| el.name === "OrderCompleteDate"}[0].text | 212 | + total_obj.first_receipt_date = total_el.children.select { |el| el.name === 'FirstReceiptDate' }[0].text |
213 | + total_obj.order_complete_date = total_el.children.select { |el| el.name === 'OrderCompleteDate' }[0].text | ||
218 | end | 214 | end |
219 | end.compact | 215 | end.compact |
220 | 216 |
lib/syspro/business_objects/parsers/portii_parser.rb
@@ -12,10 +12,10 @@ module Syspro | @@ -12,10 +12,10 @@ module Syspro | ||
12 | 12 | ||
13 | def parse | 13 | def parse |
14 | { | 14 | { |
15 | - error_numbers: doc.xpath("//ErrorNumber").map{|e| e.text}, | ||
16 | - grn_numbers: doc.xpath("//Item/Key/GRNNumber").map{|e| e.text}, | ||
17 | - items_processed: doc.xpath("//StatusOfItems/ItemsProcessed").first.text, | ||
18 | - items_invalid: doc.xpath("//StatusOfItems/ItemsInvalid").first.text | 15 | + error_numbers: doc.xpath('//ErrorNumber').map(&:text), |
16 | + grn_numbers: doc.xpath('//Item/Key/GRNNumber').map(&:text), | ||
17 | + items_processed: doc.xpath('//StatusOfItems/ItemsProcessed').first.text, | ||
18 | + items_invalid: doc.xpath('//StatusOfItems/ItemsInvalid').first.text | ||
19 | } | 19 | } |
20 | end | 20 | end |
21 | 21 | ||
@@ -24,4 +24,3 @@ module Syspro | @@ -24,4 +24,3 @@ module Syspro | ||
24 | end | 24 | end |
25 | end | 25 | end |
26 | end | 26 | end |
27 | - |
lib/syspro/business_objects/parsers/portoi_parser.rb
@@ -11,15 +11,15 @@ module Syspro | @@ -11,15 +11,15 @@ module Syspro | ||
11 | end | 11 | end |
12 | 12 | ||
13 | def parse | 13 | def parse |
14 | - po = Syspro::BusinessObjects::Models::PurchaseOrder.new() | ||
15 | - | ||
16 | - po.error_numbers = doc.xpath("//ErrorNumber").map{|e| e.text} | 14 | + po = Syspro::BusinessObjects::Models::PurchaseOrder.new |
15 | + | ||
16 | + po.error_numbers = doc.xpath('//ErrorNumber').map(&:text) | ||
17 | 17 | ||
18 | po.purchase_order = doc.first_element_child.xpath('Order/Key/PurchaseOrder').text | 18 | po.purchase_order = doc.first_element_child.xpath('Order/Key/PurchaseOrder').text |
19 | po.item_number = doc.first_element_child.xpath('Order/ItemNumber').text | 19 | po.item_number = doc.first_element_child.xpath('Order/ItemNumber').text |
20 | po.order_action_type = doc.first_element_child.xpath('Order/OrderActionType').text | 20 | po.order_action_type = doc.first_element_child.xpath('Order/OrderActionType').text |
21 | po.supplier = doc.first_element_child.xpath('Order/Supplier').text | 21 | po.supplier = doc.first_element_child.xpath('Order/Supplier').text |
22 | - | 22 | + |
23 | po | 23 | po |
24 | end | 24 | end |
25 | 25 | ||
@@ -28,4 +28,3 @@ module Syspro | @@ -28,4 +28,3 @@ module Syspro | ||
28 | end | 28 | end |
29 | end | 29 | end |
30 | end | 30 | end |
31 | - |
lib/syspro/business_objects/parsers/portor_parser.rb
@@ -11,7 +11,7 @@ module Syspro | @@ -11,7 +11,7 @@ module Syspro | ||
11 | end | 11 | end |
12 | 12 | ||
13 | def parse | 13 | def parse |
14 | - error_numbers = doc.xpath("//ErrorNumber").map{|e| e.text} | 14 | + error_numbers = doc.xpath('//ErrorNumber').map(&:text) |
15 | 15 | ||
16 | gl_journal = doc.first_element_child.xpath('GlJournal') | 16 | gl_journal = doc.first_element_child.xpath('GlJournal') |
17 | gl_journal_obj = gl_journal.children.map do |el| | 17 | gl_journal_obj = gl_journal.children.map do |el| |
@@ -34,7 +34,7 @@ module Syspro | @@ -34,7 +34,7 @@ module Syspro | ||
34 | receipts_obj = receipts.flat_map do |el| | 34 | receipts_obj = receipts.flat_map do |el| |
35 | el.elements.map do |inner| | 35 | el.elements.map do |inner| |
36 | [inner.name, | 36 | [inner.name, |
37 | - inner.value] | 37 | + inner.value] |
38 | end | 38 | end |
39 | end.compact.to_h | 39 | end.compact.to_h |
40 | 40 | ||
@@ -47,7 +47,7 @@ module Syspro | @@ -47,7 +47,7 @@ module Syspro | ||
47 | ) | 47 | ) |
48 | end | 48 | end |
49 | 49 | ||
50 | - grns = doc.xpath("//Grn").map{|e| e.text} | 50 | + grns = doc.xpath('//Grn').map(&:text) |
51 | 51 | ||
52 | { | 52 | { |
53 | error_numbers: error_numbers, | 53 | error_numbers: error_numbers, |
@@ -60,4 +60,3 @@ module Syspro | @@ -60,4 +60,3 @@ module Syspro | ||
60 | end | 60 | end |
61 | end | 61 | end |
62 | end | 62 | end |
63 | - |
lib/syspro/business_objects/parsers/sorqry_parser.rb
@@ -12,115 +12,115 @@ module Syspro | @@ -12,115 +12,115 @@ module Syspro | ||
12 | end | 12 | end |
13 | 13 | ||
14 | def parse | 14 | def parse |
15 | - sor = Syspro::BusinessObjects::Models::SorDetail.new() | ||
16 | - sor.sales_order = doc.first_element_child.xpath("SalesOrder").text | ||
17 | - sor.document_type = doc.first_element_child.xpath("DocumentType").text | ||
18 | - sor.document_type_desc = doc.first_element_child.xpath("DocumentTypeDesc").text | ||
19 | - sor.inter_branch_transfer = doc.first_element_child.xpath("InterBranchTransfer").text | ||
20 | - sor.inter_wh_sale = doc.first_element_child.xpath("InterWhSale").text | ||
21 | - sor.source_warehouse = doc.first_element_child.xpath("SourceWarehouse").text | ||
22 | - sor.target_warehouse = doc.first_element_child.xpath("TargetWarehouse").text | ||
23 | - sor.gtr_reference = doc.first_element_child.xpath("GtrReference").text | ||
24 | - sor.customer = doc.first_element_child.xpath("Customer").text | ||
25 | - sor.customer_name = doc.first_element_child.xpath("CustomerName").text | ||
26 | - sor.tax_status_code = doc.first_element_child.xpath("TaxStatusCode").text | ||
27 | - sor.tax_status = doc.first_element_child.xpath("TaxStatus").text | ||
28 | - sor.gst_tax_status_code = doc.first_element_child.xpath("GstTaxStatusCode").text | ||
29 | - sor.gst_tax_status = doc.first_element_child.xpath("GstTaxStatus").text | ||
30 | - sor.eu_flag = doc.first_element_child.xpath("EuFlag").text | ||
31 | - sor.eu_flag_desc = doc.first_element_child.xpath("EuFlagDesc").text | ||
32 | - sor.sold_to_name = doc.first_element_child.xpath("SoldToName").text | ||
33 | - sor.sold_addr_1 = doc.first_element_child.xpath("SoldAddr1").text | ||
34 | - sor.sold_addr_2 = doc.first_element_child.xpath("SoldAddr2").text | ||
35 | - sor.sold_addr_3 = doc.first_element_child.xpath("SoldAddr3").text | ||
36 | - sor.sold_addr_3_locality = doc.first_element_child.xpath("SoldAddr3Locality").text | ||
37 | - sor.sold_addr_4 = doc.first_element_child.xpath("SoldAddr4").text | ||
38 | - sor.sold_addr_5 = doc.first_element_child.xpath("SoldAddr5").text | ||
39 | - sor.sold_postal_code = doc.first_element_child.xpath("SoldPostalCode").text | ||
40 | - sor.sold_gps_lat = doc.first_element_child.xpath("SoldGpsLat").text | ||
41 | - sor.sold_gps_long = doc.first_element_child.xpath("SoldGpsLong").text | ||
42 | - sor.salesperson = doc.first_element_child.xpath("Salesperson").text | ||
43 | - sor.scheduled_ord_flag = doc.first_element_child.xpath("ScheduledOrdFlag").text | ||
44 | - sor.disc_pct_1 = doc.first_element_child.xpath("DiscPct1").text | ||
45 | - sor.disc_pct_2 = doc.first_element_child.xpath("DiscPct2").text | ||
46 | - sor.disc_pct_3 = doc.first_element_child.xpath("DiscPct3").text | 15 | + sor = Syspro::BusinessObjects::Models::SorDetail.new |
16 | + sor.sales_order = doc.first_element_child.xpath('SalesOrder').text | ||
17 | + sor.document_type = doc.first_element_child.xpath('DocumentType').text | ||
18 | + sor.document_type_desc = doc.first_element_child.xpath('DocumentTypeDesc').text | ||
19 | + sor.inter_branch_transfer = doc.first_element_child.xpath('InterBranchTransfer').text | ||
20 | + sor.inter_wh_sale = doc.first_element_child.xpath('InterWhSale').text | ||
21 | + sor.source_warehouse = doc.first_element_child.xpath('SourceWarehouse').text | ||
22 | + sor.target_warehouse = doc.first_element_child.xpath('TargetWarehouse').text | ||
23 | + sor.gtr_reference = doc.first_element_child.xpath('GtrReference').text | ||
24 | + sor.customer = doc.first_element_child.xpath('Customer').text | ||
25 | + sor.customer_name = doc.first_element_child.xpath('CustomerName').text | ||
26 | + sor.tax_status_code = doc.first_element_child.xpath('TaxStatusCode').text | ||
27 | + sor.tax_status = doc.first_element_child.xpath('TaxStatus').text | ||
28 | + sor.gst_tax_status_code = doc.first_element_child.xpath('GstTaxStatusCode').text | ||
29 | + sor.gst_tax_status = doc.first_element_child.xpath('GstTaxStatus').text | ||
30 | + sor.eu_flag = doc.first_element_child.xpath('EuFlag').text | ||
31 | + sor.eu_flag_desc = doc.first_element_child.xpath('EuFlagDesc').text | ||
32 | + sor.sold_to_name = doc.first_element_child.xpath('SoldToName').text | ||
33 | + sor.sold_addr_1 = doc.first_element_child.xpath('SoldAddr1').text | ||
34 | + sor.sold_addr_2 = doc.first_element_child.xpath('SoldAddr2').text | ||
35 | + sor.sold_addr_3 = doc.first_element_child.xpath('SoldAddr3').text | ||
36 | + sor.sold_addr_3_locality = doc.first_element_child.xpath('SoldAddr3Locality').text | ||
37 | + sor.sold_addr_4 = doc.first_element_child.xpath('SoldAddr4').text | ||
38 | + sor.sold_addr_5 = doc.first_element_child.xpath('SoldAddr5').text | ||
39 | + sor.sold_postal_code = doc.first_element_child.xpath('SoldPostalCode').text | ||
40 | + sor.sold_gps_lat = doc.first_element_child.xpath('SoldGpsLat').text | ||
41 | + sor.sold_gps_long = doc.first_element_child.xpath('SoldGpsLong').text | ||
42 | + sor.salesperson = doc.first_element_child.xpath('Salesperson').text | ||
43 | + sor.scheduled_ord_flag = doc.first_element_child.xpath('ScheduledOrdFlag').text | ||
44 | + sor.disc_pct_1 = doc.first_element_child.xpath('DiscPct1').text | ||
45 | + sor.disc_pct_2 = doc.first_element_child.xpath('DiscPct2').text | ||
46 | + sor.disc_pct_3 = doc.first_element_child.xpath('DiscPct3').text | ||
47 | sor.salsls_name = doc.first_element_child.at_xpath('//SALSLS:Name').children.text | 47 | sor.salsls_name = doc.first_element_child.at_xpath('//SALSLS:Name').children.text |
48 | - sor.order_status = doc.first_element_child.xpath("OrderStatus").text | ||
49 | - sor.order_status_desc = doc.first_element_child.xpath("OrderStatusDesc").text | ||
50 | - sor.customer_po_number = doc.first_element_child.xpath("CustomerPoNumber").text | ||
51 | - sor.order_date = doc.first_element_child.xpath("OrderDate").text | ||
52 | - sor.git_reference = doc.first_element_child.xpath("GITReference").text | ||
53 | - sor.req_ship_date = doc.first_element_child.xpath("ReqShipDate").text | ||
54 | - sor.shipping_instrs = doc.first_element_child.xpath("ShippingInstrs").text | ||
55 | - sor.shipping_instrs_cod = doc.first_element_child.xpath("ShippingInstrsCod").text | ||
56 | - sor.special_instrs = doc.first_element_child.xpath("SpecialInstrs").text | ||
57 | - sor.inv_terms_override = doc.first_element_child.xpath("InvTermsOverride").text | ||
58 | - sor.delivery_note = doc.first_element_child.xpath("DeliveryNote").text | ||
59 | - sor.last_del_note = doc.first_element_child.xpath("LastDelNote").text | ||
60 | - sor.time_del_prted_hh = doc.first_element_child.xpath("TimeDelPrtedHh").text | ||
61 | - sor.time_del_prted_mm = doc.first_element_child.xpath("TimeDelPrtedMm").text | ||
62 | - sor.last_invoice = doc.first_element_child.xpath("LastInvoice").text | ||
63 | - sor.date_last_inv_prt = doc.first_element_child.xpath("DateLastInvPrt").text | ||
64 | - sor.time_inv_prt_hh = doc.first_element_child.xpath("TimeInvPrtHh").text | ||
65 | - sor.time_inv_prt_mm = doc.first_element_child.xpath("TimeInvPrtMm").text | ||
66 | - sor.tblart_description = doc.first_element_child.xpath("//TBLART:Description").children.text | ||
67 | - sor.branch = doc.first_element_child.xpath("Branch").text | ||
68 | - sor.salbrn_description = doc.first_element_child.xpath("//SALBRN:Description").children.text | ||
69 | - sor.ent_invoice = doc.first_element_child.xpath("EntInvoice").text | ||
70 | - sor.order_type = doc.first_element_child.xpath("OrderType").text | ||
71 | - sor.area = doc.first_element_child.xpath("Area").text | ||
72 | - sor.salare_description = doc.first_element_child.xpath("//SALARE:Description").children.text | ||
73 | - sor.tax_exempt_number = doc.first_element_child.xpath("TaxExemptNumber").text | ||
74 | - sor.gst_exempt_number = doc.first_element_child.xpath("GstExemptNumber").text | ||
75 | - sor.currency = doc.first_element_child.xpath("Currency").text | ||
76 | - sor.tblcur_description = doc.first_element_child.xpath("//TBLCUR:Description").children.text | ||
77 | - sor.ship_address_1 = doc.first_element_child.xpath("ShipAddress1").text | ||
78 | - sor.ship_address_2 = doc.first_element_child.xpath("ShipAddress2").text | ||
79 | - sor.ship_address_3 = doc.first_element_child.xpath("ShipAddress3").text | ||
80 | - sor.ship_address_3_locality = doc.first_element_child.xpath("ShipAddress3Locality").text | ||
81 | - sor.ship_address_4 = doc.first_element_child.xpath("ShipAddress4").text | ||
82 | - sor.ship_address_5 = doc.first_element_child.xpath("ShipAddress5").text | ||
83 | - sor.ship_postal_code = doc.first_element_child.xpath("ShipPostalCode").text | ||
84 | - sor.ship_gps_lat = doc.first_element_child.xpath("ShipGpsLat").text | ||
85 | - sor.ship_gps_long = doc.first_element_child.xpath("ShipGpsLong").text | ||
86 | - sor.ship_complete = doc.first_element_child.xpath("ShipComplete").text | ||
87 | - sor.email = doc.first_element_child.xpath("Email").text | ||
88 | - sor.fix_exchange_rate = doc.first_element_child.xpath("FixExchangeRate").text | ||
89 | - sor.exchange_rate = doc.first_element_child.xpath("ExchangeRate").text | ||
90 | - sor.edited_exchange_rate = doc.first_element_child.xpath("EditedExchangeRate").text | ||
91 | - sor.mul_div = doc.first_element_child.xpath("MulDiv").text | ||
92 | - sor.consolidated_order = doc.first_element_child.xpath("ConsolidatedOrder").text | ||
93 | - sor.gst_deduction = doc.first_element_child.xpath("GstDeduction").text | ||
94 | - sor.credited_inv_date = doc.first_element_child.xpath("CreditedInvDate").text | ||
95 | - sor.job = doc.first_element_child.xpath("Job").text | ||
96 | - sor.serialized_flag = doc.first_element_child.xpath("SerializedFlag").text | ||
97 | - sor.counter_sales_flag = doc.first_element_child.xpath("CounterSalesFlag").text | ||
98 | - sor.nationality = doc.first_element_child.xpath("Nationality").text | ||
99 | - sor.delivery_terms = doc.first_element_child.xpath("DeliveryTerms").text | ||
100 | - sor.shipping_location = doc.first_element_child.xpath("ShippingLocation").text | ||
101 | - sor.transaction_nature = doc.first_element_child.xpath("TransactionNature").text | ||
102 | - sor.transport_mode = doc.first_element_child.xpath("TransportMode").text | ||
103 | - sor.process_flag = doc.first_element_child.xpath("ProcessFlag").text | ||
104 | - sor.jobs_exist_flag = doc.first_element_child.xpath("JobsExistFlag").text | ||
105 | - sor.alternate_key = doc.first_element_child.xpath("AlternateKey").text | ||
106 | - sor.hierarchy_flag = doc.first_element_child.xpath("HierarchyFlag").text | ||
107 | - sor.deposit_flag = doc.first_element_child.xpath("DepositFlag").text | ||
108 | - sor.edi_source = doc.first_element_child.xpath("EdiSource").text | ||
109 | - sor.mult_ship_code = doc.first_element_child.xpath("MultShipCode").text | ||
110 | - sor.company_tax_no = doc.first_element_child.xpath("CompanyTaxNo").text | ||
111 | - sor.last_operator = doc.first_element_child.xpath("LastOperator").text | ||
112 | - sor.operator = doc.first_element_child.xpath("Operator").text | ||
113 | - sor.state = doc.first_element_child.xpath("State").text | ||
114 | - sor.county_zip = doc.first_element_child.xpath("CountyZip").text | ||
115 | - sor.extended_tax_code = doc.first_element_child.xpath("ExtendedTaxCode").text | ||
116 | - sor.web_created = doc.first_element_child.xpath("WebCreated").text | ||
117 | - sor.quote = doc.first_element_child.xpath("Quote").text | ||
118 | - sor.dispatches_made = doc.first_element_child.xpath("DispatchesMade").text | ||
119 | - sor.live_disp_exist = doc.first_element_child.xpath("LiveDispExist").text | ||
120 | - sor.num_dispatches = doc.first_element_child.xpath("NumDispatches").text | ||
121 | - sor.include_in_mrp = doc.first_element_child.xpath("IncludeInMrp").text | ||
122 | - sor.header_text = doc.first_element_child.xpath("HeaderText").text | ||
123 | - sor.header_notes = doc.first_element_child.xpath("HeaderNotes").text | 48 | + sor.order_status = doc.first_element_child.xpath('OrderStatus').text |
49 | + sor.order_status_desc = doc.first_element_child.xpath('OrderStatusDesc').text | ||
50 | + sor.customer_po_number = doc.first_element_child.xpath('CustomerPoNumber').text | ||
51 | + sor.order_date = doc.first_element_child.xpath('OrderDate').text | ||
52 | + sor.git_reference = doc.first_element_child.xpath('GITReference').text | ||
53 | + sor.req_ship_date = doc.first_element_child.xpath('ReqShipDate').text | ||
54 | + sor.shipping_instrs = doc.first_element_child.xpath('ShippingInstrs').text | ||
55 | + sor.shipping_instrs_cod = doc.first_element_child.xpath('ShippingInstrsCod').text | ||
56 | + sor.special_instrs = doc.first_element_child.xpath('SpecialInstrs').text | ||
57 | + sor.inv_terms_override = doc.first_element_child.xpath('InvTermsOverride').text | ||
58 | + sor.delivery_note = doc.first_element_child.xpath('DeliveryNote').text | ||
59 | + sor.last_del_note = doc.first_element_child.xpath('LastDelNote').text | ||
60 | + sor.time_del_prted_hh = doc.first_element_child.xpath('TimeDelPrtedHh').text | ||
61 | + sor.time_del_prted_mm = doc.first_element_child.xpath('TimeDelPrtedMm').text | ||
62 | + sor.last_invoice = doc.first_element_child.xpath('LastInvoice').text | ||
63 | + sor.date_last_inv_prt = doc.first_element_child.xpath('DateLastInvPrt').text | ||
64 | + sor.time_inv_prt_hh = doc.first_element_child.xpath('TimeInvPrtHh').text | ||
65 | + sor.time_inv_prt_mm = doc.first_element_child.xpath('TimeInvPrtMm').text | ||
66 | + sor.tblart_description = doc.first_element_child.xpath('//TBLART:Description').children.text | ||
67 | + sor.branch = doc.first_element_child.xpath('Branch').text | ||
68 | + sor.salbrn_description = doc.first_element_child.xpath('//SALBRN:Description').children.text | ||
69 | + sor.ent_invoice = doc.first_element_child.xpath('EntInvoice').text | ||
70 | + sor.order_type = doc.first_element_child.xpath('OrderType').text | ||
71 | + sor.area = doc.first_element_child.xpath('Area').text | ||
72 | + sor.salare_description = doc.first_element_child.xpath('//SALARE:Description').children.text | ||
73 | + sor.tax_exempt_number = doc.first_element_child.xpath('TaxExemptNumber').text | ||
74 | + sor.gst_exempt_number = doc.first_element_child.xpath('GstExemptNumber').text | ||
75 | + sor.currency = doc.first_element_child.xpath('Currency').text | ||
76 | + sor.tblcur_description = doc.first_element_child.xpath('//TBLCUR:Description').children.text | ||
77 | + sor.ship_address_1 = doc.first_element_child.xpath('ShipAddress1').text | ||
78 | + sor.ship_address_2 = doc.first_element_child.xpath('ShipAddress2').text | ||
79 | + sor.ship_address_3 = doc.first_element_child.xpath('ShipAddress3').text | ||
80 | + sor.ship_address_3_locality = doc.first_element_child.xpath('ShipAddress3Locality').text | ||
81 | + sor.ship_address_4 = doc.first_element_child.xpath('ShipAddress4').text | ||
82 | + sor.ship_address_5 = doc.first_element_child.xpath('ShipAddress5').text | ||
83 | + sor.ship_postal_code = doc.first_element_child.xpath('ShipPostalCode').text | ||
84 | + sor.ship_gps_lat = doc.first_element_child.xpath('ShipGpsLat').text | ||
85 | + sor.ship_gps_long = doc.first_element_child.xpath('ShipGpsLong').text | ||
86 | + sor.ship_complete = doc.first_element_child.xpath('ShipComplete').text | ||
87 | + sor.email = doc.first_element_child.xpath('Email').text | ||
88 | + sor.fix_exchange_rate = doc.first_element_child.xpath('FixExchangeRate').text | ||
89 | + sor.exchange_rate = doc.first_element_child.xpath('ExchangeRate').text | ||
90 | + sor.edited_exchange_rate = doc.first_element_child.xpath('EditedExchangeRate').text | ||
91 | + sor.mul_div = doc.first_element_child.xpath('MulDiv').text | ||
92 | + sor.consolidated_order = doc.first_element_child.xpath('ConsolidatedOrder').text | ||
93 | + sor.gst_deduction = doc.first_element_child.xpath('GstDeduction').text | ||
94 | + sor.credited_inv_date = doc.first_element_child.xpath('CreditedInvDate').text | ||
95 | + sor.job = doc.first_element_child.xpath('Job').text | ||
96 | + sor.serialized_flag = doc.first_element_child.xpath('SerializedFlag').text | ||
97 | + sor.counter_sales_flag = doc.first_element_child.xpath('CounterSalesFlag').text | ||
98 | + sor.nationality = doc.first_element_child.xpath('Nationality').text | ||
99 | + sor.delivery_terms = doc.first_element_child.xpath('DeliveryTerms').text | ||
100 | + sor.shipping_location = doc.first_element_child.xpath('ShippingLocation').text | ||
101 | + sor.transaction_nature = doc.first_element_child.xpath('TransactionNature').text | ||
102 | + sor.transport_mode = doc.first_element_child.xpath('TransportMode').text | ||
103 | + sor.process_flag = doc.first_element_child.xpath('ProcessFlag').text | ||
104 | + sor.jobs_exist_flag = doc.first_element_child.xpath('JobsExistFlag').text | ||
105 | + sor.alternate_key = doc.first_element_child.xpath('AlternateKey').text | ||
106 | + sor.hierarchy_flag = doc.first_element_child.xpath('HierarchyFlag').text | ||
107 | + sor.deposit_flag = doc.first_element_child.xpath('DepositFlag').text | ||
108 | + sor.edi_source = doc.first_element_child.xpath('EdiSource').text | ||
109 | + sor.mult_ship_code = doc.first_element_child.xpath('MultShipCode').text | ||
110 | + sor.company_tax_no = doc.first_element_child.xpath('CompanyTaxNo').text | ||
111 | + sor.last_operator = doc.first_element_child.xpath('LastOperator').text | ||
112 | + sor.operator = doc.first_element_child.xpath('Operator').text | ||
113 | + sor.state = doc.first_element_child.xpath('State').text | ||
114 | + sor.county_zip = doc.first_element_child.xpath('CountyZip').text | ||
115 | + sor.extended_tax_code = doc.first_element_child.xpath('ExtendedTaxCode').text | ||
116 | + sor.web_created = doc.first_element_child.xpath('WebCreated').text | ||
117 | + sor.quote = doc.first_element_child.xpath('Quote').text | ||
118 | + sor.dispatches_made = doc.first_element_child.xpath('DispatchesMade').text | ||
119 | + sor.live_disp_exist = doc.first_element_child.xpath('LiveDispExist').text | ||
120 | + sor.num_dispatches = doc.first_element_child.xpath('NumDispatches').text | ||
121 | + sor.include_in_mrp = doc.first_element_child.xpath('IncludeInMrp').text | ||
122 | + sor.header_text = doc.first_element_child.xpath('HeaderText').text | ||
123 | + sor.header_notes = doc.first_element_child.xpath('HeaderNotes').text | ||
124 | 124 | ||
125 | # Inner Nested Structure Parsing | 125 | # Inner Nested Structure Parsing |
126 | sor.commissions = parse_commissions(doc) | 126 | sor.commissions = parse_commissions(doc) |
@@ -131,27 +131,25 @@ module Syspro | @@ -131,27 +131,25 @@ module Syspro | ||
131 | end | 131 | end |
132 | 132 | ||
133 | def parse_commissions(doc) | 133 | def parse_commissions(doc) |
134 | - commissions = doc.first_element_child.xpath("Commissions") | 134 | + commissions = doc.first_element_child.xpath('Commissions') |
135 | commissions_obj = parse_children_elements(commissions) | 135 | commissions_obj = parse_children_elements(commissions) |
136 | 136 | ||
137 | commissions_obj | 137 | commissions_obj |
138 | end | 138 | end |
139 | 139 | ||
140 | - | ||
141 | def parse_sales_order_lines(doc) | 140 | def parse_sales_order_lines(doc) |
142 | - sales_order_lines = doc.first_element_child.xpath("SalesOrderLine") | 141 | + sales_order_lines = doc.first_element_child.xpath('SalesOrderLine') |
143 | sales_order_lines_obj = {} | 142 | sales_order_lines_obj = {} |
144 | 143 | ||
145 | - | ||
146 | sales_order_lines.children.each do |el| | 144 | sales_order_lines.children.each do |el| |
147 | - next if el.name == "text" | 145 | + next if el.name == 'text' |
148 | 146 | ||
149 | serial_obj = {} | 147 | serial_obj = {} |
150 | bin_obj = {} | 148 | bin_obj = {} |
151 | attached_items_obj = {} | 149 | attached_items_obj = {} |
152 | lot_obj = {} | 150 | lot_obj = {} |
153 | 151 | ||
154 | - if el.name == "MiscCharge" | 152 | + if el.name == 'MiscCharge' |
155 | unless sales_order_lines_obj[:misc_charge] | 153 | unless sales_order_lines_obj[:misc_charge] |
156 | sales_order_lines_obj[:misc_charge] = [] | 154 | sales_order_lines_obj[:misc_charge] = [] |
157 | end | 155 | end |
@@ -160,7 +158,7 @@ module Syspro | @@ -160,7 +158,7 @@ module Syspro | ||
160 | sales_order_lines_obj[:misc_charge].push(misc_charge_arr) | 158 | sales_order_lines_obj[:misc_charge].push(misc_charge_arr) |
161 | end | 159 | end |
162 | 160 | ||
163 | - if el.name == "Freight" | 161 | + if el.name == 'Freight' |
164 | unless sales_order_lines_obj[:freight] | 162 | unless sales_order_lines_obj[:freight] |
165 | sales_order_lines_obj[:freight] = [] | 163 | sales_order_lines_obj[:freight] = [] |
166 | end | 164 | end |
@@ -169,7 +167,7 @@ module Syspro | @@ -169,7 +167,7 @@ module Syspro | ||
169 | sales_order_lines_obj[:freight].push(freight_arr) | 167 | sales_order_lines_obj[:freight].push(freight_arr) |
170 | end | 168 | end |
171 | 169 | ||
172 | - if el.name == "CommentLine" | 170 | + if el.name == 'CommentLine' |
173 | unless sales_order_lines_obj[:comment_line] | 171 | unless sales_order_lines_obj[:comment_line] |
174 | sales_order_lines_obj[:comment_line] = [] | 172 | sales_order_lines_obj[:comment_line] = [] |
175 | end | 173 | end |
@@ -178,118 +176,109 @@ module Syspro | @@ -178,118 +176,109 @@ module Syspro | ||
178 | sales_order_lines_obj[:comment_line].push(comment_line_arr) | 176 | sales_order_lines_obj[:comment_line].push(comment_line_arr) |
179 | end | 177 | end |
180 | 178 | ||
181 | - if el.name == "Merchandise" | ||
182 | - unless sales_order_lines_obj[:merchandise] | ||
183 | - sales_order_lines_obj[:merchandise] = [] | 179 | + next unless el.name == 'Merchandise' |
180 | + unless sales_order_lines_obj[:merchandise] | ||
181 | + sales_order_lines_obj[:merchandise] = [] | ||
182 | + end | ||
183 | + | ||
184 | + merchandise_arr = el.children.map do |el_child| | ||
185 | + next if el_child.name == 'text' | ||
186 | + | ||
187 | + if el_child.name == 'MOrderQty' | ||
188 | + @calculated_weight += el_child.text.split(' ')[0].split(',').join.to_f | ||
189 | + | ||
190 | + { | ||
191 | + name: el_child.name, | ||
192 | + text: el_child.text | ||
193 | + } | ||
184 | end | 194 | end |
185 | 195 | ||
186 | - merchandise_arr = el.children.map do |el_child| | ||
187 | - next if el_child.name == "text" | 196 | + # NOTE: These first three in the following |
197 | + # conditionals are "Merchandise" elements with | ||
198 | + # thier own nested structure that need parsed | ||
199 | + if el_child.name == 'Serial' | ||
200 | + serial_obj[:serial] = [] unless serial_obj[:serial] | ||
188 | 201 | ||
189 | - if el_child.name == "MOrderQty" | ||
190 | - @calculated_weight = @calculated_weight + el_child.text.split(' ')[0].split(',').join().to_f | 202 | + serial_arr = parse_children_elements(el_child) |
203 | + serial_obj[:serial].push(serial_arr) | ||
204 | + serial_obj | ||
191 | 205 | ||
192 | - { | ||
193 | - name: el_child.name, | ||
194 | - text: el_child.text | ||
195 | - } | ||
196 | - end | 206 | + elsif el_child.name == 'Bin' |
207 | + bin_obj[:bin] = [] unless bin_obj[:bin] | ||
197 | 208 | ||
198 | - # NOTE: These first three in the following | ||
199 | - # conditionals are "Merchandise" elements with | ||
200 | - # thier own nested structure that need parsed | ||
201 | - if el_child.name == "Serial" | ||
202 | - unless serial_obj[:serial] | ||
203 | - serial_obj[:serial] = [] | ||
204 | - end | 209 | + bin_arr = parse_children_elements(el_child) |
210 | + bin_obj[:bin].push(bin_arr) | ||
211 | + bin_obj | ||
205 | 212 | ||
206 | - serial_arr = parse_children_elements(el_child) | ||
207 | - serial_obj[:serial].push(serial_arr) | ||
208 | - serial_obj | 213 | + elsif el_child.name == 'Lot' |
214 | + lot_obj[:lot] = [] unless lot_obj[:lot] | ||
209 | 215 | ||
210 | - elsif el_child.name == "Bin" | ||
211 | - unless bin_obj[:bin] | ||
212 | - bin_obj[:bin] = [] | ||
213 | - end | 216 | + lot_arr = parse_children_elements(el_child) |
217 | + lot_obj[:lot].push(lot_arr) | ||
218 | + lot_obj | ||
214 | 219 | ||
215 | - bin_arr = parse_children_elements(el_child) | ||
216 | - bin_obj[:bin].push(bin_arr) | ||
217 | - bin_obj | 220 | + elsif el_child.name == 'AttachedItems' |
221 | + # NOTE: Like "Merchandise", "AttachedItems" is | ||
222 | + # an element within "Merchandise" that contains | ||
223 | + # elements with thier own nested structure that | ||
224 | + # need parsed | ||
218 | 225 | ||
219 | - elsif el_child.name == "Lot" | ||
220 | - unless lot_obj[:lot] | ||
221 | - lot_obj[:lot] = [] | ||
222 | - end | 226 | + sct_item_obj = {} |
227 | + requisition_item_obj = {} | ||
228 | + purchase_order_obj = {} | ||
229 | + | ||
230 | + unless attached_items_obj[:attached_items] | ||
231 | + attached_items_obj[:attached_items] = [] | ||
232 | + end | ||
223 | 233 | ||
224 | - lot_arr = parse_children_elements(el_child) | ||
225 | - lot_obj[:lot].push(lot_arr) | ||
226 | - lot_obj | 234 | + attached_items_arr = el_child.children.map do |attached_items_child| |
235 | + next if attached_items_child.name == 'text' | ||
227 | 236 | ||
228 | - elsif el_child.name == "AttachedItems" | ||
229 | - # NOTE: Like "Merchandise", "AttachedItems" is | ||
230 | - # an element within "Merchandise" that contains | ||
231 | - # elements with thier own nested structure that | ||
232 | - # need parsed | 237 | + if attached_items_child.name == 'SctItem' |
238 | + sct_item_obj[:sct_item] = [] unless sct_item_obj[:sct_item] | ||
233 | 239 | ||
234 | - sct_item_obj = {} | ||
235 | - requisition_item_obj = {} | ||
236 | - purchase_order_obj = {} | 240 | + sct_item_arr = parse_children_elements(attached_items_child) |
241 | + sct_item_obj[:sct_item].push(sct_item_arr) | ||
242 | + sct_item_obj | ||
237 | 243 | ||
238 | - unless attached_items_obj[:attached_items] | ||
239 | - attached_items_obj[:attached_items] = [] | ||
240 | - end | 244 | + elsif attached_items_child.name == 'RequisitionItem' |
245 | + unless requisition_item_obj[:requisition_item] | ||
246 | + requisition_item_obj[:requisition_item] = [] | ||
247 | + end | ||
241 | 248 | ||
242 | - attached_items_arr = el_child.children.map do |attached_items_child| | ||
243 | - next if attached_items_child.name == "text" | ||
244 | - | ||
245 | - if attached_items_child.name == "SctItem" | ||
246 | - unless sct_item_obj[:sct_item] | ||
247 | - sct_item_obj[:sct_item] = [] | ||
248 | - end | ||
249 | - | ||
250 | - sct_item_arr = parse_children_elements(attached_items_child) | ||
251 | - sct_item_obj[:sct_item].push(sct_item_arr) | ||
252 | - sct_item_obj | ||
253 | - | ||
254 | - elsif attached_items_child.name == "RequisitionItem" | ||
255 | - unless requisition_item_obj[:requisition_item] | ||
256 | - requisition_item_obj[:requisition_item] = [] | ||
257 | - end | ||
258 | - | ||
259 | - requisition_item_arr = parse_children_elements(attached_items_child) | ||
260 | - requisition_item_obj[:requisition_item].push(requisition_item_arr) | ||
261 | - requisition_item_obj | ||
262 | - | ||
263 | - elsif attached_items_child.name == "PurchaseOrder" | ||
264 | - unless purchase_order_obj[:purchase_order] | ||
265 | - purchase_order_obj[:purchase_order] = [] | ||
266 | - end | ||
267 | - | ||
268 | - purchase_order_arr = parse_children_elements(attached_items_child) | ||
269 | - purchase_order_obj[:purchase_order].push(purchase_order_arr) | ||
270 | - purchase_order_obj | ||
271 | - | ||
272 | - else | ||
273 | - { | ||
274 | - name: attached_items_child.name, | ||
275 | - text: attached_items_child.text | ||
276 | - } | 249 | + requisition_item_arr = parse_children_elements(attached_items_child) |
250 | + requisition_item_obj[:requisition_item].push(requisition_item_arr) | ||
251 | + requisition_item_obj | ||
252 | + | ||
253 | + elsif attached_items_child.name == 'PurchaseOrder' | ||
254 | + unless purchase_order_obj[:purchase_order] | ||
255 | + purchase_order_obj[:purchase_order] = [] | ||
277 | end | 256 | end |
278 | - end.compact | ||
279 | 257 | ||
280 | - attached_items_obj[:attached_items].push(attached_items_arr) | ||
281 | - attached_items_obj | 258 | + purchase_order_arr = parse_children_elements(attached_items_child) |
259 | + purchase_order_obj[:purchase_order].push(purchase_order_arr) | ||
260 | + purchase_order_obj | ||
282 | 261 | ||
283 | - else | ||
284 | - { | ||
285 | - name: el_child.name, | ||
286 | - text: el_child.text | ||
287 | - } | ||
288 | - end | ||
289 | - end.compact | 262 | + else |
263 | + { | ||
264 | + name: attached_items_child.name, | ||
265 | + text: attached_items_child.text | ||
266 | + } | ||
267 | + end | ||
268 | + end.compact | ||
290 | 269 | ||
291 | - sales_order_lines_obj[:merchandise].push(merchandise_arr) | ||
292 | - end | 270 | + attached_items_obj[:attached_items].push(attached_items_arr) |
271 | + attached_items_obj | ||
272 | + | ||
273 | + else | ||
274 | + { | ||
275 | + name: el_child.name, | ||
276 | + text: el_child.text | ||
277 | + } | ||
278 | + end | ||
279 | + end.compact | ||
280 | + | ||
281 | + sales_order_lines_obj[:merchandise].push(merchandise_arr) | ||
293 | end | 282 | end |
294 | 283 | ||
295 | sales_order_lines_obj | 284 | sales_order_lines_obj |
@@ -297,7 +286,7 @@ module Syspro | @@ -297,7 +286,7 @@ module Syspro | ||
297 | 286 | ||
298 | def parse_children_elements(el_child) | 287 | def parse_children_elements(el_child) |
299 | obj_array = el_child.children.map do |el| | 288 | obj_array = el_child.children.map do |el| |
300 | - next if el.name == "text" | 289 | + next if el.name == 'text' |
301 | { | 290 | { |
302 | name: el.name, | 291 | name: el.name, |
303 | text: el.text | 292 | text: el.text |
@@ -306,7 +295,6 @@ module Syspro | @@ -306,7 +295,6 @@ module Syspro | ||
306 | 295 | ||
307 | obj_array | 296 | obj_array |
308 | end | 297 | end |
309 | - | ||
310 | end | 298 | end |
311 | end | 299 | end |
312 | end | 300 | end |
lib/syspro/business_objects/porqry.rb
@@ -10,10 +10,10 @@ module Syspro | @@ -10,10 +10,10 @@ module Syspro | ||
10 | include Syspro::BusinessObjects::Parsers | 10 | include Syspro::BusinessObjects::Parsers |
11 | 11 | ||
12 | attr_accessor :purchase_order, :include_stocked_lines, :include_non_stocked_lines, | 12 | attr_accessor :purchase_order, :include_stocked_lines, :include_non_stocked_lines, |
13 | - :include_freight_lines, :include_miscellaneous_lines, :include_comment_lines, | ||
14 | - :include_completed_lines, :include_grns, :include_history, :include_lct_details, | ||
15 | - :include_requisition_details, :include_requisition_routing, :include_sales_orders, | ||
16 | - :include_custom_forms, :filter_type, :filter_value | 13 | + :include_freight_lines, :include_miscellaneous_lines, :include_comment_lines, |
14 | + :include_completed_lines, :include_grns, :include_history, :include_lct_details, | ||
15 | + :include_requisition_details, :include_requisition_routing, :include_sales_orders, | ||
16 | + :include_custom_forms, :filter_type, :filter_value | ||
17 | 17 | ||
18 | def call(user_id) | 18 | def call(user_id) |
19 | xml_in = template.result(binding) | 19 | xml_in = template.result(binding) |
lib/syspro/business_objects/portii.rb
@@ -11,10 +11,10 @@ module Syspro | @@ -11,10 +11,10 @@ module Syspro | ||
11 | 11 | ||
12 | # input params | 12 | # input params |
13 | attr_accessor :transaction_date, | 13 | attr_accessor :transaction_date, |
14 | - :ignore_warnings, | ||
15 | - :apply_if_entire_document_valid, | ||
16 | - :validate_only, | ||
17 | - :item_inspected | 14 | + :ignore_warnings, |
15 | + :apply_if_entire_document_valid, | ||
16 | + :validate_only, | ||
17 | + :item_inspected | ||
18 | 18 | ||
19 | def call(user_id) | 19 | def call(user_id) |
20 | xml_parameters = params_template.result(binding) | 20 | xml_parameters = params_template.result(binding) |
@@ -43,10 +43,9 @@ module Syspro | @@ -43,10 +43,9 @@ module Syspro | ||
43 | parser.parse | 43 | parser.parse |
44 | end | 44 | end |
45 | 45 | ||
46 | - def render_xml(inner_text, dflt_value = "") | 46 | + def render_xml(inner_text, dflt_value = '') |
47 | inner_text ? inner_text.to_s : dflt_value | 47 | inner_text ? inner_text.to_s : dflt_value |
48 | end | 48 | end |
49 | end | 49 | end |
50 | end | 50 | end |
51 | end | 51 | end |
52 | - |
lib/syspro/business_objects/portoi.rb
@@ -11,22 +11,22 @@ module Syspro | @@ -11,22 +11,22 @@ module Syspro | ||
11 | 11 | ||
12 | # input params | 12 | # input params |
13 | attr_accessor :purchase_order_header, | 13 | attr_accessor :purchase_order_header, |
14 | - :order_details, | ||
15 | - :validate_only, | ||
16 | - :ignore_warnings, | ||
17 | - :allow_non_stock_items, | ||
18 | - :allow_zero_price, | ||
19 | - :validate_working_days, | ||
20 | - :allow_po_when_blanket_po, | ||
21 | - :default_memo_code, | ||
22 | - :fixed_exchange_rate, | ||
23 | - :default_memo_days, | ||
24 | - :allow_blank_ledger_code, | ||
25 | - :calc_due_date, | ||
26 | - :default_delivery_address, | ||
27 | - :insert_dangerous_goods_text, | ||
28 | - :insert_additional_po_text, | ||
29 | - :status | 14 | + :order_details, |
15 | + :validate_only, | ||
16 | + :ignore_warnings, | ||
17 | + :allow_non_stock_items, | ||
18 | + :allow_zero_price, | ||
19 | + :validate_working_days, | ||
20 | + :allow_po_when_blanket_po, | ||
21 | + :default_memo_code, | ||
22 | + :fixed_exchange_rate, | ||
23 | + :default_memo_days, | ||
24 | + :allow_blank_ledger_code, | ||
25 | + :calc_due_date, | ||
26 | + :default_delivery_address, | ||
27 | + :insert_dangerous_goods_text, | ||
28 | + :insert_additional_po_text, | ||
29 | + :status | ||
30 | 30 | ||
31 | def call(user_id) | 31 | def call(user_id) |
32 | xml_parameters = params_template.result(binding) | 32 | xml_parameters = params_template.result(binding) |
@@ -61,4 +61,3 @@ module Syspro | @@ -61,4 +61,3 @@ module Syspro | ||
61 | end | 61 | end |
62 | end | 62 | end |
63 | end | 63 | end |
64 | - |
lib/syspro/business_objects/portor.rb
@@ -47,10 +47,9 @@ module Syspro | @@ -47,10 +47,9 @@ module Syspro | ||
47 | parser.parse | 47 | parser.parse |
48 | end | 48 | end |
49 | 49 | ||
50 | - def render_xml(inner_text, dflt_value = "") | 50 | + def render_xml(inner_text, dflt_value = '') |
51 | inner_text ? inner_text.to_s : dflt_value | 51 | inner_text ? inner_text.to_s : dflt_value |
52 | end | 52 | end |
53 | end | 53 | end |
54 | end | 54 | end |
55 | end | 55 | end |
56 | - |
lib/syspro/configuration.rb
@@ -43,7 +43,7 @@ module Syspro | @@ -43,7 +43,7 @@ module Syspro | ||
43 | private | 43 | private |
44 | 44 | ||
45 | def deprecated_default_server_url | 45 | def deprecated_default_server_url |
46 | - warn "[DEPRECATION] the default server url of `http://syspro.wildlandlabs.com:90` will be removed. Please update your application to configure this server url (see README for details)." | 46 | + warn '[DEPRECATION] the default server url of `http://syspro.wildlandlabs.com:90` will be removed. Please update your application to configure this server url (see README for details).' |
47 | 'http://syspro.wildlandlabs.com:90' | 47 | 'http://syspro.wildlandlabs.com:90' |
48 | end | 48 | end |
49 | 49 |
lib/syspro/util.rb
lib/syspro/version.rb
test/comsfm_test.rb
@@ -18,13 +18,13 @@ class ComsFmTest < Minitest::Test | @@ -18,13 +18,13 @@ class ComsFmTest < Minitest::Test | ||
18 | 18 | ||
19 | def test_comsfm | 19 | def test_comsfm |
20 | cust_item = Syspro::BusinessObjects::Models::ComsFmItem.new | 20 | cust_item = Syspro::BusinessObjects::Models::ComsFmItem.new |
21 | - cust_item.form_type = "POR" | ||
22 | - cust_item.key_field = "U03679" | ||
23 | - cust_item.field_name = "TempPO" | ||
24 | - cust_item.alpha_value = "Y" | 21 | + cust_item.form_type = 'POR' |
22 | + cust_item.key_field = 'U03679' | ||
23 | + cust_item.field_name = 'TempPO' | ||
24 | + cust_item.alpha_value = 'Y' | ||
25 | 25 | ||
26 | cust_form = Syspro::BusinessObjects::ComsFm.new | 26 | cust_form = Syspro::BusinessObjects::ComsFm.new |
27 | - cust_form.validate_only = "Y" | 27 | + cust_form.validate_only = 'Y' |
28 | cust_form.items = [cust_item] | 28 | cust_form.items = [cust_item] |
29 | 29 | ||
30 | errors = cust_form.add(user_id.guid) | 30 | errors = cust_form.add(user_id.guid) |
test/invqry_test.rb
@@ -22,10 +22,10 @@ class InvQryTest < Minitest::Test | @@ -22,10 +22,10 @@ class InvQryTest < Minitest::Test | ||
22 | invqry_req.key_stock_code = '1003' | 22 | invqry_req.key_stock_code = '1003' |
23 | invqry_req.filter_warehouse_list = 'P0' | 23 | invqry_req.filter_warehouse_list = 'P0' |
24 | invqry_req.option = Syspro::BusinessObjects::Models::InvQryOptions.new | 24 | invqry_req.option = Syspro::BusinessObjects::Models::InvQryOptions.new |
25 | - invqry_req.option.include_lots = "Y" | ||
26 | - | 25 | + invqry_req.option.include_lots = 'Y' |
26 | + | ||
27 | invqry_rsp = invqry_req.call(user_id.guid) | 27 | invqry_rsp = invqry_req.call(user_id.guid) |
28 | 28 | ||
29 | assert_kind_of Syspro::BusinessObjects::Models::Inv, invqry_rsp | 29 | assert_kind_of Syspro::BusinessObjects::Models::Inv, invqry_rsp |
30 | end | 30 | end |
31 | -end | ||
32 | \ No newline at end of file | 31 | \ No newline at end of file |
32 | +end |
test/invsws_test.rb
@@ -19,15 +19,15 @@ class InvSwsTest < Minitest::Test | @@ -19,15 +19,15 @@ class InvSwsTest < Minitest::Test | ||
19 | def test_invsws | 19 | def test_invsws |
20 | skip 'A new VCR cassette needs recorded for this test to pass' | 20 | skip 'A new VCR cassette needs recorded for this test to pass' |
21 | invsws_item = Syspro::BusinessObjects::Models::InvSwsItem.new | 21 | invsws_item = Syspro::BusinessObjects::Models::InvSwsItem.new |
22 | - invsws_item.key_stock_code = "1004" | ||
23 | - invsws_item.key_warehouse = "P0" | ||
24 | - invsws_item.default_bin = "P0" | 22 | + invsws_item.key_stock_code = '1004' |
23 | + invsws_item.key_warehouse = 'P0' | ||
24 | + invsws_item.default_bin = 'P0' | ||
25 | 25 | ||
26 | invsws_req = Syspro::BusinessObjects::InvSws.new | 26 | invsws_req = Syspro::BusinessObjects::InvSws.new |
27 | - invsws_req.validate_only = "Y" | ||
28 | - invsws_req.apply_product_class_default = "BA" | ||
29 | - invsws_req.ignore_warnings = "N" | ||
30 | - invsws_req.apply_if_entire_document_valid = "Y" | 27 | + invsws_req.validate_only = 'Y' |
28 | + invsws_req.apply_product_class_default = 'BA' | ||
29 | + invsws_req.ignore_warnings = 'N' | ||
30 | + invsws_req.apply_if_entire_document_valid = 'Y' | ||
31 | invsws_req.item = invsws_item | 31 | invsws_req.item = invsws_item |
32 | 32 | ||
33 | invsws_resp = invsws_req.add(user_id.guid) | 33 | invsws_resp = invsws_req.add(user_id.guid) |
test/logon_test.rb
@@ -25,13 +25,13 @@ class LogonTest < Minitest::Test | @@ -25,13 +25,13 @@ class LogonTest < Minitest::Test | ||
25 | end | 25 | end |
26 | 26 | ||
27 | def test_logon_error | 27 | def test_logon_error |
28 | - assert_raises(::Syspro::AuthenticationError) { | 28 | + assert_raises(::Syspro::AuthenticationError) do |
29 | logon_result = ::Syspro::SysproClient.new.logon( | 29 | logon_result = ::Syspro::SysproClient.new.logon( |
30 | username, | 30 | username, |
31 | 'bad_password', | 31 | 'bad_password', |
32 | company, | 32 | company, |
33 | company_password | 33 | company_password |
34 | ) | 34 | ) |
35 | - } | 35 | + end |
36 | end | 36 | end |
37 | end | 37 | end |
test/portii_test.rb
@@ -15,16 +15,16 @@ class PorTiiTest < Minitest::Test | @@ -15,16 +15,16 @@ class PorTiiTest < Minitest::Test | ||
15 | 15 | ||
16 | def test_portii | 16 | def test_portii |
17 | req = Syspro::BusinessObjects::PorTii.new | 17 | req = Syspro::BusinessObjects::PorTii.new |
18 | - | 18 | + |
19 | req.item_inspected = Syspro::BusinessObjects::Models::InventoryInspection.new | 19 | req.item_inspected = Syspro::BusinessObjects::Models::InventoryInspection.new |
20 | - req.item_inspected.grn_number = "P00012509" | 20 | + req.item_inspected.grn_number = 'P00012509' |
21 | req.item_inspected.quantity = 12.312 | 21 | req.item_inspected.quantity = 12.312 |
22 | - req.item_inspected.inspection_completed = "Y" | ||
23 | - | 22 | + req.item_inspected.inspection_completed = 'Y' |
23 | + | ||
24 | resp = req.call(user_id.guid) | 24 | resp = req.call(user_id.guid) |
25 | - | ||
26 | - assert_equal resp.has_key?(:grn_numbers), true | ||
27 | - assert_equal resp.has_key?(:items_processed), true | ||
28 | - assert_equal resp.has_key?(:items_invalid), true | 25 | + |
26 | + assert_equal resp.key?(:grn_numbers), true | ||
27 | + assert_equal resp.key?(:items_processed), true | ||
28 | + assert_equal resp.key?(:items_invalid), true | ||
29 | end | 29 | end |
30 | -end | ||
31 | \ No newline at end of file | 30 | \ No newline at end of file |
31 | +end |
test/portoi_test.rb
@@ -18,60 +18,60 @@ class PorToiTest < Minitest::Test | @@ -18,60 +18,60 @@ class PorToiTest < Minitest::Test | ||
18 | po.purchase_order_header = Syspro::BusinessObjects::Models::PurchaseOrders::Header.new | 18 | po.purchase_order_header = Syspro::BusinessObjects::Models::PurchaseOrders::Header.new |
19 | 19 | ||
20 | # Setup the PORTOI params | 20 | # Setup the PORTOI params |
21 | - po.validate_only = "N" | ||
22 | - po.ignore_warnings = "N" | ||
23 | - po.allow_non_stock_items = "N" | ||
24 | - po.allow_zero_price = "Y" | ||
25 | - po.validate_working_days = "N" | ||
26 | - po.allow_po_when_blanket_po = "N" | ||
27 | - po.default_memo_code = "" | ||
28 | - po.fixed_exchange_rate = "N" | 21 | + po.validate_only = 'N' |
22 | + po.ignore_warnings = 'N' | ||
23 | + po.allow_non_stock_items = 'N' | ||
24 | + po.allow_zero_price = 'Y' | ||
25 | + po.validate_working_days = 'N' | ||
26 | + po.allow_po_when_blanket_po = 'N' | ||
27 | + po.default_memo_code = '' | ||
28 | + po.fixed_exchange_rate = 'N' | ||
29 | po.default_memo_days = 0 | 29 | po.default_memo_days = 0 |
30 | - po.allow_blank_ledger_code = "Y" | ||
31 | - po.default_delivery_address = "" | ||
32 | - po.calc_due_date = "N" | ||
33 | - po.insert_dangerous_goods_text = "N" | ||
34 | - po.insert_additional_po_text = "N" | ||
35 | - po.status = "1" | 30 | + po.allow_blank_ledger_code = 'Y' |
31 | + po.default_delivery_address = '' | ||
32 | + po.calc_due_date = 'N' | ||
33 | + po.insert_dangerous_goods_text = 'N' | ||
34 | + po.insert_additional_po_text = 'N' | ||
35 | + po.status = '1' | ||
36 | 36 | ||
37 | # Setup the purchase order header data attributes | 37 | # Setup the purchase order header data attributes |
38 | - po.purchase_order_header.order_action_type = "A" | ||
39 | - po.purchase_order_header.order_type = "L" | ||
40 | - po.purchase_order_header.supplier = "WYC001" | ||
41 | - po.purchase_order_header.customer_po_number = "H01993-1" | ||
42 | - po.purchase_order_header.buyer = "PCD" | ||
43 | - po.purchase_order_header.warehouse = "P0" | ||
44 | - po.purchase_order_header.tax_status = "N" | ||
45 | - po.purchase_order_header.invoice_terms = "X" | ||
46 | - po.purchase_order_header.order_date = Time.now.strftime("%Y-%m-%d") | ||
47 | - po.purchase_order_header.apply_due_date_to_lines = "A" | 38 | + po.purchase_order_header.order_action_type = 'A' |
39 | + po.purchase_order_header.order_type = 'L' | ||
40 | + po.purchase_order_header.supplier = 'WYC001' | ||
41 | + po.purchase_order_header.customer_po_number = 'H01993-1' | ||
42 | + po.purchase_order_header.buyer = 'PCD' | ||
43 | + po.purchase_order_header.warehouse = 'P0' | ||
44 | + po.purchase_order_header.tax_status = 'N' | ||
45 | + po.purchase_order_header.invoice_terms = 'X' | ||
46 | + po.purchase_order_header.order_date = Time.now.strftime('%Y-%m-%d') | ||
47 | + po.purchase_order_header.apply_due_date_to_lines = 'A' | ||
48 | po.purchase_order_header.disc_percent1 = 0 | 48 | po.purchase_order_header.disc_percent1 = 0 |
49 | po.purchase_order_header.disc_percent2 = 0 | 49 | po.purchase_order_header.disc_percent2 = 0 |
50 | po.purchase_order_header.disc_percent3 = 0 | 50 | po.purchase_order_header.disc_percent3 = 0 |
51 | 51 | ||
52 | line1 = Syspro::BusinessObjects::Models::PurchaseOrders::StockLine.new | 52 | line1 = Syspro::BusinessObjects::Models::PurchaseOrders::StockLine.new |
53 | line1.purchase_order_line = 1 | 53 | line1.purchase_order_line = 1 |
54 | - line1.line_action_type = "A" | ||
55 | - line1.stock_code = "8801" | ||
56 | - line1.warehouse = "P0" | ||
57 | - line1.order_qty = "100" | ||
58 | - line1.order_uom = "KG" | ||
59 | - line1.pieces = "0" | ||
60 | - line1.price_method = "M" | 54 | + line1.line_action_type = 'A' |
55 | + line1.stock_code = '8801' | ||
56 | + line1.warehouse = 'P0' | ||
57 | + line1.order_qty = '100' | ||
58 | + line1.order_uom = 'KG' | ||
59 | + line1.pieces = '0' | ||
60 | + line1.price_method = 'M' | ||
61 | line1.price = 0 | 61 | line1.price = 0 |
62 | - line1.line_disc_type = "P" | ||
63 | - line1.line_disc_less_plus = "L" | 62 | + line1.line_disc_type = 'P' |
63 | + line1.line_disc_less_plus = 'L' | ||
64 | line1.line_disc_percent1 = 0 | 64 | line1.line_disc_percent1 = 0 |
65 | line1.line_disc_percent2 = 0 | 65 | line1.line_disc_percent2 = 0 |
66 | line1.line_disc_percent3 = 0 | 66 | line1.line_disc_percent3 = 0 |
67 | line1.line_disc_value = 0 | 67 | line1.line_disc_value = 0 |
68 | - line1.taxable = "N" | ||
69 | - | 68 | + line1.taxable = 'N' |
69 | + | ||
70 | po.order_details = Syspro::BusinessObjects::Models::PurchaseOrders::OrderDetails.new | 70 | po.order_details = Syspro::BusinessObjects::Models::PurchaseOrders::OrderDetails.new |
71 | po.order_details.stock_lines = [line1] | 71 | po.order_details.stock_lines = [line1] |
72 | - | 72 | + |
73 | syspro_po = po.call(user_id.guid) | 73 | syspro_po = po.call(user_id.guid) |
74 | - | 74 | + |
75 | assert_equal syspro_po.error_numbers.length, 0 | 75 | assert_equal syspro_po.error_numbers.length, 0 |
76 | end | 76 | end |
77 | -end | ||
78 | \ No newline at end of file | 77 | \ No newline at end of file |
78 | +end |
test/portor_test.rb
@@ -18,17 +18,17 @@ class PorTorTest < Minitest::Test | @@ -18,17 +18,17 @@ class PorTorTest < Minitest::Test | ||
18 | 18 | ||
19 | def test_portor | 19 | def test_portor |
20 | receipt_intero = Syspro::BusinessObjects::Models::ReceiptInterospection.new | 20 | receipt_intero = Syspro::BusinessObjects::Models::ReceiptInterospection.new |
21 | - receipt_intero.purchase_order = "Z01308" | ||
22 | - receipt_intero.warehouse = "P0" | ||
23 | - receipt_intero.stock_code = "8801" | 21 | + receipt_intero.purchase_order = 'Z01308' |
22 | + receipt_intero.warehouse = 'P0' | ||
23 | + receipt_intero.stock_code = '8801' | ||
24 | receipt_intero.quantity = 0.01 | 24 | receipt_intero.quantity = 0.01 |
25 | - receipt_intero.delivery_note = "DELIVER NOTE HERE-WL" | ||
26 | - receipt_intero.certificate = "8/45-3" | ||
27 | - receipt_intero.lot = "7097505" | 25 | + receipt_intero.delivery_note = 'DELIVER NOTE HERE-WL' |
26 | + receipt_intero.certificate = '8/45-3' | ||
27 | + receipt_intero.lot = '7097505' | ||
28 | 28 | ||
29 | req = Syspro::BusinessObjects::PorTor.new | 29 | req = Syspro::BusinessObjects::PorTor.new |
30 | - req.transaction_date = Time.now.strftime("%Y-%m-%d") | ||
31 | - req.ignore_warnings = "N" | 30 | + req.transaction_date = Time.now.strftime('%Y-%m-%d') |
31 | + req.ignore_warnings = 'N' | ||
32 | 32 | ||
33 | req.receipt_interospections = [receipt_intero] | 33 | req.receipt_interospections = [receipt_intero] |
34 | resp = req.call(user_id.guid) | 34 | resp = req.call(user_id.guid) |