]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 686780: Editing votes crashes Bugzilla
authorFrédéric Buclin <LpSolit@gmail.com>
Thu, 15 Sep 2011 14:16:54 +0000 (16:16 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 15 Sep 2011 14:16:54 +0000 (16:16 +0200)
r=dkl a=LpSolit

extensions/Voting/Extension.pm

index 8a786e6597ee9ff89775caf93b64c689545ab597..7a93c672e824169385f54e1cf2285ebc2145f515 100644 (file)
@@ -52,6 +52,21 @@ use constant REL_VOTER => 4;
 # Installation #
 ################
 
+BEGIN {
+    *Bugzilla::Bug::votes = \&votes;
+}
+
+sub votes {
+    my $self = shift;
+    my $dbh = Bugzilla->dbh;
+
+    return $self->{votes} if exists $self->{votes};
+
+    $self->{votes} = $dbh->selectrow_array('SELECT votes FROM bugs WHERE bug_id = ?',
+                                           undef, $self->id);
+    return $self->{votes};
+}
+
 sub db_schema_abstract_schema {
     my ($self, $args) = @_;
     $args->{'schema'}->{'votes'} = {