Commit c3d86302 authored by Koosha Khajeh Moogahi's avatar Koosha Khajeh Moogahi Committed by Frédéric Buclin

Bug 779799: Add support to call Bugzilla::Version->check({ id => $id })

r/a=LpSolit
parent a11eb609
...@@ -66,7 +66,7 @@ sub new { ...@@ -66,7 +66,7 @@ sub new {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $product; my $product;
if (ref $param) { if (ref $param and !defined $param->{id}) {
$product = $param->{product}; $product = $param->{product};
my $name = $param->{name}; my $name = $param->{name};
if (!defined $product) { if (!defined $product) {
...@@ -208,14 +208,16 @@ Bugzilla::Version - Bugzilla product version class. ...@@ -208,14 +208,16 @@ Bugzilla::Version - Bugzilla product version class.
use Bugzilla::Version; 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 $value = $version->name;
my $product_id = $version->product_id; my $product_id = $version->product_id;
my $product = $version->product; my $product = $version->product;
my $version = Bugzilla::Version->create( my $version = Bugzilla::Version->create(
{ value => $name, product => $product }); { value => $name, product => $product_obj });
$version->set_name($new_name); $version->set_name($new_name);
$version->update(); $version->update();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment