Bug 31455: Make batchMod sort by order scanned
To test: 1. In batch item deletion and batch item modification add some barcodes. 2. Notice they are being sorted by item number, not in the order scanned. 3. Appply patch and restart services. 4. Try scanning items again in both batch item deletion and batch item modification. 5. The found barcodes should now sort by order scanned. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
f60a9c50dc
commit
5c2b2ac09a
|
|
@ -19,6 +19,7 @@ use Modern::Perl;
|
|||
use List::MoreUtils qw( uniq );
|
||||
use C4::Biblio qw( GetMarcStructure GetMarcFromKohaField IsMarcStructureInternal );
|
||||
use Koha::Items;
|
||||
use List::MoreUtils qw(first_index);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -71,14 +72,16 @@ Use it with:
|
|||
|
||||
sub build_table {
|
||||
my ( $self, $params ) = @_;
|
||||
|
||||
my @itemnumbers = @{ $self->{itemnumbers} };
|
||||
my $items = Koha::Items->search( { itemnumber => $self->{itemnumbers} } );
|
||||
|
||||
my @items;
|
||||
while ( my $item = $items->next ) {
|
||||
my $item_info = $item->columns_to_str;
|
||||
my $index = first_index { $_ eq $item->itemnumber } @itemnumbers;
|
||||
$item_info = {
|
||||
%$item_info,
|
||||
index => $index,
|
||||
biblio => $item->biblio,
|
||||
safe_to_delete => $item->safe_to_delete,
|
||||
holds => $item->biblio->holds->count,
|
||||
|
|
|
|||
|
|
@ -243,6 +243,7 @@
|
|||
<table id="itemst">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
[% IF checkboxes_edit OR checkboxes_delete %]
|
||||
<th></th>
|
||||
[% END %]
|
||||
|
|
@ -264,6 +265,7 @@
|
|||
[% SET can_be_edited = ! ( Koha.Preference('IndependentBranches') && ! logged_in_user.is_superlibrarian && item.homebranch != Branches.GetLoggedInBranchname() ) %]
|
||||
|
||||
<tr>
|
||||
<td>[% item.index + 1 | html %]</td>
|
||||
[% IF checkboxes_edit %]
|
||||
[% UNLESS can_be_edited%]
|
||||
<td class="error">Cannot edit</td>
|
||||
|
|
@ -333,7 +335,6 @@
|
|||
<td>[% item.$attribute | html %]</td>
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
</tr>
|
||||
[% END # /FOREACH items %]
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ $(document).ready(function () {
|
|||
$("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
|
||||
"sDom": 't',
|
||||
"aoColumnDefs": [
|
||||
{ "aTargets": [0], "bSortable": false, "bSearchable": false },
|
||||
{ "aTargets": [0, 1], "bSortable": false, "bSearchable": false },
|
||||
{ "aTargets": [0], "bVisible": false },
|
||||
{ "sType": "anti-the", "aTargets": ["anti-the"] }
|
||||
],
|
||||
"bPaginate": false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue