1 /* global __ biblionumber count holdcount countorders countdeletedorders searchid addRecord */
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 ) */
18 function addToCart() { addRecord( biblionumber ); }
19 function addToShelf() { window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=' + biblionumber,'Add_to_virtualshelf','width=500,height=400,toolbar=false,scrollbars=yes');
21 function printBiblio() {window.print(); }
23 /* IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */
25 function confirm_deletion(link) {
26 var order_manage_permission = $(link).data("order-manage");
29 is_confirmed = alert(__("%s item(s) are attached to this record. You must delete all items before deleting this record.").format(count));
30 } else if (countorders > 0){
31 if( order_manage_permission ){
32 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));
34 is_confirmed = alert(__("%s order(s) are using this record. You need order managing permissions to delete this record.").format(countorders));
36 } else if (countdeletedorders > 0){
37 if( order_manage_permission ){
38 is_confirmed = confirm(__("%s deleted order(s) are using this record. Are you sure you want to delete this record?").format(countdeletedorders));
40 is_confirmed = alert(__("%s deleted order(s) are using this record. You need order managing permissions to delete this record.").format(countdeletedorders));
42 } else if ( holdcount > 0 ) {
43 is_confirmed = confirm( __("%s holds(s) for this record. Are you sure you want to delete this record?").format(holdcount));
45 is_confirmed = confirm( __("Are you sure you want to delete this record?") );
48 $("#deletebiblio").unbind('click');
49 window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&biblionumber=" + biblionumber + (searchid ? "&searchid="+searchid : "");
55 /* END IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */
57 /* IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */
59 function confirm_items_deletion() {
60 if ( holdcount > 0 ) {
61 alert(__("%s hold(s) on this record. You must delete all holds before deleting all items.").format(holdcount));
62 } else if ( count > 0 ) {
63 if (confirm(__("Are you sure you want to delete the %s attached items?").format(count))) {
64 window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&biblionumber=" + biblionumber + (searchid ? "&searchid="+searchid : "");
74 function alertNoItems(){
75 alert( __("This record has no items.") );
78 /* END IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */
80 $(document).ready(function() {
81 $("#z3950copy").click(function(){
85 $("#deletebiblio").click(function(){
86 confirm_deletion(this);
89 $("#deleteallitems").click(function(){
90 confirm_items_deletion();
93 $("#printbiblio").click(function(){
97 $("#addtocart").click(function(){
99 $(".btn-group").removeClass("open");
102 $("#addtoshelf").click(function(){
104 $(".btn-group").removeClass("open");
107 $("#export").remove(); // Hide embedded export form if JS menus available
108 $("#deletebiblio").tooltip();
109 $("#batchedit-disabled,#batchdelete-disabled,#deleteallitems-disabled")
110 .on("click",function(e){