Forum OpenACS Development: Re: content_item__new broken for items with non-cr parents

Collapse
Posted by Dave Bauer on
Every cr_item eventually has a root parent_id of either -4 (security_context_root) or some other non-cr_item.

So we can just find the item in the hierarchy that has the non-cr_item as the parent, grab the parent_id referring to the non-cr_item, and select package_id from that acs_object.

This query seems to work

select acs_object__package_id(parent_id)
from cr_items
where tree_sortkey=(select tree_ancestor_key(tree_sortkey,2)
 from cr_items where item_id=new__item_id);

I can replace the call to content_item__get_root_folder in content_item__new with this.

If someone with Oracle knowledge would like to write up a connect by version of this, that would be very helpful. Basically we are getting the second item from the root of the hierarchy.