[otrs-cvs] CVS: ITSMCMDB/Kernel/Modules AgentITSMCMDB.pm,1.39,1.40

cvs-log at otrs.org cvs-log at otrs.org
Fri Nov 3 10:13:53 CET 2006


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

Modified Files:
	AgentITSMCMDB.pm 
Log Message:
complete search function

Index: AgentITSMCMDB.pm
===================================================================
RCS file: /home/cvs/ITSMCMDB/Kernel/Modules/AgentITSMCMDB.pm,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** AgentITSMCMDB.pm	3 Nov 2006 08:04:37 -0000	1.39
--- AgentITSMCMDB.pm	3 Nov 2006 09:13:51 -0000	1.40
***************
*** 377,380 ****
--- 377,381 ----
      elsif ($Self->{Subaction} eq 'RecordSearch') {
          my $Search = 0;
+         my %AttributesData;
          my $ConfigItem = $Self->{ParamObject}->GetParam(Param => "ConfigItemSelect");
  
***************
*** 404,408 ****
                  Data => {},
              );
- 
              # get attributes
              my @Attributes = $Self->{ITSMCMDBObject}->AttributeSearch(
--- 405,408 ----
***************
*** 411,416 ****
                  OptionValue => 1,
              );
! 
!             my %AttributesData;
              foreach my $Key (@Attributes) {
                  # get search string
--- 411,415 ----
                  OptionValue => 1,
              );
!             # get attributes
              foreach my $Key (@Attributes) {
                  # get search string
***************
*** 419,423 ****
                      $AttributesData{$Key} = $SearchString;
                  }
- 
                  # generate input field
                  my $AttributeInput = $Self->{LayoutObject}->ITSMCMDBInputText(
--- 418,421 ----
***************
*** 426,430 ****
                      Value => $AttributesData{$Key},
                  );
- 
                  # output block
                  $Self->{LayoutObject}->Block(
--- 424,427 ----
***************
*** 436,440 ****
                  );
              }
! 
              if (%AttributesData) {
                  $Search = 1;
--- 433,437 ----
                  );
              }
!             # if AttributeData was given, start search
              if (%AttributesData) {
                  $Search = 1;
***************
*** 444,453 ****
          # output search result
          if ($Search) {
  
              my @SearchResult = $Self->{ITSMCMDBObject}->RecordSearch(
                  ConfigItem => $ConfigItem,
! 
              );
! 
              if (@SearchResult) {
                  $Self->{LayoutObject}->Block(
--- 441,471 ----
          # output search result
          if ($Search) {
+             my @What;
+             # create search array
+             foreach (keys %AttributesData) {
+                 my @Key = split(/::/, $_);
+ 
+                 my $NewKey;
+                 if ($#Key eq 0) {
+                     $NewKey = '[%]{\'' . $Key[0] . '\'}[%]{\'Content\'}';
+                 }
+                 elsif ($#Key eq 1) {
+                     $NewKey = '[%]{\'' . $Key[0] . '\'}[%]{\'' . $Key[1] . '\'}[%]{\'Content\'}';
+                 }
+                 elsif ($#Key eq 2) {
+                     $NewKey = '[%]{\'' . $Key[0] . '\'}[%]{\'' . $Key[1] . '\'}[%]{\'' . $Key[2] . '\'}[%]{\'Content\'}';
+                 }
+ 
+                 my %Search;
+                 $Search{$NewKey} = '%' . $AttributesData{$_} . '%';
  
+                 push (@What, \%Search);
+             }
+             # search records
              my @SearchResult = $Self->{ITSMCMDBObject}->RecordSearch(
                  ConfigItem => $ConfigItem,
!                 What => \@What,
              );
!             # output result
              if (@SearchResult) {
                  $Self->{LayoutObject}->Block(
***************
*** 456,465 ****
                  );
              }
- 
              # get overview attribute
              my @AttributeOverview = $Self->{ITSMCMDBObject}->AttributeOverviewList(
                  ConfigItem => $ConfigItem,
              );
- 
              # output table header
              foreach (@AttributeOverview) {
--- 474,481 ----
***************
*** 471,475 ****
                  );
              }
! 
              foreach my $RecordID (@SearchResult) {
                  # set output class
--- 487,491 ----
                  );
              }
!             # output results
              foreach my $RecordID (@SearchResult) {
                  # set output class
***************
*** 480,484 ****
                      $Param{Class} = 'searchpassive';
                  }
! 
                  $Self->{LayoutObject}->Block(
                      Name => 'RecordSearchResultRow',
--- 496,500 ----
                      $Param{Class} = 'searchpassive';
                  }
!                 # output block
                  $Self->{LayoutObject}->Block(
                      Name => 'RecordSearchResultRow',
***************
*** 497,501 ****
                          Attribute => $_,
                      );
! 
                      $Self->{LayoutObject}->Block(
                          Name => 'RecordSearchResultRowColumn',
--- 513,517 ----
                          Attribute => $_,
                      );
!                     # output block
                      $Self->{LayoutObject}->Block(
                          Name => 'RecordSearchResultRowColumn',
***************
*** 507,511 ****
                  }
              }
- 
              # output table footer
              foreach (@AttributeOverview) {
--- 523,526 ----



More information about the cvs-log mailing list