From 19cd8b6f433dd8028483a4b17117da2d898a17cd Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 11 Oct 2021 10:39:11 +0100 Subject: [PATCH] Bug 29202: Trigger replacementpricedate on replacementprice change --- Koha/Item.pm | 3 ++- acqui/finishreceive.pl | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 08e527df10..1ae6d45d8c 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -137,11 +137,12 @@ sub store { exists $updated_columns{itemlost} or exists $updated_columns{withdrawn} or exists $updated_columns{damaged} + or exists $updated_columns{replacementprice} ) ? $self->get_from_storage : undef; # Update *_on fields if needed # FIXME: Why not for AddItem as well? - my @fields = qw( itemlost withdrawn damaged ); + my @fields = qw( itemlost withdrawn damaged replacementprice ); for my $field (@fields) { # If the field is defined but empty or 0, we are diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 93391e8fad..4d3e02ae84 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -174,14 +174,15 @@ if ($quantityrec > $origquantityrec ) { my $new_order_object = Koha::Acquisition::Orders->find( $new_ordernumber ); # FIXME we should not need to refetch it my $items = $new_order_object->items; while ( my $item = $items->next ) { - $item->update({ - booksellerid => $booksellerid, - dateaccessioned => $datereceived, - datelastseen => $datereceived, - price => $unitprice, - replacementprice => $replacementprice, - replacementpricedate => $datereceived, - }); + $item->update( + { + booksellerid => $booksellerid, + dateaccessioned => $datereceived, + datelastseen => $datereceived, + price => $unitprice, + replacementprice => $replacementprice, + } + ); } if ($suggestion_id) { -- 2.20.1