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));
47 } else if (subscriptionscount > 0){
48 is_confirmed = alert(__("%s subscription(s) are attached to this record. You must delete all subscription before deleting this record.").format(subscriptionscount));
50 is_confirmed = confirm( __("Are you sure you want to delete this record?") );
53 $("#deletebiblio").unbind('click');
54 window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&biblionumber=" + biblionumber + (searchid ? "&searchid="+searchid : "");
60 /* END IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */
62 /* IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */
64 function confirm_items_deletion() {
65 if ( holdcount > 0 ) {
66 alert(__("%s hold(s) on this record. You must delete all holds before deleting all items.").format(holdcount));
67 } else if ( count > 0 ) {
68 if (confirm(__("Are you sure you want to delete the %s attached items?").format(count))) {
69 window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&biblionumber=" + biblionumber + (searchid ? "&searchid="+searchid : "");
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(){
98 $(".addtocart").on("click", function (e) {
100 var selection_id = this.id;
101 var biblionumber = selection_id.replace("cart", "");
102 addRecord(biblionumber);
105 $(".cartRemove").on("click", function (e) {
107 var selection_id = this.id;
108 var biblionumber = selection_id.replace("cartR", "");
109 delSingleRecord(biblionumber);
110 $(".addtocart").html("<i class=\"fa fa-shopping-cart\"></i> " + __("Add to cart"));
113 $("#addtoshelf").click(function(){
115 $(".btn-group").removeClass("open");
118 $("#export").remove(); // Hide embedded export form if JS menus available
119 $("#deletebiblio").tooltip();
120 $("#batchedit-disabled,#batchdelete-disabled,#deleteallitems-disabled")
121 .on("click",function(e){
126 $(".addtolist").on("click", function (e) {
128 var shelfnumber = $(this).data("shelfnumber");
129 if ($(this).hasClass("morelists")) {
130 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=' + biblionumber);
131 } else if ($(this).hasClass("newlist")) {
132 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&biblionumber=' + biblionumber);
134 openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber=' + shelfnumber + '&confirm=1&biblionumber=' + biblionumber);