View | Details | Raw Unified | Return to bug 37247
Collapse All | Expand All

(-)a/serials/subscription-detail.pl (-13 / +10 lines)
Lines 34-50 use Carp qw( carp ); Link Here
34
use Koha::SharedContent;
34
use Koha::SharedContent;
35
35
36
my $query = CGI->new;
36
my $query = CGI->new;
37
my $op = $query->param('op') || q{};
37
38
my $op             = $query->param('op') || q{};
38
my $issueconfirmed = $query->param('issueconfirmed');
39
my $issueconfirmed = $query->param('issueconfirmed');
39
my $dbh            = C4::Context->dbh;
40
my $subscriptionid = $query->param('subscriptionid');
40
my $subscriptionid = $query->param('subscriptionid');
41
my $subscription = Koha::Subscriptions->find( $subscriptionid );
42
43
if ( $op and $op eq "cud-close" ) {
44
    C4::Serials::CloseSubscription( $subscriptionid );
45
} elsif ( $op and $op eq "cud-reopen" ) {
46
    C4::Serials::ReopenSubscription( $subscriptionid );
47
}
48
41
49
# the subscription must be deletable if there is NO issues for a reason or another (should not happened, but...)
42
# the subscription must be deletable if there is NO issues for a reason or another (should not happened, but...)
50
43
Lines 69-75 $subs->{enddate} ||= GetExpirationDate($subscriptionid); Link Here
69
my ($totalissues,@serialslist) = GetSerials($subscriptionid);
62
my ($totalissues,@serialslist) = GetSerials($subscriptionid);
70
$totalissues-- if $totalissues; # the -1 is to have 0 if this is a new subscription (only 1 issue)
63
$totalissues-- if $totalissues; # the -1 is to have 0 if this is a new subscription (only 1 issue)
71
64
72
if ($op eq 'cud-del') {
65
my $subscription = Koha::Subscriptions->find( $subscriptionid );
66
67
if ( $op eq "cud-close" ) {
68
    C4::Serials::CloseSubscription( $subscriptionid );
69
} elsif ( $op eq "cud-reopen" ) {
70
    C4::Serials::ReopenSubscription( $subscriptionid );
71
} elsif ( $op eq "cud-del" ) {
73
    if ($$subs{'cannotedit'}){
72
    if ($$subs{'cannotedit'}){
74
        carp "Attempt to delete subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
73
        carp "Attempt to delete subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
75
        print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
74
        print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
Lines 94-101 if ($op eq 'cud-del') { Link Here
94
        print $query->redirect("/cgi-bin/koha/serials/serials-home.pl");
93
        print $query->redirect("/cgi-bin/koha/serials/serials-home.pl");
95
        exit;
94
        exit;
96
    }
95
    }
97
}
96
} elsif ( $op eq "share" ) {
98
elsif ( $op and $op eq "share" ) {
99
    my $mana_language = $query->param('mana_language');
97
    my $mana_language = $query->param('mana_language');
100
    my $result = Koha::SharedContent::send_entity($mana_language, $loggedinuser, $subscriptionid, 'subscription');
98
    my $result = Koha::SharedContent::send_entity($mana_language, $loggedinuser, $subscriptionid, 'subscription');
101
    $template->param( mana_code => $result->{msg} );
99
    $template->param( mana_code => $result->{msg} );
102
- 

Return to bug 37247