From ce66f186409246400ee88fb012fd839368fc2f43 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 16 Dec 2020 14:42:03 +0100 Subject: [PATCH] Bug 8694: Show accurate subscription renewal warning for expired subscriptions If a subscription is going to expired we should not phrase the warning "Subscription will expire [ date in the past ]." Test plan: Create a subscription with relevant expiration date. The detail page of the subscription show correctly the warning about the expiration date. --- .../prog/en/modules/serials/subscription-detail.tt | 6 ++++-- serials/subscription-detail.pl | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt index cdb5a2f895..deb65a1470 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt @@ -33,8 +33,10 @@

Subscription for [% bibliotitle | html %] [% IF closed %](closed)[% END %]

- [% IF ( abouttoexpire ) %] - [% UNLESS closed %] + [% IF abouttoexpire AND NOT closed %] + [% IF has_expired_already %] +
Subscription expired on [% enddate | html %]. Renew this subscription.
+ [% ELSE %]
Subscription will expire [% enddate | html %]. Renew this subscription.
[% END %] [% END %] diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl index ac4abcef18..0855848b20 100755 --- a/serials/subscription-detail.pl +++ b/serials/subscription-detail.pl @@ -120,6 +120,7 @@ for my $date ( qw(startdate enddate firstacquidate histstartdate histenddate) ) my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $subs->{location} }); $subs->{location} = $av->count ? $av->next->lib : ''; $subs->{abouttoexpire} = abouttoexpire($subs->{subscriptionid}); +$subs->{has_expired_already} = dt_from_string($subs->{enddate})->compare(dt_from_string); $template->param(%{ $subs }); $template->param(biblionumber_for_new_subscription => $subs->{bibnum}); my @irregular_issues = split /;/, $subs->{irregularity}; -- 2.20.1