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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt (-3 / +31 lines)
Lines 25-31 Link Here
25
25
26
     // ]]>
26
     // ]]>
27
</script>
27
</script>
28
<!-- End of additions -->
28
<script type="text/javascript">
29
function selectAll () {
30
    $(".selection").attr("checked", "checked");
31
}
32
function clearAll () {
33
    $(".selection").removeAttr("checked");
34
}
35
function checkCheckBoxes() {
36
    var checkedItems = $(".selection:checked");
37
    if ($(checkedItems).size() == 0) {
38
        alert('Please select atleast one subscription(s) to renew.');
39
        return false;
40
    } else{     
41
   return true;
42
   }
43
}
44
</script>
29
</head>
45
</head>
30
<body id="ser_checkexpiration" class="ser">
46
<body id="ser_checkexpiration" class="ser">
31
[% INCLUDE 'header.inc' %]
47
[% INCLUDE 'header.inc' %]
Lines 74-81 Link Here
74
    [% END %]
90
    [% END %]
75
        will expire before <b>[% date %]</b>
91
        will expire before <b>[% date %]</b>
76
</p>
92
</p>
93
<form id="myform" action="/cgi-bin/koha/serials/subscription-renew.pl" method="post" onsubmit="return checkCheckBoxes();">
94
<input type="hidden" name="op" value="renewall" />
95
<input type="hidden" name="subscriptionid" value="[% subscriptions_loo.subscriptionid %]" />
96
<input type="hidden" name="date" value="[% date %]" />
97
<div id="toolbar"><a href="#" onclick="selectAll(); return false;">Select All</a> |
98
<a href="#" onclick="clearAll(); return false;">Clear All</a></div>
77
<table>
99
<table>
78
        <tr>
100
        <tr>	
101
            <th> </th>
79
            <th>ISSN</th>
102
            <th>ISSN</th>
80
            <th>Title</th>
103
            <th>Title</th>
81
            <th>Note</th>
104
            <th>Note</th>
Lines 88-93 Link Here
88
        [% ELSE %]
111
        [% ELSE %]
89
        <tr>
112
        <tr>
90
        [% END %]
113
        [% END %]
114
            <td> 
115
              <input type="checkbox" class="selection" name="subscriptionid" value="[% subscriptions_loo.subscriptionid %]"/>
116
            </td>
91
            <td>
117
            <td>
92
                [% subscriptions_loo.issn %]
118
                [% subscriptions_loo.issn %]
93
            </td>
119
            </td>
Lines 108-114 Link Here
108
			<td><a href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscriptions_loo.subscriptionid %]" onclick="popup([% subscriptions_loo.subscriptionid %]); return false;">Renew</a></td>
134
			<td><a href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscriptions_loo.subscriptionid %]" onclick="popup([% subscriptions_loo.subscriptionid %]); return false;">Renew</a></td>
109
        </tr>
135
        </tr>
110
    [% END %]
136
    [% END %]
111
    </table>
137
    </table><br />
138
    <input type="submit" value="Renew"/>
139
   </form>
112
[% ELSE %]
140
[% ELSE %]
113
    <p>No results for your query</p>
141
    <p>No results for your query</p>
114
[% END %]
142
[% END %]
(-)a/serials/subscription-renew.pl (-7 / +22 lines)
Lines 61-67 my $dbh = C4::Context->dbh; Link Here
61
61
62
my $mode           = $query->param('mode');
62
my $mode           = $query->param('mode');
63
my $op             = $query->param('op') || q{};
63
my $op             = $query->param('op') || q{};
64
my $subscriptionid = $query->param('subscriptionid');
64
my @subscriptionid = $query->param('subscriptionid');
65
my $date = $query->param('date');
65
my $done = 0;    # for after form has been submitted
66
my $done = 0;    # for after form has been submitted
66
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
67
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
67
    {
68
    {
Lines 75-91 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
75
);
76
);
76
if ( $op eq "renew" ) {
77
if ( $op eq "renew" ) {
77
    ReNewSubscription(
78
    ReNewSubscription(
78
        $subscriptionid,             $loggedinuser,
79
        @subscriptionid,             $loggedinuser,
79
        C4::Dates->new($query->param('startdate'))->output('iso'),  $query->param('numberlength'),
80
        C4::Dates->new($query->param('startdate'))->output('iso'),  $query->param('numberlength'),
80
        $query->param('weeklength'), $query->param('monthlength'),
81
        $query->param('weeklength'), $query->param('monthlength'),
81
        $query->param('note')
82
        $query->param('note')
82
    );
83
    );
83
}
84
}
84
85
85
my $subscription = GetSubscription($subscriptionid);
86
my $subid;
87
if ( $op eq "renewall" ) {
88
    foreach $subid (@subscriptionid){
89
        next unless $subid;
90
        my $data = GetSubscription($subid);
91
        my $length = $data->{numberlength};
92
        my $weeklength = $data->{weeklength};
93
        my $monthlength = $data->{monthlength};
94
        my $note = $data->{note};
95
        my $startdate =  $data->{enddate} || POSIX::strftime( "%Y-%m-%d", localtime );
96
        ReNewSubscription( $subid,$loggedinuser,$startdate,$length,$weeklength, $monthlength, $note);
97
    }
98
    print $query->redirect("/cgi-bin/koha/serials/checkexpiration.pl?date=$date");    
99
}
100
101
my $subscription = GetSubscription(@subscriptionid);
86
if ($subscription->{'cannotedit'}){
102
if ($subscription->{'cannotedit'}){
87
  carp "Attempt to renew subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
103
  carp "Attempt to renew subscription @subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
88
  print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
104
  print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=@subscriptionid");
89
}
105
}
90
106
91
$template->param(
107
$template->param(
Lines 96-102 $template->param( Link Here
96
    numberlength   => $subscription->{numberlength},
112
    numberlength   => $subscription->{numberlength},
97
    weeklength     => $subscription->{weeklength},
113
    weeklength     => $subscription->{weeklength},
98
    monthlength    => $subscription->{monthlength},
114
    monthlength    => $subscription->{monthlength},
99
    subscriptionid => $subscriptionid,
115
    subscriptionid => \@subscriptionid,
100
    bibliotitle    => $subscription->{bibliotitle},
116
    bibliotitle    => $subscription->{bibliotitle},
101
    $op            => 1,
117
    $op            => 1,
102
    popup          => ($query->param('mode')eq "popup"),
118
    popup          => ($query->param('mode')eq "popup"),
103
- 

Return to bug 7910