Bug 22136: Added 'ExtendedPatronAttributes' notes to 'Import Patrons' notes.
[koha.git] / koha-tmpl / intranet-tmpl / prog / js / cart.js
1
2 function placeHold () {
3     var checkedItems = $("input:checkbox:checked");
4     if ($(checkedItems).size() === 0) {
5         alert(MSG_NO_RECORD_SELECTED);
6         return false;
7     }
8
9     var newloc;
10
11     if ($(checkedItems).size() > 1) {
12         var bibs = "";
13         $(checkedItems).each(function() {
14             var bib = $(this).val();
15             bibs += bib + "/";
16         });
17
18         newloc = "/cgi-bin/koha/reserve/request.pl?biblionumbers=" + bibs + "&multi_hold=1";
19     } else {
20         var bib = checkedItems[0].value;
21         newloc = "/cgi-bin/koha/reserve/request.pl?biblionumber=" + bib;
22     }
23
24     window.opener.location = newloc;
25     window.close();
26 }
27
28 function batchDelete(){
29     var checkedItems = $("input:checkbox:checked");
30     if ($(checkedItems).size() === 0) {
31         alert(MSG_NO_RECORD_SELECTED);
32         return false;
33     }
34     var newloc;
35
36     var bibs = "";
37     checkedItems.each(function() {
38         var bib = $(this).val();
39         bibs += bib + "/";
40     });
41
42     newloc = "/cgi-bin/koha/tools/batch_delete_records.pl?op=list&type=biblio&bib_list=" + bibs;
43
44     window.opener.location = newloc;
45     window.close();
46 }
47
48 function batchModify(){
49     var checkedItems = $("input:checkbox:checked");
50     if ($(checkedItems).size() === 0) {
51         alert(MSG_NO_RECORD_SELECTED);
52         return false;
53     }
54     var newloc;
55
56     var bibs = "";
57     $(checkedItems).each(function() {
58         var bib = $(this).val();
59         bibs += bib + "/";
60     });
61     newloc = "/cgi-bin/koha/tools/batch_record_modification.pl?op=list&bib_list=" + bibs + "&type=biblio";
62
63     window.opener.location = newloc;
64     window.close();
65 }
66
67 $(document).ready(function(){
68     $("#items-popover").popover();
69     $("#CheckAll").click(function(){
70     var checked = [];
71     $("#bookbag_form").checkCheckboxes("*", true).each(
72         function() {
73             selRecord(this.value,true);
74             $(this).change();
75         }
76     );
77         return false;
78     });
79     $("#CheckNone").click(function(){
80     var checked = [];
81     $("#bookbag_form").unCheckCheckboxes("*",true).each(
82         function() {
83             selRecord(this.value,false);
84             $(this).change();
85         }
86     );
87         return false;
88     });
89     $(".holdsep").text("| ");
90     $(".hold").text(_("Place hold"));
91     $("#downloadcartc").empty();
92
93     $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
94         "sDom": 't',
95         "aoColumnDefs": [
96             { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
97             { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
98             { "sType": "callnumbers", "aTargets" : [ "callnumbers"] }
99         ],
100         "aaSorting": [[ 1, "asc" ]],
101         "bPaginate": false
102     }));
103
104     $(".showdetails").on("click",function(e){
105         e.preventDefault();
106         if( $(this).hasClass("showmore") ){
107             showMore();
108         } else {
109             showLess();
110         }
111     });
112
113     $("#batch_modify").on("click",function(e){
114         e.preventDefault();
115         batchModify();
116     });
117     $("#batch_delete").on("click",function(e){
118         e.preventDefault();
119         batchDelete();
120     });
121
122     $("#remove_from_cart").on("click",function(e){
123         e.preventDefault();
124         delSelRecords();
125     });
126
127     $("#add_to_list").on("click",function(e){
128         e.preventDefault();
129         addSelToShelf();
130     });
131
132     $("#place_hold").on("click",function(e){
133         e.preventDefault();
134         placeHold();
135     });
136
137     $("#send_cart").on("click",function(e){
138         e.preventDefault();
139         sendBasket();
140     });
141
142     $("#print_cart").on("click",function(e){
143         e.preventDefault();
144         printBasket();
145     });
146
147     $("#empty_cart").on("click",function(e){
148         e.preventDefault();
149         delBasket('popup');
150     });
151     $(".open_title").on("click",function(e){
152         e.preventDefault();
153         openBiblio( this.href );
154     });
155     $(".select_record").on("change",function(){
156         selRecord( this.value, this.checked );
157     });
158 });