summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler/Traits.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2011-05-17 16:24:40 +0200
committerYorhel <git@yorhel.nl>2011-05-17 16:24:40 +0200
commit18e43c166feaaa8ae6b4183f1dd939cfcc3492f2 (patch)
treeaf5ed6fdd270ce6a49e69b720834c6a33fa6ad1c /lib/VNDB/Handler/Traits.pm
parentc07f9ab519afb936d4d346e73b129a0d34039361 (diff)
Bugfix: Don't allow duplicate trait names/aliasses within the same group
This makes the denied trait listing useful again.
Diffstat (limited to 'lib/VNDB/Handler/Traits.pm')
-rw-r--r--lib/VNDB/Handler/Traits.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/VNDB/Handler/Traits.pm b/lib/VNDB/Handler/Traits.pm
index ea599ed1..43b83090 100644
--- a/lib/VNDB/Handler/Traits.pm
+++ b/lib/VNDB/Handler/Traits.pm
@@ -151,6 +151,14 @@ sub traitedit {
$group //= $c->[0]{group}||$c->[0]{id} if @$c;
}
}
+ if(!$frm->{_err}) {
+ my $c = $self->dbTraitGet(name => $frm->{name}, noid => $trait, group => $group);
+ push @{$frm->{_err}}, [ 'name', 'traitexists', $c->[0] ] if @$c;
+ for (split /[\t\s]*\n[\t\s]*/, $frm->{alias}) {
+ $c = $self->dbTraitGet(name => $_, noid => $trait, group => $group);
+ push @{$frm->{_err}}, [ 'alias', 'traitexists', $c->[0] ] if @$c;
+ }
+ }
if(!$frm->{_err}) {
$frm->{state} = $frm->{meta} = 0 if !$self->authCan('tagmod');