Bug 11059: fix date sorting of import batches in basket add form

This patch improves the sorting of staged import batches by date,
particularly when the dateformat system preference is set to anything
other than YYYY-MM-DD.

Adds title-string sorting type to enable this.

To test:

[1] Ensure that there are at least three staged
    bib import batches, with upload timestamps such that
    date sorting errors would be apparent.
[2] Set the dateformat system preference to either DD/MM/YYYY
    or MM/DD/YYYY.
[3] Create a new basket in acquisitions, then chose to add
    a new order line from a staged record batch.
[4] In the list of batches, click on the 'staged' column
    heading to sort by date.
[5] Observe that dates are sorted in alphanumeric order, not date
    order.
[6] Apply the patch and refresh.  This time, dates should sort
    correctly.

Signed-off-by: Fridolyn SOMERS <fridolyn.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Lyon3 Team 2013-11-12 15:32:34 -04:00 committed by Galen Charlton
parent 38503e18a3
commit 097a92b318
2 changed files with 7 additions and 5 deletions

View file

@ -333,13 +333,11 @@ sub import_batches_list {
# check if there is at least 1 line still staged # check if there is at least 1 line still staged
my $stagedList=GetImportRecordsRange($batch->{'import_batch_id'}, undef, undef, 'staged'); my $stagedList=GetImportRecordsRange($batch->{'import_batch_id'}, undef, undef, 'staged');
if (scalar @$stagedList) { if (scalar @$stagedList) {
my ($staged_date, $staged_hour) = split (/ /, $batch->{'upload_timestamp'});
push @list, { push @list, {
import_batch_id => $batch->{'import_batch_id'}, import_batch_id => $batch->{'import_batch_id'},
num_biblios => $batch->{'num_biblios'}, num_biblios => $batch->{'num_biblios'},
num_items => $batch->{'num_items'}, num_items => $batch->{'num_items'},
staged_date => $staged_date, staged_date => $batch->{'upload_timestamp'},
staged_hour => $staged_hour,
import_status => $batch->{'import_status'}, import_status => $batch->{'import_status'},
file_name => $batch->{'file_name'}, file_name => $batch->{'file_name'},
comments => $batch->{'comments'}, comments => $batch->{'comments'},

View file

@ -19,10 +19,14 @@
[% END %] [% END %]
$(document).ready(function() { $(document).ready(function() {
var srlt = $("#files").dataTable($.extend(true, {}, dataTablesDefaults, { var srlt = $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumns": [
null,null,null,{ "sType": "title-string" },null,null
],
"aoColumnDefs": [ "aoColumnDefs": [
{ "aTargets": [ 5 ], "bSortable": false, "bSearchable": false }, { "aTargets": [ 5 ], "bSortable": false, "bSearchable": false },
], ],
"sPaginationType": "four_button" "sPaginationType": "four_button",
"aaSorting": []
} ) ); } ) );
$("form#Aform").submit(function() { $("form#Aform").submit(function() {
@ -109,7 +113,7 @@
<td>[% batch_lis.file_name %]</td> <td>[% batch_lis.file_name %]</td>
<td>[% batch_lis.comments %]</td> <td>[% batch_lis.comments %]</td>
<td>[% batch_lis.import_status %]</td> <td>[% batch_lis.import_status %]</td>
<td>[% batch_lis.staged_date | $KohaDates %] [% batch_lis.staged_hour %]</td> <td><span title="[% batch_lis.staged_date %]">[% batch_lis.staged_date | $KohaDates %]</span></td>
<td>[% batch_lis.num_biblios %]</td> <td>[% batch_lis.num_biblios %]</td>
<td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]">Add orders</a></td> <td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]">Add orders</a></td>
</tr> </tr>