Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-functions-create.sql,v
diff -u -r1.8.2.5 -r1.8.2.6
--- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql	4 Feb 2004 20:17:19 -0000	1.8.2.5
+++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql	5 Feb 2004 23:57:49 -0000	1.8.2.6
@@ -422,7 +422,7 @@
 -- If it is not associated with a project, then it is placed in the root
 -- project repository folder.
 
-select define_function_args('pm_task__new_task_item', 'project_id, title, description, end_date, percent_complete, estimated_hours_work, estimated_hours_work_min, estimated_hours_work_max, creation_date, creation_user, creation_ip, package_id');
+select define_function_args('pm_task__new_task_item', 'project_id, title, description, end_date, percent_complete, estimated_hours_work, estimated_hours_work_min, estimated_hours_work_max, status_id, creation_date, creation_user, creation_ip, package_id');
 
 create function pm_task__new_task_item (
         integer,        -- project_id
@@ -433,6 +433,7 @@
         numeric,        -- estimated_hours_work
         numeric,        -- estimated_hours_work_min
         numeric,        -- estimated_hours_work_max,
+        integer,        -- status_id
         timestamptz,    -- creation_date
         integer,        -- creation_user
         varchar,        -- creation_ip
@@ -448,10 +449,11 @@
         p_estimated_hours_work                  alias for $6;
         p_estimated_hours_work_min              alias for $7;
         p_estimated_hours_work_max              alias for $8;
-        p_creation_date                         alias for $9;
-        p_creation_user                         alias for $10;
-        p_creation_ip                           alias for $11;
-        p_package_id                            alias for $12;
+        p_status_id                             alias for $9;
+        p_creation_date                         alias for $10;
+        p_creation_user                         alias for $11;
+        p_creation_ip                           alias for $12;
+        p_package_id                            alias for $13;
 
         v_item_id               cr_items.item_id%TYPE;
         v_revision_id           cr_revisions.revision_id%TYPE;
@@ -499,9 +501,9 @@
         PERFORM content_item__set_live_revision (v_revision_id);
 
         insert into pm_tasks (
-                task_id, task_number)
+                task_id, task_number, status)
         values (
-                v_item_id, v_task_number);
+                v_item_id, v_task_number, p_status_id);
 
         insert into pm_tasks_revisions (
                 task_revision_id, end_date, percent_complete, estimated_hours_work, estimated_hours_work_min, estimated_hours_work_max, actual_hours_worked)
@@ -531,6 +533,7 @@
         numeric,        -- estimated_hours_work_min
         numeric,        -- estimated_hours_work_max
         numeric,        -- actual_hours_worked
+        integer,        -- status_id
         timestamptz,    -- creation_date
         integer,        -- creation_user
         varchar,        -- creation_ip
@@ -548,10 +551,11 @@
         p_estimated_hours_work_min              alias for $8;
         p_estimated_hours_work_max              alias for $9;
         p_actual_hours_worked                   alias for $10;
-        p_creation_date                         alias for $11;
-        p_creation_user                         alias for $12;
-        p_creation_ip                           alias for $13;
-        p_package_id                            alias for $14;
+        p_status_id                             alias for $11;
+        p_creation_date                         alias for $12;
+        p_creation_user                         alias for $13
+        p_creation_ip                           alias for $14;
+        p_package_id                            alias for $15;
 
         v_revision_id           cr_revisions.revision_id%TYPE;
         v_id                    cr_items.item_id%TYPE;
@@ -581,6 +585,8 @@
         values (
                 v_revision_id, p_end_date, p_percent_complete, p_estimated_hours_work, p_estimated_hours_work_min, p_estimated_hours_work_max, p_actual_hours_worked);
 
+        update pm_tasks set status = p_status_id where task_id = p_task_id;
+
         PERFORM acs_permission__grant_permission(
                 v_revision_id,
                 p_creation_user,
