summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoosha Khajeh Moogahi <koosha.khajeh@gmail.com>2012-09-04 19:11:24 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-09-04 19:11:24 +0200
commitc3d86302f155ca9467d4fe80942ec91e6dd9e812 (patch)
tree7fd7635947c608d82dbe43ac4e619c67c8c1c642
parenta11eb609e7b3ef0063bf493bd95ebb63612d7ac3 (diff)
downloadbugzilla-c3d86302f155ca9467d4fe80942ec91e6dd9e812.tar.gz
bugzilla-c3d86302f155ca9467d4fe80942ec91e6dd9e812.tar.xz
Bug 779799: Add support to call Bugzilla::Version->check({ id => $id })
r/a=LpSolit
-rw-r--r--Bugzilla/Version.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/Bugzilla/Version.pm b/Bugzilla/Version.pm
index 449630a6d..aa05d66e8 100644
--- a/Bugzilla/Version.pm
+++ b/Bugzilla/Version.pm
@@ -66,7 +66,7 @@ sub new {
my $dbh = Bugzilla->dbh;
my $product;
- if (ref $param) {
+ if (ref $param and !defined $param->{id}) {
$product = $param->{product};
my $name = $param->{name};
if (!defined $product) {
@@ -208,14 +208,16 @@ Bugzilla::Version - Bugzilla product version class.
use Bugzilla::Version;
- my $version = new Bugzilla::Version({ name => $name, product => $product });
+ my $version = new Bugzilla::Version({ name => $name, product => $product_obj });
+ my $version = Bugzilla::Version->check({ name => $name, product => $product_obj });
+ my $version = Bugzilla::Version->check({ id => $id });
my $value = $version->name;
my $product_id = $version->product_id;
my $product = $version->product;
my $version = Bugzilla::Version->create(
- { value => $name, product => $product });
+ { value => $name, product => $product_obj });
$version->set_name($new_name);
$version->update();