Bug 31437: (bug 30718 follow-up) Prevent useless indexation call from ModDateLastSeen

Koha::Object->store is triggering an UPDATE because the datelastseen is
different than the value in DB (comparing a datetime with a date)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2022-10-14 11:04:40 +02:00 committed by Tomas Cohen Arazi
parent 1b7db7e369
commit 6d9c1403fb
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -400,7 +400,7 @@ sub ModDateLastSeen {
my ( $itemnumber, $leave_item_lost, $params ) = @_;
my $item = Koha::Items->find($itemnumber);
$item->datelastseen(dt_from_string);
$item->datelastseen(dt_from_string->ymd);
my $log = $item->itemlost && !$leave_item_lost ? 1 : 0; # If item was lost, record the change to the item
$item->itemlost(0) unless $leave_item_lost;
$item->store({ log_action => $log, skip_record_index => $params->{skip_record_index}, skip_holds_queue => $params->{skip_holds_queue} });