From bbebc0a349d644081febd0d20054e7d1be274a8d Mon Sep 17 00:00:00 2001 From: Imani Thomas Date: Mon, 21 Jul 2025 16:56:34 +0000 Subject: [PATCH] Bug 40459: Preferred name is lost when editing partial record Content-Type: text/plain; charset=utf-8 To test: * on the patron page click edit at the top, entered a preferred name, and hit save * we should see the preferred name being displayed instead of the first name for the user * go back to the main edit page and change the preferred name to a blank space * We should revert back to the first name being used * if we open the edit page back up we should see the first name in the preferred name field * Edit the preferred name again and click on details * open up any of the sections other then contact information * hit the save button on the section without changing anything * you should still see the preferred name you set being used. * open up an individual section other then contact method, change a value, then save * you should still see the preferred name you set being used. * open up the contact information section and save without changing anything * the preferred name should be intact * open up the contact information and change the preferred name, and save. * you should see the new preferred name reflected. * Open up the contact information section, change the preferred name field to a blank and save. * you should see the first name being used now. * Open up the contact information section, and put any number of spaces in the preferred name with nothing else and then save. * you should still see the first name being used. Signed-off-by: CJ Lynce Signed-off-by: Marcel de Rooy --- members/memberentry.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index 6b39df2996..5f15a10555 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -550,7 +550,9 @@ if ( ( !$nok ) and $nodouble and ( $op eq 'cud-insert' or $op eq 'cud-save' ) ) $patron = Koha::Patrons->find($borrowernumber); # Ensure preferred name is set even if not passed because of BorrowerUnwantedFields - $newdata{preferred_name} = undef unless defined $newdata{preferred_name}; + if ( $step == 0 or $step == 1 ) { + $newdata{preferred_name} = undef unless defined $newdata{preferred_name}; + } if ($NoUpdateEmail) { delete $newdata{'email'}; -- 2.39.5