$('#issues-table').show();
$('#issues-table-actions').show();
- issuesTable = KohaTable("#issues-table", {
+ issuesTable = KohaTable("issues-table", {
"oLanguage": {
"sEmptyTable" : MSG_DT_LOADING_RECORDS,
"sProcessing": MSG_DT_LOADING_RECORDS,
due = "<span id='date_due_" + oObj.itemnumber + "' class='date_due'>" + due + "</span>";
if ( oObj.lost ) {
- due += "<span class='lost'>" + oObj.lost + "</span>";
+ due += "<span class='lost'>" + oObj.lost.escapeHtml() + "</span>";
}
if ( oObj.damaged ) {
- due += "<span class='dmg'>" + oObj.damaged + "</span>";
+ due += "<span class='dmg'>" + oObj.damaged.escapeHtml() + "</span>";
}
var patron_note = " <span class='patron_note_" + oObj.itemnumber + "'></span>";
title = "<span id='title_" + oObj.itemnumber + "' class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
+ oObj.biblionumber
+ "'>"
- + oObj.title;
+ + oObj.title.escapeHtml();
$.each(oObj.subtitle, function( index, value ) {
- title += " " + value.subfield;
+ title += " " + value.subfield.escapeHtml();
});
if ( oObj.enumchron ) {
- title += " (" + oObj.enumchron + ")";
+ title += " (" + oObj.enumchron.escapeHtml() + ")";
}
title += "</a></span>";
if ( oObj.author ) {
- title += " " + BY.replace( "_AUTHOR_", " " + oObj.author );
+ title += " " + BY.replace( "_AUTHOR_", " " + oObj.author.escapeHtml() );
}
if ( oObj.itemnotes ) {
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
span_class = "circ-hlt";
}
- title += " - <span class='" + span_class + "'>" + oObj.itemnotes + "</span>";
+ title += " - <span class='" + span_class + " item-note-public'>" + oObj.itemnotes.escapeHtml() + "</span>";
}
if ( oObj.itemnotes_nonpublic ) {
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
span_class = "circ-hlt";
}
- title += " - <span class='" + span_class + "'>" + oObj.itemnotes_nonpublic + "</span>";
+ title += " - <span class='" + span_class + " item-note-nonpublic'>" + oObj.itemnotes_nonpublic.escapeHtml() + "</span>";
}
var onsite_checkout = '';
+ "#"
+ oObj.itemnumber
+ "'>"
- + oObj.barcode
+ + oObj.barcode.escapeHtml()
+ "</a>"
+ onsite_checkout
},
"sType": "anti-the"
},
- { "mDataProp": "itemtype_description" },
- { "mDataProp": "location" },
- { "mDataProp": "homebranch" },
- { "mDataProp": "issuedate_formatted" },
- { "mDataProp": "branchname" },
- { "mDataProp": "itemcallnumber" },
+ {
+ "mDataProp": function ( oObj ) {
+ return oObj.itemtype_description.escapeHtml();
+ }
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ return ( oObj.collection ? oObj.collection.escapeHtml() : '' );
+ }
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ return ( oObj.location ? oObj.location.escapeHtml() : '' );
+ }
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ return oObj.homebranch.escapeHtml();
+ }
+ },
+ {
+ "mDataProp": "issuedate",
+ "bVisible": false,
+ },
+ {
+ "iDataSort": 9, // Sort on hidden unformatted issuedate column
+ "mDataProp": "issuedate_formatted",
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ return oObj.branchname.escapeHtml();
+ }
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ return ( oObj.itemcallnumber ? oObj.itemcallnumber.escapeHtml() : '' );
+ }
+ },
{
"mDataProp": function ( oObj ) {
if ( ! oObj.charge ) oObj.charge = 0;
+ NOT_RENEWABLE_AUTO_TOO_LATE
+ "</span>";
+ span_style = "display: none";
+ span_class = "renewals-allowed";
+ } else if ( oObj.can_renew_error == "auto_too_much_oweing" ) {
+ content += "<span class='renewals-disabled'>"
+ + NOT_RENEWABLE_AUTO_TOO_MUCH_OWEING
+ + "</span>";
+
+ span_style = "display: none";
+ span_class = "renewals-allowed";
+ } else if ( oObj.can_renew_error == "auto_account_expired" ) {
+ content += "<span class='renewals-disabled'>"
+ + NOT_RENEWABLE_AUTO_ACCOUNT_EXPIRED
+ + "</span>";
+
span_style = "display: none";
span_class = "renewals-allowed";
} else if ( oObj.can_renew_error == "auto_renew" ) {
span_class = "renewals-allowed";
} else if ( oObj.can_renew_error == "onsite_checkout" ) {
// Don't display something if it's an onsite checkout
+ } else if ( oObj.can_renew_error == "item_denied_renewal" ) {
+ content += "<span class='renewals-disabled'>"
+ + NOT_RENEWABLE_DENIED
+ + "</span>";
+
+ span_style = "display: none";
+ span_class = "renewals-allowed";
} else {
content += "<span class='renewals-disabled'>"
+ oObj.can_renew_error
fnCallback(json)
} );
},
- "fnInitComplete": function(oSettings) {
+ "fnInitComplete": function(oSettings, json) {
// Disable rowGrouping plugin after first use
// so any sorting on the table doesn't use it
var oSettings = issuesTable.fnSettings();
}
oSettings.aaSortingFixed = null;
+
+ // Build a summary of checkouts grouped by itemtype
+ var checkoutsByItype = json.aaData.reduce(function (obj, row) {
+ obj[row.itemtype_description] = (obj[row.itemtype_description] || 0) + 1;
+ return obj;
+ }, {});
+ var ul = $('<ul>');
+ Object.keys(checkoutsByItype).sort().forEach(function (itype) {
+ var li = $('<li>')
+ .append($('<strong>').html(itype || MSG_NO_ITEMTYPE))
+ .append(': ' + checkoutsByItype[itype]);
+ ul.append(li);
+ })
+ $('<details>')
+ .addClass('checkouts-by-itemtype')
+ .append($('<summary>').html(MSG_CHECKOUTS_BY_ITEMTYPE))
+ .append(ul)
+ .insertBefore(oSettings.nTableWrapper)
},
}, columns_settings).rowGrouping(
{
"bVisible": false,
},
{
- "iDataSort": 1, // Sort on hidden unformatted date due column
+ "iDataSort": 0, // Sort on hidden unformatted date due column
"mDataProp": function( oObj ) {
var today = new Date();
var due = new Date( oObj.date_due );
title = "<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
+ oObj.biblionumber
+ "'>"
- + oObj.title;
+ + oObj.title.escapeHtml();
$.each(oObj.subtitle, function( index, value ) {
- title += " " + value.subfield;
+ title += " " + value.subfield.escapeHtml();
});
if ( oObj.enumchron ) {
- title += " (" + oObj.enumchron + ")";
+ title += " (" + oObj.enumchron.escapeHtml() + ")";
}
title += "</a></span>";
if ( oObj.author ) {
- title += " " + BY.replace( "_AUTHOR_", " " + oObj.author );
+ title += " " + BY.replace( "_AUTHOR_", " " + oObj.author.escapeHtml() );
}
if ( oObj.itemnotes ) {
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
span_class = "circ-hlt";
}
- title += " - <span class='" + span_class + "'>" + oObj.itemnotes + "</span>"
+ title += " - <span class='" + span_class + "'>" + oObj.itemnotes.escapeHtml() + "</span>"
}
if ( oObj.itemnotes_nonpublic ) {
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
span_class = "circ-hlt";
}
- title += " - <span class='" + span_class + "'>" + oObj.itemnotes_nonpublic + "</span>"
+ title += " - <span class='" + span_class + "'>" + oObj.itemnotes_nonpublic.escapeHtml() + "</span>"
}
var onsite_checkout = '';
+ "#"
+ oObj.itemnumber
+ "'>"
- + oObj.barcode
+ + oObj.barcode.escapeHtml()
+ "</a>"
+ onsite_checkout;
},
"sType": "anti-the"
},
- { "mDataProp": "itemtype" },
- { "mDataProp": "location" },
- { "mDataProp": "issuedate_formatted" },
- { "mDataProp": "branchname" },
- { "mDataProp": "itemcallnumber" },
+ {
+ "mDataProp": function ( oObj ) {
+ return oObj.itemtype_description.escapeHtml();
+ }
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ return ( oObj.collection ? oObj.collection.escapeHtml() : '' );
+ }
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ return ( oObj.location ? oObj.location.escapeHtml() : '' );
+ }
+ },
+ {
+ "mDataProp": "issuedate",
+ "bVisible": false,
+ },
+ {
+ "iDataSort": 7, // Sort on hidden unformatted issuedate column
+ "mDataProp": "issuedate_formatted",
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ return oObj.branchname.escapeHtml();
+ }
+ },
+ {
+ "mDataProp": function ( oObj ) {
+ return ( oObj.itemcallnumber ? oObj.itemcallnumber.escapeHtml() : '' );
+ }
+ },
{
"mDataProp": function ( oObj ) {
if ( ! oObj.charge ) oObj.charge = 0;
{
"mDataProp": function( oObj ) {
return "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=" + oObj.borrowernumber + "'>"
- + oObj.borrower.firstname + " " + oObj.borrower.surname + " (" + oObj.borrower.cardnumber + ")</a>"
+ + oObj.borrower.firstname.escapeHtml()
+ + " " +
+ oObj.borrower.surname.escapeHtml()
+ + " (" + oObj.borrower.cardnumber.escapeHtml() + ")</a>"
}
},
],