Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
[mantis/radio.git] / bug_actiongroup_update_severity_inc.php
blob2c20157c28b2585692553bc95ca6b58ba1e240b3
1 <?php
2 # MantisBT - A PHP based bugtracking system
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.
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.
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/>.
17 /**
18 * @package MantisBT
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
20 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
21 * @link http://www.mantisbt.org
23 * @uses access_api.php
24 * @uses bug_api.php
25 * @uses config_api.php
26 * @uses gpc_api.php
27 * @uses lang_api.php
28 * @uses print_api.php
31 require_api( 'access_api.php' );
32 require_api( 'bug_api.php' );
33 require_api( 'config_api.php' );
34 require_api( 'gpc_api.php' );
35 require_api( 'lang_api.php' );
36 require_api( 'print_api.php' );
38 /**
39 * Prints the title for the custom action page.
41 function action_update_severity_print_title() {
42 echo '<tr class="form-title">';
43 echo '<td colspan="2">';
44 echo lang_get( 'update_severity_title' );
45 echo '</td></tr>';
48 /**
49 * Prints the field within the custom action form. This has an entry for
50 * every field the user need to supply + the submit button. The fields are
51 * added as rows in a table that is already created by the calling code.
52 * A row has two columns.
54 function action_update_severity_print_fields() {
55 echo '<tr class="row-1" valign="top"><td class="category">';
56 echo lang_get( 'update_severity_msg' );
57 echo '</td><td><select name="severity">';
58 print_enum_string_option_list( 'severity' );
59 echo '</select></td></tr>';
60 echo '<tr><td colspan="2"><center><input type="submit" class="button" value="' . lang_get( 'update_severity_button' ) . ' " /></center></td></tr>';
63 /**
64 * Validates the action on the specified bug id.
66 * @returns true Action can be applied.
67 * @returns array( bug_id => reason for failure )
69 function action_update_severity_validate( $p_bug_id ) {
70 $f_severity = gpc_get_string( 'severity' );
72 $t_failed_validation_ids = array();
74 $t_update_severity_threshold = config_get( 'update_bug_threshold' );
75 $t_bug_id = $p_bug_id;
77 if ( bug_is_readonly( $t_bug_id ) ) {
78 $t_failed_validation_ids[$t_bug_id] = lang_get( 'actiongroup_error_issue_is_readonly' );
79 return $t_failed_validation_ids;
82 if ( !access_has_bug_level( $t_update_severity_threshold, $t_bug_id ) ) {
83 $t_failed_validation_ids[$t_bug_id] = lang_get( 'access_denied' );
84 return $t_failed_validation_ids;
87 return true;
90 /**
91 * Executes the custom action on the specified bug id.
93 * @param $p_bug_id The bug id to execute the custom action on.
95 * @returns true Action executed successfully.
96 * @returns array( bug_id => reason for failure )
98 function action_update_severity_process( $p_bug_id ) {
99 $f_severity = gpc_get_string( 'severity' );
100 bug_set_field( $p_bug_id, 'severity', $f_severity );
101 return true;