Koha/koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js
Owen Leonard 38b94cf964
Bug 34478: Item removal deletion should be POSTed form
This patch updates the "Remove" button from items which are in a
rotating collection (in the "Manage items" stage). A GET link is
converted to a posted form.

Unrelated: The JavaScript has also been modified so that it asks for
confirmation.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:59:39 +01:00

32 lines
952 B
JavaScript

/* global _ dataTablesDefaults */
$(document).ready(function(){
$("#barcode").focus();
$(".confirmdelete").click(function(){
return confirm( __("Are you sure you want to delete this rotating collection?"));
});
$(".removeitem").on("click", function(){
$(this).parents('tr').addClass("warn");
if(confirm(__("Are you sure you want to remove this item?"))){
$(this).parents('form').submit();
return true;
} else {
$(this).parents('tr').removeClass("warn");
return false;
}
});
if( $('#rotating-collections-table').length > 0 ){
$('#rotating-collections-table').dataTable($.extend(true, {}, dataTablesDefaults, {
"autoWidth": false,
"columnDefs": [
{ "targets": [ -1 ], "orderable": false, "searchable": false },
],
"pagingType": "full"
} ));
}
});