From: Frédéric Buclin Date: Thu, 15 Sep 2011 14:16:54 +0000 (+0200) Subject: Bug 686780: Editing votes crashes Bugzilla X-Git-Tag: bugzilla-4.2rc1~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6721e79f654fe64a247525fec35e217d4fcf57e2;p=thirdparty%2Fbugzilla.git Bug 686780: Editing votes crashes Bugzilla r=dkl a=LpSolit --- diff --git a/extensions/Voting/Extension.pm b/extensions/Voting/Extension.pm index 8a786e6597..7a93c672e8 100644 --- a/extensions/Voting/Extension.pm +++ b/extensions/Voting/Extension.pm @@ -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'} = {