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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-filters.inc (+29 lines)
Line 0 Link Here
1
[% IF letters %]
2
    [% IF ( missingissues && supplierid ) %]
3
        [% PROCESS select_vendor context => "sidebar" %]
4
    [% END %]
5
[% END %]
6
7
[% IF ( missingissues ) %]
8
    <form action="claims.pl" id="filter_claims_form">
9
        <fieldset class="brief">
10
            <h4>Filter missing issues</h4>
11
            <legend class="sr-only">Filter missing issues</legend>
12
            <ol>
13
                <li>
14
                    <label for="from">From:</label>
15
                    <input type="text" name="begindate" id="from" value="[% begindate | html %]" size="10" maxlength="10" class="flatpickr" data-date_to="to" />
16
                </li>
17
                <li>
18
                    <label for="to">To:</label>
19
                    <input type="text" name="enddate" id="to" value="[% enddate | html %]" size="10" maxlength="10" class="flatpickr" />
20
                    <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
21
                </li>
22
            </ol>
23
        </fieldset>
24
        <fieldset class="action">
25
            <input id="filterByDate" class="btn btn-primary" type="button" value="OK" />
26
            <input type="reset" class="btn btn-default" value="Clear" id="clearfilter" />
27
        </fieldset>
28
    </form>
29
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-menu.inc (+1 lines)
Lines 1-4 Link Here
1
<div id="serials-menu" class="sidebar_menu">
1
<div id="serials-menu" class="sidebar_menu">
2
    [% INCLUDE "serials-filters.inc" %]
2
    <h5>Serials</h5>
3
    <h5>Serials</h5>
3
    <ul>
4
    <ul>
4
        [% IF ( subscriptionid ) %]
5
        [% IF ( subscriptionid ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt (-81 / +113 lines)
Lines 67-72 Link Here
67
                <div class="alert alert-warning">No missing issues found.</div>
67
                <div class="alert alert-warning">No missing issues found.</div>
68
            [% ELSE %]
68
            [% ELSE %]
69
                <div class="alert alert-info">Please choose a vendor.</div>
69
                <div class="alert alert-info">Please choose a vendor.</div>
70
                [% PROCESS select_vendor context => "main" %]
70
            [% END %]
71
            [% END %]
71
        [% END %]
72
        [% END %]
72
    [% END %]
73
    [% END %]
Lines 79-123 Link Here
79
        <div class="alert alert-warning"> No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>. </div>
80
        <div class="alert alert-warning"> No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>. </div>
80
    [% END %]
81
    [% END %]
81
82
82
    <form id="claims" name="claims" action="claims.pl" method="get">
83
        <fieldset>
84
            <label for="supplierid">Vendor: </label>
85
            <select id="supplierid" name="supplierid">
86
                [% FOREACH suploo IN suploop %]
87
                    <option value="[% suploo.id | html %]" [% IF suploo.selected %]selected="selected"[% END %]> [% suploo.name | html %] ([% suploo.count | html %]) </option>
88
                [% END %]
89
            </select>
90
            <input type="submit" class="btn btn-primary" value="OK" />
91
        </fieldset>
92
    </form>
93
    <!-- /#claims -->
94
95
    [% IF ( missingissues ) %]
83
    [% IF ( missingissues ) %]
96
        <h3>Missing issues</h3>
84
        <h3>Missing issues</h3>
97
        <form method="get" action="claims.pl" id="filter_claims_form">
98
            <fieldset class="rows">
99
                <legend>Filters:</legend>
100
                <ol>
101
                    <li>
102
                        <label for="from">From:</label>
103
                        <input type="text" name="begindate" id="from" value="[% begindate | html %]" size="10" maxlength="10" class="flatpickr" data-date_to="to" />
104
                        <label for="to" style="float:none;">To:</label>
105
                        <input type="text" name="enddate" id="to" value="[% enddate | html %]" size="10" maxlength="10" class="flatpickr" />
106
                        <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
107
                        <input id="filterByDate" type="button" value="OK" />
108
                        <a href="#" id="clearfilter"><i class="fa fa-times"></i> Clear filter</a>
109
                    </li>
110
                </ol>
111
            </fieldset>
112
        </form>
113
85
114
        <fieldset>
86
        <form action="claims.pl" method="post" id="claims_form">
115
            <form action="claims.pl" method="post" id="claims_form">
87
            <div class="page-section">
116
                [% INCLUDE 'csrf-token.inc' %]
88
                [% INCLUDE 'csrf-token.inc' %]
117
                <table id="claimst">
89
                <table id="claimst">
118
                    <thead>
90
                    <thead>
119
                        <tr>
91
                        <tr>
120
                            <th><input type="checkbox" id="CheckAll" /></th>
92
                            <th class="NoSort"><input type="checkbox" id="CheckAll" /></th>
121
                            <th>Vendor</th>
93
                            <th>Vendor</th>
122
                            <th>Library</th>
94
                            <th>Library</th>
123
                            <th class="anti-the">Title</th>
95
                            <th class="anti-the">Title</th>
Lines 138-144 Link Here
138
                            <tr>
110
                            <tr>
139
                                <td>
111
                                <td>
140
                                    [% UNLESS missingissue.cannot_claim %]
112
                                    [% UNLESS missingissue.cannot_claim %]
141
                                        <input type="checkbox" name="serialid" value="[% missingissue.serialid | html %]" />
113
                                        <input type="checkbox" class="select_serial" name="serialid" value="[% missingissue.serialid | html %]" />
142
                                    [% END %]
114
                                    [% END %]
143
                                </td>
115
                                </td>
144
                                <td>[% missingissue.name | html %]</td>
116
                                <td>[% missingissue.name | html %]</td>
Lines 179-243 Link Here
179
                    </tfoot>
151
                    </tfoot>
180
                </table>
152
                </table>
181
                <!-- /#claimst -->
153
                <!-- /#claimst -->
154
            </div>
155
            <!-- /.page-section -->
182
156
157
            <hr />
158
159
            <div class="row">
183
                [% IF csv_profiles.count %]
160
                [% IF csv_profiles.count %]
184
                    <fieldset class="action">
161
                    <div class="col">
185
                        <label for="csv_code">Select CSV profile:</label>
162
                        <fieldset class="serial_batch_op" disabled="disabled">
186
                        <select id="csv_profile_for_export">
163
                            <fieldset class="brief">
187
                            [% FOR csv IN csv_profiles %]
164
                                <legend>Download selected claims</legend>
188
                                <option value="[% csv.export_format_id | html %]">[% csv.profile | html %]</option>
165
                                <label for="csv_profile_for_export">Select CSV profile:</label>
189
                            [% END %]
166
                                <select id="csv_profile_for_export">
190
                        </select>
167
                                    [% FOR csv IN csv_profiles %]
191
                        <span class="exportSelected"><a id="ExportSelected" href="/cgi-bin/koha/serials/claims.pl">Download selected claims</a></span>
168
                                        <option value="[% csv.export_format_id | html %]">[% csv.profile | html %]</option>
192
                    </fieldset>
169
                                    [% END %]
170
                                </select>
171
                                <fieldset class="action">
172
                                    <button class="btn btn-primary" id="ExportSelected" type="button">Download selected claims</button>
173
                                </fieldset>
174
                            </fieldset>
175
                        </fieldset>
176
                    </div>
193
                [% END %]
177
                [% END %]
194
178
195
                [% IF letters %]
179
                [% IF letters %]
196
                    <fieldset class="action">
180
                    <div class="col">
197
                        <label for="letter_code">Select notice:</label>
181
                        <fieldset class="serial_batch_op" disabled="disabled">
198
                        <select name="letter_code" id="letter_code">
182
                            <fieldset class="brief">
199
                            [% FOREACH letter IN letters %]
183
                                <legend>Send claim notification</legend>
200
                                <option value="[% letter.code | html %]">[% letter.name | html %]</option>
184
                                <label for="letter_code">Select notice:</label>
201
                            [% END %]
185
                                <select name="letter_code" id="letter_code">
202
                        </select>
186
                                    [% FOREACH letter IN letters %]
203
                        <input type="hidden" name="op" value="cud-send_alert" />
187
                                        <option value="[% letter.code | html %]">[% letter.name | html %]</option>
204
                        <input type="hidden" name="supplierid" value="[% supplierid | html %]" />
188
                                    [% END %]
205
                        <input type="submit" name="submit" class="btn btn-primary" value="Send notification" />
189
                                </select>
206
                    </fieldset>
190
                                <fieldset class="action">
191
                                    <input type="hidden" name="op" value="cud-send_alert" />
192
                                    <input type="hidden" name="supplierid" value="[% supplierid | html %]" />
193
                                    <input type="submit" name="submit" class="btn btn-primary" value="Send notification" />
194
                                </fieldset>
195
                            </fieldset>
196
                        </fieldset>
197
                    </div>
207
                [% END %]
198
                [% END %]
208
            </form>
199
            </div>
209
            <!-- /#claims_form -->
200
        </form>
210
        </fieldset>
201
        <!-- /#claims_form -->
211
    [% END # /missingissues %]
202
    [% END # /missingissues %]
212
[% END %]
203
[% END %]
213
204
205
[% BLOCK select_vendor %]
206
    <form class="select_vendor" name="claims" action="claims.pl" method="get">
207
        [% IF ( context == "main") %]
208
            [% SET form_class = "rows" %]
209
        [% ELSE %]
210
            [% SET form_class = "brief" %]
211
        [% END %]
212
        <fieldset class="[% form_class | html %]">
213
            <h4>Choose vendor</h4>
214
            <label class="sr-only" for="supplierid">Choose vendor: </label>
215
            <select id="supplierid" name="supplierid">
216
                [% FOREACH suploo IN suploop %]
217
                    [% IF ( suploo.selected ) %]
218
                        <option value="[% suploo.id | html %]" selected="selected"> [% suploo.name | html %] ([% suploo.count | html %]) </option>
219
                    [% ELSE %]
220
                        <option value="[% suploo.id | html %]"> [% suploo.name | html %] ([% suploo.count | html %]) </option>
221
                    [% END %]
222
                [% END %]
223
            </select>
224
        </fieldset>
225
        <fieldset class="action">
226
            <input type="submit" class="btn btn-primary" value="OK" />
227
        </fieldset>
228
    </form>
229
    <!-- /#claims -->
230
[% END %]
231
214
[% MACRO jsinclude BLOCK %]
232
[% MACRO jsinclude BLOCK %]
215
    [% INCLUDE 'calendar.inc' %]
233
    [% INCLUDE 'calendar.inc' %]
216
    [% INCLUDE 'datatables.inc' %]
234
    [% INCLUDE 'datatables.inc' %]
217
    <script>
235
    <script>
218
        var sTable;
236
        var sTable;
219
        $(document).ready(function () {
237
        $(document).ready(function() {
238
            enableSelectedActions();
220
            sTable = $("#claimst").kohaTable({
239
            sTable = $("#claimst").kohaTable({
221
                dom: "t",
240
                "dom": 't',
222
                columnDefs: [
241
                "order": [[ 7, "asc" ]],
223
                    { targets: [0], orderable: false, searchable: false },
242
                "columnDefs": [
224
                    { type: "anti-the", targets: ["anti-the"] },
243
                    { 'sortable': false, 'targets': [ 'NoSort' ] },
244
                    { "type": "anti-the", "targets":  [ 'anti-the'] }
225
                ],
245
                ],
226
                paginate: false,
246
                "paging": false
227
            });
247
            }));
228
            $("#supplierid").change(function () {
229
                $("#claims").submit();
230
            });
231
248
232
            // Checkboxes : Select All / None
249
            // Checkboxes : Select All / None
233
            $("span.checkall").html('<input type="checkbox" name="CheckAll"> ' + _("Check all") + "</input>");
250
            $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check all")+"</input>");
234
251
235
            $("#CheckAll").click(function () {
252
            $("#CheckAll").click(function() {
236
                $("#claimst tr:visible :checkbox").prop("checked", $("#CheckAll").is(":checked"));
253
                $("#claimst tr:visible :checkbox").prop('checked', $("#CheckAll").is(':checked'));
254
                enableSelectedActions();
237
            });
255
            });
238
256
239
            // Generates a dynamic link for exporting the selections data as CSV
257
            // Generates a dynamic link for exporting the selections data as CSV
240
            $("#ExportSelected").click(function () {
258
            $("#ExportSelected").click(function() {
241
                // We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error.
259
                // We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error.
242
                var selected = $("input[name=serialid]:checked");
260
                var selected = $("input[name=serialid]:checked");
243
261
Lines 247-279 Link Here
247
                }
265
                }
248
266
249
                // Building the url from currently checked boxes
267
                // Building the url from currently checked boxes
250
                var url = "/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&amp;op=claims";
268
                var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&amp;op=claims';
251
                for (var i = 0; i < selected.length; i++) {
269
                for (var i = 0; i < selected.length; i++) {
252
                    url += "&amp;serialid=" + selected[i].value;
270
                    url += '&amp;serialid=' + selected[i].value;
253
                }
271
                }
254
                url += "&amp;csv_profile=" + $("#csv_profile_for_export option:selected").val();
272
                url += '&amp;csv_profile=' + $("#csv_profile_for_export option:selected").val();
255
                // And redirecting to the CSV page
273
                // And redirecting to the CSV page
256
                location.href = url;
274
                location.href = url;
257
                return false;
275
                return false;
258
            });
276
            });
259
            $("#filterByDate").on("click", function (e) {
277
            $("#filterByDate").on("click",function(e){
260
                e.preventDefault();
278
                e.preventDefault();
261
                filterByDate();
279
                filterByDate();
262
            });
280
            });
263
            $("#clearfilter").on("click", function (e) {
281
            $("#clearfilter").on("click",function(e){
264
                e.preventDefault();
282
                e.preventDefault();
265
                $("#from").flatpickr().clear();
283
                $("#from").flatpickr().clear();
266
                $("#to").flatpickr().clear();
284
                $("#to").flatpickr().clear();
267
                $("table#claimst tbody tr").show();
285
                $("table#claimst tbody tr").show();
268
            });
286
            });
269
            $("#claims_form").on("submit", function () {
287
            $("#claims_form").on("submit",function(){
270
                return checkForm();
288
                return checkForm();
271
            });
289
            });
272
            $("#filter_claims_form").on("submit", function () {
290
            $("#filter_claims_form").on("submit",function(){
273
                return false;
291
                return false;
274
            });
292
            });
293
294
            $(".select_serial").on("change", function(){
295
                enableSelectedActions();
296
            });
275
        });
297
        });
276
298
299
        function enableSelectedActions() {
300
            var checkedBoxes = $(".select_serial:checked");
301
            if ( checkedBoxes.length ) {
302
                $(".serial_batch_op").prop( "disabled", false );
303
            } else {
304
                $(".serial_batch_op").prop( "disabled", true );
305
            }
306
        }
307
277
        // Checks if the form can be sent (at least one checkbox must be checked)
308
        // Checks if the form can be sent (at least one checkbox must be checked)
278
        function checkForm() {
309
        function checkForm() {
279
            if ($("input:checked").length == 0) {
310
            if ($("input:checked").length == 0) {
Lines 285-291 Link Here
285
        // Filter by date
316
        // Filter by date
286
        function filterByDate() {
317
        function filterByDate() {
287
            var beginDate = new Date($("#from").val()).getTime();
318
            var beginDate = new Date($("#from").val()).getTime();
288
            var endDate = new Date($("#to").val()).getTime();
319
            var endDate   = new Date($("#to").val()).getTime();
289
320
290
            // Checks if the beginning date is valid
321
            // Checks if the beginning date is valid
291
            if (!parseInt(beginDate)) {
322
            if (!parseInt(beginDate)) {
Lines 311-322 Link Here
311
            $("table#claimst tbody tr").hide();
342
            $("table#claimst tbody tr").hide();
312
343
313
            // For each date in the table
344
            // For each date in the table
314
            $(".planneddate").each(function () {
345
            $(".planneddate").each(function() {
346
315
                // We make a JS Date Object, according to the locale
347
                // We make a JS Date Object, according to the locale
316
                var pdate = Date_from_syspref($(this).text()).getTime();
348
                var pdate = Date_from_syspref($(this).text()).getTime();
317
349
318
                // And checks if the date is between the beginning and ending dates
350
                // And checks if the date is between the beginning and ending dates
319
                if (pdate > beginDate && pdate < endDate) {
351
                if (pdate > beginDate &&
352
                    pdate < endDate) {
320
                    // If so, we can show the row
353
                    // If so, we can show the row
321
                    $(this).parent().show();
354
                    $(this).parent().show();
322
                }
355
                }
323
- 

Return to bug 37094