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

(-)a/C4/XSLT.pm (-1 / +22 lines)
Lines 285-292 sub XSLTParse4Display { Link Here
285
    }
285
    }
286
    $varxml .= "</variables>\n";
286
    $varxml .= "</variables>\n";
287
287
288
    my $partsxml = '';
289
    # possibly insert component records into Detail views
290
    if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" ) {
291
        my $showcomp = C4::Context->preference('ShowComponentRecords');
292
        if ( $showcomp eq 'both' ||
293
             ($showcomp eq 'staff' && $xslsyspref !~ m/OPAC/ ) ||
294
             ($showcomp eq 'opac' && $xslsyspref =~ m/OPAC/  ) ) {
295
            my $biblio = Koha::Biblios->find( $biblionumber );
296
            if ( $biblio->components() ) {
297
                my @componentPartRecordXML = ('<componentPartRecords>');
298
                for my $cb ( @{ $biblio->components() } ) {
299
                    # Remove the xml header
300
                    $cb =~ s/^<\?xml.*?\?>//;
301
                    push @componentPartRecordXML, decode('utf8', $cb);
302
                }
303
                push @componentPartRecordXML, '</componentPartRecords>';
304
                $partsxml = join "\n", @componentPartRecordXML;
305
            }
306
        }
307
    }
308
288
    my $sysxml = get_xslt_sysprefs();
309
    my $sysxml = get_xslt_sysprefs();
289
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/;
310
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml$partsxml\<\/record\>/;
290
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
311
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
291
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
312
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
292
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
313
        $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 476-481 sub suggestions { Link Here
476
    return Koha::Suggestions->_new_from_dbic( $suggestions_rs );
478
    return Koha::Suggestions->_new_from_dbic( $suggestions_rs );
477
}
479
}
478
480
481
=head3 components
482
483
my $components = $self->components();
484
485
Returns an array of MARCXML data, which are component parts of
486
this object (MARC21 773$w points to this)
487
488
=cut
489
490
sub components {
491
    my ($self) = @_;
492
493
    return undef if (C4::Context->preference('marcflavour') ne 'MARC21');
494
495
    if (!defined($self->{_components})) {
496
        my $marc = C4::Biblio::GetMarcBiblio({ biblionumber => $self->id });
497
        my $pf001 = $marc->field('001') || undef;
498
        my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
499
500
        if (defined($pf001)) {
501
            my $pf003 = $marc->field('003') || undef;
502
            my $searchstr;
503
504
            if (!defined($pf003)) {
505
                # search for 773$w='Host001'
506
                $searchstr = "rcn='".$pf001->data()."'";
507
            } else {
508
                # search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001')
509
                $searchstr = "(rcn='".$pf001->data()."' and cni='".$pf003->data()."')";
510
                $searchstr .= " or rcn='".$pf003->data()." ".$pf001->data()."'";
511
            }
512
513
            my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, undef );
514
515
            $self->{_components} = $results if ( defined($results) && scalar(@$results) );
516
        } else {
517
            warn "Record $self->id has no 001";
518
        }
519
    }
520
521
    return $self->{_components};
522
}
523
479
=head3 subscriptions
524
=head3 subscriptions
480
525
481
my $subscriptions = $self->subscriptions
526
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 615-620 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
615
('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'),
615
('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'),
616
('ShelfBrowserUsesLocation','1','1','Use the item location when finding items for the shelf browser.','YesNo'),
616
('ShelfBrowserUsesLocation','1','1','Use the item location when finding items for the shelf browser.','YesNo'),
617
('ShowAllCheckins', '0', '', 'Show all checkins', 'YesNo'),
617
('ShowAllCheckins', '0', '', 'Show all checkins', 'YesNo'),
618
('ShowComponentRecords', 'nowhere', 'nowhere|staff|opac|both','In which record detail pages to show list of the component records, as linked via 773','Choice'),
618
('showLastPatron','0','','If ON, enables the last patron feature in the intranet','YesNo'),
619
('showLastPatron','0','','If ON, enables the last patron feature in the intranet','YesNo'),
619
('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'),
620
('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'),
620
('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'),
621
('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 614-619 ol { Link Here
614
    padding: 7px 0;
614
    padding: 7px 0;
615
}
615
}
616
616
617
.componentPartRecordsContainer {
618
    float: right;
619
    overflow-y: auto;
620
    overflow-x: hidden;
621
    max-width: 50%;
622
    max-height: 25em;
623
}
624
617
#editions {
625
#editions {
618
    table,
626
    table,
619
    td {
627
    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