Index: openacs-4/packages/project-manager/catalog/project-manager.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/catalog/project-manager.de_DE.ISO-8859-1.xml,v diff -u -r1.24 -r1.25 --- openacs-4/packages/project-manager/catalog/project-manager.de_DE.ISO-8859-1.xml 30 Jan 2006 17:55:34 -0000 1.24 +++ openacs-4/packages/project-manager/catalog/project-manager.de_DE.ISO-8859-1.xml 12 Mar 2006 16:54:57 -0000 1.25 @@ -203,7 +203,7 @@ Sind Sie sich sicher, dass Sie diesen Prozess l�schen wollen: %one_line% Sind Sie sich sicher, dass Sie diesen Log-Eintrag mit %value% %variable.unit% %variable.name% on %time_stamp%?' l�schen wollen Sind Sie sicher, dass Sie diese %task_term_lower%n l�schen wollen? - Zugewiesen zu Projekt: project_name% + Zugewiesen zu Projekt: %project_name% (seien Sie geduldig, dies dauert eine kleine Weile; in der Zwischenzeit k�nnen Sie die LOg-Files lesen, um zu sehen, was passiert.) Starte Synchronisation �nderungen am Projekt wurden gespeichert Index: openacs-4/packages/project-manager/lib/projects-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/projects-postgresql.xql,v diff -u -r1.11 -r1.12 --- openacs-4/packages/project-manager/lib/projects-postgresql.xql 13 Nov 2005 17:54:44 -0000 1.11 +++ openacs-4/packages/project-manager/lib/projects-postgresql.xql 12 Mar 2006 16:54:57 -0000 1.12 @@ -8,13 +8,16 @@ p.item_id as project_item_id, p.project_id, p.status_id, + s.description as pretty_status, p.parent_id as folder_id, p.object_type as content_type, p.title as project_name, p.project_code, to_char(p.planned_start_date, 'YYYY-MM-DD HH24:MI:SS') as planned_start_date, to_char(p.planned_end_date, 'YYYY-MM-DD HH24:MI:SS') as planned_end_date, p.ongoing_p, + p.etat_id, + p.contact_id, c.category_id, c.category_name, p.earliest_finish_date - current_date as days_to_earliest_finish, @@ -30,7 +33,7 @@ p.object_package_id as package_id, to_char(p.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date, to_char(p.planned_start_date, 'YYYY-MM-DD HH24:MI:SS') as start_date - FROM pm_projectsx p + FROM pm_project_status s, pm_projectsx p LEFT JOIN organizations o ON p.customer_id = o.organization_id LEFT JOIN ( @@ -51,6 +54,7 @@ where ppm.object_id = p.project_id and ppm.privilege = 'read' and ppm.party_id = :user_id) + and s.status_id = p.status_id [template::list::filter_where_clauses -and -name projects] [template::list::page_where_clause -and -name "projects" -key "p.project_id"] [template::list::orderby_clause -orderby -name projects] Index: openacs-4/packages/project-manager/lib/projects.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/projects.tcl,v diff -u -r1.32 -r1.33 --- openacs-4/packages/project-manager/lib/projects.tcl 18 Nov 2005 22:05:37 -0000 1.32 +++ openacs-4/packages/project-manager/lib/projects.tcl 12 Mar 2006 16:54:57 -0000 1.33 @@ -18,7 +18,7 @@ set required_param_list "package_id" set optional_param_list [list orderby status_id searchterm bulk_p action_p page_num page_size\ filter_p base_url end_date_f user_space_p hidden_vars] -set optional_unset_list [list assignee_id date_range is_observer_p previous_status_f current_package_f subprojects_p] +set optional_unset_list [list assignee_id etat_id contact_id date_range is_observer_p previous_status_f current_package_f subprojects_p] set dotlrn_installed_p [apm_package_installed_p dotlrn] set invoice_installed_p [apm_package_installed_p dotlrn-invoices] set contacts_installed_p [apm_package_installed_p contacts] @@ -36,7 +36,7 @@ set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] -set fmt "%x %r" +set fmt "%x %X" if { $daily_p } { set fmt "%x" } @@ -170,6 +170,7 @@ ############################################## set default_orderby [pm::project::index_default_orderby] +set default_orderby "project_name,desc" if {[exists_and_not_null orderby]} { pm::project::index_default_orderby \ @@ -181,7 +182,7 @@ if {[empty_string_p $contacts_url]} { set contact_column "@projects.customer_name@" } else { - set contact_column "@projects.customer_name@" + set contact_column "@projects.customer_name@" } # Store project names and all other project individuel data @@ -233,6 +234,23 @@ set user_space_clause "" } +# If this filter is provided we can see all projects for a given contact +set organization_id [lindex [application_data_link::get_linked -from_object_id [dotlrn_community::get_community_id] -to_object_type "organization"] 0] +set contact_filter [lrange [wieners::get_contacts -customer_id $organization_id] 1 end] +if { [exists_and_not_null contact_id] } { + set contact_where_clause "p.contact_id = :contact_id" +} else { + set contact_where_clause "" +} + +# If this filter is provided we can see all projects for a given etat +set etat_filter [lrange [wieners::get_etats -customer_id $organization_id] 1 end] +if { [exists_and_not_null etat_id] } { + set etat_where_clause "p.etat_id = :etat_id" +} else { + set etat_where_clause "" +} + # If this filter is provided we can watch the projects in # all project manager instances if { [exists_and_not_null current_package_f] } { @@ -301,6 +319,16 @@ values { {All "-1"} [pm::status::project_status_select]} \ where_clause { $status_where_clause } \ ] \ + contact_id [list \ + label "[_ acs-translations.pm_project_contact_id]" \ + values { $contact_filter } \ + where_clause {$contact_where_clause} + ] \ + etat_id [list \ + label "[_ acs-translations.pm_project_etat_id]" \ + values { $etat_filter } \ + where_clause {$etat_where_clause} + ] \ assignee_id [list \ label "[_ project-manager.Assignee]" \ default_value $user_id \ @@ -351,6 +379,14 @@ $contact_column@projects.customer_name@ " } + contact_id { + label "[_ acs-translations.pm_project_contact_id]" + display_template {@projects.contact_name@ } + } + etat_id { + label "[_ acs-translations.pm_project_etat_id]" + display_template {@projects.etat_name@ } + } creation_date { label "[_ project-manager.Creation_date]" display_template "@projects.creation_date_lc@" @@ -380,7 +416,7 @@ } status_id { label "[_ project-manager.Status_1]" - display_template "#project-manager.Closed##project-manager.Open#" + display_template {@projects.pretty_status@} } } \ -actions $actions \ @@ -468,14 +504,17 @@ width 100% } -db_multirow -extend { item_url customer_url category_select earliest_finish_date latest_finish_date start_date_lc earliest_start_date creation_date_lc planned_end_date_lc} projects project_folders " " { +db_multirow -extend { item_url customer_url category_select earliest_finish_date latest_finish_date start_date_lc earliest_start_date creation_date_lc planned_end_date_lc etat_name etat_url contact_name contact_url} projects project_folders " " { set earliest_finish_date [lc_time_fmt $earliest_finish_date $fmt] set latest_finish_date [lc_time_fmt $latest_finish_date $fmt] set creation_date_lc [lc_time_fmt $creation_date $fmt] - set start_date_lc [lc_time_fmt $start_date $fmt] + set start_date_lc [lc_time_fmt $start_date "%x"] set planned_end_date_lc [lc_time_fmt $planned_end_date $fmt] + set etat_name [contact::name -party_id $etat_id] + set etat_url "/contacts/$etat_id" + set contact_name [contact::name -party_id $contact_id -reverse_order] + set contact_url "/contacts/$contact_id" - set _base_url [site_node::get_url_from_object_id -object_id $package_id] if {![empty_string_p $_base_url]} { set base_url $_base_url Index: openacs-4/packages/project-manager/lib/search-project.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/search-project.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/project-manager/lib/search-project.xql 18 Dec 2005 20:10:38 -0000 1.2 +++ openacs-4/packages/project-manager/lib/search-project.xql 12 Mar 2006 16:54:57 -0000 1.3 @@ -11,8 +11,8 @@ from pm_projectsx where - lower(object_title) = lower(:keyword) - or lower(project_code) like '%$keyword%' + lower(object_title) like '%${keyword}%' + or lower(project_code) like '%${keyword}%' order by object_title asc Index: openacs-4/packages/project-manager/lib/tasks-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/tasks-postgresql.xql,v diff -u -r1.21 -r1.22 --- openacs-4/packages/project-manager/lib/tasks-postgresql.xql 14 Dec 2005 22:05:30 -0000 1.21 +++ openacs-4/packages/project-manager/lib/tasks-postgresql.xql 12 Mar 2006 16:54:57 -0000 1.22 @@ -88,7 +88,7 @@ - SELECT t.item_id as task_item_id + SELECT t.item_id as task_item_id FROM (select tr.item_id, ta.party_id, @@ -130,6 +130,7 @@ ti.status = s.status_id and cp.live_revision = o.object_id [template::list::filter_where_clauses -and -name tasks] + group by t.item_id, t.title, t.description, status, t.end_date, t.latest_finish, t.latest_start, t.earliest_start [template::list::orderby_clause -name tasks -orderby] Index: openacs-4/packages/project-manager/lib/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/tasks.tcl,v diff -u -r1.51 -r1.52 --- openacs-4/packages/project-manager/lib/tasks.tcl 25 Jan 2006 15:08:12 -0000 1.51 +++ openacs-4/packages/project-manager/lib/tasks.tcl 12 Mar 2006 16:54:57 -0000 1.52 @@ -1,6 +1,7 @@ # Possible Filters: # ----------------- # filter_party_id Show tasks where this party_id participates +# filter_group_id Show tasks where members of this group participate # pid_filter Show tasks only for this project_item_id # is_observer_filter Show tasks where party_id is_observer_p "t" or "f" # filter_package_id Show tasks for this package_id @@ -33,7 +34,7 @@ set required_param_list [list] set optional_param_list [list orderby searchterm page actions_p base_url page_num page_size bulk_actions_p] set optional_unset_list [list \ - filter_party_id pid_filter \ + filter_party_id filter_group_id pid_filter \ is_observer_filter instance_id filter_package_id \ subproject_tasks status_id tasks_portlet_p] @@ -173,12 +174,6 @@ edit_url] } -if ![info exist filter_package_id] { - set project_item_clause [pm::project::get_list_of_open] -} else { - set project_item_clause [pm::project::get_list_of_open -object_package_id $filter_package_id] -} - if { [exists_and_not_null subproject_tasks] && [exists_and_not_null pid_filter]} { set subprojects_list [db_list get_subprojects { } ] lappend subprojects_list $pid_filter @@ -229,12 +224,10 @@ ] \ pid_filter [list \ label "[_ project-manager.Project_1]" \ - values { $project_item_clause } \ where_clause "$project_item_where_clause" ] \ project_item_id [list \ label "[_ project-manager.Project_1]" \ - values { $project_item_clause } \ where_clause "$project_item_where_clause" ] \ instance_id [list \ @@ -247,6 +240,12 @@ filter_package_id [list \ where_clause "o.package_id = :filter_package_id" ] \ + filter_party_id [list \ + where_clause "t.party_id = :filter_party_id" + ] \ + filter_group_id [list \ + where_clause "t.party_id in (select member_id from group_member_map where group_id = :filter_group_id)" + ] \ ] if { [exists_and_not_null pid_filter] } { @@ -644,6 +643,7 @@ } else { set red_title_p 0 } + set red_title_p 0 if {[exists_and_not_null earliest_start_j]} { set slack_time [pm::task::slack_time \ Index: openacs-4/packages/project-manager/tcl/project-manager-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/project-manager-callback-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/project-manager/tcl/project-manager-callback-procs.tcl 19 Dec 2005 20:06:26 -0000 1.10 +++ openacs-4/packages/project-manager/tcl/project-manager-callback-procs.tcl 12 Mar 2006 16:54:58 -0000 1.11 @@ -36,6 +36,13 @@ } { } +ad_proc -public -callback pm::project_assign { + {-project_id:required} + {-role_id:required} + {-party_id:required} +} { +} + ad_proc -public -callback pm::project_links { {-project_id:required} } { Index: openacs-4/packages/project-manager/tcl/project-manager-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/project-manager-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/project-manager/tcl/project-manager-procs.tcl 30 Jan 2006 17:55:34 -0000 1.11 +++ openacs-4/packages/project-manager/tcl/project-manager-procs.tcl 12 Mar 2006 16:54:58 -0000 1.12 @@ -444,7 +444,6 @@ if {[string equal $type task]} { set assignees $to - if {[llength $assignees] > 0} { set from_address [db_string get_from_email "select email from parties where party_id = :user_id" -default "nobody@nowhere.com"] @@ -470,7 +469,8 @@ -body $content \ -mime_type "text/html" \ -object_id "$project_item_id" \ - -no_callback_p + -use_sender \ + -no_callback } } @@ -481,7 +481,6 @@ if {[string equal $type project]} { set assignees $to - if {[llength $assignees] > 0} { set from_address [db_string get_from_email "select email from parties where party_id = :user_id" -default "nobody@nowhere.com"] @@ -507,7 +506,8 @@ -body $content \ -mime_type "text/html" \ -object_id "$object_id" \ - -no_callback_p + -no_callback \ + -use_sender } } @@ -578,12 +578,14 @@ foreach to $to_addr { if { ![empty_string_p $to] } { acs_mail_lite::complex_send \ - -send_immediately \ -to_addr "$to" \ -from_addr "$from_addr" \ -subject "$subject" \ - -body $content \ - -object_id $object_id + -body $body \ + -object_id $object_id \ + -mime_type $mime_type \ + -no_callback \ + -use_sender } } } Index: openacs-4/packages/project-manager/tcl/project-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/project-procs.tcl,v diff -u -r1.28 -r1.29 --- openacs-4/packages/project-manager/tcl/project-procs.tcl 27 Jan 2006 07:54:36 -0000 1.28 +++ openacs-4/packages/project-manager/tcl/project-procs.tcl 12 Mar 2006 16:54:58 -0000 1.29 @@ -1743,6 +1743,7 @@ {-role_id:required} {-party_id:required} {-send_email_p "f"} + -no_callback:boolean } { Assigns a user to a project @@ -1785,7 +1786,7 @@ # Flush the cache that remembers which roles to offer the current user in the 'assign role to myself' listbox util_memoize_flush [list pm::role::project_select_list_filter_not_cached -project_item_id $project_item_id -party_id $party_id] - if {[string is true $send_email_p] || [string is true [parameter::get -parameter "SendAssignEmailsP"]]} { + if {0 && ([string is true $send_email_p] || [string is true [parameter::get -parameter "SendAssignEmailsP"]])} { set project_name [pm::project::name \ -project_item_id $project_item_id] @@ -1810,6 +1811,10 @@ -mime_type "text/html" } + if {!$no_callback_p} { + callback pm::project_assign -project_id $project_item_id -role_id $role_id -party_id $party_id + } + return } @@ -1943,7 +1948,7 @@ } { if {[exists_and_not_null status_id]} { - set status_clause "p.status_id = :status_id and" + set status_clause "p.status_id in ([join $status_id ,]) and" } else { set status_clause "" } @@ -2046,7 +2051,7 @@ } { if {[exists_and_not_null project_item_id]} { - return [db_string get_name { + return [db_string get_item_name { SELECT title FROM @@ -2084,7 +2089,7 @@ @error } { set package_id [db_string package_id "select distinct object_package_id from pm_projectsx where item_id = :project_item_id"] - return "[apm_package_url_from_id $package_id]one?project_item_id=$project_item_id" + return "[ad_url]/[apm_package_url_from_id $package_id]one?project_item_id=$project_item_id" } @@ -2251,6 +2256,10 @@ set latest_finish($my_iid) $task_deadline set hours_to_complete $activity_time($my_iid) + + if {[string eq $hours_to_complete ""]} { + set hours_to_complete 0 + } set date [lindex [split $task_deadline " "] 0] set hours [lindex [split [lindex [split $task_deadline " "] 1] :] 0] Index: openacs-4/packages/project-manager/tcl/status-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/status-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/project-manager/tcl/status-procs.tcl 9 Jun 2005 16:40:39 -0000 1.4 +++ openacs-4/packages/project-manager/tcl/status-procs.tcl 12 Mar 2006 16:54:58 -0000 1.5 @@ -13,14 +13,14 @@ namespace eval pm::status {} ad_proc -public pm::status::open_p { - -task_status_id:required + -project_status_id:required } { - Returns t if the task status code is open, f otherwise + Returns t if the project status code is open, f otherwise @author Jade Rubick (jader@bread.com) @creation-date 2004-05-21 - @param task_status_id + @param project_status_id @return @@ -31,9 +31,9 @@ SELECT case when status_type = 'c' then 'f' else 't' end FROM - pm_task_status + pm_project_status WHERE - status_id = :task_status_id + status_id = :project_status_id }] return $return_val 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.18 -r1.19 --- openacs-4/packages/project-manager/tcl/task-procs.tcl 14 Dec 2005 22:05:30 -0000 1.18 +++ openacs-4/packages/project-manager/tcl/task-procs.tcl 12 Mar 2006 16:54:58 -0000 1.19 @@ -2493,7 +2493,7 @@ # project - if {![string equal $old_project_item_id $project_item_id_array($tid)]} { + if {![string equal $old_project_item_id $project_item_id_array($tid)] && ![empty_string_p $old_project_item_id]} { set old [pm::project::name -project_item_id $old_project_item_id] Index: openacs-4/packages/project-manager/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/index.adp,v diff -u -r1.13 -r1.14 --- openacs-4/packages/project-manager/www/index.adp 13 Nov 2005 17:54:44 -0000 1.13 +++ openacs-4/packages/project-manager/www/index.adp 12 Mar 2006 16:54:58 -0000 1.14 @@ -10,8 +10,10 @@ status_id="@status_id@" searchterm="@searchterm@" assignee_id="@assignee_id@" + contact_id="@contact_id@" + etat_id="@etat_id@" category_id="@pass_cat@" - elements="project_code customer_name category_id creation_date start_date planned_end_date actual_hours_completed status_id" + elements="project_code customer_name contact_id etat_id category_id start_date planned_end_date status_id" package_id=@package_id@ actions_p="1" bulk_p="1" Index: openacs-4/packages/project-manager/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/index.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/project-manager/www/index.tcl 8 Jan 2006 10:54:45 -0000 1.13 +++ openacs-4/packages/project-manager/www/index.tcl 12 Mar 2006 16:54:58 -0000 1.14 @@ -24,6 +24,8 @@ category_id:multiple,optional {format "normal"} {assignee_id ""} + {contact_id ""} + {etat_id ""} {user_space_p "0"} {subprojects_p "t"} {is_observer_p ""} Index: openacs-4/packages/project-manager/www/send-mail.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/send-mail.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/project-manager/www/send-mail.adp 30 Sep 2005 21:43:19 -0000 1.2 +++ openacs-4/packages/project-manager/www/send-mail.adp 12 Mar 2006 16:54:58 -0000 1.3 @@ -13,6 +13,6 @@ --> - + Index: openacs-4/packages/project-manager/www/send-mail.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/send-mail.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/project-manager/www/send-mail.tcl 30 Sep 2005 20:51:57 -0000 1.2 +++ openacs-4/packages/project-manager/www/send-mail.tcl 12 Mar 2006 16:54:58 -0000 1.3 @@ -32,4 +32,10 @@ } } +set employee_list [group::get_members -group_id [group::get_id -group_name "Employees"]] +foreach employee_id $employee_list { + if {[lsearch -exact $party_ids $employee_id] == -1} { + lappend party_ids $employee_id + } +} Index: openacs-4/packages/project-manager/www/task-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-delete.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/project-manager/www/task-delete.tcl 15 Jun 2005 05:46:42 -0000 1.4 +++ openacs-4/packages/project-manager/www/task-delete.tcl 12 Mar 2006 16:54:58 -0000 1.5 @@ -72,7 +72,7 @@ db_1row task_query { } - set description [list $description $mime_type] + set description [list [lang::util::localize $description] $mime_type] } \ -mode display \ Index: openacs-4/packages/project-manager/www/admin/logger-sync.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/admin/logger-sync.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/project-manager/www/admin/logger-sync.tcl 26 May 2005 09:34:30 -0000 1.3 +++ openacs-4/packages/project-manager/www/admin/logger-sync.tcl 12 Mar 2006 16:54:58 -0000 1.4 @@ -51,7 +51,7 @@ set organization_id [lindex $project 5] set logger_project [lindex $project 6] - set active_p [pm::status::open_p -task_status_id $status_id] + set active_p [pm::status::open_p -project_status_id $status_id] set customer_name [organizations::name -organization_id "$organization_id"] if {![empty_string_p $customer_name]} { append customer_name " - " Index: openacs-4/packages/project-manager/www/comments/add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/comments/add.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/project-manager/www/comments/add.tcl 30 Jan 2006 17:55:35 -0000 1.6 +++ openacs-4/packages/project-manager/www/comments/add.tcl 12 Mar 2006 16:54:58 -0000 1.7 @@ -38,6 +38,8 @@ set assignees [pm::task::assignee_role_list -task_item_id $object_id] } +set show_role_p 1 + set assignee_list [list] if { $exclude_observers_p } { foreach assignee $assignees { @@ -47,15 +49,43 @@ # Not an observer. Added to the list set name [contact::name -party_id [lindex $assignee 0]] set email [party::email -party_id [lindex $assignee 0]] - lappend assignee_list [list "$name ($email)" $email] + + if {$show_role_p} { + # display assigned role + lappend assignee_list [list "$name ($email) ([pm::role::name -role_id [lindex $assignee 1]])" $email] + } else { + lappend assignee_list [list "$name ($email)" $email] + } } } } else { # We want every assignee so we just get the assignees name foreach assignee $assignees { set name [contact::name -party_id [lindex $assignee 0]] set email [party::email -party_id [lindex $assignee 0]] + + if {$show_role_p} { + # display assigned role + lappend assignee_list [list "$name ($email) ([pm::role::name -role_id [lindex $assignee 1]])" $email] + } else { + lappend assignee_list [list "$name ($email)" $email] + } + } +} + +set listed_emails {} +foreach assignee $assignee_list { + lappend listed_emails [lindex $assignee 1] +} + +set employee_list [group::get_members -group_id [group::get_id -group_name "Employees"]] +foreach employee_id $employee_list { + set name [contact::name -party_id $employee_id] + set email [party::email -party_id $employee_id] + + if {[lsearch -exact $listed_emails $email] == -1} { lappend assignee_list [list "$name ($email)" $email] + lappend listed_emails $email } } @@ -87,30 +117,57 @@ # We will add a check/uncheck element to call the javascript function, # this works only when the elements in the list is greather than one -if { [llength $assignee_list] > 1 } { - ad_form -extend -name comment -form { - {check_uncheck:text(checkbox),multiple,optional - {label "[_ project-manager.check_uncheck]"} - {options {{"" 1}}} - {value 1} - {section "[_ project-manager.Email]" } - {html {onclick check_uncheck_boxes(this.checked)}} - } - {to:text(checkbox),optional,multiple - {label "[_ project-manager.Send_email]"} - {options $assignee_list} - {html {checked 1}} - } - } +set default_checked_p 0 + +if {$default_checked_p} { + if { [llength $assignee_list] > 1 } { + ad_form -extend -name comment -form { + {check_uncheck:text(checkbox),multiple,optional + {label "[_ project-manager.check_uncheck]"} + {options {{"" 1}}} + {value 1} + {section "[_ project-manager.Email]" } + {html {onclick check_uncheck_boxes(this.checked)}} + } + {to:text(checkbox),optional,multiple + {label "[_ project-manager.Send_email]"} + {options $assignee_list} + {html {checked 1}} + } + } + } else { + ad_form -extend -name comment -form { + {to:text(checkbox),optional + {label "[_ project-manager.Send_email]"} + {section "[_ project-manager.Email]" } + {options $assignee_list} + {html {checked 1}} + } + } + } } else { - ad_form -extend -name comment -form { - {to:text(checkbox),optional - {label "[_ project-manager.Send_email]"} - {section "[_ project-manager.Email]" } - {options $assignee_list} - {html {checked 1}} - } - } + if { [llength $assignee_list] > 1 } { + ad_form -extend -name comment -form { + {check_uncheck:text(checkbox),multiple,optional + {label "[_ project-manager.check_uncheck]"} + {options {{"" 1}}} + {section "[_ project-manager.Email]" } + {html {onclick check_uncheck_boxes(this.checked)}} + } + {to:text(checkbox),optional,multiple + {label "[_ project-manager.Send_email]"} + {options $assignee_list} + } + } + } else { + ad_form -extend -name comment -form { + {to:text(checkbox),optional + {label "[_ project-manager.Send_email]"} + {section "[_ project-manager.Email]" } + {options $assignee_list} + } + } + } } ad_form -extend -name comment -form { @@ -124,7 +181,7 @@ set description [template::util::richtext::create "" {}] } -on_submit { - + # insert the comment into the database set description_body [template::util::richtext::get_property contents $description] set description_format [template::util::richtext::get_property format $description]