View | Details | Raw Unified | Return to bug 11175
Collapse All | Expand All

(-)a/C4/Search.pm (+2 lines)
Lines 1075-1080 sub getIndexes{ Link Here
1075
                    'Conference-name-seealso',
1075
                    'Conference-name-seealso',
1076
                    'Content-type',
1076
                    'Content-type',
1077
                    'Control-number',
1077
                    'Control-number',
1078
                    'Control-number-identifier',
1079
                    'cni',
1078
                    'copydate',
1080
                    'copydate',
1079
                    'Corporate-name',
1081
                    'Corporate-name',
1080
                    'Corporate-name-heading',
1082
                    'Corporate-name-heading',
(-)a/C4/XSLT.pm (-1 / +22 lines)
Lines 272-278 sub XSLTParse4Display { Link Here
272
    }
272
    }
273
    $varxml .= "</variables>\n";
273
    $varxml .= "</variables>\n";
274
274
275
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/;
275
    my $partsxml = '';
276
    # possibly insert component records into Detail views
277
    if ($xslsyspref =~ m/Details/) {
278
        my $showcomp = C4::Context->preference('ShowComponentRecords');
279
        if ( $showcomp eq 'both' ||
280
             ($showcomp eq 'staff' && $xslsyspref !~ m/OPAC/ ) ||
281
             ($showcomp eq 'opac' && $xslsyspref =~ m/OPAC/  ) ) {
282
            my $biblio = Koha::Biblios->find( $biblionumber );
283
            if ( $biblio->components() ) {
284
                my @componentPartRecordXML = ('<componentPartRecords>');
285
                for my $cb ( @{ $biblio->components() } ) {
286
                    # Remove the xml header
287
                    $cb =~ s/^<\?xml.*?\?>//;
288
                    push @componentPartRecordXML, decode('utf8', $cb);
289
                }
290
                push @componentPartRecordXML, '</componentPartRecords>';
291
                $partsxml = join "\n", @componentPartRecordXML;
292
            }
293
        }
294
    }
295
296
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml$partsxml\<\/record\>/;
276
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
297
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
277
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
298
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
278
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
299
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
(-)a/Koha/Biblio.pm (+45 lines)
Lines 43-48 use Koha::Items; Link Here
43
use Koha::Libraries;
43
use Koha::Libraries;
44
use Koha::Suggestions;
44
use Koha::Suggestions;
45
use Koha::Subscriptions;
45
use Koha::Subscriptions;
46
use Koha::SearchEngine;
47
use Koha::SearchEngine::Search;
46
48
47
=head1 NAME
49
=head1 NAME
48
50
Lines 494-499 sub suggestions { Link Here
494
    return Koha::Suggestions->_new_from_dbic( $suggestions_rs );
496
    return Koha::Suggestions->_new_from_dbic( $suggestions_rs );
495
}
497
}
496
498
499
=head3 components
500
501
my $components = $self->components();
502
503
Returns an array of MARCXML data, which are component parts of
504
this object (MARC21 773$w points to this)
505
506
=cut
507
508
sub components {
509
    my ($self) = @_;
510
511
    return undef if (C4::Context->preference('marcflavour') ne 'MARC21');
512
513
    if (!defined($self->{_components})) {
514
        my $marc = C4::Biblio::GetMarcBiblio({ biblionumber => $self->id });
515
        my $pf001 = $marc->field('001') || undef;
516
        my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
517
518
        if (defined($pf001)) {
519
            my $pf003 = $marc->field('003') || undef;
520
            my $searchstr;
521
522
            if (!defined($pf003)) {
523
                # search for 773$w='Host001'
524
                $searchstr = "rcn='".$pf001->data()."'";
525
            } else {
526
                # search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001')
527
                $searchstr = "(rcn='".$pf001->data()."' and cni='".$pf003->data()."')";
528
                $searchstr .= " or rcn='".$pf003->data()." ".$pf001->data()."'";
529
            }
530
531
            my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, undef );
532
533
            $self->{_components} = $results if ( defined($results) && scalar(@$results) );
534
        } else {
535
            warn "Record $self->id has no 001";
536
        }
537
    }
538
539
    return $self->{_components};
