Bugzilla – Attachment 152008 Details for
Bug 21983
Better handling of deleted biblios on ILL requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21983: Make DelBiblio update linked ILL requests
Bug-21983-Make-DelBiblio-update-linked-ILL-request.patch (text/plain), 3.13 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-06-05 17:01:54 UTC
(
hide
)
Description:
Bug 21983: Make DelBiblio update linked ILL requests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-06-05 17:01:54 UTC
Size:
3.13 KB
patch
obsolete
>From 4bda1b5d58ce124b666d8073397455603d03ba9f Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 5 Jun 2023 13:54:40 -0300 >Subject: [PATCH] Bug 21983: Make DelBiblio update linked ILL requests > >This patch makes DelBiblio update the biblio linked ILL requests so the >value in biblio_id is moved to the deleted_biblio_id. > >The change is covered by tests. > >To test: >1. Apply this patchset >2. Run: > $ ktd --shell > k$ updatedatabase > k$ qa --run-tests >=> SUCCESS: Tests pass! All green/good >3. Sign off :-D >--- > C4/Biblio.pm | 2 ++ > t/db_dependent/Biblio.t | 13 ++++++++++++- > 2 files changed, 14 insertions(+), 1 deletion(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index cc88b20871e..879044b0e4d 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -523,6 +523,8 @@ sub DelBiblio { > # We update any existing orders > my $orders = $biblio->orders; > $orders->update({ deleted_biblionumber => $biblionumber}, { no_triggers => 1 }); >+ # Update related ILL requests >+ $biblio->ill_requests->update({ deleted_biblio_id => $biblio->id, biblio_id => undef }); > > unless ( $params->{skip_record_index} ){ > my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index 3d6f96e7591..c176885efe5 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -670,7 +670,7 @@ subtest 'deletedbiblio_metadata' => sub { > > subtest 'DelBiblio' => sub { > >- plan tests => 6; >+ plan tests => 10; > > t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 0 ); > >@@ -716,11 +716,22 @@ subtest 'DelBiblio' => sub { > my $order = $builder->build_object( > { class => 'Koha::Acquisition::Orders', value => $orderinfo } ); > >+ # Add some ILL requests >+ my $ill_req_1 = $builder->build_object({ class => 'Koha::Illrequests', value => { biblio_id => $biblio->id, deleted_biblio_id => undef } }); >+ my $ill_req_2 = $builder->build_object({ class => 'Koha::Illrequests', value => { biblio_id => $biblio->id, deleted_biblio_id => undef } }); >+ > C4::Biblio::DelBiblio($biblio->biblionumber); # Or $biblio->delete > is( $subscription->get_from_storage, undef, 'subscription should be deleted on biblio deletion' ); > is( $serial->get_from_storage, undef, 'serial should be deleted on biblio deletion' ); > is( $subscription_history->get_from_storage, undef, 'subscription history should be deleted on biblio deletion' ); > is( $order->get_from_storage->deleted_biblionumber, $biblio->biblionumber, 'biblionumber of order has been moved to deleted_biblionumber column' ); >+ >+ $ill_req_1 = $ill_req_1->get_from_storage; >+ $ill_req_2 = $ill_req_2->get_from_storage; >+ is( $ill_req_1->biblio_id, undef, 'biblio_id cleared on biblio deletion' ); >+ is( $ill_req_1->deleted_biblio_id, $biblio->id, 'biblio_id is kept on the deleted_biblio_id column' ); >+ is( $ill_req_2->biblio_id, undef, 'biblio_id cleared on biblio deletion' ); >+ is( $ill_req_2->deleted_biblio_id, $biblio->id, 'biblio_id is kept on the deleted_biblio_id column' ); > }; > > subtest 'MarcFieldForCreatorAndModifier' => sub { >-- >2.34.1
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 21983
:
83226
|
83227
|
152005
|
152006
|
152007
|
152008
|
152010
|
152011
|
152012
|
152013
|
152056
|
152057
|
152058
|
152059
|
152060
|
152063