@@ -, +, @@ (This file is an attachment on the bug) the biblio detail page. You should not see anything different in the record detail page. the record detail page in staff client and OPAC. You should see a list of component part records. --- C4/Search.pm | 2 + C4/XSLT.pm | 23 +++++++- Koha/Biblio.pm | 45 +++++++++++++++ Koha/QueryParser/Driver/PQF.pm | 2 + etc/searchengine/queryparser.yaml | 10 ++++ etc/zebradb/biblios/etc/bib1.att | 1 + etc/zebradb/ccl.properties | 3 + .../marc21/biblios/biblio-koha-indexdefs.xml | 3 + .../marc21/biblios/biblio-zebra-indexdefs.xsl | 5 ++ installer/data/mysql/atomicupdate/bug_11175.perl | 6 ++ installer/data/mysql/sysprefs.sql | 1 + .../intranet-tmpl/prog/css/src/staff-global.scss | 8 +++ .../en/modules/admin/preferences/staff_client.pref | 9 +++ .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 2 + .../intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl | 66 +++++++++++++++++++++ koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss | 7 +++ .../bootstrap/en/xslt/MARC21slim2OPACDetail.xsl | 2 + .../bootstrap/en/xslt/MARC21slimUtils.xsl | 67 ++++++++++++++++++++++ t/QueryParser.t | 2 +- 19 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_11175.perl --- a/C4/Search.pm +++ a/C4/Search.pm @@ -1119,6 +1119,8 @@ sub getIndexes{ 'Conference-name-seealso', 'Content-type', 'Control-number', + 'Control-number-identifier', + 'cni', 'copydate', 'Corporate-name', 'Corporate-name-heading', --- a/C4/XSLT.pm +++ a/C4/XSLT.pm @@ -243,7 +243,28 @@ sub XSLTParse4Display { my $itemsxml = buildKohaItemsNamespace($biblionumber, $hidden_items); my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour')); - $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/; + my $partsxml = ''; + # possibly insert component records into Detail views + if ($xslsyspref =~ m/Details/) { + my $showcomp = C4::Context->preference('ShowComponentRecords'); + if ( $showcomp eq 'both' || + ($showcomp eq 'staff' && $xslsyspref !~ m/OPAC/ ) || + ($showcomp eq 'opac' && $xslsyspref =~ m/OPAC/ ) ) { + my $biblio = Koha::Biblios->find( $biblionumber ); + if ( $biblio->components() ) { + my @componentPartRecordXML = (''); + for my $cb ( @{ $biblio->components() } ) { + # Remove the xml header + $cb =~ s/^<\?xml.*?\?>//; + push @componentPartRecordXML, decode('utf8', $cb); + } + push @componentPartRecordXML, ''; + $partsxml = join "\n", @componentPartRecordXML; + } + } + } + + $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$partsxml\<\/record\>/; if ($fixamps) { # We need to correct the HTML entities that Zebra outputs $xmlrecord =~ s/\&amp;/\&/g; $xmlrecord =~ s/\&\;lt\;/\<\;/g; --- a/Koha/Biblio.pm +++ a/Koha/Biblio.pm @@ -36,6 +36,8 @@ use Koha::IssuingRules; use Koha::Item::Transfer::Limits; use Koha::Libraries; use Koha::Subscriptions; +use Koha::SearchEngine; +use Koha::SearchEngine::Search; =head1 NAME @@ -386,6 +388,49 @@ sub biblioitem { return $self->{_biblioitem}; } +=head3 components + +my $components = $self->components(); + +Returns an array of MARCXML data, which are component parts of +this object (MARC21 773$w points to this) + +=cut + +sub components { + my ($self) = @_; + + return undef if (C4::Context->preference('marcflavour') ne 'MARC21'); + + if (!defined($self->{_components})) { + my $marc = C4::Biblio::GetMarcBiblio({ biblionumber => $self->id }); + my $pf001 = $marc->field('001') || undef; + my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); + + if (defined($pf001)) { + my $pf003 = $marc->field('003') || undef; + my $searchstr; + + if (!defined($pf003)) { + # search for 773$w='Host001' + $searchstr = "rcn='".$pf001->data()."'"; + } else { + # search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001') + $searchstr = "(rcn='".$pf001->data()."' and cni='".$pf003->data()."')"; + $searchstr .= " or rcn='".$pf003->data()." ".$pf001->data()."'"; + } + + my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, undef ); + + $self->{_components} = $results if ( defined($results) && scalar(@$results) ); + } else { + warn "Record $self->id has no 001"; + } + } + + return $self->{_components}; +} + =head3 subscriptions my $subscriptions = $self->subscriptions --- a/Koha/QueryParser/Driver/PQF.pm +++ a/Koha/QueryParser/Driver/PQF.pm @@ -727,6 +727,8 @@ sub TEST_SETUP { $self->add_search_field_alias( 'keyword' => 'note' => 'nt' ); $self->add_bib1_field_map('keyword' => 'record-control-number' => 'biblioserver' => { '1' => '1045' } ); $self->add_search_field_alias( 'keyword' => 'record-control-number' => 'rcn' ); + $self->add_bib1_field_map('keyword' => 'control-number-identifier' => 'biblioserver' => { '1' => '9014' } ); + $self->add_search_field_alias( 'keyword' => 'control-number-identifier' => 'cni' ); $self->add_bib1_field_map('subject' => '' => 'biblioserver' => { '1' => '21' } ); $self->add_search_field_alias( 'subject' => '' => 'su' ); $self->add_search_field_alias( 'subject' => '' => 'su-to' ); --- a/etc/searchengine/queryparser.yaml +++ a/etc/searchengine/queryparser.yaml @@ -321,6 +321,16 @@ field_mappings: aliases: - control-number label: Control-number + control-number-identifier: + bib1_mapping: + biblioserver: + 1: 9014 + enabled: 1 + index: control-number-identifier + aliases: + - control-number-identifier + - cni + label: Control-number-identifier copynumber: bib1_mapping: biblioserver: --- a/etc/zebradb/biblios/etc/bib1.att +++ a/etc/zebradb/biblios/etc/bib1.att @@ -221,6 +221,7 @@ att 9010 cn-suffix att 9011 Suppress att 9012 Identifier-other att 9013 not-onloan-count +att 9014 Control-number-identifier # Items Index att 8001 withdrawn --- a/etc/zebradb/ccl.properties +++ a/etc/zebradb/ccl.properties @@ -996,6 +996,9 @@ llength 1=llength Summary 1=Summary not-onloan-count 1=9013 4=109 +Control-number-identifier 1=9014 +cni Control-number-identifier + ### # Items Index withdrawn 1=8001 --- a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml +++ a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml @@ -16,6 +16,9 @@ Control-number:w + + Control-number-identifier:w + Date/time-last-modified:w --- a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl +++ a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl @@ -62,6 +62,11 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + + + --- a/installer/data/mysql/atomicupdate/bug_11175.perl +++ a/installer/data/mysql/atomicupdate/bug_11175.perl @@ -0,0 +1,6 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do("INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('ShowComponentRecords', 'nowhere', 'nowhere|staff|opac|both','In which record detail pages to show list of the component records, as linked via 773','Choice')"); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 11175: Show component records in detail views)\n"; +} --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -510,6 +510,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'), ('ShelfBrowserUsesLocation','1','1','Use the item location when finding items for the shelf browser.','YesNo'), ('ShowAllCheckins', '0', '', 'Show all checkins', 'YesNo'), +('ShowComponentRecords', 'nowhere', 'nowhere|staff|opac|both','In which record detail pages to show list of the component records, as linked via 773','Choice'), ('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'), ('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'), ('ShowReviewerPhoto','1','','If ON, photo of reviewer will be shown beside comments in OPAC','YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -707,6 +707,14 @@ ol { padding: 7px 0; } +.componentPartRecordsContainer { + float: right; + overflow-y: auto; + overflow-x: hidden; + max-width: 50%; + max-height: 25em; +} + #editions { table, td { --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref @@ -167,3 +167,12 @@ Staff Client: yes: Show no: "Don't show" - a search field pulldown for 'Search the catalog' boxes. + - + - Show a list of component records, as linked via field 773, in + - pref: ShowComponentRecords + choices: + nowhere: "no" + staff: "staff client" + opac: "OPAC" + both: "both staff client and OPAC" + - record detail pages. --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl +++ a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl @@ -110,6 +110,8 @@ + +

--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl +++ a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl @@ -338,6 +338,72 @@ + + + + + + +

--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl +++ a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl @@ -295,6 +295,73 @@ + + + + + + + +