summaryrefslogtreecommitdiff
path: root/rt/lib/RT/Handle.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-12-12 10:26:29 -0800
committerIvan Kohler <ivan@freeside.biz>2012-12-12 10:26:29 -0800
commit84f2df8931fa02e63fb21f8f0bb87dd9577b8919 (patch)
tree8cbe43418fe23f3fc28cc8f3e19a61666a1696ed /rt/lib/RT/Handle.pm
parentd7678b9b97068dcd352f0ea101c6c8d02ae330d6 (diff)
rt 4.0.8
Diffstat (limited to 'rt/lib/RT/Handle.pm')
-rw-r--r--rt/lib/RT/Handle.pm30
1 files changed, 16 insertions, 14 deletions
diff --git a/rt/lib/RT/Handle.pm b/rt/lib/RT/Handle.pm
index 99d10e367..03c262bba 100644
--- a/rt/lib/RT/Handle.pm
+++ b/rt/lib/RT/Handle.pm
@@ -858,26 +858,28 @@ sub InsertData {
@queues = @{ delete $item->{'Queue'} };
}
- my ( $return, $msg ) = $new_entry->Create(%$item);
- unless( $return ) {
- $RT::Logger->error( $msg );
- next;
- }
-
if ( $item->{'BasedOn'} ) {
- my $basedon = RT::CustomField->new($RT::SystemUser);
- my ($ok, $msg ) = $basedon->LoadByCols( Name => $item->{'BasedOn'},
- LookupType => $new_entry->LookupType );
- if ($ok) {
- ($ok, $msg) = $new_entry->SetBasedOn( $basedon );
+ if ( $item->{'LookupType'} ) {
+ my $basedon = RT::CustomField->new($RT::SystemUser);
+ my ($ok, $msg ) = $basedon->LoadByCols( Name => $item->{'BasedOn'},
+ LookupType => $item->{'LookupType'} );
if ($ok) {
- $RT::Logger->debug("Added BasedOn $item->{BasedOn}: $msg");
+ $item->{'BasedOn'} = $basedon->Id;
} else {
- $RT::Logger->error("Failed to add basedOn $item->{BasedOn}: $msg");
+ $RT::Logger->error("Unable to load $item->{BasedOn} as a $item->{LookupType} CF. Skipping BasedOn: $msg");
+ delete $item->{'BasedOn'};
}
} else {
- $RT::Logger->error("Unable to load $item->{BasedOn} as a $item->{LookupType} CF. Skipping BasedOn");
+ $RT::Logger->error("Unable to load CF $item->{BasedOn} because no LookupType was specified. Skipping BasedOn");
+ delete $item->{'BasedOn'};
}
+
+ }
+
+ my ( $return, $msg ) = $new_entry->Create(%$item);
+ unless( $return ) {
+ $RT::Logger->error( $msg );
+ next;
}
foreach my $value ( @{$values} ) {