effective_orders 1.2.4 → 1.2.5

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: 9019d34aa37326aedfa30f1109d9af5ced0de13a
4
- data.tar.gz: ddb700b7fbf547e81cfc90bf4234aa57fb8139e8
3
+ metadata.gz: c1e228be4429904e02e51771125e189f2c917642
4
+ data.tar.gz: 60ca8ea9cb693199784c7bfaf6d1424fc6bd6412
5
5
  SHA512:
6
- metadata.gz: 83339fe6de29de57ae6b909ee49d409500e93c1d6a1b9ac66e561d5181f093bc3a43e78f5647b2261128a93c857b6958c6315a32026b577060884c95d899aa35
7
- data.tar.gz: a4d3ee975306f6e20b7852636f9dfb97e89b462d22c7deffdc7c04d6ac44a7ab1832c9cee1bd182394135a9e316960b1c3ba2fea2b1502e41657ff0161ded830
6
+ metadata.gz: 89ab63b17901c6dd25e2f590f78d77427bde9dcaec50ff36d86760b57b1c24356ef7c4b3b6bf086dbb744b73e2e962a8f04fa8a8022d136a94a6921d9d9c31b1
7
+ data.tar.gz: f1714b29a9588dd1b78c034f74ad95305876713e5780def64c82bffe59153ed86a716d593f3853eb5bb0a325900b9b2e64a4efbcd3db8c95d24cc945208e596c
@@ -11,8 +11,8 @@ if defined?(EffectiveDatatables)
11
11
  end
12
12
 
13
13
  if EffectiveOrders.require_billing_address
14
- table_column :full_name, :sortable => false, :label => 'Buyer Name', :if => Proc.new { attributes[:user_id].blank? } do |order|
15
- (order[:full_name] || '').split('!!SEP!!').find { |name| name.present? }
14
+ table_column :buyer_name, :sortable => false, :label => 'Buyer Name', :if => Proc.new { attributes[:user_id].blank? } do |order|
15
+ (order[:buyer_name] || '').split('!!SEP!!').find { |name| name.present? }
16
16
  end
17
17
  end
18
18
 
@@ -33,12 +33,7 @@ if defined?(EffectiveDatatables)
33
33
  end
34
34
 
35
35
  table_column :actions, :sortable => false, :filter => false do |order|
36
- content_tag(:span, :style => 'white-space: nowrap;') do
37
- [
38
- link_to('View', (datatables_admin_path? ? effective_orders.admin_order_path(order) : effective_orders.order_path(order))),
39
- (link_to('Resend Receipt', effective_orders.resend_buyer_receipt_path(order), {'data-confirm' => 'This action will resend a copy of the original email receipt. Send receipt now?'}) if order.try(:purchased?))
40
- ].compact.join(' - ').html_safe
41
- end
36
+ link_to('View', (datatables_admin_path? ? effective_orders.admin_order_path(order) : effective_orders.order_path(order)))
42
37
  end
43
38
 
44
39
  def collection
@@ -52,11 +47,13 @@ if defined?(EffectiveDatatables)
52
47
  .select("#{query_total} AS total")
53
48
  .select("string_agg(order_items.title, '!!SEP!!') AS order_items")
54
49
 
55
- if EffectiveOrders.require_billing_address
50
+ if EffectiveOrders.require_billing_address && defined?(EffectiveAddresses)
51
+ tblAddresses = EffectiveAddresses.addresses_table_name
52
+
56
53
  collection = collection
57
- .joins("LEFT OUTER JOIN addresses ON addresses.addressable_id = orders.id AND addresses.addressable_type = 'Effective::Order'")
58
- .select("string_agg(addresses.full_name, '!!SEP!!') AS full_name")
59
- .where("addresses IS NULL OR addresses.category = 'billing'")
54
+ .joins("LEFT JOIN (SELECT addressable_id, string_agg(#{tblAddresses}.full_name, '!!SEP!!') AS buyer_name FROM #{tblAddresses} WHERE #{tblAddresses}.category = 'billing' AND #{tblAddresses}.addressable_type = 'Effective::Order' GROUP BY #{tblAddresses}.addressable_id) #{tblAddresses} ON orders.id = #{tblAddresses}.addressable_id")
55
+ .group("#{tblAddresses}.buyer_name")
56
+ .select("#{tblAddresses}.buyer_name AS buyer_name")
60
57
  end
61
58
 
62
59
  if attributes[:user_id].present?
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '1.2.4'.freeze
2
+ VERSION = '1.2.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
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: 2014-12-31 00:00:00.000000000 Z
11
+ date: 2015-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails