Revamped owner search to show better entries. IO-437

This commit is contained in:
Patrick Fic
2020-12-16 20:40:45 -08:00
parent f326b8ec03
commit a7acaed5d4
8 changed files with 74 additions and 0 deletions

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,18 @@
- args:
cascade: true
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.search_owners (search text)\n\tRETURNS
SETOF owners\n\tLANGUAGE plpgsql\n\tSTABLE\n\tAS $FUNCTION$\nBEGIN\n\tIF search
= '' THEN\n\t\tRETURN query\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\towners;\n\tELSE\n\t\tRETURN
query\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\towners\n\t\tWHERE (ownr_fn || '
' || ownr_ln)\n\t\tILIKE '%' || search || '%'\n\t\t\tOR ownr_ln ILIKE '%' ||
search || '%'\n\t\t\tOR ownr_fn ILIKE '%' || search || '%'\n\t\t\tOR ownr_fn
ILIKE '%' || search || '%'\n\t\t\tOR ownr_co_nm ILIKE '%' || search || '%'\n\t\t\tOR
ownr_ph1 ILIKE '%' || search || '%'\n\t\t\tOR ownr_addr1 ILIKE '%' || search
|| '%'\n\t\tORDER BY\n\t\t\t(ownr_fn || ' ' || ownr_ln)\n\t\t\tILIKE '%' ||
search || '%'\n\t\t\tOR NULL,\n\t\t\townr_ln ILIKE '%' || search || '%'\n\t\t\tOR
NULL,\n\t\t\townr_fn ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\townr_co_nm
ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\townr_fn ILIKE '%' || search
|| '%'\n\t\t\tOR NULL,\n\t\t\townr_ph1 ILIKE '%' || search || '%'\n\t\t\tOR
NULL,\n\t\t\townr_addr1 ILIKE '%' || search || '%'\n\t\t\tOR NULL;\n\tEND IF;\nEND\n$FUNCTION$;"
type: run_sql