Commit e7f1d829 authored by Frank Bergmann's avatar Frank Bergmann

- changes baselkb:

	- Added new stuff to WF
parent bfdccca8
...@@ -33,5 +33,3 @@ end;' language 'plpgsql'; ...@@ -33,5 +33,3 @@ end;' language 'plpgsql';
-- show errors
...@@ -995,9 +995,10 @@ declare ...@@ -995,9 +995,10 @@ declare
execute_time_callback__transition_key alias for $4; execute_time_callback__transition_key alias for $4;
v_rec record; v_rec record;
v_str text; v_str text;
v_result timestamptz;
begin begin
if execute_time_callback__callback = '''' or execute_time_callback__callback is null then if execute_time_callback__callback = '''' or execute_time_callback__callback is null then
raise EXCEPTION ''-20000: There''''s no time_callback function for the timed transition "%"'', execute_time_callback__transition_key; return null;
end if; end if;
v_str := ''select '' || execute_time_callback__callback || ''('' || v_str := ''select '' || execute_time_callback__callback || ''('' ||
...@@ -1007,11 +1008,11 @@ begin ...@@ -1007,11 +1008,11 @@ begin
for v_rec in execute v_str for v_rec in execute v_str
LOOP LOOP
return v_rec.trigger_time; v_result := v_rec.trigger_time;
end LOOP; end LOOP;
return null; RAISE NOTICE ''workflow_case__execute_time_callback: res=%, sql=%'', v_result, v_str;
return v_result;
end;' language 'plpgsql'; end;' language 'plpgsql';
...@@ -1338,7 +1339,8 @@ declare ...@@ -1338,7 +1339,8 @@ declare
v_finished_p boolean; v_finished_p boolean;
task_rec record; task_rec record;
begin begin
RAISE NOTICE ''sweep_automatic_transitions(%,%)'',
sweep_automatic_transitions__case_id, sweep_automatic_transitions__journal_id;
PERFORM workflow_case__enable_transitions(sweep_automatic_transitions__case_id); PERFORM workflow_case__enable_transitions(sweep_automatic_transitions__case_id);
while v_done_p != ''t'' loop while v_done_p != ''t'' loop
v_done_p := ''t''; v_done_p := ''t'';
...@@ -1717,14 +1719,14 @@ begin ...@@ -1717,14 +1719,14 @@ begin
enable_transitions__case_id, enable_transitions__case_id,
trans_rec.transition_key trans_rec.transition_key
); );
else if trans_rec.trigger_type = ''time'' then end if;
v_trigger_time := workflow_case__execute_time_callback (
v_trigger_time := workflow_case__execute_time_callback (
trans_rec.time_callback, trans_rec.time_callback,
trans_rec.time_custom_arg, trans_rec.time_custom_arg,
enable_transitions__case_id, enable_transitions__case_id,
trans_rec.transition_key); trans_rec.transition_key);
end if;
end if;
/* we are ready to insert the row */ /* we are ready to insert the row */
select wf_task_id_seq.nextval into v_task_id from dual; select wf_task_id_seq.nextval into v_task_id from dual;
......
...@@ -5,4 +5,8 @@ ad_library { ...@@ -5,4 +5,8 @@ ad_library {
@cvs-id $Id$ @cvs-id $Id$
} }
ad_schedule_proc -thread t 900 wf_sweep_time_events # normal rhythm: Every 15 minutes
# ad_schedule_proc -thread t 900 wf_sweep_time_events
# for debugging: every 1 minute
ad_schedule_proc -thread t 60 wf_sweep_time_events
...@@ -7,9 +7,11 @@ ...@@ -7,9 +7,11 @@
<querytext> <querytext>
select t.task_id, select t.task_id,
t.transition_key, t.transition_key,
t.state, t.state,
t.case_id, t.case_id,
t.holding_user,
acs_object__name(t.holding_user) as holding_user_name,
tr.transition_name, tr.transition_name,
to_char(t.enabled_date, :date_format) as enabled_date_pretty, to_char(t.enabled_date, :date_format) as enabled_date_pretty,
to_char(t.started_date, :date_format) as started_date_pretty, to_char(t.started_date, :date_format) as started_date_pretty,
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<th>Activated Date</th> <th>Activated Date</th>
<th>Started Date</th> <th>Started Date</th>
<th>Deadline</th> <th>Deadline</th>
<th>Holder</th>
<th>Assignees</th> <th>Assignees</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
<if @active_tasks.deadline_pretty@ not nil>@active_tasks.deadline_pretty@</if> <if @active_tasks.deadline_pretty@ not nil>@active_tasks.deadline_pretty@</if>
<else>&nbsp;</else> <else>&nbsp;</else>
</td> </td>
<td><a href="@holding_user_url@">@holding_user_name@</a></td>
<td> <td>
<if @active_tasks.assignee_party_id@ not nil> <if @active_tasks.assignee_party_id@ not nil>
<group column="task_id"> <group column="task_id">
...@@ -40,9 +42,11 @@ ...@@ -40,9 +42,11 @@
<else> <else>
@active_tasks.assignee_name@ @active_tasks.assignee_name@
</else> </else>
<!--
<if @active_tasks.assignee_email@ not nil> <if @active_tasks.assignee_email@ not nil>
(<a href="mailto:@active_tasks.assignee_email@">@active_tasks.assignee_email@</a>) (<a href="mailto:@active_tasks.assignee_email@">@active_tasks.assignee_email@</a>)
</if> </if>
-->
</li> </li>
</group> </group>
</if> </if>
......
...@@ -17,31 +17,8 @@ if { ![info exists date_format] } { ...@@ -17,31 +17,8 @@ if { ![info exists date_format] } {
set date_format "Mon fmDDfm, YYYY HH24:MI:SS" set date_format "Mon fmDDfm, YYYY HH24:MI:SS"
} }
db_multirow active_tasks active_tasks { db_multirow active_tasks active_tasks {} {
select t.task_id, set holding_user_url "/shared/community-member?[export_vars -url {{user_id $holding_user}}]"
t.transition_key,
t.state,
t.case_id,
tr.transition_name,
to_char(t.enabled_date, :date_format) as enabled_date_pretty,
to_char(t.started_date, :date_format) as started_date_pretty,
to_char(t.deadline, :date_format) as deadline_pretty,
p.party_id as assignee_party_id,
p.email as assignee_email,
acs_object.name(p.party_id) as assignee_name,
'' as assignee_url,
assignee_o.object_type as assignee_object_type,
'' as reassign_url
from wf_tasks t, wf_transitions tr, wf_task_assignments tasgn, parties p, acs_objects assignee_o
where t.case_id = :case_id
and t.state in ('enabled', 'started')
and tr.workflow_key = t.workflow_key
and tr.transition_key = t.transition_key
and tasgn.task_id (+) = t.task_id
and p.party_id (+) = tasgn.party_id
and assignee_o.object_id (+) = p.party_id
order by t.enabled_date desc
} {
if { [string equal $assignee_object_type "user"] } { if { [string equal $assignee_object_type "user"] } {
set assignee_url "/shared/community-member?[export_vars -url {{user_id $assignee_party_id}}]" set assignee_url "/shared/community-member?[export_vars -url {{user_id $assignee_party_id}}]"
} }
......
...@@ -11,15 +11,28 @@ ad_page_contract { ...@@ -11,15 +11,28 @@ ad_page_contract {
@cvs-id $Id$ @cvs-id $Id$
} { } {
task_id:integer,notnull task_id:integer,notnull
{permanent_p 0}
{return_url ""} {return_url ""}
} }
set user_id [ad_conn user_id] set user_id [ad_conn user_id]
set subsite_id [ad_conn subsite_id]
set reassign_p [permission::permission_p -party_id $user_id -object_id $subsite_id -privilege "wf_reassign_tasks"]
if {!$reassign_p} {
ad_return_complaint 1 "<li>[_ intranet-core.lt_You_have_insufficient_1]"
return
}
wf_case_add_task_assignment \ if {$permanent_p} {
wf_case_add_task_assignment \
-task_id $task_id \ -task_id $task_id \
-party_id $user_id \ -party_id $user_id \
-permanent -permanent
} else {
wf_case_add_task_assignment \
-task_id $task_id \
-party_id $user_id
}
if [empty_string_p $return_url] { if [empty_string_p $return_url] {
ad_returnredirect task?task_id=$task_id ad_returnredirect task?task_id=$task_id
......
...@@ -5,6 +5,20 @@ ad_page_contract { ...@@ -5,6 +5,20 @@ ad_page_contract {
party_id:integer party_id:integer
{return_url "task?[export_url_vars task_id]"} {return_url "task?[export_url_vars task_id]"}
} }
# ------------------------------------------------------------
# Check Permissions
set user_id [ad_conn user_id]
set subsite_id [ad_conn subsite_id]
set reassign_p [permission::permission_p -party_id $user_id -object_id $subsite_id -privilege "wf_reassign_tasks"]
if {!$reassign_p} {
ad_return_complaint 1 "<li>[_ intranet-core.lt_You_have_insufficient_1]"
return
}
# ------------------------------------------------------------
wf_case_add_task_assignment \ wf_case_add_task_assignment \
-task_id $task_id \ -task_id $task_id \
-party_id $party_id \ -party_id $party_id \
......
...@@ -11,14 +11,23 @@ ad_page_contract { ...@@ -11,14 +11,23 @@ ad_page_contract {
focus focus
} }
array set task [wf_task_info $task_id] # ------------------------------------------------------------
# Check Permissions
set context [list [list "case?[export_vars -url {{case_id $task(case_id)}}]" "$task(object_name) case"] [list "task?[export_vars -url {task_id}]" "$task(task_name)"] "Add assignee"] set user_id [ad_conn user_id]
set subsite_id [ad_conn subsite_id]
set reassign_p [permission::permission_p -party_id $user_id -object_id $subsite_id -privilege "wf_reassign_tasks"]
if {!$reassign_p} {
ad_return_complaint 1 "<li>[_ intranet-core.lt_You_have_insufficient_1]"
return
}
set export_vars [export_vars -form {task_id return_url}] # ------------------------------------------------------------
array set task [wf_task_info $task_id]
set context [list [list "case?[export_vars -url {{case_id $task(case_id)}}]" "$task(object_name) case"] [list "task?[export_vars -url {task_id}]" "$task(task_name)"] "Add assignee"]
set export_vars [export_vars -form {task_id return_url}]
set focus "assign.party_id" set focus "assign.party_id"
set party_widget "<select name=\"party_id\">\n" set party_widget "<select name=\"party_id\">\n"
set count 0 set count 0
......
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
<form method="post" action="@done_action_url@"> <form method="post" action="@done_action_url@">
<table width="100%" border="0" cellspacing="0" cellpadding="0"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
@done_export_vars;noquote@ @done_export_vars;noquote@
<tr bgcolor="#dddddd"> <tr>
<td colspan="3" align="right"> <td colspan="3" align="left">
<input type=submit value="Done" /> <input type=submit value="Done" />
</td> </td>
</tr> </tr>
......
...@@ -15,10 +15,18 @@ ad_page_contract { ...@@ -15,10 +15,18 @@ ad_page_contract {
array set task [wf_task_info $task_id] array set task [wf_task_info $task_id]
set party_id [ad_conn user_id] set party_id [ad_conn user_id]
set subsite_id [ad_conn subsite_id]
set sub_return_url "[ns_conn url]?[export_vars -url {task_id return_url}]" set sub_return_url "[ns_conn url]?[export_vars -url {task_id return_url}]"
set task(add_assignee_url) "assignee-add?[export_vars -url {task_id {return_url $sub_return_url}}]" set task(add_assignee_url) "assignee-add?[export_vars -url {task_id {return_url $sub_return_url}}]"
set task(assign_yourself_url) "assignee-add-2?[export_vars -url {task_id party_id {return_url $sub_return_url}}]" set task(assign_yourself_url) "assignee-add-2?[export_vars -url {task_id party_id {return_url $sub_return_url}}]"
set reassign_p [permission::permission_p -party_id $party_id -object_id $subsite_id -privilege "wf_reassign_tasks"]
if {!$reassign_p} {
ad_return_complaint 1 "<li>[_ intranet-core.lt_You_have_insufficient_1]"
return
}
set context [list [list "case?[export_vars -url {{case_id $task(case_id)}}]" "$task(object_name) case"] [list "task?[export_vars -url {task_id}]" "$task(task_name)"] "Assignees"] set context [list [list "case?[export_vars -url {{case_id $task(case_id)}}]" "$task(object_name) case"] [list "task?[export_vars -url {task_id}]" "$task(task_name)"] "Assignees"]
......
...@@ -54,7 +54,20 @@ wf_sweep_message_transition_tcl ...@@ -54,7 +54,20 @@ wf_sweep_message_transition_tcl
# --------------------------------------------------------- # ---------------------------------------------------------
# Get everything about the task # Get everything about the task
array set task [wf_task_info $task_id]
if {[catch {
array set task [wf_task_info $task_id]
} err_msg]} {
ad_return_complaint 1 "<li>
<b>[lang::message::lookup "" acs-workflow.Task_not_found "Task not found:"]</b><p>
[lang::message::lookup "" acs-workflow.Task_not_found_message "
This error can occur if a system administrator has deleted a workflow.<br>
This situation should not occur during normal operations.<p>
Please contact your System Administrator
"]
"
return
}
set task(add_assignee_url) "assignee-add?[export_url_vars task_id]" set task(add_assignee_url) "assignee-add?[export_url_vars task_id]"
set task(assign_yourself_url) "assign-yourself?[export_vars -url {task_id return_url}]" set task(assign_yourself_url) "assign-yourself?[export_vars -url {task_id return_url}]"
......
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