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

(-)a/C4/Search.pm (+2 lines)
Lines 996-1001 sub getIndexes{ Link Here
996
                    'Conference-name-seealso',
996
                    'Conference-name-seealso',
997
                    'Content-type',
997
                    'Content-type',
998
                    'Control-number',
998
                    'Control-number',
999
                    'Control-number-identifier',
1000
                    'cni',
999
                    'copydate',
1001
                    'copydate',
1000
                    'Corporate-name',
1002
                    'Corporate-name',
1001
                    'Corporate-name-heading',
1003
                    'Corporate-name-heading',
(-)a/C4/XSLT.pm (-1 / +22 lines)
Lines 271-277 sub XSLTParse4Display { Link Here
271
    }
271
    }
272
    $varxml .= "</variables>\n";
272
    $varxml .= "</variables>\n";
273
273
274
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/;
274
    my $partsxml = '';
275
    # possibly insert component records into Detail views
276
    if ($xslsyspref =~ m/Details/) {
277
        my $showcomp = C4::Context->preference('ShowComponentRecords');
278
        if ( $showcomp eq 'both' ||
279
             ($showcomp eq 'staff' && $xslsyspref !~ m/OPAC/ ) ||
280
             ($showcomp eq 'opac' && $xslsyspref =~ m/OPAC/  ) ) {
281
            my $biblio = Koha::Biblios->find( $biblionumber );
282
            if ( $biblio->components() ) {
283
                my @componentPartRecordXML = ('<componentPartRecords>');
284
                for my $cb ( @{ $biblio->components() } ) {
285
                    # Remove the xml header
286
                    $cb =~ s/^<\?xml.*?\?>//;
287
                    push @componentPartRecordXML, decode('utf8', $cb);
288
                }
289
                push @componentPartRecordXML, '</componentPartRecords>';
290
                $partsxml = join "\n", @componentPartRecordXML;
291
            }
292
        }
293
    }
294
295
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml$partsxml\<\/record\>/;
275
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
296
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
276
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
297
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
277
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
298
        $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/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 612-617 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
612
('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'),
612
('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'),
613
('ShelfBrowserUsesLocation','1','1','Use the item location when finding items for the shelf browser.','YesNo'),
613
('ShelfBrowserUsesLocation','1','1','Use the item location when finding items for the shelf browser.','YesNo'),
614
('ShowAllCheckins', '0', '', 'Show all checkins', 'YesNo'),
614
('ShowAllCheckins', '0', '', 'Show all checkins', 'YesNo'),
615
('ShowComponentRecords', 'nowhere', 'nowhere|staff|opac|both','In which record detail pages to show list of the component records, as linked via 773','Choice'),
615
('showLastPatron','0','','If ON, enables the last patron feature in the intranet','YesNo'),
616
('showLastPatron','0','','If ON, enables the last patron feature in the intranet','YesNo'),
616
('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'),
617
('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'),
617
('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'),
618
('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 597-602 ol { Link Here
597
    padding: 7px 0;
597
    padding: 7px 0;
598
}
598
}
599
599
600
.componentPartRecordsContainer {
601
    float: right;
602
    overflow-y: auto;
603
    overflow-x: hidden;
604
    max-width: 50%;
605
    max-height: 25em;
606
}
607
600
#editions {
608
#editions {
601
    table,
609
    table,
602
    td {
610
    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