From 6806da46ce97273f797c9076bb00a475398cb348 Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Fri, 13 Feb 2015 18:06:19 +0200 Subject: [PATCH] Bug 13707 - Adding a new column datereceived for items and biblioitems. New sortable Zebra index. For new Biblios, this feature is automatically enabled, but if you want to make your existing biblios searchable, you must update your MARC Records from the koha DB. The easiest way is to run 'misc/batchRebuildBiblioTables.pl --upstream' to update your MARC Records from the koha DB, but you need to have Bugg 13703 deployed. After that Zebra needs to be fully reindexed. TEST PLAN: (index search) 1. Add a new Biblio. 2. Add an Item to it, either via the acquisitions module or the cataloguing module. 3. Reindex zebra partially with the "./rebuild_zebra.pl -b -z -v" or wait a while if automatic Zebra indexing is enabled in your environment. 4. Make the following search to the search box: datereceived=2015-12-04 where the Date is the day when you added those Items from step 2. (should be today) 5. You should find the Biblio you just added. TEST PLAN: (sorting search) 0. You need to prepare a searchable index of Records with the datereceived indexed. The easiest way is to use the batchRebuildBiblioTables.pl but some records can be manually created as well. M. Manual path: M.1. Add new Biblios, and Items to the using the cataloguing module's additems.pl. You can set the datereceived from the Item-form, so set some Items to past and some Items to have a datereceived in the future. Be aware that the first Item created sets the Parent Biblio's datereceived. M.2. Make a search which should find all the Biblios you manually made. ALL PATHS 3. Sort based on the datereceived (Receival date - Newest to oldest) 4. All the Records should be ordered with the most newly received Biblio on top. Note: Since we can only put Dates to Zebra, sorting is only based on the day-portion of the datereceived. The time-portion is only for potential statistical/logistical optimization reasons. --- C4/Search.pm | 8 ++++++++ Koha/QueryParser/Driver/PQF.pm | 2 ++ etc/zebradb/biblios/etc/bib1.att | 1 + etc/zebradb/ccl.properties | 3 +++ .../marc21/biblios/biblio-koha-indexdefs.xml | 11 +++++++++++ .../marc21/biblios/biblio-zebra-indexdefs.xsl | 14 ++++++++++++++ .../marc21/mandatory/marc21_framework_DEFAULT.sql | 2 ++ .../marc21/optional/marc21_fastadd_framework.sql | 2 ++ .../optional/marc21_simple_bib_frameworks.sql | 16 ++++++++++++++++ installer/data/mysql/updatedatabase.pl | 17 +++++++++++++++++ .../intranet-tmpl/prog/en/includes/resort_form.inc | 12 ++++++++++++ .../bootstrap/en/includes/resort_form.inc | 10 ++++++++++ 12 files changed, 98 insertions(+) diff --git a/C4/Search.pm b/C4/Search.pm index 5216a12..f7f50cb 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -413,6 +413,12 @@ sub getRecords { elsif ( $sort eq "acqdate_dsc" ) { $sort_by .= "1=32 >i "; } + elsif ( $sort eq "datereceived_asc" ) { + $sort_by .= "1=9015 add_bib1_filter_map( 'biblioserver', 'copydate', { 'target_syntax_callback' => \&Koha::QueryParser::Driver::PQF::date_filter_target_callback, '1' => '30', '4' => '4' }); $self->add_bib1_filter_map( 'biblioserver', 'pubdate', { 'target_syntax_callback' => \&Koha::QueryParser::Driver::PQF::date_filter_target_callback, '1' => 'pubdate', '4' => '4' }); $self->add_bib1_filter_map( 'biblioserver', 'acqdate', { 'target_syntax_callback' => \&Koha::QueryParser::Driver::PQF::date_filter_target_callback, '1' => 'Date-of-acquisition', '4' => '4' }); + $self->add_bib1_field_map('keyword' => 'datereceived' => 'biblioserver' => { '1' => '9015' } ); + $self->add_search_field_alias( 'keyword' => 'date-of-receival' => 'datereceived' ); $self->add_bib1_field_map('keyword' => 'isbn' => 'biblioserver' => { '1' => '7' } ); $self->add_search_field_alias( 'keyword' => 'isbn' => 'nb' ); $self->add_bib1_field_map('keyword' => 'issn' => 'biblioserver' => { '1' => '8' } ); diff --git a/etc/zebradb/biblios/etc/bib1.att b/etc/zebradb/biblios/etc/bib1.att index ed8c64b..8b7baa5 100644 --- a/etc/zebradb/biblios/etc/bib1.att +++ b/etc/zebradb/biblios/etc/bib1.att @@ -219,6 +219,7 @@ att 9009 cn-prefix att 9010 cn-suffix att 9011 Suppress att 9012 Identifier-other +att 9015 Date-of-receival # Items Index att 8001 withdrawn diff --git a/etc/zebradb/ccl.properties b/etc/zebradb/ccl.properties index 99e3498..daf29a0 100644 --- a/etc/zebradb/ccl.properties +++ b/etc/zebradb/ccl.properties @@ -346,6 +346,9 @@ pubdate Date-of-publication Date-of-acquisition 1=32 acqdate Date-of-acquisition +Date-of-receival 1=9015 +datereceived Date-of-receival + #Date/time added to 1011 The date and time that a 008/00-05 #database record was added to the # database. diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml index c7dd166..4c8c0a8 100644 --- a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml +++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml @@ -1095,6 +1095,12 @@ totalissues:n totalissues:s + + + Date-of-receival:w + Date-of-receival:d + Date-of-receival:s + cn-bib-source:w @@ -1255,6 +1261,11 @@ datelastseen:w + + + Date-of-receival:w + Date-of-receival:d + datelastborrowed:w diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl index db4c6f2..8a14395 100644 --- a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl +++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl @@ -1056,6 +1056,13 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + + + + + @@ -1296,6 +1303,13 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + + + + + diff --git a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql b/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql index bb1c93d..07b0dbd 100644 --- a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql +++ b/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql @@ -56,6 +56,7 @@ INSERT IGNORE INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('942', '0', 'Koha issues (borrowed), all copies', 'Koha issues (borrowed), all copies', 0, 0, 'biblioitems.totalissues', 9, '', '', '', NULL, -5, '', '', '', NULL), + ('942', '1', 'First date received', 'First date received', 0, 0, 'biblioitems.datereceived',9, '', '', '', NULL, 0, '', '', '', NULL);"); ('942', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, 'biblioitems.cn_source', 9, 'cn_source', '', '', NULL, 0, '', '', '', NULL), ('942', '6', 'Koha normalized classification for sorting', 'Koha normalized classification for sorting', 0, 0, 'biblioitems.cn_sort', -1, '', '', '', 0, 7, '', '', '', NULL), ('942', 'a', 'Institution code [OBSOLETE]', 'Institution code [OBSOLETE]', 0, 0, '', 9, '', '', '', NULL, -5, '', '', '', NULL), @@ -114,6 +115,7 @@ INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblib ('952', 'p', 'Barcode', 'Barcode', 0, 0, 'items.barcode', 10, '', '', 'barcode.pl', 0, 0, '', '', '', NULL), ('952', 'q', 'Checked out', 'Checked out', 0, 0, 'items.onloan', 10, '', '', '', NULL, -5, '', '', '', NULL), ('952', 'r', 'Date last seen', 'Date last seen', 0, 0, 'items.datelastseen', 10, '', '', '', NULL, -5, '', '', '', NULL), + ('952', 'R', 'Date received', 'Date received', 0, 0, 'items.datereceived', 10, '', '', '', NULL, 0, '', '', '', NULL);"); ('952', 's', 'Date last checked out', 'Date last checked out', 0, 0, 'items.datelastborrowed', 10, '', '', '', NULL, -5, '', '', '', NULL), ('952', 't', 'Copy number', 'Copy number', 0, 0, 'items.copynumber', 10, '', '', '', NULL, 0, '', '', '', NULL), ('952', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 0, 0, 'items.uri', 10, '', '', '', 1, 0, '', '', '', NULL), diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_fastadd_framework.sql b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_fastadd_framework.sql index bccbfff..04b1d11 100644 --- a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_fastadd_framework.sql +++ b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_fastadd_framework.sql @@ -99,6 +99,7 @@ INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblib ('500', 'x', 'International Standard Serial Number (SE) [OBSOLETE]', 'International Standard Serial Number (SE) [OBSOLETE]', 0, 0, '', 0, '', '', '', 0, 0, 'FA', NULL, '', ''), ('500', 'z', 'Source of note information (AM SE) [OBSOLETE]', 'Source of note information (AM SE) [OBSOLETE]', 0, 0, '', 0, '', '', '', 0, 0, 'FA', NULL, '', ''), ('942', '0', 'Koha issues (borrowed), all copies', 'Koha issues (borrowed), all copies', 0, 0, 'biblioitems.totalissues', 9, '', '', '', NULL, 5, 'FA', '', '', NULL), + ('942', '1', 'First date received', 'First date received', 0, 0, 'biblioitems.datereceived',9, '', '', '', NULL, 0, 'FA', '', '', NULL), ('942', 'c', 'Koha item type', 'Koha item type', 0, 1, 'biblioitems.itemtype', 9, 'itemtypes', '', '', NULL, 5, 'FA', '', '', NULL), ('942', 'n', 'Suppress in OPAC', 'Suppress in OPAC', 0, 0, NULL, 9, '', '', '', 0, 5, 'FA', '', '', NULL), ('942', 's', 'Serial record flag', 'Serial record', 0, 0, 'biblio.serial', 9, '', '', '', NULL, 5, 'FA', '', '', NULL), @@ -129,6 +130,7 @@ INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblib ('952', 'p', 'Barcode', 'Barcode', 0, 0, 'items.barcode', 10, '', '', 'barcode.pl', NULL, 0, 'FA', '', NULL, NULL), ('952', 'q', 'Checked out', 'Checked out', 0, 0, 'items.onloan', 10, '', '', '', NULL, 0, 'FA', '', NULL, NULL), ('952', 'r', 'Date last seen', 'Date last seen', 0, 0, 'items.datelastseen', 10, '', '', '', NULL, 0, 'FA', '', NULL, NULL), + ('952', 'R', 'Date received', 'Date received', 0, 0, 'items.datereceived', 10, '', '', '', NULL, 0, 'FA', '', '', NULL), ('952', 's', 'Date last checked out', 'Date last checked out', 0, 0, 'items.datelastborrowed', 10, '', '', '', NULL, 0, 'FA', '', NULL, NULL), ('952', 't', 'Copy number', 'Copy number', 0, 0, 'items.copynumber', 10, '', '', '', NULL, 0, 'FA', '', NULL, NULL), ('952', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 0, 0, 'items.uri', 10, '', '', '', NULL, 0, 'FA', '', NULL, NULL), diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.sql b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.sql index 3aade56..3de7047 100644 --- a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.sql +++ b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.sql @@ -131,6 +131,7 @@ INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeat INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('942', '0', 'Koha issues (borrowed), all copies', 'Koha issues (borrowed), all copies', 0, 0, 'biblioitems.totalissues', 9, '', '', '', NULL, -5, 'BKS', '', '', NULL), + ('942', '1', 'First date received', 'First date received', 0, 0, 'biblioitems.datereceived',9, '', '', '', NULL, 0, 'BKS', '', '', NULL), ('942', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, 'biblioitems.cn_source', 9, 'cn_source', '', '', NULL, 0, 'BKS', '', '', NULL), ('942', '6', 'Koha normalized classification for sorting', 'Koha normalized classification for sorting', 0, 0, 'biblioitems.cn_sort', -1, '', '', '', 0, 7, 'BKS', '', '', NULL), ('942', 'a', 'Institution code [OBSOLETE]', 'Institution code [OBSOLETE]', 0, 0, '', 9, '', '', '', NULL, -5, 'BKS', '', '', NULL), @@ -189,6 +190,7 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('952', 'p', 'Barcode', 'Barcode', 0, 0, 'items.barcode', 10, '', '', 'barcode.pl', 0, 0, 'BKS', '', '', NULL), ('952', 'q', 'Checked out', 'Checked out', 0, 0, 'items.onloan', 10, '', '', '', NULL, -5, 'BKS', '', '', NULL), ('952', 'r', 'Date last seen', 'Date last seen', 0, 0, 'items.datelastseen', 10, '', '', '', NULL, -5, 'BKS', '', '', NULL), + ('952', 'R', 'Date received', 'Date received', 0, 0, 'items.datereceived', 10, '', '', '', NULL, 0, 'BKS', '', '', NULL), ('952', 's', 'Date last checked out', 'Date last checked out', 0, 0, 'items.datelastborrowed', 10, '', '', '', NULL, -5, 'BKS', '', '', NULL), ('952', 't', 'Copy number', 'Copy number', 0, 0, 'items.copynumber', 10, '', '', '', NULL, 0, 'BKS', '', '', NULL), ('952', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 0, 0, 'items.uri', 10, '', '', '', 1, 0, 'BKS', '', '', NULL), @@ -4138,6 +4140,7 @@ INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeat INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('942', '0', 'Koha issues (borrowed), all copies', 'Koha issues (borrowed), all copies', 0, 0, 'biblioitems.totalissues', 9, '', '', '', NULL, -5, 'CF', '', '', NULL), + ('942', '1', 'First date received', 'First date received', 0, 0, 'biblioitems.datereceived',9, '', '', '', NULL, 0, 'CF', '', '', NULL), ('942', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, 'biblioitems.cn_source', 9, 'cn_source', '', '', NULL, 0, 'CF', '', '', NULL), ('942', '6', 'Koha normalized classification for sorting', 'Koha normalized classification for sorting', 0, 0, 'biblioitems.cn_sort', -1, '', '', '', 0, 7, 'CF', '', '', NULL), ('942', 'a', 'Institution code [OBSOLETE]', 'Institution code [OBSOLETE]', 0, 0, '', 9, '', '', '', NULL, -5, 'CF', '', '', NULL), @@ -4196,6 +4199,7 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('952', 'p', 'Barcode', 'Barcode', 0, 0, 'items.barcode', 10, '', '', 'barcode.pl', 0, 0, 'CF', '', '', NULL), ('952', 'q', 'Checked out', 'Checked out', 0, 0, 'items.onloan', 10, '', '', '', NULL, -5, 'CF', '', '', NULL), ('952', 'r', 'Date last seen', 'Date last seen', 0, 0, 'items.datelastseen', 10, '', '', '', NULL, -5, 'CF', '', '', NULL), + ('952', 'R', 'Date received', 'Date received', 0, 0, 'items.datereceived', 10, '', '', '', NULL, 0, 'CF', '', '', NULL), ('952', 's', 'Date last checked out', 'Date last checked out', 0, 0, 'items.datelastborrowed', 10, '', '', '', NULL, -5, 'CF', '', '', NULL), ('952', 't', 'Copy number', 'Copy number', 0, 0, 'items.copynumber', 10, '', '', '', NULL, 0, 'CF', '', '', NULL), ('952', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 0, 0, 'items.uri', 10, '', '', '', 1, 0, 'CF', '', '', NULL), @@ -8146,6 +8150,7 @@ INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeat INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('942', '0', 'Koha issues (borrowed), all copies', 'Koha issues (borrowed), all copies', 0, 0, 'biblioitems.totalissues', 9, '', '', '', NULL, -5, 'SR', '', '', NULL), + ('942', '1', 'First date received', 'First date received', 0, 0, 'biblioitems.datereceived',9, '', '', '', NULL, 0, 'SR', '', '', NULL), ('942', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, 'biblioitems.cn_source', 9, 'cn_source', '', '', NULL, 0, 'SR', '', '', NULL), ('942', '6', 'Koha normalized classification for sorting', 'Koha normalized classification for sorting', 0, 0, 'biblioitems.cn_sort', -1, '', '', '', 0, 7, 'SR', '', '', NULL), ('942', 'a', 'Institution code [OBSOLETE]', 'Institution code [OBSOLETE]', 0, 0, '', 9, '', '', '', NULL, -5, 'SR', '', '', NULL), @@ -8204,6 +8209,7 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('952', 'p', 'Barcode', 'Barcode', 0, 0, 'items.barcode', 10, '', '', 'barcode.pl', 0, 0, 'SR', '', '', NULL), ('952', 'q', 'Checked out', 'Checked out', 0, 0, 'items.onloan', 10, '', '', '', NULL, -5, 'SR', '', '', NULL), ('952', 'r', 'Date last seen', 'Date last seen', 0, 0, 'items.datelastseen', 10, '', '', '', NULL, -5, 'SR', '', '', NULL), + ('952', 'R', 'Date received', 'Date received', 0, 0, 'items.datereceived', 10, '', '', '', NULL, 0, 'SR', '', '', NULL), ('952', 's', 'Date last checked out', 'Date last checked out', 0, 0, 'items.datelastborrowed', 10, '', '', '', NULL, -5, 'SR', '', '', NULL), ('952', 't', 'Copy number', 'Copy number', 0, 0, 'items.copynumber', 10, '', '', '', NULL, 0, 'SR', '', '', NULL), ('952', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 0, 0, 'items.uri', 10, '', '', '', 1, 0, 'SR', '', '', NULL), @@ -12153,6 +12159,7 @@ INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeat INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('942', '0', 'Koha issues (borrowed), all copies', 'Koha issues (borrowed), all copies', 0, 0, 'biblioitems.totalissues', 9, '', '', '', NULL, -5, 'VR', '', '', NULL), + ('942', '1', 'First date received', 'First date received', 0, 0, 'biblioitems.datereceived',9, '', '', '', NULL, 0, 'VR', '', '', NULL), ('942', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, 'biblioitems.cn_source', 9, 'cn_source', '', '', NULL, 0, 'VR', '', '', NULL), ('942', '6', 'Koha normalized classification for sorting', 'Koha normalized classification for sorting', 0, 0, 'biblioitems.cn_sort', -1, '', '', '', 0, 7, 'VR', '', '', NULL), ('942', 'a', 'Institution code [OBSOLETE]', 'Institution code [OBSOLETE]', 0, 0, '', 9, '', '', '', NULL, -5, 'VR', '', '', NULL), @@ -12211,6 +12218,7 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('952', 'p', 'Barcode', 'Barcode', 0, 0, 'items.barcode', 10, '', '', 'barcode.pl', 0, 0, 'VR', '', '', NULL), ('952', 'q', 'Checked out', 'Checked out', 0, 0, 'items.onloan', 10, '', '', '', NULL, -5, 'VR', '', '', NULL), ('952', 'r', 'Date last seen', 'Date last seen', 0, 0, 'items.datelastseen', 10, '', '', '', NULL, -5, 'VR', '', '', NULL), + ('952', 'R', 'Date received', 'Date received', 0, 0, 'items.datereceived', 10, '', '', '', NULL, 0, 'VR', '', '', NULL), ('952', 's', 'Date last checked out', 'Date last checked out', 0, 0, 'items.datelastborrowed', 10, '', '', '', NULL, -5, 'VR', '', '', NULL), ('952', 't', 'Copy number', 'Copy number', 0, 0, 'items.copynumber', 10, '', '', '', NULL, 0, 'VR', '', '', NULL), ('952', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 0, 0, 'items.uri', 10, '', '', '', 1, 0, 'VR', '', '', NULL), @@ -16159,6 +16167,7 @@ INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeat INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('942', '0', 'Koha issues (borrowed), all copies', 'Koha issues (borrowed), all copies', 0, 0, 'biblioitems.totalissues', 9, '', '', '', NULL, -5, 'AR', '', '', NULL), + ('942', '1', 'First date received', 'First date received', 0, 0, 'biblioitems.datereceived',9, '', '', '', NULL, 0, 'AR', '', '', NULL), ('942', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, 'biblioitems.cn_source', 9, 'cn_source', '', '', NULL, 0, 'AR', '', '', NULL), ('942', '6', 'Koha normalized classification for sorting', 'Koha normalized classification for sorting', 0, 0, 'biblioitems.cn_sort', -1, '', '', '', 0, 7, 'AR', '', '', NULL), ('942', 'a', 'Institution code [OBSOLETE]', 'Institution code [OBSOLETE]', 0, 0, '', 9, '', '', '', NULL, -5, 'AR', '', '', NULL), @@ -16217,6 +16226,7 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('952', 'p', 'Barcode', 'Barcode', 0, 0, 'items.barcode', 10, '', '', 'barcode.pl', 0, 0, 'AR', '', '', NULL), ('952', 'q', 'Checked out', 'Checked out', 0, 0, 'items.onloan', 10, '', '', '', NULL, -5, 'AR', '', '', NULL), ('952', 'r', 'Date last seen', 'Date last seen', 0, 0, 'items.datelastseen', 10, '', '', '', NULL, -5, 'AR', '', '', NULL), + ('952', 'R', 'Date received', 'Date received', 0, 0, 'items.datereceived', 10, '', '', '', NULL, 0, 'AR', '', '', NULL), ('952', 's', 'Date last checked out', 'Date last checked out', 0, 0, 'items.datelastborrowed', 10, '', '', '', NULL, -5, 'AR', '', '', NULL), ('952', 't', 'Copy number', 'Copy number', 0, 0, 'items.copynumber', 10, '', '', '', NULL, 0, 'AR', '', '', NULL), ('952', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 0, 0, 'items.uri', 10, '', '', '', 1, 0, 'AR', '', '', NULL), @@ -20164,6 +20174,7 @@ INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeat INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('942', '0', 'Koha issues (borrowed), all copies', 'Koha issues (borrowed), all copies', 0, 0, 'biblioitems.totalissues', 9, '', '', '', NULL, -5, 'KT', '', '', NULL), + ('942', '1', 'First date received', 'First date received', 0, 0, 'biblioitems.datereceived',9, '', '', '', NULL, 0, 'KT', '', '', NULL), ('942', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, 'biblioitems.cn_source', 9, 'cn_source', '', '', NULL, 0, 'KT', '', '', NULL), ('942', '6', 'Koha normalized classification for sorting', 'Koha normalized classification for sorting', 0, 0, 'biblioitems.cn_sort', -1, '', '', '', 0, 7, 'KT', '', '', NULL), ('942', 'a', 'Institution code [OBSOLETE]', 'Institution code [OBSOLETE]', 0, 0, '', 9, '', '', '', NULL, -5, 'KT', '', '', NULL), @@ -20222,6 +20233,7 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('952', 'p', 'Barcode', 'Barcode', 0, 0, 'items.barcode', 10, '', '', 'barcode.pl', 0, 0, 'KT', '', '', NULL), ('952', 'q', 'Checked out', 'Checked out', 0, 0, 'items.onloan', 10, '', '', '', NULL, -5, 'KT', '', '', NULL), ('952', 'r', 'Date last seen', 'Date last seen', 0, 0, 'items.datelastseen', 10, '', '', '', NULL, -5, 'KT', '', '', NULL), + ('952', 'R', 'Date received', 'Date received', 0, 0, 'items.datereceived', 10, '', '', '', NULL, 0, 'KT', '', '', NULL), ('952', 's', 'Date last checked out', 'Date last checked out', 0, 0, 'items.datelastborrowed', 10, '', '', '', NULL, -5, 'KT', '', '', NULL), ('952', 't', 'Copy number', 'Copy number', 0, 0, 'items.copynumber', 10, '', '', '', NULL, 0, 'KT', '', '', NULL), ('952', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 0, 0, 'items.uri', 10, '', '', '', 1, 0, 'KT', '', '', NULL), @@ -24170,6 +24182,7 @@ INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeat INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('942', '0', 'Koha issues (borrowed), all copies', 'Koha issues (borrowed), all copies', 0, 0, 'biblioitems.totalissues', 9, '', '', '', NULL, -5, 'IR', '', '', NULL), + ('942', '1', 'First date received', 'First date received', 0, 0, 'biblioitems.datereceived',9, '', '', '', NULL, 0, 'IR', '', '', NULL) ('942', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, 'biblioitems.cn_source', 9, 'cn_source', '', '', NULL, 0, 'IR', '', '', NULL), ('942', '6', 'Koha normalized classification for sorting', 'Koha normalized classification for sorting', 0, 0, 'biblioitems.cn_sort', -1, '', '', '', 0, 7, 'IR', '', '', NULL), ('942', 'a', 'Institution code [OBSOLETE]', 'Institution code [OBSOLETE]', 0, 0, '', 9, '', '', '', NULL, -5, 'IR', '', '', NULL), @@ -24228,6 +24241,7 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('952', 'p', 'Barcode', 'Barcode', 0, 0, 'items.barcode', 10, '', '', 'barcode.pl', 0, 0, 'IR', '', '', NULL), ('952', 'q', 'Checked out', 'Checked out', 0, 0, 'items.onloan', 10, '', '', '', NULL, -5, 'IR', '', '', NULL), ('952', 'r', 'Date last seen', 'Date last seen', 0, 0, 'items.datelastseen', 10, '', '', '', NULL, -5, 'IR', '', '', NULL), + ('952', 'R', 'Date received', 'Date received', 0, 0, 'items.datereceived', 10, '', '', '', NULL, 0, 'IR', '', '', NULL), ('952', 's', 'Date last checked out', 'Date last checked out', 0, 0, 'items.datelastborrowed', 10, '', '', '', NULL, -5, 'IR', '', '', NULL), ('952', 't', 'Copy number', 'Copy number', 0, 0, 'items.copynumber', 10, '', '', '', NULL, 0, 'IR', '', '', NULL), ('952', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 0, 0, 'items.uri', 10, '', '', '', 1, 0, 'IR', '', '', NULL), @@ -28174,6 +28188,7 @@ INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeat INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('942', '0', 'Koha issues (borrowed), all copies', 'Koha issues (borrowed), all copies', 0, 0, 'biblioitems.totalissues', 9, '', '', '', NULL, -5, 'SER', '', '', NULL), + ('942', '1', 'First date received', 'First date received', 0, 0, 'biblioitems.datereceived',9, '', '', '', NULL, 0, 'SER', '', '', NULL), ('942', '2', 'Source of classification or shelving scheme', 'Source of classification or shelving scheme', 0, 0, 'biblioitems.cn_source', 9, 'cn_source', '', '', NULL, 0, 'SER', '', '', NULL), ('942', '6', 'Koha normalized classification for sorting', 'Koha normalized classification for sorting', 0, 0, 'biblioitems.cn_sort', -1, '', '', '', 0, 7, 'SER', '', '', NULL), ('942', 'a', 'Institution code [OBSOLETE]', 'Institution code [OBSOLETE]', 0, 0, '', 9, '', '', '', NULL, -5, 'SER', '', '', NULL), @@ -28232,6 +28247,7 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` ('952', 'p', 'Barcode', 'Barcode', 0, 0, 'items.barcode', 10, '', '', 'barcode.pl', 0, 0, 'SER', '', '', NULL), ('952', 'q', 'Checked out', 'Checked out', 0, 0, 'items.onloan', 10, '', '', '', NULL, -5, 'SER', '', '', NULL), ('952', 'r', 'Date last seen', 'Date last seen', 0, 0, 'items.datelastseen', 10, '', '', '', NULL, -5, 'SER', '', '', NULL), + ('952', 'R', 'Date received', 'Date received', 0, 0, 'items.datereceived', 10, '', '', '', NULL, 0, 'SER', '', '', NULL), ('952', 's', 'Date last checked out', 'Date last checked out', 0, 0, 'items.datelastborrowed', 10, '', '', '', NULL, -5, 'SER', '', '', NULL), ('952', 't', 'Copy number', 'Copy number', 0, 0, 'items.copynumber', 10, '', '', '', NULL, 0, 'SER', '', '', NULL), ('952', 'u', 'Uniform Resource Identifier', 'Uniform Resource Identifier', 0, 0, 'items.uri', 10, '', '', '', 1, 0, 'SER', '', '', NULL), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index df207bd..edeed4f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7912,6 +7912,23 @@ if ( CheckVersion($DBversion) ) { SetVersion ($DBversion); } +$DBversion = "3.19.00.XXX"; +if ( CheckVersion($DBversion) ) { + ##Add the "Koha to MARC mappings" + my $sth = $dbh->prepare("SELECT frameworkcode FROM biblio_framework"); + $sth->execute(); + my $frameworks = $sth->fetchall_arrayref(); + push @$frameworks, ['']; #Add the Default framework + foreach my $fwAry (@$frameworks) { + my $framework = $fwAry->[0]; + $dbh->do("INSERT INTO marc_subfield_structure VALUES ('952','R','Date received','Date received','0','0','items.datereceived','10','','','','0','0','$framework',NULL,'','','9999');"); + $dbh->do("INSERT INTO marc_subfield_structure VALUES ('942','1','First date received','First date received','0','0','biblioitems.datereceived','9','','','','0','0','$framework',NULL,'','','9999');"); + } + print "Upgrade to $DBversion done (Bug 13707 - Adding a new column datereceived for items and biblioitems. New sortable Zebra index! )\n"; + print "- For new Biblios, this feature is automatically enabled, but if you want to make your existing biblios searchable, you must update your MARC Records from the koha DB. The easiest way is to run 'misc/batchRebuildBiblioTables.pl --upstream' to update your MARC Records from the koha DB, but you need to have Bug 13703 deployed. After that Zebra needs to be fully reindexed.\n"; + SetVersion ($DBversion); +} + $DBversion = "3.15.00.008"; if ( CheckVersion($DBversion) ) { $dbh->do(q{ diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc index 4326bea..ca1176c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc @@ -70,6 +70,18 @@ [% ELSE %] [% END %] + +[% IF ( sort_by == "datereceived_dsc" ) %] + +[% ELSE %] + +[% END %] + +[% IF ( sort_by == "datereceived_asc" ) %] + +[% ELSE %] + +[% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/resort_form.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/resort_form.inc index c5a30f6..a20ad96 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/resort_form.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/resort_form.inc @@ -56,6 +56,16 @@ [% ELSE %] [% END %] + [% IF ( sort_by == "datereceived_dsc" ) %] + + [% ELSE %] + + [% END %] + [% IF ( sort_by == "datereceived_asc" ) %] + + [% ELSE %] + + [% END %] [% IF ( sort_by == "title_az" || sort_by == "title_asc" ) %] -- 1.7.9.5