postgresql7.1
select tt.ticket_id,
ttracker_option__option_name(:package_id, 'severity', tt.severity)
as pretty_severity,
ttracker_option__option_name(:package_id, 'priority', tt.priority)
as pretty_priority,
tt.subject,
to_char(tt.creation_date, 'MM/DD/YYYY HH24:MI') as created,
tc.category_id,
tc.name as category,
tt.creation_user as creator_id,
acs_object__name(tt.creation_user) as creator_name,
wc.state,
:user_id as assignee_id,
'me' as assignee_name
$view_select
from ttracker_categories tc,
ttracker_tickets tt,
wf_cases wc
$view_from
where tc.package_id = :package_id and
tt.category_id = tc.category_id and
wc.object_id = tt.ticket_id and
exists (select wt.task_id
from wf_task_assignments wta,
wf_tasks wt,
party_approved_member_map m
where wt.transition_key = 'resolve' and
wt.task_id = wta.task_id and
wta.party_id = m.party_id and
m.member_id = :user_id and
wt.case_id = wc.case_id and
wt.task_id = (select max(wt1.task_id)
from wf_tasks wt1
where wt1.case_id = wc.case_id and
wt1.transition_key = 'resolve'))
$view_where
[ad_dimensional_sql $dimensional]
[ad_order_by_from_sort_spec $orderby $table_def]
select tt.ticket_id,
ttracker_option__option_name(:package_id, 'severity', tt.severity)
as pretty_severity,
ttracker_option__option_name(:package_id, 'priority', tt.priority)
as pretty_priority,
tt.subject,
to_char(tt.creation_date, 'MM/DD/YYYY HH24:MI') as created,
tc.category_id,
tc.name as category,
tt.creation_user as creator_id,
acs_object__name(tt.creation_user) as creator_name,
wc.state,
0 as assignee_id,
'' as assignee_name
$view_select
from ttracker_categories tc,
ttracker_tickets tt,
wf_cases wc
$view_from
where tc.package_id = :package_id and
tt.category_id = tc.category_id and
wc.object_id = tt.ticket_id and
not exists (select wta1.task_id
from wf_task_assignments wta1
where wta1.task_id = (select max(wt.task_id)
from wf_tasks wt
where wt.case_id = wc.case_id and
wt.transition_key = 'resolve'))
$view_where
[ad_dimensional_sql $dimensional]
[ad_order_by_from_sort_spec $orderby $table_def]
select results.* from
(select tt.ticket_id,
ttracker_option__option_name(:package_id, 'severity', tt.severity)
as pretty_severity,
ttracker_option__option_name(:package_id, 'priority', tt.priority)
as pretty_priority,
tt.subject,
to_char(tt.creation_date, 'MM/DD/YYYY HH24:MI') as created,
tc.category_id,
tc.name as category,
tt.creation_user as creator_id,
acs_object__name(tt.creation_user) as creator_name,
wc.state,
wta.party_id as assignee_id,
acs_object__name(wta.party_id) as assignee_name
$view_select
from ttracker_categories tc,
ttracker_tickets tt,
wf_cases wc,
wf_task_assignments wta
$view_from
where tc.package_id = :package_id and
tt.category_id = tc.category_id and
wc.object_id = tt.ticket_id and
wta.task_id = (select max(wt.task_id)
from wf_tasks wt
where wt.case_id = wc.case_id and
wt.transition_key = 'resolve')
$view_where
[ad_dimensional_sql $dimensional]
union all
select tt.ticket_id,
ttracker_option__option_name(:package_id, 'severity', tt.severity)
as pretty_severity,
ttracker_option__option_name(:package_id, 'priority', tt.priority)
as pretty_priority,
tt.subject,
to_char(tt.creation_date, 'MM/DD/YYYY HH24:MI') as created,
tc.category_id,
tc.name as category,
tt.creation_user as creator_id,
acs_object__name(tt.creation_user) as creator_name,
wc.state,
0 as assignee_id,
'' as assignee_name
$view_select
from ttracker_categories tc,
ttracker_tickets tt,
wf_cases wc
$view_from
where tc.package_id = :package_id and
tt.category_id = tc.category_id and
wc.object_id = tt.ticket_id and
not exists (select wta1.task_id
from wf_task_assignments wta1
where wta1.task_id = (select max(wt.task_id)
from wf_tasks wt
where wt.case_id = wc.case_id and
wt.transition_key = 'resolve'))
$view_where
[ad_dimensional_sql $dimensional]) results
[ad_order_by_from_sort_spec $orderby $table_def]
tt.creation_date + '1 days'::interval > now()
tt.creation_date + '7 days'::interval > now()
tt.creation_date + '30 days'::interval > now()
and cr.revision_id = content_item__get_live_revision(tt.ticket_id)