Bug 30628: Fix patron selection in batch patron modification tool
bug 28014 added Datatables to this view, but the form is submitted with
only the checkboxes from the first page.
Solution adapted from https://stackoverflow.com/questions/33240409/how-to-submit-checkboxes-from-all-pages-with-jquery-datatables
Test plan:
Have more than 20 cardnumbers, use the batch patron modification tool
Select (not all) patrons from the first page and second page
Submit the form
Notice that the patrons you have selected appear on the confirmation
page.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 7e053bf546)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
parent
8308f924aa
commit
0d9bdc015d
|
|
@ -367,7 +367,7 @@
|
|||
[% END %]
|
||||
$(document).ready(function() {
|
||||
[% IF borrowers %]
|
||||
KohaTable("borrowerst", {
|
||||
let patron_table = KohaTable("borrowerst", {
|
||||
"order": [[ 1, "asc" ]],
|
||||
"autoWidth": false,
|
||||
}, table_settings);
|
||||
|
|
@ -418,6 +418,23 @@
|
|||
e.preventDefault();
|
||||
del_attributes(this);
|
||||
});
|
||||
|
||||
$('form[name="f"]').on("submit", function(){
|
||||
// Add the checkboxes to the DOM before we submit the form
|
||||
var form = this;
|
||||
var checkboxes = patron_table.$('input:checkbox:checked').serializeArray();
|
||||
$.each(checkboxes, function(){
|
||||
let borrowernumber = this.value;
|
||||
if(!$(form).find('input[name="borrowernumber"][value="'+borrowernumber+'"]').length){
|
||||
$(form).append(
|
||||
$('<input>')
|
||||
.attr('type', 'hidden')
|
||||
.attr('name', 'borrowernumber')
|
||||
.val(borrowernumber)
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function updateAttrValues (select_attr) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue