From: Victor B. <vb...@us...> - 2004-07-16 23:03:20
|
Update of /cvsroot/mantisbt/mantisbt/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22548/core Modified Files: bug_api.php csv_api.php relationship_api.php Log Message: Issue Relationships: - Hidding/Showing Duplicate Id on the view, update, print, csv, word.depending on enable_relationship flag. - Added a missing string to strings_english.txt / italian which is used in email notifications. Index: csv_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/csv_api.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- csv_api.php 24 May 2004 12:23:18 -0000 1.3 +++ csv_api.php 16 Jul 2004 23:03:09 -0000 1.4 @@ -74,8 +74,12 @@ 'summary' => 'summary', 'status' => 'status', 'resolution' => 'resolution', - 'duplicate_id' => 'duplicate_id', 'fixed_in_version' => 'fixed_in_version' ); + + if ( OFF == config_get( 'enable_relationship' ) ) { + $t_columns['duplicate_id'] = 'duplicate_id'; + } # MASC RELATIONSHIP + return $t_columns; } @@ -217,4 +221,4 @@ function csv_format_duplicate_id( $p_duplicate_id ) { return bug_format_id( $p_duplicate_id ); } -?> \ No newline at end of file +?> Index: relationship_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/relationship_api.php,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- relationship_api.php 12 Jul 2004 04:37:43 -0000 1.10 +++ relationship_api.php 16 Jul 2004 23:03:09 -0000 1.11 @@ -346,6 +346,13 @@ $p_user_id = auth_get_current_user_id(); } + if ( $p_html_preview == false ) { + $t_td = '<td>'; + } + else { + $t_td = '<td class="print">'; + } + if ( $p_bug_id == $p_relationship->src_bug_id ) { # root bug is in the src side, related bug in the dest side $t_related_bug_id = $p_relationship->dest_bug_id; @@ -368,12 +375,12 @@ $t_relationship_info_html = $t_relationship_descr . '</td>'; if ( $p_html_preview == false ) { - $t_relationship_info_html .= '<td><a href="' . string_get_bug_view_url( $t_related_bug_id ) . '">' . bug_format_id( $t_related_bug_id ) . '</a></td>'; - $t_relationship_info_html .= '<td bgcolor="' . get_status_color( $t_bug->status ) . '">' . $t_status . ' </td><td>'; + $t_relationship_info_html .= '<td><a href="' . string_get_bug_view_url( $t_related_bug_id ) . '">' . bug_format_id( $t_related_bug_id ) . '</a>' . $t_td; + $t_relationship_info_html .= '<td bgcolor="' . get_status_color( $t_bug->status ) . '">' . $t_status . ' </td>' . $t_td; } else { - $t_relationship_info_html .= '<td>' . bug_format_id( $t_related_bug_id ) . '</td>'; - $t_relationship_info_html .= '<td>' . $t_status . ' </td><td>'; + $t_relationship_info_html .= $t_td . bug_format_id( $t_related_bug_id ) . '</td>'; + $t_relationship_info_html .= $t_td . $t_status . ' </td>' . $t_td; } $t_relationship_info_text = str_pad( $t_relationship_descr,25); @@ -382,21 +389,21 @@ # get the handler name of the related bug if ( $t_bug->handler_id > 0 ) { - $t_relationship_info_html .= string_attribute( user_get_name( $t_bug->handler_id ) ); + $t_relationship_info_html .= '<nobr>' . string_attribute( user_get_name( $t_bug->handler_id ) ) . '<nobr>'; } # add summary - $t_relationship_info_html .= ' </td><td><i>' . string_attribute( $t_bug->summary ) . '</i>'; + $t_relationship_info_html .= ' </td>' . $t_td . string_attribute( $t_bug->summary ); } else { # no viewer access to the related bug - $t_relationship_info_html = bug_format_id( $t_related_bug_id ) . '</td><td> </td><td> </td><td>'; + $t_relationship_info_html = bug_format_id( $t_related_bug_id ) . '</td>' . $t_td . ' </td>' . $t_td . ' </td>' . $t_td; $t_relationship_info_text = str_pad( bug_format_id( $t_related_bug_id ),8 ); } } else { # related bug not found... - $t_relationship_info_html = bug_format_id( $t_related_bug_id ) . '</td><td> </td><td> </td><td>'; + $t_relationship_info_html = bug_format_id( $t_related_bug_id ) . '</td>' . $t_td . ' </td>' . $t_td . ' </td>' . $t_td; $t_relationship_info_text = str_pad( bug_format_id( $t_related_bug_id ),8 ); } @@ -410,10 +417,10 @@ $t_relationship_info_text .= "\n"; if ( $p_html_preview == false ) { - $t_relationship_info_html = '<tr class="row-2"><td>' . $t_relationship_info_html . ' </td></tr>'; + $t_relationship_info_html = '<tr class="row-2">' . $t_td . $t_relationship_info_html . ' </td></tr>'; } else { - $t_relationship_info_html = '<tr class="print"><td>' . $t_relationship_info_html . ' </td></tr>'; + $t_relationship_info_html = '<tr>' . $t_td . $t_relationship_info_html . ' </td></tr>'; } if ( $p_html == true ) { @@ -446,7 +453,9 @@ $t_summary .= '<tr class="row-2"><td colspan=5><b>' . lang_get( 'relationship_warning_blocking_bugs_not_resolved' ) . '</b></td></tr>'; } - $t_summary = '<table class="width100">' . $t_summary . '</table>'; + if ( $t_summary != '' ) { + $t_summary = '<table class="width100">' . $t_summary . '</table>'; + } return $t_summary; } @@ -469,10 +478,12 @@ } if ( relationship_can_resolve_bug( $p_bug_id ) == false ) { - $t_summary .= '<tr class="print"><td colspan=5><b>' . lang_get( 'relationship_warning_blocking_bugs_not_resolved' ) . '</b></td></tr>'; + $t_summary .= '<tr class="print"><td class="print" colspan=5><b>' . lang_get( 'relationship_warning_blocking_bugs_not_resolved' ) . '</b></td></tr>'; } - $t_summary = '<table cellspacing=0 cellpadding=1 border=0>' . $t_summary . '</table>'; + if ( !is_blank( $t_summary ) ) { + $t_summary = '<table class="width100">' . $t_summary . '</table>'; + } return $t_summary; } Index: bug_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/bug_api.php,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -r1.69 -r1.70 --- bug_api.php 13 Jul 2004 12:16:10 -0000 1.69 +++ bug_api.php 16 Jul 2004 23:03:09 -0000 1.70 @@ -286,7 +286,7 @@ return false; } - + #=================================== # Creation / Deletion / Updating #=================================== @@ -655,11 +655,8 @@ sponsorship_delete( sponsorship_get_all_ids( $p_bug_id ) ); # MASC RELATIONSHIP - # @@@ VB: Once the database is upgraded and the feature is tested, - # we should probably delete relationships even if the feature is currently off. - if ( ON == config_get( 'enable_relationship' ) ) { - relationship_delete_all( $p_bug_id ); - } + # we delete relationships even if the feature is currently off. + relationship_delete_all( $p_bug_id ); # MASC RELATIONSHIP # Delete files @@ -972,7 +969,7 @@ # -------------------- # return the timestamp for the most recent time at which a bugnote - # associated wiht the bug was modified and the total bugnote + # associated with the bug was modified and the total bugnote # count in one db query function bug_get_bugnote_stats( $p_bug_id ) { $c_bug_id = db_prepare_int( $p_bug_id ); @@ -1111,14 +1108,39 @@ function bug_resolve( $p_bug_id, $p_resolution, $p_fixed_in_version = '', $p_bugnote_text = '', $p_duplicate_id = null, $p_handler_id = null ) { $p_bugnote_text = trim( $p_bugnote_text ); - bug_set_field( $p_bug_id, 'status', config_get( 'bug_resolved_status_threshold' ) ); - bug_set_field( $p_bug_id, 'fixed_in_version', $p_fixed_in_version ); - bug_set_field( $p_bug_id, 'resolution', (int)$p_resolution ); - if ( null !== $p_duplicate_id ) { + # MASC RELATIONSHIP + + # the related bug exists... + bug_ensure_exists( $p_duplicate_id ); + + # @@@ Would be nice if we don't generate an error if the relationship + # @@@ is the same as the one we are trying to add. + # there is no other relationship between the same bugs... + if ( relationship_exists( $p_bug_id, $p_duplicate_id ) ) { + trigger_error( ERROR_RELATIONSHIP_ALREADY_EXISTS, ERROR ); + } + + # user can access to the related bug at least as viewer... + if ( !access_has_bug_level( VIEWER, $p_duplicate_id ) ) { + error_parameters( $p_duplicate_id ); + trigger_error( ERROR_RELATIONSHIP_ACCESS_LEVEL_TO_DEST_BUG_TOO_LOW, ERROR ); + } + bug_set_field( $p_bug_id, 'duplicate_id', (int)$p_duplicate_id ); + if ( ON == config_get( 'enable_relationship' ) ) { + # Relationship feature active + relationship_add( $p_bug_id, $p_duplicate_id, BUG_DUPLICATE ); + history_log_event_special( $p_bug_id, BUG_ADD_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id ); + history_log_event_special( $p_duplicate_id, BUG_ADD_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id ); + } + # MASC RELATIONSHIP } + bug_set_field( $p_bug_id, 'status', config_get( 'bug_resolved_status_threshold' ) ); + bug_set_field( $p_bug_id, 'fixed_in_version', $p_fixed_in_version ); + bug_set_field( $p_bug_id, 'resolution', (int)$p_resolution ); + # only set handler if specified explicitly or if bug was not assigned to a handler if ( null == $p_handler_id ) { if ( bug_get_field( $p_bug_id, 'handler_id' ) == 0 ) { |