Index: openacs-4/packages/project-manager/tcl/task-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/task-procs.tcl,v diff -u -r1.21 -r1.22 --- openacs-4/packages/project-manager/tcl/task-procs.tcl 22 May 2006 06:16:44 -0000 1.21 +++ openacs-4/packages/project-manager/tcl/task-procs.tcl 21 Aug 2006 16:24:06 -0000 1.22 @@ -1052,6 +1052,7 @@ -task_item_id:required -party_id:required {-role_id ""} + -no_update:boolean } { Assigns party_id to task_item_id @@ -1063,6 +1064,8 @@ @param party_id @param role_id the role under which the person is assigned + + @param no_update Do not update an existing record with the new role @return @@ -1073,26 +1076,30 @@ } db_transaction { - # make sure we avoid case when that assignment has already - # been made. - db_dml delete_assignment { - delete from - pm_task_assignment - where - task_id = :task_item_id and - party_id = :party_id - } - db_dml add_assignment { - insert into pm_task_assignment - (task_id, - role_id, - party_id) - values - (:task_item_id, - :role_id, - :party_id) - } + if {$no_update_p} { + if {[pm::task::assigned_p -task_item_id $task_item_id -party_id $party_id]} { + set add_p 0 + } else { + set add_p 1 + } + } else { + pm::task::unassign -task_item_id $task_item_id -party_id $party_id + set add_p 1 + } + + if {$add_p} { + db_dml add_assignment { + insert into pm_task_assignment + (task_id, + role_id, + party_id) + values + (:task_item_id, + :role_id, + :party_id) + } + } } # Flush the cache that remembers which roles to offer the current user in the 'assign role to myself' listbox Index: openacs-4/packages/project-manager/templates/project-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/project-ae.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/project-manager/templates/project-ae.tcl 10 Aug 2006 09:18:09 -0000 1.8 +++ openacs-4/packages/project-manager/templates/project-ae.tcl 21 Aug 2006 16:24:06 -0000 1.9 @@ -196,8 +196,8 @@ set ongoing_p t } - set planned_end_date [dt_sysdate] - set planned_start_date [dt_sysdate] + set planned_end_date [template::util::date::now] + set planned_start_date [template::util::date::now] set description [template::util::richtext::create "" {}] } -edit_request { Index: openacs-4/packages/project-manager/templates/task-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/task-ae.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/project-manager/templates/task-ae.tcl 8 Jun 2006 14:48:14 -0000 1.10 +++ openacs-4/packages/project-manager/templates/task-ae.tcl 21 Aug 2006 16:24:06 -0000 1.11 @@ -551,10 +551,14 @@ if {[array exists assignee]} { foreach role [array names assignee] { foreach person_id $assignee($role) { - pm::task::assign \ + # We do not want to update the assignment + # This allows the trick that a LEAD assignement will not be + # overwritten by a player / watcher one, as the role is lower + pm::task::assign \ -task_item_id $task_item_id \ -party_id $person_id \ - -role_id $role + -role_id $role \ + -no_update } } }