Koha/koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js
Jonathan Druart d86ff0f5db Bug 20778: (bug 19777 follow-up) Fix subscription deletion
Caused by
  commit 666a1b2760
  Bug 19777: Move template JavaScript to the footer: Serials, part 3

TT vars should not be used in .js files

Test plan:
Delete a subscription, confirm you see the confirmation popup and that
the it deletes the subscription correctly after it has been confirmed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-06-08 09:48:12 -04:00

43 lines
1.3 KiB
JavaScript

/* global MSG_CLOSE_SUBSCRIPTION MSG_REOPEN_SUBSCRIPTION CONFIRM_DELETE_SUBSCRIPTION subscriptionid */
function confirm_close() {
var is_confirmed = confirm( MSG_CLOSE_SUBSCRIPTION );
if (is_confirmed) {
window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=close";
}
}
function confirm_reopen() {
var is_confirmed = confirm( MSG_REOPEN_SUBSCRIPTION );
if (is_confirmed) {
window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=reopen";
}
}
function confirm_deletion() {
var is_confirmed = confirm( CONFIRM_DELETE_SUBSCRIPTION );
if (is_confirmed) {
window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=del";
}
}
function popup(subscriptionid) {
newin=window.open("subscription-renew.pl?mode=popup&subscriptionid="+subscriptionid,'popup','width=590,height=440,toolbar=false,scrollbars=yes');
}
$(document).ready(function() {
$("#deletesub").click(function(){
confirm_deletion();
return false;
});
$("#reopen").click(function(){
confirm_reopen();
return false;
});
$("#close").click(function(){
confirm_close();
return false;
});
$("#renew").click(function(){
popup( subscriptionid );
return false;
});
});