Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
best-practical
rt-extension-mandatoryontransition
Commits
88de111c
Commit
88de111c
authored
Nov 09, 2012
by
Jim Brandt
Browse files
Add MandatoryOnTransition checking to the mobile create page
parent
d29823b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
1 deletion
+57
-1
html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/create/BeforeCreate
...ension-MandatoryOnTransition/m/ticket/create/BeforeCreate
+24
-0
xt/mandatory_on_create.t
xt/mandatory_on_create.t
+33
-1
No files found.
html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/create/BeforeCreate
0 → 100644
View file @
88de111c
<%args>
$ARGSRef
$skip_create
$results => []
</%args>
<%init>
my $Queue = $ARGSRef->{Queue};
my $QueueObj = RT::Queue->new($session{'CurrentUser'});
$QueueObj->Load($Queue);
my $errors_ref = RT::Extension::MandatoryOnTransition->CheckMandatoryFields(
ARGSRef => $ARGSRef,
From => "*",
To => $ARGSRef->{'Status'},
Queue => $QueueObj,
);
if (@$errors_ref) {
RT->Logger->debug("Preventing create because of missing mandatory fields");
$$skip_create = 1;
push @$results, @$errors_ref;
}
</%init>
xt/mandatory_on_create.t
View file @
88de111c
use
strict
;
use
warnings
;
use
RT::Extension::MandatoryOnTransition::
Test
tests
=>
19
;
use
RT::Extension::MandatoryOnTransition::
Test
tests
=>
32
;
use_ok
('
RT::Extension::MandatoryOnTransition
');
...
...
@@ -56,3 +56,35 @@ diag "Test mandatory fields on create";
$m
->
content_contains
("
Ticket 1 created in queue 'General'
");
}
diag
"
Test mandatory fields on create for mobile
";
{
$m
->
get_ok
(
$m
->
rt_base_url
.
'
/m/
');
$m
->
follow_link_ok
(
{
text
=>
'
New ticket
'
},
'
Click New ticket
');
$m
->
title_is
('
Create a ticket
');
$m
->
follow_link_ok
(
{
text
=>
'
General
'
},
'
Click General queue
');
$m
->
title_is
('
Create a ticket
');
$m
->
submit_form_ok
(
{
form_name
=>
'
TicketCreate
',
fields
=>
{
Status
=>
'
resolved
'
},
},
'
Submit with resolved status
');
$m
->
content_contains
('
Time Worked is required when changing Status to resolved
');
$m
->
content_contains
('
Test Field is required when changing Status to resolved
');
$m
->
submit_form_ok
(
{
form_name
=>
'
TicketCreate
',
fields
=>
{
Status
=>
'
resolved
',
'
Object-RT::Ticket--CustomField-1-Values
'
=>
'
foo
'},
},
'
Submit with resolved status
');
$m
->
content_contains
('
Time Worked is required when changing Status to resolved
');
$m
->
submit_form_ok
(
{
form_name
=>
'
TicketCreate
',
fields
=>
{
Status
=>
'
resolved
',
'
Object-RT::Ticket--CustomField-1-Values
'
=>
'
foo
',
'
TimeWorked
'
=>
'
10
',
},
},
'
Submit with resolved status
');
$m
->
title_like
(
qr/#(\d+):/
,
'
Looks like a ticket number in the title
');
like
(
$m
->
uri
->
as_string
,
qr/show/
,
"
On show page after ticket create
");
}
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