Bug 40324 - moremember.pl crashes when a barred patron doesn't have a borrower_debarments record
Summary: moremember.pl crashes when a barred patron doesn't have a borrower_debarments...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: 24.11
Hardware: PC Linux
: P5 - low minor
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-07 21:14 UTC by Joe Koop
Modified: 2025-07-08 14:57 UTC (History)
1 user (show)

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


Attachments
Entire log. Is very short. (623 bytes, text/x-log)
2025-07-07 21:14 UTC, Joe Koop
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Koop 2025-07-07 21:14:22 UTC
Created attachment 183850 [details]
Entire log. Is very short.

(I've replaced my domain name(s) and hostname(s) with MY_DOMAIN below)

I click on the patron like normal in the table that shows which copy of the book is out to which patron, and I'm served a 500 error page.

The URL the link goes to is MY_DOMAIN/cgi-bin/koha/members/moremember.pl?borrowernumber=2518

I've attached the entirety of plack-error.log. The log file must've rotated recently.

Koha version:	24.11.04.000
OS version ('uname -a'):	Linux MY_DOMAIN 6.8.0-63-generic #66-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:25:30 UTC 2025 x86_64
Perl interpreter:	/usr/bin/perl
Perl version:	5.038002
MySQL version:	5.5.5-10.11.13-MariaDB-0ubuntu0.24.04.1
Apache version:	Server version: Apache/2.4.58 (Ubuntu)
PSGI:	Plack (deployment)
Memcached:	Servers: 127.0.0.1:11211 | Namespace: koha_koha | Status: running. | Config read from: koha-conf.xml
Zebra version:	Zebra 2.2.7 (C) 1994-2023, [...] SHA1 ID: ac40f289672405a299436d73c1532f9906774cc6 Using ICU
Zebra status:	Running
Message broker:	Using RabbitMQ
Date and time:	2025-07-07 04:09 PM
Time zone:	Used: America/Winnipeg | Config: America/Winnipeg | Environment (TZ): Undefined

Feel free to ask for more details.
Comment 1 Joe Koop 2025-07-08 14:38:54 UTC
I've done some more poking around.

  0 of my 2150 unrestricted patrons[1] have this issue.
257 of my  827   restricted patrons[2] have this issue.

-----

[1]: SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.debarred, borrowers.debarredcomment FROM borrowers WHERE borrowers.debarred IS NULL AND NOT EXISTS ( SELECT 1 FROM borrower_debarments WHERE borrower_debarments.borrowernumber = borrowers.borrowernumber ) ORDER BY borrowers.cardnumber
[2]: SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.debarred, borrowers.debarredcomment FROM borrowers WHERE borrowers.debarred IS NOT NULL OR EXISTS ( SELECT 1 FROM borrower_debarments WHERE borrower_debarments.borrowernumber = borrowers.borrowernumber ) ORDER BY borrowers.cardnumber
Comment 2 Joe Koop 2025-07-08 14:54:29 UTC
I've done even more poking around.

The patrons who are broken are missing a "borrower_debarments" record.

We have a custom script that wrangles patrons, syncing them with another system, and barring them if they don't exist in the other system. Our custom script must be misbehaving.

There is still an issue, however. Koha should handle missing "borrower_debarments" records, even if it's automatically adding a placeholder one, or doing something else.

I'm leaving this bug open.