From 24936a656db7d6a5f447a4c65ce67b42e299c103 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 24 Oct 2023 10:32:07 +0200 Subject: [PATCH] Bug 34913: Adjust "Manage staged MARC records" Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize (cherry picked from commit 3f0715ef0a73eea69258b807590419a9091619ad) Signed-off-by: Fridolin Somers --- .../en/modules/tools/manage-marc-import.tt | 22 +++++++------------ tools/batch_records_ajax.pl | 20 +++++++++-------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt index d3875e4d01..6247e441df 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt @@ -460,7 +460,14 @@ "searching": false, "processing": true, "serverSide": true, - "ajax": 'batch_records_ajax.pl', + ajax: { + url: "batch_records_ajax.pl", + type: "POST", + data: function ( d ) { + d.import_batch_id = [% import_batch_id | html %]; + return d; + }, + }, "pagingType": "full_numbers", "dom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">', "columns": [ @@ -472,19 +479,6 @@ { "data": null, "defaultContent": "" }, { "data": "matched" } ], - "fnServerData": function(sSource, aoData, fnCallback) { - aoData.push({ "name": "import_batch_id", "value": [% import_batch_id | html %] }); - - $.ajax({ - 'dataType': 'json', - 'type': 'POST', - 'url': sSource, - 'data': aoData, - 'success': function(json) { - fnCallback(json); - } - }); - }, "rowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) { [% IF(record_type == 'auth') %] var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid="; diff --git a/tools/batch_records_ajax.pl b/tools/batch_records_ajax.pl index 3d706013ba..bcf97e06bd 100755 --- a/tools/batch_records_ajax.pl +++ b/tools/batch_records_ajax.pl @@ -44,10 +44,11 @@ my @sort_columns = qw/import_record_id title status overlay_status overlay_status/; my $import_batch_id = $input->param('import_batch_id'); -my $offset = $input->param('iDisplayStart'); -my $results_per_page = $input->param('iDisplayLength'); -my $sorting_column = $sort_columns[ $input->param('iSortCol_0') // 0 ]; -my $sorting_direction = $input->param('sSortDir_0'); +my $offset = $input->param('start'); +my $results_per_page = $input->param('length'); +# FIXME We handle sorting on one column only! +my $sorting_column = $sort_columns[ $input->param('order[0][column]') // 0 ]; +my $sorting_direction = $input->param('order[0][dir]'); $results_per_page = undef if $results_per_page && $results_per_page == -1; @@ -108,10 +109,11 @@ foreach my $record (@$records) { }; } -my $data; -$data->{'iTotalRecords'} = $batch->{'num_records'}; -$data->{'iTotalDisplayRecords'} = $batch->{'num_records'}; -$data->{'sEcho'} = $input->param('sEcho') || undef; -$data->{'aaData'} = \@list; +my $data = { + recordsTotal => $batch->{num_records}, + recordsFiltered => $batch->{num_records}, + draw => $input->param('draw') || undef, + data => \@list, +}; print to_json($data); -- 2.39.5