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/>.
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
20 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net
21 * @link http://www.mantisbt.org
23 * @uses access_api.php
25 * @uses config_api.php
30 if ( !defined( 'BUG_ACTIONGROUP_UPDATE_PRODUCT_BUILD_INC_ALLOW' ) ) {
34 require_api( 'access_api.php' );
35 require_api( 'bug_api.php' );
36 require_api( 'config_api.php' );
37 require_api( 'gpc_api.php' );
38 require_api( 'lang_api.php' );
41 * Prints the title for the custom action page.
43 function action_update_product_build_print_title() {
44 echo '<tr class="form-title">';
45 echo '<td colspan="2">';
46 echo lang_get( 'product_build' );
51 * Prints the field within the custom action form. This has an entry for
52 * every field the user need to supply + the submit button. The fields are
53 * added as rows in a table that is already created by the calling code.
54 * A row has two columns.
56 function action_update_product_build_print_fields() {
57 echo '<tr class="row-1"><th class="category">', lang_get( 'product_build' ), '</th><td><input type="text" name="build" size="32" maxlength="32" /></td></tr>';
58 echo '<tr><td colspan="2" class="center"><input type="submit" class="button" value="' . lang_get( 'actiongroup_menu_update_product_build' ) . ' " /></td></tr>';
62 * Validates the action on the specified bug id.
64 * @param $p_bug_id Bug ID
65 * @return string|null On failure: the reason why the action could not be validated. On success: null.
67 function action_update_product_build_validate( $p_bug_id ) {
68 $t_bug_id = (int)$p_bug_id;
70 if ( bug_is_readonly( $t_bug_id ) ) {
71 return lang_get( 'actiongroup_error_issue_is_readonly' );
74 if ( !access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) {
75 return lang_get( 'access_denied' );
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 * @return null Previous validation ensures that this function doesn't fail. Therefore we can always return null to indicate no errors occurred.
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 );