[otrs-cvs] SystemMonitoring/Kernel/System/PostMaster/Filter SystemMonitoring.pm, 1.16, 1.17
"CVS commits notifications of OTRS.org" <[email protected]> Tue, 28 May 2013 09:34:40 +0000
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/SystemMonitoring/Kernel/System/PostMaster/Filter
In directory lancelot:/tmp/cvs-serv8697/Kernel/System/PostMaster/Filter
Modified Files:
SystemMonitoring.pm
Log Message:
Added documentation for missnaming of dynamic fields and error messages for missnamed dynamic fields.
Author: rs
Index: SystemMonitoring.pm
===================================================================
RCS file: /home/cvs/SystemMonitoring/Kernel/System/PostMaster/Filter/SystemMonitoring.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -2 -u -d -r1.16 -r1.17
--- SystemMonitoring.pm 7 Feb 2012 10:38:29 -0000 1.16
+++ SystemMonitoring.pm 28 May 2013 09:34:35 -0000 1.17
@@ -1,5 +1,5 @@
# --
# Kernel/System/PostMaster/Filter/SystemMonitoring.pm - Basic System Monitoring Interface
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id$
@@ -16,5 +16,9 @@
use strict;
use warnings;
+
use Kernel::System::LinkObject;
+use Kernel::System::DynamicField;
+use Kernel::System::VariableCheck qw(:all);
+
use vars qw($VERSION);
$VERSION = qw($Revision$) [1];
@@ -43,5 +47,6 @@
# create additional objects
- $Self->{LinkObject} = Kernel::System::LinkObject->new( %{$Self} );
+ $Self->{LinkObject} = Kernel::System::LinkObject->new( %{$Self} );
+ $Self->{DynamicFieldObject} = Kernel::System::DynamicField->new( %{$Self} );
# check if CI incident state should be set automatically
@@ -281,8 +286,61 @@
}
+ # Check if dynamic fields really exists.
+ # If dynamic fields don't exists, TicketSearch will return all tickets
+ # and then the new article/ticket could take wrong place.
+ # The lesser of the three evils is to create a new ticket
+ # instead of defacing existing tickets or dropping it.
+ # This behaviour will come true if the dynamic fields
+ # are named like TicketFreeTextHost. Its also bad.
+ my $Errors = 0;
+ for my $Type (qw(Host Service)) {
+ my $FreeTextField = $Self->{Config}->{ 'FreeText' . $Type };
+
+ my $DynamicField = $Self->{DynamicFieldObject}->DynamicFieldGet(
+ 'Name' => DynamicFieldTicketTextPrefix . $FreeTextField,
+ );
+
+ if ( !IsHashRefWithData($DynamicField) || $FreeTextField !~ m{\d+}xms ) {
+ $Self->{LogObject}->Log(
+ Priority => 'error',
+ Message => "DynamicField "
+ . DynamicFieldTicketTextPrefix
+ . $FreeTextField
+ . " does not exists or missnamed."
+ . " The configuration is based on freetext fields, so the number of the freetext field is expected"
+ . " (wrong value for key " . DynamicFieldTicketTextPrefix . $Type . " is set).",
+ );
+ $Errors = 1;
+ }
+ }
+
+ my $ArticleFreeTextField = $Self->{Config}->{'FreeTextState'};
+ my $DynamicFieldArticle = $Self->{DynamicFieldObject}->DynamicFieldGet(
+ 'Name' => DynamicFieldArticleTextPrefix . $ArticleFreeTextField,
+ );
+
+ if ( !IsHashRefWithData($DynamicFieldArticle) || $ArticleFreeTextField !~ m{\d+}xms ) {
+ $Self->{LogObject}->Log(
+ Priority => 'error',
+ Message => "DynamicField "
+ . DynamicFieldArticleTextPrefix
+ . $ArticleFreeTextField
+ . " does not exists or missnamed."
+ . " The configuration is based on freetext fields, so the number of the freetext field is expected"
+ . " (wrong value for key "
+ . DynamicFieldArticleTextPrefix
+ . $ArticleFreeTextField
+ . " is set).",
+ );
+ $Errors = 1;
+ }
+
my @TicketIDs = $Self->{TicketObject}->TicketSearch(%Query);
# get the first and only ticket id
- my $TicketID = shift @TicketIDs;
+ my $TicketID = ();
+ if ( !$Errors ) {
+ $TicketID = shift @TicketIDs;
+ }
return $TicketID;
---------------------------------------------------------------------
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