[otrs-cvs] FAQ/Kernel/System FAQ.pm,1.161,1.162
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/FAQ/Kernel/System
In directory lancelot:/tmp/cvs-serv24469/Kernel/System
Modified Files:
FAQ.pm
Log Message:
Code cleanup.
Author: mh
Index: FAQ.pm
===================================================================
RCS file: /home/cvs/FAQ/Kernel/System/FAQ.pm,v
retrieving revision 1.161
retrieving revision 1.162
diff -2 -u -d -r1.161 -r1.162
--- FAQ.pm 20 Nov 2012 13:06:08 -0000 1.161
+++ FAQ.pm 6 Dec 2012 12:50:10 -0000 1.162
@@ -234,7 +234,6 @@
);
- my %Data;
-
# set %Data from cache if any
+ my %Data;
if ( ref $Cache eq 'HASH' ) {
%Data = %{$Cache};
@@ -243,4 +242,5 @@
# otherwise get %Data from the DB
else {
+
return if !$Self->{DBObject}->Prepare(
SQL => '
@@ -254,5 +254,6 @@
AND i.f_language_id = l.id
AND i.id = ?',
- Bind => [ \$Param{ItemID} ],
+ Bind => [ \$Param{ItemID} ],
+ Limit => 1,
);
@@ -298,4 +299,5 @@
# check if FAQ item fields are required
if ($FetchItemFields) {
+
for my $FieldNumber ( 1 .. 6 ) {
@@ -313,9 +315,12 @@
# update number
if ( !$Data{Number} ) {
+
my $Number = $Self->{ConfigObject}->Get('SystemID') . '00' . $Data{ItemID};
+
return if !$Self->{DBObject}->Do(
SQL => 'UPDATE faq_item SET f_number = ? WHERE id = ?',
Bind => [ \$Number, \$Data{ItemID} ],
);
+
$Data{Number} = $Number;
}
@@ -493,4 +498,6 @@
Limit => $Param{Limit} || 500,
);
+
+ # fetch the result
my %Data;
if ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -654,5 +661,7 @@
\$Param{Keywords},
],
+ Limit => 1,
);
+
my $ID;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -1115,5 +1124,6 @@
Limit => 100,
);
- my @Index = ();
+
+ my @Index;
ATTACHMENT:
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -1153,4 +1163,5 @@
};
}
+
return @Index;
}
@@ -1216,4 +1227,5 @@
$Count = $Row[0];
}
+
return $Count;
}
@@ -1335,5 +1347,9 @@
$SQL .= $Ext;
- return if !$Self->{DBObject}->Prepare( SQL => $SQL );
+ return if !$Self->{DBObject}->Prepare(
+ SQL => $SQL,
+ Limit => 1,
+ );
+
my %Data;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -1349,5 +1365,4 @@
return if !%Data;
-
return \%Data;
}
@@ -1390,8 +1405,10 @@
Limit => $Param{Limit} || 500,
);
+
my @VoteIDs;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
push @VoteIDs, $Row[0];
}
+
return \@VoteIDs;
}
@@ -1601,4 +1618,5 @@
Bind => [ \$Param{ItemID} ],
);
+
my @Data;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -1610,4 +1628,5 @@
push @Data, \%Record;
}
+
return \@Data;
}
@@ -1716,4 +1735,5 @@
Limit => 200,
);
+
my @Data;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -1729,4 +1749,5 @@
push @Data, \%Record;
}
+
return \@Data;
}
@@ -1980,7 +2001,9 @@
# sql
return if !$Self->{DBObject}->Prepare(
- SQL => 'SELECT id, parent_id, name, comments, valid_id FROM faq_category WHERE id = ?',
- Bind => [ \$Param{CategoryID} ],
+ SQL => 'SELECT id, parent_id, name, comments, valid_id FROM faq_category WHERE id = ?',
+ Bind => [ \$Param{CategoryID} ],
+ Limit => 1,
);
+
my %Data;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -2076,5 +2099,5 @@
}
- my @SubCategoryIDs = ();
+ my @SubCategoryIDs;
my @TempSubCategoryIDs = keys %{ $Categories->{ $Param{ParentID} } };
SUBCATEGORYID:
@@ -2163,7 +2186,9 @@
# get new category id
return if !$Self->{DBObject}->Prepare(
- SQL => 'SELECT id FROM faq_category WHERE name = ?',
- Bind => [ \$Param{Name} ],
+ SQL => 'SELECT id FROM faq_category WHERE name = ?',
+ Bind => [ \$Param{Name} ],
+ Limit => 1,
);
+
my $CategoryID;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -2312,5 +2337,8 @@
# prepare sql statement
- return if !$Self->{DBObject}->Prepare( SQL => $SQL );
+ return if !$Self->{DBObject}->Prepare(
+ SQL => $SQL,
+ Limit => 1,
+ );
# fetch the result
@@ -2388,4 +2416,5 @@
$Count = $Row[0];
}
+
return $Count;
}
@@ -2528,8 +2557,10 @@
Bind => [ \$Param{CategoryID} ],
);
+
my @Groups;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
push @Groups, $Row[0];
}
+
return \@Groups;
}
@@ -2593,4 +2624,5 @@
SQL => 'SELECT group_id, category_id FROM faq_category_group',
);
+
my %Groups;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -2691,4 +2723,5 @@
SQL => 'SELECT f_keywords FROM faq_item',
);
+
my %Data;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -2804,8 +2837,10 @@
# sql
return if !$Self->{DBObject}->Prepare( SQL => 'SELECT id, name FROM faq_state' );
+
my %List;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
$List{ $Row[0] } = $Row[1];
}
+
return %List;
}
@@ -2924,7 +2959,9 @@
# sql
return if !$Self->{DBObject}->Prepare(
- SQL => 'SELECT id, name FROM faq_state WHERE id = ?',
- Bind => [ \$Param{StateID} ],
+ SQL => 'SELECT id, name FROM faq_state WHERE id = ?',
+ Bind => [ \$Param{StateID} ],
+ Limit => 1,
);
+
my %Data;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -2935,4 +2972,5 @@
);
}
+
return %Data;
}
@@ -2995,4 +3033,5 @@
Bind => \@Bind,
);
+
my %Data;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -3139,5 +3178,8 @@
# prepare sql statement
- return if !$Self->{DBObject}->Prepare( SQL => $SQL );
+ return if !$Self->{DBObject}->Prepare(
+ SQL => $SQL,
+ Limit => 1,
+ );
# fetch the result
@@ -3221,7 +3263,9 @@
# sql
return if !$Self->{DBObject}->Prepare(
- SQL => 'SELECT id, name FROM faq_language WHERE id = ?',
- Bind => [ \$Param{LanguageID} ],
+ SQL => 'SELECT id, name FROM faq_language WHERE id = ?',
+ Bind => [ \$Param{LanguageID} ],
+ Limit => 1,
);
+
my %Data;
while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
@@ -3231,4 +3275,5 @@
);
}
+
return %Data;
}
@@ -3737,4 +3782,5 @@
push @List, $Row[0];
}
+
return @List;
}
@@ -3782,5 +3828,5 @@
}
- my @CategoryList = ();
+ my @CategoryList;
my $TempCategoryID = $Param{CategoryID};
while ($TempCategoryID) {
@@ -3794,5 +3840,6 @@
$TempCategoryID = $Data{ParentID};
}
- @CategoryList = reverse(@CategoryList);
+
+ @CategoryList = reverse @CategoryList;
return \@CategoryList;
@@ -3904,5 +3951,5 @@
UserID => $Param{UserID},
);
- my %UserGroups = ();
+ my %UserGroups;
if ( !$Self->{Cache}->{GetUserCategories}->{GroupMemberList} ) {
%UserGroups = $Self->{GroupObject}->GroupMemberList(
@@ -4112,5 +4159,5 @@
# extract category ids
- my %AllCategoryIDs = ();
+ my %AllCategoryIDs;
for my $ParentID ( keys %{$CustomerCategories} ) {
for my $CategoryID ( keys %{ $CustomerCategories->{$ParentID} } ) {
@@ -4120,5 +4167,5 @@
# get all customer category ids
- my @CustomerCategoryIDs = ();
+ my @CustomerCategoryIDs;
for my $CategoryID ( 0, keys %AllCategoryIDs ) {
push @CustomerCategoryIDs, @{
@@ -4205,5 +4252,5 @@
# extract category ids
- my %AllCategoryIDs = ();
+ my %AllCategoryIDs;
for my $ParentID ( keys %{$PublicCategories} ) {
for my $CategoryID ( keys %{ $PublicCategories->{$ParentID} } ) {
@@ -4213,5 +4260,5 @@
# get all public category ids
- my @PublicCategoryIDs = ();
+ my @PublicCategoryIDs;
for my $CategoryID ( 0, keys %AllCategoryIDs ) {
push @PublicCategoryIDs, @{
@@ -4292,4 +4339,5 @@
UserID => $Param{UserID},
);
+
for my $Permission (qw(rw ro)) {
for my $ParentID ( keys %{$UserCategories} ) {
@@ -4302,4 +4350,5 @@
}
}
+
return '';
}
@@ -4350,4 +4399,5 @@
}
}
+
return '';
}
@@ -4443,9 +4493,9 @@
);
- my %Category = %{ $Categories->{ $Param{ParentID} } };
- my @CategoryIDs = sort { $Category{$a} cmp $Category{$b} } ( keys %Category );
- my @AllowedCategoryIDs = ();
+ my %Category = %{ $Categories->{ $Param{ParentID} } };
+ my @CategoryIDs = sort { $Category{$a} cmp $Category{$b} } ( keys %Category );
- my %Articles = ();
+ my @AllowedCategoryIDs;
+ my %Articles;
# check cache
@@ -4543,7 +4593,7 @@
return [] if !$CategoryListCategories->{ $Param{ParentID} };
- my %Category = %{ $CategoryListCategories->{ $Param{ParentID} } };
- my @CategoryIDs = sort { $Category{$a} cmp $Category{$b} } ( keys %Category );
- my @AllowedCategoryIDs = ();
+ my %Category = %{ $CategoryListCategories->{ $Param{ParentID} } };
+ my @CategoryIDs = sort { $Category{$a} cmp $Category{$b} } ( keys %Category );
+ my @AllowedCategoryIDs;
for my $CategoryID (@CategoryIDs) {
@@ -4937,10 +4987,10 @@
}
- my %UserCategories = ();
+ my %UserCategories;
PARENTID:
for my $ParentID ( sort { $a <=> $b } keys %{ $Param{Categories} } ) {
- my %SubCategories = ();
+ my %SubCategories;
CATEGORYID:
---------------------------------------------------------------------
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