Bug 41780

Summary: Show firstname if preferred_name is empty in moremember.tt
Product: Koha Reporter: Ayoub Glizi-Vicioso <ayoub.glizi-vicioso>
Component: PatronsAssignee: Ayoub Glizi-Vicioso <ayoub.glizi-vicioso>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: gmcharlt, kyle
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28633
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 28633    
Bug Blocks:    
Attachments: Bug 41780 - Show firstname if preferred_name is empty

Description Ayoub Glizi-Vicioso 2026-02-05 20:43:37 UTC
Since bz28633, the patron's firstname is no longer displayed in the staff interface (moremember.tt) if the 'preferred_name' field is NULL or empty.

This issue occurs when patrons are imported via external scripts (like Activitek) that do not automatically populate 'preferred_name' with the 'firstname' value.
Comment 1 Ayoub Glizi-Vicioso 2026-02-05 21:31:07 UTC Comment hidden (obsolete)
Comment 2 Ayoub Glizi-Vicioso 2026-02-05 21:31:54 UTC
To reproduce this issue, you will need to:

Option 1: 

1- Create a patron via the staff interface 
2- Set the patron preferred name to null, using : 
    --> UPDATE borrowers SET preferred_name = NULL WHERE borrowernumber = [specify the patron's borrowernumber that you just created];

Option 2:

1-ADD patron directly in BD.
Comment 3 Ayoub Glizi-Vicioso 2026-02-06 16:48:47 UTC
Created attachment 192651 [details] [review]
Bug 41780 - Show firstname if preferred_name is empty

To test:

BEFORE APPLYING PATCH:

1- Create a new patron( Patrons > +New patron ), WITHOUT entering any preferred name, via the staff interface.
    --> Notice that once added, if you edit the patron you just created,
    the preferred name field will have been automatically filled to match the patron first name.

2- Set your patron's preferred name to NULL through this SQL request:
    --> UPDATE borrowers SET preferred_name = NULL WHERE borrowernumber = [borrowernumber located in the URL];

3- Make sure that the preferred name field of which you set to NULL is empty ( Patron details page > Edit).

4- Go back to the patron's main information page.
    --> Notice that only the surname shows up.

5- Apply this patch.

AFTER APPLYING PATCH:

6- Refresh the  page (Ctrl + r and F5).

7- Notice that the first name is now also displayed.

8- Open the 'edit patron' form and you will see that the preferred name field is still empty.