Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
50c02ff2
Commit
50c02ff2
authored
11 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
Implement help topic forms for all new tickets
(regardless of the source)
parent
37b657bd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/api.tickets.php
+0
-14
0 additions, 14 deletions
include/api.tickets.php
include/class.ticket.php
+39
-19
39 additions, 19 deletions
include/class.ticket.php
open.php
+0
-15
0 additions, 15 deletions
open.php
scp/tickets.php
+0
-12
0 additions, 12 deletions
scp/tickets.php
with
39 additions
and
60 deletions
include/api.tickets.php
+
0
−
14
View file @
50c02ff2
...
@@ -122,14 +122,6 @@ class TicketApiController extends ApiController {
...
@@ -122,14 +122,6 @@ class TicketApiController extends ApiController {
# Create the ticket with the data (attempt to anyway)
# Create the ticket with the data (attempt to anyway)
$errors
=
array
();
$errors
=
array
();
if
(
$topic
=
Topic
::
lookup
(
$data
[
'topicId'
]))
{
if
(
$form
=
DynamicForm
::
lookup
(
$topic
->
ht
[
'form_id'
]))
{
$form
=
$form
->
instanciate
();
if
(
!
$form
->
isValid
())
$errors
+=
$form
->
errors
();
}
}
$ticket
=
Ticket
::
create
(
$data
,
$errors
,
$data
[
'source'
],
$autorespond
,
$alert
);
$ticket
=
Ticket
::
create
(
$data
,
$errors
,
$data
[
'source'
],
$autorespond
,
$alert
);
# Return errors (?)
# Return errors (?)
if
(
count
(
$errors
))
{
if
(
count
(
$errors
))
{
...
@@ -145,12 +137,6 @@ class TicketApiController extends ApiController {
...
@@ -145,12 +137,6 @@ class TicketApiController extends ApiController {
return
$this
->
exerr
(
500
,
"Unable to create new ticket: unknown error"
);
return
$this
->
exerr
(
500
,
"Unable to create new ticket: unknown error"
);
}
}
# Save dynamic form
if
(
isset
(
$form
))
{
$form
->
setTicketId
(
$ticket
->
getId
());
$form
->
save
();
}
return
$ticket
;
return
$ticket
;
}
}
...
...
This diff is collapsed.
Click to expand it.
include/class.ticket.php
+
39
−
19
View file @
50c02ff2
...
@@ -2230,6 +2230,14 @@ class Ticket {
...
@@ -2230,6 +2230,14 @@ class Ticket {
$vars
[
'email'
],
$filter
->
getName
()));
$vars
[
'email'
],
$filter
->
getName
()));
}
}
if
(
$vars
[
'topicId'
]
&&
(
$topic
=
Topic
::
lookup
(
$vars
[
'topicId'
])))
{
if
(
$topic_form
=
DynamicForm
::
lookup
(
$topic
->
ht
[
'form_id'
]))
{
$topic_form
=
$topic_form
->
instanciate
();
if
(
!
$topic_form
->
getForm
()
->
isValid
(
$field_filter
(
'topic'
)))
$errors
=
array_merge
(
$errors
,
$topic_form
->
getForm
()
->
errors
());
}
}
$id
=
0
;
$id
=
0
;
$fields
=
array
();
$fields
=
array
();
$fields
[
'message'
]
=
array
(
'type'
=>
'*'
,
'required'
=>
1
,
'error'
=>
'Message required'
);
$fields
[
'message'
]
=
array
(
'type'
=>
'*'
,
'required'
=>
1
,
'error'
=>
'Message required'
);
...
@@ -2293,24 +2301,26 @@ class Ticket {
...
@@ -2293,24 +2301,26 @@ class Ticket {
# Some things will need to be unpacked back into the scope of this
# Some things will need to be unpacked back into the scope of this
# function
# function
if
(
isset
(
$vars
[
'autorespond'
]))
$autorespond
=
$vars
[
'autorespond'
];
if
(
isset
(
$vars
[
'autorespond'
]))
$autorespond
=
$vars
[
'autorespond'
];
# Apply filter-specific priority
# Apply filter-specific priority
if
(
$vars
[
'priorityId'
])
if
(
$vars
[
'priorityId'
])
$form
->
setAnswer
(
'priority'
,
null
,
$vars
[
'priorityId'
]);
$form
->
setAnswer
(
'priority'
,
null
,
$vars
[
'priorityId'
]);
// OK...just do it.
// OK...just do it.
$deptId
=
$vars
[
'deptId'
];
//pre-selected Dept if any.
$deptId
=
$vars
[
'deptId'
];
//pre-selected Dept if any.
$source
=
ucfirst
(
$vars
[
'source'
]);
$source
=
ucfirst
(
$vars
[
'source'
]);
$topic
=
NULL
;
// Intenal mapping magic...see if we need to override anything
// Intenal mapping magic...see if we need to override anything
if
(
isset
(
$
vars
[
'topicId'
])
&&
(
$topic
=
Topic
::
lookup
(
$vars
[
'topicId'
])))
{
//Ticket created via web by user/or staff
if
(
isset
(
$
topic
))
{
$deptId
=
$deptId
?
$deptId
:
$topic
->
getDeptId
();
$deptId
=
$deptId
?:
$topic
->
getDeptId
();
$priority
=
$form
->
getAnswer
(
'priority'
);
$priority
=
$form
->
getAnswer
(
'priority'
);
if
(
!
$priority
||
!
$priority
->
getIdValue
())
if
(
!
$priority
||
!
$priority
->
getIdValue
())
$form
->
setAnswer
(
'priority'
,
null
,
$topic
->
getPriorityId
());
$form
->
setAnswer
(
'priority'
,
null
,
$topic
->
getPriorityId
());
if
(
$autorespond
)
$autorespond
=
$topic
->
autoRespond
();
if
(
$autorespond
)
$source
=
$vars
[
'source'
]
?
$vars
[
'source'
]
:
'Web'
;
$autorespond
=
$topic
->
autoRespond
();
$source
=
$vars
[
'source'
]
?:
'Web'
;
//Auto assignment.
//Auto assignment.
if
(
!
isset
(
$vars
[
'staffId'
])
&&
$topic
->
getStaffId
())
if
(
!
isset
(
$vars
[
'staffId'
])
&&
$topic
->
getStaffId
())
...
@@ -2319,27 +2329,30 @@ class Ticket {
...
@@ -2319,27 +2329,30 @@ class Ticket {
$vars
[
'teamId'
]
=
$topic
->
getTeamId
();
$vars
[
'teamId'
]
=
$topic
->
getTeamId
();
//set default sla.
//set default sla.
if
(
isset
(
$vars
[
'slaId'
]))
if
(
isset
(
$vars
[
'slaId'
]))
$vars
[
'slaId'
]
=
$vars
[
'slaId'
]
?
$vars
[
'slaId'
]
:
$cfg
->
getDefaultSLAId
();
$vars
[
'slaId'
]
=
$vars
[
'slaId'
]
?:
$cfg
->
getDefaultSLAId
();
elseif
(
$topic
&&
$topic
->
getSLAId
())
elseif
(
$topic
&&
$topic
->
getSLAId
())
$vars
[
'slaId'
]
=
$topic
->
getSLAId
();
$vars
[
'slaId'
]
=
$topic
->
getSLAId
();
}
}
elseif
(
$vars
[
'emailId'
]
&&
!
$vars
[
'deptId'
]
&&
(
$email
=
Email
::
lookup
(
$vars
[
'emailId'
])))
{
//Emailed Tickets
// Apply email settings for emailed tickets
$deptId
=
$email
->
getDeptId
();
if
(
$vars
[
'emailId'
]
&&
(
$email
=
Email
::
lookup
(
$vars
[
'emailId'
])))
{
$deptId
=
$deptId
?:
$email
->
getDeptId
();
$priority
=
$form
->
getAnswer
(
'priority'
);
$priority
=
$form
->
getAnswer
(
'priority'
);
if
(
!
$priority
||
!
$priority
->
getIdValue
())
if
(
!
$priority
||
!
$priority
->
getIdValue
())
$form
->
setAnswer
(
'priority'
,
null
,
$email
->
getPriorityId
());
$form
->
setAnswer
(
'priority'
,
null
,
$email
->
getPriorityId
());
if
(
$autorespond
)
$autorespond
=
$email
->
autoRespond
();
if
(
$autorespond
)
$email
=
null
;
$autorespond
=
$email
->
autoRespond
();
$source
=
'Email'
;
$email
=
null
;
$source
=
'Email'
;
}
}
//Last minute checks
//Last minute checks
$priority
=
$form
->
getAnswer
(
'priority'
);
$priority
=
$form
->
getAnswer
(
'priority'
);
if
(
!
$priority
||
!
$priority
->
getIdValue
())
if
(
!
$priority
||
!
$priority
->
getIdValue
())
$form
->
setAnswer
(
'priority'
,
null
,
$cfg
->
getDefaultPriorityId
());
$form
->
setAnswer
(
'priority'
,
null
,
$cfg
->
getDefaultPriorityId
());
$deptId
=
$deptId
?
$deptId
:
$cfg
->
getDefaultDeptId
();
$deptId
=
$deptId
?:
$cfg
->
getDefaultDeptId
();
$topicId
=
$vars
[
'topicId'
]
?
$vars
[
'topicId'
]
:
0
;
$topicId
=
$vars
[
'topicId'
]
?:
0
;
$ipaddress
=
$vars
[
'ip'
]
?
$vars
[
'ip'
]
:
$_SERVER
[
'REMOTE_ADDR'
];
$ipaddress
=
$vars
[
'ip'
]
?:
$_SERVER
[
'REMOTE_ADDR'
];
//We are ready son...hold on to the rails.
//We are ready son...hold on to the rails.
$number
=
Ticket
::
genRandTicketNumber
();
$number
=
Ticket
::
genRandTicketNumber
();
...
@@ -2375,6 +2388,13 @@ class Ticket {
...
@@ -2375,6 +2388,13 @@ class Ticket {
// Save the (common) dynamic form
// Save the (common) dynamic form
$form
->
setTicketId
(
$id
);
$form
->
setTicketId
(
$id
);
$form
->
save
();
$form
->
save
();
// Save the form data from the help-topic form, if any
if
(
$topic_form
)
{
$topic_form
->
setTicketId
(
$id
);
$topic_form
->
save
();
}
$ticket
->
loadDynamicData
();
$ticket
->
loadDynamicData
();
$dept
=
$ticket
->
getDept
();
$dept
=
$ticket
->
getDept
();
...
...
This diff is collapsed.
Click to expand it.
open.php
+
0
−
15
View file @
50c02ff2
...
@@ -29,16 +29,6 @@ if ($_POST) {
...
@@ -29,16 +29,6 @@ if ($_POST) {
$errors
[
'captcha'
]
=
'Invalid - try again!'
;
$errors
[
'captcha'
]
=
'Invalid - try again!'
;
}
}
$form
=
false
;
if
(
$topic
=
Topic
::
lookup
(
$vars
[
'topicId'
]))
{
if
(
$form
=
DynamicForm
::
lookup
(
$topic
->
ht
[
'form_id'
]))
{
$form
=
$form
->
instanciate
();
// Don't require internal fields (they're not shown)
if
(
!
$form
->
isValid
(
function
(
$f
)
{
return
!
$f
->
get
(
'private'
);
}))
$errors
+=
$form
->
errors
();
}
}
if
(
!
$errors
&&
$cfg
->
allowOnlineAttachments
()
&&
$_FILES
[
'attachments'
])
if
(
!
$errors
&&
$cfg
->
allowOnlineAttachments
()
&&
$_FILES
[
'attachments'
])
$vars
[
'files'
]
=
AttachmentFile
::
format
(
$_FILES
[
'attachments'
],
true
);
$vars
[
'files'
]
=
AttachmentFile
::
format
(
$_FILES
[
'attachments'
],
true
);
...
@@ -46,11 +36,6 @@ if ($_POST) {
...
@@ -46,11 +36,6 @@ if ($_POST) {
if
((
$ticket
=
Ticket
::
create
(
$vars
,
$errors
,
SOURCE
))){
if
((
$ticket
=
Ticket
::
create
(
$vars
,
$errors
,
SOURCE
))){
$msg
=
'Support ticket request created'
;
$msg
=
'Support ticket request created'
;
Draft
::
deleteForNamespace
(
'ticket.client.'
.
substr
(
session_id
(),
-
12
));
Draft
::
deleteForNamespace
(
'ticket.client.'
.
substr
(
session_id
(),
-
12
));
// Save the form data from the help-topic form, if any
if
(
$form
)
{
$form
->
setTicketId
(
$ticket
->
getId
());
$form
->
save
();
}
//Logged in...simply view the newly created ticket.
//Logged in...simply view the newly created ticket.
if
(
$thisclient
&&
$thisclient
->
isValid
())
{
if
(
$thisclient
&&
$thisclient
->
isValid
())
{
session_write_close
();
session_write_close
();
...
...
This diff is collapsed.
Click to expand it.
scp/tickets.php
+
0
−
12
View file @
50c02ff2
...
@@ -485,13 +485,6 @@ if($_POST && !$errors):
...
@@ -485,13 +485,6 @@ if($_POST && !$errors):
break
;
break
;
case
'open'
:
case
'open'
:
$ticket
=
null
;
$ticket
=
null
;
if
(
$topic
=
Topic
::
lookup
(
$_POST
[
'topicId'
]))
{
if
(
$form
=
DynamicForm
::
lookup
(
$topic
->
ht
[
'form_id'
]))
{
$form
=
$form
->
instanciate
();
if
(
!
$form
->
getForm
()
->
isValid
())
$errors
=
array_merge
(
$errors
,
$form
->
getForm
()
->
errors
());
}
}
if
(
!
$thisstaff
||
!
$thisstaff
->
canCreateTickets
())
{
if
(
!
$thisstaff
||
!
$thisstaff
->
canCreateTickets
())
{
$errors
[
'err'
]
=
'You do not have permission to create tickets. Contact admin for such access'
;
$errors
[
'err'
]
=
'You do not have permission to create tickets. Contact admin for such access'
;
}
else
{
}
else
{
...
@@ -501,11 +494,6 @@ if($_POST && !$errors):
...
@@ -501,11 +494,6 @@ if($_POST && !$errors):
if
((
$ticket
=
Ticket
::
open
(
$vars
,
$errors
)))
{
if
((
$ticket
=
Ticket
::
open
(
$vars
,
$errors
)))
{
$msg
=
'Ticket created successfully'
;
$msg
=
'Ticket created successfully'
;
$_REQUEST
[
'a'
]
=
null
;
$_REQUEST
[
'a'
]
=
null
;
# Save extra dynamic form(s)
if
(
isset
(
$form
))
{
$form
->
setTicketId
(
$ticket
->
getId
());
$form
->
save
();
}
if
(
!
$ticket
->
checkStaffAccess
(
$thisstaff
)
||
$ticket
->
isClosed
())
if
(
!
$ticket
->
checkStaffAccess
(
$thisstaff
)
||
$ticket
->
isClosed
())
$ticket
=
null
;
$ticket
=
null
;
Draft
::
deleteForNamespace
(
'ticket.staff%'
,
$thisstaff
->
getId
());
Draft
::
deleteForNamespace
(
'ticket.staff%'
,
$thisstaff
->
getId
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment