Commit 4246e6ec authored by Frank Bergmann's avatar Frank Bergmann

- Now ignoring closed projects (main project or leaf)

parent 3330e308
......@@ -110,6 +110,7 @@ SELECT im_report_new (
update im_reports set
report_description = 'Lists absences and assignments to other projects of the members of a project',
report_sql = '
-- Individual absences from im_user_absences (by user)
select t.*,
im_name_from_user_id(user_id) as user_name,
acs_object__name(context_id) as context
......@@ -137,6 +138,7 @@ update im_reports set
a.end_date >= (select start_date from im_projects where project_id = %main_project_id%) and
a.start_date <= (select end_date from im_projects where project_id = %main_project_id%)
UNION
-- Group absences such as bank holidays
select
a.absence_id as object_id,
''im_user_absence'' as object_type,
......@@ -162,6 +164,7 @@ update im_reports set
a.end_date >= (select start_date from im_projects where project_id = %main_project_id%) and
a.start_date <= (select end_date from im_projects where project_id = %main_project_id%)
UNION
-- Assignments to other projects
select p.project_id as object_id,
''im_project'' as object_type,
pe.person_id as user_id,
......@@ -174,12 +177,21 @@ update im_reports set
) as context_id
from persons pe,
im_projects p,
im_projects super_p,
acs_rels r,
im_biz_object_members bom
where r.rel_id = bom.rel_id and
where
super_p.parent_id is null and
p.parent_id is not null and -- Ignore assignments on a main project level
p.tree_sortkey between super_p.tree_sortkey and tree_right(super_p.tree_sortkey) and
super_p.project_status_id in (select * from im_sub_categories(76)) and
p.project_status_id in (select * from im_sub_categories(76)) and
r.rel_id = bom.rel_id and
r.object_id_one = p.project_id and
r.object_id_two = pe.person_id and
pe.person_id in (
-- Only report about persons assigned in main_p
select distinct
object_id_two
from acs_rels,
......@@ -189,6 +201,7 @@ update im_reports set
sub_p.tree_sortkey between main_p.tree_sortkey and tree_right(main_p.tree_sortkey) and
main_p.project_id = %main_project_id%
) and p.project_id not in (
-- Exclude assignments within main_p (handled in JavaScript)
select sub_p.project_id
from im_projects sub_p,
im_projects main_p
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment