Bugzilla – Attachment 151198 Details for
Bug 33739
ModItemTransfer triggers indexing twice
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33739: Only trigger indexing on last item modification at ModItemTransfer
Bug-33739-Only-trigger-indexing-on-last-item-modif.patch (text/plain), 2.46 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-05-15 15:15:46 UTC
(
hide
)
Description:
Bug 33739: Only trigger indexing on last item modification at ModItemTransfer
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-05-15 15:15:46 UTC
Size:
2.46 KB
patch
obsolete
>From f029314492ff47596b14504a84fd98e0e4ad397d Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 15 May 2023 12:07:09 -0300 >Subject: [PATCH] Bug 33739: Only trigger indexing on last item modification at > ModItemTransfer > >This patch makes ModItemTransfer trigger record indexing only on the >last call (in $transfer->transit). And extra parameter is added to >->transit to effectively honour the ModItemTransfer parameter. > >To test: >1. Run: > $ ktd --shell > k$ prove t/db_dependent/Koha/SearchEngine/Indexer.t >=> FAIL: Indexing is requested twice, should only be once >2. Apply this patch >3. Repeat 1 >=> SUCCESS: Tests pass! Indexing is requested only once! >4. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Items.pm | 4 ++-- > Koha/Item/Transfer.pm | 11 ++++++++--- > 2 files changed, 10 insertions(+), 5 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index ea008f09e24..813d01a045e 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -380,10 +380,10 @@ sub ModItemTransfer { > $item->holdingbranch($frombranch)->store( > { > log_action => 0, >- skip_record_index => $params->{skip_record_index} >+ skip_record_index => 1, # avoid indexing duplication, let ->transit handle it > } > ); >- $transfer->transit; >+ $transfer->transit({ skip_record_index => $params->{skip_record_index} }); > } > > return; >diff --git a/Koha/Item/Transfer.pm b/Koha/Item/Transfer.pm >index 286e0fd276f..74ec297ec93 100644 >--- a/Koha/Item/Transfer.pm >+++ b/Koha/Item/Transfer.pm >@@ -80,14 +80,19 @@ sub to_library { > > =head3 transit > >-Set the transfer as in transit by updating the datesent time. >+ $transfer->transit({ [ skip_record_index => 0|1 ] }); >+ >+Set the transfer as in transit by updating the I<datesent> time. > > Also, update date last seen and ensure item holdingbranch is correctly set. > >+An optional I<skip_record_index> parameter can be passed to avoid triggering >+reindex. >+ > =cut > > sub transit { >- my ($self) = @_; >+ my ($self, $params) = @_; > > # Throw exception if item is still checked out > Koha::Exceptions::Item::Transfer::OnLoan->throw() if ( $self->item->checkout ); >@@ -107,7 +112,7 @@ sub transit { > } > )->store; > >- ModDateLastSeen( $self->item->itemnumber ); >+ ModDateLastSeen( $self->item->itemnumber, undef, { skip_record_index => $params->{skip_record_index} } ); > return $self; > > } >-- >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 33739
:
151198
|
151219
|
151244