| |
35 |
35 |
if {[llength $package_id_list] > 1} { |
| |
36 |
36 |
ns_log Error "acs_mail_lite::incoming_email -impl bug-tracker found two bug tracker instances that has EmailPostID ${email_post_id}. These are ${package_id_list}. Bug entry creation failed." |
| |
37 |
37 |
return "" |
| |
38 |
38 |
} elseif {[llength $package_id_list] == 0} { |
| |
39 |
39 |
ns_log Warning "acs_mail_lite::incoming_email -impl bug-tracker did not find any bug tracker instance with EmailPostID ${email_post_id}. Bug entry creation failed." |
| |
40 |
40 |
return "" |
| |
41 |
41 |
} else { |
| |
42 |
42 |
set package_id [lindex $package_id_list 0] |
| |
43 |
43 |
|
| |
44 |
44 |
set user_id [party::get_by_email -email $email(from)] |
| |
45 |
45 |
if {$user_id eq ""} { |
| |
46 |
46 |
# spam control |
| |
47 |
47 |
return "" |
| |
48 |
48 |
} elseif {![permission::permission_p -party_id $user_id -object_id $package_id -privilege create -no_login]} { |
| |
49 |
49 |
# no rights |
| |
50 |
50 |
return "" |
| |
51 |
51 |
} |
| |
52 |
52 |
|
| |
53 |
53 |
template::util::list_of_lists_to_array $email(bodies) email_body |
| |
54 |
54 |
|
| |
55 |
|
if {[exists_and_not_null email_body(text/html)]} { |
| |
|
55 |
if {[info exists email_body(text/html)] && $email_body(text/html) ne ""} { |
| |
56 |
56 |
set body [ad_html_to_text -- $email_body(text/html)] |
| |
57 |
57 |
} else { |
| |
58 |
58 |
set body $email_body(text/plain) |
| |
59 |
59 |
} |
| |
60 |
60 |
|
| |
61 |
61 |
# default mostly to blanks |
| |
62 |
62 |
# improve on this later if we want to include |
| |
63 |
63 |
# bug settings on the email |
| |
64 |
64 |
|
| |
65 |
65 |
set bug_id [db_nextval acs_object_id_seq] |
| |
66 |
66 |
set components_list [bug_tracker::components_get_options -package_id $package_id] |
| |
67 |
67 |
if {[llength $components_list] == 0} { |
| |
68 |
68 |
set component_id {} |
| |
69 |
69 |
} else { |
| |
70 |
70 |
set component_id [lindex $components_list 0 1] |
| |
71 |
71 |
} |
| |
72 |
72 |
set found_in_version {} |
| |
73 |
73 |
if {[llength $email(subject)] == 1} { |
| |
74 |
74 |
set summary [lindex $email(subject) 0] |
| |
75 |
75 |
} else { |