effective_qb_sync 1.3.7 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e1b10dc71838c8390bd6baff5fa2bcec970c0be67d3a799967b17cbb1e8490d
4
- data.tar.gz: 38cea0b7beb53c3ebfcddda052ea3970514a3c9bfbc4d31d17b9e27194f0db26
3
+ metadata.gz: 349c5cbc263f6553be07c308064427d01c9fd44f45e9e89b626852ff1daad271
4
+ data.tar.gz: 3d961d678553a5cea81250014b18256a10fee4334bd720a98b2ad3c2bcc85d1d
5
5
  SHA512:
6
- metadata.gz: 653e25f22cd61bac1119dc50cf0abbc29109906ee8de741db7c75527f60db2f5278567d18a9e3fa70df376a042672487ddfeec0d262e6fbe0ed088367a212464
7
- data.tar.gz: '019270eb08c5b8267676b7f94d01ae15150a7c3f34d643aa762a0c726833d5192a5ba791a352d550571d73d3510756c8d4eee6d6e79fe1526776473e5e66df3d'
6
+ metadata.gz: ddc265acf4e19b8aeedc7fb6fe4a2d764e54c883818e5fc3e07ad08264bf874b387cd231a2e26c44533b38d3a1635a792964e6c90a6f33ec6c4c8d784772d0ed
7
+ data.tar.gz: 73a4419a4eea4ac12900d40e15869cad50ef8d5279d81a79dac1ffcb0958733804f02fec5773bc9a0889d60afe836deade1630e78ce8ef4dd9a0f7b7e9a00a82
@@ -44,9 +44,9 @@ module Admin
44
44
  def qwc
45
45
  @filename = EffectiveQbSync.qwc_name.parameterize + '.qwc'
46
46
 
47
- response.headers['Content-Disposition'] = "attachment; filename=\"#{@filename}\""
47
+ data = render_to_string('effective/qb_web_connector/quickbooks', layout: false)
48
48
 
49
- render '/effective/qb_web_connector/quickbooks.qwc', layout: false
49
+ send_data(data, filename: 'quickbooks.qwc', disposition: 'attachment')
50
50
  end
51
51
 
52
52
  def set_all_orders_finished
@@ -67,9 +67,7 @@ module Admin
67
67
  private
68
68
 
69
69
  def permitted_params
70
- params.require(:effective_qb_order_items_form).permit(
71
- :id, qb_order_items_attributes: [:name, :id, :order_item_id]
72
- )
70
+ params.require(:effective_qb_order_items_form).permit!
73
71
  end
74
72
 
75
73
  end
@@ -7,7 +7,6 @@ module Effective
7
7
  timestamps
8
8
  end
9
9
 
10
- validates :order_item, presence: true
11
10
  validates :name, presence: true
12
11
  end
13
12
  end
@@ -234,11 +234,24 @@ module Effective
234
234
  }
235
235
  end
236
236
 
237
- if EffectiveQbSync.quickbooks_tax_name.present?
237
+ surcharge_name = EffectiveOrders.try(:credit_card_surcharge_qb_item_name)
238
+ tax_name = EffectiveQbSync.quickbooks_tax_name
239
+
240
+ if surcharge_name.present? && order.surcharge != 0
241
+ xml.SalesReceiptLineAdd {
242
+ xml.ItemRef { xml.FullName(surcharge_name) }
243
+ xml.Desc(surcharge_name)
244
+ xml.Amount(qb_amount(order.surcharge))
245
+ }
246
+ end
247
+
248
+ # This is manual tax mode. Add the Tax and Surcharge Tax as an item.
249
+ # When tax name is blank, this is handled automatically by QuickBooks
250
+ if tax_name.present? && (order.tax != 0 || order.try(:surcharge_tax).to_i != 0)
238
251
  xml.SalesReceiptLineAdd {
239
- xml.ItemRef { xml.FullName(EffectiveQbSync.quickbooks_tax_name) }
240
- xml.Desc(EffectiveQbSync.quickbooks_tax_name)
241
- xml.Amount(qb_amount(order.tax))
252
+ xml.ItemRef { xml.FullName(tax_name) }
253
+ xml.Desc(tax_name)
254
+ xml.Amount(qb_amount(order.tax + order.try(:surcharge_tax).to_i))
242
255
  }
243
256
  end
244
257
  }
@@ -14,6 +14,6 @@
14
14
  %td
15
15
  = f.fields_for :qb_order_items, order_item.qb_order_item do |foi|
16
16
  = foi.hidden_field :order_item_id, value: order_item.id
17
- = foi.text_field :name, label: false, required: false
17
+ = foi.text_field :name, label: false, required: true
18
18
 
19
19
  = f.submit 'Save QuickBooks Item Names'
@@ -98,7 +98,7 @@
98
98
 
99
99
  %ul
100
100
  %li
101
- Download the #{link_to 'quickbooks web connector .qwc file', (effective_qb_sync.qwc_admin_qb_syncs_path)} and put it somewhere safe
101
+ Download the #{link_to 'quickbooks web connector .qwc file', (effective_qb_sync.qwc_admin_qb_syncs_path), target: '_blank'} and put it somewhere safe
102
102
  %li
103
103
  Open the Quickbooks Web Connector program from the Start menu
104
104
  %ul
@@ -117,7 +117,7 @@
117
117
  url that ends with
118
118
  %strong= effective_qb_sync.qb_sync_path
119
119
  such as
120
- %strong https://myapp.herokuapp.com#{effective_qb_sync.qb_sync_path}
120
+ %strong https://mysite.com#{effective_qb_sync.qb_sync_path}
121
121
  %li The AppSupport url doesn't matter
122
122
  %li The UserName must be present and match an existing user
123
123
  %li The OwnerID and FileID values must also be unique between all other .qwc files
@@ -135,7 +135,7 @@
135
135
  %li (optional) or enable Auto-Run
136
136
  %li
137
137
  If any synchronization errors occur,
138
- %strong= EffectiveQbSync.error_email || EffectiveOrders.mailer[:admin_email]
138
+ %strong= EffectiveQbSync.error_email || EffectiveOrders.mailer_admin
139
139
  will receive an email with instructions on how to fix the error
140
140
 
141
141
  %h3 6. Troubleshooting
@@ -149,4 +149,3 @@
149
149
  %li You might need a developer's help to undo this.
150
150
  - unsynced = Effective::QbRequest.new_requests_for_unsynced_items.length
151
151
  %li= link_to "Mark all #{unsynced} unsynced orders as already synchronized", effective_qb_sync.set_all_orders_finished_admin_qb_syncs_path, 'data-method': :post, 'data-confirm': 'Are you sure?'
152
-
@@ -1,3 +1,3 @@
1
1
  module EffectiveQbSync
2
- VERSION = '1.3.7'.freeze
2
+ VERSION = '1.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_qb_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-13 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -113,7 +113,7 @@ files:
113
113
  - app/views/effective/qb_sync/receiveResponseXML.erb
114
114
  - app/views/effective/qb_sync/sendRequestXML.erb
115
115
  - app/views/effective/qb_sync/serverVersion.erb
116
- - app/views/effective/qb_web_connector/quickbooks.qwc.erb
116
+ - app/views/effective/qb_web_connector/quickbooks.html.erb
117
117
  - config/effective_qb_sync.rb
118
118
  - config/routes.rb
119
119
  - db/migrate/01_create_effective_qb_sync.rb.erb