Skip to content
Newer
Older
100644 88 lines (77 sloc) 2.9 KB
816cefd @vboctor Fixes #6792: Option to update the severity of selected bugs.
vboctor authored Nov 1, 2009
1 <?php
2 # MantisBT - a php based bugtracking system
3
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
16
17 /**
18 * @package MantisBT
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
c757c81 @dregad Update copyright year to 2012
dregad authored Jan 1, 2012
20 * @copyright Copyright (C) 2002 - 2012 MantisBT Team - mantisbt-dev@lists.sourceforge.net
816cefd @vboctor Fixes #6792: Option to update the severity of selected bugs.
vboctor authored Nov 1, 2009
21 * @link http://www.mantisbt.org
22 */
23
24 /**
25 * Prints the title for the custom action page.
26 */
27 function action_update_severity_print_title() {
28 echo '<tr class="form-title">';
29 echo '<td colspan="2">';
30 echo lang_get( 'update_severity_title' );
31 echo '</td></tr>';
32 }
33
34 /**
35 * Prints the field within the custom action form. This has an entry for
36 * every field the user need to supply + the submit button. The fields are
37 * added as rows in a table that is already created by the calling code.
38 * A row has two columns.
39 */
40 function action_update_severity_print_fields() {
41 echo '<tr class="row-1" valign="top"><td class="category">';
42 echo lang_get( 'update_severity_msg' );
43 echo '</td><td><select name="severity">';
44 print_enum_string_option_list( 'severity' );
45 echo '</select></td></tr>';
46 echo '<tr><td colspan="2"><center><input type="submit" class="button" value="' . lang_get( 'update_severity_button' ) . ' " /></center></td></tr>';
47 }
48
49 /**
50 * Validates the action on the specified bug id.
51 *
52 * @returns true Action can be applied.
53 * @returns array( bug_id => reason for failure )
54 */
55 function action_update_severity_validate( $p_bug_id ) {
56 $f_severity = gpc_get_string( 'severity' );
57
58 $t_failed_validation_ids = array();
59
60 $t_update_severity_threshold = config_get( 'update_bug_threshold' );
61 $t_bug_id = $p_bug_id;
62
63 if ( bug_is_readonly( $t_bug_id ) ) {
64 $t_failed_validation_ids[$t_bug_id] = lang_get( 'actiongroup_error_issue_is_readonly' );
65 return $t_failed_validation_ids;
66 }
67
68 if ( !access_has_bug_level( $t_update_severity_threshold, $t_bug_id ) ) {
69 $t_failed_validation_ids[$t_bug_id] = lang_get( 'access_denied' );
70 return $t_failed_validation_ids;
71 }
72
73 return true;
74 }
75
76 /**
77 * Executes the custom action on the specified bug id.
78 *
79 * @param $p_bug_id The bug id to execute the custom action on.
80 *
81 * @returns true Action executed successfully.
82 * @returns array( bug_id => reason for failure )
83 */
84 function action_update_severity_process( $p_bug_id ) {
85 $f_severity = gpc_get_string( 'severity' );
86 bug_set_field( $p_bug_id, 'severity', $f_severity );
87 return true;
88 }
Something went wrong with that request. Please try again.