Bug 27144 - Cannot delete any patrons
Summary: Cannot delete any patrons
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: 20.11
Hardware: All All
: P5 - low critical
Assignee: Joonas Kylmälä
QA Contact: Testopia
URL:
Keywords:
Depends on: 14708
Blocks:
  Show dependency treegraph
 
Reported: 2020-12-03 13:10 UTC by Joonas Kylmälä
Modified: 2022-06-06 20:25 UTC (History)
10 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.01, 20.05.07
Circulation function:


Attachments
Bug 27144: Fix syntax error that prevents deleting patrons (1.07 KB, patch)
2020-12-03 13:26 UTC, Joonas Kylmälä
Details | Diff | Splinter Review
Bug 27144: Fix syntax error that prevents deleting patrons (1.14 KB, patch)
2020-12-03 14:03 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 27144: Fix syntax error that prevents deleting patrons (1.19 KB, patch)
2020-12-04 09:33 UTC, Julian Maurice
Details | Diff | Splinter Review
After fixing bug 27144 (24.11 KB, image/png)
2020-12-11 13:25 UTC, Nishath Ahmed
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joonas Kylmälä 2020-12-03 13:10:23 UTC
The try catch introduced in bug 14708 breaks deletion of borrowers totally via the staff interface, giving 500 error and also it hides the error message in log because it is in try catch so this is very hard to spot in error logs.

To reproduce: go to any patron record and try to delete, you will get http 500 error back.
Comment 1 Joonas Kylmälä 2020-12-03 13:26:22 UTC
Created attachment 114145 [details] [review]
Bug 27144: Fix syntax error that prevents deleting patrons

To test:
 1) In staff interface open up a patron record
 2) Click More -> Delete, and then "Yes, delete"
 3) Notice 500 error
 4) Apply patch
 5) Notice error is now gone when deleting
Comment 2 Kyle M Hall (khall) 2020-12-03 14:03:35 UTC
Created attachment 114147 [details] [review]
Bug 27144: Fix syntax error that prevents deleting patrons

To test:
 1) In staff interface open up a patron record
 2) Click More -> Delete, and then "Yes, delete"
 3) Notice 500 error
 4) Apply patch
 5) Notice error is now gone when deleting

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 3 Joonas Kylmälä 2020-12-03 14:19:09 UTC
This might have caused some corruption/duplicated data in the DB, to check if you have any use:

> select count(*) FROM deletedborrowers WHERE borrowernumber IN (SELECT borrowernumber FROM borrowers);
Comment 4 Jonathan Druart 2020-12-03 14:31:10 UTC
(In reply to Joonas Kylmälä from comment #3)
> This might have caused some corruption/duplicated data in the DB, to check
> if you have any use:
> 
> > select count(*) FROM deletedborrowers WHERE borrowernumber IN (SELECT borrowernumber FROM borrowers);

Why, can you detail please?
Comment 5 Andrii Nugged 2020-12-03 16:55:28 UTC
(In reply to Jonathan Druart from comment #4)
> (In reply to Joonas Kylmälä from comment #3)
> > This might have caused some corruption/duplicated data in the DB, to check
> > if you have any use:
> > 
> > > select count(*) FROM deletedborrowers WHERE borrowernumber IN (SELECT borrowernumber FROM borrowers);
> 
> Why, can you detail please?

deletedborrowers pollution happens because first "$patron->move_to_deleted;" succeeds, but then try/catch with "$patron->delete" fails, keeping those deleted records as duplicates.
Comment 6 Andrii Nugged 2020-12-03 16:56:31 UTC
(add) i.e. that might happen on those servers where this fail happened so manual post-check and cleanup in "deletedborrowers" might be required.
Comment 7 Julian Maurice 2020-12-04 09:33:27 UTC
Created attachment 114182 [details] [review]
Bug 27144: Fix syntax error that prevents deleting patrons

To test:
 1) In staff interface open up a patron record
 2) Click More -> Delete, and then "Yes, delete"
 3) Notice 500 error
 4) Apply patch
 5) Notice error is now gone when deleting

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 8 Jonathan Druart 2020-12-04 16:05:07 UTC Comment hidden (obsolete)
Comment 9 Katrin Fischer 2020-12-06 12:54:19 UTC
(In reply to Jonathan Druart from comment #8)
> Pushed to master for 20.05, thanks to everybody involved!

I think the script might need updating? :) 21.05
Comment 10 Fridolin Somers 2020-12-07 08:04:16 UTC
Pushed to 20.11.x for 20.11.01
Comment 11 Jonathan Druart 2020-12-07 16:53:28 UTC
(In reply to Katrin Fischer from comment #9)
> (In reply to Jonathan Druart from comment #8)
> > Pushed to master for 20.05, thanks to everybody involved!
> 
> I think the script might need updating? :) 21.05

Yes!
Pushed to master for 21.05
Comment 12 Jonathan Druart 2020-12-11 11:19:32 UTC
*** Bug 27189 has been marked as a duplicate of this bug. ***
Comment 13 Nishath Ahmed 2020-12-11 13:25:19 UTC
Created attachment 114341 [details]
After fixing bug 27144

Dear All,
I patched this bug by adding semicolon(;) at deletemem.pl, but still I get an unusual error even after setting AnonymousPatron in Global System Preference. 
Please checkout attachment.

Advice is anticipated!

Thanks!
Comment 14 Jonathan Druart 2020-12-11 13:39:12 UTC
(In reply to Nishath Ahmed from comment #13)
> Created attachment 114341 [details]
> After fixing bug 27144
> 
> Dear All,
> I patched this bug by adding semicolon(;) at deletemem.pl, but still I get
> an unusual error even after setting AnonymousPatron in Global System
> Preference. 
> Please checkout attachment.
> 
> Advice is anticipated!
> 
> Thanks!

Are you trying to delete the anonymous patron? Do you get this error with another patron?
Comment 15 Nishath Ahmed 2020-12-12 07:26:41 UTC
Dear Jonathan Druart,
No I set a different user as AnonymousPatron in Global System Preferences and I   
want to delete other patrons like students and staff category. 

Thanks!
Comment 16 Andrew Fuerste-Henry 2020-12-15 20:21:16 UTC
Pushed to 20.05.x for 20.05.07
Comment 17 Victor Grousset/tuxayo 2020-12-17 00:32:01 UTC
Missing dependencies for 19.11.x, can't backport.