From 3b3094a983b29114f188b257607c585a83d07b1f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 5 Jul 2024 14:47:42 +0200 Subject: [PATCH] Bug 37247: Fix display of "closed" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The subscription was not shown as closed after we closed it. This is because "closed" is not passed to the template. It seems more reliable to rely on the subscription object (that is passed to both serials/serials-collection.tt and serials/subscription-detail.tt, the others are not showing the Reopen/Close buttons) Also fetch the subscription object after and reopen/close it to display accurate values. Signed-off-by: Chris Cormack Signed-off-by: Martin Renvoize (cherry picked from commit 3cf17aa16f70e978f654345274972b65ca7b6164) Signed-off-by: Frédéric Demians --- .../intranet-tmpl/prog/en/includes/serials-toolbar.inc | 6 +++--- .../prog/en/modules/serials/subscription-detail.tt | 4 ++-- serials/subscription-detail.pl | 7 +++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc index b9465d6e19..ec757fdf9c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc @@ -50,14 +50,14 @@ [% END %] [% IF not cannotedit or CAN_user_serials_receive_serials %] - [% IF CAN_user_serials_renew_subscription and not closed %] + [% IF CAN_user_serials_renew_subscription and not subscription.closed %] [% END %] - [% IF CAN_user_serials_receive_serials and not closed %] + [% IF CAN_user_serials_receive_serials and not subscription.closed %] [% END %] [% UNLESS cannotedit %] - [% IF closed %] + [% IF subscription.closed %] [% ELSE %] 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 c5eaafdf56..38ce2cc818 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 @@ -42,10 +42,10 @@ [% INCLUDE 'serials-toolbar.inc' %] [% INCLUDE 'mana/mana-comment-status.inc' %] -

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

+

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

[% IF ( abouttoexpire ) %] - [% UNLESS closed %] + [% UNLESS subscription.closed %]
Subscription will expire [% enddate | html %]. Renew this subscription.
[% END %] [% END %] diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl index 60c28fd9cc..faa04adea0 100755 --- a/serials/subscription-detail.pl +++ b/serials/subscription-detail.pl @@ -62,8 +62,6 @@ $subs->{enddate} ||= GetExpirationDate($subscriptionid); my ($totalissues,@serialslist) = GetSerials($subscriptionid); $totalissues-- if $totalissues; # the -1 is to have 0 if this is a new subscription (only 1 issue) -my $subscription = Koha::Subscriptions->find( $subscriptionid ); - if ( $op and $op eq "close" ) { C4::Serials::CloseSubscription( $subscriptionid ); } elsif ( $op and $op eq "reopen" ) { @@ -123,12 +121,13 @@ my @irregular_issues = split /;/, $subs->{irregularity}; my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subs->{periodicity}); my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subs->{numberpattern}); -my $subscription_object = Koha::Subscriptions->find( $subscriptionid ); +my $subscription = Koha::Subscriptions->find( $subscriptionid ); + $template->param( available_additional_fields => Koha::AdditionalFields->search( { tablename => 'subscription' } ), additional_field_values => { map { $_->field->name => $_->value } - $subscription_object->additional_field_values->as_list + $subscription->additional_field_values->as_list }, ); -- 2.39.5