From 6721e79f654fe64a247525fec35e217d4fcf57e2 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Thu, 15 Sep 2011 16:16:54 +0200 Subject: Bug 686780: Editing votes crashes Bugzilla r=dkl a=LpSolit --- extensions/Voting/Extension.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'extensions/Voting') diff --git a/extensions/Voting/Extension.pm b/extensions/Voting/Extension.pm index 8a786e659..7a93c672e 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'} = { -- cgit v1.2.3-24-g4f1b