Bugzilla – Attachment 160484 Details for
Bug 29440
Refactor/clean up bulkmarcimport.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29440: Only log items has been inserted if actually have been so, and remove extra out of place logging of record insertion
Bug-29440-Only-log-items-has-been-inserted-if-actu.patch (text/plain), 3.14 KB, created by
Martin Renvoize (ashimema)
on 2024-01-03 16:25:26 UTC
(
hide
)
Description:
Bug 29440: Only log items has been inserted if actually have been so, and remove extra out of place logging of record insertion
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-01-03 16:25:26 UTC
Size:
3.14 KB
patch
obsolete
>From 5b7a99f4e5ab4a696d88896ae8cab4e5ac222c82 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Mon, 26 Sep 2022 16:55:36 +0200 >Subject: [PATCH] Bug 29440: Only log items has been inserted if actually have > been so, and remove extra out of place logging of record insertion >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Signed-off-by: MichaĆ Kula <148193449+mkibp@users.noreply.github.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > misc/migration_tools/bulkmarcimport.pl | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > >diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl >index aaa61cd6210..417b6b27c6f 100755 >--- a/misc/migration_tools/bulkmarcimport.pl >+++ b/misc/migration_tools/bulkmarcimport.pl >@@ -578,9 +578,6 @@ RECORD: foreach my $record (@{$marc_records}) { > # the MARC columns in biblioitems were not set. > next RECORD; > } >- else { >- printlog({ id => $record_id, op => "insert items", status => "ok" }) if ($logfile); >- } > if ($dedup_barcode && grep { exists $_->{error_code} && $_->{error_code} eq 'duplicate_barcode' } @$errors_ref) { > # Find the record called 'barcode' > my ($tag, $sub) = C4::Biblio::GetMarcFromKohaField('items.barcode'); >@@ -611,8 +608,8 @@ RECORD: foreach my $record (@{$marc_records}) { > } > # Now re-add the record as before, adding errors to the prev list > my $more_errors; >- eval { ($itemnumbers_ref, $more_errors) = AddItemBatchFromMarc($record, $record_id, $biblioitemnumber, ''); }; >- $record_has_added_items ||= @{$itemnumbers_ref}; >+ eval { ($itemnumbers_ref, $more_errors) = >+ AddItemBatchFromMarc($record, $record_id, $biblioitemnumber, ''); }; > if ($@) { > warn "ERROR: Adding items to bib $record_id failed: $@\n"; > printlog({ id => $record_id, op => "insert items", status => "ERROR" }) if ($logfile); >@@ -624,11 +621,16 @@ RECORD: foreach my $record (@{$marc_records}) { > ModBiblioMarc($record, $record_id, $mod_biblio_options); > next RECORD; > } >- else { >- printlog({ id => $record_id, op => "insert", status => "ok" }) if ($logfile); >+ $record_has_added_items ||= @{$itemnumbers_ref}; >+ if (@{$more_errors}) { >+ push @$errors_ref, @{$more_errors}; > } >- push @$errors_ref, @{$more_errors}; > } >+ >+ if ($record_has_added_items) { >+ printlog({ id => $record_id, op => "insert items", status => "ok" }) if ($logfile); >+ } >+ > if (@{$errors_ref}) { > report_item_errors($record_id, $errors_ref); > } >-- >2.43.0
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 29440
:
127479
|
127480
|
127481
|
127485
|
127486
|
127508
|
127509
|
127651
|
127652
|
127791
|
127792
|
127795
|
127796
|
127959
|
127960
|
127961
|
127963
|
128086
|
128087
|
128362
|
128890
|
128891
|
131176
|
131177
|
131180
|
131181
|
132942
|
140822
|
140823
|
140903
|
140904
|
140905
|
140906
|
140924
|
140925
|
140926
|
140927
|
140928
|
140987
|
140988
|
140989
|
143375
|
151293
|
151294
|
151295
|
151296
|
151297
|
151298
|
151299
|
151300
|
151301
|
157798
|
160148
|
160149
|
160150
|
160151
|
160152
|
160153
|
160154
|
160155
|
160156
|
160157
|
160477
|
160478
|
160479
|
160480
|
160481
|
160482
|
160483
| 160484 |
160485
|
160486
|
160487