Index: openacs-4/packages/simulation/www/simbuild/task-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/task-edit.tcl,v diff -u -r1.38.2.2 -r1.38.2.3 --- openacs-4/packages/simulation/www/simbuild/task-edit.tcl 19 Feb 2007 15:10:56 -0000 1.38.2.2 +++ openacs-4/packages/simulation/www/simbuild/task-edit.tcl 21 Feb 2007 20:46:33 -0000 1.38.2.3 @@ -385,29 +385,36 @@ } -after_submit { - set action_id [simulation::action::edit \ - -operation $operation \ - -workflow_id $workflow_id \ - -action_id $action_id \ - -array row] + db_transaction { + set action_id [simulation::action::edit \ + -operation $operation \ + -workflow_id $workflow_id \ + -action_id $action_id \ + -array row] - db_dml delete_all_relations { - delete from sim_task_object_map - where task_id = :action_id - } + if { [string equal $trigger_type "user"] } { - for { set i 1 } { $i <= [set attachment_count] } { incr i } { - set elm "attachment_$i" - set related_object_id [set $elm] - - if { ![empty_string_p $related_object_id] } { - db_dml insert_rel { - insert into sim_task_object_map (task_id, object_id, order_n, relation_tag) - values (:action_id, :related_object_id, :i, 'attachment') - } + db_dml delete_all_relations { + delete from sim_task_object_map + where task_id = :action_id + } + + for { set i 1 } { $i <= [set attachment_count] } { incr i } { + set elm "attachment_$i" + set related_object_id [set $elm] + + if { ![empty_string_p $related_object_id] } { + db_dml insert_rel { + insert into sim_task_object_map (task_id, object_id, order_n, relation_tag) + values (:action_id, :related_object_id, :i, 'attachment') + } + } } - } + } + } + + # Let's mark this template edited set sim_type "dev_template"