Bug 37247: 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>
This commit is contained in:
parent
51157a763b
commit
f8ed88e98e
|
|
@ -49,14 +49,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-solid fa-rotate"></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 %]&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-solid fa-arrow-rotate-right"></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>
|
||||
|
|
|
|||
|
|
@ -44,10 +44,10 @@
|
|||
[% INCLUDE 'serials-toolbar.inc' %]
|
||||
[% INCLUDE 'mana/mana-comment-status.inc' %]
|
||||
|
||||
<h1>Subscription for [% INCLUDE 'biblio-title.inc' biblio=subscription.biblio link = 0 %] [% IF closed %](closed)[% END %]</h1>
|
||||
<h1>Subscription for [% INCLUDE 'biblio-title.inc' biblio=subscription.biblio link = 0 %] [% 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 %]
|
||||
|
|
|
|||
|
|
@ -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,6 +121,8 @@ my @irregular_issues = split /;/, $subs->{irregularity};
|
|||
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subs->{periodicity});
|
||||
my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subs->{numberpattern});
|
||||
|
||||
my $subscription = Koha::Subscriptions->find( $subscriptionid );
|
||||
|
||||
$template->param(
|
||||
available_additional_fields => Koha::AdditionalFields->search( { tablename => 'subscription' } ),
|
||||
additional_field_values => { map { $_->field->name => $_->value } $subscription->additional_field_values->as_list },
|
||||
|
|
|
|||
Loading…
Reference in New Issue