summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/Traits.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2011-02-13 13:30:43 +0100
committerYorhel <git@yorhel.nl>2011-02-13 13:30:43 +0100
commitf4b31e6d934bc93d678804ae7e4039031ff87760 (patch)
tree09cbed1af1155dea3db7ffb17a7aead541906321 /lib/VNDB/DB/Traits.pm
parent359627f10128f36f10b1d4714601fc33c3ce3c8a (diff)
chardb: Added trait add/edit form
Diffstat (limited to 'lib/VNDB/DB/Traits.pm')
-rw-r--r--lib/VNDB/DB/Traits.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/VNDB/DB/Traits.pm b/lib/VNDB/DB/Traits.pm
index 81ac95e1..8b9849ed 100644
--- a/lib/VNDB/DB/Traits.pm
+++ b/lib/VNDB/DB/Traits.pm
@@ -13,7 +13,7 @@ use Exporter 'import';
our @EXPORT = qw|dbTraitGet dbTraitTree dbTraitEdit dbTraitAdd|;
-# Options: id what results page sort reverse
+# Options: id noid name what results page sort reverse
# what: parents childs(n) aliases addedby
# sort: id name added
sub dbTraitGet {
@@ -26,7 +26,10 @@ sub dbTraitGet {
);
my %where = (
- $o{id} ? ('t.id = ?' => $o{id}) : (),
+ $o{id} ? ('t.id = ?' => $o{id}) : (),
+ $o{noid} ? ('t.id <> ?' => $o{noid}) : (),
+ $o{name} ? (
+ 't.id = (SELECT id FROM traits LEFT JOIN traits_aliases ON id = trait WHERE lower(name) = ? OR lower(alias) = ? LIMIT 1)' => [ lc $o{name}, lc $o{name} ]) : (),
);
my @select = (