|
From: Benjamin C. <bc...@us...> - 2002-03-18 17:55:56
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv23909
Modified Files:
bug.php config-dist.php dbchanges.sql
Log Message:
Added bug dependencies
Index: bug.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/bug.php,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -r1.84 -r1.85
--- bug.php 17 Mar 2002 01:44:24 -0000 1.84
+++ bug.php 18 Mar 2002 17:43:15 -0000 1.85
@@ -363,6 +363,41 @@
$db->query('delete from '.TBL_BUG_CC." where bug_id = $bugid
and user_id in (".delimit_list(',', $remove_cc).')');
}
+
+ // Add dependency if requested
+ if (!empty($add_dependency)) {
+ $add_dependency = preg_replace('/\D/', '', $add_dependency);
+ // Validate the bug number
+ if (!is_numeric($add_dependency)) {
+ show_bug($bugid, array('add_dep' => $STRING['nobug']));
+ return;
+ }
+ if (!$db->getOne('select count(*) from '.TBL_BUG." where bug_id = $add_dependency")) {
+ show_bug($bugid, array('add_dep' => $STRING['nobug']));
+ return;
+ }
+
+ // Check if the dependency has already been added
+ if ($db->getOne('select count(*) from '.TBL_BUG_DEPENDENCY.
+ " where bug_id = $bugid and depends_on = $add_dependency")) {
+ show_bug($bugid, array('add_dep' => $STRING['dupe_dependency']));
+ return;
+ }
+
+ // Add it
+ $db->query("insert into ".TBL_BUG_DEPENDENCY.
+ " (bug_id, depends_on) values($bugid, $add_dependency)");
+ }
+
+ // Remove dependency if requested
+ if (!empty($del_dependency)) {
+ $del_dependency = preg_replace('/\D/', '', $del_dependency);
+ if (is_numeric($del_dependency)) {
+ $db->query("delete from ".TBL_BUG_DEPENDENCY.
+ " where bug_id = $bugid and depends_on = $del_dependency");
+ }
+ }
+
$changeresolution = false;
switch($outcome) {
@@ -558,7 +593,7 @@
}
function show_bug_printable($bugid) {
- global $db, $t, $select, $TITLE;
+ global $db, $me, $t, $select, $TITLE;
if (!is_numeric($bugid) or
!$row = $db->getRow('select b.*, reporter.login as reporter,
@@ -599,7 +634,11 @@
'version' => $row['version_name'],
'component' => $row['component_name'],
'os' => $row['os_name'],
- 'browserstring' => $row['browser_string']
+ 'browserstring' => $row['browser_string'],
+ 'bug_dependencies' => delimit_list(', ', $db->getCol('select '.
+ db_concat("'<a href=\"$me?op=show&bugid='", 'depends_on', '\'">#\'',
+ 'depends_on', '\'</a>\'').' from '.TBL_BUG_DEPENDENCY.
+ " where bug_id = $bugid"))
));
// Show the comments
@@ -739,7 +778,14 @@
" where bug_id = $bugid and user_id = $u"),
'already_voted_string' => $STRING['already_voted'],
'num_votes' => $db->getOne("select count(*) from ".TBL_BUG_VOTE.
- " where bug_id = $bugid")
+ " where bug_id = $bugid"),
+ 'bug_dependencies' => delimit_list(', ', $db->getCol('select '.
+ db_concat("'<a href=\"$me?op=show&bugid='", 'depends_on', '\'">#\'',
+ 'depends_on', '\'</a>\'').' from '.TBL_BUG_DEPENDENCY.
+ " where bug_id = $bugid")),
+ 'dependency_error' => isset($error['add_dep'])
+ ? '<div class="error">'.$error['add_dep'].'</div>'
+ : ''
));
switch($row['status_name']) {
case 'Unconfirmed' :
Index: config-dist.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/config-dist.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- config-dist.php 26 Jan 2002 16:46:52 -0000 1.7
+++ config-dist.php 18 Mar 2002 17:43:15 -0000 1.8
@@ -40,6 +40,7 @@
define ('TBL_AUTH_USER', TBL_PREFIX.'auth_user');
define ('TBL_BUG', TBL_PREFIX.'bug');
define ('TBL_BUG_CC', TBL_PREFIX.'bug_cc');
+define ('TBL_BUG_DEPENDENCY', TBL_PREFIX.'bug_dependency');
define ('TBL_BUG_GROUP', TBL_PREFIX.'bug_group');
define ('TBL_BUG_HISTORY', TBL_PREFIX.'bug_history');
define ('TBL_BUG_VOTE', TBL_PREFIX.'bug_vote');
Index: dbchanges.sql
===================================================================
RCS file: /cvsroot/phpbt/phpbt/dbchanges.sql,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- dbchanges.sql 26 Jan 2002 16:54:42 -0000 1.18
+++ dbchanges.sql 18 Mar 2002 17:43:16 -0000 1.19
@@ -1,3 +1 @@
-create table bug_vote (user_id int not null, bug_id int not null, created_date bigint unsigned not null, primary key(user_id, bug_id));
-insert into configuration values ('PROMOTE_VOTES', 5, 'The number of votes required to promote a bug from Unconfirmed to New (Set to 0 to disable promotions by voting)', 'string');
-insert into configuration values ('MAX_USER_VOTES', 5, 'The maximum number of votes a user can cast across all bugs (Set to 0 to have no limit)', 'string');
+create table bug_dependency (bug_id int not null, depends_on int not null, primary key (bug_id, depends_on));
|