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 83-90 Link Here
83
    [% END %]
99
    [% END %]
84
        will expire before <b>[% date %]</b>
100
        will expire before <b>[% date %]</b>
85
</p>
101
</p>
102
<form id="myform" action="/cgi-bin/koha/serials/subscription-renew.pl" method="post" onsubmit="return checkCheckBoxes();">
103
<input type="hidden" name="op" value="renewall" />
104
<input type="hidden" name="subscriptionid" value="[% subscriptions_loo.subscriptionid %]" />
105
<input type="hidden" name="date" value="[% date %]" />
106
<div id="toolbar"><a href="#" onclick="selectAll(); return false;">Select All</a> |
107
<a href="#" onclick="clearAll(); return false;">Clear All</a></div>
86
<table>
108
<table>
87
        <tr>
109
        <tr>	
110
            <th> </th>
88
            <th>ISSN</th>
111
            <th>ISSN</th>
89
            <th>Title</th>
112
            <th>Title</th>
90
            <th>Note</th>
113
            <th>Note</th>
Lines 97-102 Link Here
97
        [% ELSE %]
120
        [% ELSE %]
98
        <tr>
121
        <tr>
99
        [% END %]
122
        [% END %]
123
            <td> 
124
              <input type="checkbox" class="selection" name="subscriptionid" value="[% subscriptions_loo.subscriptionid %]"/>
125
            </td>
100
            <td>
126
            <td>
101
                [% subscriptions_loo.issn %]
127
                [% subscriptions_loo.issn %]
102
            </td>
128
            </td>
Lines 117-123 Link Here
117
			<td><a href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscriptions_loo.subscriptionid %]" onclick="popup([% subscriptions_loo.subscriptionid %]); return false;">Renew</a></td>
143
			<td><a href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscriptions_loo.subscriptionid %]" onclick="popup([% subscriptions_loo.subscriptionid %]); return false;">Renew</a></td>
118
        </tr>
144
        </tr>
119
    [% END %]
145
    [% END %]
120
    </table>
146
    </table><br />
147
    <input type="submit" value="Renew"/>
148
   </form>
121
[% ELSE %]
149
[% ELSE %]
122
    <p>No results for your query</p>
150
    <p>No results for your query</p>
123
[% END %]
151
[% 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