Commit ddb9d602 authored by Jim Brandt's avatar Jim Brandt
Browse files

Silence 4.2 deprecation warnings

We can't just switch to /Elements/EditCustomFields and remain 4.0
compatible, so we have some shenanigans to figure out what version
we're on.  /Elements/EditCustomFields didn't exist in 4.0 which makes it
easier.

See also rt-extension-customfieldsonupdate.
parent 59b2b376
......@@ -7,11 +7,21 @@ my ($core, $cfs) = RT::Extension::MandatoryOnTransition->RequiredFields(
To => $ARGS{'Status'} || $ARGS{'DefaultStatus'},
);
return unless @$cfs;
my $comp = '/Elements/EditCustomFields';
my %obj_args = ( Object => $Ticket );
# Handle location in 4.0 and 4.2
if (!$m->comp_exists('/Elements/EditCustomFields')) {
$comp = '/Ticket/Elements/EditCustomFields';
%obj_args = ( TicketObj => $Ticket );
}
</%init>
%# 'Named' is handled by this extension in the MassageCustomFields callback
<& /Ticket/Elements/EditCustomFields,
<& $comp,
%ARGS,
TicketObj => $Ticket,
%obj_args,
InTable => 1,
Named => $cfs,
&>
......@@ -10,11 +10,19 @@ my ($core, $cfs) = RT::Extension::MandatoryOnTransition->RequiredFields(
return unless @$cfs;
my $comp = '/Elements/EditCustomFields';
my %obj_args = ( Object => $Ticket );
# Handle location in 4.0 and 4.2
if (!$m->comp_exists('/Elements/EditCustomFields')) {
$comp = '/Ticket/Elements/EditCustomFields';
%obj_args = ( TicketObj => $Ticket );
}
</%init>
%# 'Named' is handled by this extension in the MassageCustomFields callback
<& /Ticket/Elements/EditCustomFields,
<& $comp,
%ARGS,
TicketObj => $Ticket,
%obj_args,
InTable => 0,
Named => $cfs,
&>
use strict;
use warnings;
use RT::Extension::MandatoryOnTransition::Test tests => 37;
use RT::Extension::MandatoryOnTransition::Test tests => undef;
use_ok('RT::Extension::MandatoryOnTransition');
......@@ -51,7 +51,13 @@ diag "Try a resolve without TimeWorked";
button => 'SubmitTicket',
}, 'Submit resolve with Time Worked and Test Field');
$m->content_contains("TimeWorked changed from &#40;no value&#41; to &#39;10&#39;");
if ( $RT::VERSION =~ /^4\.0\.\d+/ ){
$m->content_contains("TimeWorked changed from &#40;no value&#41; to &#39;10&#39;");
}
else{
# 4.2 or later
$m->content_contains("Worked 10 minutes");
}
$m->content_contains("Status changed from &#39;open&#39; to &#39;resolved&#39;");
}
......@@ -93,3 +99,6 @@ diag "Try a resolve without TimeWorked in mobile interface";
$m->title_like(qr/^#$ticket_id:/, "Page title starts with ticket number $ticket_id");
like($m->uri->as_string, qr/show/, "On show page after ticket resolve");
}
undef $m;
done_testing;
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