Bug 15982 - Serials numbering patterns can be deleted without warning

A JavaScript alert should ask the user to confirm deletion of a serial
numbering pattern. This patch adds this to the template.

To test, apply the patch and go to Serials -> Manage numbering patterns.

- In the list of patterns, click any "Delete" link.
- Verify that a JavaScript alert is triggered.
- Test that cancelling the alert cancels the deletion operation.
- Test that confirming the alert allows the deletion to complete.

Signed-off-by: Nicole C Engard <nengard@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2016-03-04 12:07:44 -05:00 committed by Brendan A Gallagher
parent a234d27cbe
commit 6179f04c8a

View file

@ -4,6 +4,11 @@
[% INCLUDE 'calendar.inc' %] [% INCLUDE 'calendar.inc' %]
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
function confirmDelete() {
return confirm(_("Are you sure you want to delete this numbering pattern?"));
}
[% IF (new or modify) %] [% IF (new or modify) %]
function testPattern() { function testPattern() {
var frequencyid = $("#frequency").val(); var frequencyid = $("#frequency").val();
@ -57,6 +62,11 @@
function show_blocking_subs() { function show_blocking_subs() {
$("#blocking_subs").show(); $("#blocking_subs").show();
} }
$(document).ready(function(){
$(".delete_pattern").on("click",function(){
return confirmDelete();
});
});
//]]> //]]>
</script> </script>
</head> </head>
@ -318,7 +328,7 @@ function show_blocking_subs() {
<td>[% numberpattern.displayorder %]</td> <td>[% numberpattern.displayorder %]</td>
<td> <td>
<a href="/cgi-bin/koha/serials/subscription-numberpatterns.pl?op=modify&id=[% numberpattern.id %]">Edit</a> | <a href="/cgi-bin/koha/serials/subscription-numberpatterns.pl?op=modify&id=[% numberpattern.id %]">Edit</a> |
<a href="/cgi-bin/koha/serials/subscription-numberpatterns.pl?op=del&id=[% numberpattern.id %]">Delete</a> <a class="delete_pattern" href="/cgi-bin/koha/serials/subscription-numberpatterns.pl?op=del&id=[% numberpattern.id %]">Delete</a>
</td> </td>
</tr> </tr>
[% END %] [% END %]