caboose-cms 0.9.113 → 0.9.114

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: e5b6301fd321b1efeab9a0cd5f7ed2e70a78fc56
4
- data.tar.gz: 7219d25362856913714e7ec5946136e5590093b2
3
+ metadata.gz: ae72cde296525849afad58aaab5bbd68ceee848b
4
+ data.tar.gz: 52509f12ba044955cd0153b167b6292879133a6f
5
5
  SHA512:
6
- metadata.gz: 3c7f98b0ea172cf2680ee857d5e917a6bc75e0739d54d80ea248b488c57413da9c234a6327fea742812840f02c573a625cb59fe28cede0a8734eaa280c7b1d80
7
- data.tar.gz: cfecdb73e6bb98c0288afe5dcc9ef3a1f0f3ab422faa00d4c14de85dd5f80bd88454cb96ce26b88df7e59c497e7abe0a3631feeabdbf0190e7e6b2b4a3062016
6
+ metadata.gz: dd10147fd33167312d596827dc3ac730f308ff6e2275970553fda5962f01d3bdb72073549522f95d79a1de6f403025da6935c8578a5dd2dcb6ab5f2a96790110
7
+ data.tar.gz: 808eb857f1e05a649e85b9fe9565f7380677ea4f0363e93d67b2ed77fd635400e3bb6eed27fa992899120bc4f266bde5b22c0cb146f6fa82d0be07cac9a82a02
@@ -529,9 +529,10 @@ InvoiceController.prototype = {
529
529
  }
530
530
  tr.append($('<td/>')
531
531
  .append(that.line_item_link(li))
532
+ .append(that.line_item_opts(li))
532
533
  .append(that.subscription_dates(li))
533
- .append(that.line_item_weight(li))
534
- .append(that.gift_options(li))
534
+ // .append(that.line_item_weight(li))
535
+ // .append(that.gift_options(li))
535
536
  .append($('<div/>').attr('id', 'line_item_' + li.id + '_message'))
536
537
  );
537
538
  tr.append($('<td/>').append($('<div/>').attr('id', 'lineitem_' + li.id + '_status')))
@@ -629,6 +630,23 @@ InvoiceController.prototype = {
629
630
  });
630
631
  return link;
631
632
  },
633
+
634
+ line_item_opts: function(li) {
635
+ var that = this;
636
+ var v = li.variant;
637
+ var div = $('<p />');
638
+ var opts = [];
639
+ if ( v && v.option1 )
640
+ opts.push(v.option1);
641
+ if ( v && v.option2 )
642
+ opts.push(v.option2);
643
+ if ( v && v.option3 )
644
+ opts.push(v.option3);
645
+ if ( opts.length > 0 )
646
+ div.text( opts.join(', '));
647
+ div.css('margin-bottom',0).css('margin-top','5px');
648
+ return div;
649
+ },
632
650
 
633
651
  line_item_weight: function(li)
