summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-02-19 22:25:45 +0100
committerYorhel <git@yorhel.nl>2010-02-19 22:25:45 +0100
commit85bd4a28b3fcef7dbb68ae82e0c151979fff037a (patch)
tree2666b93382d45df8ca2964808dfdd7e6b7898e46 /lib
parent6423bc9f8b6c6283cbbc9b04954f63e7ad8ef1af (diff)
Two more GTIN-related fixes
1. Don't try to normalize the GTIN code in the releases form when it's 0 2. Don't try to gtintype() *every* number in the search
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/VN.pm2
-rw-r--r--lib/VNDB/Handler/Releases.pm2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm
index cb1a878c..fe4f7475 100644
--- a/lib/VNDB/DB/VN.pm
+++ b/lib/VNDB/DB/VN.pm
@@ -47,7 +47,7 @@ sub dbVNGet {
my @w;
for (split /[ -,._]/, $o{search}) {
s/%//g;
- if(/^\d+$/ && gtintype($_)) {
+ if(/^[0-9]{12,13}$/ && gtintype($_)) {
push @w, 'irr.gtin = ?', $_;
} elsif(length($_) > 0) {
$_ = "%$_%";
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index a0c860e2..840b29f0 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -295,7 +295,7 @@ sub edit {
sort { $a->{id} <=> $b->{id} } @{$r->{producers}}
),
);
- gtintype($b4{gtin}); # normalize gtin code
+ gtintype($b4{gtin}) if $b4{gtin}; # normalize gtin code
$b4{vn} = join('|||', map "$_->{vid},$_->{title}", @$vn);
my $frm;