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

(-)a/C4/Search.pm (+2 lines)
Lines 1119-1124 sub getIndexes{ Link Here
1119
                    'Conference-name-seealso',
1119
                    'Conference-name-seealso',
1120
                    'Content-type',
1120
                    'Content-type',
1121
                    'Control-number',
1121
                    'Control-number',
1122
                    'Control-number-identifier',
1123
                    'cni',
1122
                    'copydate',
1124
                    'copydate',
1123
                    'Corporate-name',
1125
                    'Corporate-name',
1124
                    'Corporate-name-heading',
1126
                    'Corporate-name-heading',
(-)a/C4/XSLT.pm (-1 / +22 lines)
Lines 243-249 sub XSLTParse4Display { Link Here
243
    my $itemsxml  = buildKohaItemsNamespace($biblionumber, $hidden_items);
243
    my $itemsxml  = buildKohaItemsNamespace($biblionumber, $hidden_items);
244
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
244
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
245
245
246
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
246
    my $partsxml = '';
247
    # possibly insert component records into Detail views
248
    if ($xslsyspref =~ m/Details/) {
249
        my $showcomp = C4::Context->preference('ShowComponentRecords');
250
        if ( $showcomp eq 'both' ||
251
             ($showcomp eq 'staff' && $xslsyspref !~ m/OPAC/ ) ||
252
             ($showcomp eq 'opac' && $xslsyspref =~ m/OPAC/  ) ) {
253
            my $biblio = Koha::Biblios->find( $biblionumber );
254
            if ( $biblio->components() ) {
255
                my @componentPartRecordXML = ('<componentPartRecords>');
256
                for my $cb ( @{ $biblio->components() } ) {
257
                    # Remove the xml header
258
                    $cb =~ s/^<\?xml.*?\?>//;
259
                    push @componentPartRecordXML, decode('utf8', $cb);
260
                }
261
                push @componentPartRecordXML, '</componentPartRecords>';
262
                $partsxml = join "\n", @componentPartRecordXML;
263
            }
264
        }
265
    }
266
267
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$partsxml\<\/record\>/;
247
    if ($fixamps) { # We need to correct the HTML entities that Zebra outputs
268
    if ($fixamps) { # We need to correct the HTML entities that Zebra outputs
248
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
269
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
249
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
270
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
(-)a/Koha/Biblio.pm (+45 lines)
Lines 36-41 use Koha::IssuingRules; Link Here
36
use Koha::Item::Transfer::Limits;
36
use Koha::Item::Transfer::Limits;
37
use Koha::Libraries;
37
use Koha::Libraries;
38
use Koha::Subscriptions;
38
use Koha::Subscriptions;
39
use Koha::SearchEngine;
40
use Koha::SearchEngine::Search;
39
41
40
=head1 NAME
42
=head1 NAME
41
43
Lines 386-391 sub biblioitem { Link Here
386
    return $self->{_biblioitem};
388
    return $self->{_biblioitem};
387
}
389
}
388
390
391
=head3 components
392
393
my $components = $self->components();
394
395
Returns an array of MARCXML data, which are component parts of
396
this object (MARC21 773$w points to this)
397
398
=cut
399
400
sub components {
401
    my ($self) = @_;
402
403
    return undef if (C4::Context->preference('marcflavour') ne 'MARC21');
404
405
    if (!defined($self->{_components})) {
406
        my $marc = C4::Biblio::GetMarcBiblio({ biblionumber => $self->id });
407
        my $pf001 = $marc->field('001') || undef;
408
        my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
409
410
        if (defined($pf001)) {
411
            my $pf003 = $marc->field('003') || undef;
412
            my $searchstr;
413
414
            if (!defined($pf003)) {
415
                # search for 773$w='Host001'
416
                $searchstr = "rcn='".$pf001->data()."'";
417
            } else {
418
                # search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001')
419
                $searchstr = "(rcn='".$pf001->data()."' and cni='".$pf003->data()."')";
420
                $searchstr .= " or rcn='".$pf003->data()." ".$pf001->data()."'";
421
            }
422
423
            my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, undef );
424
425
            $self->{_components} = $results if ( defined($results) && scalar(@$results) );
426
        } else {
427
            warn "Record $self->id has no 001";
428
        }
429
    }
430
431
    return $self->{_components};
432
}
433
389
=head3 subscriptions
434
=head3 subscriptions
390
435
391
my $subscriptions = $self->subscriptions
436
my $subscriptions = $self->subscriptions
(-)a/Koha/QueryParser/Driver/PQF.pm (+2 lines)
Lines 727-732 sub TEST_SETUP { Link Here
727
    $self->add_search_field_alias( 'keyword' => 'note' => 'nt' );
727
    $self->add_search_field_alias( 'keyword' => 'note' => 'nt' );
728
    $self->add_bib1_field_map('keyword' => 'record-control-number' => 'biblioserver' => { '1' => '1045' } );
728
    $self->add_bib1_field_map('keyword' => 'record-control-number' => 'biblioserver' => { '1' => '1045' } );
729
    $self->add_search_field_alias( 'keyword' => 'record-control-number' => 'rcn' );
729
    $self->add_search_field_alias( 'keyword' => 'record-control-number' => 'rcn' );
730
    $self->add_bib1_field_map('keyword' => 'control-number-identifier' => 'biblioserver' => { '1' => '9014' } );
731
    $self->add_search_field_alias( 'keyword' => 'control-number-identifier' => 'cni' );
730
    $self->add_bib1_field_map('subject' => '' => 'biblioserver' => { '1' => '21' } );
732
    $self->add_bib1_field_map('subject' => '' => 'biblioserver' => { '1' => '21' } );
731
    $self->add_search_field_alias( 'subject' => '' => 'su' );
733
    $self->add_search_field_alias( 'subject' => '' => 'su' );
732
    $self->add_search_field_alias( 'subject' => '' => 'su-to' );
734
    $self->add_search_field_alias( 'subject' => '' => 'su-to' );
(-)a/etc/searchengine/queryparser.yaml (+10 lines)
Lines 321-326 field_mappings: Link Here
321
      aliases:
321
      aliases:
322
        - control-number
322
        - control-number
323
      label: Control-number
323
      label: Control-number
324
    control-number-identifier:
325
      bib1_mapping:
326
        biblioserver:
327
          1: 9014
328
      enabled: 1
329
      index: control-number-identifier
330
      aliases:
331
        - control-number-identifier
332
        - cni
333
      label: Control-number-identifier
324
    copynumber:
334
    copynumber:
325
      bib1_mapping:
335
      bib1_mapping:
326
        biblioserver:
336
        biblioserver:
(-)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/sysprefs.sql (+1 lines)
Lines 510-515 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
510
('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'),
510
('ShelfBrowserUsesHomeBranch','1','1','Use the item home branch when finding items for the shelf browser.','YesNo'),
511
('ShelfBrowserUsesLocation','1','1','Use the item location when finding items for the shelf browser.','YesNo'),
511
('ShelfBrowserUsesLocation','1','1','Use the item location when finding items for the shelf browser.','YesNo'),
512
('ShowAllCheckins', '0', '', 'Show all checkins', 'YesNo'),
512
('ShowAllCheckins', '0', '', 'Show all checkins', 'YesNo'),
513
('ShowComponentRecords', 'nowhere', 'nowhere|staff|opac|both','In which record detail pages to show list of the component records, as linked via 773','Choice'),
513
('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'),
514
('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'),
514
('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'),
515
('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'),
515
('ShowReviewerPhoto','1','','If ON, photo of reviewer will be shown beside comments in OPAC','YesNo'),
516
('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 (+8 lines)
Lines 707-712 ol { Link Here
707
    padding: 7px 0;
707
    padding: 7px 0;
708
}
708
}
709
709
710
.componentPartRecordsContainer {
711
    float: right;
712
    overflow-y: auto;
713
    overflow-x: hidden;
714
    max-width: 50%;
715
    max-height: 25em;
716
}
717
710
#editions {
718
#editions {
711
    table,
719
    table,
712
    td {
720
    td {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref (+9 lines)
Lines 167-169 Staff Client: Link Here
167
                  yes: Show
167
                  yes: Show
168
                  no: "Don't show"
168
                  no: "Don't show"
169
            - a search field pulldown for 'Search the catalog' boxes.
169
            - a search field pulldown for 'Search the catalog' boxes.
170
        -
171
            - Show a list of component records, as linked via field 773, in
172
            - pref: ShowComponentRecords
173
              choices:
174
                  nowhere: "no"
175
                  staff: "staff client"
176
                  opac: "OPAC"
177
                  both: "both staff client and OPAC"
178
            - record detail pages.
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl (+2 lines)
Lines 110-115 Link Here
110
            </h1>
110
            </h1>
111
        </xsl:if>
111
        </xsl:if>
112
112
113
	<xsl:call-template name="showComponentParts"/>
114
113
        <!--Bug 13381 -->
115
        <!--Bug 13381 -->
114
        <xsl:if test="marc:datafield[@tag=245]">
116
        <xsl:if test="marc:datafield[@tag=245]">
115
            <h1 class="title" property="name">
117
            <h1 class="title" property="name">
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl (+66 lines)
Lines 338-343 Link Here
338
        </xsl:if>
338
        </xsl:if>
339
    </xsl:template>
339
    </xsl:template>
340
340
341
    <xsl:template name="showComponentParts">
342
        <!-- Component part records: Displaying title and author of component part records -->
343
        <xsl:if test="marc:componentPartRecords">
344
            <div class="results_summary componentPartRecordsContainer">
345
                <h5>Component part records</h5>
346
                <ol class="componentParts">
347
                    <xsl:for-each select="marc:componentPartRecords/marc:record">
348
                        <li>
349
                            <span class="componentPartRecord">
350
                                <span class="componentPartRecordTitle">
351
                                    <a>
352
                                    <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>
353
                                    <xsl:choose>
354
                                        <xsl:when test="marc:datafield[@tag=245]/marc:subfield[@code='a']">
355
                                            <xsl:value-of select="substring-before( concat(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/'), '/')" />
356
                                        </xsl:when>
357
                                        <xsl:when test="marc:datafield[@tag=240]/marc:subfield[@code='a']">
358
					  <xsl:for-each select="marc:datafield[@tag=240]">
359
					    <xsl:call-template name="chopPunctuation">
360
					      <xsl:with-param name="chopString">
361
						<xsl:call-template name="subfieldSelect">
362
						  <xsl:with-param name="codes">amnp</xsl:with-param>
363
						</xsl:call-template>
364
					      </xsl:with-param>
365
					    </xsl:call-template>
366
					  </xsl:for-each>
367
                                        </xsl:when>
368
                                        <xsl:when test="marc:datafield[@tag=130]/marc:subfield[@code='a']">
369
					  <xsl:for-each select="marc:datafield[@tag=130]">
370
					    <xsl:call-template name="chopPunctuation">
371
					      <xsl:with-param name="chopString">
372
						<xsl:call-template name="subfieldSelect">
373
						  <xsl:with-param name="codes">amnp</xsl:with-param>
374
						</xsl:call-template>
375
					      </xsl:with-param>
376
					    </xsl:call-template>
377
					  </xsl:for-each>
378
                                        </xsl:when>
379
                                        <xsl:otherwise>
380
                                            <xsl:text>[Record with no title statement]</xsl:text>
381
                                        </xsl:otherwise>
382
                                    </xsl:choose>
383
                                    </a>
384
                                </span>
385
				<xsl:choose>
386
                                  <xsl:when test="marc:datafield[@tag=100]/marc:subfield[@code='a']">
387
                                    -
388
                                    <span class="componentPartRecordAuthor">
389
                                        <xsl:value-of select="marc:datafield[@tag=100]/marc:subfield[@code='a']" />
390
                                    </span>
391
                                  </xsl:when>
392
                                  <xsl:when test="marc:datafield[@tag=110]/marc:subfield[@code='a']">
393
                                    -
394
                                    <span class="componentPartRecordAuthor">
395
                                        <xsl:value-of select="marc:datafield[@tag=110]/marc:subfield[@code='a']" />
396
                                    </span>
397
                                  </xsl:when>
398
				</xsl:choose>
399
                            </span>
400
                        </li>
401
                    </xsl:for-each>
402
                </ol>
403
            </div>
404
        </xsl:if>
405
    </xsl:template>
406
341
</xsl:stylesheet>
407
</xsl:stylesheet>
342
408
343
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
409
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
(-)a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss (+7 lines)
Lines 409-414 th { Link Here
409
    }
409
    }
410
}
410
}
411
411
412
.componentPartRecordsContainer {
413
    float: right;
414
    overflow-y: auto;
415
    overflow-x: hidden;
416
    max-width: 50%;
417
    max-height: 25em;
418
}
412
419
413
#members {
420
#members {
414
    display: block;
421
    display: block;
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl (+2 lines)
Lines 123-128 Link Here
123
            </h1>
123
            </h1>
124
        </xsl:if>
124
        </xsl:if>
125
125
126
	<xsl:call-template name="showComponentParts"/>
127
126
            <!--Bug 13381 -->
128
            <!--Bug 13381 -->
127
            <xsl:if test="marc:datafield[@tag=245]">
129
            <xsl:if test="marc:datafield[@tag=245]">
128
                <h1 class="title" property="name">
130
                <h1 class="title" property="name">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl (+67 lines)
Lines 295-300 Link Here
295
295
296
        </span>
296
        </span>
297
    </xsl:template>
297
    </xsl:template>
298
299
    <xsl:template name="showComponentParts">
300
        <!-- Component part records: Displaying title and author of component part records -->
301
        <xsl:if test="marc:componentPartRecords">
302
            <div class="results_summary componentPartRecordsContainer">
303
                <h5>Component part records</h5>
304
                <ol class="componentParts">
305
                    <xsl:for-each select="marc:componentPartRecords/marc:record">
306
                        <li>
307
                            <span class="componentPartRecord">
308
                                <span class="componentPartRecordTitle">
309
                                    <a>
310
                                    <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>
311
                                    <xsl:choose>
312
                                        <xsl:when test="marc:datafield[@tag=245]/marc:subfield[@code='a']">
313
                                            <xsl:value-of select="substring-before( concat(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/'), '/')" />
314
                                        </xsl:when>
315
                                        <xsl:when test="marc:datafield[@tag=240]/marc:subfield[@code='a']">
316
					  <xsl:for-each select="marc:datafield[@tag=240]">
317
					    <xsl:call-template name="chopPunctuation">
318
					      <xsl:with-param name="chopString">
319
						<xsl:call-template name="subfieldSelect">
320
						  <xsl:with-param name="codes">amnp</xsl:with-param>
321
						</xsl:call-template>
322
					      </xsl:with-param>
323
					    </xsl:call-template>
324
					  </xsl:for-each>
325
                                        </xsl:when>
326
                                        <xsl:when test="marc:datafield[@tag=130]/marc:subfield[@code='a']">
327
					  <xsl:for-each select="marc:datafield[@tag=130]">
328
					    <xsl:call-template name="chopPunctuation">
329
					      <xsl:with-param name="chopString">
330
						<xsl:call-template name="subfieldSelect">
331
						  <xsl:with-param name="codes">amnp</xsl:with-param>
332
						</xsl:call-template>
333
					      </xsl:with-param>
334
					    </xsl:call-template>
335
					  </xsl:for-each>
336
                                        </xsl:when>
337
                                        <xsl:otherwise>
338
                                            <xsl:text>[Record with no title statement]</xsl:text>
339
                                        </xsl:otherwise>
340
                                    </xsl:choose>
341
                                    </a>
342
                                </span>
343
				<xsl:choose>
344
                                  <xsl:when test="marc:datafield[@tag=100]/marc:subfield[@code='a']">
345
                                    -
346
                                    <span class="componentPartRecordAuthor">
347
                                        <xsl:value-of select="marc:datafield[@tag=100]/marc:subfield[@code='a']" />
348
                                    </span>
349
                                  </xsl:when>
350
                                  <xsl:when test="marc:datafield[@tag=110]/marc:subfield[@code='a']">
351
                                    -
352
                                    <span class="componentPartRecordAuthor">
353
                                        <xsl:value-of select="marc:datafield[@tag=110]/marc:subfield[@code='a']" />
354
                                    </span>
355
                                  </xsl:when>
356
				</xsl:choose>
357
                            </span>
358
                        </li>
359
                    </xsl:for-each>
360
                </ol>
361
            </div>
362
        </xsl:if>
363
    </xsl:template>
364
298
</xsl:stylesheet>
365
</xsl:stylesheet>
299
366
300
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
367
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
(-)a/t/QueryParser.t (-2 / +1 lines)
Lines 17-23 ok(defined $QParser, 'Successfully created empty QP object'); Link Here
17
ok($QParser->load_config('./etc/searchengine/queryparser.yaml'), 'Loaded QP config');
17
ok($QParser->load_config('./etc/searchengine/queryparser.yaml'), 'Loaded QP config');
18
18
19
is($QParser->search_class_count, 4, 'Initialized 4 search classes');
19
is($QParser->search_class_count, 4, 'Initialized 4 search classes');
20
is (scalar(@{$QParser->search_fields()->{'keyword'}}), 111, "Correct number of search fields for 'keyword' class");
20
is (scalar(@{$QParser->search_fields()->{'keyword'}}), 112, "Correct number of search fields for 'keyword' class");
21
21
22
# Set keyword search as the default
22
# Set keyword search as the default
23
$QParser->default_search_class('keyword');
23
$QParser->default_search_class('keyword');
24
- 

Return to bug 11175