Bug 14632

Summary: Incorrect alert while deleting single item in batch
Product: Koha Reporter: Indranil Das Gupta <indradg>
Component: TemplatesAssignee: Indranil Das Gupta <indradg>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: f.demians, kyle, liz, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15663
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 14676    
Bug Blocks:    
Attachments: Bug 14632 - Fix alert message for single item batch
Bug 14632 - Fix alert message for single item batch
[PASSED QA] Bug 14632 - Fix alert message for single item batch
[PASSED QA] Bug 14632 - Fix alert message for single item batch
[PASSED QA] Bug 14632 [QA Followup] - Restore missing "Delete batch" button.

Description Indranil Das Gupta 2015-08-03 02:14:28 UTC
In "Manage patron card batches", the user is prevented from deleting the items from a single item batch as that would remove the entry from table creator_batches effectively deleting the batch. 

However, the JS alert's message reads as "Please select at least label to delete.". This is incorrect as one item is already selected.
Comment 1 Indranil Das Gupta 2015-08-03 04:23:09 UTC
(In reply to Indranil Das Gupta from comment #0)> 
> However, the JS alert's message reads as "Please select at least label to
> delete.". This is incorrect as one item is already selected.

The function Remove() checks for document.items.action.length > 0. In cases of batches with only a single item / patron, this test fails.
Comment 2 Indranil Das Gupta 2015-08-03 04:39:38 UTC Comment hidden (obsolete)
Comment 3 Frédéric Demians 2015-11-03 12:30:02 UTC Comment hidden (obsolete)
Comment 4 Kyle M Hall (khall) 2015-11-06 14:26:21 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall (khall) 2015-11-06 14:27:24 UTC
Created attachment 44565 [details] [review]
[PASSED QA] Bug 14632 - Fix alert message for single item batch

Fixes the incorrect msg "Please select at least label to delete."
for attempts to delete from single patron batches. Notifies the
user that doing so will delete the batch. It disallows direct
deletion, instead suggests the users to use the 'Delete batch'
option assuming the users know what they are doing.

Test plan
=========

1/ Load a single patron batch in edit mode and attempt to delete
   the single record. The JS alert message will inform that "Please
   select at least label to delete."
2/ Apply patch and refresh page and try to delete the single record
   again.
3/ This time the alert will inform the user that doing so will delete
   the batch and should that be desired action to choose the 'Delete
   batch' option from the toolbar.

Signed-off-by: Frederic Demians <f.demians@tamil.fr>
  It works as before but with an understantable warning message.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Kyle M Hall (khall) 2015-11-06 14:28:28 UTC
Created attachment 44566 [details] [review]
[PASSED QA] Bug 14632 [QA Followup] - Restore missing "Delete batch" button.

This button was removed by accident in bug 14676

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Kyle M Hall (khall) 2015-11-06 14:29:09 UTC
Upping severity due to missing "Delete batch" button. Patch could be split into a separate bug if need be.
Comment 8 Tomás Cohen Arazi (tcohen) 2015-11-06 15:13:22 UTC
Patches pushed to master.

Thanks Indranil and Kyle!
Comment 9 Frédéric Demians 2015-11-29 20:27:20 UTC
This patch has been pushed to 3.20.x, will be in 3.20.6. (1st patch but not the followup.)
Comment 10 Liz Rea 2016-01-06 21:05:57 UTC
Pushed to 3.18.13, and released.