Koha/koha-tmpl/intranet-tmpl/prog/js/cart.js
Jonathan Druart c9a7b6742b Bug 19290: Browse selected bibliographic records - Staff interface
This patch adds the same feature as bug 10858 for the OPAC interface:
after a search, librarians will be able to browse selected results.
The results can be selected from several pages.
By extension it is possible to add results from several pages to a list
or the cart.

When at least one result is selected, a new "Browse selected records" button
becomes usable and change the behaviour of the existing browser.

The whole feature can be turned off with the pref BrowseResultSelection.

Test plan:
- Launch a search (on the staff interface)
- Check some biblios
- Go on another page
- Check some biblios
- Come back to a page you already check results and confirm that they are
still checked
- Click on the "Browse selected records" button
- Check that you are able to browse results you had checked.

You can also:
- add them to the cart
- add them to a list

QA note: the browsers at the OPAC and the one at the staff interface are completely different
That's why the code is not mimicking what has been done on bug 10858.
The behaviour must stay the same anyway.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-02-19 16:13:30 -03:00

158 lines
3.9 KiB
JavaScript

function placeHold () {
var checkedItems = $("input:checkbox:checked");
if ($(checkedItems).size() === 0) {
alert(MSG_NO_RECORD_SELECTED);
return false;
}
var newloc;
if ($(checkedItems).size() > 1) {
var bibs = "";
$(checkedItems).each(function() {
var bib = $(this).val();
bibs += bib + "/";
});
newloc = "/cgi-bin/koha/reserve/request.pl?biblionumbers=" + bibs + "&multi_hold=1";
} else {
var bib = checkedItems[0].value;
newloc = "/cgi-bin/koha/reserve/request.pl?biblionumber=" + bib;
}
window.opener.location = newloc;
window.close();
}
function batchDelete(){
var checkedItems = $("input:checkbox:checked");
if ($(checkedItems).size() === 0) {
alert(MSG_NO_RECORD_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(MSG_NO_RECORD_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&amp;bib_list=" + bibs + "&type=biblio";
window.opener.location = newloc;
window.close();
}
$(document).ready(function(){
$("#items-popover").popover();
$("#CheckAll").click(function(){
var checked = [];
$("#bookbag_form").checkCheckboxes("*", true).each(
function() {
selRecord(this.value,true);
$(this).change();
}
);
return false;
});
$("#CheckNone").click(function(){
var checked = [];
$("#bookbag_form").unCheckCheckboxes("*",true).each(
function() {
selRecord(this.value,false);
$(this).change();
}
);
return false;
});
$(".holdsep").text("| ");
$(".hold").text(_("Place hold"));
$("#downloadcartc").empty();
$("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
"sDom": 't',
"aoColumnDefs": [
{ "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
{ "sType": "anti-the", "aTargets" : [ "anti-the" ] },
{ "sType": "callnumbers", "aTargets" : [ "callnumbers"] }
],
"aaSorting": [[ 1, "asc" ]],
"bPaginate": 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');
});
$(".open_title").on("click",function(e){
e.preventDefault();
openBiblio( this.href );
});
$(".select_record").on("change",function(){
selRecord( this.value, this.checked );
});
});