From: Jeff Davis Date: Tue, 15 Nov 2022 23:11:49 +0000 (-0800) Subject: LP#1996651: treat empty string as null for preferred name/alias in wide_hold_data X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ee8ff0fd49e4849752da80461e7e8b828084fc77;p=Evergreen.git LP#1996651: treat empty string as null for preferred name/alias in wide_hold_data This prevents the patron name from appearing blank in the hold shelf "User Display Name" or "User Alias or Display Name" columns when the alias or preferred name fields are empty strings. Signed-off-by: Jeff Davis Signed-off-by: Susan Morrison Signed-off-by: Jane Sandberg --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm index c519e63ee0..07a8bfe41d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm @@ -2262,32 +2262,32 @@ SELECT h.id, h.request_time, h.capture_time, h.fulfillment_time, h.checkin_time u.expire_date AS usr_expire_date, u.claims_never_checked_out_count AS usr_claims_never_checked_out_count, u.last_update_time AS usr_last_update_time, - CASE WHEN u.alias IS NOT NULL THEN + CASE WHEN NULLIF(u.alias,'') IS NOT NULL THEN u.alias ELSE u.first_given_name END AS usr_alias_or_first_given_name, - CASE WHEN u.alias IS NOT NULL THEN + CASE WHEN NULLIF(u.alias,'') IS NOT NULL THEN u.alias ELSE REGEXP_REPLACE(ARRAY_TO_STRING(ARRAY[ - COALESCE(u.pref_family_name, u.family_name, ''), - COALESCE(u.pref_suffix, u.suffix, ''), + COALESCE(NULLIF(u.pref_family_name,''), u.family_name, ''), + COALESCE(NULLIF(u.pref_suffix,''), u.suffix, ''), ', ', - COALESCE(u.pref_prefix, u.prefix, ''), - COALESCE(u.pref_first_given_name, u.first_given_name, ''), - COALESCE(u.pref_second_given_name, u.second_given_name, '') + COALESCE(NULLIF(u.pref_prefix,''), u.prefix, ''), + COALESCE(NULLIF(u.pref_first_given_name,''), u.first_given_name, ''), + COALESCE(NULLIF(u.pref_second_given_name,''), u.second_given_name, '') ], ' '), E'\\s+,', ',') END AS usr_alias_or_display_name, REGEXP_REPLACE(ARRAY_TO_STRING(ARRAY[ - COALESCE(u.pref_family_name, u.family_name, ''), - COALESCE(u.pref_suffix, u.suffix, ''), + COALESCE(NULLIF(u.pref_family_name,''), u.family_name, ''), + COALESCE(NULLIF(u.pref_suffix,''), u.suffix, ''), ', ', - COALESCE(u.pref_prefix, u.prefix, ''), - COALESCE(u.pref_first_given_name, u.first_given_name, ''), - COALESCE(u.pref_second_given_name, u.second_given_name, '') + COALESCE(NULLIF(u.pref_prefix,''), u.prefix, ''), + COALESCE(NULLIF(u.pref_first_given_name,''), u.first_given_name, ''), + COALESCE(NULLIF(u.pref_second_given_name,''), u.second_given_name, '') ], ' '), E'\\s+,', ',') AS usr_display_name, uc.id AS ucard_id, uc.barcode AS ucard_barcode, uc.usr AS ucard_usr, uc.active AS ucard_active,