Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-helpdesk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-helpdesk
Commits
6d4c8388
Commit
6d4c8388
authored
Jan 27, 2011
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- updates from Versia
parent
954e7ae5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
159 additions
and
73 deletions
+159
-73
intranet-helpdesk-create.sql
sql/postgresql/intranet-helpdesk-create.sql
+4
-2
intranet-helpdesk-procs.tcl
tcl/intranet-helpdesk-procs.tcl
+132
-0
action.tcl
www/action.tcl
+23
-71
No files found.
sql/postgresql/intranet-helpdesk-create.sql
View file @
6d4c8388
...
...
@@ -740,8 +740,6 @@ delete from im_categories where category_type = 'Intranet Ticket Action';
SELECT
im_category_new
(
30500
,
'Close'
,
'Intranet Ticket Action'
);
SELECT
im_category_new
(
30510
,
'Close & notify'
,
'Intranet Ticket Action'
);
-- SELECT im_category_new(30515, 'Freeze', 'Intranet Ticket Action');
SELECT
im_category_new
(
30590
,
'Delete'
,
'Intranet Ticket Action'
);
SELECT
im_category_new
(
30599
,
'Nuke'
,
'Intranet Ticket Action'
);
-- Custom screen for duplicate action to select base
...
...
@@ -755,6 +753,10 @@ SELECT im_category_new(30540, 'Associate', 'Intranet Ticket Action');
SELECT
im_category_new
(
30550
,
'Escalate'
,
'Intranet Ticket Action'
);
SELECT
im_category_new
(
30552
,
'Close Escalated Tickets'
,
'Intranet Ticket Action'
);
SELECT
im_category_new
(
30560
,
'Resolved'
,
'Intranet Ticket Action'
);
SELECT
im_category_new
(
30590
,
'Delete'
,
'Intranet Ticket Action'
);
SELECT
im_category_new
(
30599
,
'Nuke'
,
'Intranet Ticket Action'
);
...
...
tcl/intranet-helpdesk-procs.tcl
View file @
6d4c8388
...
...
@@ -598,6 +598,138 @@ namespace eval im_ticket {
# Write Audit Trail
im_project_audit -project_id
$ticket
_id -action create
}
ad_proc -public check_permissions
{
{
-check_only_p 0
}
-ticket_id:required
-operation:required
}
{
Check if the user can perform view, read, write or admin the ticket
}
{
set user_id
[
ad_get_user_id
]
set user_name
[
im_name_from_user_id
$user
_id
]
im_ticket_permissions
$user
_id
$ticket
_id view read write admin
if
{[
lsearch
{
view read write admin
}
$operation
]
< 0
}
{
ad_return_complaint 1
"Invalid operation '
$operation
':<br>Expected view, read, write or admin"
ad_script_abort
}
set perm
[
set
$operation
]
# Just return the result check_only_p is set
if
{
$check
_only_p
}
{
return
$perm
}
if
{
!$perm
}
{
set action_forbidden_msg
[
lang::message::lookup
""
intranet-helpdesk.Forbidden_operation on ticket
"
<b>Unable to perform operation '%operation%'</b>:<br>You don't have the necessary permissions for ticket #%ticket_id%."
]
ad_return_complaint 1
$action
_forbidden_msg
ad_script_abort
}
return
$perm
}
ad_proc -public set_status_id
{
-ticket_id:required
-ticket_status_id:required
}
{
Set the ticket to the specified status.
The procedure deals with some special cases
}
{
set user_id
[
ad_get_user_id
]
set user_name
[
im_name_from_user_id
$user
_id
]
im_ticket_permissions
$user
_id
$ticket
_id view read write admin
if
{
!$write
}
{
set action_forbidden_msg
[
lang::message::lookup
""
intranet-helpdesk.Forbidden_to_change_ticket_status_msg
"
<b>Unable to change the status of the ticket</b>:<br>You don't have the permissions to modify ticket #%ticket_id%."
]
ad_return_complaint 1
$action
_forbidden_msg
ad_script_abort
}
db_dml update_ticket_status
"
update im_tickets set
ticket_status_id = :ticket_status_id
where ticket_id = :ticket_id
"
# Add a message to the forum
set ticket_status
[
im_category_from_id
$ticket
_status_id
]
im_ticket::add_reply -ticket_id
$ticket
_id -subject
\
[
lang::message::lookup
""
intranet-helpdesk.Set_to_status_by_user
"Set to status '%ticket_status%' by %user_name%"
]
# Set the status of the underlying project depending on the ticket status
set project_status_id
""
if
{[
im_category_is_a
$ticket
_status_id
[
im_ticket_status_open
]]}
{
set project_status_id
[
im_project_status_open
]
}
if
{[
im_category_is_a
$ticket
_status_id
[
im_ticket_status_closed
]]}
{
set project_status_id
[
im_project_status_closed
]
}
if
{
""
!=
$project
_status_id
}
{
db_dml update_ticket_project_status
"
update im_projects set
project_status_id =
[
im_project_status_closed
]
where project_id = :ticket_id
"
}
else
{
ad_return_complaint 1
"Internal Error: Found invalid ticket_status_id=
$ticket
_status_id"
ad_script_abort
}
}
ad_proc -public close_workflow
{
-ticket_id:required
}
{
Stop the ticket workflow.
}
{
# Cancel associated workflow
im_workflow_cancel_workflow -object_id
$ticket
_id
}
ad_proc -public audit
{
-ticket_id:required
-action:required
}
{
Write the audit trail
}
{
# Write Audit Trail
im_project_audit -project_id
$ticket
_id -action
$action
}
ad_proc -public close_forum
{
-ticket_id:required
}
{
Set the ticket forum to
"deleted"
}
{
# Close associated forum by moving to
"deleted"
folder
db_dml move_to_deleted
"
update im_forum_topic_user_map
set folder_id = 1
where topic_id in (
select t.topic_id
from im_forum_topics t
where t.object_id = :ticket_id
)
"
}
ad_proc -public update_timestamp
{
-timestamp:required
-ticket_id:required
}
{
Set the specified timestamp
(
s
)
to now
()
}
{
foreach ts
$timestamp
{
switch
$ts
{
done
{
set column
"ticket_done_date"
}
default
{
set column
""
}
}
if
{
""
!=
$column
}
{
db_dml update_ticket_timestamp
"
update im_tickets set
ticket_done_date = now()
where ticket_id = :ticket_id
"
}
}
}
}
...
...
www/action.tcl
View file @
6d4c8388
...
...
@@ -45,36 +45,12 @@ switch $action_id {
30500 - 30510
{
# Close and
"Close & Notify"
foreach ticket_id
$tid
{
im_ticket_permissions
$user
_id
$ticket
_id view read write admin
if
{
!$write
}
{
ad_return_complaint 1
$action
_forbidden_msg
}
db_dml close_ticket
"
update im_tickets set
ticket_status_id =
[
im_ticket_status_closed
]
,
ticket_done_date = now()
where ticket_id = :ticket_id
"
db_dml close_ticket
"
update im_projects set
project_status_id =
[
im_project_status_closed
]
where project_id = :ticket_id
"
im_ticket::add_reply -ticket_id
$ticket
_id -subject
\
[
lang::message::lookup
""
intranet-helpdesk.Closed_by_user
"Closed by %user_name%"
]
# Cancel associated workflow
im_workflow_cancel_workflow -object_id
$ticket
_id
# Close associated forum by moving to
"deleted"
folder
db_dml move_to_deleted
"
update im_forum_topic_user_map
set folder_id = 1
where topic_id in (
select t.topic_id
from im_forum_topics t
where t.object_id = :ticket_id
)
"
im_ticket::check_permissions -ticket_id
$ticket
_id -operation
"write"
im_ticket::set_status_id -ticket_id
$ticket
_id -ticket_status_id
[
im_ticket_status_closed
]
im_ticket::update_timestamp -ticket_id
$ticket
_id -timestamp
"done"
im_ticket::close_workflow -ticket_id
$ticket
_id
im_ticket::close_forum -ticket_id
$ticket
_id
im_ticket::audit -ticket_id
$ticket
_id -action
"update"
}
if
{
$action
_id == 30510
}
{
...
...
@@ -85,22 +61,9 @@ switch $action_id {
30530
{
# Reopen
foreach ticket_id
$tid
{
im_ticket_permissions
$user
_id
$ticket
_id view read write admin
if
{
!$write
}
{
ad_return_complaint 1
$action
_forbidden_msg
}
db_dml reopen_ticket
"
update im_tickets set ticket_status_id =
[
im_ticket_status_open
]
where ticket_id = :ticket_id
"
# Re-Open the project as well
db_dml close_ticket
"
update im_projects set
project_status_id =
[
im_project_status_open
]
where project_id = :ticket_id
"
im_ticket::add_reply -ticket_id
$ticket
_id -subject
\
[
lang::message::lookup
""
intranet-helpdesk.Re_opened_by_user
"Re-opened by %user_name%"
]
im_ticket::check_permissions -ticket_id
$ticket
_id -operation
"write"
im_ticket::set_status_id -ticket_id
$ticket
_id -ticket_status_id
[
im_ticket_status_open
]
im_ticket::audit -ticket_id
$ticket
_id -action
"update"
}
}
30540
{
...
...
@@ -134,51 +97,40 @@ switch $action_id {
30560
{
# Resolved
foreach ticket_id
$tid
{
im_ticket_permissions
$user
_id
$ticket
_id view read write admin
if
{
!$write
}
{
ad_return_complaint 1
$action
_forbidden_msg
}
db_dml resolved_ticket
"
update im_tickets set
ticket_status_id =
[
im_ticket_status_resolved
]
,
ticket_done_date = now()
where ticket_id = :ticket_id
"
im_ticket::add_reply -ticket_id
$ticket
_id -subject
\
[
lang::message::lookup
""
intranet-helpdesk.Deleted_by_user
"Resolved by %user_name%"
]
im_ticket::check_permissions -ticket_id
$ticket
_id -operation
"write"
im_ticket::set_status_id -ticket_id
$ticket
_id -ticket_status_id
[
im_ticket_status_resolved
]
im_ticket::update_timestamp -ticket_id
$ticket
_id -timestamp
"done"
im_ticket::audit -ticket_id
$ticket
_id -action
"update"
}
}
30590
{
# Delete
foreach ticket_id
$tid
{
im_ticket_permissions
$user
_id
$ticket
_id view read write admin
if
{
!$write
}
{
ad_return_complaint 1
$action
_forbidden_msg
}
db_dml close_ticket
"
update im_tickets set ticket_status_id =
[
im_ticket_status_deleted
]
where ticket_id = :ticket_id
"
im_ticket::add_reply -ticket_id
$ticket
_id -subject
\
[
lang::message::lookup
""
intranet-helpdesk.Deleted_by_user
"Deleted by %user_name%"
]
im_ticket::check_permissions -ticket_id
$ticket
_id -operation
"write"
im_ticket::set_status_id -ticket_id
$ticket
_id -ticket_status_id
[
im_ticket_status_deleted
]
im_ticket::close_workflow -ticket_id
$ticket
_id
im_ticket::close_forum -ticket_id
$ticket
_id
im_ticket::audit -ticket_id
$ticket
_id -action
"update"
}
}
30599
{
# Nuke
if
{
!$user_is_admin_p
}
{
ad_return_complaint 1
"User needs to be SysAdmin in order to 'Nuke' tickets.<br>Please use 'Delete' otherwise."
}
if
{
!$user_is_admin_p
}
{
ad_return_complaint 1
"User needs to be SysAdmin in order to 'Nuke' tickets.<br>Please use 'Delete' otherwise."
ad_script_abort
}
foreach ticket_id
$tid
{
im_ticket_permissions
$user
_id
$ticket
_id view read write admin
if
{
!$admin
}
{
ad_return_complaint 1
$action
_forbidden_msg
}
im_ticket::check_permissions -ticket_id
$ticket
_id -operation
"admin"
im_project_nuke
$ticket
_id
}
}
default
{
# Check if we've got a custom action to perform
set redirect_base_url
[
db_string redir
"select aux_string1 from im_categories where category_id = :action_id"
-default
""
]
if
{
""
!=
[
string
trim
$redirect
_base_url
]}
{
# Redirect for custom action
set redirect_url
[
export_vars -base
$redirect
_base_url
{
action_id return_url
}]
foreach ticket_id
$tid
{
append redirect_url
"&tid=
$ticket
_id"
}
# ad_return_complaint 1 $redirect_url
ad_returnredirect
$redirect
_url
}
else
{
ad_return_complaint 1
"Unknown Ticket action:
$action
_id='
[
im_category_from_id
$action
_id
]
'"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment