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 / +18 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
    # Add component part records only for Detail view
248
    if ( $xslsyspref =~ m/Details/ ) {
249
        my $biblio = Koha::Biblios->find( $biblionumber );
250
        if ( $biblio->components() ) {
251
            my @componentPartRecordXML = ('<componentPartRecords>');
252
            for my $cb ( @{ $biblio->components() } ) {
253
                # Remove the xml header
254
                $cb =~ s/^<\?xml.*?\?>//;
255
                push @componentPartRecordXML, decode('utf8', $cb);
256
            }
257
            push @componentPartRecordXML, '</componentPartRecords>';
258
259
            $partsxml = join "\n", @componentPartRecordXML;
260
        }
261
    }
262
263
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$partsxml\<\/record\>/;
247
    if ($fixamps) { # We need to correct the HTML entities that Zebra outputs
264
    if ($fixamps) { # We need to correct the HTML entities that Zebra outputs
248
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
265
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
249
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
266
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
(-)a/Koha/Biblio.pm (+41 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 $pf003 = $marc->field('003') || undef;
409
410
        my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
411
412
        if (defined($pf001)) {
413
	    # search for (773$w='Host001' and 003='Host003') or 773$w='Host003 Host001')
414
            my $searchstr = "(rcn='".$pf001->data()."'";
415
            $searchstr .= " and cni='".$pf003->data()."'" if (defined($pf003));
416
	    $searchstr .= ")";
417
	    $searchstr .= " or rcn='".$pf003->data()." ".$pf001->data()."'" if (defined($pf003));
418
419
            my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, undef );
420
421
            $self->{_components} = $results if ( defined($results) && scalar(@$results) );
422
        } else {
423
            warn "Record $self->id has no 001";
424
        }
425
    }
426
427
    return $self->{_components};
428
}
429
389
=head3 subscriptions
430
=head3 subscriptions
390
431
391
my $subscriptions = $self->subscriptions
432
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/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/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/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