diff --git a/C4/Items.pm b/C4/Items.pm index ea008f09e2..813d01a045 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 286e0fd276..74ec297ec9 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 time. Also, update date last seen and ensure item holdingbranch is correctly set. +An optional I 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; }