Bug 31286: Embed see-from headings into bibliographic records export
In misc/export_records.pl add an option to add see-from headings (from authorities 4xx) into bibliographic records export.
Like it is done during record indexing.
Test plan :
1) Choose a biblio record having a field (for example 650) linked to an authority with a see-form.
2) Export this record without see-from headings :
misc/export_records.pl --starting_biblionumber=X --ending_biblionumber=X --filename /tmp/record_without.xml --format xml
3) Export this record with see-from headings :
misc/export_records.pl --starting_biblionumber=X --ending_biblionumber=X --filename /tmp/record_with.xml --format xml --embed_see_from_headings
4) Compare /tmp/record_without.xml and /tmp/record_with.xml
=> you should see two 650, one with main heading and one with see-from heading
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit fd70ee6a94
)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
529b34cbf6
commit
a0556b5bc7
2 changed files with 14 additions and 0 deletions
|
@ -10,6 +10,7 @@ use C4::Record;
|
||||||
use Koha::Biblios;
|
use Koha::Biblios;
|
||||||
use Koha::CsvProfiles;
|
use Koha::CsvProfiles;
|
||||||
use Koha::Logger;
|
use Koha::Logger;
|
||||||
|
use Koha::RecordProcessor;
|
||||||
use List::Util qw( all any );
|
use List::Util qw( all any );
|
||||||
|
|
||||||
sub _get_record_for_export {
|
sub _get_record_for_export {
|
||||||
|
@ -120,12 +121,18 @@ sub _get_biblio_for_export {
|
||||||
my $itemnumbers = $params->{itemnumbers};
|
my $itemnumbers = $params->{itemnumbers};
|
||||||
my $export_items = $params->{export_items} // 1;
|
my $export_items = $params->{export_items} // 1;
|
||||||
my $only_export_items_for_branches = $params->{only_export_items_for_branches};
|
my $only_export_items_for_branches = $params->{only_export_items_for_branches};
|
||||||
|
my $embed_see_from_headings = $params->{embed_see_from_headings};
|
||||||
|
|
||||||
my $biblio = Koha::Biblios->find($biblionumber);
|
my $biblio = Koha::Biblios->find($biblionumber);
|
||||||
my $record = eval { $biblio->metadata->record };
|
my $record = eval { $biblio->metadata->record };
|
||||||
|
|
||||||
return if $@ or not defined $record;
|
return if $@ or not defined $record;
|
||||||
|
|
||||||
|
if ($embed_see_from_headings) {
|
||||||
|
my $record_processor = Koha::RecordProcessor->new( { filters => 'EmbedSeeFromHeadings' } );
|
||||||
|
$record_processor->process($record);
|
||||||
|
}
|
||||||
|
|
||||||
if ($export_items) {
|
if ($export_items) {
|
||||||
Koha::Biblio::Metadata->record(
|
Koha::Biblio::Metadata->record(
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,6 +54,7 @@ my (
|
||||||
$start_accession,
|
$start_accession,
|
||||||
$end_accession,
|
$end_accession,
|
||||||
$marc_conditions,
|
$marc_conditions,
|
||||||
|
$embed_see_from_headings,
|
||||||
$help
|
$help
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -78,6 +79,7 @@ GetOptions(
|
||||||
'start_accession=s' => \$start_accession,
|
'start_accession=s' => \$start_accession,
|
||||||
'end_accession=s' => \$end_accession,
|
'end_accession=s' => \$end_accession,
|
||||||
'marc_conditions=s' => \$marc_conditions,
|
'marc_conditions=s' => \$marc_conditions,
|
||||||
|
'embed_see_from_headings' => \$embed_see_from_headings,
|
||||||
'h|help|?' => \$help
|
'h|help|?' => \$help
|
||||||
) || pod2usage(1);
|
) || pod2usage(1);
|
||||||
|
|
||||||
|
@ -266,6 +268,7 @@ else {
|
||||||
csv_profile_id => $csv_profile_id,
|
csv_profile_id => $csv_profile_id,
|
||||||
export_items => (not $dont_export_items),
|
export_items => (not $dont_export_items),
|
||||||
clean => $clean || 0,
|
clean => $clean || 0,
|
||||||
|
embed_see_from_headings => $embed_see_from_headings || 0,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -395,6 +398,10 @@ Print a brief help message.
|
||||||
"exists(<marc_target>)" will include marc records where
|
"exists(<marc_target>)" will include marc records where
|
||||||
no <marc_target> exists.
|
no <marc_target> exists.
|
||||||
|
|
||||||
|
=item B<--embed_see_from_headings>
|
||||||
|
|
||||||
|
--embed_see_from_headings Embed see from (non-preferred form) headings in bibliographic record.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head1 AUTHOR
|
=head1 AUTHOR
|
||||||
|
|
Loading…
Reference in a new issue