Bug 37247: [23.05.x] Fix display of "closed"

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 <chris@bigballofwax.co.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
This commit is contained in:
Jonathan Druart 2024-07-05 14:47:42 +02:00 committed by wainuiwitikapark
parent b402e82121
commit 84faba1f19
3 changed files with 5 additions and 7 deletions

View File

@ -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 %]
<div class="btn-group"><a id="renew" class="btn btn-default" href="#"><i class="fa fa-refresh"></i> Renew</a></div>
[% END %]
[% IF CAN_user_serials_receive_serials and not closed %]
[% IF CAN_user_serials_receive_serials and not subscription.closed %]
<div class="btn-group"><a id="receive" class="btn btn-default" href="/cgi-bin/koha/serials/serials-edit.pl?subscriptionid=[% subscriptionid | html %]&amp;serstatus=1,3"><i class="fa fa-inbox"></i> Receive</a></div>
[% END %]
[% UNLESS cannotedit %]
[% IF closed %]
[% IF subscription.closed %]
<div class="btn-group"><a id="reopen" class="btn btn-default" href="#"><i class="fa fa-repeat"></i> Reopen</a></div>
[% ELSE %]
<div class="btn-group"><a id="close" class="btn btn-default" href="#"><i class="fa fa-times-circle"></i> Close</a></div>

View File

@ -42,10 +42,10 @@
[% INCLUDE 'serials-toolbar.inc' %]
[% INCLUDE 'mana/mana-comment-status.inc' %]
<h1>Subscription for [% bibliotitle | html %] [% bibliosubtitle | html %] [% IF closed %](closed)[% END %]</h1>
<h1>Subscription for [% bibliotitle | html %] [% bibliosubtitle | html %] [% IF subscription.closed %](closed)[% END %]</h1>
[% IF ( abouttoexpire ) %]
[% UNLESS closed %]
[% UNLESS subscription.closed %]
<div class="dialog message">Subscription will expire [% enddate | html %]. <a href="#" id="renewsub">Renew this subscription</a>.</div>
[% END %]
[% END %]

View File

@ -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" ) {