effective_qb_sync 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7396424bcd93f518f79f503a4ec0855410c3b690
|
4
|
+
data.tar.gz: cfab9318b68fa74de2e58edf05ce3ac1ae84de9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5b0a32248537b7730b9ea555b02dda870761d3d1cb48be664271c3ba786359fc5cb07c474e3d59a98f99bc501be230b03a90761dbd0c6c5257b7953585bed05
|
7
|
+
data.tar.gz: bf84fa497145aad617107f9443c46cb39f5bc8750c9261f038bf132f08c2d4b6c0feb0730d6dcc436374a65be3136905ded384aa0f05ede41914993a72e5d41d
|
@@ -1,12 +1,18 @@
|
|
1
1
|
module Admin
|
2
2
|
class QbSyncsController < ApplicationController
|
3
|
-
|
4
|
-
|
3
|
+
respond_to?(:before_action) ? before_action(:authenticate_user!) : before_filter(:authenticate_user!) # Devise
|
4
|
+
respond_to?(:before_action) ? before_action(:restrict_access) : before_filter(:restrict_access)
|
5
5
|
|
6
6
|
layout (EffectiveQbSync.layout.kind_of?(Hash) ? EffectiveQbSync.layout[:admin_qb_tickets] : EffectiveQbSync.layout)
|
7
7
|
|
8
8
|
def index
|
9
|
-
|
9
|
+
|
10
|
+
if Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
|
11
|
+
@datatable = Effective::Datatables::QbSyncs.new()
|
12
|
+
else
|
13
|
+
@datatable = EffectiveQbSyncDatatable.new(self)
|
14
|
+
end
|
15
|
+
|
10
16
|
@page_title = 'Quickbooks Synchronizations'
|
11
17
|
end
|
12
18
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
unless Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
|
2
|
+
class EffectiveQbSyncDatatable < Effective::Datatable
|
3
|
+
datatable do
|
4
|
+
order :created_at, :desc
|
5
|
+
|
6
|
+
col :created_at
|
7
|
+
col :state, search: { collection: Effective::QbTicket::STATES }
|
8
|
+
|
9
|
+
val :num_orders, visible: false do |qb_ticket|
|
10
|
+
qb_ticket.qb_requests.length
|
11
|
+
end
|
12
|
+
|
13
|
+
val :orders, sort: false, as: :obfuscated_id do |qb_ticket|
|
14
|
+
qb_ticket.qb_requests.select { |qb_request| qb_request.order.present? }
|
15
|
+
end.format do |requests|
|
16
|
+
requests.map { |qb_request| link_to "##{qb_request.order.to_param}", effective_orders.admin_order_path(qb_request.order) }
|
17
|
+
.join('<br>').html_safe
|
18
|
+
end.search do |collection, term, column, sql_column|
|
19
|
+
order = Effective::Order.where(id: search_term).first
|
20
|
+
|
21
|
+
if order.present?
|
22
|
+
collection.where(id: Effective::QbRequest.where(order_id: order.id).pluck(:qb_ticket_id))
|
23
|
+
else
|
24
|
+
collection.none
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
actions_col partial: 'admin/qb_syncs/actions', partial_as: :qb_sync
|
29
|
+
end
|
30
|
+
|
31
|
+
collection do
|
32
|
+
Effective::QbTicket.includes(qb_requests: :order)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -12,12 +12,12 @@ module EffectiveQbSync
|
|
12
12
|
# Ensure every acts_as_purchasable object responds to qb_item_name
|
13
13
|
initializer 'effective_qb_sync.assert_qb_item_names_present' do |app|
|
14
14
|
if Rails.env.development?
|
15
|
-
|
16
|
-
|
17
|
-
invalids = (ActsAsPurchasable.descendants || []).reject { |klass| (klass.new().try(:qb_item_name).present? rescue false) }
|
15
|
+
ActiveSupport.on_load :active_record do
|
16
|
+
invalids = (ActsAsPurchasable.descendants || []).reject { |klass| (klass.new().try(:qb_item_name).present? rescue false) }
|
18
17
|
|
19
|
-
|
20
|
-
|
18
|
+
if invalids.present?
|
19
|
+
puts "WARNING: (effective_qb_sync) expected acts_as_purchasable objects #{invalids.map(&:to_s).to_sentence} .qb_item_name() to be present."
|
20
|
+
end
|
21
21
|
end
|
22
22
|
end
|
23
23
|
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.1.
|
4
|
+
version: 1.1.1
|
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:
|
11
|
+
date: 2017-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -245,6 +245,7 @@ files:
|
|
245
245
|
- Rakefile
|
246
246
|
- app/controllers/admin/qb_syncs_controller.rb
|
247
247
|
- app/controllers/effective/qb_sync_controller.rb
|
248
|
+
- app/datatables/effective_qb_sync_datatable.rb
|
248
249
|
- app/models/effective/access_denied.rb
|
249
250
|
- app/models/effective/datatables/qb_syncs.rb
|
250
251
|
- app/models/effective/qb_log.rb
|