Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
[mantis/radio.git] / bug_actiongroup_update_product_build_inc.php
blob327b23ad30b46eb6ea6ce23ddec6bcce0461abd3
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
30 require_api( 'access_api.php' );
31 require_api( 'bug_api.php' );
32 require_api( 'config_api.php' );
33 require_api( 'gpc_api.php' );
34 require_api( 'lang_api.php' );
36 /**
37 * Prints the title for the custom action page.
39 function action_update_product_build_print_title() {
40 echo '<tr class="form-title">';
41 echo '<td colspan="2">';
42 echo lang_get( 'product_build' );
43 echo '</td></tr>';
46 /**
47 * Prints the field within the custom action form. This has an entry for
48 * every field the user need to supply + the submit button. The fields are
49 * added as rows in a table that is already created by the calling code.
50 * A row has two columns.
52 function action_update_product_build_print_fields() {
53 echo '<tr class="row-1" valign="top"><td class="category">', lang_get( 'product_build' ), '</td><td><input type="text" name="build" size="32" maxlength="32" /></td></tr>';
54 echo '<tr><td colspan="2"><center><input type="submit" class="button" value="' . lang_get( 'actiongroup_menu_update_product_build' ) . ' " /></center></td></tr>';
57 /**
58 * Validates the action on the specified bug id.
60 * @param $p_bug_id Bug ID
61 * @return true|array Action can be applied., bug_id => reason for failure
63 function action_update_product_build_validate( $p_bug_id ) {
64 $t_bug_id = (int)$p_bug_id;
66 if ( bug_is_readonly( $t_bug_id ) ) {
67 $t_failed_validation_ids = array();
68 $t_failed_validation_ids[$t_bug_id] = lang_get( 'actiongroup_error_issue_is_readonly' );
69 return $t_failed_validation_ids;
72 if ( !access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) {
73 $t_failed_validation_ids = array();
74 $t_failed_validation_ids[$t_bug_id] = lang_get( 'access_denied' );
75 return $t_failed_validation_ids;
78 return true;
81 /**
82 * Executes the custom action on the specified bug id.
84 * @param $p_bug_id The bug id to execute the custom action on.
85 * @returns true|array Action executed successfully., ( bug_id => reason for failure )
87 function action_update_product_build_process( $p_bug_id ) {
88 $f_build = gpc_get_string( 'build' );
89 $t_build = trim( $f_build );
91 bug_set_field( $p_bug_id, 'build', $t_build );
92 return true;