Koha/koha-tmpl/intranet-tmpl/prog/js/cart.js
Owen Leonard 93866a2320
Bug 34913: DataTables upgrade: Update CSS and option names
This patch makes two categories of changes:

1. CSS changes to accommodate changes in DataTables default CSS and
   markup structure. I've tried to make sure all of our Koha-specific
   styles are still applying.

   This change necessitates a rebuild of staff interface CSS.

2. DataTables option names: In this version of DataTables you can't
   override a default which uses CamelCase (e.g. "pagingType") with one
   in "Hungarian" notation, e.g. "sPaginationType." Since we define many
   default options in prog/js/datatables.js in camel case, any template
   which previously used a Hungarian notation option to override the
   default has now been updated to use the CamelCase version.

   See https://datatables.net/upgrade/1.10-convert#Options for a summary
   of the different option name changes.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-26 15:13:40 +01:00

149 lines
3.8 KiB
JavaScript

/* global __ dataTablesDefaults showMore showLess delSelRecords addSelToShelf sendBasket printBasket delBasket openBiblio selRecord */
function placeHold () {
var checkedItems = $("input:checkbox:checked");
if ($(checkedItems).size() === 0) {
alert( __("No item was selected") );
return false;
}
var bib_params = [];
$(checkedItems).each(function() {
var bib = $(this).val();
bib_params.push("biblionumber=" + bib);
});
if (bib_params.length > 1) {
bib_params.push('multi_hold=1');
}
window.opener.location = "/cgi-bin/koha/reserve/request.pl?" + bib_params.join('&');
window.close();
}
function batchDelete(){
var checkedItems = $("input:checkbox:checked");
if ($(checkedItems).size() === 0) {
alert( __("No item was selected") );
return false;
}
var newloc;
var bibs = "";
checkedItems.each(function() {
var bib = $(this).val();
bibs += bib + "/";
});
newloc = "/cgi-bin/koha/tools/batch_delete_records.pl?op=list&type=biblio&bib_list=" + bibs;
window.opener.location = newloc;
window.close();
}
function batchModify(){
var checkedItems = $("input:checkbox:checked");
if ($(checkedItems).size() === 0) {
alert( __("No item was selected") );
return false;
}
var newloc;
var bibs = "";
$(checkedItems).each(function() {
var bib = $(this).val();
bibs += bib + "/";
});
newloc = "/cgi-bin/koha/tools/batch_record_modification.pl?op=list&bib_list=" + bibs + "&type=biblio";
window.opener.location = newloc;
window.close();
}
$(document).ready(function(){
$("#items-popover").popover();
$("#CheckAll").click(function (e) {
e.preventDefault();
$(".select_record").each(function () {
$(this).prop("checked", true).change();
});
});
$("#CheckNone").click(function (e) {
e.preventDefault();
$(".select_record").each(function () {
$(this).prop("checked", false).change();
});
});
$(".holdsep").text("| ");
$(".hold").text( __("Place hold") );
$("#downloadcartc").empty();
$("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
"dom": 't',
"columnDefs": [
{ "orderable": false, "searchable": false, "targets": [ 'NoSort' ] },
{ "type": "anti-the", "targets": [ "anti-the" ] },
{ "type": "callnumbers", "targets": [ "callnumbers"] }
],
"order": [[ 1, "asc" ]],
"paging": false
}));
$(".showdetails").on("click",function(e){
e.preventDefault();
if( $(this).hasClass("showmore") ){
showMore();
} else {
showLess();
}
});
$("#batch_modify").on("click",function(e){
e.preventDefault();
batchModify();
});
$("#batch_delete").on("click",function(e){
e.preventDefault();
batchDelete();
});
$("#remove_from_cart").on("click",function(e){
e.preventDefault();
delSelRecords();
});
$("#add_to_list").on("click",function(e){
e.preventDefault();
addSelToShelf();
});
$("#place_hold").on("click",function(e){
e.preventDefault();
placeHold();
});
$("#send_cart").on("click",function(e){
e.preventDefault();
sendBasket();
});
$("#print_cart").on("click",function(e){
e.preventDefault();
printBasket();
});
$("#empty_cart").on("click",function(e){
e.preventDefault();
delBasket('popup');
});
$(".title").on("click",function(e){
e.preventDefault();
openBiblio( this.href );
});
$(".select_record").on("change",function(){
selRecord( this.value, this.checked );
});
});