634
652
  {
@@ -726,8 +744,9 @@ InvoiceController.prototype = {
726
744
 
727
745
  tr.append($('<td/>')
728
746
  .append(that.line_item_link(li))
747
+ .append(that.line_item_opts(li))
729
748
  .append(that.subscription_dates(li))
730
- .append(that.gift_options(li))
749
+ // .append(that.gift_options(li))
731
750
  .append($('<div/>').attr('id', 'line_item_' + li.id + '_message'))
732
751
  );
733
752
 
@@ -5,6 +5,13 @@ module Caboose
5
5
  # @route GET /admin/users/:user_id/invoices
6
6
  def admin_index
7
7
  return if !user_is_allowed('invoices', 'view')
8
+
9
+ if !params[:game_id].blank?
10
+ game = Colonnade::Game.find(params[:game_id])
11
+ menu = Colonnade::Menu.where(:game_id => game.id).first if game
12
+ invoice_ids = Colonnade::SuiteMenu.where(:menu_id => menu.id).pluq(:invoice_id) if menu
13
+ invoice_ids = invoice_ids.to_s.gsub('[','').gsub(']','')
14
+ end
8
15
 
9
16
  @pager = Caboose::PageBarGenerator.new(params, {
10
17
  'site_id' => @site.id,
@@ -20,6 +27,7 @@ module Caboose
20
27
  'sort' => 'id',
21
28
  'desc' => 1,
22
29
  'base_url' => params[:user_id] ? "/admin/users/#{params[:user_id]}/invoices" : "/admin/invoices",
30
+ 'additional_where' => [ params[:game_id].blank? ? 'id is not null' : ( invoice_ids.blank? ? "id is null" : "id in (#{invoice_ids})" ) ],
23
31
  'use_url_params' => false,
24
32
  'items_per_page' => 100
25
33
  })
@@ -214,13 +222,44 @@ module Caboose
214
222
 
215
223
  # @route GET /admin/invoices/print-pending
216
224
  def admin_print_pending
217
- return if !user_is_allowed('invoices', 'edit')
218
-
219
- pdf = PendingInvoicesPdf.new
225
+ return if !user_is_allowed('invoices', 'edit')
226
+
227
+ pdf = @site.store_config.custom_invoice_pdf
228
+ pdf = "PendingInvoicesPdf" if pdf.blank?
229
+ eval("pdf = #{pdf}.new")
230
+
231
+ where = []
232
+ terms = []
233
+ where << "(id = ?)" if !params[:id].blank?
234
+ terms << params[:id] if !params[:id].blank?
235
+ where << "(invoice_number = ?)" if !params[:invoice_number].blank?
236
+ terms << params[:invoice_number] if !params[:invoice_number].blank?
237
+ where << "(customer_id = ?)" if !params[:customer_id].blank?
238
+ terms << params[:customer_id] if !params[:customer_id].blank?
239
+ where << "(total_gte = ?)" if !params[:total_gte].blank?
240
+ terms << params[:total_gte] if !params[:total_gte].blank?
241
+ where << "(total_lte = ?)" if !params[:total_lte].blank?
242
+ terms << params[:total_lte] if !params[:total_lte].blank?
243
+ where << "(status = ?)"
244
+ terms << 'pending'
245
+
246
+
247
+ if !params[:game_id].blank?
248
+ game = Colonnade::Game.find(params[:game_id])
249
+ menu = Colonnade::Menu.where(:game_id => game.id).first if game
250
+ invoice_ids = Colonnade::SuiteMenu.where(:menu_id => menu.id).pluq(:invoice_id) if menu
251
+ end
252
+
253
+ where << "(id in (?))" if invoice_ids
254
+ terms << invoice_ids if invoice_ids
255
+
256
+
257
+ where2 = where.join(' AND ')
258
+
259
+ pdf.invoices = Invoice.where(where2, *terms).all
220
260
  if params[:print_card_details]
221
261
  pdf.print_card_details = params[:print_card_details].to_i == 1
222
262
  end
223
- pdf.invoices = Invoice.where(:site_id => @site.id, :status => Invoice::STATUS_PENDING).all
224
263
  send_data pdf.to_pdf, :filename => "pending_invoices.pdf", :type => "application/pdf", :disposition => "inline"
225
264
  end
226
265
 
@@ -1,3 +1,4 @@
1
+ <div style="padding-right:20px;">
1
2
 
2
3
  <% if @edituser %>
3
4
  <%= render :partial => 'caboose/users/admin_header' %>
@@ -20,6 +21,9 @@
20
21
  <%= render :partial => 'caboose/users/admin_footer' %>
21
22
  <% end %>
22
23
 
24
+ </div>
25
+
26
+
23
27
  <!--
24
28
  <p>
25
29
  <input type='button' value='< Back' onclick="window.location='/admin/invoices';" />
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.113'
2
+ VERSION = '0.9.114'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.113
4
+ version: 0.9.114
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-20 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg