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

(-)a/admin/columns_settings.yml (+61 lines)
Lines 231-236 modules: Link Here
231
          columnname: export
231
          columnname: export
232
          cannot_be_toggled: 1
232
          cannot_be_toggled: 1
233
          cannot_be_modified: 1
233
          cannot_be_modified: 1
234
      relatives-issues-table:
235
        -
236
          columnname: due_date_unformatted
237
          cannot_be_toggled: 1
238
          cannot_be_modified: 1
239
          is_hidden: 1
240
        -
241
          columnname: due_date
242
        -
243
          columnname: title
244
        -
245
          columnname: item_type
246
        -
247
          columnname: location
248
        -
249
          columnname: checkout_on
250
        -
251
          columnname: checkout_from
252
        -
253
          columnname: callno
254
        -
255
          columnname: charge
256
        -
257
          columnname: fine
258
        -
259
          columnname: price
260
        -
261
          columnname: patron
234
262
235
  reports:
263
  reports:
236
    lostitems:
264
    lostitems:
Lines 273-278 modules: Link Here
273
          cannot_be_modified: 1
301
          cannot_be_modified: 1
274
          is_hidden: 1
302
          is_hidden: 1
275
        -
303
        -
304
          columnname: group_order
305
          cannot_be_toggled: 1
306
          cannot_be_modified: 1
307
          is_hidden: 1
308
        -
276
          columnname: todays_or_previous_checkouts
309
          columnname: todays_or_previous_checkouts
277
          cannot_be_toggled: 1
310
          cannot_be_toggled: 1
278
          cannot_be_modified: 1
311
          cannot_be_modified: 1
Lines 314-316 modules: Link Here
314
          columnname: export
347
          columnname: export
315
          cannot_be_toggled: 1
348
          cannot_be_toggled: 1
316
          cannot_be_modified: 1
349
          cannot_be_modified: 1
350
      relatives-issues-table:
351
        -
352
          columnname: due_date_unformatted
353
          cannot_be_toggled: 1
354
          cannot_be_modified: 1
355
          is_hidden: 1
356
        -
357
          columnname: due_date
358
        -
359
          columnname: title
360
        -
361
          columnname: item_type
362
        -
363
          columnname: location
364
        -
365
          columnname: checkout_on
366
        -
367
          columnname: checkout_from
368
        -
369
          columnname: callno
370
        -
371
          columnname: charge
372
        -
373
          columnname: fine
374
        -
375
          columnname: price
376
        -
377
          columnname: patron
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc (-1 / +1 lines)
Lines 1-6 Link Here
1
<tfoot>
1
<tfoot>
2
	<tr>
2
	<tr>
3
        <td colspan="10" style="text-align: right; font-weight:bold;">Totals:</td>
3
        <td colspan="11" style="text-align: right; font-weight:bold;">Totals:</td>
4
        <td id="totaldue">[% totaldue %]</td>
4
        <td id="totaldue">[% totaldue %]</td>
5
        <td id="totalfine">[% finetotal %]</td>
5
        <td id="totalfine">[% finetotal %]</td>
6
        <td id="totalprice">[% totalprice %]</td>
6
        <td id="totalprice">[% totalprice %]</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc (+1 lines)
Lines 11-16 Link Here
11
                    <tr>
11
                    <tr>
12
                        <th scope="col">&nbsp;</th>
12
                        <th scope="col">&nbsp;</th>
13
                        <th scope="col">&nbsp;</th>
13
                        <th scope="col">&nbsp;</th>
14
                        <th scope="col">&nbsp;</th>
14
                        <th scope="col">Due date</th>
15
                        <th scope="col">Due date</th>
15
                        <th scope="col">Due date</th>
16
                        <th scope="col">Due date</th>
16
                        <th scope="col">Title</th>
17
                        <th scope="col">Title</th>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/datatables-strings.inc (+1 lines)
Lines 6-11 Link Here
6
    var MSG_DT_PREVIOUS = _("Previous");
6
    var MSG_DT_PREVIOUS = _("Previous");
7
    var MSG_DT_EMPTY_TABLE = _("No data available in table");
7
    var MSG_DT_EMPTY_TABLE = _("No data available in table");
8
    var MSG_DT_INFO = _("Showing _START_ to _END_ of _TOTAL_");
8
    var MSG_DT_INFO = _("Showing _START_ to _END_ of _TOTAL_");
9
    var MSG_DT_INFO_SIMPLE = _("Entries shown: _TOTAL_");
9
    var MSG_DT_INFO_EMPTY = _("No entries to show");
10
    var MSG_DT_INFO_EMPTY = _("No entries to show");
10
    var MSG_DT_INFO_FILTERED = _("(filtered from _MAX_ total entries)");
11
    var MSG_DT_INFO_FILTERED = _("(filtered from _MAX_ total entries)");
11
    var MSG_DT_LENGTH_MENU = _("Show _MENU_ entries");
12
    var MSG_DT_LENGTH_MENU = _("Show _MENU_ entries");
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc (-19 / +1 lines)
Lines 1-22 Link Here
1
[% INCLUDE 'format_price.inc' %]
1
[% INCLUDE 'format_price.inc' %]
2
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
2
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
3
<script type="text/javascript">
3
[% INCLUDE 'datatables-strings.inc' %]
4
//<![CDATA[
5
    var MSG_DT_FIRST = _("First");
6
    var MSG_DT_LAST = _("Last");
7
    var MSG_DT_NEXT = _("Next");
8
    var MSG_DT_PREVIOUS = _("Previous");
9
    var MSG_DT_EMPTY_TABLE = _("No data available in table");
10
    var MSG_DT_INFO = _("Showing _START_ to _END_ of _TOTAL_");
11
    var MSG_DT_INFO_EMPTY = _("No entries to show");
12
    var MSG_DT_INFO_FILTERED = _("(filtered from _MAX_ total entries)");
13
    var MSG_DT_LENGTH_MENU = _("Show _MENU_ entries");
14
    var MSG_DT_LOADING_RECORDS = _("Loading...");
15
    var MSG_DT_PROCESSING = _("Processing...");
16
    var MSG_DT_SEARCH = _("Search:");
17
    var MSG_DT_ZERO_RECORDS = _("No matching records found");
18
    var MSG_DT_ALL = _("All");
19
    var CONFIG_EXCLUDE_ARTICLES_FROM_SORT = _("a an the");
20
//]]>
21
</script>
22
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
4
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc (+1 lines)
Lines 30-34 Link Here
30
    var NO = _("No");
30
    var NO = _("No");
31
    var YES = _("Yes");
31
    var YES = _("Yes");
32
    var INHOUSE_USE = _("On-site checkout");
32
    var INHOUSE_USE = _("On-site checkout");
33
    var GROUP_TODAYS_CHECKOUTS = _("Group today's checkouts");
33
//]]>
34
//]]>
34
</script>
35
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js (-332 / +330 lines)
Lines 1-3 Link Here
1
(function($) {
2
3
var ymd = $.datepicker.formatDate('yy-mm-dd', new Date());
4
5
function enableGrouping(datatable) {
6
    datatable.rowGrouping({
7
        iGroupingColumnIndex: 2,
8
        iGroupingOrderByColumnIndex: 1,
9
        sGroupingColumnSortDirection: "asc"
10
    });
11
}
12
13
function disableGrouping(datatable) {
14
    var oSettings = datatable.fnSettings();
15
    for (f = 0; f < oSettings.aoDrawCallback.length; f++) {
16
        if (oSettings.aoDrawCallback[f].sName == 'fnRowGrouping') {
17
            oSettings.aoDrawCallback.splice(f, 1);
18
            datatable.fnDraw();
19
            break;
20
        }
21
    }
22
}
23
24
function loadTableData(datatable, borrowernumbers, offset, count) {
25
    offset = offset ? offset : 0;
26
    count = count ? count : 100;
27
28
    var args = {
29
        "borrowernumber": borrowernumbers,
30
        "offset": offset,
31
        "count": count
32
    };
33
34
    $.ajax({
35
        dataType: "json",
36
        traditional: true,
37
        url: '/cgi-bin/koha/svc/checkouts',
38
        data: args,
39
        success: function(data) {
40
            if (data.length) {
41
                datatable.fnAddData(data);
42
            }
43
44
            if (data.length < count) {
45
                var oSettings = datatable.fnSettings();
46
                oSettings.bDataFullyLoaded = true;
47
48
                // We need to redraw to update the info text
49
                datatable.fnDraw();
50
            } else {
51
                loadTableData(datatable, borrowernumbers, offset + count, count);
52
            }
53
        }
54
    });
55
}
56
57
function dtSimpleInfoCallback (oSettings, iStart, iEnd, iMax, iTotal, sPre) {
58
    var sInfo;
59
    var oLanguage = oSettings.oLanguage;
60
61
    if (iTotal > 0) {
62
      sInfo = oLanguage.sInfoSimple.replace('_TOTAL_', iTotal);
63
    } else {
64
      sInfo = oLanguage.sInfoEmpty;
65
    }
66
67
    if (iMax > iTotal) {
68
      sInfo += ' ' + oLanguage.sInfoFiltered.replace('_MAX_', iMax);
69
    }
70
71
    if (!oSettings.bDataFullyLoaded) {
72
      sInfo += ' (' + oLanguage.sLoadingRecords + ')';
73
    }
74
75
    return sInfo;
76
}
77
78
var mDataProps = {
79
    groupOrder: function( oObj ) {
80
        if ( oObj.issued_today ) {
81
            return "0";
82
        } else {
83
            return "1";
84
        }
85
    },
86
    groupName: function( oObj ) {
87
        if ( oObj.issued_today ) {
88
            return "<strong>" + TODAYS_CHECKOUTS + "</strong>";
89
        } else {
90
            return "<strong>" + PREVIOUS_CHECKOUTS + "</strong>";
91
        }
92
    },
93
    dateDueFormatted: function( oObj ) {
94
        var due = oObj.date_due_formatted;
95
96
        if ( oObj.date_due_overdue ) {
97
            due = "<span class='overdue'>" + due + "</span>";
98
        }
99
100
        if ( oObj.lost ) {
101
            due += "<span class='lost'>" + oObj.lost + "</span>";
102
        }
103
104
        if ( oObj.damaged ) {
105
            due += "<span class='dmg'>" + oObj.damaged + "</span>";
106
        }
107
108
        due = "<span id='date_due_" + oObj.itemnumber + "' class='date_due'>" + due + "</span>";
109
110
        return due;
111
    },
112
    title: function ( oObj ) {
113
        var title = "<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
114
              + oObj.biblionumber
115
              + "'>"
116
              + oObj.title;
117
118
        $.each(oObj.subtitle, function( index, value ) {
119
                  title += " " + value.subfield;
120
        });
121
122
        title += "</a></span>";
123
124
        if ( oObj.author ) {
125
            title += " " + BY.replace( "_AUTHOR_",  " " + oObj.author );
126
        }
127
128
        if ( oObj.itemnotes ) {
129
            var span_class = "";
130
            if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
131
                span_class = "circ-hlt";
132
            }
133
            title += " - <span class='" + span_class + "'>" + oObj.itemnotes + "</span>"
134
        }
135
136
        var onsite_checkout = '';
137
        if ( oObj.onsite_checkout == 1 ) {
138
            onsite_checkout += " <span class='onsite_checkout'>(" + INHOUSE_USE + ")</span>";
139
        }
140
141
        title += " "
142
              + "<a href='/cgi-bin/koha/catalogue/moredetail.pl?biblionumber="
143
              + oObj.biblionumber
144
              + "&itemnumber="
145
              + oObj.itemnumber
146
              + "#"
147
              + oObj.itemnumber
148
              + "'>"
149
              + oObj.barcode
150
              + "</a>"
151
              + onsite_checkout;
152
153
        return title;
154
    },
155
    charge: function ( oObj ) {
156
        if ( ! oObj.charge ) oObj.charge = 0;
157
        return parseFloat(oObj.charge).toFixed(2);
158
    },
159
    fine: function ( oObj ) {
160
        if ( ! oObj.fine ) oObj.fine = 0;
161
        return parseFloat(oObj.fine).toFixed(2);
162
    },
163
    price: function ( oObj ) {
164
        if ( ! oObj.price ) oObj.price = 0;
165
        return parseFloat(oObj.price).toFixed(2);
166
    },
167
    renew: function ( oObj ) {
168
        var content = "";
169
        var span_style = "";
170
        var span_class = "";
171
172
        content += "<span>";
173
        content += "<span style='padding: 0 1em;'>" + oObj.renewals_count + "</span>";
174
175
        if ( oObj.can_renew ) {
176
            // Do nothing
177
        } else if ( oObj.can_renew_error == "on_reserve" ) {
178
            content += "<span class='renewals-disabled-no-override'>"
179
                    + "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>"
180
                    + "</span>";
181
182
            span_style = "display: none";
183
            span_class = "renewals-allowed";
184
        } else if ( oObj.can_renew_error == "too_many" ) {
185
            content += "<span class='renewals-disabled'>"
186
                    + NOT_RENEWABLE
187
                    + "</span>";
188
189
            span_style = "display: none";
190
            span_class = "renewals-allowed";
191
        } else if ( oObj.can_renew_error == "restriction" ) {
192
            content += "<span class='renewals-disabled'>"
193
                    + NOT_RENEWABLE_RESTRICTION
194
                    + "</span>";
195
196
            span_style = "display: none";
197
            span_class = "renewals-allowed";
198
        } else if ( oObj.can_renew_error == "overdue" ) {
199
            content += "<span class='renewals-disabled'>"
200
                    + NOT_RENEWABLE_OVERDUE
201
                    + "</span>";
202
203
            span_style = "display: none";
204
            span_class = "renewals-allowed";
205
        } else if ( oObj.can_renew_error == "too_soon" ) {
206
            content += "<span class='renewals-disabled'>"
207
                    + NOT_RENEWABLE_TOO_SOON.format( oObj.can_renew_date )
208
                    + "</span>";
209
210
            span_style = "display: none";
211
            span_class = "renewals-allowed";
212
        } else if ( oObj.can_renew_error == "auto_too_soon" ) {
213
            content += "<span class='renewals-disabled'>"
214
                    + NOT_RENEWABLE_AUTO_TOO_SOON
215
                    + "</span>";
216
217
            span_style = "display: none";
218
            span_class = "renewals-allowed";
219
        } else if ( oObj.can_renew_error == "auto_renew" ) {
220
            content += "<span class='renewals-disabled'>"
221
                    + NOT_RENEWABLE_AUTO_RENEW
222
                    + "</span>";
223
224
            span_style = "display: none";
225
            span_class = "renewals-allowed";
226
        } else if ( oObj.can_renew_error == "onsite_checkout" ) {
227
            // Don't display something if it's an onsite checkout
228
        } else {
229
            content += "<span class='renewals-disabled'>"
230
                    + oObj.can_renew_error
231
                    + "</span>";
232
233
            span_style = "display: none";
234
            span_class = "renewals-allowed";
235
        }
236
237
        var can_force_renew = ( oObj.onsite_checkout == 0 ) && ( oObj.can_renew_error != "on_reserve" );
238
        var can_renew = ( oObj.renewals_remaining > 0  && !oObj.can_renew_error );
239
        if ( can_renew || can_force_renew ) {
240
            content += "<span class='" + span_class + "' style='" + span_style + "'>"
241
                    +  "<input type='checkbox' ";
242
            if ( oObj.date_due_overdue && can_renew ) {
243
                content += "checked='checked' ";
244
            }
245
            content += "class='renew' id='renew_" + oObj.itemnumber + "' name='renew' value='" + oObj.itemnumber +"'/>"
246
                    +  "</span>";
247
248
            content += "<span class='renewals'>("
249
                    + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed )
250
                    + ")</span>";
251
        }
252
253
        content += "</span>";
254
255
        return content;
256
    },
257
    checkin: function ( oObj ) {
258
        if ( oObj.can_renew_error == "on_reserve" ) {
259
            return "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>";
260
        } else {
261
            return "<input type='checkbox' class='checkin' id='checkin_" + oObj.itemnumber + "' name='checkin' value='" + oObj.itemnumber +"'></input>";
262
        }
263
    },
264
    export: function ( oObj ) {
265
        var s = "<input type='checkbox' name='itemnumbers' value='" + oObj.itemnumber + "' style='visibility:hidden;' />";
266
267
        s += "<input type='checkbox' class='export' id='export_" + oObj.biblionumber + "' name='biblionumbers' value='" + oObj.biblionumber + "' />";
268
        return s;
269
    },
270
    patron: function( oObj ) {
271
        return "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=" + oObj.borrowernumber + "'>"
272
             + oObj.borrower.firstname + " " + oObj.borrower.surname + " (" + oObj.borrower.cardnumber + ")</a>"
273
    }
274
};
275
1
$(document).ready(function() {
276
$(document).ready(function() {
2
    $.ajaxSetup ({ cache: false });
277
    $.ajaxSetup ({ cache: false });
3
278
Lines 139-146 $(document).ready(function() { Link Here
139
        return false;
414
        return false;
140
    });
415
    });
141
416
142
    var ymd = $.datepicker.formatDate('yy-mm-dd', new Date());
143
144
    $('#issues-table').hide();
417
    $('#issues-table').hide();
145
    $('#issues-table-actions').hide();
418
    $('#issues-table-actions').hide();
146
    $('#issues-table-load-immediately').change(function(){
419
    $('#issues-table-load-immediately').change(function(){
Lines 174-265 $(document).ready(function() { Link Here
174
                "sProcessing": MSG_DT_LOADING_RECORDS,
447
                "sProcessing": MSG_DT_LOADING_RECORDS,
175
            },
448
            },
176
            "bAutoWidth": false,
449
            "bAutoWidth": false,
177
            "sDom": 'C<"clearfix">rt',
450
            "bPaginate": false,
451
            "sDom": 'C<"top pager"if>rt',
178
            "aoColumns": [
452
            "aoColumns": [
179
                {
453
                { "mDataProp": "sort_order" },
180
                    "mDataProp": function( oObj ) {
454
                { "mDataProp": mDataProps.groupOrder },
181
                        return oObj.sort_order;
455
                { "mDataProp": mDataProps.groupName },
182
                    }
456
                { "mDataProp": "date_due" },
183
                },
184
                {
185
                    "mDataProp": function( oObj ) {
186
                        if ( oObj.issued_today ) {
187
                            return "<strong>" + TODAYS_CHECKOUTS + "</strong>";
188
                        } else {
189
                            return "<strong>" + PREVIOUS_CHECKOUTS + "</strong>";
190
                        }
191
                    }
192
                },
193
                {
194
                    "mDataProp": "date_due",
195
                    "bVisible": false,
196
                },
197
                {
457
                {
198
                    "iDataSort": 2, // Sort on hidden unformatted date due column
458
                    "iDataSort": 2, // Sort on hidden unformatted date due column
199
                    "mDataProp": function( oObj ) {
459
                    "mDataProp": mDataProps.dateDueFormatted
200
                        var due = oObj.date_due_formatted;
201
202
                        if ( oObj.date_due_overdue ) {
203
                            due = "<span class='overdue'>" + due + "</span>";
204
                        }
205
206
                        if ( oObj.lost ) {
207
                            due += "<span class='lost'>" + oObj.lost + "</span>";
208
                        }
209
210
                        if ( oObj.damaged ) {
211
                            due += "<span class='dmg'>" + oObj.damaged + "</span>";
212
                        }
213
214
                        due = "<span id='date_due_" + oObj.itemnumber + "' class='date_due'>" + due + "</span>";
215
216
                        return due;
217
                    }
218
                },
460
                },
219
                {
461
                {
220
                    "mDataProp": function ( oObj ) {
462
                    "mDataProp": mDataProps.title,
221
                        title = "<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
222
                              + oObj.biblionumber
223
                              + "'>"
224
                              + oObj.title;
225
226
                        $.each(oObj.subtitle, function( index, value ) {
227
                                  title += " " + value.subfield;
228
                        });
229
230
                        title += "</a></span>";
231
232
                        if ( oObj.author ) {
233
                            title += " " + BY.replace( "_AUTHOR_",  " " + oObj.author );
234
                        }
235
236
                        if ( oObj.itemnotes ) {
237
                            var span_class = "";
238
                            if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
239
                                span_class = "circ-hlt";
240
                            }
241
                            title += " - <span class='" + span_class + "'>" + oObj.itemnotes + "</span>"
242
                        }
243
244
                        var onsite_checkout = '';
245
                        if ( oObj.onsite_checkout == 1 ) {
246
                            onsite_checkout += " <span class='onsite_checkout'>(" + INHOUSE_USE + ")</span>";
247
                        }
248
249
                        title += " "
250
                              + "<a href='/cgi-bin/koha/catalogue/moredetail.pl?biblionumber="
251
                              + oObj.biblionumber
252
                              + "&itemnumber="
253
                              + oObj.itemnumber
254
                              + "#"
255
                              + oObj.itemnumber
256
                              + "'>"
257
                              + oObj.barcode
258
                              + "</a>"
259
                              + onsite_checkout;
260
261
                        return title;
262
                    },
263
                    "sType": "anti-the"
463
                    "sType": "anti-the"
264
                },
464
                },
265
                { "mDataProp": "itemtype_description" },
465
                { "mDataProp": "itemtype_description" },
Lines 267-402 $(document).ready(function() { Link Here
267
                { "mDataProp": "issuedate_formatted" },
467
                { "mDataProp": "issuedate_formatted" },
268
                { "mDataProp": "branchname" },
468
                { "mDataProp": "branchname" },
269
                { "mDataProp": "itemcallnumber" },
469
                { "mDataProp": "itemcallnumber" },
270
                {
470
                { "mDataProp": mDataProps.charge },
271
                    "mDataProp": function ( oObj ) {
471
                { "mDataProp": mDataProps.fine },
272
                        if ( ! oObj.charge ) oObj.charge = 0;
472
                { "mDataProp": mDataProps.price },
273
                        return parseFloat(oObj.charge).toFixed(2);
274
                    }
275
                },
276
                {
277
                    "mDataProp": function ( oObj ) {
278
                        if ( ! oObj.fine ) oObj.fine = 0;
279
                        return parseFloat(oObj.fine).toFixed(2);
280
                    }
281
                },
282
                {
283
                    "mDataProp": function ( oObj ) {
284
                        if ( ! oObj.price ) oObj.price = 0;
285
                        return parseFloat(oObj.price).toFixed(2);
286
                    }
287
                },
288
                {
473
                {
289
                    "bSortable": false,
474
                    "bSortable": false,
290
                    "mDataProp": function ( oObj ) {
475
                    "mDataProp": mDataProps.renew
291
                        var content = "";
292
                        var span_style = "";
293
                        var span_class = "";
294
295
                        content += "<span>";
296
                        content += "<span style='padding: 0 1em;'>" + oObj.renewals_count + "</span>";
297
298
                        if ( oObj.can_renew ) {
299
                            // Do nothing
300
                        } else if ( oObj.can_renew_error == "on_reserve" ) {
301
                            content += "<span class='renewals-disabled-no-override'>"
302
                                    + "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>"
303
                                    + "</span>";
304
305
                            span_style = "display: none";
306
                            span_class = "renewals-allowed";
307
                        } else if ( oObj.can_renew_error == "too_many" ) {
308
                            content += "<span class='renewals-disabled'>"
309
                                    + NOT_RENEWABLE
310
                                    + "</span>";
311
312
                            span_style = "display: none";
313
                            span_class = "renewals-allowed";
314
                        } else if ( oObj.can_renew_error == "restriction" ) {
315
                            content += "<span class='renewals-disabled'>"
316
                                    + NOT_RENEWABLE_RESTRICTION
317
                                    + "</span>";
318
319
                            span_style = "display: none";
320
                            span_class = "renewals-allowed";
321
                        } else if ( oObj.can_renew_error == "overdue" ) {
322
                            content += "<span class='renewals-disabled'>"
323
                                    + NOT_RENEWABLE_OVERDUE
324
                                    + "</span>";
325
326
                            span_style = "display: none";
327
                            span_class = "renewals-allowed";
328
                        } else if ( oObj.can_renew_error == "too_soon" ) {
329
                            content += "<span class='renewals-disabled'>"
330
                                    + NOT_RENEWABLE_TOO_SOON.format( oObj.can_renew_date )
331
                                    + "</span>";
332
333
                            span_style = "display: none";
334
                            span_class = "renewals-allowed";
335
                        } else if ( oObj.can_renew_error == "auto_too_soon" ) {
336
                            content += "<span class='renewals-disabled'>"
337
                                    + NOT_RENEWABLE_AUTO_TOO_SOON
338
                                    + "</span>";
339
340
                            span_style = "display: none";
341
                            span_class = "renewals-allowed";
342
                        } else if ( oObj.can_renew_error == "auto_renew" ) {
343
                            content += "<span class='renewals-disabled'>"
344
                                    + NOT_RENEWABLE_AUTO_RENEW
345
                                    + "</span>";
346
347
                            span_style = "display: none";
348
                            span_class = "renewals-allowed";
349
                        } else if ( oObj.can_renew_error == "onsite_checkout" ) {
350
                            // Don't display something if it's an onsite checkout
351
                        } else {
352
                            content += "<span class='renewals-disabled'>"
353
                                    + oObj.can_renew_error
354
                                    + "</span>";
355
356
                            span_style = "display: none";
357
                            span_class = "renewals-allowed";
358
                        }
359
360
                        var can_force_renew = ( oObj.onsite_checkout == 0 ) && ( oObj.can_renew_error != "on_reserve" );
361
                        var can_renew = ( oObj.renewals_remaining > 0  && !oObj.can_renew_error );
362
                        if ( can_renew || can_force_renew ) {
363
                            content += "<span class='" + span_class + "' style='" + span_style + "'>"
364
                                    +  "<input type='checkbox' ";
365
                            if ( oObj.date_due_overdue && can_renew ) {
366
                                content += "checked='checked' ";
367
                            }
368
                            content += "class='renew' id='renew_" + oObj.itemnumber + "' name='renew' value='" + oObj.itemnumber +"'/>"
369
                                    +  "</span>";
370
371
                            content += "<span class='renewals'>("
372
                                    + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed )
373
                                    + ")</span>";
374
                        }
375
376
                        content += "</span>";
377
378
                        return content;
379
                    }
380
                },
476
                },
381
                {
477
                {
382
                    "bSortable": false,
478
                    "bSortable": false,
383
                    "mDataProp": function ( oObj ) {
479
                    "mDataProp": mDataProps.checkin
384
                        if ( oObj.can_renew_error == "on_reserve" ) {
385
                            return "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>";
386
                        } else {
387
                            return "<input type='checkbox' class='checkin' id='checkin_" + oObj.itemnumber + "' name='checkin' value='" + oObj.itemnumber +"'></input>";
388
                        }
389
                    }
390
                },
480
                },
391
                {
481
                {
392
                    "bVisible": exports_enabled ? true : false,
482
                    "bVisible": exports_enabled ? true : false,
393
                    "bSortable": false,
483
                    "bSortable": false,
394
                    "mDataProp": function ( oObj ) {
484
                    "mDataProp": mDataProps.checkin
395
                        var s = "<input type='checkbox' name='itemnumbers' value='" + oObj.itemnumber + "' style='visibility:hidden;' />";
396
397
                        s += "<input type='checkbox' class='export' id='export_" + oObj.biblionumber + "' name='biblionumbers' value='" + oObj.biblionumber + "' />";
398
                        return s;
399
                    }
400
                }
485
                }
401
            ],
486
            ],
402
            "fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
487
            "fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
Lines 412-449 $(document).ready(function() { Link Here
412
                $("#totalfine").html(total_fine.toFixed(2));
497
                $("#totalfine").html(total_fine.toFixed(2));
413
                $("#totalprice").html(total_price.toFixed(2));
498
                $("#totalprice").html(total_price.toFixed(2));
414
            },
499
            },
415
            "bPaginate": false,
500
            "fnInfoCallback": dtSimpleInfoCallback
416
            "bProcessing": true,
501
        }, columns_settings);
417
            "bServerSide": false,
502
418
            "sAjaxSource": '/cgi-bin/koha/svc/checkouts',
503
        enableGrouping(issuesTable);
419
            "fnServerData": function ( sSource, aoData, fnCallback ) {
504
420
                aoData.push( { "name": "borrowernumber", "value": borrowernumber } );
505
        var groupingSwitch = $('<input type="checkbox">')
421
506
          .attr('id', 'issues-table-row-grouping-switch')
422
                $.getJSON( sSource, aoData, function (json) {
507
          .attr('checked', 'checked')
423
                    fnCallback(json)
508
          .css('vertical-align', 'middle')
424
                } );
509
          .change(function() {
425
            },
510
              if ($(this).is(':checked')) {
426
            "fnInitComplete": function(oSettings) {
511
                  enableGrouping(issuesTable);
427
                // Disable rowGrouping plugin after first use
512
              } else {
428
                // so any sorting on the table doesn't use it
513
                  disableGrouping(issuesTable);
429
                var oSettings = issuesTable.fnSettings();
514
              }
430
515
          });
431
                for (f = 0; f < oSettings.aoDrawCallback.length; f++) {
516
        $('<div></div>')
432
                    if (oSettings.aoDrawCallback[f].sName == 'fnRowGrouping') {
517
          .css('float', 'left')
433
                        oSettings.aoDrawCallback.splice(f, 1);
518
          .css('padding', '0.3em 0.5em')
434
                        break;
519
          .css('line-height', '1.9em')
435
                    }
520
          .append(groupingSwitch)
436
                }
521
          .append('&nbsp;')
522
          .append('<label for="issues-table-row-grouping-switch">' + GROUP_TODAYS_CHECKOUTS + '</label>')
523
          .appendTo('#issues-table_wrapper .top.pager');
437
524
438
                oSettings.aaSortingFixed = null;
525
        loadTableData(issuesTable, borrowernumber);
439
            },
440
        }, columns_settings).rowGrouping(
441
            {
442
                iGroupingColumnIndex: 1,
443
                iGroupingOrderByColumnIndex: 0,
444
                sGroupingColumnSortDirection: "asc"
445
            }
446
        );
447
526
448
        if ( $("#issues-table").length ) {
527
        if ( $("#issues-table").length ) {
449
            $("#issues-table_processing").position({
528
            $("#issues-table_processing").position({
Lines 457-527 $(document).ready(function() { Link Here
457
    var relativesIssuesTable;
536
    var relativesIssuesTable;
458
    $("#relatives-issues-tab").click( function() {
537
    $("#relatives-issues-tab").click( function() {
459
        if ( ! relativesIssuesTable ) {
538
        if ( ! relativesIssuesTable ) {
460
            relativesIssuesTable = $("#relatives-issues-table").dataTable({
539
            relativesIssuesTable = KohaTable("#relatives-issues-table", {
461
                "bAutoWidth": false,
540
                "bAutoWidth": false,
462
                "sDom": "rt",
541
                "sDom": 'C<"top pager"if>rt',
463
                "aaSorting": [],
542
                "aaSorting": [],
543
                "bPaginate": false,
464
                "aoColumns": [
544
                "aoColumns": [
465
                    {
545
                    { "mDataProp": "date_due" },
466
                        "mDataProp": "date_due",
467
                        "bVisible": false,
468
                    },
469
                    {
546
                    {
470
                        "iDataSort": 1, // Sort on hidden unformatted date due column
547
                        "iDataSort": 1, // Sort on hidden unformatted date due column
471
                        "mDataProp": function( oObj ) {
548
                        "mDataProp": mDataProps.dateDueFormatted
472
                            var today = new Date();
473
                            var due = new Date( oObj.date_due );
474
                            if ( today > due ) {
475
                                return "<span class='overdue'>" + oObj.date_due_formatted + "</span>";
476
                            } else {
477
                                return oObj.date_due_formatted;
478
                            }
479
                        }
480
                    },
549
                    },
481
                    {
550
                    {
482
                        "mDataProp": function ( oObj ) {
551
                        "mDataProp": mDataProps.title,
483
                            title = "<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
484
                                  + oObj.biblionumber
485
                                  + "'>"
486
                                  + oObj.title;
487
488
                            $.each(oObj.subtitle, function( index, value ) {
489
                                      title += " " + value.subfield;
490
                            });
491
492
                            title += "</a></span>";
493
494
                            if ( oObj.author ) {
495
                                title += " " + BY.replace( "_AUTHOR_", " " + oObj.author );
496
                            }
497
498
                            if ( oObj.itemnotes ) {
499
                                var span_class = "";
500
                                if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
501
                                    span_class = "circ-hlt";
502
                                }
503
                                title += " - <span class='" + span_class + "'>" + oObj.itemnotes + "</span>"
504
                            }
505
506
                            var onsite_checkout = '';
507
                            if ( oObj.onsite_checkout == 1 ) {
508
                                onsite_checkout += " <span class='onsite_checkout'>(" + INHOUSE_USE + ")</span>";
509
                            }
510
511
                            title += " "
512
                                  + "<a href='/cgi-bin/koha/catalogue/moredetail.pl?biblionumber="
513
                                  + oObj.biblionumber
514
                                  + "&itemnumber="
515
                                  + oObj.itemnumber
516
                                  + "#"
517
                                  + oObj.itemnumber
518
                                  + "'>"
519
                                  + oObj.barcode
520
                                  + "</a>"
521
                                  + onsite_checkout;
522
523
                            return title;
524
                        },
525
                        "sType": "anti-the"
552
                        "sType": "anti-the"
526
                    },
553
                    },
527
                    { "mDataProp": "itemtype" },
554
                    { "mDataProp": "itemtype" },
Lines 529-573 $(document).ready(function() { Link Here
529
                    { "mDataProp": "issuedate_formatted" },
556
                    { "mDataProp": "issuedate_formatted" },
530
                    { "mDataProp": "branchname" },
557
                    { "mDataProp": "branchname" },
531
                    { "mDataProp": "itemcallnumber" },
558
                    { "mDataProp": "itemcallnumber" },
532
                    {
559
                    { "mDataProp": mDataProps.charge },
533
                        "mDataProp": function ( oObj ) {
560
                    { "mDataProp": mDataProps.fine },
534
                            if ( ! oObj.charge ) oObj.charge = 0;
561
                    { "mDataProp": mDataProps.price },
535
                            return parseFloat(oObj.charge).toFixed(2);
562
                    { "mDataProp": mDataProps.patron }
536
                        }
537
                    },
538
                    {
539
                        "mDataProp": function ( oObj ) {
540
                            if ( ! oObj.fine ) oObj.fine = 0;
541
                            return parseFloat(oObj.fine).toFixed(2);
542
                        }
543
                    },
544
                    {
545
                        "mDataProp": function ( oObj ) {
546
                            if ( ! oObj.price ) oObj.price = 0;
547
                            return parseFloat(oObj.price).toFixed(2);
548
                        }
549
                    },
550
                    {
551
                        "mDataProp": function( oObj ) {
552
                            return "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=" + oObj.borrowernumber + "'>"
553
                                 + oObj.borrower.firstname + " " + oObj.borrower.surname + " (" + oObj.borrower.cardnumber + ")</a>"
554
                        }
555
                    },
556
                ],
563
                ],
557
                "bPaginate": false,
564
                "fnInfoCallback": dtSimpleInfoCallback
558
                "bProcessing": true,
565
            }, relatives_columns_settings);
559
                "bServerSide": false,
566
            loadTableData(relativesIssuesTable, relatives_borrowernumbers);
560
                "sAjaxSource": '/cgi-bin/koha/svc/checkouts',
561
                "fnServerData": function ( sSource, aoData, fnCallback ) {
562
                    $.each(relatives_borrowernumbers, function( index, value ) {
563
                        aoData.push( { "name": "borrowernumber", "value": value } );
564
                    });
565
566
                    $.getJSON( sSource, aoData, function (json) {
567
                        fnCallback(json)
568
                    } );
569
                },
570
            });
571
        }
567
        }
572
    });
568
    });
573
569
Lines 587-590 $(document).ready(function() { Link Here
587
            }
583
            }
588
        } ).attr( 'checked', false );
584
        } ).attr( 'checked', false );
589
    }
585
    }
590
 });
586
});
587
588
})(jQuery);
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js (+1 lines)
Lines 15-20 var dataTablesDefaults = { Link Here
15
        },
