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

(-)a/C4/Biblio.pm (-9 / +63 lines)
Lines 99-104 use Koha::Caches; Link Here
99
use Koha::Authority::Types;
99
use Koha::Authority::Types;
100
use Koha::Acquisition::Currencies;
100
use Koha::Acquisition::Currencies;
101
use Koha::Biblio::Metadatas;
101
use Koha::Biblio::Metadatas;
102
use Koha::MetadataRecord::Authority;
102
use Koha::Holds;
103
use Koha::Holds;
103
use Koha::ItemTypes;
104
use Koha::ItemTypes;
104
use Koha::Plugins;
105
use Koha::Plugins;
Lines 1150-1165 sub GetMarcSubfieldStructureFromKohaField { Link Here
1150
=head2 GetMarcBiblio
1151
=head2 GetMarcBiblio
1151
1152
1152
  my $record = GetMarcBiblio({
1153
  my $record = GetMarcBiblio({
1153
      biblionumber => $biblionumber,
1154
      biblionumber		=> $biblionumber,
1154
      embed_items  => $embeditems,
1155
      embed_items		=> $embeditems,
1155
      opac         => $opac,
1156
      embed_seefromheadings	=> $embedseefromheadings,
1156
      borcat       => $patron_category });
1157
      opac			=> $opac,
1158
      borcat			=> $patron_category });
1157
1159
1158
Returns MARC::Record representing a biblio record, or C<undef> if the
1160
Returns MARC::Record representing a biblio record, or C<undef> if the
1159
biblionumber doesn't exist.
1161
biblionumber doesn't exist.
1160
1162
1161
Both embed_items and opac are optional.
1163
embed_seefromheadings, embed_items and opac are optional.
1162
If embed_items is passed and is 1, items are embedded.
1164
If embed_items is passed and is 1, items are embedded.
1165
If embed_seefromheading is passed and is 1, see-from headings are embedded.
1163
If opac is passed and is 1, the record is filtered as needed.
1166
If opac is passed and is 1, the record is filtered as needed.
1164
1167
1165
=over 4
1168
=over 4
Lines 1195-1204 sub GetMarcBiblio { Link Here
1195
        return;
1198
        return;
1196
    }
1199
    }
1197
1200
1198
    my $biblionumber = $params->{biblionumber};
1201
    my $biblionumber         = $params->{biblionumber};
1199
    my $embeditems   = $params->{embed_items} || 0;
1202
    my $embeditems           = $params->{embed_items} || 0;
1200
    my $opac         = $params->{opac} || 0;
1203
    my $embedseefromheadings = $params->{embed_seefromheadings} || 0;
1201
    my $borcat       = $params->{borcat} // q{};
1204
    my $opac                 = $params->{opac} || 0;
1205
    my $borcat               = $params->{borcat} // q{};
1202
1206
1203
    if (not defined $biblionumber) {
1207
    if (not defined $biblionumber) {
1204
        carp 'GetMarcBiblio called with undefined biblionumber';
1208
        carp 'GetMarcBiblio called with undefined biblionumber';
Lines 1232-1237 sub GetMarcBiblio { Link Here
1232
            opac         => $opac,
1236
            opac         => $opac,
1233
            borcat       => $borcat })
1237
            borcat       => $borcat })
1234
          if ($embeditems);
1238
          if ($embeditems);
1239
        C4::Biblio::EmbedSeeFromHeadings({
1240
            marc_record  => $record })
1241
          if ($embedseefromheadings);
1235
1242
1236
        return $record;
1243
        return $record;
1237
    }
1244
    }
Lines 2680-2685 sub EmbedItemsInMarcBiblio { Link Here
2680
    $marc->append_fields(@item_fields);
2687
    $marc->append_fields(@item_fields);
2681
}
2688
}
2682
2689
2690
=head2 EmbedSeeFromHeadings
2691
2692
    EmbedSeeFromHeadings({
2693
        marc_record  => $record });
