[otrs-cvs] CVS: ITSMCMDB/Kernel/Modules AgentITSMCMDB.pm,1.66,1.67

cvs-log at otrs.org cvs-log at otrs.org
Tue Dec 5 14:57:28 CET 2006


Update of /home/cvs/ITSMCMDB/Kernel/Modules
In directory lancelot:/tmp/cvs-serv25768/Kernel/Modules

Modified Files:
	AgentITSMCMDB.pm 
Log Message:
fixed bug in link mechanism

Index: AgentITSMCMDB.pm
===================================================================
RCS file: /home/cvs/ITSMCMDB/Kernel/Modules/AgentITSMCMDB.pm,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -r1.66 -r1.67
*** AgentITSMCMDB.pm	4 Dec 2006 12:02:42 -0000	1.66
--- AgentITSMCMDB.pm	5 Dec 2006 13:57:26 -0000	1.67
***************
*** 1046,1050 ****
                  );
  
!                 my %RelationTypes;
                  foreach (@LinkTypes) {
                      my %LinkType = $Self->{LinkObject2Object}->LinkTypeLookup(
--- 1046,1050 ----
                  );
  
!                 my %RelationTypesTmp;
                  foreach (@LinkTypes) {
                      my %LinkType = $Self->{LinkObject2Object}->LinkTypeLookup(
***************
*** 1052,1056 ****
                      );
  
!                     $RelationTypes{$_} = $LinkType{ParentName};
                  }
  
--- 1052,1065 ----
                      );
  
!                     $RelationTypesTmp{'Parent::' . $_} = $LinkType{ParentName};
!                     $RelationTypesTmp{'Child::' . $_} = $LinkType{ChildName};
!                 }
!                 my %RelationTypesTmp2;
!                 foreach (sort keys %RelationTypesTmp) {
!                     $RelationTypesTmp2{$RelationTypesTmp{$_}} = $_;
!                 }
!                 my %RelationTypes;
!                 foreach (sort keys %RelationTypesTmp2) {
!                     $RelationTypes{$RelationTypesTmp2{$_}} = $_;
                  }
  
***************
*** 1189,1199 ****
  
          foreach my $BKey (@BKeys) {
              $Self->{LinkObject2Object}->LinkAdd(
-                 LinkType => $RelationType,
-                 ParentObject => 'ITSM::' . $ConfigItem,
-                 ParentKey => $RecordID,
-                 ChildObject => $BObject,
-                 ChildKey => $BKey,
                  ValidID => 1,
              );
          }
--- 1198,1225 ----
  
          foreach my $BKey (@BKeys) {
+             my %LinkData;
+ 
+             if ($RelationType =~ /^Parent\:\:(.*)$/) {
+                 $LinkData{LinkType} = $1,
+                 $LinkData{ParentObject} = 'ITSM::' . $ConfigItem,
+                 $LinkData{ParentKey} = $RecordID,
+                 $LinkData{ChildObject} = $BObject,
+                 $LinkData{ChildKey} = $BKey,
+             }
+             elsif ($RelationType =~ /^Child\:\:(.*)$/) {
+                 $LinkData{LinkType} = $1,
+                 $LinkData{ParentObject} = $BObject,
+                 $LinkData{ParentKey} = $BKey,
+                 $LinkData{ChildObject} = 'ITSM::' . $ConfigItem,
+                 $LinkData{ChildKey} = $RecordID,
+             }
+             else {
+                 last;
+                 next;
+             }
+ 
              $Self->{LinkObject2Object}->LinkAdd(
                  ValidID => 1,
+                 %LinkData,
              );
          }



More information about the cvs-log mailing list