Commit 1c71384a authored by Frank Bergmann's avatar Frank Bergmann

- first version - more or less - working

- deleting releationship needs to be fixed
- association with other tickets doesn't work yet
parent a9abf440
...@@ -634,6 +634,41 @@ ad_proc -public im_helpdesk_new_ticket_ticket_rel { ...@@ -634,6 +634,41 @@ ad_proc -public im_helpdesk_new_ticket_ticket_rel {
# Selects & Options # Selects & Options
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
ad_proc -public im_ticket_options {
{-include_empty_p 1}
{-include_empty_name "" }
{-maxlen_name 50 }
} {
Returns a list of Tickets suitable for ad_form
} {
set user_id [ad_get_user_id]
set ticket_sql "
select child.*,
t.*
from im_projects child,
im_projects parent,
im_tickets t
where parent.parent_id is null and
child.project_id = t.ticket_id and
child.tree_sortkey between parent.tree_sortkey and tree_right(parent.tree_sortkey)
order by
child.project_nr,
child.project_name
"
set options [list]
db_foreach tickets $ticket_sql {
lappend options [list "$project_nr - [string range $project_name 0 $maxlen_name]" $ticket_id]
}
if {$include_empty_p} { set options [linsert $options 0 "$include_empty_name {}"] }
return $options
}
ad_proc -public im_helpdesk_ticket_queue_options { ad_proc -public im_helpdesk_ticket_queue_options {
{-mine_p 0} {-mine_p 0}
{-include_empty_p 1} {-include_empty_p 1}
...@@ -722,6 +757,12 @@ ad_proc -public im_helpdesk_ticket_sla_options { ...@@ -722,6 +757,12 @@ ad_proc -public im_helpdesk_ticket_sla_options {
} }
# ----------------------------------------------------------------------
# Portlets
# ---------------------------------------------------------------------
ad_proc -public im_helpdesk_home_component { ad_proc -public im_helpdesk_home_component {
{-show_empty_ticket_list_p 1} {-show_empty_ticket_list_p 1}
{-view_name "ticket_personal_list" } {-view_name "ticket_personal_list" }
......
...@@ -6,12 +6,18 @@ ...@@ -6,12 +6,18 @@
# http://www.project-open.com/license/ for details. # http://www.project-open.com/license/ for details.
ad_page_contract { ad_page_contract {
Allow the user to associate the current ticket with a new object Associate the ticket_ids in "tid" with one of the specified objects.
using an OpenACS relationship. target_object_type specifies the type of object to associate with and
determines which parameters are used.
@author frank.bergmann@project-open.com @author frank.bergmann@project-open.com
} { } {
{ tid ""} { tid ""}
{ target_object_type "" } { target_object_type "" }
{ user_id "" }
{ role_id "" }
{ release_project_id "" }
{ conf_item_id "" }
{ ticket_id "" }
{ return_url "/intranet-helpdesk/index" } { return_url "/intranet-helpdesk/index" }
} }
...@@ -34,4 +40,75 @@ foreach ticket_id $tid { ...@@ -34,4 +40,75 @@ foreach ticket_id $tid {
if {!$write} { ad_return_complaint 1 $action_forbidden_msg } if {!$write} { ad_return_complaint 1 $action_forbidden_msg }
} }
set first_ticket_id [lindex $tid 0] # ---------------------------------------------------------------
#
# ---------------------------------------------------------------
switch $target_object_type {
user {
# user_id contains the user to associate with
# role_id contains the type of association (member or admin)
if {"" == $role_id} { ad_return_complaint 1 [lang::message::lookup "" intranet-helpdesk.No_Role_Specified "No role specified"] }
foreach t $tid {
im_biz_object_add_role $user_id $t $role_id
}
}
release_project {
# release_project_id contains the project to associate
foreach pid $tid {
set exists_p [db_string count "
select count(*)
from im_release_items i,
acs_rels r
where
i.rel_id = r.rel_id
and r.object_id_one = :release_project_id
and r.object_id_two = :pid
"]
if {!$exists_p} {
set max_sort_order [db_string max_sort_order "
select coalesce(max(i.sort_order),0)
from im_release_items i,
acs_rels r
where i.rel_id = r.rel_id
and r.object_id_one = :release_project_id
" -default 0]
set release_status_id [im_release_mgmt_status_default]
db_string add_user "
select im_release_item__new (
null,
'im_release_item',
:release_project_id,
:pid,
null,
:current_user_id,
'[ad_conn peeraddr]',
:release_status_id,
[expr $max_sort_order + 10]
)
"
}
}
}
conf_item {
foreach t $tid {
im_conf_item_new_project_rel \
-project_id $t \
-conf_item_id $conf_item_id
}
}
ticket {
}
default {
ad_return_complaint 1 [lang::message::lookup "" intranet-helpdesk.Unknown_target_object_type "Unknown object type %target_object_type%"]
}
}
ad_returnredirect $return_url
...@@ -6,54 +6,65 @@ ...@@ -6,54 +6,65 @@
<h1>@page_title@</h1> <h1>@page_title@</h1>
<p> <p>
This page allows you to associated your tickets with other objects: <%= [lang::message::lookup "" intranet-helpdesk.Associate_Tickets_Msg "This page allows you to associated your tickets with other objects."] %>
</p> </p>
<br>
<form action=associate-2 method=GET> <form action=associate-2 method=GET>
<%= [export_form_vars tid return_url] %> <%= [export_form_vars tid return_url] %>
<table> <table>
<tr> <tr>
<th>&nbsp;</th> <th colspan=2><%= [lang::message::lookup "" intranet-helpdesk.Associate_With "Associate With"] %></th>
<th>Associate with</th> <th> <%= [lang::message::lookup "" intranet-helpdesk.Object Object] %></th>
<th>Comment</th> <th> <%= [lang::message::lookup "" intranet-helpdesk.Comment Comment] %></th>
</tr> </tr>
<tr> <tr>
<td><input type=radio name=target_object_type value=user></td> <td> <input type=radio name=target_object_type value=user></td>
<td>User</td> <td> <%= [lang::message::lookup "" intranet-helpdesk.Object_Type_User "User"] %></td>
<td> <td> <%= [im_user_select user_id ""] %><br>
Add a new user to the tickets.<br> <%= [lang::message::lookup "" intranet-helpdesk.Associate_As "as"] %>&nbsp;
Users can be added either as "members" or "administrators". <%= [im_biz_object_roles_select role_id $first_ticket_id [im_biz_object_role_full_member]] %>
</td>
<td> <%= [lang::message::lookup "" intranet-helpdesk.Associate_Msg_User "
Add a new user to the tickets.<br>
Users can be added either as 'members' or 'administrators'."] %>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><input type=radio name=target_object_type value=release_project></td> <td> <input type=radio name=target_object_type value=release_project></td>
<td>Release Project</td> <td> <%= [lang::message::lookup "" intranet-helpdesk.Object_Type_Release_Project "Release Project"] %></td>
<td>Make your tickets "release items" of a software Release Project. <br> <td> <%= [im_project_select -project_type_id [im_project_type_software_release] release_project_id] %></td>
Release items are those changes to software that are included in a specific release. <td> <%= [lang::message::lookup "" intranet-helpdesk.Associate_Msg_Release_Project "
Make your tickets 'release items' of a software Release Project. <br>
Release items are those changes to software that are included in a specific release."] %>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><input type=radio name=target_object_type value=conf_item></td> <td> <input type=radio name=target_object_type value=conf_item></td>
<td>Configuration Item</td> <td> <%= [lang::message::lookup "" intranet-helpdesk.Object_Type_Configuration_Item "Configuration Item"] %></td>
<td>Associate your tickets with a configuration item.<br> <td> <%= [im_select -ad_form_option_list_style_p 1 conf_item_id [im_conf_item_options]] %></td>
A configuration item is a hardware or software item that is affected by your tickets. <td> <%= [lang::message::lookup "" intranet-helpdesk.Associate_Msg_Conf_Item "
Associate your tickets with a configuration item.<br>
A configuration item is a hardware or software item that is affected by your tickets."] %>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><input type=radio name=target_object_type value=ticket></td> <td> <input type=radio name=target_object_type value=ticket></td>
<td>Ticket</td> <td> <%= [lang::message::lookup "" intranet-helpdesk.Object_Type_Ticket Ticket] %></td>
<td>Associate your tickets with another ticket.<br> <td> <%= [im_select -ad_form_option_list_style_p 1 ticket_id [im_ticket_options -maxlen_name 30]] %></td>
This is used for escalating and for referencing another ticket. <td> <%= [lang::message::lookup "" intranet-helpdesk.Associate_Msg_Ticket "
Associate your tickets with another ticket.<br>
This is used for escalating and for referencing another ticket."] %>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td><input type=submit name=submit value="Associate"></td> <td><input type=submit name=submit value="<%= [lang::message::lookup "" intranet-helpdesk.Associate_Assoc_Action Associate] %>"></td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
......
...@@ -20,7 +20,7 @@ ad_page_contract { ...@@ -20,7 +20,7 @@ ad_page_contract {
# --------------------------------------------------------------- # ---------------------------------------------------------------
set current_user_id [ad_maybe_redirect_for_registration] set current_user_id [ad_maybe_redirect_for_registration]
set page_title [lang::message::lookup "" intranet-helpdesk.Associate_Ticket_With_Other_Object "Associate Ticket With Other Object"] set page_title [lang::message::lookup "" intranet-helpdesk.Associate_Ticket_With_Other_Object "Associate Tickets With Another Object"]
set context_bar [im_context_bar $page_title] set context_bar [im_context_bar $page_title]
set page_focus "im_header_form.keywords" set page_focus "im_header_form.keywords"
set action_forbidden_msg [lang::message::lookup "" intranet-helpdesk.Action_Forbidden "<b>Unable to execute action</b>:<br>You don't have the permissions to execute the action '%action_name%' on this ticket."] set action_forbidden_msg [lang::message::lookup "" intranet-helpdesk.Action_Forbidden "<b>Unable to execute action</b>:<br>You don't have the permissions to execute the action '%action_name%' on this ticket."]
...@@ -35,4 +35,7 @@ foreach ticket_id $tid { ...@@ -35,4 +35,7 @@ foreach ticket_id $tid {
if {!$write} { ad_return_complaint 1 $action_forbidden_msg } if {!$write} { ad_return_complaint 1 $action_forbidden_msg }
} }
set first_ticket_id [lindex $tid 0]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment