[Rt-commit] [svn] r1005 - rt/branches/rt-3.1/lib/RT/Interface
leira at pallas.eruditorum.org
leira at pallas.eruditorum.org
Fri Jun 4 14:45:02 EDT 2004
Author: leira
Date: Fri Jun 4 14:45:01 2004
New Revision: 1005
Modified:
rt/branches/rt-3.1/lib/RT/Interface/Web.pm
Log:
CreateTickets should pass in link arguments to the Create Method, rather than making the links separatedly after the fact. That way, OnCreate Scrips can know about links made at ticket creation.
Modified: rt/branches/rt-3.1/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/rt-3.1/lib/RT/Interface/Web.pm (original)
+++ rt/branches/rt-3.1/lib/RT/Interface/Web.pm Fri Jun 4 14:45:01 2004
@@ -336,35 +336,54 @@
Starts => $starts->ISO,
MIMEObj => $MIMEObj
);
- foreach my $arg (%ARGS) {
+ foreach my $arg (%ARGS) {
if ($arg =~ /^CustomField-(\d+)(.*?)$/) {
next if ($arg =~ /-Magic$/);
$create_args{"CustomField-".$1} = $ARGS{"$arg"};
}
}
- my ( $id, $Trans, $ErrMsg ) = $Ticket->Create(%create_args);
- unless ( $id && $Trans ) {
- Abort($ErrMsg);
+
+ # turn new link lists into arrays, and pass in the proper arguments
+ my (@dependson, @dependedonby,
+ @parents, @children,
+ @refersto, @referredtoby);
+
+ foreach my $luri ( split ( / /, $ARGS{"new-DependsOn"} ) ) {
+ $luri =~ s/\s*$//; # Strip trailing whitespace
+ push @dependson, $luri;
}
- my @linktypes = qw( DependsOn MemberOf RefersTo );
+ $create_args{'DependsOn'} = \@dependson;
- foreach my $linktype (@linktypes) {
- foreach my $luri ( split ( / /, $ARGS{"new-$linktype"} ) ) {
- $luri =~ s/\s*$//; # Strip trailing whitespace
- my ( $val, $msg ) = $Ticket->AddLink(
- Target => $luri,
- Type => $linktype
- );
- push ( @Actions, $msg ) unless ($val);
- }
+ foreach my $luri ( split ( / /, $ARGS{"DependsOn-new"} ) ) {
+ push @dependedonby, $luri;
+ }
+ $create_args{'DependedOnBy'} = \@dependedonby;
- foreach my $luri ( split ( / /, $ARGS{"$linktype-new"} ) ) {
- my ( $val, $msg ) = $Ticket->AddLink(
- Base => $luri,
- Type => $linktype
- );
- push ( @Actions, $msg ) unless ($val);
- }
+ foreach my $luri ( split ( / /, $ARGS{"new-MemberOf"} ) ) {
+ $luri =~ s/\s*$//; # Strip trailing whitespace
+ push @parents, $luri;
+ }
+ $create_args{'Parents'} = \@parents;
+
+ foreach my $luri ( split ( / /, $ARGS{"MemberOf-new"} ) ) {
+ push @children, $luri;
+ }
+ $create_args{'Children'} = \@children;
+
+ foreach my $luri ( split ( / /, $ARGS{"new-RefersTo"} ) ) {
+ $luri =~ s/\s*$//; # Strip trailing whitespace
+ push @refersto, $luri;
+ }
+ $create_args{'RefersTo'} = \@refersto;
+
+ foreach my $luri ( split ( / /, $ARGS{"RefersTo-new"} ) ) {
+ push @referredtoby, $luri;
+ }
+ $create_args{'ReferredToBy'} = \@referredtoby;
+
+ my ( $id, $Trans, $ErrMsg ) = $Ticket->Create(%create_args);
+ unless ( $id && $Trans ) {
+ Abort($ErrMsg);
}
push ( @Actions, split("\n", $ErrMsg) );
More information about the Rt-commit
mailing list