Bug 34478: Corrections to some serials scripts
This patch updates the serials toolbar and related JS so that delete, close, and reopen are all POST operations. The patch also fixes an incorrect op check in the subscription search popup. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
63a51acc83
commit
f2394c8c09
|
|
@ -40,7 +40,12 @@
|
|||
|
||||
[% IF ( CAN_user_serials_delete_subscription ) %]
|
||||
<li>
|
||||
<a href="#" id="deletesub">Delete subscription</a>
|
||||
<form action="subscription-detail.pl" method="post">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-del" />
|
||||
<input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
|
||||
<button type="submit" class="btn btn-default" id="deletesub">Delete subscription</button>
|
||||
</form>
|
||||
</li>
|
||||
[% END %]
|
||||
</ul>
|
||||
|
|
@ -57,9 +62,23 @@
|
|||
[% END %]
|
||||
[% UNLESS cannotedit %]
|
||||
[% IF closed %]
|
||||
<div class="btn-group"><a id="reopen" class="btn btn-default" href="#"><i class="fa-solid fa-arrow-rotate-right"></i> Reopen</a></div>
|
||||
<div class="btn-group">
|
||||
<form action="subscription-detail.pl" method="post">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-reopen" />
|
||||
<input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
|
||||
<button type="submit" class="btn btn-default" id="reopen"><i class="fa-solid fa-arrow-rotate-right"></i> Reopen</button>
|
||||
</form>
|
||||
</div>
|
||||
[% ELSE %]
|
||||
<div class="btn-group"><a id="close" class="btn btn-default" href="#"><i class="fa fa-times-circle"></i> Close</a></div>
|
||||
<div class="btn-group">
|
||||
<form action="subscription-detail.pl" method="post">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-close" />
|
||||
<input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
|
||||
<button type="submit" class="btn btn-default" id="close"><i class="fa fa-times-circle"></i> Close</button>
|
||||
</form>
|
||||
</div>
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
|
|
|||
|
|
@ -1,40 +1,18 @@
|
|||
/* global subscriptionid */
|
||||
/* global subscriptionid __ */
|
||||
|
||||
function confirm_close() {
|
||||
var is_confirmed = confirm( __("Are you sure you want to close this subscription?") );
|
||||
if (is_confirmed) {
|
||||
window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=close";
|
||||
}
|
||||
}
|
||||
function confirm_reopen() {
|
||||
var is_confirmed = confirm( __("Are you sure you want to reopen this subscription?") );
|
||||
if (is_confirmed) {
|
||||
window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=reopen";
|
||||
}
|
||||
}
|
||||
|
||||
function confirm_deletion() {
|
||||
var is_confirmed = confirm( __("Are you sure you want to delete this 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;
|
||||
$("#deletesub").on("click", function(){
|
||||
return confirm( __("Are you sure you want to delete this subscription?") );
|
||||
});
|
||||
$("#reopen").click(function(){
|
||||
confirm_reopen();
|
||||
return false;
|
||||
return confirm( __("Are you sure you want to reopen this subscription?") );
|
||||
});
|
||||
$("#close").click(function(){
|
||||
confirm_close();
|
||||
return false;
|
||||
$("#close").on("click", function(){
|
||||
return confirm( __("Are you sure you want to close this subscription?") );
|
||||
});
|
||||
$("#renew").click(function(){
|
||||
popup( subscriptionid );
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ my $itype_or_itemtype =
|
|||
my $query = $input->param('q');
|
||||
|
||||
# don't run the search if no search term !
|
||||
if ( $op eq "cud-do_search" && $query ) {
|
||||
if ( $op eq "do_search" && $query ) {
|
||||
|
||||
( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ my $dbh = C4::Context->dbh;
|
|||
my $subscriptionid = $query->param('subscriptionid');
|
||||
my $subscription = Koha::Subscriptions->find( $subscriptionid );
|
||||
|
||||
if ( $op and $op eq "close" ) {
|
||||
if ( $op and $op eq "cud-close" ) {
|
||||
C4::Serials::CloseSubscription( $subscriptionid );
|
||||
} elsif ( $op and $op eq "reopen" ) {
|
||||
} elsif ( $op and $op eq "cud-reopen" ) {
|
||||
C4::Serials::ReopenSubscription( $subscriptionid );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue