Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 579 lines (470 sloc) 19.198 kB
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
1 <?php
3744d87 @giallu Mass header update with license specification (GPLv2+)
giallu authored
2 # Mantis - a php based bugtracking system
3
4 # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
5 # Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net
6
7 # Mantis is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # Mantis is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with Mantis. If not, see <http://www.gnu.org/licenses/>.
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
19
20 # --------------------------------------------------------
3744d87 @giallu Mass header update with license specification (GPLv2+)
giallu authored
21 # $Id: bugnote_api.php,v 1.46.2.1 2007-10-13 22:35:14 giallu Exp $
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
22 # --------------------------------------------------------
23
4310109 Added require_once statements to the API files.
Jeroen Latour authored
24 $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
feed7c5 code formatting fixes
Kenzaburo Ito authored
25
4310109 Added require_once statements to the API files.
Jeroen Latour authored
26 require_once( $t_core_dir . 'current_user_api.php' );
27 require_once( $t_core_dir . 'email_api.php' );
28 require_once( $t_core_dir . 'history_api.php' );
29 require_once( $t_core_dir . 'bug_api.php' );
feed7c5 code formatting fixes
Kenzaburo Ito authored
30
43c61f9 formatting fixes continued
Kenzaburo Ito authored
31 ### Bugnote API ###
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
32
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
33 #===================================
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
34 # Bugnote Data Structure Definition
35 #===================================
36 class BugnoteData {
ab38ae3 @vboctor Fixed some limitations that were reported in a MantisConnect issue (s…
vboctor authored
37 var $id;
38 var $bug_id;
39 var $reporter_id;
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
40 var $note;
41 var $view_state;
ab38ae3 @vboctor Fixed some limitations that were reported in a MantisConnect issue (s…
vboctor authored
42 var $date_submitted;
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
43 var $last_modified;
ab38ae3 @vboctor Fixed some limitations that were reported in a MantisConnect issue (s…
vboctor authored
44 var $note_type;
45 var $note_attr;
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
46 var $time_tracking;
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
47 }
48
49 #===================================
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
50 # Boolean queries and ensures
51 #===================================
1e7c6b9 Sorry for the muddled commit. I realize now that I ended up doing mo…
Julian Fitzell authored
52
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
53 # --------------------
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
54 # Check if a bugnote with the given ID exists
55 #
56 # return true if the bugnote exists, false otherwise
37a8eff start cleaning up bugnote_api.php - trigerring errors, converting thi…
Julian Fitzell authored
57 function bugnote_exists( $p_bugnote_id ) {
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
58 $c_bugnote_id = db_prepare_int( $p_bugnote_id );
59 $t_bugnote_table = config_get( 'mantis_bugnote_table' );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
60
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
61 $query = "SELECT COUNT(*)
62 FROM $t_bugnote_table
63 WHERE id='$c_bugnote_id'";
64 $result = db_query( $query );
1e7c6b9 Sorry for the muddled commit. I realize now that I ended up doing mo…
Julian Fitzell authored
65
37a8eff start cleaning up bugnote_api.php - trigerring errors, converting thi…
Julian Fitzell authored
66 if ( 0 == db_result( $result ) ) {
67 return false;
68 } else {
69 return true;
70 }
71 }
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
72
37a8eff start cleaning up bugnote_api.php - trigerring errors, converting thi…
Julian Fitzell authored
73 # --------------------
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
74 # Check if a bugnote with the given ID exists
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
75 #
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
76 # return true if the bugnote exists, raise an error if not
37a8eff start cleaning up bugnote_api.php - trigerring errors, converting thi…
Julian Fitzell authored
77 function bugnote_ensure_exists( $p_bugnote_id ) {
85ac3b7 code formatting fixes
Kenzaburo Ito authored
78 if ( !bugnote_exists( $p_bugnote_id ) ) {
37a8eff start cleaning up bugnote_api.php - trigerring errors, converting thi…
Julian Fitzell authored
79 trigger_error( ERROR_BUGNOTE_NOT_FOUND, ERROR );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
80 }
81 }
feed7c5 code formatting fixes
Kenzaburo Ito authored
82
0370da8 So finally, 2 days later, here is the access_api rewrite. I've teste…
Julian Fitzell authored
83 # --------------------
84 # Check if the given user is the reporter of the bugnote
85 # return true if the user is the reporter, false otherwise
86 function bugnote_is_user_reporter( $p_bugnote_id, $p_user_id ) {
87 if ( bugnote_get_field( $p_bugnote_id, 'reporter_id' ) == $p_user_id ) {
88 return true;
89 } else {
90 return false;
91 }
feed7c5 code formatting fixes
Kenzaburo Ito authored
92 }
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
93
94 #===================================
95 # Creation / Deletion / Updating
96 #===================================
97
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
98 # --------------------
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
99 # Add a bugnote to a bug
100 #
101 # return the ID of the new bugnote
b76e481 @giallu Fix 9309: Problems with e-mail notifications about bugnotes.
giallu authored
102 function bugnote_add ( $p_bug_id, $p_bugnote_text, $p_time_tracking = '0:00', $p_private = false, $p_type = 0, $p_attr = '', $p_user_id = null, $p_send_email = TRUE ) {
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
103 $c_bug_id = db_prepare_int( $p_bug_id );
104 $c_bugnote_text = db_prepare_string( $p_bugnote_text );
8544d9c Convert time_tracking from TIME to INT (minutes).
davidnewcomb authored
105 $c_time_tracking = db_prepare_time( $p_time_tracking );
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
106 $c_private = db_prepare_bool( $p_private );
b2b7c75 @thraxisp fir for 0004387: reminders are localized
thraxisp authored
107 $c_type = db_prepare_int( $p_type );
108 $c_attr = db_prepare_string( $p_attr );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
109
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
110 $t_bugnote_text_table = config_get( 'mantis_bugnote_text_table' );
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
111 $t_bugnote_table = config_get( 'mantis_bugnote_table' );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
112
4fb71fb Fix for bugs #9179, #9180, #9181, #9182
Daryn Warriner authored
113 $t_time_tracking_enabled = config_get( 'time_tracking_enabled' );
114 $t_time_tracking_without_note = config_get( 'time_tracking_without_note' );
115 if ( ON == $t_time_tracking_enabled && $c_time_tracking > 0 ) {
116 if ( is_blank( $p_bugnote_text ) && OFF == $t_time_tracking_without_note ) {
117 error_parameters( lang_get( 'bugnote' ) );
118 trigger_error( ERROR_EMPTY_FIELD, ERROR );
119 }
120 $c_type = TIME_TRACKING;
121 } else if ( is_blank( $p_bugnote_text ) ) {
122 return false;
123 }
124
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
125 # insert bugnote text
43c61f9 formatting fixes continued
Kenzaburo Ito authored
126 $query = "INSERT INTO $t_bugnote_text_table
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
127 ( note )
128 VALUES
129 ( '$c_bugnote_text' )";
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
130 db_query( $query );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
131
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
132 # retrieve bugnote text id number
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
133 $t_bugnote_text_id = db_insert_id( $t_bugnote_text_table );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
134
a8878ad @vboctor - Fixed #5741: PHP notice generated when a priority is not defined $g…
vboctor authored
135 # get user information
136 if ( $p_user_id === null ) {
137 $c_user_id = auth_get_current_user_id();
138 } else {
139 $c_user_id = db_prepare_int( $p_user_id );
140 }
141
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
142 # Check for private bugnotes.
a8878ad @vboctor - Fixed #5741: PHP notice generated when a priority is not defined $g…
vboctor authored
143 # @@@ VB: Should we allow users to report private bugnotes, and possibly see only their own private ones
144 if ( $p_private && access_has_bug_level( config_get( 'private_bugnote_threshold' ), $p_bug_id, $c_user_id ) ) {
f68056c * (many files):
int2str authored
145 $t_view_state = VS_PRIVATE;
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
146 } else {
f68056c * (many files):
int2str authored
147 $t_view_state = VS_PUBLIC;
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
148 }
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
149
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
150 # insert bugnote info
43c61f9 formatting fixes continued
Kenzaburo Ito authored
151 $query = "INSERT INTO $t_bugnote_table
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
152 (bug_id, reporter_id, bugnote_text_id, view_state, date_submitted, last_modified, note_type, note_attr, time_tracking )
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
153 VALUES
8544d9c Convert time_tracking from TIME to INT (minutes).
davidnewcomb authored
154 ('$c_bug_id', '$c_user_id','$t_bugnote_text_id', '$t_view_state', " . db_now() . "," . db_now() . ", '$c_type', '$c_attr', '$c_time_tracking' )";
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
155 db_query( $query );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
156
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
157 # get bugnote id
43c61f9 formatting fixes continued
Kenzaburo Ito authored
158 $t_bugnote_id = db_insert_id( $t_bugnote_table );
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
159
160 # update bug last updated
161 bug_update_date( $p_bug_id );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
162
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
163 # log new bug
164 history_log_event_special( $p_bug_id, BUGNOTE_ADDED, bugnote_format_id( $t_bugnote_id ) );
165
4fb71fb Fix for bugs #9179, #9180, #9181, #9182
Daryn Warriner authored
166 # only send email if the text is not blank, otherwise, it is just recording of time without a comment.
b76e481 @giallu Fix 9309: Problems with e-mail notifications about bugnotes.
giallu authored
167 if ( $p_send_email && !is_blank( $p_bugnote_text ) ) {
4fb71fb Fix for bugs #9179, #9180, #9181, #9182
Daryn Warriner authored
168 email_bugnote_add( $p_bug_id );
169 }
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
170 return $t_bugnote_id;
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
171 }
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
172
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
173 # --------------------
174 # Delete a bugnote
175 function bugnote_delete( $p_bugnote_id ) {
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
176 $c_bugnote_id = db_prepare_int( $p_bugnote_id );
177 $t_bug_id = bugnote_get_field( $p_bugnote_id, 'bug_id' );
178 $t_bugnote_text_id = bugnote_get_field( $p_bugnote_id, 'bugnote_text_id' );
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
179 $t_bugnote_text_table = config_get( 'mantis_bugnote_text_table' );
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
180 $t_bugnote_table = config_get( 'mantis_bugnote_table' );
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
181
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
182 # Remove the bugnote
43c61f9 formatting fixes continued
Kenzaburo Ito authored
183 $query = "DELETE FROM $t_bugnote_table
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
184 WHERE id='$c_bugnote_id'";
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
185 db_query( $query );
feed7c5 code formatting fixes
Kenzaburo Ito authored
186
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
187 # Remove the bugnote text
43c61f9 formatting fixes continued
Kenzaburo Ito authored
188 $query = "DELETE FROM $t_bugnote_text_table
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
189 WHERE id='$t_bugnote_text_id'";
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
190 db_query( $query );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
191
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
192 # log deletion of bug
193 history_log_event_special( $t_bug_id, BUGNOTE_DELETED, bugnote_format_id( $p_bugnote_id ) );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
194
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
195 return true;
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
196 }
197
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
198 # --------------------
199 # delete all bugnotes associated with the given bug
200 function bugnote_delete_all( $p_bug_id ) {
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
201 $c_bug_id = db_prepare_int( $p_bug_id );
202 $t_bugnote_table = config_get( 'mantis_bugnote_table' );
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
203 $t_bugnote_text_table = config_get( 'mantis_bugnote_text_table' );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
204
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
205 # Delete the bugnote text items
206 $query = "SELECT bugnote_text_id
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
207 FROM $t_bugnote_table
208 WHERE bug_id='$c_bug_id'";
43c61f9 formatting fixes continued
Kenzaburo Ito authored
209 $result = db_query( $query );
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
210 $bugnote_count = db_num_rows( $result );
211 for ( $i = 0 ; $i < $bugnote_count ; $i++ ) {
212 $row = db_fetch_array( $result );
213 $t_bugnote_text_id = $row['bugnote_text_id'];
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
214
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
215 # Delete the corresponding bugnote texts
43c61f9 formatting fixes continued
Kenzaburo Ito authored
216 $query = "DELETE FROM $t_bugnote_text_table
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
217 WHERE id='$t_bugnote_text_id'";
e8a2fa0 @vboctor Fix #3020: Error when deleting a bug.
vboctor authored
218 db_query( $query );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
219 }
220
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
221 # Delete the corresponding bugnotes
43c61f9 formatting fixes continued
Kenzaburo Ito authored
222 $query = "DELETE FROM $t_bugnote_table
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
223 WHERE bug_id='$c_bug_id'";
43c61f9 formatting fixes continued
Kenzaburo Ito authored
224 $result = db_query( $query );
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
225
226 # db_query() errors on failure so:
227 return true;
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
228 }
229
230
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
231 #===================================
232 # Data Access
233 #===================================
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
234
235 # --------------------
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
236 # Get the text associated with the bugnote
6fee1c7 - renames to coding standard
Julian Fitzell authored
237 function bugnote_get_text( $p_bugnote_id ) {
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
238 $t_bugnote_text_id = bugnote_get_field( $p_bugnote_id, 'bugnote_text_id' );
43c61f9 formatting fixes continued
Kenzaburo Ito authored
239 $t_bugnote_text_table = config_get( 'mantis_bugnote_text_table' );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
240
241 # grab the bugnote text
242 $query = "SELECT note
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
243 FROM $t_bugnote_text_table
244 WHERE id='$t_bugnote_text_id'";
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
245 $result = db_query( $query );
246
1e7c6b9 Sorry for the muddled commit. I realize now that I ended up doing mo…
Julian Fitzell authored
247 return db_result( $result );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
248 }
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
249
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
250 # --------------------
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
251 # Get a field for the given bugnote
6fee1c7 - renames to coding standard
Julian Fitzell authored
252 function bugnote_get_field( $p_bugnote_id, $p_field_name ) {
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
253 $c_bugnote_id = db_prepare_int( $p_bugnote_id );
254 $c_field_name = db_prepare_string( $p_field_name );
43c61f9 formatting fixes continued
Kenzaburo Ito authored
255 $t_bugnote_table = config_get( 'mantis_bugnote_table' );
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
256
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
257 $query = "SELECT $c_field_name
258 FROM $t_bugnote_table
259 WHERE id='$c_bugnote_id' ";
3f2bf47 Added experimental support for MSSQL and PgSQL database, through ADOD…
Jeroen Latour authored
260 $result = db_query( $query, 1 );
37a8eff start cleaning up bugnote_api.php - trigerring errors, converting thi…
Julian Fitzell authored
261
1e7c6b9 Sorry for the muddled commit. I realize now that I ended up doing mo…
Julian Fitzell authored
262 return db_result( $result );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
263 }
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
264
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
265 # --------------------
f41664a @thraxisp fix for 0003882: Private notes on public bugs notify people below pri…
thraxisp authored
266 # Get latest bugnote id
267 function bugnote_get_latest_id( $p_bug_id ) {
268 $c_bug_id = db_prepare_int( $p_bug_id );
269 $t_bugnote_table = config_get( 'mantis_bugnote_table' );
270
271 $query = "SELECT id
272 FROM $t_bugnote_table
638dcd0 Fixed inconsistencies in line-endings
Jeroen Latour authored
273 WHERE bug_id='$c_bug_id'
f41664a @thraxisp fix for 0003882: Private notes on public bugs notify people below pri…
thraxisp authored
274 ORDER by last_modified DESC";
275 $result = db_query( $query, 1 );
276
277 return db_result( $result );
278 }
279
280 # --------------------
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
281 # Build the bugnotes array for the given bug_id filtered by specified $p_user_access_level.
282 # Bugnotes are sorted by date_submitted according to 'bugnote_order' configuration setting.
283 #
284 # Return BugnoteData class object with raw values from the tables except the field
285 # last_modified - it is UNIX_TIMESTAMP.
3f72dc6 The bugnote limit was not read from the settings of the user the mail…
Jeroen Latour authored
286 function bugnote_get_all_visible_bugnotes( $p_bug_id, $p_user_access_level, $p_user_bugnote_order, $p_user_bugnote_limit ) {
287 $t_all_bugnotes = bugnote_get_all_bugnotes( $p_bug_id, $p_user_bugnote_order, $p_user_bugnote_limit );
43c61f9 formatting fixes continued
Kenzaburo Ito authored
288 $t_private_bugnote_threshold = config_get( 'private_bugnote_threshold' );
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
289
ab36ed8 @thraxisp refactored access routines to access comparison
thraxisp authored
290 $t_private_bugnote_visible = access_compare_level( $p_user_access_level, config_get( 'private_bugnote_threshold' ) );
11a6b8f @vboctor Fixed #7965: Time tracking information not shown on email notifications.
vboctor authored
291 $t_time_tracking_visible = access_compare_level( $p_user_access_level, config_get( 'time_tracking_view_threshold' ) );
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
292
293 $t_bugnotes = array();
294 foreach ( $t_all_bugnotes as $t_note_index => $t_bugnote ) {
43c61f9 formatting fixes continued
Kenzaburo Ito authored
295 if ( $t_private_bugnote_visible || ( VS_PUBLIC == $t_bugnote->view_state ) ) {
11a6b8f @vboctor Fixed #7965: Time tracking information not shown on email notifications.
vboctor authored
296 # If the access level specified is not enough to see time tracking information
297 # then reset it to 0.
298 if ( !$t_time_tracking_visible ) {
299 $t_bugnote->time_tracking = 0;
300 }
301
feed7c5 code formatting fixes
Kenzaburo Ito authored
302 $t_bugnotes[$t_note_index] = $t_bugnote;
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
303 }
304 }
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
305
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
306 return $t_bugnotes;
307 }
308
309 # --------------------
310 # Build the bugnotes array for the given bug_id. Bugnotes are sorted by date_submitted
311 # according to 'bugnote_order' configuration setting.
312 # Return BugnoteData class object with raw values from the tables except the field
313 # last_modified - it is UNIX_TIMESTAMP.
314 # The data is not filtered by VIEW_STATE !!
3f72dc6 The bugnote limit was not read from the settings of the user the mail…
Jeroen Latour authored
315 function bugnote_get_all_bugnotes( $p_bug_id, $p_user_bugnote_order, $p_user_bugnote_limit ) {
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
316 global $g_cache_bugnotes;
317
85ac3b7 code formatting fixes
Kenzaburo Ito authored
318 if ( !isset( $g_cache_bugnotes ) ) {
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
319 $g_cache_bugnotes = array();
320 }
321
8aa9edd @vboctor - Fixed #5844: The order of issue notes is random if submitted timest…
vboctor authored
322 # the cache should be aware of the sorting order
323 if ( !isset( $g_cache_bugnotes[$p_bug_id][$p_user_bugnote_order] ) ) {
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
324 $c_bug_id = db_prepare_int( $p_bug_id );
325 $t_bugnote_table = config_get( 'mantis_bugnote_table' );
43c61f9 formatting fixes continued
Kenzaburo Ito authored
326 $t_bugnote_text_table = config_get( 'mantis_bugnote_text_table' );
638dcd0 Fixed inconsistencies in line-endings
Jeroen Latour authored
327
3f72dc6 The bugnote limit was not read from the settings of the user the mail…
Jeroen Latour authored
328 if ( 0 == $p_user_bugnote_limit ) {
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
329 ## Show all bugnotes
330 $t_bugnote_limit = -1;
331 $t_bugnote_offset = -1;
332 } else {
333 ## Use offset only if order is ASC to get the last bugnotes
3f72dc6 The bugnote limit was not read from the settings of the user the mail…
Jeroen Latour authored
334 if ( 'ASC' == $p_user_bugnote_order ) {
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
335 $result = db_query( "SELECT COUNT(*) AS row_count FROM $t_bugnote_table WHERE bug_id = '$c_bug_id'" );
336 $row = db_fetch_array( $result );
638dcd0 Fixed inconsistencies in line-endings
Jeroen Latour authored
337
338 $t_bugnote_offset = $row['row_count'] - $p_user_bugnote_limit;
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
339 } else {
340 $t_bugnote_offset = -1;
341 }
638dcd0 Fixed inconsistencies in line-endings
Jeroen Latour authored
342
3f72dc6 The bugnote limit was not read from the settings of the user the mail…
Jeroen Latour authored
343 $t_bugnote_limit = $p_user_bugnote_limit;
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
344 }
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
345
8aa9edd @vboctor - Fixed #5844: The order of issue notes is random if submitted timest…
vboctor authored
346 # sort by bugnote id which should be more accurate than submit date, since two bugnotes
347 # may be submitted at the same time if submitted using a script (eg: MantisConnect).
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
348 $query = "SELECT b.*, t.note
008043e @thraxisp fix for 0005380: Invalid LEFT JOIN syntax for Oracle
thraxisp authored
349 FROM $t_bugnote_table b
350 LEFT JOIN $t_bugnote_text_table t ON b.bugnote_text_id = t.id
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
351 WHERE b.bug_id = '$c_bug_id'
8aa9edd @vboctor - Fixed #5844: The order of issue notes is random if submitted timest…
vboctor authored
352 ORDER BY b.id $p_user_bugnote_order";
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
353 $t_bugnotes = array();
354
355 # BUILD bugnotes array
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
356 $result = db_query( $query, $t_bugnote_limit, $t_bugnote_offset );
357 $count = db_num_rows( $result );
43c61f9 formatting fixes continued
Kenzaburo Ito authored
358 for ( $i=0; $i < $count; $i++ ) {
359 $row = db_fetch_array( $result );
360
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
361 $t_bugnote = new BugnoteData;
362
ab38ae3 @vboctor Fixed some limitations that were reported in a MantisConnect issue (s…
vboctor authored
363 $t_bugnote->id = $row['id'];
e024371 @vboctor The bug_id and the date_submitted were not set in BugnoteData class.
vboctor authored
364 $t_bugnote->bug_id = $row['bug_id'];
43c61f9 formatting fixes continued
Kenzaburo Ito authored
365 $t_bugnote->note = $row['note'];
366 $t_bugnote->view_state = $row['view_state'];
ab38ae3 @vboctor Fixed some limitations that were reported in a MantisConnect issue (s…
vboctor authored
367 $t_bugnote->reporter_id = $row['reporter_id'];
e024371 @vboctor The bug_id and the date_submitted were not set in BugnoteData class.
vboctor authored
368 $t_bugnote->date_submitted = db_unixtimestamp( $row['date_submitted'] );
43c61f9 formatting fixes continued
Kenzaburo Ito authored
369 $t_bugnote->last_modified = db_unixtimestamp( $row['last_modified'] );
ab38ae3 @vboctor Fixed some limitations that were reported in a MantisConnect issue (s…
vboctor authored
370 $t_bugnote->note_type = $row['note_type'];
371 $t_bugnote->note_attr = $row['note_attr'];
7f254a5 Fix for Bug #9208 introduced by fix for Bug #9184.
Daryn Warriner authored
372 $t_bugnote->time_tracking = $row['time_tracking'];
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
373
374 $t_bugnotes[] = $t_bugnote;
375 }
8aa9edd @vboctor - Fixed #5844: The order of issue notes is random if submitted timest…
vboctor authored
376 $g_cache_bugnotes[$p_bug_id][$p_user_bugnote_order] = $t_bugnotes;
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
377 }
378
8aa9edd @vboctor - Fixed #5844: The order of issue notes is random if submitted timest…
vboctor authored
379 return $g_cache_bugnotes[$p_bug_id][$p_user_bugnote_order];
0bc0c22 * Enh #0000: Generate one email per user. Stage #1 (no send mail opti…
yarick123 authored
380 }
381
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
382 #===================================
383 # Data Modification
384 #===================================
feed7c5 code formatting fixes
Kenzaburo Ito authored
385
a4ea10e bug_api cleanup
Julian Fitzell authored
386 # --------------------
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
387 # Update the time_tracking field of the bugnote
388 function bugnote_set_time_tracking( $p_bugnote_id, $p_time_tracking ) {
389 $c_bugnote_id = db_prepare_int( $p_bugnote_id );
8544d9c Convert time_tracking from TIME to INT (minutes).
davidnewcomb authored
390 $c_bugnote_time_tracking = db_prepare_time( $p_time_tracking );
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
391 $t_bugnote_table = config_get( 'mantis_bugnote_table' );
392
393 $query = "UPDATE $t_bugnote_table
394 SET time_tracking = '$c_bugnote_time_tracking'
395 WHERE id='$c_bugnote_id'";
396 db_query( $query );
397
398 # db_query() errors if there was a problem so:
399 return true;
400 }
401
402 # --------------------
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
403 # Update the last_modified field of the bugnote
404 function bugnote_date_update( $p_bugnote_id ) {
43c61f9 formatting fixes continued
Kenzaburo Ito authored
405 $c_bugnote_id = db_prepare_int( $p_bugnote_id );
406 $t_bugnote_table = config_get( 'mantis_bugnote_table' );
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
407
408 $query = "UPDATE $t_bugnote_table
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
409 SET last_modified=" . db_now() . "
410 WHERE id='$c_bugnote_id'";
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
411 db_query( $query );
412
413 # db_query() errors if there was a problem so:
414 return true;
415 }
416
417 # --------------------
418 # Set the bugnote text
419 function bugnote_set_text( $p_bugnote_id, $p_bugnote_text ) {
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
420 $c_bugnote_text = db_prepare_string( $p_bugnote_text );
421 $t_bug_id = bugnote_get_field( $p_bugnote_id, 'bug_id' );
422 $t_bugnote_text_id = bugnote_get_field( $p_bugnote_id, 'bugnote_text_id' );
43c61f9 formatting fixes continued
Kenzaburo Ito authored
423 $t_bugnote_text_table = config_get( 'mantis_bugnote_text_table' );
a4ea10e bug_api cleanup
Julian Fitzell authored
424
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
425 $query = "UPDATE $t_bugnote_text_table
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
426 SET note='$c_bugnote_text'
427 WHERE id='$t_bugnote_text_id'";
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
428 db_query( $query );
a4ea10e bug_api cleanup
Julian Fitzell authored
429
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
430 # updated the last_updated date
431 bugnote_date_update( $p_bugnote_id );
a4ea10e bug_api cleanup
Julian Fitzell authored
432
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
433 # log new bugnote
434 history_log_event_special( $t_bug_id, BUGNOTE_UPDATED, bugnote_format_id( $p_bugnote_id ) );
9f6ee3e Everyone seemed to prefer lower case API filenames and I had a few sp…
Julian Fitzell authored
435
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
436 return true;
437 }
438
439 # --------------------
440 # Set the view state of the bugnote
441 function bugnote_set_view_state( $p_bugnote_id, $p_private ) {
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
442 $c_bugnote_id = db_prepare_int( $p_bugnote_id );
443 $t_bug_id = bugnote_get_field( $p_bugnote_id, 'bug_id' );
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
444
445 if ( $p_private ) {
f68056c * (many files):
int2str authored
446 $t_view_state = VS_PRIVATE;
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
447 } else {
f68056c * (many files):
int2str authored
448 $t_view_state = VS_PUBLIC;
a4ea10e bug_api cleanup
Julian Fitzell authored
449 }
450
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
451 $t_bugnote_table = config_get( 'mantis_bugnote_table' );
452
453 # update view_state
454 $query = "UPDATE $t_bugnote_table
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
455 SET view_state='$t_view_state'
456 WHERE id='$c_bugnote_id'";
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
457 db_query( $query );
458
459 history_log_event_special( $t_bug_id, BUGNOTE_STATE_CHANGED, bugnote_format_id( $t_view_state ), $p_bugnote_id );
a4ea10e bug_api cleanup
Julian Fitzell authored
460
461 return true;
462 }
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
463
464
465 #===================================
466 # Other
467 #===================================
468
469 # --------------------
470 # Pad the bugnote id with the appropriate number of zeros for printing
19f6686 * config_defaults_inc.php
Julian Fitzell authored
471 function bugnote_format_id( $p_bugnote_id ) {
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
472 $t_padding = config_get( 'display_bugnote_padding' );
473
43c61f9 formatting fixes continued
Kenzaburo Ito authored
474 return str_pad( $p_bugnote_id, $t_padding, '0', STR_PAD_LEFT );
5b92ff5 cleanup all the bugnote pages (except bugnote_inc.php) and the bugnot…
Julian Fitzell authored
475 }
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
476
477
478 #===================================
479 # Bugnote Stats
480 #===================================
481
482 # --------------------
483 # Returns an array of bugnote stats
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
484 # $p_from - Starting date (yyyy-mm-dd) inclusive, if blank, then ignored.
485 # $p_to - Ending date (yyyy-mm-dd) inclusive, if blank, then ignored.
486 function bugnote_stats_get_events_array( $p_bug_id, $p_from, $p_to ) {
487 $c_bug_id = db_prepare_int( $p_bug_id );
488 $c_from = db_prepare_date( $p_from );
489 $c_to = db_prepare_date( $p_to );
490
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
491 $t_user_table = config_get( 'mantis_user_table' );
492 $t_bugnote_table = config_get( 'mantis_bugnote_table' );
493
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
494 if ( !is_blank( $c_from ) ) {
495 $t_from_where = " AND bn.date_submitted >= '$c_from 00:00:00'";
496 } else {
497 $t_from_where = '';
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
498 }
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
499
500 if ( !is_blank( $c_to ) ) {
501 $t_to_where = " AND bn.date_submitted <= '$c_to 23:59:59'";
502 } else {
503 $t_to_where = '';
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
504 }
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
505
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
506 $t_results = array();
507
a0ca06b @vboctor Fixed #9176: Port 0008699: Get Time Tracking Information return a SQL…
vboctor authored
508 $query = "SELECT username, SUM(time_tracking) AS sum_time_tracking
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
509 FROM $t_user_table u, $t_bugnote_table bn
510 WHERE u.id = bn.reporter_id AND
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
511 bn.bug_id = '$c_bug_id'
512 $t_from_where $t_to_where
9b6add9 @grangeway Fix: 0007912: Time tracking doesn't work- SQL syntax error
grangeway authored
513 GROUP BY u.id, u.username";
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
514
515 $result = db_query( $query );
516
517 while ( $row = db_fetch_array( $result ) ) {
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
518 $t_results[] = $row;
519 }
520
521 return $t_results;
522 }
523
524 # --------------------
525 # Returns an array of bugnote stats
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
526 # $p_from - Starting date (yyyy-mm-dd) inclusive, if blank, then ignored.
527 # $p_to - Ending date (yyyy-mm-dd) inclusive, if blank, then ignored.
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
528 function bugnote_stats_get_project_array( $p_project_id, $p_from, $p_to, $p_cost ) {
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
529 $c_project_id = db_prepare_int( $p_project_id );
530 $c_to = db_prepare_date( $p_to );
531 $c_from = db_prepare_date( $p_from );
532 $c_cost = db_prepare_double( $p_cost );
533
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
534 // MySQL
0205931 Make billing_page.php print bug number as a link.
davidnewcomb authored
535 $t_bug_table = config_get( 'mantis_bug_table' );
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
536 $t_user_table = config_get( 'mantis_user_table' );
537 $t_bugnote_table = config_get( 'mantis_bugnote_table' );
538
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
539 if ( !is_blank( $c_from ) ) {
540 $t_from_where = " AND bn.date_submitted >= '$c_from 00:00:00'";
541 } else {
542 $t_from_where = '';
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
543 }
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
544
545 if ( !is_blank( $c_to ) ) {
546 $t_to_where = " AND bn.date_submitted <= '$c_to 23:59:59'";
547 } else {
548 $t_to_where = '';
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
549 }
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
550
551 if ( ALL_PROJECTS != $c_project_id ) {
552 $t_project_where = " AND b.project_id = '$c_project_id' AND bn.bug_id = b.id ";
553 } else {
554 $t_project_where = '';
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
555 }
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
556
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
557 $t_results = array();
558
a0ca06b @vboctor Fixed #9176: Port 0008699: Get Time Tracking Information return a SQL…
vboctor authored
559 $query = "SELECT username, summary, bn.bug_id, SUM(time_tracking) AS sum_time_tracking
0205931 Make billing_page.php print bug number as a link.
davidnewcomb authored
560 FROM $t_user_table u, $t_bugnote_table bn, $t_bug_table b
561 WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND bn.bug_id = b.id
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
562 $t_project_where $t_from_where $t_to_where
9b6add9 @grangeway Fix: 0007912: Time tracking doesn't work- SQL syntax error
grangeway authored
563 GROUP BY bn.bug_id, u.id, u.username, b.summary
564 ORDER BY bn.bug_id";
565
e74537d @vboctor 1. Fixed a bug in db_prepare_date()
vboctor authored
566 $result = db_query( $query );
567
568 $t_cost_min = $c_cost / 60;
569
570 while ( $row = db_fetch_array( $result ) ) {
571 $t_total_cost = $t_cost_min * $row['sum_time_tracking'];
572 $row['cost'] = $t_total_cost;
fe2bc7b Add time tracking functionality see bug 4428
davidnewcomb authored
573 $t_results[] = $row;
574 }
575
576 return $t_results;
577 }
3973d02 0004043: [email] Preference to exclude old bugnotes from notification…
Jeroen Latour authored
578 ?>
Something went wrong with that request. Please try again.