Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql,v
diff -u -r1.65.2.3 -r1.65.2.4
--- openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql	28 Oct 2005 18:03:47 -0000	1.65.2.3
+++ openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql	29 Dec 2005 01:24:02 -0000	1.65.2.4
@@ -21,15 +21,15 @@
   v_folder_id                             cr_folders.folder_id%TYPE;
 begin
 
-  if get_root_folder__item_id is NULL or get_root_folder__item_id in (0,-100,-200) then
+  if get_root_folder__item_id is NULL or get_root_folder__item_id in (-4,-100,-200) then
 
     v_folder_id := content_item_globals.c_root_folder_id;
 
   else
 
     select i2.item_id into v_folder_id
     from cr_items i1, cr_items i2
-    where i2.parent_id = 0
+    where i2.parent_id = -4
     and i1.item_id = get_root_folder__item_id
     and i1.tree_sortkey between i2.tree_sortkey and tree_right(i2.tree_sortkey);
 
@@ -124,23 +124,23 @@
     v_title := new__title;
   end if;
 
-  if new__package_id is null and v_parent_id != 0 then
+  if new__package_id is null and v_parent_id != -4 then
     v_package_id := acs_object__package_id(content_item__get_root_folder(v_parent_id));
   else
     v_package_id := new__package_id;
   end if;
 
-  if v_parent_id = 0 or 
+  if v_parent_id = -4 or 
     content_folder__is_folder(v_parent_id) = ''t'' then
 
-    if v_parent_id != 0 and 
+    if v_parent_id != -4 and 
       content_folder__is_registered(
         v_parent_id, new__content_type, ''f'') = ''f'' then
 
       raise EXCEPTION ''-20000: This items content type % is not registered to this folder %'', new__content_type, v_parent_id;
     end if;
 
-  else if v_parent_id != 0 then
+  else if v_parent_id != -4 then
 
      if new__relation_tag is null then
        v_rel_tag := content_item__get_content_type(v_parent_id) 
@@ -186,7 +186,7 @@
   );
 
   -- if the parent is not a folder, insert into cr_child_rels
-  if v_parent_id != 0 and
+  if v_parent_id != -4 and
     content_folder__is_folder(v_parent_id) = ''f'' then
 
     v_rel_id := acs_object__new(
@@ -364,17 +364,17 @@
     v_package_id := new__package_id;
   end if;
 
-  if v_parent_id = 0 or 
+  if v_parent_id = -4 or 
     content_folder__is_folder(v_parent_id) = ''t'' then
 
-    if v_parent_id != 0 and 
+    if v_parent_id != -4 and 
       content_folder__is_registered(
         v_parent_id, new__content_type, ''f'') = ''f'' then
 
       raise EXCEPTION ''-20000: This items content type % is not registered to this folder %'', new__content_type, v_parent_id;
     end if;
 
-  else if v_parent_id != 0 then
+  else if v_parent_id != -4 then
 
      select object_type into v_parent_type from acs_objects
        where object_id = v_parent_id;
@@ -412,7 +412,7 @@
   );
 
   -- if the parent is not a folder, insert into cr_child_rels
-  if v_parent_id != 0 and
+  if v_parent_id != -4 and
     content_folder__is_folder(v_parent_id) = ''f'' and 
     content_item__is_valid_child(v_parent_id, new__content_type) = ''t'' then
 
@@ -572,17 +572,17 @@
     v_title := new__title;
   end if;
 
-  if v_parent_id = 0 or 
+  if v_parent_id = -4 or 
     content_folder__is_folder(v_parent_id) = ''t'' then
 
-    if v_parent_id != 0 and 
+    if v_parent_id != -4 and 
       content_folder__is_registered(
         v_parent_id, new__content_type, ''f'') = ''f'' then
 
       raise EXCEPTION ''-20000: This items content type % is not registered to this folder %'', new__content_type, v_parent_id;
     end if;
 
-  else if v_parent_id != 0 then
+  else if v_parent_id != -4 then
 
      select object_type into v_parent_type from acs_objects
        where object_id = v_parent_id;
@@ -620,7 +620,7 @@
   );
 
   -- if the parent is not a folder, insert into cr_child_rels
-  if v_parent_id != 0 and
+  if v_parent_id != -4 and
     content_folder__is_folder(v_parent_id) = ''f'' and 
     content_item__is_valid_child(v_parent_id, new__content_type) = ''t'' then
 
@@ -856,17 +856,17 @@
     v_package_id := new__package_id;
   end if;
 
-  if v_parent_id = 0 or 
+  if v_parent_id = -4 or 
     content_folder__is_folder(v_parent_id) = ''t'' then
 
-    if v_parent_id != 0 and 
+    if v_parent_id != -4 and 
       content_folder__is_registered(
         v_parent_id, new__content_type, ''f'') = ''f'' then
 
       raise EXCEPTION ''-20000: This items content type % is not registered to this folder %'', new__content_type, v_parent_id;
     end if;
 
-  else if v_parent_id != 0 then
+  else if v_parent_id != -4 then
 
      select object_type into v_parent_type from acs_objects
        where object_id = v_parent_id;
@@ -906,7 +906,7 @@
   );
 
   -- if the parent is not a folder, insert into cr_child_rels
-  if v_parent_id != 0 and
+  if v_parent_id != -4 and
     content_folder__is_folder(v_parent_id) = ''f'' and 
     content_item__is_valid_child(v_parent_id, new__content_type) = ''t'' then
 
