From a1ff2fb562c0136eaed141832b208fd5d8831897 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 21 Jun 2013 18:43:59 +0200 Subject: [PATCH] Bug 9788: (follow-up) for expirationdate in Letter.pm Pasting comment from the Bugzilla report: Looking bit longer at this code, it is kind of strange to find it there in the first place. Adding maxpickupdelay in Letters.pm should not be there, but it is.. Also this date is not used normally in the default HOLD Available for Pickup notice (that we are generating in this case). And if it would be undef, the expiration date should imo be empty instead of today+0. (before adding maxreservespickupdelay, you should test the allowexpire pref first) So it is an (invisible) bug on its own. Test plan: See former patch. Kyle just discovered this bug, apparently by deleting the maxpickupdelay pref.. Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton (cherry picked from commit a23d4181b1e756a61a036059b8b909d4f0d30537) Signed-off-by: Fridolin Somers --- C4/Letters.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 712514896e..cd9291024e 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -612,9 +612,13 @@ sub _parseletter { if ( $table eq 'reserves' && $values->{'waitingdate'} ) { my @waitingdate = split /-/, $values->{'waitingdate'}; - my $dt = dt_from_string(); - $dt->add( days => C4::Context->preference('ReservesMaxPickUpDelay') || 0); - $values->{'expirationdate'} = output_pref({ dt => $dt, dateonly => 1 }); + $values->{'expirationdate'} = ''; + if( C4::Context->preference('ExpireReservesMaxPickUpDelay') && + C4::Context->preference('ReservesMaxPickUpDelay') ) { + my $dt = dt_from_string(); + $dt->add( days => C4::Context->preference('ReservesMaxPickUpDelay') ); + $values->{'expirationdate'} = output_pref({ dt => $dt, dateonly => 1 }); + } $values->{'waitingdate'} = output_pref({ dt => dt_from_string( $values->{'waitingdate'} ), dateonly => 1 }); -- 2.39.5