To reproduce: 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! --> Error
Created attachment 53540 [details] [review] 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, firstly, there were records to delete. 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 and refresh page. You may have to go back and resend the form 6) Page should now correctly say 'No record has been deleted. An error occurred.' Sponsored-by: Catalyst IT
Hi Aleisha, What do you think about having a different message if no record is selected? Maybe something like: (...) [% ELSIF op == 'report' %] [% IF report.total_records == 0 %] No records were selected for deletion! [% ELSIF report.total_records == report.total_success %] All records have been deleted successfully! [% ELSIF report.total_success == 0 %] No record has been deleted. An error occurred. [% ELSE %] (...) Marc
(In reply to Marc Véron from comment #2) > Hi Aleisha, > > What do you think about having a different message if no record is selected? > > Maybe something like: > (...) > [% ELSIF op == 'report' %] > [% IF report.total_records == 0 %] > No records were selected for deletion! > [% ELSIF report.total_records == report.total_success %] > All records have been deleted successfully! > [% ELSIF report.total_success == 0 %] > No record has been deleted. An error occurred. > [% ELSE %] > (...) > > Marc ...and maybe an additional link back to the previous screen to give the opportunity to select records.
I think a client-side check is also in order: Don't submit the form if no titles are checked. That's standard for similar interfaces in Koha.
(In reply to Marc Véron from comment #3) > ...and maybe an additional link back to the previous screen to give the > opportunity to select records. There is already a link there that says 'New batch record deletion' after the form has been submitted.
Created attachment 53792 [details] [review] 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. Sponsored-by: Catalyst IT
Hi ALeisha, I applied the patch, cleared the browser cache and tested. Now I get always "No records have been selected" (with or withot items selected in checkboxes).
Created attachment 53870 [details] [review] 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
Created attachment 54127 [details] Can not proceed even if items selected Re-tested, I still can not proceed with items selected, see screenshot.
Created attachment 54901 [details] [review] 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
Created attachment 55438 [details] [review] [SIGNED-OFF] 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 <oleonard@myacpl.org>
Created attachment 55514 [details] [review] 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 <oleonard@myacpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 55515 [details] [review] Bug 16949: Simplify the checkbox checked condition It's easier to use jQuery selector to know if checkboxes are checked. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to master for 16.11, thanks Aleisha, Jonathan!