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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt (+52 lines)
Lines 61-68 Link Here
61
    [% END %]
61
    [% END %]
62
        will expire before <b>[% date | $KohaDates %]</b>
62
        will expire before <b>[% date | $KohaDates %]</b>
63
</p>
63
</p>
64
65
<div class="checkexpiration-table_table_controls">
66
    <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> |
67
    <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
68
    <span class="itemselection_actions">
69
      | Actions:
70
          <a class="itemselection_action_renew" title="Renew selected subscriptions"><i class="fa fa-refresh"></i> Renew selected subscriptions</a>
71
    </span>
72
</div>
73
74
64
<table>
75
<table>
65
        <tr>
76
        <tr>
77
            <th></th>
66
            <th>ISSN</th>
78
            <th>ISSN</th>
67
            <th>Title</th>
79
            <th>Title</th>
68
            [% IF can_change_library %]<th>Library</th>[% END %]
80
            [% IF can_change_library %]<th>Library</th>[% END %]
Lines 73-78 Link Here
73
        </tr>
85
        </tr>
74
    [% FOREACH subscriptions_loo IN subscriptions_loop %]
86
    [% FOREACH subscriptions_loo IN subscriptions_loop %]
75
        <tr>
87
        <tr>
88
            <td style="text-align:center;vertical-align:middle">
89
                <input type="checkbox" value="[% subscriptions_loo.subscriptionid %]" name="subscriptionid" />
90
            </td>
76
            <td>
91
            <td>
77
                [% subscriptions_loo.issn %]
92
                [% subscriptions_loo.issn %]
78
            </td>
93
            </td>
Lines 123-128 Link Here
123
                var subscriptionid = $(this).data("subscriptionid");
138
                var subscriptionid = $(this).data("subscriptionid");
124
                popup( subscriptionid );
139
                popup( subscriptionid );
125
            });
140
            });
141
            function itemSelectionBuildRenewLink() {
142
                var subscription_ids= new Array();
143
                $("input[name='subscriptionid'][type='checkbox']:checked").each(function() {
144
                    subscription_ids.push($(this).val());
145
                });
146
                if (subscription_ids.length > 0) {
147
                    var url = '/cgi-bin/koha/serials/subscription-renew.pl?op=multi_renew';
148
                    url += '&subscriptionid=' + subscription_ids.join('&subscriptionid=');
149
                    $('a.itemselection_action_renew').attr('href', url);
150
                } else {
151
                    return false;
152
                }
153
                return true;
154
            }
155
156
            function itemSelectionBuildActionLinks() {
157
                var export_link_ok = itemSelectionBuildRenewLink();
158
                if (export_link_ok) {
159
                    $('.itemselection_actions').show();
160
                } else {
161
                    $('.itemselection_actions').hide();
162
                }
163
            }
164
165
            itemSelectionBuildActionLinks();
166
167
            $("input[name='subscriptionid'][type='checkbox']").change(function() {
168
                itemSelectionBuildActionLinks();
169
            });
170
171
            $(".SelectAll, .ClearAll").on("click",function(e){
172
                e.preventDefault();
173
                var checkboxes = $(this).parent().siblings('table').first().find('input[type="checkbox"]');
174
                checkboxes.prop('checked', $(this).hasClass('SelectAll'));
175
                itemSelectionBuildActionLinks();
176
            });
177
126
        });
178
        });
