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.5 -r1.6
--- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql	6 Aug 2003 20:22:18 -0000	1.5
+++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql	13 Aug 2003 18:56:29 -0000	1.6
@@ -21,7 +21,7 @@
     p_pm_project_id      alias for $1;
     v_pm_project_name    pm_projects.project_name%TYPE;
 begin
-        select project_name into v_pm_project_name
+        select project_name || ''_'' || p_pm_project_id into v_pm_project_name
                 from pm_projects
                 where project_id = p_pm_project_id;
     return v_pm_project_name;
@@ -90,9 +90,6 @@
 	v_count			integer;
 begin
 
-        -- this function is not complete yet. It makes duplicates
-
-
         -- raise notice ''in get root folder p_create_if_not_present_p = %'',p_create_if_not_present_p;
 
 	select count(*) into v_count
@@ -191,7 +188,7 @@
         -- raise notice ''v_parent_id (%) p_parent_id (%)'', v_parent_id, p_parent_id;
 
 	v_item_id := content_item__new (
-		p_project_name,		-- name
+		v_id::varchar,	        -- name
 		v_parent_id,		-- parent_id
 		v_id,			-- item_id
 		null,			-- locale
@@ -225,12 +222,12 @@
 	PERFORM content_item__set_live_revision (v_revision_id);
 
 	insert into pm_projects (
-		project_id, project_name, project_code, 
+		project_id, project_code, 
 		goal, deadline_scheduling, planned_start_date, 
 		planned_end_date, actual_start_date, actual_end_date, 
 		ongoing_p) 
 	values (
-		v_revision_id, p_project_name, p_project_code, 
+		v_revision_id, p_project_code, 
 		p_goal, p_deadline_scheduling, p_planned_start_date, 
 		p_planned_end_date, p_actual_start_date, 
 		p_actual_end_date, p_ongoing_p);
@@ -340,12 +337,12 @@
 	PERFORM content_item__set_live_revision (v_revision_id);
 
 	insert into pm_projects (
-		project_id, project_name, project_code, 
+		project_id, project_code, 
 		goal, deadline_scheduling, planned_start_date, 
 		planned_end_date, actual_start_date, actual_end_date, 
 		ongoing_p) 
 	values (
-		v_revision_id, p_project_name, p_project_code, 
+		v_revision_id, p_project_code, 
 		p_goal, p_deadline_scheduling, p_planned_start_date, 
 		p_planned_end_date, p_actual_start_date, 
 		p_actual_end_date, p_ongoing_p);
@@ -405,10 +402,9 @@
     p_pm_task_id         alias for $1;
     v_pm_task_name       pm_tasks.title%TYPE;
 begin
-        select t.title into v_pm_project_name
-                from pm_tasks_revisionsx t, cr_items i
-                where t.item_id = p_pm_task_id and 
-                i.live_revision = t.item_id;
+        select i.name || ''_'' || p_pm_task_id into v_pm_project_name
+                from cr_items i
+                where i.item_id = p_pm_task_id;
     return v_pm_task_name;
 end;
 ' language 'plpgsql';
@@ -461,7 +457,7 @@
         -- create the task_number
         
 	v_item_id := content_item__new (
-		p_title,                -- name
+		v_id::varchar,          -- name
 		p_project_id,		-- parent_id
 		v_id,			-- item_id
 		null,			-- locale
