+/* global __ dataTablesDefaults borrowernumber SuspendHoldsIntranet */
$(document).ready(function() {
var holdsTable;
function load_holds_table() {
var holds = new Array();
if ( ! holdsTable ) {
- holdsTable = $("#holds-table").dataTable({
+ var title;
+ holdsTable = $("#holds-table").dataTable($.extend(true, {}, dataTablesDefaults, {
"bAutoWidth": false,
"sDom": "rt",
"columns": [
{
- "mDataProp": "reservedate_formatted"
+ "data": { _: "reservedate_formatted", "sort": "reservedate" }
},
{
"mDataProp": function ( oObj ) {
+ oObj.title.escapeHtml();
$.each(oObj.subtitle, function( index, value ) {
- title += " " + value.subfield.escapeHtml();
+ title += " " + value.escapeHtml();
});
+ title += " " + oObj.part_number + " " + oObj.part_name;
+
+ if ( oObj.enumchron ) {
+ title += " (" + oObj.enumchron.escapeHtml() + ")";
+ }
+
title += "</a>";
if ( oObj.author ) {
- title += " " + BY.replace( "_AUTHOR_", oObj.author.escapeHtml() );
+ title += " " + __("by _AUTHOR_").replace("_AUTHOR_", oObj.author.escapeHtml());
}
if ( oObj.itemnotes ) {
"mDataProp": function( oObj ) {
var data = "";
if ( oObj.barcode ) {
- data += " <a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
+ data += " <a href='/cgi-bin/koha/catalogue/moredetail.pl?biblionumber="
+ oObj.biblionumber
+ "&itemnumber="
+ oObj.itemnumber
- + "#"
+ + "#item"
+ oObj.itemnumber
+ "'>"
+ oObj.barcode.escapeHtml()
if( oObj.branches[i].selected ){
selectedbranch = " selected='selected' ";
- setbranch = CURRENT;
- }
- else{
+ setbranch = __(" (current) ");
+ } else if ( oObj.branches[i].pickup_location == 0 ) {
+ continue;
+ } else{
selectedbranch = '';
setbranch = '';
}
else { return oObj.branchcode.escapeHtml() || ""; }
}
},
- { "mDataProp": "expirationdate_formatted" },
+ { "data": { _: "expirationdate_formatted", "sort": "expirationdate" } },
{
"mDataProp": function( oObj ) {
if ( oObj.priority && parseInt( oObj.priority ) && parseInt( oObj.priority ) > 0 ) {
"bSortable": false,
"mDataProp": function( oObj ) {
return "<select name='rank-request'>"
- + "<option value='n'>" + NO + "</option>"
- + "<option value='del'>" + YES + "</option>"
+ +"<option value='n'>" + __("No") + "</option>"
+ +"<option value='del'>" + __("Yes") + "</option>"
+ "</select>"
+ "<input type='hidden' name='biblionumber' value='" + oObj.biblionumber + "'>"
+ "<input type='hidden' name='borrowernumber' value='" + borrowernumber + "'>"
},
{
"bSortable": false,
+ "visible": SuspendHoldsIntranet,
"mDataProp": function( oObj ) {
holds[oObj.reserve_id] = oObj; //Store holds for later use
return "";
} else if ( oObj.suspend == 1 ) {
return "<a class='hold-resume btn btn-default btn-xs' id='resume" + oObj.reserve_id + "'>"
- + "<i class='fa fa-play'></i> " + RESUME + "</a>";
+ +"<i class='fa fa-play'></i> " + __("Resume") + "</a>";
} else {
return "<a class='hold-suspend btn btn-default btn-xs' id='suspend" + oObj.reserve_id + "'>"
- + "<i class='fa fa-pause'></i> " + SUSPEND + "</a>";
+ +"<i class='fa fa-pause'></i> " + __("Suspend") + "</a>";
}
}
},
var data = "";
if ( oObj.suspend == 1 ) {
- data += "<p>" + HOLD_IS_SUSPENDED;
+ data += "<p>" + __("Hold is <strong>suspended</strong>");
if ( oObj.suspend_until ) {
- data += " " + UNTIL.format( oObj.suspend_until_formatted );
+ data += " " + __("until %s").format(oObj.suspend_until_formatted);
}
data += "</p>";
}
if ( oObj.itemtype_limit ) {
- data += NEXT_AVAILABLE_ITYPE.format( oObj.itemtype_limit );
+ data += __("Next available %s item").format(oObj.itemtype_limit);
}
if ( oObj.barcode ) {
if ( oObj.found == "W" ) {
if ( oObj.waiting_here ) {
- data += ITEM_IS_WAITING_HERE;
+ data += __("Item is <strong>waiting here</strong>");
+ if (oObj.desk_name) {
+ data += ", " + __("at %s").format(oObj.desk_name.escapeHtml());
+ }
} else {
- data += ITEM_IS_WAITING;
- data += " " + AT.format( oObj.waiting_at );
+ data += __("Item is <strong>waiting</strong>");
+ data += " " + __("at %s").format(oObj.waiting_at);
+ if (oObj.desk_name) {
+ data += ", " + __("at %s").format(oObj.desk_name.escapeHtml());
+ }
+
}
} else if ( oObj.transferred ) {
- data += ITEM_IS_IN_TRANSIT.format( oObj.from_branch, oObj.date_sent );
+ data += __("Item is <strong>in transit</strong> from %s since %s").format(oObj.from_branch, oObj.date_sent);
} else if ( oObj.not_transferred ) {
- data += NOT_TRANSFERRED_YET.format( oObj.not_transferred_by );
+ data += __("Item hasn't been transferred yet from %s").format(oObj.not_transferred_by);
}
data += "</em>";
}
return data;
}
- }
+ }
],
"bPaginate": false,
"bProcessing": true,
d.borrowernumber = borrowernumber;
}
},
- });
+ }));
$('#holds-table').on( 'draw.dt', function () {
$(".hold-suspend").on( "click", function() {
holdsTable.api().ajax.reload();
} else {
if ( data.error == "HOLD_NOT_FOUND" ) {
- alert ( RESUME_HOLD_ERROR_NOT_FOUND );
+ alert( __("Unable to resume, hold not found") );
holdsTable.api().ajax.reload();
}
}
<form id='suspend-modal-form' class='form-inline'>\
<div class='modal-header'>\
<button type='button' class='closebtn' data-dismiss='modal' aria-hidden='true'>×</button>\
- <h3 id='suspend-modal-label'>" + SUSPEND_HOLD_ON + " <i><span id='suspend-modal-title'></span></i></h3>\
+ <h3 id='suspend-modal-label'>" + __("Suspend hold on") + " <i><span id='suspend-modal-title'></span></i></h3>\
</div>\
\
<div class='modal-body'>\
<input type='hidden' id='suspend-modal-reserve_id' name='reserve_id' />\
\
- <label for='suspend-modal-until'>" + SUSPEND_UNTIL + "</label>\
+ <label for='suspend-modal-until'>" + __("Suspend until:") + "</label>\
<input name='suspend_until' id='suspend-modal-until' class='suspend-until' size='10' />\
\
- <p/><a class='btn btn-link' id='suspend-modal-clear-date' >" + CLEAR_DATE_TO_SUSPEND_INDEFINITELY + "</a></p>\
+ <p><a class='btn btn-link' id='suspend-modal-clear-date' >" + __("Clear date to suspend indefinitely") + "</a></p>\
\
</div>\
\
<div class='modal-footer'>\
- <button id='suspend-modal-submit' class='btn btn-primary' type='submit' name='submit'>" + SUSPEND + "</button>\
- <a href='#' data-dismiss='modal' aria-hidden='true' class='cancel'>" + CANCEL + "</a>\
+ <button id='suspend-modal-submit' class='btn btn-primary' type='submit' name='submit'>" + __("Suspend") + "</button>\
+ <a href='#' data-dismiss='modal' aria-hidden='true' class='cancel'>" + __("Cancel") + "</a>\
</div>\
</form>\
</div>\
holdsTable.api().ajax.reload();
} else {
if ( data.error == "INVALID_DATE" ) {
- alert( SUSPEND_HOLD_ERROR_DATE );
+ alert( __("Unable to suspend hold, invalid date") );
}
else if ( data.error == "HOLD_NOT_FOUND" ) {
- alert ( SUSPEND_HOLD_ERROR_NOT_FOUND );
+ alert( __("Unable to suspend hold, hold not found") );
holdsTable.api().ajax.reload();
}
}
});
});
-
});