Commit 216c0f0f authored by sunnavy's avatar sunnavy
Browse files

make it compatible with 4.2

2 changes:

* LINKTYPEMAP
* circular links are not allowed
parent c506c8ef
......@@ -387,8 +387,9 @@ sub GetCurrentUser {
my %tmp = _ParseAdditiveCommand( \%cmds, 1, $type );
next unless keys %tmp;
my $link_type = $ticket_as_user->LINKTYPEMAP->{ $type }->{'Type'};
my $link_mode = $ticket_as_user->LINKTYPEMAP->{ $type }->{'Mode'};
my $typemap = keys %RT::Link::TYPEMAP ? \%RT::Link::TYPEMAP : $ticket_as_user->LINKTYPEMAP;
my $link_type = $typemap->{$type}->{'Type'};
my $link_mode = $typemap->{$type}->{'Mode'};
$tmp{'Default'} = [ do {
my %h = ( Base => 'Target', Target => 'Base' );
......
......@@ -229,8 +229,9 @@ END
ok($links, "ticket has links");
is($links->Count, 1, "one link");
my $link_type = $obj->LINKTYPEMAP->{ $field }->{'Type'};
my $link_mode = $obj->LINKTYPEMAP->{ $field }->{'Mode'};
my $typemap = keys %RT::Link::TYPEMAP ? \%RT::Link::TYPEMAP : $obj->LINKTYPEMAP;
my $link_type = $typemap->{ $field }->{'Type'};
my $link_mode = $typemap->{ $field }->{'Mode'};
my $link = $links->First;
is($link->Type, $link_type, "correct type");
......
......@@ -236,7 +236,7 @@ END
}
diag("set links on update") if $ENV{'TEST_VERBOSE'};
foreach my $field ( qw(DependsOn DependedOnBy RefersTo ReferredToBy Members MemberOf) ) {
foreach my $field ( qw(DependsOn DependedOnBy RefersTo ReferredToBy MemberOf Members) ) {
diag("test $field command") if $ENV{'TEST_VERBOSE'};
my $text = <<END;
Subject: [$RT::rtname #$test_ticket_id] test
......@@ -256,14 +256,16 @@ END
ok($links, "ticket has links");
is($links->Count, 1, "one link");
my $link_type = $obj->LINKTYPEMAP->{ $field }->{'Type'};
my $link_mode = $obj->LINKTYPEMAP->{ $field }->{'Mode'};
my $typemap = keys %RT::Link::TYPEMAP ? \%RT::Link::TYPEMAP : $obj->LINKTYPEMAP;
my $link_type = $typemap->{ $field }->{'Type'};
my $link_mode = $typemap->{ $field }->{'Mode'};
my $link = $links->First;
is($link->Type, $link_type, "correct type");
isa_ok($link, 'RT::Link');
my $method = $link_mode .'Obj';
is($link->$method()->Id, $link_ticket_id, 'set '. $field );
ok($obj->DeleteLink(Type => $field, Target => $link_ticket_id));
}
diag("set custom fields on update") if $ENV{'TEST_VERBOSE'};
......
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