540
}
541
497
=head3 subscriptions
542
=head3 subscriptions
498
543
499
my $subscriptions = $self->subscriptions
544
my $subscriptions = $self->subscriptions
(-)a/etc/zebradb/biblios/etc/bib1.att (+1 lines)
Lines 221-226 att 9010 cn-suffix Link Here
221
att 9011    Suppress
221
att 9011    Suppress
222
att 9012    Identifier-other
222
att 9012    Identifier-other
223
att 9013    not-onloan-count
223
att 9013    not-onloan-count
224
att 9014    Control-number-identifier
224
225
225
# Items Index
226
# Items Index
226
att 8001    withdrawn
227
att 8001    withdrawn
(-)a/etc/zebradb/ccl.properties (+3 lines)
Lines 996-1001 llength 1=llength Link Here
996
Summary 1=Summary
996
Summary 1=Summary
997
not-onloan-count 1=9013 4=109
997
not-onloan-count 1=9013 4=109
998
998
999
Control-number-identifier 1=9014
1000
cni Control-number-identifier
1001
999
###
1002
###
1000
# Items Index
1003
# Items Index
1001
withdrawn 1=8001
1004
withdrawn 1=8001
(-)a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml (+3 lines)
Lines 16-21 Link Here
16
  <index_control_field tag="001">
16
  <index_control_field tag="001">
17
    <target_index>Control-number:w</target_index>
17
    <target_index>Control-number:w</target_index>
18
  </index_control_field>
18
  </index_control_field>
19
  <index_control_field tag="003">
20
    <target_index>Control-number-identifier:w</target_index>
21
  </index_control_field>
19
  <!--record.abs line 44: melm 005        Date/time-last-modified-->
22
  <!--record.abs line 44: melm 005        Date/time-last-modified-->
20
  <index_control_field tag="005">
23
  <index_control_field tag="005">
21
    <target_index>Date/time-last-modified:w</target_index>
24
    <target_index>Date/time-last-modified:w</target_index>
(-)a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl (+5 lines)
Lines 62-67 definition file (probably something like {biblio,authority}-koha-indexdefs.xml) Link Here
62
      <xslo:value-of select="."/>
62
      <xslo:value-of select="."/>
63
    </z:index>
63
    </z:index>
64
  </xslo:template>
64
  </xslo:template>
65
  <xslo:template match="marc:controlfield[@tag='003']">
66
    <z:index name="Control-number-identifier:w">
67
      <xslo:value-of select="."/>
68
    </z:index>
69
  </xslo:template>
65
  <xslo:template match="marc:controlfield[@tag='005']">
70
  <xslo:template match="marc:controlfield[@tag='005']">
66
    <z:index name="Date/time-last-modified:w">
71
    <z:index name="Date/time-last-modified:w">
67
      <xslo:value-of select="."/>
72
      <xslo:value-of select="."/>
