Index: openacs-4/packages/simulation/www/simplay/task-detail.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/task-detail.tcl,v diff -u -r1.22.2.7 -r1.22.2.8 --- openacs-4/packages/simulation/www/simplay/task-detail.tcl 30 Nov 2004 21:48:19 -0000 1.22.2.7 +++ openacs-4/packages/simulation/www/simplay/task-detail.tcl 23 Dec 2004 09:48:27 -0000 1.22.2.8 @@ -10,8 +10,11 @@ subject:optional body:optional received_message_item_id:optional + case_id + role_id } + # FIXME: I am exporting the enabled_action_id list as the string variable enabled_action_ids in # the forms as I can't export multiples. Here I'm recreating the list again. This is convoluted. if { ![empty_string_p $enabled_action_ids] } { @@ -22,9 +25,21 @@ set bulk_p 1 } -if { [llength $enabled_action_id] == 1 } { - workflow::case::enabled_action_get -enabled_action_id $enabled_action_id -array enabled_action +if { [empty_string_p $return_url] } { + set return_url [export_vars -base case { case_id role_id }] +} +if { [llength $enabled_action_id] == 1 } { + + # Check that no other player has changed the state while + # we have been filling in the form. + if { [catch { + workflow::case::enabled_action_get -enabled_action_id $enabled_action_id -array enabled_action + }] } { + ad_returnredirect -message "

[_ simulation.Sorry] [_ simulation.lt_The_task_you_were_try]

[_ simulation.lt_Someone_was_probably_]

" \ + -html $return_url + ad_script_abort + } set action_id $enabled_action(action_id) set case_id $enabled_action(case_id) simulation::action::get -action_id $action_id -array action @@ -34,10 +49,6 @@ set common_enabled_action_ids [list [list $enabled_action_id $case_id]] - if { [empty_string_p $return_url] } { - set return_url [export_vars -base case { case_id role_id }] - } - set common_actions_count 1 set ignored_actions_count 0 @@ -245,6 +256,7 @@ } } -on_submit { + db_transaction { foreach one_action $common_enabled_action_ids { set case_id [lindex $one_action 1]