[otrs-cvs] CVS: ITSMCMDB/Kernel/System ITSMCMDB.pm,1.23,1.24
cvs-log at otrs.org
cvs-log at otrs.org
Thu Nov 2 13:19:15 CET 2006
Update of /home/cvs/ITSMCMDB/Kernel/System
In directory lancelot:/tmp/cvs-serv11524/Kernel/System
Modified Files:
ITSMCMDB.pm
Log Message:
new function
Index: ITSMCMDB.pm
===================================================================
RCS file: /home/cvs/ITSMCMDB/Kernel/System/ITSMCMDB.pm,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** ITSMCMDB.pm 24 Oct 2006 20:30:12 -0000 1.23
--- ITSMCMDB.pm 2 Nov 2006 12:19:13 -0000 1.24
***************
*** 83,89 ****
returns complete config hash reference or a ConfigItem config array referece
! my %ConfigHash = $CMDBObject->ConfigGet();
! my @ConfigArray = $CMDBObject->ConfigGet(
ConfigItem => 'Computer',
);
--- 83,89 ----
returns complete config hash reference or a ConfigItem config array referece
! my $ConfigHashRef = $CMDBObject->ConfigGet();
! my $ConfigArrayRef = $CMDBObject->ConfigGet(
ConfigItem => 'Computer',
);
***************
*** 364,367 ****
--- 364,419 ----
}
+ =item AttributeSearch()
+
+ return attributes
+
+ my @Attributes = $CMDBObject->AttributeSearch(
+ ConfigItem => 'Computer',
+ Option => 'Searchable',
+ OptionValue => 1;
+ );
+
+ =cut
+
+ sub AttributeSearch {
+ my $Self = shift;
+ my %Param = @_;
+ # check needed stuff
+ foreach (qw(ConfigItem Option OptionValue)) {
+ if (!$Param{$_}) {
+ $Self->{LogObject}->Log(Priority => 'error', Message => "Need $_!");
+ return;
+ }
+ }
+ my @ArrayReturn;
+ my $ConfigArray = $Self->ConfigGet(
+ ConfigItem => $Param{ConfigItem},
+ );
+
+ foreach my $Attribute (@{$ConfigArray}) {
+ if ($Attribute->{$Param{Option}} eq $Param{OptionValue}) {
+ push (@ArrayReturn, $Attribute->{Key});
+ }
+
+ if ($Attribute->{Sub}) {
+ foreach my $AttributeSub1 (@{$Attribute->{Sub}}) {
+ if ($AttributeSub1->{$Param{Option}} eq $Param{OptionValue}) {
+ push (@ArrayReturn, $Attribute->{Key} . '::' . $AttributeSub1->{Key});
+ }
+
+ if ($AttributeSub1->{Sub}) {
+ foreach my $AttributeSub2 (@{$AttributeSub1->{Sub}}) {
+ if ($AttributeSub2->{$Param{Option}} eq $Param{OptionValue}) {
+ push (@ArrayReturn, $Attribute->{Key} . '::' . $AttributeSub1->{Key} . '::' . $AttributeSub2->{Key});
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return @ArrayReturn;
+ }
+
=item ConfigItemList()
***************
*** 602,605 ****
--- 654,683 ----
}
+ =item RecordSearch()
+
+ search config item records
+
+ $CMDBObject->RecordSearch(
+ ConfigItem => 'Computer',
+ );
+
+ =cut
+
+ sub RecordSearch {
+ my $Self = shift;
+ my %Param = @_;
+ # check needed stuff
+ foreach (qw(ConfigItem)) {
+ if (!$Param{$_}) {
+ $Self->{LogObject}->Log(Priority => 'error', Message => "Need $_!");
+ return;
+ }
+ }
+ return $Self->{XMLObject}->XMLHashSearch(
+ Type => "ITSMObject::$Param{ConfigItem}",
+
+ );
+ }
+
=item DataArrayGet()
More information about the cvs-log
mailing list