From: Koosha Khajeh Moogahi Date: Tue, 4 Sep 2012 17:13:11 +0000 (+0200) Subject: Bug 779799: Add support to call Bugzilla::Version->check({ id => $id }) X-Git-Tag: bugzilla-4.4rc1~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8196e17133163a16a9a160624d54a7ebe3f49c36;p=thirdparty%2Fbugzilla.git Bug 779799: Add support to call Bugzilla::Version->check({ id => $id }) r/a=LpSolit --- diff --git a/Bugzilla/Version.pm b/Bugzilla/Version.pm index 02f2a70d81..4a2c4a5e1d 100644 --- a/Bugzilla/Version.pm +++ b/Bugzilla/Version.pm @@ -65,7 +65,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) { @@ -207,14 +207,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();