From 70b808f5e192e833a9760079d8e2cb86e4346a86 Mon Sep 17 00:00:00 2001 From: Andrew Nugged Date: Wed, 14 Dec 2022 17:03:58 +0200 Subject: [PATCH] Bug 32563: HOTFIX: reservedate becomes expirationdate in some cases To reproduce: 1. Go to /cgi-bin/koha/admin/preferences.pl?op=search&searchfield=DefaultHoldExpirationdate 2. Setup default expiration date to be 1 year from reserve date for example. 3. Switch to catalog to any biblio with item for example /cgi-bin/koha/catalogue/detail.pl?biblionumber=1 and place a hold for any borrower. 4. Check holds for this item, as by example /cgi-bin/koha/reserve/request.pl?biblionumber=1 5. Observe the field "Date" contains the same date as the "Expiration" which is wrong and both contains date 1 year in the future. "Date" should have a date the reservation made, i.e. now. 6. Apply the patch. 7. Make another hold, i.e. repeat steps 3-5 8. Observe the field "Date" contains correct date (today) but the "Expiration" date is 1 year in the future as set is step 2. Signed-off-by: Amaury GAU --- Koha/Hold.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Hold.pm b/Koha/Hold.pm index a5a9d03003..8e314d25b9 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -896,7 +896,7 @@ sub _set_default_expirationdate { C4::Context->preference('DefaultHoldExpirationdateUnitOfTime') || 'days'; $self->expirationdate( - dt_from_string( $self->reservedate )->add( $timeunit => $period ) ); + dt_from_string( $self->reservedate->clone )->add( $timeunit => $period ) ); } =head3 _move_to_old -- 2.30.2