Browse Source

Bug 29391: Improve output of reservoir search

This patch makes the cataloging reservoir search results a configurable
DataTable. The empty edition and date columns are removed, and an import
data column is added.

To test, apply the patch and go to Cataloging.

- Perform a cataloging search which will return results from the
  reservoir.
- The table of reservoir search results should be a DataTable with
  paging, navigation, filtering, column configuration, etc.
  - Confirm that all DataTable controls work correctly.
- Go to Administration -> Table settings -> Cataloging -> addbooks.
  - Try modifying the default configuration and confirm that the
    settings take effect.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
master
Owen 3 months ago
committed by Fridolin Somers
parent
commit
4b3b6f1996
  1. 9
      C4/Breeding.pm
  2. 15
      admin/columns_settings.yml
  3. 3
      cataloguing/addbooks.pl
  4. 75
      koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt

9
C4/Breeding.pm

@ -79,8 +79,13 @@ sub BreedingSearch {
# normalise ISBN like at import
my @isbns = C4::Koha::GetVariationsOfISBN($term);
$query = "SELECT import_record_id, file_name, isbn, title, author
FROM import_biblios
$query = "SELECT import_biblios.import_record_id,
import_batches.file_name,
import_biblios.isbn,
import_biblios.title,
import_biblios.author,
import_batches.upload_timestamp
FROM import_biblios
JOIN import_records USING (import_record_id)
JOIN import_batches USING (import_batch_id)
WHERE title LIKE ? OR author LIKE ? OR isbn IN (" . join(',',('?') x @isbns) . ")";

15
admin/columns_settings.yml

@ -465,6 +465,21 @@ modules:
columnname: checkin_on
cataloguing:
addbooks:
reservoir-table:
columns:
-
columnname: title
-
columnname: isbn
-
columnname: coming_from
-
columnname: import_date
-
columnname: actions
cannot_be_toggled: 1
cannot_be_modified: 1
additem:
itemst:
# NOTE: These columns are in the same order as kohastructure.sql, and contain all items

3
cataloguing/addbooks.pl

@ -112,11 +112,10 @@ for my $resultsbr (@resultsbr) {
push @{$breeding_loop}, {
id => $resultsbr->{import_record_id},
isbn => $resultsbr->{isbn},
copyrightdate => $resultsbr->{copyrightdate},
editionstatement => $resultsbr->{editionstatement},
file => $resultsbr->{file_name},
title => $resultsbr->{title},
author => $resultsbr->{author},
upload_timestamp => $resultsbr->{upload_timestamp}
};
}

75
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt

@ -1,5 +1,7 @@
[% USE raw %]
[% USE Koha %]
[% USE KohaDates %]
[% USE TablesSettings %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Cataloging [% IF ( total || breeding_loop ) %] &rsaquo; Search results [% ELSIF ( query ) %] &rsaquo; No results found [% END %] &rsaquo; Koha</title>
@ -200,41 +202,42 @@
<div id="searchresult-breeding">
<h2>Records found in the reservoir</h2>
[% IF ( breeding_loop ) %]
<table>
<tr>
<th>Title</th>
<th>ISBN</th>
<th>Date</th>
<th>Edition</th>
<th>Coming from</th>
<th>&nbsp;</th>
</tr>
[% FOREACH breeding_loo IN breeding_loop %]
<table id="reservoir-table">
<thead>
<tr>
<td>
[% breeding_loo.title | html %]
[% breeding_loo.author | html %]
</td>
<td>[% breeding_loo.isbn | html %]</td>
<td>[% breeding_loo.copyrightdate | html %]</td>
<td>[% breeding_loo.edition | html %]</td>
<td>[% breeding_loo.file | html %]</td>
<td>
<div class="dropup">
<a class="btn btn-default btn-xs dropdown-toggle" id="reservoirsearchactions[% breeding_loo.id | html %]" role="button" data-toggle="dropdown" href="#">
Actions <b class="caret"></b>
</a>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reservoirsearchactions[% breeding_loo.id | html %]">
<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.id | uri %]" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.id | uri %]" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
<li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id | uri %]"><i class="fa fa-plus"></i> Add biblio</a></li>
[% END %]
</ul>
</div>
</td>
<th>Title</th>
<th>ISBN</th>
<th>Coming from</th>
<th>Import date</th>
<th class="NoSort noExport">&nbsp;</th>
</tr>
[% END # /IF breeding_loo %]
</thead>
<tbody>
[% FOREACH breeding_loo IN breeding_loop %]
<tr>
<td>
[% breeding_loo.title | html %] [% breeding_loo.author | html %]
</td>
<td>[% breeding_loo.isbn | html %]</td>
<td>[% breeding_loo.file | html %]</td>
<td data-sort="[% breeding_loo.upload_timestamp | html %]">[% breeding_loo.upload_timestamp | $KohaDates %]</td>
<td>
<div class="dropup">
<a class="btn btn-default btn-xs dropdown-toggle" id="reservoirsearchactions[% breeding_loo.id | html %]" role="button" data-toggle="dropdown" href="#">
Actions <b class="caret"></b>
</a>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reservoirsearchactions[% breeding_loo.id | html %]">
<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.id | uri %]" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.id | uri %]" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
<li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id | uri %]"><i class="fa fa-plus"></i> Add biblio</a></li>
[% END %]
</ul>
</div>
</td>
</tr>
[% END # /IF breeding_loo %]
</tbody>
</table>
[% ELSE %]
<h3 id="searchresult-breeding">No results found</h3>
@ -262,6 +265,8 @@
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
<script>
$(document).ready(function() {
@ -306,6 +311,10 @@
$("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
});
columns_settings = [% TablesSettings.GetColumns( 'cataloguing', 'addbooks', 'reservoir-table', 'json' ) | $raw %]
var reservoirt = KohaTable("reservoir-table", {
"pagingType": "simple"
}, columns_settings );
});
/* this function open a popup to search on z3950 server. */

Loading…
Cancel
Save