From 3433f922e7c2983332098535bbf544dd8fe84f28 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.. --- C4/Letters.pm | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 0349efe..6b9e5cc 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -610,9 +610,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') ); - $values->{'expirationdate'} = output_pref( $dt, undef, 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, undef, 1 ); + } $values->{'waitingdate'} = output_pref( dt_from_string( $values->{'waitingdate'} ), undef, 1 ); -- 1.7.7.6