1 /* global __ biblionumber count holdcount countorders countdeletedorders searchid addRecord delSingleRecord */
2 /* exported GetZ3950Terms PopupZ3950Confirmed */
3 /* IF ( CAN_user_editcatalogue_edit_catalogue ) */
4 /* this function open a popup to search on z3950 server. */
5 function PopupZ3950() {
6 var strQuery = GetZ3950Terms();
8 window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=" + biblionumber + strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
11 function PopupZ3950Confirmed() {
12 if (confirm( __("Please note that this external search could replace the current record.") )) {
16 /* END IF( CAN_user_editcatalogue_edit_catalogue ) */
19 addRecord( biblionumber );
22 function addToShelf() { window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=' + biblionumber,'Add_to_virtualshelf','width=500,height=400,toolbar=false,scrollbars=yes');
24 function printBiblio() {window.print(); }
26 /* IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */
28 function confirm_deletion(link) {
29 var order_manage_permission = $(link).data("order-manage");
32 is_confirmed = alert(__("%s item(s) are attached to this record. You must delete all items before deleting this record.").format(count));
33 } else if (countorders > 0){
34 if( order_manage_permission ){
35 is_confirmed = confirm(__("Warning: This record is used in %s order(s). Deleting it could cause serious issues on acquisition module. Are you sure you want to delete this record?").format(countorders));
37 is_confirmed = alert(__("%s order(s) are using this record. You need order managing permissions to delete this record.").format(countorders));
39 } else if (countdeletedorders > 0){
40 if( order_manage_permission ){
41 is_confirmed = confirm(__("%s deleted order(s) are using this record. Are you sure you want to delete this record?").format(countdeletedorders));
43 is_confirmed = alert(__("%s deleted order(s) are using this record. You need order managing permissions to delete this record.").format(countdeletedorders));
45 } else if ( holdcount > 0 ) {
46 is_confirmed = confirm( __("%s holds(s) for this record. Are you sure you want to delete this record?").format(holdcount));
48 is_confirmed = confirm( __("Are you sure you want to delete this record?") );
51 $("#deletebiblio").unbind('click');
52 window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&biblionumber=" + biblionumber + (searchid ? "&searchid="+searchid : "");
58 /* END IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */
60 /* IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */
62 function confirm_items_deletion() {
63 if ( holdcount > 0 ) {
64 alert(__("%s hold(s) on this record. You must delete all holds before deleting all items.").format(holdcount));
65 } else if ( count > 0 ) {
66 if (confirm(__("Are you sure you want to delete the %s attached items?").format(count))) {
67 window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&biblionumber=" + biblionumber + (searchid ? "&searchid="+searchid : "");
77 function alertNoItems(){
78 alert( __("This record has no items.") );
81 /* END IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */
83 $(document).ready(function() {
84 $("#z3950copy").click(function(){
88 $("#deletebiblio").click(function(){
89 confirm_deletion(this);
92 $("#deleteallitems").click(function(){
93 confirm_items_deletion();
96 $("#printbiblio").click(function(){
101 $(".addtocart").on("click", function (e) {
103 var selection_id = this.id;
104 var biblionumber = selection_id.replace("cart", "");
105 addRecord(biblionumber);
108 $(".cartRemove").on("click", function (e) {
110 var selection_id = this.id;
111 var biblionumber = selection_id.replace("cartR", "");
112 delSingleRecord(biblionumber);
113 $(".addtocart").html("<i class=\"fa fa-shopping-cart\"></i> " + __("Add to cart"));
116 $("#addtoshelf").click(function(){
118 $(".btn-group").removeClass("open");
121 $("#export").remove(); // Hide embedded export form if JS menus available
122 $("#deletebiblio").tooltip();
123 $("#batchedit-disabled,#batchdelete-disabled,#deleteallitems-disabled")
124 .on("click",function(e){
130 $(".addtolist").on("click", function (e) {
132 var shelfnumber = $(this).data("shelfnumber");
133 if ($(this).hasClass("morelists")) {
134 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=' + biblionumber);
135 } else if ($(this).hasClass("newlist")) {
136 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&biblionumber=' + biblionumber);
138 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber=' + shelfnumber + '&confirm=1&biblionumber=' + biblionumber);