@@ -25,7 +25,7 @@ function register() {
25
25
$ this ->description = 'Time tracking plugin that supports entering date worked, time and notes. Also includes limited permissions per user. ' ;
26
26
$ this ->page = 'config_page ' ;
27
27
28
- $ this ->version = '1.0.3 ' ;
28
+ $ this ->version = '1.0.4 ' ;
29
29
$ this ->requires = array (
30
30
'MantisCore ' => '1.2.0 '
31
31
);
@@ -45,9 +45,8 @@ function hooks() {
45
45
46
46
function config () {
47
47
return array (
48
- 'view_threshold ' => DEVELOPER ,
49
- 'delete_threshold ' => DEVELOPER ,
50
- 'add_threshold ' => DEVELOPER ,
48
+ 'admin_own_threshold ' => DEVELOPER ,
49
+ 'view_others_threshold ' => MANAGER ,
51
50
'admin_threshold ' => ADMINISTRATOR
52
51
);
53
52
}
@@ -65,18 +64,25 @@ function init() {
65
64
*/
66
65
function view_bug_time ( $ p_event , $ p_bug_id ) {
67
66
$ table = plugin_table ('data ' );
67
+ $ t_user_id = auth_get_current_user_id ();
68
68
69
69
# Pull all Time-Record entries for the current Bug
70
+ if (access_has_bug_level ( plugin_config_get ( 'view_others_threshold ' ), $ p_bug_id ) ) {
70
71
$ query_pull_timerecords = "SELECT * FROM $ table WHERE bug_id = $ p_bug_id ORDER BY timestamp DESC " ;
71
- $ result_pull_timerecords = db_query ($ query_pull_timerecords );
72
- $ num_timerecords = db_num_rows ( $ result_pull_timerecords );
72
+
73
+ } else if (access_has_bug_level ( plugin_config_get ( 'admin_own_threshold ' ), $ p_bug_id ) ) {
74
+ $ query_pull_timerecords = "SELECT * FROM $ table WHERE bug_id = $ p_bug_id and user = $ t_user_id ORDER BY timestamp DESC " ;
75
+ }
76
+ $ result_pull_timerecords = db_query ($ query_pull_timerecords );
77
+ $ num_timerecords = db_num_rows ( $ result_pull_timerecords );
73
78
74
79
# Get Sum for this bug
75
80
$ query_pull_hours = "SELECT SUM(hours) as hours FROM $ table WHERE bug_id = $ p_bug_id " ;
76
81
$ result_pull_hours = db_query ( $ query_pull_hours );
77
82
$ row_pull_hours = db_fetch_array ( $ result_pull_hours );
78
83
79
- if (access_has_bug_level ( plugin_config_get ( 'view_threshold ' ), $ p_bug_id )) {
84
+ if ( (access_has_bug_level ( plugin_config_get ( 'admin_own_threshold ' ), $ p_bug_id ) )
85
+ || (access_has_bug_level ( plugin_config_get ( 'view_others_threshold ' ), $ p_bug_id ) ) ) {
80
86
?>
81
87
82
88
@@ -104,7 +110,7 @@ function view_bug_time( $p_event, $p_bug_id ) {
104
110
105
111
106
112
<?php
107
- if ( access_has_bug_level ( plugin_config_get ( 'add_threshold ' ), $ p_bug_id ) ) {
113
+ if ( access_has_bug_level ( plugin_config_get ( 'admin_own_threshold ' ), $ p_bug_id ) ) {
108
114
$ current_date = explode ("- " , date ("Y-m-d " ));
109
115
?>
110
116
@@ -147,7 +153,8 @@ function view_bug_time( $p_event, $p_bug_id ) {
147
153
148
154
<?php
149
155
$ user = auth_get_current_user_id ();
150
- if ($ user == $ row ["user " ] && access_has_bug_level ( plugin_config_get ( 'delete_threshold ' ), $ p_bug_id )) {
156
+ if ( ($ user == $ row ["user " ] && access_has_bug_level ( plugin_config_get ( 'admin_own_threshold ' ), $ p_bug_id ) )
157
+ || access_has_bug_level ( plugin_config_get ( 'admin_threshold ' ), $ p_bug_id ) ) {
151
158
?>
152
159
153
160
@@ -216,7 +223,8 @@ function schema() {
216
223
217
224
function timerecord_menu () {
218
225
$ bugid = gpc_get_int ( 'id ' );
219
- if ( access_has_bug_level ( plugin_config_get ( 'view_threshold ' ), $ bugid ) ){
226
+ if ( access_has_bug_level ( plugin_config_get ( 'admin_own_threshold ' ), $ bugid )
227
+ || access_has_bug_level ( plugin_config_get ( 'view_others_threshold ' ), $ bugid ) ){
220
228
$ import_page ='view.php? ' ;
221
229
$ import_page .='id= ' ;
222
230
$ import_page .= $ bugid ;
@@ -230,7 +238,7 @@ function timerecord_menu() {
230
238
}
231
239
232
240
function showreport_menu () {
233
- if ( access_has_global_level ( plugin_config_get ( 'view_threshold ' ) ) ){
241
+ if ( access_has_global_level ( plugin_config_get ( 'admin_own_threshold ' ) ) ){
234
242
return array ( '<a href=" ' . plugin_page ( 'show_report ' ) . '"> ' . plugin_lang_get ( 'title ' ) . '</a> ' , );
235
243
}
236
244
else {
0 commit comments