From f03cf0c34be444ba5816f77abb8fa8b2b95e3308 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 21 Jun 2013 18:43:59 +0200 Subject: [PATCH] Bug 9788: Followup for expirationdate in Letter.pm Content-Type: text/plain; charset=utf-8 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 --- C4/Letters.pm | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 7125148..cd92910 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 }); -- 1.7.7.6