Bugzilla – Attachment 35967 Details for
Bug 13707
Adding a new column datereceived for items and biblioitems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13707 - 3. Adding a new column datereceived for items and biblioitems. New sortable Zebra index.
Bug-13707---3-Adding-a-new-column-datereceived-for.patch (text/plain), 39.12 KB, created by
Olli-Antti Kivilahti
on 2015-02-17 12:52:46 UTC
(
hide
)
Description:
Bug 13707 - 3. Adding a new column datereceived for items and biblioitems. New sortable Zebra index.
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2015-02-17 12:52:46 UTC
Size:
39.12 KB
patch
obsolete
>From 220ef5301e47a22f4d241a65c992eb6ba7f20f4a Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Fri, 13 Feb 2015 18:06:19 +0200 >Subject: [PATCH] Bug 13707 - 3. 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 databaseupdate.pl -script does this for you. > >Also the table 'marc_subfield_structure' has an case-insensitive collation >preventing adding subfield 'R' when 'r' is present. The collation is changed to >utf8_bin. This has no adverse side effects since there is no need for complex >text-based sorting using this table. > >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/kohastructure.sql | 2 +- > installer/data/mysql/updatedatabase.pl | 62 ++++++++++++++++++++ > .../intranet-tmpl/prog/en/includes/resort_form.inc | 12 ++++ > .../bootstrap/en/includes/resort_form.inc | 10 ++++ > 13 files changed, 144 insertions(+), 1 deletion(-) > >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 <i "; >+ } >+ elsif ( $sort eq "datereceived_dsc" ) { >+ $sort_by .= "1=9015 >i "; >+ } > elsif ( $sort eq "title_az" || $sort eq "title_asc" ) { > $sort_by .= "1=4 <i "; > } >@@ -1131,6 +1137,8 @@ sub getIndexes{ > 'date-entered-on-file', > 'Date-of-acquisition', > 'Date-of-publication', >+ 'Date-of-receival', >+ 'datereceived', > 'Dewey-classification', > 'Dissertation-information', > 'EAN', >diff --git a/Koha/QueryParser/Driver/PQF.pm b/Koha/QueryParser/Driver/PQF.pm >index 8181cd3..6e41ce2 100644 >--- a/Koha/QueryParser/Driver/PQF.pm >+++ b/Koha/QueryParser/Driver/PQF.pm >@@ -701,6 +701,8 @@ sub TEST_SETUP { > $self->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 @@ > <target_index>totalissues:n</target_index> > <target_index>totalissues:s</target_index> > </index_subfields> >+ <!--record.abs line 298: melm 942$1 Date-of-receival,Date-of-receival:d,Date-of-receival:s--> >+ <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="942" subfields="1"> >+ <target_index>Date-of-receival:w</target_index> >+ <target_index>Date-of-receival:d</target_index> >+ <target_index>Date-of-receival:s</target_index> >+ </index_subfields> > <!--record.abs line 271: melm 942$2 cn-bib-source--> > <index_subfields tag="942" subfields="2"> > <target_index>cn-bib-source:w</target_index> >@@ -1255,6 +1261,11 @@ > <index_subfields tag="952" subfields="r"> > <target_index>datelastseen:w</target_index> > </index_subfields> >+ <!--record.abs line 298: melm 952$R Date-of-receival,Date-of-receival:d--> >+ <index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="R"> >+ <target_index>Date-of-receival:w</target_index> >+ <target_index>Date-of-receival:d</target_index> >+ </index_subfields> > <!--record.abs line 313: melm 952$s datelastborrowed--> > <index_subfields tag="952" subfields="s"> > <target_index>datelastborrowed:w</target_index> >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) > </xslo:if> > </xslo:for-each> > <xslo:for-each select="marc:subfield"> >+ <xslo:if test="contains('1', @code)"> >+ <z:index name="Date-of-receival:w Date-of-receival:d Date-of-receival:s"> >+ <xslo:value-of select="."/> >+ </z:index> >+ </xslo:if> >+ </xslo:for-each> >+ <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('2', @code)"> > <z:index name="cn-bib-source:w"> > <xslo:value-of select="."/> >@@ -1296,6 +1303,13 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > </xslo:if> > </xslo:for-each> > <xslo:for-each select="marc:subfield"> >+ <xslo:if test="contains('R', @code)"> >+ <z:index name="Date-of-receival:w Date-of-receival:d"> >+ <xslo:value-of select="."/> >+ </z:index> >+ </xslo:if> >+ </xslo:for-each> >+ <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('s', @code)"> > <z:index name="datelastborrowed:w"> > <xslo:value-of select="."/> >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/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index fa1f834..ab8c6ef 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1423,7 +1423,7 @@ CREATE TABLE `marc_subfield_structure` ( > KEY `kohafield_2` (`kohafield`), > KEY `tab` (`frameworkcode`,`tab`), > KEY `kohafield` (`frameworkcode`,`kohafield`) >-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; >+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; > > -- > -- Table structure for table `marc_tag_structure` >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index ea7961d..384998b 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -7901,6 +7901,68 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "3.19.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ require C4::Biblio; >+ >+ #For some strange reason the marc_subfield_structure-table is case insensitive, this prevents setting subfields codes r and R side-by-side. >+ $dbh->do("ALTER TABLE marc_subfield_structure CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;"); >+ >+ #Check if it is safe to do the upgrade by looking if the default mappings have alredy been taken. >+ my $sth3 = $dbh->prepare("SELECT 1 FROM marc_subfield_structure WHERE (tagfield = '942' AND tagsubfield = '1') OR (tagfield = '952' AND tagsubfield = 'R')"); >+ $sth3->execute(); >+ my $mappingUsed = $sth3->fetchall_arrayref(); >+ $sth3->finish(); >+ if (@$mappingUsed > 0) { >+ print "Upgrade to $DBversion failed (Bug 13707 - Adding a new column datereceived for items and biblioitems. New sortable Zebra index! ). The default \"Koha to MARC mappings\" for biblioitems.datereceived are already taken. You must manually map biblioitems.datereceived to a MARC framework to enable searching by datereceived. You can see the subroutine inside this upgrade clause on how to do that.\n"; >+ } >+ else { >+ my $doTheDirtyDeed = sub { >+ print "Upgrading Bug 13707, mapping biblioitems.datereceived to MARC 954\$1 and mapping items.datereceived to 952\$R. Then putting biblioitems.datereceived to all MARC Records. This will take several hours.\n"; >+ >+ my $sth = $dbh->prepare("SELECT frameworkcode FROM biblio_framework"); >+ $sth->execute(); >+ my $frameworks = $sth->fetchall_arrayref(); >+ $sth->finish(); >+ push @$frameworks, ['']; #Add the Default framework >+ >+ ###Add the default "Koha to MARC mappings" ### >+ 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');"); >+ } >+ my ( $datereceivedFieldCode, $datereceivedSubfieldCode ) = >+ C4::Biblio::GetMarcFromKohaField( "biblioitems.datereceived", '' ); >+ ###Add the biblioitems.datereceived to all MARC Records to the mapped location. ### >+ #Fetch all biblios >+ my $sth2 = $dbh->prepare(" SELECT b.biblionumber, datereceived, frameworkcode FROM biblioitems bi LEFT JOIN biblio b ON b.biblionumber = bi.biblionumber WHERE datereceived IS NOT NULL; "); >+ $sth2->execute(); >+ my $biblios = $sth2->fetchall_arrayref({}); >+ $sth2->finish(); >+ foreach my $b (@$biblios) { >+ #UPSERT the datereceived >+ my $record = C4::Biblio::GetMarcBiblio( $b->{biblionumber} ); >+ my @existingFields = $record->field($datereceivedFieldCode); >+ if ($existingFields[0]) { >+ $existingFields[0]->update($datereceivedSubfieldCode => $b->{datereceived}); >+ } >+ else { >+ my $newField = MARC::Field->new($datereceivedFieldCode, '', '', $datereceivedSubfieldCode => $b->{datereceived}); >+ $record->insert_fields_ordered($newField); >+ } >+ C4::Biblio::ModBiblio($record, $b->{biblionumber}, $b->{frameworkcode}); >+ } >+ >+ print "Upgrade to $DBversion done (Bug 13707 - Adding a new column datereceived for items and biblioitems. New sortable Zebra index! )\n"; >+ print "- All MARC records have now been updated, but Zebra needs to be fully reindexed.\n"; >+ }; >+ &$doTheDirtyDeed(); >+ } >+ >+ 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 %] > <option value="acqdate_asc">Acquisition date: oldest to newest</option> > [% END %] >+ >+[% IF ( sort_by == "datereceived_dsc" ) %] >+ <option value="datereceived_dsc" selected="selected">Receival date: newest to oldest</option> >+[% ELSE %] >+ <option value="datereceived_dsc">Receival date: newest to oldest</option> >+[% END %] >+ >+[% IF ( sort_by == "datereceived_asc" ) %] >+ <option value="datereceived_asc" selected="selected">Receival date: oldest to newest</option> >+[% ELSE %] >+ <option value="datereceived_asc">Receival date: oldest to newest</option> >+[% END %] > </optgroup> > > <optgroup label="Title"> >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 %] > <option value="acqdate_asc">Acquisition date: Oldest to newest</option> > [% END %] >+ [% IF ( sort_by == "datereceived_dsc" ) %] >+ <option value="datereceived_dsc" selected="selected">Receival date: Newest to oldest</option> >+ [% ELSE %] >+ <option value="datereceived_dsc">Receival date: Newest to oldest</option> >+ [% END %] >+ [% IF ( sort_by == "datereceived_asc" ) %] >+ <option value="datereceived_asc" selected="selected">Receival date: Oldest to newest</option> >+ [% ELSE %] >+ <option value="datereceived_asc">Receival date: Oldest to newest</option> >+ [% END %] > </optgroup> > <optgroup label="Title"> > [% IF ( sort_by == "title_az" || sort_by == "title_asc" ) %] >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13707
:
35908
|
35909
|
35910
|
35917
|
35933
|
35944
|
35945
|
35946
|
35966
|
35967
|
35968
|
35970
|
42391
|
42394
|
64343
|
64344