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

(-)a/serials/subscription-detail.pl (-12 / +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
41
42
if ( $op and $op eq "close" ) {
43
    C4::Serials::CloseSubscription( $subscriptionid );
44
} elsif ( $op and $op eq "reopen" ) {
45
    C4::Serials::ReopenSubscription( $subscriptionid );
46
}
47
48
# 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...)
49
43
50
# Permission needed if it is a deletion (del) : delete_subscription
44
# Permission needed if it is a deletion (del) : delete_subscription
Lines 68-74 $subs->{enddate} ||= GetExpirationDate($subscriptionid); Link Here
68
my ($totalissues,@serialslist) = GetSerials($subscriptionid);
62
my ($totalissues,@serialslist) = GetSerials($subscriptionid);
69
$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)
70
64
71
if ($op eq 'del') {
65
my $subscription = Koha::Subscriptions->find( $subscriptionid );
66
67
if ( $op and $op eq "close" ) {
68
    C4::Serials::CloseSubscription( $subscriptionid );
69
} elsif ( $op and $op eq "reopen" ) {
70
    C4::Serials::ReopenSubscription( $subscriptionid );
71
} elsif ($op eq 'del') {
72
    if ($$subs{'cannotedit'}){
72
    if ($$subs{'cannotedit'}){
73
        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";
74
        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 93-100 if ($op eq 'del') { Link Here
93
        print $query->redirect("/cgi-bin/koha/serials/serials-home.pl");
93
        print $query->redirect("/cgi-bin/koha/serials/serials-home.pl");
94
        exit;
94
        exit;
95
    }
95
    }
96
}
96
} elsif ( $op eq "share" ) {
97
elsif ( $op and $op eq "share" ) {
98
    my $mana_language = $query->param('mana_language');
97
    my $mana_language = $query->param('mana_language');
99
    my $result = Koha::SharedContent::send_entity($mana_language, $loggedinuser, $subscriptionid, 'subscription');
98
    my $result = Koha::SharedContent::send_entity($mana_language, $loggedinuser, $subscriptionid, 'subscription');
100
    $template->param( mana_code => $result->{msg} );
99
    $template->param( mana_code => $result->{msg} );
101
- 

Return to bug 37247