Bug 15711: Fixing the 'Delete selected' button on patroncard images
To test: 1) Go to Tools -> Patron Card Creator -> Manage images 2) Upload an image if you haven't already 3) Click Delete selected without selecting any images 4) Notice broken behaviour as described in Description 5) Apply patch, refresh page 6) Click Delete selected without selecting any images 7) Notice alert. Click OK 8) Select one image or more, click Delete selected 9) Notice confirm delete message. Sponsored-by: Catalyst IT Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
1b492938e4
commit
bd3879e037
|
|
@ -5,17 +5,19 @@
|
|||
//<![CDATA[
|
||||
function DeleteConfirm() {
|
||||
var results = selected_images("delete");
|
||||
if (results.images != -1) {
|
||||
if (results.images) {
|
||||
var msg = _("Are you sure you want to delete image(s): %s?").format(results.image_ids);
|
||||
var answer = confirm(msg);
|
||||
if (answer) {
|
||||
window.location = "/cgi-bin/koha/patroncards/image-manage.pl?op=delete&" + results.images;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return; // abort delete
|
||||
}
|
||||
} else {
|
||||
alert(_("Please select image(s) to delete."));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function selected_images(op) {
|
||||
var selected = new Array;
|
||||
var image_ids = new Array;
|
||||
|
|
@ -25,16 +27,15 @@
|
|||
selected.push("image_id=" + document.delete_images.action[i].value);
|
||||
image_ids.push(document.delete_images.action[i].value);
|
||||
}
|
||||
};
|
||||
}
|
||||
images = selected.join("&");
|
||||
return {images:images, image_ids:image_ids};
|
||||
}
|
||||
else if (document.delete_images.action.checked){
|
||||
return {images:"batch_id="+document.delete_images.action.value, image_ids:document.delete_images.action.value};
|
||||
};
|
||||
alert(_("Please select image(s) to %s.").format(op));
|
||||
}
|
||||
return (-1);
|
||||
};
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$("#delete").click(function(){
|
||||
return DeleteConfirm();
|
||||
|
|
|
|||
Loading…
Reference in New Issue