15
        },
16
        "sEmptyTable"       : window.MSG_DT_EMPTY_TABLE || "No data available in table",
16
        "sEmptyTable"       : window.MSG_DT_EMPTY_TABLE || "No data available in table",
17
        "sInfo"             : window.MSG_DT_INFO || "Showing _START_ to _END_ of _TOTAL_ entries",
17
        "sInfo"             : window.MSG_DT_INFO || "Showing _START_ to _END_ of _TOTAL_ entries",
18
        "sInfoSimple"       : window.MSG_DT_INFO_SIMPLE || "Entries shown: _TOTAL_",
18
        "sInfoEmpty"        : window.MSG_DT_INFO_EMPTY || "No entries to show",
19
        "sInfoEmpty"        : window.MSG_DT_INFO_EMPTY || "No entries to show",
19
        "sInfoFiltered"     : window.MSG_DT_INFO_FILTERED || "(filtered from _MAX_ total entries)",
20
        "sInfoFiltered"     : window.MSG_DT_INFO_FILTERED || "(filtered from _MAX_ total entries)",
20
        "sLengthMenu"       : window.MSG_DT_LENGTH_MENU || "Show _MENU_ entries",
21
        "sLengthMenu"       : window.MSG_DT_LENGTH_MENU || "Show _MENU_ entries",
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+1 lines)
Lines 48-53 var MSG_ADD_MESSAGE = _("Add a new message"); Link Here
48
var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
48
var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
49
49
50
columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'issues-table', 'json' ) %]
50
columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'issues-table', 'json' ) %]
51
relatives_columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'relatives-issues-table', 'json' ) %]
51
52
52
[% IF ( borrowernumber ) %]
53
[% IF ( borrowernumber ) %]
53
    if($.cookie("holdfor") != [% borrowernumber %]){
54
    if($.cookie("holdfor") != [% borrowernumber %]){
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+1 lines)
Lines 44-49 var MSG_ADD_MESSAGE = _("Add a new message"); Link Here
44
var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
44
var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
45
45
46
columns_settings = [% ColumnsSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) %]
46
columns_settings = [% ColumnsSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) %]
47
relatives_columns_settings = [% ColumnsSettings.GetColumns( 'members', 'moremember', 'relatives-issues-table', 'json' ) %]
47
48
48
$(document).ready(function() {
49
$(document).ready(function() {
49
    $('#finesholdsissues').tabs({
50
    $('#finesholdsissues').tabs({
(-)a/svc/checkouts (-43 / +24 lines)
Lines 42-63 if ( $auth_status ne "ok" ) { Link Here
42
    exit 0;
42
    exit 0;
43
}
43
}
44
44
45
my @sort_columns = qw/date_due title itype issuedate branchcode itemcallnumber/;
46
47
my @borrowernumber   = $input->param('borrowernumber');
45
my @borrowernumber   = $input->param('borrowernumber');
48
my $offset           = $input->param('iDisplayStart');
46
my $offset = $input->param('offset') || 0;
49
my $results_per_page = $input->param('iDisplayLength') || -1;
47
my $count = $input->param('count') || 10;
50
51
my $sorting_column = $input->param('iSortCol_0') || q{};
52
$sorting_column = ( $sorting_column && $sort_columns[$sorting_column] ) ? $sort_columns[$sorting_column] : 'issuedate';
53
54
my $sorting_direction = $input->param('sSortDir_0') || q{};
55
$sorting_direction = $sorting_direction eq 'asc' ? 'asc' : 'desc';
56
57
$results_per_page = undef if ( $results_per_page == -1 );
58
59
binmode STDOUT, ":encoding(UTF-8)";
60
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
61
48
62
my @parameters;
49
my @parameters;
63
my $sql = '
50
my $sql = '
Lines 112-118 else { Link Here
112
}
99
}
113
push( @parameters, @borrowernumber );
100
push( @parameters, @borrowernumber );
114
101
115
$sql .= " ORDER BY $sorting_column $sorting_direction ";
102
$sql .= " ORDER BY date_due DESC";
103
$sql .= " LIMIT ?,?";
104
push @parameters, $offset, $count;
116
105
117
my $dbh = C4::Context->dbh();
106
my $dbh = C4::Context->dbh();
118
my $sth = $dbh->prepare($sql);
107
my $sth = $dbh->prepare($sql);
Lines 120-127 $sth->execute(@parameters); Link Here
120
109
121
my $item_level_itypes = C4::Context->preference('item-level_itypes');
110
my $item_level_itypes = C4::Context->preference('item-level_itypes');
122
111
123
my @checkouts_today;
112
my @checkouts;
124
my @checkouts_previous;
125
while ( my $c = $sth->fetchrow_hashref() ) {
113
while ( my $c = $sth->fetchrow_hashref() ) {
126
    my ($charge) = GetIssuingCharges( $c->{itemnumber}, $c->{borrowernumber} );
114
    my ($charge) = GetIssuingCharges( $c->{itemnumber}, $c->{borrowernumber} );
127
    my $fine = GetFine( $c->{itemnumber}, $c->{borrowernumber} );
115
    my $fine = GetFine( $c->{itemnumber}, $c->{borrowernumber} );
Lines 198-230 while ( my $c = $sth->fetchrow_hashref() ) { Link Here
198
        issued_today => !$c->{not_issued_today},
186
        issued_today => !$c->{not_issued_today},
199
    };
187
    };
200
188
201
    if ( $c->{not_issued_today} ) {
189
    push @checkouts, $checkout;
202
        push( @checkouts_previous, $checkout );
203
    }
204
    else {
205
        push( @checkouts_today, $checkout );
206
    }
207
}
190
}
208
191
192
my $todaysIssuesDefaultSortOrder =
193
  C4::Context->preference('todaysIssuesDefaultSortOrder');
194
my $previousIssuesDefaultSortOrder =
195
  C4::Context->preference('previousIssuesDefaultSortOrder');
209
196
210
@checkouts_today = sort { $a->{timestamp} cmp $b->{timestamp} } @checkouts_today;
197
my $i = $offset + 1;
211
@checkouts_today = reverse(@checkouts_today)
198
foreach my $c (@checkouts) {
212
  unless ( C4::Context->preference('todaysIssuesDefaultSortOrder') eq 'desc' );
199
    my $sort_order = $i++;
213
214
@checkouts_previous = sort { $a->{date_due} cmp $b->{date_due} } @checkouts_previous;
215
@checkouts_previous = reverse(@checkouts_previous)
216
  if ( C4::Context->preference('previousIssuesDefaultSortOrder') eq 'desc' );
217
218
my @checkouts = ( @checkouts_today, @checkouts_previous );
219
220
my $i = 1;
221
map { $_->{sort_order} = $i++ } @checkouts;
222
200
201
    if ($c->{issued_today} && $todaysIssuesDefaultSortOrder eq 'asc') {
202
        $sort_order = - $sort_order;
203
    } elsif (!$c->{issued_today} && $previousIssuesDefaultSortOrder eq 'asc') {
204
        $sort_order = - $sort_order;
205
    }
223
206
224
my $data;
207
    $c->{sort_order} = $sort_order;
225
$data->{'iTotalRecords'}        = scalar @checkouts;
208
}
226
$data->{'iTotalDisplayRecords'} = scalar @checkouts;
227
$data->{'sEcho'}                = $input->param('sEcho') || undef;
228
$data->{'aaData'}               = \@checkouts;
229
209
230
print to_json($data);
210
binmode STDOUT, ":encoding(UTF-8)";
211
print $input->header( -type => 'application/json', -charset => 'UTF-8' );
212
print to_json(\@checkouts);
231
- 

Return to bug 15219