kaui 2.0.4 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -16
- data/app/assets/stylesheets/kaui/account.less +9 -1
- data/app/assets/stylesheets/kaui/common.less +2 -2
- data/app/controllers/kaui/accounts_controller.rb +11 -15
- data/app/controllers/kaui/audit_logs_controller.rb +2 -2
- data/app/controllers/kaui/engine_controller_util.rb +24 -17
- data/app/controllers/kaui/invoice_tags_controller.rb +28 -0
- data/app/controllers/kaui/invoices_controller.rb +45 -14
- data/app/controllers/kaui/payment_methods_controller.rb +5 -0
- data/app/helpers/kaui/account_helper.rb +10 -2
- data/app/helpers/kaui/plugin_helper.rb +1 -1
- data/app/helpers/kaui/uuid_helper.rb +1 -0
- data/app/models/kaui/tag.rb +1 -1
- data/app/views/kaui/accounts/_billing_info.html.erb +4 -0
- data/app/views/kaui/accounts/_payment_methods.html.erb +3 -0
- data/app/views/kaui/accounts/index.html.erb +7 -4
- data/app/views/kaui/admin_tenants/_form_plugin_config.erb +13 -3
- data/app/views/kaui/bundles/_bundle_details.html.erb +12 -0
- data/app/views/kaui/bundles/index.html.erb +2 -13
- data/app/views/kaui/invoice_tags/_form.html.erb +33 -0
- data/app/views/kaui/invoice_tags/_form_bar.html.erb +21 -0
- data/app/views/kaui/invoice_tags/edit.html.erb +10 -0
- data/app/views/kaui/invoices/_invoice_table.html.erb +28 -7
- data/app/views/kaui/invoices/index.html.erb +6 -4
- data/app/views/kaui/invoices/show.html.erb +10 -1
- data/app/views/kaui/layouts/kaui_flash.html.erb +8 -1
- data/app/views/kaui/payments/index.html.erb +3 -1
- data/config/routes.rb +6 -0
- data/lib/kaui.rb +55 -0
- data/lib/kaui/version.rb +1 -1
- data/test/dummy/config/initializers/money.rb +2 -0
- data/test/functional/kaui/account_emails_controller_test.rb +2 -2
- data/test/functional/kaui/account_tags_controller_test.rb +1 -1
- data/test/functional/kaui/accounts_controller_test.rb +4 -4
- data/test/functional/kaui/admin_tenants_controller_test.rb +1 -1
- data/test/functional/kaui/bundle_tags_controller_test.rb +1 -1
- data/test/functional/kaui/bundles_controller_test.rb +3 -3
- data/test/functional/kaui/chargebacks_controller_test.rb +2 -2
- data/test/functional/kaui/charges_controller_test.rb +2 -2
- data/test/functional/kaui/credits_controller_test.rb +2 -2
- data/test/functional/kaui/invoice_items_controller_test.rb +3 -3
- data/test/functional/kaui/invoices_controller_test.rb +2 -2
- data/test/functional/kaui/refunds_controller_test.rb +2 -2
- data/test/functional/kaui/subscriptions_controller_test.rb +6 -6
- data/test/killbill_test_helper.rb +2 -0
- data/test/unit/kaui/account_test.rb +2 -2
- data/test/unit/kaui/invoice_item_test.rb +1 -1
- data/test/unit/kaui/invoice_payment_test.rb +7 -7
- data/test/unit/kaui/invoice_test.rb +4 -4
- data/test/unit/kaui/payment_test.rb +7 -7
- metadata +83 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5d858912d18a92b6d29b430c5abcef292407e21
|
4
|
+
data.tar.gz: c9fb2496bc22b4c176cbf491d914be4f2ff794fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b9de048f13170e6ca37fd7656f5c4524e6c72f1820efb4c16d9778f61890fd613a4ab31daa25216792396d636d4df9215638e153f411f7e49fc1f3a17d479cc
|
7
|
+
data.tar.gz: c1f5fca064ec6d5e671f69ab21fccc35d63f02f24c9b05ff897b20466a2980f1c470a3bc11b14df8060b368dc77646d03307ed87b21eac94f828033cae40e295
|
data/README.md
CHANGED
@@ -91,22 +91,6 @@ Alternatively, you can run the `kaui` script under `bin` by setting your loadpat
|
|
91
91
|
|
92
92
|
ruby -Ilib bin/kaui /path/to/rails/app --path=$PWD --skip-bundle
|
93
93
|
|
94
|
-
Releases
|
95
|
-
========
|
96
|
-
|
97
|
-
To trigger a release, run (update `patch` as needed):
|
98
|
-
|
99
|
-
```
|
100
|
-
bundle exec gem bump -c -p -t -v patch
|
101
|
-
```
|
102
|
-
|
103
|
-
This will:
|
104
|
-
|
105
|
-
* Update the `version.rb` file
|
106
|
-
* Commit the changes
|
107
|
-
* Create the new tag and push the changes
|
108
|
-
|
109
|
-
GitHub Actions will automatically push the new gem to Rubygems.
|
110
94
|
|
111
95
|
Multi-Tenancy
|
112
96
|
=============
|
@@ -99,7 +99,7 @@ span {
|
|
99
99
|
font-weight: normal;
|
100
100
|
color: rgb(119, 119, 119);
|
101
101
|
|
102
|
-
&.label-success, &.label-warning, &.label-danger {
|
102
|
+
&.label-default, &.label-success, &.label-warning, &.label-danger {
|
103
103
|
color: #fff;
|
104
104
|
}
|
105
105
|
}
|
@@ -497,7 +497,7 @@ table.subtitle {
|
|
497
497
|
}
|
498
498
|
|
499
499
|
a {
|
500
|
-
margin: 0
|
500
|
+
margin: 0 5px;
|
501
501
|
text-transform: uppercase;
|
502
502
|
font-size: 12px;
|
503
503
|
|
@@ -29,12 +29,9 @@ class Kaui::AccountsController < Kaui::EngineController
|
|
29
29
|
data_extractor = lambda do |account, column|
|
30
30
|
[
|
31
31
|
account.parent_account_id,
|
32
|
-
account.name,
|
33
32
|
account.account_id,
|
34
33
|
account.external_key,
|
35
|
-
account.account_balance
|
36
|
-
account.city,
|
37
|
-
account.country
|
34
|
+
account.account_balance
|
38
35
|
][column]
|
39
36
|
end
|
40
37
|
|
@@ -44,12 +41,9 @@ class Kaui::AccountsController < Kaui::EngineController
|
|
44
41
|
child_label = account.parent_account_id.nil? ? '' : view_context.content_tag(:span, 'Child', class: ['label', 'label-info', 'account-child-label'])
|
45
42
|
end
|
46
43
|
|
47
|
-
[
|
48
|
-
|
49
|
-
|
50
|
-
account.external_key,
|
51
|
-
view_context.humanized_money_with_symbol(account.balance_to_money)
|
52
|
-
]
|
44
|
+
row = [child_label, view_context.link_to(account.account_id, view_context.url_for(:action => :show, :account_id => account.account_id))]
|
45
|
+
row += Kaui.account_search_columns.call(account, view_context)[1]
|
46
|
+
row
|
53
47
|
end
|
54
48
|
|
55
49
|
paginate searcher, data_extractor, formatter
|
@@ -83,17 +77,17 @@ class Kaui::AccountsController < Kaui::EngineController
|
|
83
77
|
@account = Kaui::Account::find_by_id_or_key(params.require(:account_id), true, true, cached_options_for_klient)
|
84
78
|
|
85
79
|
fetch_children = promise { @account.children(false, false, 'NONE',cached_options_for_klient)}
|
86
|
-
fetch_parent =
|
80
|
+
fetch_parent = @account.parent_account_id.nil? ? nil : promise { Kaui::Account::find_by_id(@account.parent_account_id,false,false,cached_options_for_klient) }
|
87
81
|
fetch_overdue_state = promise { @account.overdue(cached_options_for_klient) }
|
88
82
|
fetch_account_tags = promise { @account.tags(false, 'NONE', cached_options_for_klient).sort { |tag_a, tag_b| tag_a <=> tag_b } }
|
89
83
|
fetch_account_fields = promise { @account.custom_fields('NONE', cached_options_for_klient).sort { |cf_a, cf_b| cf_a.name.downcase <=> cf_b.name.downcase } }
|
90
84
|
fetch_account_emails = promise { Kaui::AccountEmail.find_all_sorted_by_account_id(@account.account_id, 'NONE', cached_options_for_klient) }
|
91
85
|
fetch_payments = promise { @account.payments(cached_options_for_klient).map! { |payment| Kaui::Payment.build_from_raw_payment(payment) } }
|
92
|
-
fetch_payment_methods = promise
|
86
|
+
fetch_payment_methods = promise { Kaui::PaymentMethod.find_all_by_account_id(@account.account_id, false, cached_options_for_klient) }
|
93
87
|
|
94
88
|
# is email notification plugin available
|
95
89
|
is_email_notifications_plugin_available = Kenui::EmailNotificationService.email_notification_plugin_available?(cached_options_for_klient).first
|
96
|
-
fetch_email_notification_configuration =
|
90
|
+
fetch_email_notification_configuration = !is_email_notifications_plugin_available ? nil : promise do
|
97
91
|
Kenui::EmailNotificationService.get_configuration_per_account(params.require(:account_id),cached_options_for_klient)
|
98
92
|
end.then do |configuration|
|
99
93
|
if configuration.first.is_a?(FalseClass)
|
@@ -106,7 +100,7 @@ class Kaui::AccountsController < Kaui::EngineController
|
|
106
100
|
fetch_payment_methods_with_details = fetch_payment_methods.then do |pms|
|
107
101
|
ops = []
|
108
102
|
pms.each do |pm|
|
109
|
-
ops << promise
|
103
|
+
ops << promise {
|
110
104
|
begin
|
111
105
|
Kaui::PaymentMethod.find_by_id(pm.payment_method_id, true, cached_options_for_klient)
|
112
106
|
rescue => e
|
@@ -125,7 +119,7 @@ class Kaui::AccountsController < Kaui::EngineController
|
|
125
119
|
@custom_fields = wait(fetch_account_fields)
|
126
120
|
@account_emails = wait(fetch_account_emails)
|
127
121
|
wait(fetch_payment_methods)
|
128
|
-
@payment_methods = wait(fetch_payment_methods_with_details).map
|
122
|
+
@payment_methods = wait(fetch_payment_methods_with_details).map{ |pm_f| wait(pm_f) }.reject { |pm| pm.nil? }
|
129
123
|
@available_tags = wait(fetch_available_tags)
|
130
124
|
@children = wait(fetch_children)
|
131
125
|
@account_parent = @account.parent_account_id.nil? ? nil : wait(fetch_parent)
|
@@ -183,6 +177,8 @@ class Kaui::AccountsController < Kaui::EngineController
|
|
183
177
|
redirect_to account_path(account_id), :notice => "Nothing to generate for target date #{target_date.nil? ? 'today' : target_date}"
|
184
178
|
elsif dry_run
|
185
179
|
@invoice = Kaui::Invoice.build_from_raw_invoice(invoice)
|
180
|
+
@invoice_tags = []
|
181
|
+
@available_invoice_tags = []
|
186
182
|
@payments = []
|
187
183
|
@payment_methods = nil
|
188
184
|
@account = Kaui::Account.find_by_id(account_id, false, false, options_for_klient)
|
@@ -65,7 +65,7 @@ class Kaui::AuditLogsController < Kaui::EngineController
|
|
65
65
|
elsif object_type == 'CUSTOM_FIELD'
|
66
66
|
audit_logs_with_history = Kaui::CustomField.new({:custom_field_id => object_id}).audit_logs_with_history(cached_options_for_klient)
|
67
67
|
elsif object_type == 'INVOICE'
|
68
|
-
invoice = Kaui::Invoice::find_by_id(object_id,
|
68
|
+
invoice = Kaui::Invoice::find_by_id(object_id, "NONE", cached_options_for_klient)
|
69
69
|
audit_logs_with_history = invoice.audit_logs_with_history(cached_options_for_klient)
|
70
70
|
elsif object_type == 'INVOICE_ITEM'
|
71
71
|
invoice_item = Kaui::InvoiceItem.new
|
@@ -113,4 +113,4 @@ class Kaui::AuditLogsController < Kaui::EngineController
|
|
113
113
|
OBJECT_WITH_HISTORY.include?(object_type)
|
114
114
|
end
|
115
115
|
|
116
|
-
end
|
116
|
+
end
|
@@ -41,7 +41,7 @@ module Kaui::EngineControllerUtil
|
|
41
41
|
b = data_extractor.call(b, ordering_column)
|
42
42
|
sort = a <=> b
|
43
43
|
sort.nil? ? -1 : sort
|
44
|
-
end unless search_key.nil? # Keep DB ordering when listing all entries
|
44
|
+
end unless search_key.nil? # Keep DB ordering when listing all entries (note! make sure to set "ordering": false in DataTables config as the client-side sort behavior can be confusing)
|
45
45
|
pages.reverse! if ordering_dir == 'desc' && limit >= 0 || ordering_dir == 'asc' && limit < 0
|
46
46
|
|
47
47
|
pages.each { |page| json[:data] << formatter.call(page) }
|
@@ -51,25 +51,29 @@ module Kaui::EngineControllerUtil
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
def promise
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
def promise
|
55
|
+
# Evaluation starts immediately
|
56
|
+
::Concurrent::Promises.future do
|
57
|
+
# https://github.com/rails/rails/issues/26847
|
58
|
+
Rails.application.executor.wrap do
|
59
|
+
yield
|
60
|
+
end
|
61
|
+
end
|
58
62
|
end
|
59
63
|
|
60
64
|
def wait(promise)
|
61
|
-
#
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
65
|
+
# https://github.com/rails/rails/issues/26847
|
66
|
+
ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
|
67
|
+
# Make sure to set a timeout to avoid infinite wait
|
68
|
+
value = promise.value!(60)
|
69
|
+
raise promise.reason unless promise.reason.nil?
|
70
|
+
if value.nil? && promise.state != :fulfilled
|
71
|
+
# Could be https://github.com/ruby-concurrency/concurrent-ruby/issues/585
|
72
|
+
Rails.logger.warn("Unable to run promise #{promise_as_string(promise)}")
|
73
|
+
raise Timeout::Error
|
74
|
+
end
|
75
|
+
value
|
71
76
|
end
|
72
|
-
value
|
73
77
|
end
|
74
78
|
|
75
79
|
def promise_as_string(promise)
|
@@ -82,7 +86,9 @@ module Kaui::EngineControllerUtil
|
|
82
86
|
# Used to format flash error messages
|
83
87
|
def as_string(e)
|
84
88
|
if e.is_a?(KillBillClient::API::ResponseError)
|
85
|
-
|
89
|
+
as_string_from_response(e.response.body)
|
90
|
+
elsif e.respond_to?(:cause) && !e.cause.nil?
|
91
|
+
as_string(e.cause)
|
86
92
|
else
|
87
93
|
log_rescue_error(e)
|
88
94
|
e.message
|
@@ -104,6 +110,7 @@ module Kaui::EngineControllerUtil
|
|
104
110
|
if error_message.respond_to? :[] and error_message['message'].present?
|
105
111
|
# Likely BillingExceptionJson
|
106
112
|
error_message = error_message['message']
|
113
|
+
error_message += " (code=#{error_message['code']})" unless error_message['code'].blank?
|
107
114
|
end
|
108
115
|
# Limit the error size to avoid ActionDispatch::Cookies::CookieOverflow
|
109
116
|
error_message[0..1000]
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Kaui::InvoiceTagsController < Kaui::EngineController
|
2
|
+
|
3
|
+
def edit
|
4
|
+
@invoice_id = params.require(:invoice_id)
|
5
|
+
|
6
|
+
cached_options_for_klient = options_for_klient
|
7
|
+
fetch_tag_names = promise { (Kaui::Tag.all_for_invoice(@invoice_id, false, 'NONE', cached_options_for_klient).map { |tag| tag.tag_definition_name }).sort }
|
8
|
+
fetch_available_tags = promise { Kaui::TagDefinition.all_for_invoice(cached_options_for_klient) }
|
9
|
+
|
10
|
+
@tag_names = wait(fetch_tag_names)
|
11
|
+
@available_tags = wait(fetch_available_tags)
|
12
|
+
end
|
13
|
+
|
14
|
+
def update
|
15
|
+
account_id = params.require(:account_id)
|
16
|
+
invoice_id = params.require(:invoice_id)
|
17
|
+
|
18
|
+
tags = []
|
19
|
+
params.each do |tag, tag_name|
|
20
|
+
tag_info = tag.split('_')
|
21
|
+
next if tag_info.size != 2 or tag_info[0] != 'tag'
|
22
|
+
tags << tag_info[1]
|
23
|
+
end
|
24
|
+
|
25
|
+
Kaui::Tag.set_for_invoice(invoice_id, tags, current_user.kb_username, params[:reason], params[:comment], options_for_klient)
|
26
|
+
redirect_to kaui_engine.invoice_path(invoice_id, :account_id => account_id), :notice => 'Invoice tags successfully set'
|
27
|
+
end
|
28
|
+
end
|
@@ -18,26 +18,39 @@ class Kaui::InvoicesController < Kaui::EngineController
|
|
18
18
|
if account.nil?
|
19
19
|
Kaui::Invoice.list_or_search(search_key, offset, limit, cached_options_for_klient)
|
20
20
|
else
|
21
|
-
account.invoices(cached_options_for_klient).map! { |invoice| Kaui::Invoice.build_from_raw_invoice(invoice) }
|
21
|
+
account.invoices(cached_options_for_klient.merge({ :params => { :includeVoidedInvoices => true } })).map! { |invoice| Kaui::Invoice.build_from_raw_invoice(invoice) }
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
account_id = (params[:search] || {})[:value]
|
26
|
+
if account_id.blank?
|
27
|
+
# Don't show amount and balance, and they will not be populated
|
28
|
+
data_extractor = lambda do |invoice, column|
|
29
|
+
[
|
30
|
+
invoice.invoice_number.to_i,
|
31
|
+
invoice.invoice_date
|
32
|
+
][column]
|
33
|
+
end
|
34
|
+
formatter = lambda do |invoice|
|
35
|
+
row = [view_context.link_to(invoice.invoice_number, view_context.url_for(:controller => :invoices, :action => :show, :account_id => invoice.account_id, :id => invoice.invoice_id))]
|
36
|
+
row += Kaui.invoice_search_columns.call(invoice, view_context)[1]
|
37
|
+
row
|
38
|
+
end
|
39
|
+
else
|
40
|
+
data_extractor = lambda do |invoice, column|
|
41
|
+
[
|
27
42
|
invoice.invoice_number.to_i,
|
28
43
|
invoice.invoice_date,
|
29
44
|
invoice.amount,
|
30
|
-
invoice.balance
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
view_context.humanized_money_with_symbol(invoice.balance_to_money)
|
40
|
-
]
|
45
|
+
invoice.balance,
|
46
|
+
invoice.status
|
47
|
+
][column]
|
48
|
+
end
|
49
|
+
formatter = lambda do |invoice|
|
50
|
+
row = [view_context.link_to(invoice.invoice_number, view_context.url_for(:controller => :invoices, :action => :show, :account_id => invoice.account_id, :id => invoice.invoice_id))]
|
51
|
+
row += Kaui.account_invoices_columns.call(invoice, view_context)[1]
|
52
|
+
row
|
53
|
+
end
|
41
54
|
end
|
42
55
|
|
43
56
|
paginate searcher, data_extractor, formatter
|
@@ -88,6 +101,9 @@ class Kaui::InvoicesController < Kaui::EngineController
|
|
88
101
|
custom_fields_per_invoice_item.inject({}) { |hsh, entry| (hsh[entry.object_id] ||= []) << entry; hsh }
|
89
102
|
}
|
90
103
|
|
104
|
+
fetch_invoice_tags = promise { @invoice.tags(false, 'NONE', cached_options_for_klient).sort { |tag_a, tag_b| tag_a <=> tag_b } }
|
105
|
+
fetch_available_invoice_tags = promise { Kaui::TagDefinition.all_for_invoice(cached_options_for_klient) }
|
106
|
+
|
91
107
|
@payments = wait(fetch_payments)
|
92
108
|
@payment_methods = wait(fetch_pms)
|
93
109
|
@custom_fields = wait(fetch_invoice_fields)
|
@@ -95,6 +111,21 @@ class Kaui::InvoicesController < Kaui::EngineController
|
|
95
111
|
@custom_fields_per_invoice_item = wait(fetch_custom_fields_per_invoice_item)
|
96
112
|
@tags_per_invoice_item = wait(fetch_tags_per_invoice_item)
|
97
113
|
@available_invoice_item_tags = wait(fetch_available_invoice_item_tags)
|
114
|
+
@invoice_tags = wait(fetch_invoice_tags)
|
115
|
+
@available_invoice_tags = wait(fetch_available_invoice_tags)
|
116
|
+
@available_invoice_tags.reject! { |td| td.name == 'WRITTEN_OFF' } if @invoice.status == 'VOID'
|
117
|
+
end
|
118
|
+
|
119
|
+
def void_invoice
|
120
|
+
cached_options_for_klient = options_for_klient
|
121
|
+
invoice = KillBillClient::Model::Invoice.find_by_id(params.require(:id), 'NONE', cached_options_for_klient)
|
122
|
+
begin
|
123
|
+
invoice.void(current_user.kb_username, params[:reason], params[:comment], cached_options_for_klient)
|
124
|
+
redirect_to account_invoice_path(invoice.account_id, invoice.invoice_id), :notice => 'Invoice successfully voided'
|
125
|
+
rescue => e
|
126
|
+
flash[:error] = "Unable to void invoice: #{as_string(e)}"
|
127
|
+
redirect_to account_invoice_path(invoice.account_id, invoice.invoice_id)
|
128
|
+
end
|
98
129
|
end
|
99
130
|
|
100
131
|
def restful_show
|
@@ -101,6 +101,11 @@ class Kaui::PaymentMethodsController < Kaui::EngineController
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
def refresh
|
105
|
+
Kaui::PaymentMethod.refresh(params.require(:account_id), current_user.kb_username, params[:reason], params[:comment], options_for_klient)
|
106
|
+
redirect_to kaui_engine.account_path(params.require(:account_id)), :notice => 'Payment methods successfully refreshed'
|
107
|
+
end
|
108
|
+
|
104
109
|
private
|
105
110
|
|
106
111
|
def find_value_from_properties(properties, key)
|
@@ -3,7 +3,7 @@ module Kaui
|
|
3
3
|
|
4
4
|
def pretty_account_identifier
|
5
5
|
return nil if @account.nil?
|
6
|
-
|
6
|
+
Kaui.pretty_account_identifier.call(@account)
|
7
7
|
end
|
8
8
|
|
9
9
|
def email_notifications_plugin_available?
|
@@ -12,9 +12,17 @@ module Kaui
|
|
12
12
|
return false
|
13
13
|
end
|
14
14
|
|
15
|
+
def deposit_plugin_available?
|
16
|
+
Killbill::Deposit::DepositClient.deposit_plugin_available?(Kaui.current_tenant_user_options(current_user, session)).first
|
17
|
+
rescue
|
18
|
+
return false
|
19
|
+
end
|
20
|
+
|
15
21
|
def account_closed?
|
16
22
|
return false if @account.nil?
|
17
|
-
|
23
|
+
# Note: we ignore errors here, so that the call doesn't prevent the screen to load. While the error isn't surfaced, if there is an error with the catalog for instance,
|
24
|
+
# the AJAX call to compute the next invoice date should hopefully trigger a flash error.
|
25
|
+
blocking_states = @account.blocking_states('ACCOUNT', 'account-service', 'NONE', Kaui.current_tenant_user_options(current_user, session)) rescue []
|
18
26
|
|
19
27
|
is_account_closed = false
|
20
28
|
blocking_states.each do |blocking_state|
|
@@ -10,7 +10,7 @@ module Kaui
|
|
10
10
|
def installed_plugins
|
11
11
|
installed_plugins = []
|
12
12
|
nodes_info = KillBillClient::Model::NodesInfo.nodes_info(Kaui.current_tenant_user_options(current_user, session)) || []
|
13
|
-
plugins_info = nodes_info.first.plugins_info || []
|
13
|
+
plugins_info = nodes_info.empty? ? [] : (nodes_info.first.plugins_info || [])
|
14
14
|
|
15
15
|
plugins_info.each do |plugin|
|
16
16
|
next if plugin.version.nil?
|
data/app/models/kaui/tag.rb
CHANGED
@@ -9,7 +9,7 @@ class Kaui::Tag < KillBillClient::Model::Tag
|
|
9
9
|
end
|
10
10
|
|
11
11
|
class << self
|
12
|
-
[:account, :bundle, :subscription].each do |model|
|
12
|
+
[:account, :bundle, :subscription, :invoice].each do |model|
|
13
13
|
define_method "all_for_#{model.to_s}" do |model_id, included_deleted, audit, options|
|
14
14
|
instance = Kaui.const_get(model.to_s.camelize).new("#{model.to_s}_id".to_sym => model_id)
|
15
15
|
instance.tags(included_deleted, audit, options)
|
@@ -25,6 +25,10 @@
|
|
25
25
|
<%= link_to '<i class="fa fa-plus-square"></i> Create charge'.html_safe,
|
26
26
|
kaui_engine.new_account_charge_path(@account.account_id, :currency => @account.currency) %>
|
27
27
|
<% end %>
|
28
|
+
<% if deposit_plugin_available? %>
|
29
|
+
<%= link_to '<i class="fa fa-plus-square"></i> Create deposit'.html_safe,
|
30
|
+
deposit_engine.collection_index_path(:account_id => @account.account_id, :currency => @account.currency) %>
|
31
|
+
<% end %>
|
28
32
|
</div>
|
29
33
|
</div>
|
30
34
|
</div>
|
@@ -7,6 +7,9 @@
|
|
7
7
|
<%= link_to '<i class="fa fa-plus-square"></i>'.html_safe,
|
8
8
|
kaui_engine.new_payment_method_path(:account_id => @account.account_id),
|
9
9
|
:class => 'btn btn-xs' %>
|
10
|
+
<%= form_tag kaui_engine.refresh_payment_methods_path(params.to_h), :method => :post, :class => 'form-force-inline form-right' do %>
|
11
|
+
<%= button_tag '<i class="fa fa-refresh"></i>'.html_safe, :class => 'btn btn-xs' %>
|
12
|
+
<% end %>
|
10
13
|
<% end %>
|
11
14
|
</h1>
|
12
15
|
|
@@ -13,8 +13,9 @@
|
|
13
13
|
<tr>
|
14
14
|
<th></th>
|
15
15
|
<th>ID</th>
|
16
|
-
|
17
|
-
|
16
|
+
<% Kaui.account_search_columns.call()[0].each do |title| %>
|
17
|
+
<th><%= title %></th>
|
18
|
+
<% end %>
|
18
19
|
</tr>
|
19
20
|
</thead>
|
20
21
|
<tbody>
|
@@ -39,8 +40,10 @@ $(document).ready(function() {
|
|
39
40
|
},
|
40
41
|
"pageLength": <%= @limit %>,
|
41
42
|
"displayStart": <%= @offset %>,
|
42
|
-
<%
|
43
|
-
|
43
|
+
<% if @search_query.blank? %>
|
44
|
+
"ordering": false,
|
45
|
+
<% elsif !@ordering.blank? %>
|
46
|
+
"order": [[ 1, "<%= @ordering %>" ]],
|
44
47
|
<% end %>
|
45
48
|
"processing": true,
|
46
49
|
"serverSide": true,
|