Bugzilla – Attachment 151244 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.74 KB, created by
Jonathan Druart
on 2023-05-16 06:47:04 UTC
(
hide
)
Description:
Bug 33739: Only trigger indexing on last item modification at ModItemTransfer
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-05-16 06:47:04 UTC
Size:
2.74 KB
patch
obsolete
>From de5078c54676a5cd619359c15b79afc4cd941a6b 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. > >I wanted to mention that bug 31212 highlighted an existing issue, not >catched by the current tests before its inclussion, because of the DT truncation >taking place. > >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> >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > 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.25.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