From ff8957b7d586494c2161fb2a3435672f4f19c6c3 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 9 Apr 2009 15:46:49 +0000 Subject: [PATCH] go ahead and sort ancestor list by depth so that tree-ification is not strictly required git-svn-id: svn://svn.open-ils.org/ILS/trunk@12830 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/020.schema.functions.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/sql/Pg/020.schema.functions.sql b/Open-ILS/src/sql/Pg/020.schema.functions.sql index d0fc868863..2ac474120a 100644 --- a/Open-ILS/src/sql/Pg/020.schema.functions.sql +++ b/Open-ILS/src/sql/Pg/020.schema.functions.sql @@ -145,7 +145,8 @@ CREATE OR REPLACE FUNCTION actor.org_unit_ancestors ( INT ) RETURNS SETOF actor. FROM connectby('actor.org_unit'::text,'parent_ou'::text,'id'::text,'name'::text,$1::text,100,'.'::text) AS t(keyid text, parent_keyid text, level int, branch text,pos int) JOIN actor.org_unit a ON a.id::text = t.keyid::text - ORDER BY CASE WHEN a.parent_ou IS NULL THEN 0 ELSE 1 END, a.name; + JOIN actor.org_unit_type tp ON tp.id = a.ou_type + ORDER BY tp.depth, a.name; $$ LANGUAGE SQL STABLE; CREATE OR REPLACE FUNCTION actor.org_unit_descendants ( INT,INT ) RETURNS SETOF actor.org_unit AS $$ -- 2.11.0