summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2015-01-21 05:35:34 +0100
committerAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2015-01-22 02:21:38 +0100
commit55820d126e56904fee58a04be82548135683a5c1 (patch)
treed59602ab386a7f2964dbdf1f44e4a799a706e3b1
parent2b1e9e6e95fc1e5a5a7052deca7217d192a8af06 (diff)
downloadDefaultRecipient-55820d126e56904fee58a04be82548135683a5c1.tar.gz
DefaultRecipient-55820d126e56904fee58a04be82548135683a5c1.tar.bz2
DefaultRecipient-55820d126e56904fee58a04be82548135683a5c1.zip
DefaultTo: Add TitleExistsCheck
Add sub TitleExistsCheck to check if another DefaultTo entry exists with the given name.
-rw-r--r--Kernel/System/DefaultTo.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/Kernel/System/DefaultTo.pm b/Kernel/System/DefaultTo.pm
index ef631cb..8ef9a1b 100644
--- a/Kernel/System/DefaultTo.pm
+++ b/Kernel/System/DefaultTo.pm
@@ -201,6 +201,27 @@ sub List {
return %DefaultTo;
}
+sub TitleExistsCheck {
+ my ( $Self, %Param ) = @_;
+
+ return if !$Self->{DBObject}->Prepare(
+ SQL => 'SELECT id FROM default_to WHERE title = ?',
+ Bind => [ \$Param{Title} ],
+ );
+
+ # fetch the result
+ my $Flag;
+ while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
+ if ( !$Param{ID} || $Param{ID} ne $Row[0] ) {
+ $Flag = 1;
+ }
+ }
+ if ($Flag) {
+ return 1;
+ }
+ return 0;
+}
+
sub MappingAdd {
my ( $Self, %Param ) = @_;