Bugzilla – Attachment 176629 Details for
Bug 20551
Add option for including deleted records in export_records.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20551: Fetch deleted biblios through _get_record_export
Bug-20551-Fetch-deleted-biblios-through-getrecorde.patch (text/plain), 3.85 KB, created by
Arthur Suzuki
on 2025-01-16 10:42:36 UTC
(
hide
)
Description:
Bug 20551: Fetch deleted biblios through _get_record_export
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2025-01-16 10:42:36 UTC
Size:
3.85 KB
patch
obsolete
>From fb0125351e4b0d48de01e61072be223d5a0f7c0c Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Mon, 4 Apr 2022 15:08:43 +0200 >Subject: [PATCH] Bug 20551: Fetch deleted biblios through _get_record_export > >--- > Koha/Exporter/Record.pm | 27 +++++++++++++++------------ > misc/export_records.pl | 5 ++++- > 2 files changed, 19 insertions(+), 13 deletions(-) > >diff --git a/Koha/Exporter/Record.pm b/Koha/Exporter/Record.pm >index 3177444ce22..ee7ea04f078 100644 >--- a/Koha/Exporter/Record.pm >+++ b/Koha/Exporter/Record.pm >@@ -31,11 +31,13 @@ sub _get_record_for_export { > $record = _get_authority_for_export( { %$params, authid => $record_id } ); > } elsif ( $record_type eq 'bibs' ) { > $record = _get_biblio_for_export( { %$params, biblionumber => $record_id } ); >+ } elsif ( $record_type eq 'deleted_bibs' ) { >+ $record = _get_deleted_biblio_for_export( { %$params, biblionumber => $record_id } ); > } else { >- Koha::Logger->get->warn( "Record_type $record_type not supported." ); >+ Koha::Logger->get->warn( "Record type $record_type not supported." ); > } > if ( !$record ) { >- Koha::Logger->get->warn( "Record $record_id could not be exported." ); >+ Koha::Logger->get->warn( "Record $record_id with record type $record_type could not be exported." ); > return; > } > >@@ -117,8 +119,7 @@ sub _get_deleted_biblio_for_export { > my $biblionumber = $params->{biblionumber}; > # Creating schema is expensive, allow caller to > # pass it so don't have to recreate for each call >- my $resultset = $params->{resultset} || Koha::Database >- ->new() >+ my $resultset = $params->{resultset} || Koha::Database->new() > ->schema() > ->resultset('DeletedbiblioMetadata'); > my $marc_flavour = C4::Context->preference('marcflavour'); >@@ -218,7 +219,7 @@ sub export { > Koha::Logger->get->warn( "No record_type given." ); > return; > } >- return unless (@{$record_ids} || @{$deleted_record_ids} && $format ne 'csv'); >+ return unless @{$record_ids} || @{$deleted_record_ids} && $format ne 'csv'; > > my $fh; > if ( $output_filepath ) { >@@ -238,14 +239,16 @@ sub export { > > my @deleted_records; > if (@{$deleted_record_ids}) { >- my $resultset = Koha::Database >- ->new() >- ->schema() >- ->resultset('DeletedbiblioMetadata'); >+ my $resultset = Koha::Database->new() >+ ->schema() >+ ->resultset('DeletedbiblioMetadata'); >+ > @deleted_records = map { >- my $record = _get_deleted_biblio_for_export({ >- biblionumber => $_, >- resultset => $resultset, >+ my $record = _get_record_for_export({ >+ %{$params}, >+ record_type => 'deleted_bibs', >+ record_id => $_, >+ resultset => $resultset > }); > $record ? $record : (); > } @{$deleted_record_ids}; >diff --git a/misc/export_records.pl b/misc/export_records.pl >index e0097ec1e2b..5364289a693 100755 >--- a/misc/export_records.pl >+++ b/misc/export_records.pl >@@ -108,12 +108,15 @@ $record_type ||= 'bibs'; > $output_format = 'iso2709' if $output_format eq 'marc'; > > if ($include_deleted || $deleted_only) { >- if ($record_type ne 'bibs') { >+ if ($record_type ne 'bibs') { > pod2usage(q|Option "--include_deleted" or "--deleted_only" can only be used with "--record-type=bibs"|); > } > if ($output_format eq 'csv') { > pod2usage(q|Option "--include_deleted" or "--deleted_only" cannot be used with "--format=csv"|); > } >+ if (!$timestamp) { >+ pod2usage(q|Option "--include_deleted" or "--deleted_only" must be combined with "--date"|); >+ } > } > > if ( $output_format eq 'csv' and $record_type eq 'auths' ) { >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20551
:
73916
|
73923
|
75113
|
82843
|
82914
|
82918
|
90184
|
90190
|
90220
|
93619
|
93620
|
93621
|
105403
|
116408
|
116409
|
116410
|
116411
|
123099
|
123101
|
123102
|
125211
|
125212
|
125213
|
125214
|
125215
|
125216
|
128895
|
128896
|
128897
|
128898
|
128899
|
128900
|
132936
|
132937
|
176623
|
176624
|
176625
|
176626
|
176627
|
176628
| 176629 |
176630
|
176631
|
177536