2694
2695
Given a MARC::Record object containing a bib record,
2696
modify it to include see-from headings.
2697
2698
=cut
2699
2700
sub EmbedSeeFromHeadings {
2701
    my ($params) = @_;
2702
    my $record = $params->{marc_record};
2703
2704
    my ($item_tag) = GetMarcFromKohaField("items.itemnumber", '');
2705
    $item_tag ||= '';
2706
2707
    foreach my $field ( $record->fields() ) {
2708
        next if $field->is_control_field();
2709
        next if $field->tag() eq $item_tag;
2710
        my $authid = $field->subfield('9');
2711
2712
        next unless $authid;
2713
2714
        my $authority = Koha::MetadataRecord::Authority->get_from_authid($authid);
2715
        next unless $authority;
2716
        my $auth_marc = $authority->record;
2717
        my @seefrom = $auth_marc->field('4..');
2718
        my @newfields;
2719
        foreach my $authfield (@seefrom) {
2720
            my $tag = substr($field->tag(), 0, 1) . substr($authfield->tag(), 1, 2);
2721
            next if MARC::Field->is_controlfield_tag($tag);
2722
            my $newfield = MARC::Field->new($tag,
2723
                    'z',
2724
                    $authfield->indicator(2) || ' ',
2725
                    '9' => '1');
2726
            foreach my $sub ($authfield->subfields()) {
2727
                my ($code,$val) = @$sub;
2728
                $newfield->add_subfields( $code => $val );
2729
            }
2730
            $newfield->delete_subfield( code => '9' );
2731
            push @newfields, $newfield if (scalar($newfield->subfields()) > 0);
2732
        }
2733
        $record->append_fields(@newfields);
2734
    }
2735
}
2736
2683
=head1 INTERNAL FUNCTIONS
2737
=head1 INTERNAL FUNCTIONS
2684
2738
2685
=head2 _koha_marc_update_bib_ids
2739
=head2 _koha_marc_update_bib_ids
(-)a/Koha/OAI/Server/Repository.pm (-3 / +5 lines)
Lines 171-180 sub get_biblio_marcxml { Link Here
171
    if ( my $conf = $self->{conf} ) {
171
    if ( my $conf = $self->{conf} ) {
172
        $with_items = $conf->{format}->{$format}->{include_items};
172
        $with_items = $conf->{format}->{$format}->{include_items};
173
    }
173
    }
174
    my $embedseefromheadings = C4::Context->preference('OAI-PMH:EmbedSeeFromInBibRecord') || 0;
174
    my $record = GetMarcBiblio({
175
    my $record = GetMarcBiblio({
175
        biblionumber => $biblionumber,
176
        biblionumber            => $biblionumber,
176
        embed_items  => $with_items,
177
        embed_items             => $with_items,
177
        opac         => 1 });
178
        embed_seefromheadings   => $embedseefromheadings,
179
        opac                    => 1 });
178
    $record ? $record->as_xml_record() : undef;
180
    $record ? $record->as_xml_record() : undef;
179
}
181
}
180
182
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 371-376 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
371
('OAI-PMH:AutoUpdateSetEmbedItemData', '0', '', 'Embed item information when automatically updating OAI sets. Requires OAI-PMH:AutoUpdateSets syspref to be enabled', 'YesNo'),
371
('OAI-PMH:AutoUpdateSetEmbedItemData', '0', '', 'Embed item information when automatically updating OAI sets. Requires OAI-PMH:AutoUpdateSets syspref to be enabled', 'YesNo'),
372
('OAI-PMH:ConfFile','',NULL,'If empty, Koha OAI Server operates in normal mode, otherwise it operates in extended mode.','File'),
372
('OAI-PMH:ConfFile','',NULL,'If empty, Koha OAI Server operates in normal mode, otherwise it operates in extended mode.','File'),
373
('OAI-PMH:DeletedRecord','persistent','Koha\'s deletedbiblio table will never be deleted (persistent), might be deleted (transient), or will never have any data in it (no)','transient|persistent|no','Choice'),
373
('OAI-PMH:DeletedRecord','persistent','Koha\'s deletedbiblio table will never be deleted (persistent), might be deleted (transient), or will never have any data in it (no)','transient|persistent|no','Choice'),
374
('OAI-PMH:EmbedSeeFromInBibRecord','0','','Embed see-from headings in bibliographic records exposed through OAI repository.','YesNo'),
374
('OAI-PMH:MaxCount','50',NULL,'OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries','Integer'),
375
('OAI-PMH:MaxCount','50',NULL,'OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries','Integer'),
375
('OPACAcquisitionDetails','0','','Show the acquisition details at the OPAC','YesNo'),
376
('OPACAcquisitionDetails','0','','Show the acquisition details at the OPAC','YesNo'),
376
('OpacAddMastheadLibraryPulldown','0','','Adds a pulldown menu to select the library to search on the opac masthead.','YesNo'),
377
('OpacAddMastheadLibraryPulldown','0','','Adds a pulldown menu to select the library to search on the opac masthead.','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref (-1 / +7 lines)
Lines 80-85 Web services: Link Here
80
                  transient: might be emptied or truncated at some point (transient)
80
                  transient: might be emptied or truncated at some point (transient)
81
                  no: will never have any data in it (no)
81
                  no: will never have any data in it (no)
82
            - "."
82
            - "."
83
        -
84
            - pref: "OAI-PMH:EmbedSeeFromInBibRecord"
85
              default: 0
86
              choices:
87
                  yes: Embed
88
                  no: "Don't embed"
89
            - "Embed <em>see from</em> (non-preferred form) headings in bibliographic records exposed through OAI repository."
83
    ILS-DI:
90
    ILS-DI:
84
        -
91
        -
85
            - pref: ILS-DI
92
            - pref: ILS-DI
86
- 

Return to bug 28639