[otrs-cvs] ITSMConfigItem/Kernel/System/ITSMConfigItem XML.pm, 1.21, 1.22

CVS commits notifications of OTRS.org cvs-log at otrs.org
Sat May 3 13:10:29 GMT 2008


Comments:
Update of /home/cvs/ITSMConfigItem/Kernel/System/ITSMConfigItem
In directory lancelot:/tmp/cvs-serv23234/Kernel/System/ITSMConfigItem

Modified Files:
	XML.pm 
Log Message:
Fixed bug# 2728 - The CI search function ignore some search criteria.

Author: mh

Index: XML.pm
===================================================================
RCS file: /home/cvs/ITSMConfigItem/Kernel/System/ITSMConfigItem/XML.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** XML.pm	23 Apr 2008 12:52:56 -0000	1.21
--- XML.pm	3 May 2008 13:10:24 -0000	1.22
***************
*** 229,239 ****
  }
  
! =item XMLVersionSearch()
  
  search xml data of a version and return a hash reference
  
!     my $HashRef = $ConfigItemObject->XMLVersionSearch(
          ClassIDs => [1, 2, 3],  # (optional)
!         What     => [
              # each array element is a and condition
              {
--- 229,240 ----
  }
  
! =item _XMLVersionSearch()
  
  search xml data of a version and return a hash reference
  
!     my $VersionIDs = $ConfigItemObject->_XMLVersionSearch(
          ClassIDs => [1, 2, 3],  # (optional)
! 
!         What => [
              # each array element is a and condition
              {
***************
*** 248,255 ****
              {
                  # use array reference if different content with same key was searched
!                 "[%]{'ElementA'}[%]{'ElementB'}[%]{'Content'}" => ['%contentC%', '%contentD%', '%contentE%'],
!                 "[%]{'ElementA'}[%]{'ElementC'}[%]{'Content'}" => ['%contentC%', '%contentD%', '%contentE%'],
              },
          ],
          PreviousVersionSearch => 1,  # (optional) default 0 (0|1)
      );
--- 249,265 ----
              {
                  # use array reference if different content with same key was searched
!                 "[%]{'ElementA'}[%]{'ElementB'}[%]{'Content'}" => [
!                     '%contentC%',
!                     '%contentD%',
!                     '%contentE%',
!                 ],
!                 "[%]{'ElementA'}[%]{'ElementC'}[%]{'Content'}" => [
!                     '%contentC%',
!                     '%contentD%',
!                     '%contentE%',
!                 ],
              },
          ],
+ 
          PreviousVersionSearch => 1,  # (optional) default 0 (0|1)
      );
***************
*** 257,272 ****
  =cut
  
! sub XMLVersionSearch {
      my ( $Self, %Param ) = @_;
  
      # check needed stuff
!     for my $Argument (qw(What ClassIDs)) {
!         if ( !$Param{$Argument} || ref $Param{$Argument} ne 'ARRAY' ) {
!             $Self->{LogObject}->Log(
!                 Priority => 'error',
!                 Message  => "Need $Argument as array reference!"
!             );
!             return;
!         }
      }
  
--- 267,280 ----
  =cut
  
! sub _XMLVersionSearch {
      my ( $Self, %Param ) = @_;
  
      # check needed stuff
!     if ( !$Param{What} || ref $Param{What} ne 'ARRAY' ) {
!         $Self->{LogObject}->Log(
!             Priority => 'error',
!             Message  => "Need What as array reference!"
!         );
!         return;
      }
  
***************
*** 278,281 ****
--- 286,304 ----
      }
  
+     if ( !$Param{ClassIDs} || ref $Param{ClassIDs} ne 'ARRAY' || !@{ $Param{ClassIDs} } ) {
+ 
+         # get class list
+         my $ClassList = $Self->{GeneralCatalogObject}->ItemList(
+             Class => 'ITSM::ConfigItem::Class',
+         );
+ 
+         @{ $Param{ClassIDs} } = keys %{$ClassList};
+     }
+ 
+     # quote
+     for my $ClassID ( @{ $Param{ClassIDs} } ) {
+         $Self->{DBObject}->Quote( $ClassID, 'Integer' );
+     }
+ 
      # search in active versions
      my %VersionIDs;


More information about the cvs-log mailing list