Document use the function action_get_tree to retrieve all the document directly or indirectly attached
This commit is contained in:
parent
88fdddee5b
commit
5e38098c6c
3 changed files with 38 additions and 3 deletions
33
html/admin/sql/patch/upgrade73.sql
Normal file
33
html/admin/sql/patch/upgrade73.sql
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
begin;
|
||||
DROP FUNCTION if exists comptaproc.get_action_tree();
|
||||
|
||||
CREATE OR REPLACE FUNCTION comptaproc.action_get_tree(p_id bigint)
|
||||
RETURNS setof bigint AS
|
||||
$BODY$
|
||||
|
||||
declare
|
||||
e bigint;
|
||||
i bigint;
|
||||
begin
|
||||
for e in select ag_id from action_gestion where ag_ref_ag_id=p_id
|
||||
loop
|
||||
if e = 0 then
|
||||
return;
|
||||
end if;
|
||||
return next e;
|
||||
for i in select ag_id from action_gestion where ag_ref_ag_id=e
|
||||
loop
|
||||
if i = 0 then
|
||||
return;
|
||||
end if;
|
||||
return next i;
|
||||
end loop;
|
||||
end loop;
|
||||
return;
|
||||
|
||||
end;
|
||||
$BODY$
|
||||
LANGUAGE 'plpgsql' VOLATILE;
|
||||
|
||||
update version set val=74;
|
||||
commit;
|
||||
Loading…
Add table
Add a link
Reference in a new issue