From f07c6edc5b042b5334df8df76170fee60c81aa20 Mon Sep 17 00:00:00 2001 From: Owen Date: Tue, 2 Nov 2021 13:10:35 +0000 Subject: [PATCH] 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 Signed-off-by: Jonathan Druart --- C4/Breeding.pm | 9 ++- admin/columns_settings.yml | 15 ++++ cataloguing/addbooks.pl | 3 +- .../prog/en/modules/cataloguing/addbooks.tt | 75 +++++++++++-------- 4 files changed, 65 insertions(+), 37 deletions(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 2550ec2e159..3f442926c45 100644 --- a/C4/Breeding.pm +++ b/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) . ")"; diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 18f4ce0c0ee..56bec9ea04d 100644 --- a/admin/columns_settings.yml +++ b/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 diff --git a/cataloguing/addbooks.pl b/cataloguing/addbooks.pl index 53ab86b39c4..2206c5e143b 100755 --- a/cataloguing/addbooks.pl +++ b/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} }; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt index ef8e4fa2c86..5fa257b4fdd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt +++ b/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' %] Cataloging [% IF ( total || breeding_loop ) %] › Search results [% ELSIF ( query ) %] › No results found [% END %] › Koha @@ -200,41 +202,42 @@

Records found in the reservoir

[% IF ( breeding_loop ) %] - - - - - - - - - - [% FOREACH breeding_loo IN breeding_loop %] +
TitleISBNDateEditionComing from 
+ - - - - - - + + + + + - [% END # /IF breeding_loo %] + + + [% FOREACH breeding_loo IN breeding_loop %] + + + + + + + + [% END # /IF breeding_loo %] +
- [% breeding_loo.title | html %] - [% breeding_loo.author | html %] - [% breeding_loo.isbn | html %][% breeding_loo.copyrightdate | html %][% breeding_loo.edition | html %][% breeding_loo.file | html %] -
- - Actions - - -
-
TitleISBNComing fromImport date 
+ [% breeding_loo.title | html %] [% breeding_loo.author | html %] + [% breeding_loo.isbn | html %][% breeding_loo.file | html %][% breeding_loo.upload_timestamp | $KohaDates %] +
+ + Actions + + +
+
[% ELSE %]

No results found

@@ -262,6 +265,8 @@
[% MACRO jsinclude BLOCK %] + [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'columns_settings.inc' %]