From 9eb838d4c16f4be811582dcc2e1069e156091784 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 23 Apr 2021 14:37:28 +0100 Subject: [PATCH] Bug 27281: (QA follow-up) Fix Indexer Test With bug 27281 we removed a call to reset an items holdingbranch back to the 'frombranch' of the transfer. This is correct, as with bug 23129 (and friends) we ensure that the holdingbranch was not changed at transfer request time and instead would only be updated at the reciept of transfer. As such, it's safe to remove the update here as it would be just setting the same branch as is already present. However, when removing this ModItem call, I neglected to realise that also remoes the requirement for passing around the defered indexing bit as we no longer need to trigger a re-index as there's not any change to the item. This patch therefore cleans up the POD for LostItem, removes the no longer references 'params' parameter and drops the corresponding index test. Signed-off-by: Martin Renvoize --- C4/Circulation.pm | 13 ++------- t/db_dependent/Koha/SearchEngine/Indexer.t | 31 +--------------------- 2 files changed, 3 insertions(+), 41 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2295d40d23..3ec9a29075 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3815,21 +3815,12 @@ sub ReturnLostItem{ =head2 LostItem - LostItem( $itemnumber, $mark_lost_from, $force_mark_returned, [$params] ); - -The final optional parameter, C<$params>, expected to contain -'skip_record_index' key, which relayed down to Koha::Item/store, -there it prevents calling of ModZebra index_records, -which takes most of the time in batch adds/deletes: index_records better -to be called later in C after the whole loop. - -$params: - skip_record_index => 1|0 + LostItem( $itemnumber, $mark_lost_from, $force_mark_returned ); =cut sub LostItem{ - my ($itemnumber, $mark_lost_from, $force_mark_returned, $params) = @_; + my ($itemnumber, $mark_lost_from, $force_mark_returned) = @_; unless ( $mark_lost_from ) { # Temporary check to avoid regressions diff --git a/t/db_dependent/Koha/SearchEngine/Indexer.t b/t/db_dependent/Koha/SearchEngine/Indexer.t index 3d8454c234..9c4f993638 100755 --- a/t/db_dependent/Koha/SearchEngine/Indexer.t +++ b/t/db_dependent/Koha/SearchEngine/Indexer.t @@ -61,7 +61,7 @@ subtest 'Test indexer object creation' => sub { }; subtest 'Test indexer calls' => sub { - plan tests => 40; + plan tests => 36; my @engines = ('Zebra'); eval { Koha::SearchEngine::Elasticsearch->get_elasticsearch_params; }; @@ -159,35 +159,6 @@ subtest 'Test indexer calls' => sub { AddReturn($item->barcode, $item->homebranch, 0, undef); } [$engine,'C4::Circulation'], "index_records is called once for $engine when calling AddReturn if item not issued"; - $builder->build( - { - source => 'Branchtransfer', - value => { - itemnumber => $item->itemnumber, - datesent => dt_from_string, - datearrived => undef, - datecancelled => undef - } - } - ); - warnings_are{ - LostItem( $item->itemnumber, "tests"); - } [$engine,"Koha::Item"], "index_records is called for $engine when calling LostItem and transfer exists"; - $builder->build( - { - source => 'Branchtransfer', - value => { - itemnumber => $item2->itemnumber, - datesent => dt_from_string, - datearrived => undef, - datecancelled => undef - } - } - ); - warnings_are{ - LostItem( $item->itemnumber, "tests", undef, { skip_record_index => 1 }); - } undef, "index_records is not called for $engine when calling LostItem and transfer exists if skip_record_index"; - $item->datelastseen('2020-02-02'); $item->store({skip_record_index=>1}); warnings_are{ -- 2.20.1