kaui 4.0.14 → 4.0.15
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 +4 -4
- data/app/assets/javascripts/kaui/multi_functions_bar_utils.js +1 -1
- data/app/controllers/kaui/admin_tenants_controller.rb +24 -0
- data/app/controllers/kaui/engine_controller.rb +2 -1
- data/app/controllers/kaui/engine_controller_util.rb +26 -2
- data/app/controllers/kaui/invoices_controller.rb +3 -3
- data/app/controllers/kaui/payments_controller.rb +3 -3
- data/app/views/kaui/admin_tenants/new_overdue_config.html.erb +13 -0
- data/app/views/kaui/invoices/index.html.erb +3 -3
- data/config/locales/en.yml +2 -0
- data/config/routes.rb +1 -0
- data/lib/kaui/error_handler.rb +2 -1
- data/lib/kaui/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3452f98093718cc5761ee58798ac78467b66d046fc5cf17556060bd02f7637ce
|
|
4
|
+
data.tar.gz: 555af1e3377e9fcb143716618644e2701138d2a731c7f970761691a0d3ecd0fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 30d0269df326b5db8336c910ee4a111da1101d5212c43b728fbac297015b9a18409ffed04978867194bac6e7feda6beea4ea101469e201ab6465de74c863da6d
|
|
7
|
+
data.tar.gz: 3c289f1741f5ddda2c614adfca575dff1b540ea56cde455beb8fb870bbb4c898c9c793ffd0b991818fe6883f55c50a4412efbd45b0c9d2f0180ac67c7637698c
|
|
@@ -374,7 +374,7 @@ $(document).ready(function() {
|
|
|
374
374
|
container.hide();
|
|
375
375
|
|
|
376
376
|
populateSavedSearchesDropdown();
|
|
377
|
-
$('#
|
|
377
|
+
$('#applyAdvanceSearch').trigger('click');
|
|
378
378
|
});
|
|
379
379
|
|
|
380
380
|
$(document).on('hidden.bs.modal', '#advanceSearchModal', function () {
|
|
@@ -288,13 +288,19 @@ module Kaui
|
|
|
288
288
|
options = tenant_options_for_client
|
|
289
289
|
options[:api_key] = @tenant.api_key
|
|
290
290
|
options[:api_secret] = @tenant.api_secret
|
|
291
|
+
@overdue_config_exists = false
|
|
291
292
|
begin
|
|
292
293
|
@overdue = Kaui::Overdue.get_overdue_json(options)
|
|
293
294
|
@overdue_corrupted = false
|
|
295
|
+
@overdue_config_exists = @overdue.overdue_states.present? && !@overdue.has_states
|
|
296
|
+
rescue KillBillClient::API::NotFound
|
|
297
|
+
@overdue = KillBillClient::Model::Overdue.new.tap { |o| o.overdue_states = [] }
|
|
298
|
+
@overdue_corrupted = false
|
|
294
299
|
rescue StandardError => e
|
|
295
300
|
Rails.logger.warn("Failed to load overdue configuration for tenant #{@tenant.id}: #{e.class}: #{e.message}")
|
|
296
301
|
@overdue = KillBillClient::Model::Overdue.new.tap { |o| o.overdue_states = [] }
|
|
297
302
|
@overdue_corrupted = true
|
|
303
|
+
@overdue_config_exists = true
|
|
298
304
|
flash.now[:warning] = 'The existing overdue configuration is corrupted and cannot be loaded. Use the XML upload below to replace it with a valid configuration.'
|
|
299
305
|
end
|
|
300
306
|
end
|
|
@@ -342,6 +348,24 @@ module Kaui
|
|
|
342
348
|
redirect_to admin_tenant_path(current_tenant.id, active_tab: 'OverdueShow'), notice: I18n.t('flashes.notices.overdue_uploaded_successfully')
|
|
343
349
|
end
|
|
344
350
|
|
|
351
|
+
def delete_overdue_config
|
|
352
|
+
current_tenant = safely_find_tenant_by_id(params[:id])
|
|
353
|
+
|
|
354
|
+
options = tenant_options_for_client
|
|
355
|
+
options[:api_key] = current_tenant.api_key
|
|
356
|
+
options[:api_secret] = current_tenant.api_secret
|
|
357
|
+
|
|
358
|
+
begin
|
|
359
|
+
Kaui::AdminTenant.delete_tenant_user_key_value('OVERDUE_CONFIG', options[:username], nil, comment, options)
|
|
360
|
+
rescue StandardError => e
|
|
361
|
+
flash[:error] = "Failed to delete overdue config: #{as_string(e)}"
|
|
362
|
+
redirect_to admin_tenant_new_overdue_config_path(id: current_tenant.id) and return
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
flash[:overdue_deleted] = true
|
|
366
|
+
redirect_to admin_tenant_path(current_tenant.id, active_tab: 'OverdueShow'), notice: I18n.t('flashes.notices.overdue_deleted_successfully')
|
|
367
|
+
end
|
|
368
|
+
|
|
345
369
|
def upload_invoice_template
|
|
346
370
|
current_tenant = safely_find_tenant_by_id(params[:id])
|
|
347
371
|
|
|
@@ -38,7 +38,8 @@ class Kaui::EngineController < ApplicationController
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def populate_account_details
|
|
41
|
-
|
|
41
|
+
account_id = scalar_account_id_param
|
|
42
|
+
@account ||= account_id.present? ? Kaui::Account.find_by_id(account_id, false, false, options_for_klient) : Kaui::Account.new
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
def retrieve_tenants_for_current_user
|
|
@@ -37,8 +37,8 @@ module Kaui
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def paginate(searcher, data_extractor, formatter, table_default_columns = [])
|
|
40
|
-
search_key = (params[:search] || {})[:value].presence
|
|
41
|
-
advance_search_query = params[:advance_search_query].presence
|
|
40
|
+
search_key = normalize_search_key((params[:search] || {})[:value]).presence
|
|
41
|
+
advance_search_query = normalize_search_key(params[:advance_search_query]).presence
|
|
42
42
|
|
|
43
43
|
search_key = advance_search_query if advance_search_query
|
|
44
44
|
search_key = handle_balance_search(search_key) if search_key.present?
|
|
@@ -84,6 +84,30 @@ module Kaui
|
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
+
def advanced_search_query?(search_key)
|
|
88
|
+
search_key.to_s.include?('_q')
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def scalar_account_id_param
|
|
92
|
+
path_account_id = request.path_parameters[:account_id].presence
|
|
93
|
+
return path_account_id if path_account_id.present?
|
|
94
|
+
|
|
95
|
+
account_id = params[:account_id]
|
|
96
|
+
account_id if account_id.is_a?(String) || account_id.is_a?(Numeric)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def normalize_search_key(search_key)
|
|
100
|
+
return if search_key.blank?
|
|
101
|
+
|
|
102
|
+
if search_key.respond_to?(:to_unsafe_h)
|
|
103
|
+
search_key.to_unsafe_h.to_query
|
|
104
|
+
elsif search_key.is_a?(Hash)
|
|
105
|
+
search_key.to_query
|
|
106
|
+
else
|
|
107
|
+
search_key
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
87
111
|
def promise(&)
|
|
88
112
|
# Evaluation starts immediately
|
|
89
113
|
::Concurrent::Promises.future do
|
|
@@ -4,7 +4,7 @@ require 'csv'
|
|
|
4
4
|
module Kaui
|
|
5
5
|
class InvoicesController < Kaui::EngineController
|
|
6
6
|
def index
|
|
7
|
-
@search_query =
|
|
7
|
+
@search_query = scalar_account_id_param
|
|
8
8
|
@advance_search_query = params[:q] || request.query_string
|
|
9
9
|
@ordering = params[:ordering] || 'desc'
|
|
10
10
|
@offset = params[:offset] || 0
|
|
@@ -15,7 +15,7 @@ module Kaui
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def download
|
|
18
|
-
account_id =
|
|
18
|
+
account_id = scalar_account_id_param
|
|
19
19
|
start_date = params[:startDate]
|
|
20
20
|
end_date = params[:endDate]
|
|
21
21
|
all_fields_checked = params[:allFieldsChecked] == 'true'
|
|
@@ -60,7 +60,7 @@ module Kaui
|
|
|
60
60
|
|
|
61
61
|
searcher = lambda do |search_key, offset, limit|
|
|
62
62
|
account = begin
|
|
63
|
-
Kaui::Account.find_by_id_or_key(search_key, false, false, cached_options_for_klient)
|
|
63
|
+
Kaui::Account.find_by_id_or_key(search_key, false, false, cached_options_for_klient) unless advanced_search_query?(search_key)
|
|
64
64
|
rescue StandardError
|
|
65
65
|
nil
|
|
66
66
|
end
|
|
@@ -5,7 +5,7 @@ require 'csv'
|
|
|
5
5
|
module Kaui
|
|
6
6
|
class PaymentsController < Kaui::EngineController
|
|
7
7
|
def index
|
|
8
|
-
@search_query = params[:q] ||
|
|
8
|
+
@search_query = params[:q] || scalar_account_id_param
|
|
9
9
|
@advance_search_query = params[:q] || request.query_string
|
|
10
10
|
@ordering = params[:ordering] || (@search_query.blank? ? 'desc' : 'asc')
|
|
11
11
|
@offset = params[:offset] || 0
|
|
@@ -16,7 +16,7 @@ module Kaui
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def download
|
|
19
|
-
account_id =
|
|
19
|
+
account_id = scalar_account_id_param
|
|
20
20
|
start_date = params[:startDate]
|
|
21
21
|
end_date = params[:endDate]
|
|
22
22
|
all_fields_checked = params[:allFieldsChecked] == 'true'
|
|
@@ -104,7 +104,7 @@ module Kaui
|
|
|
104
104
|
payments = Kaui::Payment.list_or_search(payment_state, offset, limit, options_for_klient)
|
|
105
105
|
else
|
|
106
106
|
account = begin
|
|
107
|
-
Kaui::Account.find_by_id_or_key(search_key, false, false, options_for_klient)
|
|
107
|
+
Kaui::Account.find_by_id_or_key(search_key, false, false, options_for_klient) unless advanced_search_query?(search_key)
|
|
108
108
|
rescue StandardError
|
|
109
109
|
nil
|
|
110
110
|
end
|
|
@@ -10,6 +10,19 @@
|
|
|
10
10
|
</span>
|
|
11
11
|
Overdue Configuration
|
|
12
12
|
</h5>
|
|
13
|
+
<% if @overdue_config_exists && can?(:config_upload, Kaui::AdminTenant) %>
|
|
14
|
+
<% overdue_delete_confirmation = t('admin_tenants.delete_overdue_config_confirmation') %>
|
|
15
|
+
<div class="form-group d-flex justify-content-end pb-3">
|
|
16
|
+
<%= form_tag(kaui_engine.admin_tenant_delete_overdue_config_path(id: @tenant.id), method: :delete, class: 'd-inline', onsubmit: "return confirm('#{j(overdue_delete_confirmation)}');") do %>
|
|
17
|
+
<%= render "kaui/components/button/button", {
|
|
18
|
+
label: 'Delete',
|
|
19
|
+
variant: "d-inline-flex align-items-center gap-1",
|
|
20
|
+
type: "submit",
|
|
21
|
+
html_class: "kaui-button delete-button custom-hover"
|
|
22
|
+
} %>
|
|
23
|
+
<% end %>
|
|
24
|
+
</div>
|
|
25
|
+
<% end %>
|
|
13
26
|
<div class="form-group d-flex pb-3">
|
|
14
27
|
<label class="col-sm-1 control-label">Type</label>
|
|
15
28
|
<div class="toggle-segment col-sm-9">
|
|
@@ -50,7 +50,7 @@ $(document).ready(function() {
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
var stateKey = 'DataTables_invoices-
|
|
53
|
+
var stateKey = 'DataTables_invoices-table';
|
|
54
54
|
var state = JSON.parse(localStorage.getItem(stateKey));
|
|
55
55
|
if (state) {
|
|
56
56
|
state.start = <%= @offset %>;
|
|
@@ -64,10 +64,10 @@ $(document).ready(function() {
|
|
|
64
64
|
},
|
|
65
65
|
"stateSave": true,
|
|
66
66
|
"stateSaveCallback": function(settings, data) {
|
|
67
|
-
localStorage.setItem(
|
|
67
|
+
localStorage.setItem(stateKey, JSON.stringify(data));
|
|
68
68
|
},
|
|
69
69
|
"stateLoadCallback": function(settings) {
|
|
70
|
-
return JSON.parse(localStorage.getItem(
|
|
70
|
+
return JSON.parse(localStorage.getItem(stateKey));
|
|
71
71
|
},
|
|
72
72
|
"scrollX": true,
|
|
73
73
|
"dom": "<'row'r>t<'row'<'col-md-6'i><'col-md-6'p>>",
|
data/config/locales/en.yml
CHANGED
|
@@ -51,6 +51,7 @@ en:
|
|
|
51
51
|
overdue_uploaded_successfully: 'Overdue config was successfully uploaded'
|
|
52
52
|
overdue_added_successfully: 'Overdue config was successfully added'
|
|
53
53
|
overdue_updated_successfully: 'Overdue config was successfully updated'
|
|
54
|
+
overdue_deleted_successfully: 'Overdue config was successfully deleted'
|
|
54
55
|
invoice_template_uploaded_successfully: 'Invoice template was successfully uploaded'
|
|
55
56
|
invoice_translation_uploaded_successfully: 'Invoice translation was successfully uploaded'
|
|
56
57
|
catalog_translation_uploaded_successfully: 'Catalog translation was successfully uploaded'
|
|
@@ -85,3 +86,4 @@ en:
|
|
|
85
86
|
|
|
86
87
|
admin_tenants:
|
|
87
88
|
clock_warning: "This action will affect all tenants across the system. Proceed with caution."
|
|
89
|
+
delete_overdue_config_confirmation: "This action is irreversible and will permanently delete the overdue configuration for this tenant. Are you sure you want to continue?"
|
data/config/routes.rb
CHANGED
|
@@ -189,6 +189,7 @@ Kaui::Engine.routes.draw do
|
|
|
189
189
|
delete '/:id/delete_catalog' => 'admin_tenants#delete_catalog', :as => 'admin_tenant_delete_catalog'
|
|
190
190
|
get '/:id/new_plan_currency' => 'admin_tenants#new_plan_currency', :as => 'admin_tenant_new_plan_currency'
|
|
191
191
|
get '/:id/new_overdue_config' => 'admin_tenants#new_overdue_config', :as => 'admin_tenant_new_overdue_config'
|
|
192
|
+
delete '/:id' => 'admin_tenants#delete_overdue_config', :as => 'admin_tenant_delete_overdue_config'
|
|
192
193
|
post '/upload_catalog' => 'admin_tenants#upload_catalog', :as => 'admin_tenant_upload_catalog'
|
|
193
194
|
post '/display_catalog_xml' => 'admin_tenants#display_catalog_xml', :as => 'admin_tenant_display_catalog_xml'
|
|
194
195
|
post '/display_overdue_xml' => 'admin_tenants#display_overdue_xml', :as => 'admin_tenant_display_overdue_xml'
|
data/lib/kaui/error_handler.rb
CHANGED
|
@@ -26,7 +26,8 @@ module Kaui
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def perform_redirect_after_error(error:, error_message:, redirect: true)
|
|
29
|
-
account_id = nested_hash_value(params.permit!.to_h, :account_id)
|
|
29
|
+
account_id = request.path_parameters[:account_id].presence || nested_hash_value(params.permit!.to_h, :account_id)
|
|
30
|
+
account_id = nil unless account_id.is_a?(String) || account_id.is_a?(Numeric)
|
|
30
31
|
home_path = kaui_engine.home_path
|
|
31
32
|
redirect_path = if redirect && account_id.present?
|
|
32
33
|
kaui_engine.account_path(account_id)
|
data/lib/kaui/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kaui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0.
|
|
4
|
+
version: 4.0.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kill Bill core team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: actionpack
|