Bugzilla – Attachment 176630 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: Refactor unmotivated partially applied validator function
Bug-20551-Refactor-unmotivated-partially-applied-v.patch (text/plain), 2.73 KB, created by
Arthur Suzuki
on 2025-01-16 10:42:40 UTC
(
hide
)
Description:
Bug 20551: Refactor unmotivated partially applied validator function
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2025-01-16 10:42:40 UTC
Size:
2.73 KB
patch
obsolete
>From 292a2b03cc13abb806712a27057713057c890898 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Mon, 4 Apr 2022 15:25:02 +0200 >Subject: [PATCH] Bug 20551: Refactor unmotivated partially applied validator > function > >--- > Koha/Exporter/Record.pm | 29 ++++++++++++----------------- > 1 file changed, 12 insertions(+), 17 deletions(-) > >diff --git a/Koha/Exporter/Record.pm b/Koha/Exporter/Record.pm >index ee7ea04f078..bd5d4ea58ae 100644 >--- a/Koha/Exporter/Record.pm >+++ b/Koha/Exporter/Record.pm >@@ -255,28 +255,23 @@ sub export { > } > if ( $format eq 'iso2709' ) { > my $encoding_validator = sub { >- my ($record_type) = @_; >- return sub { >- my ($record) = @_; >- my $errorcount_on_decode = eval { scalar(MARC::File::USMARC->decode($record->as_usmarc)->warnings()) }; >- if ($errorcount_on_decode || $@) { >- my ($id_tag, $id_subfield) = GetMarcFromKohaField('biblio.biblionumber', ''); >- my $record_id = $record->subfield($id_tag, $id_subfield); >- my $msg = "$record_type $record_id could not be USMARC decoded/encoded. " . ($@ // ''); >- chomp $msg; >- Koha::Logger->get->warn($msg); >- return 0; >- } >- return 1; >+ my ($record, $record_type) = @_; >+ my $errorcount_on_decode = eval { scalar(MARC::File::USMARC->decode($record->as_usmarc)->warnings()) }; >+ if ($errorcount_on_decode || $@) { >+ my ($id_tag, $id_subfield) = GetMarcFromKohaField('biblio.biblionumber', ''); >+ my $record_id = $record->subfield($id_tag, $id_subfield); >+ my $msg = "$record_type $record_id could not be USMARC decoded/encoded. " . ($@ // ''); >+ chomp $msg; >+ Koha::Logger->get->warn($msg); >+ return 0; > } >+ return 1; > }; >- my $validator = $encoding_validator->('Record'); >- for my $record (grep { $validator->($_) } @records) { >+ for my $record (grep { $encoding_validator->($_, 'Record') } @records) { > print $record->as_usmarc(); > } > if (@deleted_records) { >- $validator = $encoding_validator->('Deleted record'); >- for my $deleted_record (grep { $validator->($_) } @deleted_records) { >+ for my $deleted_record (grep { $encoding_validator->($_, 'Deleted record') } @deleted_records) { > print $deleted_record->as_usmarc(); > } > } >-- >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