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

(-)a/C4/XSLT.pm (-1 / +22 lines)
Lines 288-295 sub XSLTParse4Display { Link Here
288
    }
288
    }
289
    $varxml .= "</variables>\n";
289
    $varxml .= "</variables>\n";
290
290
291
    my $partsxml = '';
292
    # possibly insert component records into Detail views
293
    if ($xslsyspref =~ m/Details/) {
294
        my $showcomp = C4::Context->preference('ShowComponentRecords');
295
        if ( $showcomp eq 'both' ||
296
             ($showcomp eq 'staff' && $xslsyspref !~ m/OPAC/ ) ||
297
             ($showcomp eq 'opac' && $xslsyspref =~ m/OPAC/  ) ) {
298
            my $biblio = Koha::Biblios->find( $biblionumber );
299
            if ( $biblio->components() ) {
300
                my @componentPartRecordXML = ('<componentPartRecords>');
301
                for my $cb ( @{ $biblio->components() } ) {
302
                    # Remove the xml header
303
                    $cb =~ s/^<\?xml.*?\?>//;
304
                    push @componentPartRecordXML, decode('utf8', $cb);
305
                }
306
                push @componentPartRecordXML, '</componentPartRecords>';
307
                $partsxml = join "\n", @componentPartRecordXML;
308
            }
309
        }
310
    }
311
291
    my $sysxml = get_xslt_sysprefs();
312
    my $sysxml = get_xslt_sysprefs();
292
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/;
313
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml$partsxml\<\/record\>/;
293
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
314
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
294
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
315
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
295
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
316
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
(-)a/Koha/Biblio.pm (+45 lines)
Lines 41-46 use Koha::Items; Link Here
41
use Koha::Libraries;
41
use Koha::Libraries;
42
use Koha::Suggestions;
42
use Koha::Suggestions;
43
use Koha::Subscriptions;
43
use Koha::Subscriptions;
44
use Koha::SearchEngine;
45
use Koha::SearchEngine::Search;
44
46
45
=head1 NAME
47
=head1 NAME
46
48
Lines 495-500 sub suggestions { Link Here
495
    return Koha::Suggestions->_new_from_dbic( $suggestions_rs );
497
    return Koha::Suggestions->_new_from_dbic( $suggestions_rs );
496
}
498
}
497
499
500
=head3 components
501
502
my $components = $self->components();
503
504
Returns an array of MARCXML data, which are component parts of
505
this object (MARC21 773$w points to this)
506
507
=cut
508
509
sub components {
510
    my ($self) = @_;
511
512
    return undef if (C4::Context->preference('marcflavour') ne 'MARC21');
513
514
    if (!defined($self->{_components})) {
515
        my $marc = C4::Biblio::GetMarcBiblio({ biblionumber => $self->id });
516
        my $pf001 = $marc->field('001') || undef;
517
        my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
518
519
        if (defined($pf001)) {
520
            my $pf003 = $marc->field('003') || undef;
521
            my $searchstr;
522
523
            if (!defined($pf003)) {
524
                # search for 773$w='Host001'
525
                $searchstr = "rcn='".$pf001->data()."'";
526
            } else {
527
                # search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001')
528
                $searchstr = "(rcn='".$pf001->data()."' and cni='".$pf003->data()."')";
529
                $searchstr .= " or rcn='".$pf003->data()." ".$pf001->data()."'";
530
            }
531
532
            my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, undef );
533
534
            $self->{_components} = $results if ( defined($results) && scalar(@$results) );
535
        } else {
536
            warn "Record $self->id has no 001";
537
        }
538
    }
539
540
    return $self->{_components};
541
}
542
498
=head3 subscriptions
543
=head3 subscriptions
499
544
500
my $subscriptions = $self->subscriptions
545
my $subscriptions = $self->subscriptions
(-)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 613-618 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
613
('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'),
613
('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'),
614
('ShelfBrowserUsesLocation','1','1','Use the item location when finding items for the shelf browser.','YesNo'),
614
('ShelfBrowserUsesLocation','1','1','Use the item location when finding items for the shelf browser.','YesNo'),
615
('ShowAllCheckins', '0', '', 'Show all checkins', 'YesNo'),
615
('ShowAllCheckins', '0', '', 'Show all checkins', 'YesNo'),
616
('ShowComponentRecords', 'nowhere', 'nowhere|staff|opac|both','In which record detail pages to show list of the component records, as linked via 773','Choice'),
616
('showLastPatron','0','','If ON, enables the last patron feature in the intranet','YesNo'),
617
('showLastPatron','0','','If ON, enables the last patron feature in the intranet','YesNo'),
617
('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'),
618
('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'),
618
('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'),
619
('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 609-614 ol { Link Here
609
    padding: 7px 0;
609
    padding: 7px 0;
610
}
610
}
611
611
612
.componentPartRecordsContainer {
613
    float: right;
614
    overflow-y: auto;
615
    overflow-x: hidden;
616
    max-width: 50%;
617
    max-height: 25em;
618
}
619
612
#editions {
620
#editions {
613
    table,
621
    table,
614
    td {
622
    td {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref (+9 lines)
Lines 181-186 Staff interface: Link Here
181
                  1: Show
181
                  1: Show
182
                  0: "Don't show"
182
                  0: "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.
184
    Authentication:
193
    Authentication:
185
        -
194
        -
186
            - pref: staffShibOnly
195
            - pref: staffShibOnly
(-)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 292-297 th { Link Here
292
}
292
}
293
293
294
294
295
.componentPartRecordsContainer {
296
    float: right;
297
    overflow-y: auto;
298
    overflow-x: hidden;
299
    max-width: 50%;
300
    max-height: 25em;
301
}
302
295
#members {
303
#members {
296
    p {
304
    p {
297
        color: #727272;
305
        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
                <h1 class="title" property="name">
134
                <h1 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