bugzilla-4intranet/extensions/testopia/patch-3.4.3

291 lines
11 KiB
Groff

### Eclipse Workspace Patch 1.0
#P bmo-3.4
Index: Bugzilla/Constants.pm
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Constants.pm,v
retrieving revision 1.109.2.12
diff -u -r1.109.2.12 Constants.pm
--- Bugzilla/Constants.pm 5 Nov 2009 18:56:34 -0000 1.109.2.12
+++ Bugzilla/Constants.pm 7 Nov 2009 02:55:47 -0000
@@ -134,6 +134,7 @@
ERROR_MODE_WEBPAGE
ERROR_MODE_DIE
ERROR_MODE_DIE_SOAP_FAULT
+ ERROR_MODE_AJAX
INSTALLATION_MODE_INTERACTIVE
INSTALLATION_MODE_NON_INTERACTIVE
@@ -386,6 +387,7 @@
use constant ERROR_MODE_WEBPAGE => 0;
use constant ERROR_MODE_DIE => 1;
use constant ERROR_MODE_DIE_SOAP_FAULT => 2;
+use constant ERROR_MODE_AJAX => 3;
# The various modes that checksetup.pl can run in.
use constant INSTALLATION_MODE_INTERACTIVE => 0;
Index: Bugzilla/User.pm
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/User.pm,v
retrieving revision 1.178.2.3
diff -u -r1.178.2.3 User.pm
--- Bugzilla/User.pm 2 Jun 2009 22:04:13 -0000 1.178.2.3
+++ Bugzilla/User.pm 7 Nov 2009 02:55:48 -0000
@@ -339,6 +339,16 @@
return $self->{queries_available};
}
+sub testopia_queries {
+ my $self = shift;
+ my $dbh = Bugzilla->dbh;
+ my $ref = $dbh->selectall_arrayref(
+ "SELECT name, query FROM test_named_queries
+ WHERE userid = ? AND isvisible = 1",
+ {'Slice' =>{}}, $self->id);
+ return $ref;
+}
+
sub settings {
my ($self) = @_;
@@ -657,7 +667,7 @@
my $class_restricted = Bugzilla->params->{'useclassification'} && $class_id;
if (!defined $self->{selectable_products}) {
- my $query = "SELECT id " .
+ my $query = "(SELECT id, name AS pname " .
" FROM products " .
"LEFT JOIN group_control_map " .
" ON group_control_map.product_id = products.id ";
@@ -667,10 +677,17 @@
$query .= " AND group_control_map.membercontrol = " . CONTROLMAPMANDATORY;
}
$query .= " AND group_id NOT IN(" . $self->groups_as_string . ") " .
- " WHERE group_id IS NULL " .
- "ORDER BY name";
+ " WHERE group_id IS NULL) " ;
+
- my $prod_ids = Bugzilla->dbh->selectcol_arrayref($query);
+ $query .= "UNION (SELECT id, tr_products.name AS pname FROM products AS tr_products ".
+ "INNER JOIN test_plans ON tr_products.id = test_plans.product_id ".
+ "INNER JOIN test_plan_permissions ON test_plan_permissions.plan_id = test_plans.plan_id ".
+ "WHERE test_plan_permissions.userid = ?)";
+
+ $query .= "ORDER BY pname ";
+
+ my $prod_ids = Bugzilla->dbh->selectcol_arrayref($query,undef,$self->id);
$self->{selectable_products} = Bugzilla::Product->new_from_list($prod_ids);
}
@@ -948,6 +965,33 @@
$group_delete->execute($id, $group, GRANT_REGEXP) if $present;
}
}
+ # Now do the same for Testopia test plans.
+ $sth = $dbh->prepare("SELECT test_plan_permissions_regexp.plan_id,
+ user_regexp, test_plan_permissions_regexp.permissions,
+ test_plan_permissions.plan_id
+ FROM test_plan_permissions_regexp
+ LEFT JOIN test_plan_permissions
+ ON test_plan_permissions_regexp.plan_id = test_plan_permissions.plan_id
+ AND test_plan_permissions.userid = ?
+ AND test_plan_permissions.grant_type = ?");
+
+ $sth->execute($id, GRANT_REGEXP);
+ my $plan_insert = $dbh->prepare(q{INSERT INTO test_plan_permissions
+ (userid, plan_id, permissions, grant_type)
+ VALUES (?, ?, ?, ?)});
+ my $plan_delete = $dbh->prepare(q{DELETE FROM test_plan_permissions
+ WHERE userid = ?
+ AND plan_id = ?
+ AND grant_type = ?});
+
+ while (my ($planid, $regexp, $perms, $present) = $sth->fetchrow_array()) {
+ if (($regexp ne '') && ($self->{login} =~ m/$regexp/i)) {
+ $plan_insert->execute($id, $planid, $perms, GRANT_REGEXP) unless $present;
+ } else {
+ $plan_delete->execute($id, $planid, GRANT_REGEXP) if $present;
+ }
+ }
+
}
sub product_responsibilities {
Index: Bugzilla/Bug.pm
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v
retrieving revision 1.276.2.12
diff -u -r1.276.2.12 Bug.pm
--- Bugzilla/Bug.pm 1 Nov 2009 20:14:11 -0000 1.276.2.12
+++ Bugzilla/Bug.pm 7 Nov 2009 02:55:46 -0000
@@ -2939,6 +2939,14 @@
"SELECT bug_id FROM bugs WHERE alias = ?", undef, $alias);
}
+sub get_test_case_count {
+ my $self = shift;
+ my $dbh = Bugzilla->dbh;
+ my $row_count = $dbh->selectall_arrayref(
+ "SELECT DISTINCT case_id FROM test_case_bugs WHERE bug_id = ?",
+ undef, $self->bug_id);
+ return scalar @$row_count;
+}
#####################################################################
# Subroutines
#####################################################################
Index: Bugzilla/Error.pm
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Error.pm,v
retrieving revision 1.24
diff -u -r1.24 Error.pm
--- Bugzilla/Error.pm 27 May 2008 22:08:59 -0000 1.24
+++ Bugzilla/Error.pm 7 Nov 2009 02:55:47 -0000
@@ -32,6 +32,7 @@
use Bugzilla::WebService::Constants;
use Bugzilla::Util;
use Date::Format;
+use JSON;
# We cannot use $^S to detect if we are in an eval(), because mod_perl
# already eval'uates everything, so $^S = 1 in all cases under mod_perl!
@@ -114,6 +115,16 @@
}
die SOAP::Fault->faultcode($code)->faultstring($message);
}
+ elsif (Bugzilla->error_mode == ERROR_MODE_AJAX) {
+ # JSON can't handle strings across lines.
+ $message =~ s/\n/ /gm;
+ my $err;
+ $err->{'success'} = JSON::false;
+ $err->{'error'} = $error;
+ $err->{'message'} = $message;
+ my $json = new JSON;
+ print $json->encode($err);
+ }
}
exit;
}
Index: Bugzilla/Search.pm
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search.pm,v
retrieving revision 1.173.2.1
diff -u -r1.173.2.1 Search.pm
--- Bugzilla/Search.pm 7 Jul 2009 18:20:08 -0000 1.173.2.1
+++ Bugzilla/Search.pm 7 Nov 2009 02:55:47 -0000
@@ -269,6 +269,12 @@
push(@supptables, "LEFT JOIN longdescs AS ldtime " .
"ON ldtime.bug_id = bugs.bug_id");
}
+ ### Testopia ###
+ if (grep($_ eq 'test_cases', @fields)){
+ push(@supptables, "LEFT JOIN test_case_bugs AS tcb " .
+ "ON bugs.bug_id = tcb.bug_id ");
+ }
+ ### end Testopia ###
my $minvotes;
if (defined $params->param('votes')) {
Index: Bugzilla/DB/Mysql.pm
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Mysql.pm,v
retrieving revision 1.72.2.3
diff -u -r1.72.2.3 Mysql.pm
--- Bugzilla/DB/Mysql.pm 20 Sep 2009 22:33:59 -0000 1.72.2.3
+++ Bugzilla/DB/Mysql.pm 7 Nov 2009 02:55:49 -0000
@@ -746,6 +746,9 @@
$self->bz_drop_index('bugs_fulltext', $index);
}
}
+ if ($table eq 'test_runs' && $name eq 'summary') {
+ $self->bz_drop_index('test_runs', 'test_runs_summary_idx');
+ }
my $dropped = $self->bz_drop_related_fks($table, $name);
push(@dropped_fks, @$dropped);
Index: template/en/default/admin/products/confirm-delete.html.tmpl
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/products/confirm-delete.html.tmpl,v
retrieving revision 1.11
diff -u -r1.11 confirm-delete.html.tmpl
--- template/en/default/admin/products/confirm-delete.html.tmpl 18 Dec 2008 17:18:20 -0000 1.11
+++ template/en/default/admin/products/confirm-delete.html.tmpl 7 Nov 2009 02:55:49 -0000
@@ -243,6 +243,8 @@
[% Hook.process("confirmation") %]
+[% Hook.process("additional-product-values") %]
+
[% IF product.bug_count == 0 || Param('allowbugdeletion') %]
<p>Do you really want to delete this product?</p>
Index: template/en/default/global/setting-descs.none.tmpl
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/template/en/default/global/setting-descs.none.tmpl,v
retrieving revision 1.15.2.1
diff -u -r1.15.2.1 setting-descs.none.tmpl
--- template/en/default/global/setting-descs.none.tmpl 19 Aug 2009 21:41:45 -0000 1.15.2.1
+++ template/en/default/global/setting-descs.none.tmpl 7 Nov 2009 02:55:49 -0000
@@ -40,6 +40,7 @@
"never" => "Never",
"cc_unless_role" => "Only if I have no role on them",
"lang" => "Language used in email",
+ "view_testopia" => "View the Testopia links",
"quote_replies" => "Quote the associated comment when you click on its reply link",
"quoted_reply" => "Quote the full comment",
"simple_reply" => "Reference the comment number only",
Index: Bugzilla/Install/Filesystem.pm
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Install/Filesystem.pm,v
retrieving revision 1.34
diff -u -r1.34 Filesystem.pm
--- Bugzilla/Install/Filesystem.pm 23 Jan 2009 21:34:42 -0000 1.34
+++ Bugzilla/Install/Filesystem.pm 7 Nov 2009 02:55:49 -0000
@@ -112,6 +112,7 @@
'runtests.pl' => { perms => $owner_executable },
'testserver.pl' => { perms => $ws_executable },
'whine.pl' => { perms => $ws_executable },
+ 'tr_importxml.pl' => { perms => $ws_executable },
'customfield.pl' => { perms => $owner_executable },
'email_in.pl' => { perms => $ws_executable },
'sanitycheck.pl' => { perms => $ws_executable },
Index: Bugzilla/WebService/User.pm
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/WebService/User.pm,v
retrieving revision 1.14
diff -u -r1.14 User.pm
--- Bugzilla/WebService/User.pm 26 Jan 2009 20:40:22 -0000 1.14
+++ Bugzilla/WebService/User.pm 7 Nov 2009 02:55:49 -0000
@@ -223,6 +223,32 @@
return { users => \@users };
}
+#################
+# User Lookup #
+#################
+
+sub lookup_login_by_id {
+ my $self = shift;
+ my ($author_id) = @_;
+
+ my $user = new Bugzilla::User($author_id);
+
+ my $result = defined $user ? $user->login : '';
+
+ # Result is user login string or empty string if failed
+ return $result;
+}
+
+sub lookup_id_by_login {
+ my $self = shift;
+ my ($author) = @_;
+
+ my $result = Bugzilla::User::login_to_id($author);
+
+ # Result is user id or 0 if failed
+ return $result;
+}
+
1;
__END__