Bug 25553: Make date columns sortable on the edit items table
When editing items, the table at the top contain several columns that have date values, but they cannot be sorted by dates correctly. Test plan: Have several items with different dates in columns that contain dates, like items.dateaccessioned, items.datelastseen) Sort the column and confirm that with this patch the lines are sorted correctly Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
477ae01ebd
commit
31800ba46b
|
|
@ -872,7 +872,7 @@ for my $row ( @big_array ) {
|
|||
{
|
||||
my ( undef, $subfield ) = GetMarcFromKohaField($kohafield);
|
||||
next unless $key eq $subfield;
|
||||
$item_field->{field} = output_pref( { str => $row->{$key}, dateonly => 1 } );
|
||||
$item_field->{datatype} = 'date';
|
||||
}
|
||||
|
||||
push @item_fields, $item_field;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
[% USE raw %]
|
||||
[% USE Asset %]
|
||||
[% USE Koha %]
|
||||
[% USE KohaDates %]
|
||||
[% USE ColumnsSettings %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
<title>Koha › Cataloging › [% title | html %] [% IF ( author ) %] by [% author | html %][% END %] (Record #[% biblionumber | html %]) › Items</title>
|
||||
|
|
@ -45,6 +46,7 @@
|
|||
|
||||
<div id="cataloguing_additem_itemlist">
|
||||
[% IF ( item_loop ) %]
|
||||
[% SET date_fields = [ 'dateaccessioned', 'onloan', 'datelastseen', 'datelastborrowed', 'replacementpricedate' ] %]
|
||||
<div>
|
||||
<table id="itemst">
|
||||
<thead>
|
||||
|
|
@ -52,7 +54,11 @@
|
|||
<th> </th>
|
||||
[% FOREACH item_header IN item_header_loop %]
|
||||
[% IF item_header.column_name %]
|
||||
<th data-colname="[% item_header.column_name | html %]">
|
||||
[% IF date_fields.grep(item_header.column_name).size %]
|
||||
<th class="title-string" data-colname="[% item_header.column_name | html %]">
|
||||
[% ELSE %]
|
||||
<th data-colname="[% item_header.column_name | html %]">
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
<th>
|
||||
[% END %]
|
||||
|
|
@ -106,7 +112,11 @@
|
|||
</td>
|
||||
[% END %]
|
||||
[% FOREACH item_valu IN item_loo.item_value %]
|
||||
<td>[% item_valu.field | html %]</td>
|
||||
[% IF item_valu.datatype == 'date' %]
|
||||
<td><span title="[% item_valu.field | html %]">[% item_valu.field | $KohaDates %]</span></td>
|
||||
[% ELSE %]
|
||||
<td>[% item_valu.field | html %]</td>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue