[otrs-cvs] otrs/Kernel/Modules AgentTicketSearch.pm,1.157,1.158
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/otrs/Kernel/Modules
In directory lancelot:/tmp/cvs-serv16210/Kernel/Modules
Modified Files:
AgentTicketSearch.pm
Log Message:
Code style improvements.
Author: ub
Index: AgentTicketSearch.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AgentTicketSearch.pm,v
retrieving revision 1.157
retrieving revision 1.158
diff -2 -u -d -r1.157 -r1.158
--- AgentTicketSearch.pm 10 Jan 2013 15:50:15 -0000 1.157
+++ AgentTicketSearch.pm 11 Jan 2013 11:14:59 -0000 1.158
@@ -38,10 +38,10 @@
# check needed objects
- for (
+ for my $Needed (
qw(ParamObject DBObject TicketObject LayoutObject LogObject ConfigObject MainObject EncodeObject)
)
{
- if ( !$Self->{$_} ) {
- $Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
+ if ( !$Self->{$Needed} ) {
+ $Self->{LayoutObject}->FatalError( Message => "Got no $Needed!" );
}
}
@@ -182,5 +182,5 @@
# get search string params (get submitted params)
else {
- for (
+ for my $Key (
qw(TicketNumber Title From To Cc Subject Body CustomerID CustomerUserLogin StateType
Agent ResultForm TimeSearchType ChangeTimeSearchType CloseTimeSearchType EscalationTimeSearchType
@@ -223,15 +223,15 @@
# get search string params (get submitted params)
- $GetParam{$_} = $Self->{ParamObject}->GetParam( Param => $_ );
+ $GetParam{$Key} = $Self->{ParamObject}->GetParam( Param => $Key );
# remove white space on the start and end
- if ( $GetParam{$_} ) {
- $GetParam{$_} =~ s/\s+$//g;
- $GetParam{$_} =~ s/^\s+//g;
+ if ( $GetParam{$Key} ) {
+ $GetParam{$Key} =~ s/\s+$//g;
+ $GetParam{$Key} =~ s/^\s+//g;
}
}
# get array params
- for (
+ for my $Key (
qw(StateIDs StateTypeIDs QueueIDs PriorityIDs OwnerIDs
CreatedQueueIDs CreatedUserIDs WatchUserIDs ResponsibleIDs
@@ -241,7 +241,7 @@
# get search array params (get submitted params)
- my @Array = $Self->{ParamObject}->GetArray( Param => $_ );
+ my @Array = $Self->{ParamObject}->GetArray( Param => $Key );
if (@Array) {
- $GetParam{$_} = \@Array;
+ $GetParam{$Key} = \@Array;
}
}
@@ -261,5 +261,5 @@
);
- # set the comple value structure in GetParam to store it later in the search profile
+ # set the complete value structure in GetParam to store it later in the search profile
if ( IsHashRefWithData($DynamicFieldValue) ) {
%GetParam = ( %GetParam, %{$DynamicFieldValue} );
@@ -388,11 +388,9 @@
}
elsif ( $GetParam{ArticleTimeSearchType} eq 'TimeSlot' ) {
- for (qw(Month Day)) {
- $GetParam{"ArticleCreateTimeStart$_"}
- = sprintf( "%02d", $GetParam{"ArticleCreateTimeStart$_"} );
- }
- for (qw(Month Day)) {
- $GetParam{"ArticleCreateTimeStop$_"}
- = sprintf( "%02d", $GetParam{"ArticleCreateTimeStop$_"} );
+ for my $Key (qw(Month Day)) {
+ $GetParam{"ArticleCreateTimeStart$Key"}
+ = sprintf( "%02d", $GetParam{"ArticleCreateTimeStart$Key"} );
+ $GetParam{"ArticleCreateTimeStop$Key"}
+ = sprintf( "%02d", $GetParam{"ArticleCreateTimeStop$Key"} );
}
if (
@@ -462,11 +460,9 @@
}
elsif ( $GetParam{TimeSearchType} eq 'TimeSlot' ) {
- for (qw(Month Day)) {
- $GetParam{"TicketCreateTimeStart$_"}
- = sprintf( "%02d", $GetParam{"TicketCreateTimeStart$_"} );
- }
- for (qw(Month Day)) {
- $GetParam{"TicketCreateTimeStop$_"}
- = sprintf( "%02d", $GetParam{"TicketCreateTimeStop$_"} );
+ for my $Key (qw(Month Day)) {
+ $GetParam{"TicketCreateTimeStart$Key"}
+ = sprintf( "%02d", $GetParam{"TicketCreateTimeStart$Key"} );
+ $GetParam{"TicketCreateTimeStop$Key"}
+ = sprintf( "%02d", $GetParam{"TicketCreateTimeStop$Key"} );
}
if (
@@ -536,11 +532,9 @@
}
elsif ( $GetParam{ChangeTimeSearchType} eq 'TimeSlot' ) {
- for (qw(Month Day)) {
- $GetParam{"TicketChangeTimeStart$_"}
- = sprintf( "%02d", $GetParam{"TicketChangeTimeStart$_"} );
- }
- for (qw(Month Day)) {
- $GetParam{"TicketChangeTimeStop$_"}
- = sprintf( "%02d", $GetParam{"TicketChangeTimeStop$_"} );
+ for my $Key (qw(Month Day)) {
+ $GetParam{"TicketChangeTimeStart$Key"}
+ = sprintf( "%02d", $GetParam{"TicketChangeTimeStart$Key"} );
+ $GetParam{"TicketChangeTimeStop$Key"}
+ = sprintf( "%02d", $GetParam{"TicketChangeTimeStop$Key"} );
}
if (
@@ -610,11 +604,9 @@
}
elsif ( $GetParam{CloseTimeSearchType} eq 'TimeSlot' ) {
- for (qw(Month Day)) {
- $GetParam{"TicketCloseTimeStart$_"}
- = sprintf( "%02d", $GetParam{"TicketCloseTimeStart$_"} );
- }
- for (qw(Month Day)) {
- $GetParam{"TicketCloseTimeStop$_"}
- = sprintf( "%02d", $GetParam{"TicketCloseTimeStop$_"} );
+ for my $Key (qw(Month Day)) {
+ $GetParam{"TicketCloseTimeStart$Key"}
+ = sprintf( "%02d", $GetParam{"TicketCloseTimeStart$Key"} );
+ $GetParam{"TicketCloseTimeStop$Key"}
+ = sprintf( "%02d", $GetParam{"TicketCloseTimeStop$Key"} );
}
if (
@@ -684,11 +676,9 @@
}
elsif ( $GetParam{EscalationTimeSearchType} eq 'TimeSlot' ) {
- for (qw(Month Day)) {
- $GetParam{"TicketEscalationTimeStart$_"}
- = sprintf( "%02d", $GetParam{"TicketEscalationTimeStart$_"} );
- }
- for (qw(Month Day)) {
- $GetParam{"TicketEscalationTimeStop$_"}
- = sprintf( "%02d", $GetParam{"TicketEscalationTimeStop$_"} );
+ for my $Key (qw(Month Day)) {
+ $GetParam{"TicketEscalationTimeStart$Key"}
+ = sprintf( "%02d", $GetParam{"TicketEscalationTimeStart$Key"} );
+ $GetParam{"TicketEscalationTimeStop$Key"}
+ = sprintf( "%02d", $GetParam{"TicketEscalationTimeStop$Key"} );
}
if (
@@ -780,6 +770,6 @@
if ( $GetParam{Fulltext} ) {
$GetParam{ContentSearch} = 'OR';
- for (qw(From To Cc Subject Body)) {
- $GetParam{$_} = $GetParam{Fulltext};
+ for my $Key (qw(From To Cc Subject Body)) {
+ $GetParam{$Key} = $GetParam{Fulltext};
}
}
@@ -853,9 +843,9 @@
my @CSVData;
- for (@ViewableTicketIDs) {
+ for my $TicketID (@ViewableTicketIDs) {
# get first article data
my %Data = $Self->{TicketObjectSearch}->ArticleFirstArticle(
- TicketID => $_,
+ TicketID => $TicketID,
Extended => 1,
DynamicFields => 1,
@@ -871,5 +861,5 @@
if ( $Self->{Config}->{SearchArticleCSVTree} ) {
my @Article = $Self->{TicketObjectSearch}->ArticleGet(
- TicketID => $_,
+ TicketID => $TicketID,
DynamicFields => 0,
);
@@ -902,5 +892,6 @@
%UserInfo,
AccountedTime =>
- $Self->{TicketObjectSearch}->TicketAccountedTimeGet( TicketID => $_ ),
+ $Self->{TicketObjectSearch}
+ ->TicketAccountedTimeGet( TicketID => $TicketID ),
);
@@ -920,9 +911,9 @@
}
my @Data;
- for (@CSVHead) {
+ for my $Header (@CSVHead) {
# check if header is a dynamic field and get the value from dynamic field
# backend
- if ( $_ =~ m{\A DynamicField_ ( [a-zA-Z\d]+ ) \z}xms ) {
+ if ( $Header =~ m{\A DynamicField_ ( [a-zA-Z\d]+ ) \z}xms ) {
# loop over the dynamic fields configured for CSV output
@@ -936,8 +927,8 @@
next DYNAMICFIELD if $DynamicFieldConfig->{Name} ne $1;
- # get the value as for print (to corretly display)
+ # get the value as for print (to correctly display)
my $ValueStrg = $Self->{BackendObject}->DisplayValueRender(
DynamicFieldConfig => $DynamicFieldConfig,
- Value => $Info{$_},
+ Value => $Info{$Header},
HTMLOutput => 0,
LayoutObject => $Self->{LayoutObject},
@@ -952,5 +943,5 @@
# otherwise retreive data from article
else {
- push @Data, $Info{$_};
+ push @Data, $Info{$Header};
}
}
@@ -1002,9 +993,9 @@
my @PDFData;
- for (@ViewableTicketIDs) {
+ for my $TicketID (@ViewableTicketIDs) {
# get first article data
my %Data = $Self->{TicketObjectSearch}->ArticleFirstArticle(
- TicketID => $_,
+ TicketID => $TicketID,
DynamicFields => 1,
);
@@ -1184,15 +1175,19 @@
# start table output
$Self->{PDFObject}->PageNew( %PageParam, FooterRight => $Page . ' 1', );
- for ( 2 .. $MaxPages ) {
+ PAGE:
+ for my $PageNumber ( 2 .. $MaxPages ) {
# output table (or a fragment of it)
- %TableParam = $Self->{PDFObject}->Table( %TableParam, );
+ %TableParam = $Self->{PDFObject}->Table(%TableParam);
# stop output or another page
if ( $TableParam{State} ) {
- last;
+ last PAGE;
}
else {
- $Self->{PDFObject}->PageNew( %PageParam, FooterRight => $Page . ' ' . $_, );
+ $Self->{PDFObject}->PageNew(
+ %PageParam,
+ FooterRight => $Page . ' ' . $PageNumber,
+ );
}
}
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log