|
From: Benjamin C. <bc...@us...> - 2002-07-18 13:02:17
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv9963
Modified Files:
bug.php config-dist.php config.php include.php query.php
Log Message:
Added configuration constants for four types of bug statuses. This removes the dependency on certain bug statuses having set names.
Index: bug.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/bug.php,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- bug.php 17 Jun 2002 15:49:17 -0000 1.112
+++ bug.php 18 Jul 2002 13:02:12 -0000 1.113
@@ -68,7 +68,7 @@
// If a number of votes are required to promote a bug, check for promotion
if (!$bug_is_new and $db->getOne("select count(*) from ".
TBL_BUG_VOTE." where bug_id = $bug_id") == PROMOTE_VOTES) {
- $status_id = $db->getOne("select status_id from ".TBL_STATUS." where status_name = 'New'");
+ $status_id = BUG_PROMOTED;
$buginfo = $db->getOne("select * from ".TBL_BUG." where bug_id = $bug_id");
$changedfields = array('status_id' => $status_id);
do_changedfields($u, $buginfo, $changedfields);
@@ -482,18 +482,11 @@
// Check to see if this bug's component has an owner and should be assigned
if ($owner = $db->getOne("select owner from ".TBL_COMPONENT." c where component_id = $component")) {
- $status = $db->getOne("select status_id from ".TBL_STATUS." where status_name = 'Assigned'");
+ $status = BUG_ASSIGNED;
} else {
$owner = 0;
-
- // If we aren't using voting to promote, then auto-promote to New
- if (PROMOTE_VOTES) {
- $stat_to_assign = 'Unconfirmed';
- } else {
- $stat_to_assign = 'New';
- }
-
- $status = $db->getOne("select status_id from ".TBL_STATUS." where status_name = '$stat_to_assign'");
+ // If we aren't using voting to promote, then auto-promote to New
+ $status = PROMOTE_VOTES ? BUG_UNCONFIRMED : BUG_PROMOTED;
}
$db->query('insert into '.TBL_BUG.' (bug_id, title, description, url, '.
Index: config-dist.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/config-dist.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- config-dist.php 13 Jun 2002 11:29:39 -0000 1.18
+++ config-dist.php 18 Jul 2002 13:02:14 -0000 1.19
@@ -68,7 +68,6 @@
define ('ONEDAY', 86400);
-require_once ('inc/db/'.DB_TYPE.'.php');
require_once ('inc/auth.php');
require_once ('inc/template.php');
Index: config.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/config.php,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- config.php 13 Jun 2002 11:29:39 -0000 1.32
+++ config.php 18 Jul 2002 13:02:14 -0000 1.33
@@ -70,7 +70,6 @@
define ('ONEDAY', 86400);
-require_once ('inc/db/'.DB_TYPE.'.php');
require_once ('inc/auth.php');
require_once ('inc/template.php');
Index: include.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/include.php,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- include.php 13 Jun 2002 14:26:34 -0000 1.120
+++ include.php 18 Jul 2002 13:02:14 -0000 1.121
@@ -58,7 +58,11 @@
while (list($k, $v) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
define($k, $v);
}
+define('OPEN_BUG_STATUSES', join(', ', array(BUG_UNCONFIRMED, BUG_PROMOTED,
+ BUG_ASSIGNED, BUG_REOPENED)));
+require_once ('inc/db/'.DB_TYPE.'.php');
+
// Localization - include the file with the desired language
include 'languages/'.LANGUAGE.'.php';
Index: query.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/query.php,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- query.php 17 Jun 2002 12:33:59 -0000 1.82
+++ query.php 18 Jul 2002 13:02:14 -0000 1.83
@@ -61,10 +61,8 @@
// Open bugs assigned to the user -- a hit list
if ($assignedto || $reportedby) {
- $status = $db->getCol("select status_id from ".TBL_STATUS.
- " where status_name ".($open ? '' : 'not ').
- "in ('Unconfirmed', 'New', 'Assigned', 'Reopened')");
- $query[] = 'b.status_id in ('.delimit_list(',',$status).')';
+ $query[] = 'b.status_id '.($open ? '' : 'not ').
+ 'in ('.OPEN_BUG_STATUSES.')';
if ($assignedto) {
$query[] = "assigned_to = {$_sv['uid']}";
} else {
|