From 3270e535f645bfba4a0f0ddf27a9ca41be27718c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 20 Jan 2020 15:51:39 +0000 Subject: [PATCH] Bug 25767: Add Koha::Item::Transfer->receipt method Signed-off-by: Kathleen Milne Signed-off-by: Katrin Fischer --- Koha/Item/Transfer.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Koha/Item/Transfer.pm b/Koha/Item/Transfer.pm index 669559d15b..80ba0458ba 100644 --- a/Koha/Item/Transfer.pm +++ b/Koha/Item/Transfer.pm @@ -84,6 +84,25 @@ sub transit { return $self; } +=head3 receipt + +Receive the transfer by setting the datearrived time. + +=cut + +sub receipt { + my ($self) = @_; + + # Throw exception if item is checked out + Koha::Exceptions::Item::Transfer::Out->throw() if ($self->item->checkout); + + # Update the receipt state + $self->set({ datearrived => dt_from_string })->store; + + ModDateLastSeen( $self->item->itemnumber ); + return $self; +} + =head3 type =cut -- 2.20.1