[otrs-cvs] ITSMConfigurationManagement/Kernel/System/ITSMConfigItem Version.pm, 1.33, 1.34

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/ITSMConfigurationManagement/Kernel/System/ITSMConfigItem
In directory lancelot:/tmp/cvs-serv32293/Kernel/System/ITSMConfigItem

Modified Files:
	Version.pm 
Log Message:
Added new optional sysconfig option to check if config item names are unique.

Author: ub

Index: Version.pm
===================================================================
RCS file: /home/cvs/ITSMConfigurationManagement/Kernel/System/ITSMConfigItem/Version.pm,v
retrieving revision 1.33
retrieving revision 1.34
diff -2 -u -d -r1.33 -r1.34
--- Version.pm	31 Oct 2012 13:28:14 -0000	1.33
+++ Version.pm	30 Nov 2012 19:49:09 -0000	1.34
@@ -14,4 +14,5 @@
 use strict;
 use warnings;
+use Kernel::System::VariableCheck qw(:all);
 
 use vars qw($VERSION);
@@ -480,4 +481,28 @@
     return if ref $ConfigItemInfo ne 'HASH';
 
+    # check, whether the feature to check for a unique name is enabled
+    if ( $Self->{ConfigObject}->Get('UniqueCIName::EnableUniquenessCheck') ) {
+
+        my $NameDuplicates = $Self->UniqueNameCheck(
+            ConfigItemID => $Param{ConfigItemID},
+            ClassID      => $ConfigItemInfo->{ClassID},
+            Name         => $Param{Name},
+        );
+
+        # stop processing if the name is not unique
+        if ( IsArrayRefWithData($NameDuplicates) ) {
+
+            # build a string of all duplicate IDs
+            my $Duplicates = join ', ', @{$NameDuplicates};
+
+            # write an error log message containing all the duplicate IDs
+            $Self->{LogObject}->Log(
+                Priority => 'error',
+                Message  => "The name $Param{Name} is already in use (ConfigItemIDs: $Duplicates)!",
+            );
+            return;
+        }
+    }
+
     my $Events = $Self->_GetEvents(
         Param          => \%Param,
---------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.