]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 779799: Add support to call Bugzilla::Version->check({ id => $id })
authorKoosha Khajeh Moogahi <koosha.khajeh@gmail.com>
Tue, 4 Sep 2012 17:11:24 +0000 (19:11 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Tue, 4 Sep 2012 17:11:24 +0000 (19:11 +0200)
r/a=LpSolit

Bugzilla/Version.pm

index 449630a6d9e43928899fc03490e5334bd1b69eb6..aa05d66e8f905634a9a6393566a6cc9a79bf185d 100644 (file)
@@ -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();