Bug 38183: Get the active tab number from data-attribute

To test:

1. Have more than 1 staff member who can manage suggestions
2. Create some suggestions
3. Move some suggestions to different statuses (Pending/Accepted/Rejected) so you have multiple tabs on the "Suggestions management" page.
4. Go to the first tab, check some suggestions, and click "Select manager" under "Update manager".
5. Pick a new manager, notice nothing changes on that tab.
6. Now look at the last tab in your list of tabs, see the suggestion manager has been set incorrectly to the last tab.
7. APPLY PATCH
8. Try 4-5 again. The manager should be selected correctly.
9. Try setting the manaager from every tab, making sure it works right.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Lucas Gass 2024-10-15 23:50:00 +00:00 committed by Katrin Fischer
parent 4033699062
commit 2d28aa403a
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 2 additions and 3 deletions

View File

@ -736,7 +736,7 @@
<a class="checkall" href="#">Check all</a> | <a class="uncheckall" href="#">Uncheck all</a>
</p>
<table id="table_[% loop.count | html %]" class="sorted">
<table id="table_[% loop.count | html %]" class="sorted" data-table-number=[% loop.count | html %]>
<thead>
<tr>
<th class="NoSort noExport">&nbsp;</th>
@ -1299,8 +1299,8 @@
[% INCLUDE 'calendar.inc' %]
<script>
var tab = '';
function select_manager(borrowernumber, borrower) {
let tab = $('#suggestiontabs .active table').data('table-number');
var managedby_name = $("#managedby_name"+tab);
var managedby = $("#managedby"+tab);
managedby_name.empty();
@ -1541,7 +1541,6 @@
[% PROCESS patron_search_js columns => columns, actions => ["select"], preview_on_name_click => 1, table_id => 'patron_search_modal_manager_table', callback => 'select_manager' %]
[% ELSIF op == 'else' %]
[% FOREACH suggestion IN suggestions %]
<script>tab = [% loop.count | html %];</script>
[% SET filter = "suggestions_managers" %]
[% PROCESS patron_search_modal columns => columns, modal_title => t("Select manager"), patron_search_modal_id => 'patron_search_modal_manager_' _ loop.count, table_id => 'patron_search_modal_manager_table_' _ loop.count %]
[% PROCESS patron_search_js columns => columns, actions => ["select"], preview_on_name_click => 1, table_id => 'patron_search_modal_manager_table_' _ loop.count, callback => 'select_manager' %]