Bug 15079 - Batch Delete Records Error
Summary: Batch Delete Records Error
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major (vote)
Assignee: Kyle M Hall
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-29 11:47 UTC by Kyle M Hall
Modified: 2017-06-14 22:11 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 15079 - Batch Delete Records Error (1.15 KB, patch)
2015-10-29 11:50 UTC, Kyle M Hall
Details | Diff | Splinter Review
[SIGNED-OFF]Bug 15079 - Batch Delete Records Error (1.27 KB, patch)
2015-11-02 21:57 UTC, Héctor Eduardo Castro Avalos
Details | Diff | Splinter Review
Bug 15079 - Batch Delete Records Error (1.47 KB, patch)
2015-11-13 09:28 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall 2015-10-29 11:47:48 UTC
When using the batch deletion tool, if the script attempts to delete an undeletable item, the script will die with the error:

Label not found for "next BIBLIONUMBER" at /usr/share/koha/intranet/cgi-bin/tools/batch_delete_records.pl line 172.
Comment 1 Kyle M Hall 2015-10-29 11:50:31 UTC Comment hidden (obsolete)
Comment 2 Héctor Eduardo Castro Avalos 2015-10-29 22:07:49 UTC
Hi Kyle

Another kind of error occur when you only enter one record with an item checked out.

The record is highlighted but let delete it with message " All records have been deleted successfully! ", but when you go to see the record, the record still there.

I think if only one record exist with an item that cannot deleted, the module must prevent to perform the action in some way.

Regards
Comment 3 Héctor Eduardo Castro Avalos 2015-10-29 22:25:26 UTC
Hi Kyle

I cannot reproduce the error. Is this in master?
I'm testing with a fresh installation with only three records (one ítem per record and just one with item that cannot be deleted), but works well for me.

Regards
Comment 4 Kyle M Hall 2015-10-30 12:46:49 UTC
It may be that I'm test plan is incomplete. I spotted the error after a library reported the issue. The bad label clearly exists in master, but the problem records had already been removed so I was unable to reproduce the issue.
Comment 5 Kyle M Hall 2015-11-02 14:45:16 UTC
Looks like the issue is related to deleteditems having the same itemnumber is an item that is going to be deleted:

http://screencast.com/t/jTd5b2DcB3A

After clearing out duplicate itemnumber from deleteditems:

http://screencast.com/t/PJxpEkf1DP
Comment 6 Héctor Eduardo Castro Avalos 2015-11-02 21:55:16 UTC
(In reply to Kyle M Hall from comment #5)
> Looks like the issue is related to deleteditems having the same itemnumber
> is an item that is going to be deleted:
> 
> http://screencast.com/t/jTd5b2DcB3A
> 
> After clearing out duplicate itemnumber from deleteditems:
> 
> http://screencast.com/t/PJxpEkf1DP

How itemnumber is corrupted in the table?  I mean it is a unique Id even though if you execute something like this

UPDATE items SET itemnumber='1' WHERE itemnumber='2';
ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'

MYSQL doesn't let to do this kind of operations.
Comment 7 Héctor Eduardo Castro Avalos 2015-11-02 21:57:01 UTC Comment hidden (obsolete)
Comment 8 Jonathan Druart 2015-11-13 09:28:47 UTC
Created attachment 44831 [details] [review]
Bug 15079 - Batch Delete Records Error

When using the batch deletion tool, if the script attempts to delete an
undeletable item, the script will die with the error:

Label not found for "next BIBLIONUMBER" at
/usr/share/koha/intranet/cgi-bin/tools/batch_delete_records.pl line 172.

Test Plan:
1) Attempt to batch delete a record with an item that cannot be deleted
2) Note error
3) Apply this patch
4) Repeat step 1
5) Note the error no longer occurs

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised. Follow comment 5 to reproduce the issue

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
I have not tested this patch, but looking at the code it is obviously a mistake.
If an error occured, we rollback and skip this record.
Comment 9 Tomás Cohen Arazi 2015-11-13 14:34:55 UTC
Patch pushed to master.

Thanks Kyle!
Comment 10 Frédéric Demians 2015-11-29 20:54:09 UTC
This patch has been pushed to 3.20.x, will be in 3.20.6.
Comment 11 Liz Rea 2016-01-06 21:06:42 UTC
Pushed to 3.18.13, and released.