Forum OpenACS Q&A: Re: Project Manager - must be me!

Collapse
Posted by Jade Rubick on
This seems to fix things (on one install at least)

If you go into psql, and paste the following, it should fix project-manager:

Please let me know if it works or not after this. I'll be including this in an upgrade script if it turns out to work. I'm planning on posting updates to logger and project-manager today.

------------------------------------------------

select define_function_args('pm_project__new_root_folder', 'package_id');

create or replace function pm_project__new_root_folder (integer)
returns integer as '
declare
        p_package_id            alias for $1;

        v_folder_id            cr_folders.folder_id%TYPE;
        v_folder_name          cr_items.name%TYPE;
begin

        -- raise notice ''in new root folder'';

        -- Set the folder name
        v_folder_name := pm_project__new_unique_name (p_package_id);

        v_folder_id := content_folder__new (
            v_folder_name,                              -- name
            ''Projects'',                              -- label
            ''Project Repository'',                    -- description
            null,                                      -- parent_id
            p_package_id,                              -- context_id
            null,                                      -- folder_id
            null,                                      -- creation_date
            null,                                      -- creation_user
            null                                        -- creation_ip
        );

        -- Register the standard content types
        PERFORM content_folder__register_content_type (
                v_folder_id,            -- folder_id
                ''pm_project'',        -- content_type
                ''f''                  -- include_subtypes
        );

        -- there is no facility in the API for adding in the package_id,
        -- so we have to do it ourselves

        update cr_folders
        set package_id = p_package_id
        where folder_id = v_folder_id;

        -- TODO: Handle Permissions here for this folder.

        return v_folder_id;
end;' language 'plpgsql';