Ok.. I am spending a LOT of time working with the intranet module so hopefully shake out any remaing bugs.
If you notice on a project page that the ticket tracker box doesnt show ticket status even when you created a ticket tracker .. well there is a reason. Turns out the name customer means different things to different tables.. and customers in ticket_projects is NOT the CUSTOMER.. anyway.. once I figured out that out there are two fixes
[1] procedure im_project_ticket_project_id is hitting the wrong table (ticket_projects) when it should be querying ticket_project_teams table.. so fix is easy
create function im_project_ticket_project_id(integer)
returns integer as '
declare
v_group_id alias for $1;
v_project_id ticket_project_teams.project_id%TYPE;
BEGIN
BEGIN
select project_id into v_project_id from ticket_project_teams where team_id = v_group_id;
END;
if v_project_id is null then
return 0;
else
return v_project_id;
end if;
END;
' language 'plpgsql';
The query is also broken in http://kinetx.kinetx.com/intranet/projects/view.tcl as it tries to get ticket_project_id from the proc above (good) AND from the im_projects table (bad) since it is not populated.
so remove the second grab..
the query as I fixed it is:
set selection [ns_db 0or1row $db "
select p.*, g.group_name as project_name, g.short_name, p.parent_id, p.customer_id,
user_group_name_from_id(p.customer_id) as customer_name, im_project_ticket_project_id(g.group_id) as ticket_project_id,
user_group_name_from_id(p.parent_id) as parent_name,
user_full_name(p.project_lead_id) as project_lead, project_lead_id,
user_full_name(p.supervisor_id) as supervisor,
im_proj_type_from_id(p.project_type_id) as project_type,
im_proj_status_from_id(p.project_status_id) as project_status
from im_projects p, user_groups g
where p.group_id=$group_id
and p.group_id=g.group_id
"]
If someone can be so good as to confirm this and if correct.. add the fixes to the source tree.. I need to get back up on that but might be nice to have a fix in quicker
cheers
Jamie