(-)a/installer/data/mysql/atomicupdate/bug_11175.perl (+6 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $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')");
4
    SetVersion( $DBversion );
5
    print "Upgrade to $DBversion done (Bug 11175: Show component records in detail views)\n";
6
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 596-601 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
596
('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'),
596
('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'),
597
('ShelfBrowserUsesLocation','1','1','Use the item location when finding items for the shelf browser.','YesNo'),
597
('ShelfBrowserUsesLocation','1','1','Use the item location when finding items for the shelf browser.','YesNo'),
598
('ShowAllCheckins', '0', '', 'Show all checkins', 'YesNo'),
598
('ShowAllCheckins', '0', '', 'Show all checkins', 'YesNo'),
599
('ShowComponentRecords', 'nowhere', 'nowhere|staff|opac|both','In which record detail pages to show list of the component records, as linked via 773','Choice'),
599
('showLastPatron','0','','If ON, enables the last patron feature in the intranet','YesNo'),
600
('showLastPatron','0','','If ON, enables the last patron feature in the intranet','YesNo'),
600
('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'),
601
('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'),
601
('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'),
602
('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+8 lines)
Lines 578-583 ol { Link Here
578
    padding: 7px 0;
578
    padding: 7px 0;
579
}
579
}
580
580
581
.componentPartRecordsContainer {
582
    float: right;
583
    overflow-y: auto;
584
    overflow-x: hidden;
585
    max-width: 50%;
586
    max-height: 25em;
587
}
588
581
#editions {
589
#editions {
582
    table,
590
    table,
583
    td {
591
    td {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref (+9 lines)
Lines 181-183 Staff interface: Link Here
181
                  yes: Show
181
                  yes: Show
182
                  no: "Don't show"
182
                  no: "Don't show"
183
            - a search field pulldown for 'Search the catalog' boxes.
183
            - a search field pulldown for 'Search the catalog' boxes.
184
        -
185
            - Show a list of component records, as linked via field 773, in
186
            - pref: ShowComponentRecords
187
              choices:
188
                  nowhere: "no"
189
                  staff: "staff client"
190
                  opac: "OPAC"
191
                  both: "both staff client and OPAC"
192
            - record detail pages.
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl (+2 lines)
Lines 115-120 Link Here
115
            </h1>
115
            </h1>
116
        </xsl:if>
116
        </xsl:if>
117
117
118
	<xsl:call-template name="showComponentParts"/>
119
118
        <!--Bug 13381 -->
120
        <!--Bug 13381 -->
119
        <xsl:if test="marc:datafield[@tag=245]">
121
        <xsl:if test="marc:datafield[@tag=245]">
120
            <h1 class="title" property="name">
122
            <h1 class="title" property="name">
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl (+66 lines)
Lines 578-583 Link Here
578
        </xsl:if>
578
        </xsl:if>
579
    </xsl:template>
579
    </xsl:template>
580
580
581
    <xsl:template name="showComponentParts">
582
        <!-- Component part records: Displaying title and author of component part records -->
583
        <xsl:if test="marc:componentPartRecords">
584
            <div class="results_summary componentPartRecordsContainer">
585
                <h5>Component part records</h5>
586
                <ol class="componentParts">
587
                    <xsl:for-each select="marc:componentPartRecords/marc:record">
588
                        <li>
589
                            <span class="componentPartRecord">
590
                                <span class="componentPartRecordTitle">
591
                                    <a>
592
                                    <xsl:attribute name="href">/cgi-bin/koha/catalogue/detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']" /></xsl:attribute>
593
                                    <xsl:choose>
594
                                        <xsl:when test="marc:datafield[@tag=245]/marc:subfield[@code='a']">
595
                                            <xsl:value-of select="substring-before( concat(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/'), '/')" />
596
                                        </xsl:when>
597
                                        <xsl:when test="marc:datafield[@tag=240]/marc:subfield[@code='a']">
598
					  <xsl:for-each select="marc:datafield[@tag=240]">
599
					    <xsl:call-template name="chopPunctuation">
600
					      <xsl:with-param name="chopString">
601
						<xsl:call-template name="subfieldSelect">
602
						  <xsl:with-param name="codes">amnp</xsl:with-param>
603
						</xsl:call-template>
604
					      </xsl:with-param>
605
					    </xsl:call-template>
606
					  </xsl:for-each>
607
                                        </xsl:when>
608
                                        <xsl:when test="marc:datafield[@tag=130]/marc:subfield[@code='a']">
609
					  <xsl:for-each select="marc:datafield[@tag=130]">
610
					    <xsl:call-template name="chopPunctuation">
611
					      <xsl:with-param name="chopString">
612
						<xsl:call-template name="subfieldSelect">
613
						  <xsl:with-param name="codes">amnp</xsl:with-param>
614
						</xsl:call-template>
615
					      </xsl:with-param>
616
					    </xsl:call-template>
617
					  </xsl:for-each>
618
                                        </xsl:when>
619
                                        <xsl:otherwise>
620
                                            <xsl:text>[Record with no title statement]</xsl:text>
621
                                        </xsl:otherwise>
622
                                    </xsl:choose>
623
                                    </a>
624
                                </span>
625
				<xsl:choose>
626
                                  <xsl:when test="marc:datafield[@tag=100]/marc:subfield[@code='a']">
627
                                    -
628
                                    <span class="componentPartRecordAuthor">
629
                                        <xsl:value-of select="marc:datafield[@tag=100]/marc:subfield[@code='a']" />
630
                                    </span>
631
                                  </xsl:when>
632
                                  <xsl:when test="marc:datafield[@tag=110]/marc:subfield[@code='a']">
633
                                    -
634
                                    <span class="componentPartRecordAuthor">
635
                                        <xsl:value-of select="marc:datafield[@tag=110]/marc:subfield[@code='a']" />
636
                                    </span>
637
                                  </xsl:when>
638
				</xsl:choose>
639
                            </span>
640
                        </li>
641
                    </xsl:for-each>
642
                </ol>
643
            </div>
644
        </xsl:if>
645
    </xsl:template>
646
581
</xsl:stylesheet>
647
</xsl:stylesheet>
582
648
583
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
649
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
(-)a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss (+8 lines)
Lines 261-266 th { Link Here
261
}
261
}
262
262
263
263
264
.componentPartRecordsContainer {
265
    float: right;
266
    overflow-y: auto;
267
    overflow-x: hidden;
268
    max-width: 50%;
269
    max-height: 25em;
270
}
271
264
#members {
272
#members {
265
    p {
273
    p {
266
        color: #727272;
274
        color: #727272;
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl (+2 lines)
Lines 127-132 Link Here
127
            </h2>
127
            </h2>
128
        </xsl:if>
128
        </xsl:if>
129
129
130
	<xsl:call-template name="showComponentParts"/>
131
130
            <!--Bug 13381 -->
132
            <!--Bug 13381 -->
131
            <xsl:if test="marc:datafield[@tag=245]">
133
            <xsl:if test="marc:datafield[@tag=245]">
132
                <h2 class="title" property="name">
134
                <h2 class="title" property="name">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl (-1 / +66 lines)
Lines 542-547 Link Here
542
        </xsl:if>
542
        </xsl:if>
543
    </xsl:template>
543
    </xsl:template>
544
544
545
    <xsl:template name="showComponentParts">
546
        <!-- Component part records: Displaying title and author of component part records -->
547
        <xsl:if test="marc:componentPartRecords">
548
            <div class="results_summary componentPartRecordsContainer">
549
                <h5>Component part records</h5>
550
                <ol class="componentParts">
551
                    <xsl:for-each select="marc:componentPartRecords/marc:record">
552
                        <li>
553
                            <span class="componentPartRecord">
554
                                <span class="componentPartRecordTitle">
555
                                    <a>
556
                                    <xsl:attribute name="href">/cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="marc:datafield[@tag=999]/marc:subfield[@code='c']" /></xsl:attribute>
557
                                    <xsl:choose>
558
                                        <xsl:when test="marc:datafield[@tag=245]/marc:subfield[@code='a']">
559
                                            <xsl:value-of select="substring-before( concat(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/'), '/')" />
560
                                        </xsl:when>
561
                                        <xsl:when test="marc:datafield[@tag=240]/marc:subfield[@code='a']">
562
					  <xsl:for-each select="marc:datafield[@tag=240]">
563
					    <xsl:call-template name="chopPunctuation">
564
					      <xsl:with-param name="chopString">
565
						<xsl:call-template name="subfieldSelect">
566
						  <xsl:with-param name="codes">amnp</xsl:with-param>
567
						</xsl:call-template>
568
					      </xsl:with-param>
569
					    </xsl:call-template>
570
					  </xsl:for-each>
571
                                        </xsl:when>
572
                                        <xsl:when test="marc:datafield[@tag=130]/marc:subfield[@code='a']">
573
					  <xsl:for-each select="marc:datafield[@tag=130]">
574
					    <xsl:call-template name="chopPunctuation">
575
					      <xsl:with-param name="chopString">
576
						<xsl:call-template name="subfieldSelect">
577
						  <xsl:with-param name="codes">amnp</xsl:with-param>
578
						</xsl:call-template>
579
					      </xsl:with-param>
580
					    </xsl:call-template>
581
					  </xsl:for-each>
582
                                        </xsl:when>
583
                                        <xsl:otherwise>
584
                                            <xsl:text>[Record with no title statement]</xsl:text>
585
                                        </xsl:otherwise>
586
                                    </xsl:choose>
587
                                    </a>
588
                                </span>
589
				<xsl:choose>
590
                                  <xsl:when test="marc:datafield[@tag=100]/marc:subfield[@code='a']">
591
                                    -
592
                                    <span class="componentPartRecordAuthor">
593
                                        <xsl:value-of select="marc:datafield[@tag=100]/marc:subfield[@code='a']" />
594
                                    </span>
595
                                  </xsl:when>
596
                                  <xsl:when test="marc:datafield[@tag=110]/marc:subfield[@code='a']">
597
                                    -
598
                                    <span class="componentPartRecordAuthor">
599
                                        <xsl:value-of select="marc:datafield[@tag=110]/marc:subfield[@code='a']" />
600
                                    </span>
601
                                  </xsl:when>
602
				</xsl:choose>
603
                            </span>
604
                        </li>
605
                    </xsl:for-each>
606
                </ol>
607
            </div>
608
        </xsl:if>
609
    </xsl:template>
610
545
</xsl:stylesheet>
611
</xsl:stylesheet>
546
612
547
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
613
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
548
- 

Return to bug 11175