127
        function popup(subscriptionid) {
179
        function popup(subscriptionid) {
128
           newin=window.open("subscription-renew.pl?mode=popup&subscriptionid="+subscriptionid,'popup','width=590,height=440,toolbar=false,scrollbars=yes,resize=yes');
180
           newin=window.open("subscription-renew.pl?mode=popup&subscriptionid="+subscriptionid,'popup','width=590,height=440,toolbar=false,scrollbars=yes,resize=yes');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt (-8 / +13 lines)
Lines 1-18 Link Here
1
[% SET footerjs = 1 %]
1
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Serials subscription renew #[% subscriptionid %]</title>
3
[% IF subscription %]
4
<title>Koha &rsaquo; Serials subscription renew #[% subscription.subscriptionid %]</title>
5
[% ELSE %]
6
<title>Koha &rsaquo; Serials subscription renew</title>
7
[% END %]
4
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'doc-head-close.inc' %]
5
</head>
9
</head>
6
10
7
<body id="ser_subscription-renew" class="ser">
11
<body id="ser_subscription-renew" class="ser">
8
    <div class="container-fluid">
12
    <div class="container-fluid">
9
13
10
[% IF ( renew ) %]
14
[% IF op == 'renew' %]
11
  Subscription renewed.
15
  Subscription renewed.
12
  
16
  
13
<script type="text/javascript">
17
<script type="text/javascript">
14
//<![CDATA[
18
//<![CDATA[
15
  opener.document.location.reload();
19
  //opener.document.location.reload();
20
  window.opener.location.reload(false);
16
  self.close();
21
  self.close();
17
  //]]>
22
  //]]>
18
</script>
23
</script>
Lines 20-27 Link Here
20
      <div id="bd">
25
      <div id="bd">
21
<form name="f" action="/cgi-bin/koha/serials/subscription-renew.pl" method="post">
26
<form name="f" action="/cgi-bin/koha/serials/subscription-renew.pl" method="post">
22
		<input type="hidden" name="op" value="renew" />
27
		<input type="hidden" name="op" value="renew" />
23
		<input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
28
		<input type="hidden" name="subscriptionid" value="[% subscription.subscriptionid %]" />
24
		<fieldset class="rows"><legend>Subscription renewal for [% bibliotitle %]</legend>
29
		<fieldset class="rows"><legend>Subscription renewal for [% subscription.bibliotitle %]</legend>
25
        <ol>
30
        <ol>
26
            <li>
31
            <li>
27
                <label for="startdate">Start date: </label>
32
                <label for="startdate">Start date: </label>
Lines 30-38 Link Here
30
            </li>
35
            </li>
31
		<li><fieldset>
36
		<li><fieldset>
32
		<legend>Subscription length:</legend>
37
		<legend>Subscription length:</legend>
33
		<ol><li><label for="numberlength">Number of num:</label><input type="text" id="numberlength" name="numberlength" value="[% numberlength %]" /></li>
38
		<ol><li><label for="numberlength">Number of num:</label><input type="text" id="numberlength" name="numberlength" value="[% subscription.numberlength %]" /></li>
34
		<li><label for="weeklength">Number of weeks: </label><input type="text" id="weeklength" name="weeklength" value="[% weeklength %]" /></li>
39
		<li><label for="weeklength">Number of weeks: </label><input type="text" id="weeklength" name="weeklength" value="[% subscription.weeklength %]" /></li>
35
		<li><label for="monthlength">Number of months: </label><input type="text" id="monthlength" name="monthlength" value="[% monthlength %]" /></li></ol></fieldset></li>
40
		<li><label for="monthlength">Number of months: </label><input type="text" id="monthlength" name="monthlength" value="[% subscription.monthlength %]" /></li></ol></fieldset></li>
36
		<li><label for="note">Note for the librarian that will manage your renewal request: </label>
41
		<li><label for="note">Note for the librarian that will manage your renewal request: </label>
37
		<textarea name="note" id="note" rows="5" cols="50"></textarea></li></ol></fieldset>
42
		<textarea name="note" id="note" rows="5" cols="50"></textarea></li></ol></fieldset>
38
		<fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
43
		<fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset>
(-)a/serials/subscription-renew.pl (-22 / +31 lines)
Lines 60-66 my $dbh = C4::Context->dbh; Link Here
60
60
61
my $mode           = $query->param('mode') || q{};
61
my $mode           = $query->param('mode') || q{};
62
my $op             = $query->param('op') || 'display';
62
my $op             = $query->param('op') || 'display';
63
my $subscriptionid = $query->param('subscriptionid');
63
my @subscriptionids = $query->multi_param('subscriptionid');
64
my $done = 0;    # for after form has been submitted
64
my $done = 0;    # for after form has been submitted
65
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
65
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
66
    {
66
    {
Lines 73-106 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
73
    }
73
    }
74
);
74
);
75
if ( $op eq "renew" ) {
75
if ( $op eq "renew" ) {
76
    # Do not use this script with op=renew and @subscriptionids > 1!
77
    my $subscriptionid = $subscriptionids[0];
76
    my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } );
78
    my $startdate = output_pref( { str => scalar $query->param('startdate'), dateonly => 1, dateformat => 'iso' } );
77
    ReNewSubscription(
79
    ReNewSubscription(
78
        $subscriptionid, $loggedinuser,
80
        $subscriptionid, $loggedinuser,
79
        $startdate, $query->param('numberlength'),
81
        $startdate, scalar $query->param('numberlength'),
80
        $query->param('weeklength'), $query->param('monthlength'),
82
        scalar $query->param('weeklength'), scalar $query->param('monthlength'),
81
        $query->param('note')
83
        scalar $query->param('note')
82
    );
84
    );
83
}
85
} elsif ( $op eq 'multi_renew' ) {
86
    for my $subscriptionid ( @subscriptionids ) {
87
        my $subscription = GetSubscription( $subscriptionid );
88
        next unless $subscription;
89
        ReNewSubscription(
90
            $subscriptionid, $loggedinuser,
91
            $subscription->{enddate}, $subscription->{numberlength},
92
            $subscription->{weeklength}, $subscription->{monthlength},
93
        );
94
    }
95
} else {
96
    my $subscriptionid = $subscriptionids[0];
97
    my $subscription = GetSubscription($subscriptionid);
98
    if ($subscription->{'cannotedit'}){
99
      carp "Attempt to renew subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
100
      print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
101
    }
84
102
85
my $subscription = GetSubscription($subscriptionid);
103
    my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 } )
86
if ($subscription->{'cannotedit'}){
104
        or output_pref( { dt => dt_from_string, dateonly => 1 } );
87
  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");
89
}
90
105
91
my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 } )
106
    $template->param(
92
    or output_pref( { dt => dt_from_string, dateonly => 1 } );
107
        startdate      => $newstartdate,
108
        subscription   => $subscription,
109
    );
110
}
93
111
94
$template->param(
112
$template->param(
95
    startdate      => $newstartdate,
113
    op => $op,
96
    numberlength   => $subscription->{numberlength},
97
    weeklength     => $subscription->{weeklength},
98
    monthlength    => $subscription->{monthlength},
99
    subscriptionid => $subscriptionid,
100
    bibliotitle    => $subscription->{bibliotitle},
101
    $op            => 1,
102
    popup          => ($mode eq 'popup'),
103
);
114
);
104
115
105
# Print the page
106
output_html_with_http_headers $query, $cookie, $template->output;
116
output_html_with_http_headers $query, $cookie, $template->output;
107
- 

Return to bug 7910