[otrs-cvs] ITSMConfigItem/Kernel/System ITSMConfigItem.pm, 1.43, 1.44
CVS commits notifications of OTRS.org
cvs-log at otrs.org
Fri May 2 12:58:12 GMT 2008
Comments:
Update of /home/cvs/ITSMConfigItem/Kernel/System
In directory lancelot:/tmp/cvs-serv10894/Kernel/System
Modified Files:
ITSMConfigItem.pm
Log Message:
Fixed bug# 2728 - The CI search function ignore some search criteria.
Author: mh
Index: ITSMConfigItem.pm
===================================================================
RCS file: /home/cvs/ITSMConfigItem/Kernel/System/ITSMConfigItem.pm,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** ITSMConfigItem.pm 26 Apr 2008 11:57:42 -0000 1.43
--- ITSMConfigItem.pm 2 May 2008 12:58:07 -0000 1.44
***************
*** 705,712 ****
my $ConfigItemListRef = $ConfigItemObject->ConfigItemSearch(
! ClassIDs => [9, 8, 7, 6], # (optional)
! CurDeplStateIDs => [1, 2, 3, 4], # (optional)
! CurInciStateIDs => [1, 2, 3, 4], # (optional)
! Number => 'The ConfigItem Number', # (optional)
# config items with created time after ...
--- 705,714 ----
my $ConfigItemListRef = $ConfigItemObject->ConfigItemSearch(
! Number => 'The ConfigItem Number', # (optional)
! ClassIDs => [9, 8, 7, 6], # (optional)
! CurDeplStateIDs => [1, 2, 3, 4], # (optional)
! CurInciStateIDs => [1, 2, 3, 4], # (optional)
! CreateBy => [1, 2, 3], # (optional)
! ChangeBy => [3, 2, 1], # (optional)
# config items with created time after ...
***************
*** 720,724 ****
ConfigItemChangeTimeOlderDate => '2006-01-19 23:59:59', # (optional)
! Limit => 122, # (optional)
);
--- 722,730 ----
ConfigItemChangeTimeOlderDate => '2006-01-19 23:59:59', # (optional)
! OrderBy => 'Number', # (optional) default ID
! # (ID, Number, CurDeplStateID, CurInciStateID, CreateTime, CreateBy, ChangeTime, ChangeBy)
!
! Limit => 122, # (optional)
! UsingWildcards => 0, # (optional) default 1
);
***************
*** 728,731 ****
--- 734,743 ----
my ( $Self, %Param ) = @_;
+ # set default value
+ if ( !defined $Param{UsingWildcards} ) {
+ $Param{UsingWildcards} = 1;
+ }
+ $Param{OrderBy} ||= 'id';
+
# sql where array
my @SQLWhere;
***************
*** 737,744 ****
$Param{Number} = $Self->{DBObject}->Quote( $Param{Number} );
! # prepare like string
! $Self->_PrepareLikeString( \$Param{Number} );
! push @SQLWhere, "configitem_number LIKE '$Param{Number}'";
}
--- 749,762 ----
$Param{Number} = $Self->{DBObject}->Quote( $Param{Number} );
! if ( $Param{UsingWildcards} ) {
! # prepare like string
! $Self->_PrepareLikeString( \$Param{Number} );
!
! push @SQLWhere, "configitem_number LIKE '$Param{Number}'";
! }
! else {
! push @SQLWhere, "configitem_number = '$Param{Number}'";
! }
}
***************
*** 748,751 ****
--- 766,771 ----
CurDeplStateIDs => 'cur_depl_state_id',
CurInciStateIDs => 'cur_inci_state_id',
+ CreateBy => 'create_by',
+ ChangeBy => 'change_by',
);
***************
*** 754,758 ****
next ARRAYPARAM if !$Param{$ArrayParam};
! next ARRAYPARAM if ref $Param{$ArrayParam} ne 'ARRAY';
next ARRAYPARAM if !@{ $Param{$ArrayParam} };
--- 774,786 ----
next ARRAYPARAM if !$Param{$ArrayParam};
!
! if ( ref $Param{$ArrayParam} ne 'ARRAY' ) {
! $Self->{LogObject}->Log(
! Priority => 'error',
! Message => "$ArrayParam must be an array reference!",
! );
! return;
! }
!
next ARRAYPARAM if !@{ $Param{$ArrayParam} };
***************
*** 780,790 ****
next TIMEPARAM if !$Param{$TimeParam};
! next TIMEPARAM if $Param{$TimeParam} !~ m{
! \A
! \d\d\d\d-(\d\d|\d)-(\d\d|\d)
! \s
! (\d\d|\d):(\d\d|\d):(\d\d|\d)
! \z
! }xms;
# quote
--- 808,819 ----
next TIMEPARAM if !$Param{$TimeParam};
!
! if ( $Param{$TimeParam} !~ m{ \A \d\d\d\d-\d\d-\d\d \s \d\d:\d\d:\d\d \z }xms ) {
! $Self->{LogObject}->Log(
! Priority => 'error',
! Message => "Invalid date format found!",
! );
! return;
! }
# quote
***************
*** 795,802 ****
# create where string
! my $WhereString = '';
! if (@SQLWhere) {
! $WhereString = ' WHERE ' . join q{ AND }, @SQLWhere;
! }
# set limit
--- 824,843 ----
# create where string
! my $WhereString = @SQLWhere ? ' WHERE ' . join q{ AND }, @SQLWhere : '';
!
! # define order table
! my %OrderByTable = (
! ID => 'id',
! Number => 'configitem_number',
! CurDeplStateID => 'cur_depl_state_id',
! CurInciStateID => 'cur_inci_state_id',
! CreateTime => 'create_time',
! CreateBy => 'create_by',
! ChangeTime => 'change_time',
! ChangeBy => 'change_by',
! );
!
! # set order by
! my $OrderBy = $OrderByTable{ $Param{OrderBy} } || $OrderByTable{ID};
# set limit
***************
*** 807,811 ****
# ask database
$Self->{DBObject}->Prepare(
! SQL => "SELECT id FROM configitem $WhereString ORDER BY id",
Limit => $Param{Limit},
);
--- 848,852 ----
# ask database
$Self->{DBObject}->Prepare(
! SQL => "SELECT id FROM configitem $WhereString ORDER BY $OrderBy ASC",
Limit => $Param{Limit},
);
More information about the cvs-log
mailing list