From 645b1f52379966e489f417e0173d5950e4ebc8f9 Mon Sep 17 00:00:00 2001 From: Aleisha Date: Wed, 20 Jul 2016 22:14:05 +0000 Subject: [PATCH] Bug 16949: Batch record deletion says success when no records have been passed in The reason this happens is because the page will say success when the total number of records given equals the total number of successful deletions. If you pass in no records, there are no successful deletions --> 0 = 0 --> it thinks it has been successful. This patch adds a check that validates if any checkboxes were selected before submitting the final form. I have removed the check for if any records were selected AFTER the form has been submitted because it seemed unnecessary if the form can't be submitted without selection of records anyway. To test: 1) Go to Tools -> Batch record deletion 2) Put in a record number and click Continue 3) Deselect the record so that it doesn't actually delete and click Delete selected records 4) Page says 'All records have been deleted successfully!' 5) Apply patch. Go back and repeat step 3 6) Form should not submit and you should receive an alert saying that no records have been selected. 7) If you try selecting and deleting a record after this alert, it should still work Note: Have also changed the wording of error in Step 1 when you are entering record numbers to delete. Sponsored-by: Catalyst IT Signed-off-by: Owen Leonard Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- .../en/modules/tools/batch_delete_records.tt | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt index 6f6f58aa2b..ceb5bd4186 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt @@ -60,6 +60,26 @@ $(document).ready(function() { "aaSorting": [], "bPaginate": false })); + + function Checkbox(){ + var form = document.getElementById('selectrecords'); + var inputs = form.getElementsByTagName('input'); + var checked = false; + for (var i=0; i @@ -150,7 +170,7 @@ $(document).ready(function() { | Select without items | Select without holds -
+ -- 2.39.5