Index: openacs-4/contrib/obsolete-packages/acs-workflow/sql/postgresql/workflow-case-package-body.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/acs-workflow/sql/postgresql/workflow-case-package-body.sql,v
diff -u -r1.2 -r1.3
--- openacs-4/contrib/obsolete-packages/acs-workflow/sql/postgresql/workflow-case-package-body.sql	24 Dec 2001 02:50:17 -0000	1.2
+++ openacs-4/contrib/obsolete-packages/acs-workflow/sql/postgresql/workflow-case-package-body.sql	3 Jan 2002 00:58:44 -0000	1.3
@@ -2047,8 +2047,24 @@
         return 0; 
 end;' language 'plpgsql';
 
+create function workflow_case__get_task_id (integer, integer)
+returns integer as '
+declare
+  get_task_id__case_id         alias for $1;
+  get_task_id__transition_key  alias for $2;
+  v_task_id                    integer;
+begin
 
+  select task_id into v_task_id
+  from wf_tasks
+  where case_id = get_task_id__case_id and
+    transition_key = get_task_id__transition_key;
 
--- show errors
+  if not found then
+    raise error ''Case % has no transition with key %'', get_task_id__case_id, get_task_id__transition_key;
 
+  return v_task_id;
 
+end;' language 'plpgsql';
+
+
