본문 바로가기

Engineering/__01. Issue Tracking

[Mantis] 여러 이슈를 한번에 버전 변경하기 (print_all_bug_action_option_list() 에 product version 추가하기)



이슈보기 화면 하단에 여러 이슈를 다중 선택하고 한번에 이동한다던지 상태를 변경한다던 일괄 작업을 할 수 있다.

그런데 해결버전이나 타켓버전은 있지만 유독 제품 버전은 찾아볼 수 없었다.

비슷하게 Update Product Build 가 있는데 이것은 제품 버전이 아니라 빌드 번호 변경이었다.

하여, 제품버전 (위 이미지의 Update Product Version)을 추가해 보았다.

1. view_all_inc.php 파일 에 다음 부분이 action 이다.

        # -- ====================== MASS BUG MANIPULATION =================== --

?>

        <tr>

                <td class="left" colspan="<?php echo $col_count; ?>">

                        <span class="floatleft">

<?php

                if ( $t_checkboxes_exist && ON == config_get( 'use_javascript' ) ) {

                        echo "<input type=\"checkbox\" name=\"all_bugs\" value=\"all\" onclick=\"checkall('bug_action', this.form.al

l_bugs.checked)\" /><span class=\"small\">" . lang_get( 'select_all' ) . '</span>';

                }


                if ( $t_checkboxes_exist ) {

?>

                        <select name="action">

                                <?php print_all_bug_action_option_list() ?>

                        </select>

                        <input type="submit" class="button" value="<?php echo lang_get( 'ok' ); ?>" />

<?php

                } else {

                        echo '&nbsp;';

                }

?>                      </span>

                        <span class="floatright small">

                                <?php

                                        $f_filter       = gpc_get_int( 'filter', 0);

                                        print_page_links( 'view_all_bug_page.php', 1, $t_page_count, (int)$f_page_number, $f_filter

);

                                ?>

                        </span>

                </td>

        </tr>


2. bug_actiongroup.php 파일에 다음을 추가한다.

                case 'UP_VERSION':

                        $f_version = gpc_get_string( 'version' );

                        $t_project_id = bug_get_field( $t_bug_id, 'project_id' );

                        $t_success = false;


                        if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) {

                                if ( version_get_id( $f_version, $t_project_id ) !== false ) {

                                        /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t

_bug_id, $t_bug_data, $f_bugnote_text ) ); */

                                        bug_set_field( $t_bug_id, 'version', $f_version );

                                        helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );

                                        $t_success = true;

                                }

                        }


                        if ( !$t_success ) {

                                $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );

                        }

                        break;


3. strings_english.txt 등의 string 파일에 표시할 정보를 추가한다.

$s_actiongroup_menu_update_product_version = 'Update Product Version';

$s_product_version_group_bugs_button = 'Update Product Version';

$s_product_version_bugs_conf_msg = 'Update Product Version to';

$s_product_version = 'Product Version';


4. core/print_api.php 에 다음을 추가한다.

        if( ALL_PROJECTS != $t_project_id ) {

                $t_user_id = auth_get_current_user_id();


                if( access_has_project_level( config_get( 'update_bug_threshold' ), $t_project_id ) ) {

                        $commands['UP_FIXED_IN_VERSION'] = lang_get( 'actiongroup_menu_update_fixed_in_version' );

                }


                if( access_has_project_level( config_get( 'roadmap_update_threshold' ), $t_project_id ) ) {

                        $commands['UP_TARGET_VERSION'] = lang_get( 'actiongroup_menu_update_target_version' );

                }


                if( access_has_project_level( config_get( 'update_bug_threshold' ), $t_project_id ) ) {

                        $commands['UP_VERSION'] = lang_get( 'actiongroup_menu_update_product_version' );

                }


그러면 위 처음 이미지와 같이 Update Product Version 이 나타나고 동작한다.