From 50f366799e843a3aec2192435f1f8c28de75a452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Tue, 10 Nov 2015 13:24:21 +0100 Subject: [PATCH] Bug 14969:(followup) Remove C4::Dates from serials Follow up for comment #15 - 1/ Useless spaces removed (I used them to better align the code for readability - 2/ $tmpPlannedDate removed. I used it for better readibility. - 3/ Initializition of $date to '' removed - 4/ and 5/ Changes removed (they beloged together). --- C4/Serials.pm | 9 ++++----- serials/checkexpiration.pl | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 85bda8b..67385d9 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -467,9 +467,9 @@ sub GetSubscriptionsFromBiblionumber { $sth->execute($biblionumber); my @res; while ( my $subs = $sth->fetchrow_hashref ) { - $subs->{startdate} = output_pref( { dt => dt_from_string( $subs->{startdate}), dateonly => 1 } ); - $subs->{histstartdate} = output_pref( { dt => dt_from_string( $subs->{startdate}), dateonly => 1 } ); - $subs->{histenddate} = output_pref( { dt => dt_from_string( $subs->{startdate}), dateonly => 1 } ); + $subs->{startdate} = output_pref( { dt => dt_from_string( $subs->{startdate}), dateonly => 1 } ); + $subs->{histstartdate} = output_pref( { dt => dt_from_string( $subs->{startdate}), dateonly => 1 } ); + $subs->{histenddate} = output_pref( { dt => dt_from_string( $subs->{startdate}), dateonly => 1 } ); $subs->{opacnote} =~ s/\n/\/g; $subs->{missinglist} =~ s/\n/\/g; $subs->{recievedlist} =~ s/\n/\/g; @@ -1631,8 +1631,7 @@ sub ItemizeSerials { $sth->execute( $data->{'biblionumber'} ); my $biblioitem = $sth->fetchrow_hashref; $biblioitem->{'volumedate'} = $data->{planneddate}; - my $tmpPlannedDate = output_pref( { dt => dt_from_string( $data->{planneddate} ), dateonly => 1 } ); - $biblioitem->{'volumeddesc'} = $data->{serialseq} . ' (' . $tmpPlannedDate. ')'; + $biblioitem->{'volumeddesc'} = $data->{serialseq} . ' (' . output_pref( { dt => dt_from_string( $data->{planneddate} ), dateonly => 1 } ) . ')'; $biblioitem->{'dewey'} = $info->{itemcallnumber}; } } diff --git a/serials/checkexpiration.pl b/serials/checkexpiration.pl index a27490d..2b75cb5 100755 --- a/serials/checkexpiration.pl +++ b/serials/checkexpiration.pl @@ -69,7 +69,7 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user ( my $title = $query->param('title'); my $issn = $query->param('issn'); my $branch = $query->param('branch'); -my $date = ''; +my $date; $date = eval { output_pref( { dt => dt_from_string( $query->param('date') ), dateonly => 1, dateformat => 'iso' }); } if ( $query->param('date') ); @@ -80,12 +80,11 @@ if ($date) { foreach my $subscription ( @subscriptions ) { my $subscriptionid = $subscription->{'subscriptionid'}; my $expirationdate = GetExpirationDate($subscriptionid); - $expirationdate = eval { output_pref( { dt => dt_from_string( $expirationdate ), dateonly => 1, dateformat => 'iso' }); } - if ( $expirationdate ); - - next unless ( $expirationdate ); $subscription->{expirationdate} = $expirationdate; + + next if $expirationdate !~ /\d{4}-\d{2}-\d{2}/; # next if not in ISO format. + next if $subscription->{closed}; if ( !C4::Context->preference("IndependentBranches") or C4::Context->IsSuperLibrarian() -- 1.7.10.4