Bug 27281: (QA follow-up) Fix Indexer Test
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 23 Apr 2021 13:37:28 +0000 (14:37 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 27 Apr 2021 09:19:45 +0000 (11:19 +0200)
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 <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Circulation.pm
t/db_dependent/Koha/SearchEngine/Indexer.t

index 2295d40..3ec9a29 100644 (file)
@@ -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<additem.pl> 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
index 882b5b1..b9ec418 100755 (executable)
@@ -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{