Bugzilla – Attachment 158085 Details for
Bug 35115
ERM - Potential MARC data loss when importing titles from list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35115 [Alternative]: Skip Resource store logic if resource was imported from list
Bug-35115-Alternative-Skip-Resource-store-logic-if.patch (text/plain), 2.67 KB, created by
Pedro Amorim
on 2023-10-30 16:32:57 UTC
(
hide
)
Description:
Bug 35115 [Alternative]: Skip Resource store logic if resource was imported from list
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-10-30 16:32:57 UTC
Size:
2.67 KB
patch
obsolete
>From 65a9fed4f458484850070dc063fca466c5429b07 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Mon, 30 Oct 2023 15:26:22 -0100 >Subject: [PATCH] Bug 35115 [Alternative]: Skip Resource store logic if > resource was imported from list > >This patch fixes the data loss issue when importing titles from a list >of biblios. It does NOT fix the data loss issue when saving a title that >is linked to a biblio, that will still caused data loss on the biblio. > >I believe store in Resource.pm is trying to do a couple things: >1) Updating Biblio when a title is saved, or >2) Adding a biblio when a title is created > >The problem is that it's updating the biblio when the title is created >from an import list, as if new changes were made to the title and need >to be reflected to the biblio. >This is not the case, a title created from an imported list of biblios >should have no business updating their respective biblio's MARC at that time. > >---- > >The biblio MARC being updated when the title is saved through the edit form >should perhaps be a different bug. Should all possible fields be updated on the biblio when saving the >title? >--- > Koha/BackgroundJob/CreateEHoldingsFromBiblios.pm | 3 ++- > Koha/ERM/EHoldings/Resource.pm | 7 ++++++- > 2 files changed, 8 insertions(+), 2 deletions(-) > >diff --git a/Koha/BackgroundJob/CreateEHoldingsFromBiblios.pm b/Koha/BackgroundJob/CreateEHoldingsFromBiblios.pm >index 9638c7fcd3..3090fe2764 100644 >--- a/Koha/BackgroundJob/CreateEHoldingsFromBiblios.pm >+++ b/Koha/BackgroundJob/CreateEHoldingsFromBiblios.pm >@@ -245,7 +245,8 @@ sub process { > : _get_marc21_mapping($biblio); > > $eholding_title = Koha::ERM::EHoldings::Title->new($eholding_title)->store; >- Koha::ERM::EHoldings::Resource->new({ title_id => $eholding_title->title_id, package_id => $package_id })->store; >+ Koha::ERM::EHoldings::Resource->new( { title_id => $eholding_title->title_id, package_id => $package_id } ) >+ ->store( { imported_from_list => 1 } ); > $report->{total_success}++; > } catch { > push @messages, { >diff --git a/Koha/ERM/EHoldings/Resource.pm b/Koha/ERM/EHoldings/Resource.pm >index 2457b2d644..56eefe725b 100644 >--- a/Koha/ERM/EHoldings/Resource.pm >+++ b/Koha/ERM/EHoldings/Resource.pm >@@ -44,7 +44,12 @@ Koha::ERM::EHoldings::Resource - Koha EHolding resource Object class > =cut > > sub store { >- my ($self) = @_; >+ my ($self, $params) = @_; >+ >+ if ( $params->{imported_from_list} ){ >+ $self = $self->SUPER::store; >+ return $self; >+ } > > # FIXME This is terrible and ugly, we need to: > # * Provide a mapping for each attribute of title >-- >2.30.2
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 35115
:
157507
|
158085
|
158672
|
158748
|
158806
|
158807
|
159254
|
159255