[% END %]
will expire before <b>[% date | $KohaDates %]</b>
</p>
+
+<div class="checkexpiration-table_table_controls">
+ <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> |
+ <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
+ <span class="itemselection_actions">
+ | Actions:
+ <a class="itemselection_action_renew" title="Renew selected subscriptions"><i class="fa fa-refresh"></i> Renew selected subscriptions</a>
+ </span>
+</div>
+
+
<table>
<tr>
+ <th></th>
<th>ISSN</th>
<th>Title</th>
[% IF can_change_library %]<th>Library</th>[% END %]
</tr>
[% FOREACH subscriptions_loo IN subscriptions_loop %]
<tr>
+ <td style="text-align:center;vertical-align:middle">
+ <input type="checkbox" value="[% subscriptions_loo.subscriptionid %]" name="subscriptionid" />
+ </td>
<td>
[% subscriptions_loo.issn %]
</td>
var subscriptionid = $(this).data("subscriptionid");
popup( subscriptionid );
});
+ function itemSelectionBuildRenewLink() {
+ var subscription_ids= new Array();
+ $("input[name='subscriptionid'][type='checkbox']:checked").each(function() {
+ subscription_ids.push($(this).val());
+ });
+ if (subscription_ids.length > 0) {
+ var url = '/cgi-bin/koha/serials/subscription-renew.pl?op=multi_renew';
+ url += '&subscriptionid=' + subscription_ids.join('&subscriptionid=');
+ $('a.itemselection_action_renew').attr('href', url);
+ } else {
+ return false;
+ }
+ return true;
+ }
+
+ function itemSelectionBuildActionLinks() {
+ var export_link_ok = itemSelectionBuildRenewLink();
+ if (export_link_ok) {
+ $('.itemselection_actions').show();
+ } else {
+ $('.itemselection_actions').hide();
+ }
+ }
+
+ itemSelectionBuildActionLinks();
+
+ $("input[name='subscriptionid'][type='checkbox']").change(function() {
+ itemSelectionBuildActionLinks();
+ });
+
+ $(".SelectAll, .ClearAll").on("click",function(e){
+ e.preventDefault();
+ var checkboxes = $(this).parent().siblings('table').first().find('input[type="checkbox"]');
+ checkboxes.prop('checked', $(this).hasClass('SelectAll'));
+ itemSelectionBuildActionLinks();
+ });
+
});
function popup(subscriptionid) {
newin=window.open("subscription-renew.pl?mode=popup&subscriptionid="+subscriptionid,'popup','width=590,height=440,toolbar=false,scrollbars=yes,resize=yes');
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Serials subscription renew #[% subscriptionid %]</title>
+[% IF subscription %]
+<title>Koha › Serials subscription renew #[% subscription.subscriptionid %]</title>
+[% ELSE %]
+<title>Koha › Serials subscription renew</title>
+[% END %]
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="ser_subscription-renew" class="ser">
<div class="container-fluid">
-[% IF ( renew ) %]
+[% IF op == 'renew' %]
Subscription renewed.
<script type="text/javascript">
//<![CDATA[
- opener.document.location.reload();
+ //opener.document.location.reload();
+ window.opener.location.reload(false);
self.close();
//]]>
</script>
<div id="bd">
<form name="f" action="/cgi-bin/koha/serials/subscription-renew.pl" method="post">
<input type="hidden" name="op" value="renew" />
- <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
- <fieldset class="rows"><legend>Subscription renewal for [% bibliotitle %]</legend>
+ <input type="hidden" name="subscriptionid" value="[% subscription.subscriptionid %]" />
+ <fieldset class="rows"><legend>Subscription renewal for [% subscription.bibliotitle %]</legend>
<ol>
<li>
<label for="startdate">Start date: </label>
</li>
<li><fieldset>
<legend>Subscription length:</legend>
- <ol><li><label for="numberlength">Number of num:</label><input type="text" id="numberlength" name="numberlength" value="[% numberlength %]" /></li>
- <li><label for="weeklength">Number of weeks: </label><input type="text" id="weeklength" name="weeklength" value="[% weeklength %]" /></li>
- <li><label for="monthlength">Number of months: </label><input type="text" id="monthlength" name="monthlength" value="[% monthlength %]" /></li></ol></fieldset></li>
+ <ol><li><label for="numberlength">Number of num:</label><input type="text" id="numberlength" name="numberlength" value="[% subscription.numberlength %]" /></li>
+ <li><label for="weeklength">Number of weeks: </label><input type="text" id="weeklength" name="weeklength" value="[% subscription.weeklength %]" /></li>
+ <li><label for="monthlength">Number of months: </label><input type="text" id="monthlength" name="monthlength" value="[% subscription.monthlength %]" /></li></ol></fieldset></li>
<li><label for="note">Note for the librarian that will manage your renewal request: </label>
<textarea name="note" id="note" rows="5" cols="50"></textarea></li></ol></fieldset>
<fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
my $mode = $query->param('mode') || q{};
my $op = $query->param('op') || 'display';
-my $subscriptionid = $query->param('subscriptionid');
+my @subscriptionids = $query->multi_param('subscriptionid');
my $done = 0; # for after form has been submitted
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
}
);
if ( $op eq "renew" ) {
+ # Do not use this script with op=renew and @subscriptionids > 1!
+ my $subscriptionid = $subscriptionids[0];
my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } );
ReNewSubscription(
$subscriptionid, $loggedinuser,
- $startdate, $query->param('numberlength'),
- $query->param('weeklength'), $query->param('monthlength'),
- $query->param('note')
+ $startdate, scalar $query->param('numberlength'),
+ scalar $query->param('weeklength'), scalar $query->param('monthlength'),
+ scalar $query->param('note')
);
-}
+} elsif ( $op eq 'multi_renew' ) {
+ for my $subscriptionid ( @subscriptionids ) {
+ my $subscription = GetSubscription( $subscriptionid );
+ next unless $subscription;
+ ReNewSubscription(
+ $subscriptionid, $loggedinuser,
+ $subscription->{enddate}, $subscription->{numberlength},
+ $subscription->{weeklength}, $subscription->{monthlength},
+ );
+ }
+} else {
+ my $subscriptionid = $subscriptionids[0];
+ my $subscription = GetSubscription($subscriptionid);
+ if ($subscription->{'cannotedit'}){
+ carp "Attempt to renew subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
+ print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
+ }
-my $subscription = GetSubscription($subscriptionid);
-if ($subscription->{'cannotedit'}){
- carp "Attempt to renew subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
- print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
-}
+ my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 } )
+ or output_pref( { dt => dt_from_string, dateonly => 1 } );
-my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 } )
- or output_pref( { dt => dt_from_string, dateonly => 1 } );
+ $template->param(
+ startdate => $newstartdate,
+ subscription => $subscription,
+ );
+}
$template->param(
- startdate => $newstartdate,
- numberlength => $subscription->{numberlength},
- weeklength => $subscription->{weeklength},
- monthlength => $subscription->{monthlength},
- subscriptionid => $subscriptionid,
- bibliotitle => $subscription->{bibliotitle},
- $op => 1,
- popup => ($mode eq 'popup'),
+ op => $op,
);
-# Print the page
output_html_with_http_headers $query, $cookie, $template->output;