Bug 14636: Item search - fix search and sort by publication date for MARC21
Problem: MARC21/NORMARC stores the publication date in biblio.copyrightdate, but UNIMARC uses biblioitems.publicationyear. To test: - Without patch in a MARC21 installation: - Search by publication date - Verify that the results don't match the publication year you searched for. - Try sorting the table by publication year. - Verify that the sort doesn't work. - Apply patch. - Repeat both, search and sort. - Verify both work correctly now. - Repeat tests on a UNIMARC installation. - Verify both still work. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Tested searching and sorting successfully in a MARC21 installation. DID NOT test in UNIMARC. Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> (cherry picked from commit0d2e83bca5) Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> (cherry picked from commitd772f8732c) Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
This commit is contained in:
parent
c7db8a68f0
commit
6cab2b5b1c
|
|
@ -128,6 +128,9 @@ if (scalar keys %params > 0) {
|
|||
my $op = shift @op;
|
||||
if (defined $q and $q ne '') {
|
||||
if ($i == 0) {
|
||||
if (C4::Context->preference("marcflavor") ne "UNIMARC" && $field eq 'publicationdate') {
|
||||
$field = 'copyrightdate';
|
||||
}
|
||||
$f = {
|
||||
field => $field,
|
||||
query => $q,
|
||||
|
|
@ -181,10 +184,15 @@ if (scalar keys %params > 0) {
|
|||
};
|
||||
}
|
||||
|
||||
my $sortby = $cgi->param('sortby') || 'itemnumber';
|
||||
if (C4::Context->preference("marcflavor") ne "UNIMARC" && $sortby eq 'publicationyear') {
|
||||
$sortby = 'copyrightdate';
|
||||
}
|
||||
warn $sortby;
|
||||
my $search_params = {
|
||||
rows => $cgi->param('rows') // 20,
|
||||
page => $cgi->param('page') || 1,
|
||||
sortby => $cgi->param('sortby') || 'itemnumber',
|
||||
sortby => $sortby,
|
||||
sortorder => $cgi->param('sortorder') || 'asc',
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue