puissanceX
Messages postés
2
Date d'inscription
mardi 11 décembre 2007
Statut
Membre
Dernière intervention
15 mai 2008
15 mai 2008 à 20:10
Bonjour,
Voici le script en question qui construit les lignes du tabeau du fichier excel d'export:
<?php
$field_name_count = $field_name_count;
$f_bug_arr = explode_enum_string( $f_export );
for( $i=0; $i < $row_count; $i++ ) {
if ( isset( $f_bug_arr[$i] ) ) {
$index = $f_bug_arr[$i];
$t_bug_arr_sort[$index]=1;
}
}
for( $i=0; $i < $row_count; $i++ ) {
# prefix bug data with v_
extract( $result[$i], EXTR_PREFIX_ALL, 'v' );
$v_os = string_display( $v_os );
$v_os_build = string_display( $v_os_build );
$v_platform = string_display( $v_platform );
$v_version = string_display( $v_version );
$v_id_version = string_display( $v_id_version );
$v_fixed_version = string_display( $v_id_fixed_version );
$v_summary = string_display_links( $v_summary );
$v_summary = stripslashes(strtr($v_summary, $sgml_carte));
if(($f_typeRequest 10 )&& ($v_is_bug 10)) {
$t_last_updated = date( $g_short_date_format, $v_last_updated );
# grab the bugnote count
$bugnote_count = bug_get_bugnote_count( $v_id );
$t_stage_name = stage_get_field( $v_stage_id, 'name' );
$project_id= stage_get_field( $v_stage_id, 'project_id' );
$t_project_name = project_get_field( $project_id, 'name' );
$query4 = "SELECT *
FROM $g_mantis_bug_text_table
WHERE id='$v_bug_text_id'";
$result4 = db_query( $query4 );
$row = db_fetch_array( $result4 );
extract( $row, EXTR_PREFIX_ALL, 'v2' );
$v_os = string_display( $v_os );
$v_os_build = string_display( $v_os_build );
$v_platform = string_display( $v_platform );
$v_version = string_display( $v_version );
$v_id_version = string_display( $v_id_version );
$v_fixed_version = string_display( $v_id_fixed_version );
$v_summary = string_display_links( $v_summary );
$v_summary = stripslashes(strtr($v_summary, $sgml_carte));
//Ajout de html_entity_decode pour bien afficher les caractères HTML dans dans la colonne Résumé
$v_summary = html_entity_decode($v_summary);
# line feeds are desactivated in case of excel export, to avoid multiple lines
//Ajout de la fonction htmlentities
$v2_description = htmlentities($v2_description);
if ( $f_type_page != 'html' ) {
$v2_description = stripslashes( str_replace( '\n',' ',htmlentities($v2_description)));
$v2_description = stripslashes(strtr(html_entity_decode($v2_description), $sgml_carte));
$v2_steps_to_reproduce = stripslashes( str_replace( '\n',' ',htmlentities($v2_steps_to_reproduce) ) );
$v2_additional_information = stripslashes( str_replace( '\n',' ',htmlentities($v2_additional_information) ));
$v2_additional_information = stripslashes(strtr(html_entity_decode($v2_additional_information), $sgml_carte));
//suppression des
et
et .
$v2_description = str_replace("
"," ",$v2_description);
$v2_description = str_replace("
"," ",$v2_description);
$v2_description = str_replace(""," ",$v2_description);
$v2_description = str_replace("
"," ",$v2_description);
$v2_description = str_replace("
"," ",$v2_description);
$v2_description = str_replace(""," ",$v2_description);
$v2_steps_to_reproduce = str_replace("
"," ",$v2_steps_to_reproduce);
$v2_steps_to_reproduce = str_replace("
"," ",$v2_steps_to_reproduce);
$v2_steps_to_reproduce = str_replace(""," ",$v2_steps_to_reproduce);
$v2_steps_to_reproduce = str_replace("
"," ",$v2_steps_to_reproduce);
$v2_steps_to_reproduce = str_replace("
"," ",$v2_steps_to_reproduce);
$v2_steps_to_reproduce = str_replace(""," ",$v2_steps_to_reproduce);
$v2_additional_information = str_replace("
"," ",$v2_additional_information);
$v2_additional_information = str_replace("
"," ",$v2_additional_information);
$v2_additional_information = str_replace(""," ",$v2_additional_information);
$v2_additional_information = str_replace("
"," ",$v2_additional_information);
$v2_additional_information = str_replace("
"," ",$v2_additional_information);
$v2_additional_information = str_replace(""," ",$v2_additional_information);
}
else {
$v2_description = string_display_links( $v2_description );
$v2_description = stripslashes(strtr(html_entity_decode($v2_description), $sgml_carte));
$v2_steps_to_reproduce = string_display_links( $v2_steps_to_reproduce );
$v2_additional_information = string_display_links( $v2_additional_information );
$v2_additional_information = stripslashes(strtr(html_entity_decode($v2_additional_information), $sgml_carte));
}
# an index for incrementing the array position
$name_index=0;
if ( isset( $t_bug_arr_sort[$i] ) || ( $f_show_flag==0 ) ) {
?>
<tr>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php
echo bug_format_id( $v_project_bug_unique_id);
echo "</td>";
}
$name_index++; ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php
echo stage_get_field($v_stage_id,'name');
echo "</td>";
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo category_get_name($v_category_id);
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo get_enum_element( 'severity', $v_severity );
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo get_enum_element( 'reproducibility', $v_reproducibility );
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo $v_summary;
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo $v2_description ;
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo get_enum_element( 'status', $v_status );
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo date( config_get( 'short_date_format' ), $v_date_submitted );
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php print_user_with_subject( $v_reporter_id, $v_id ) ;
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo date( config_get( 'short_date_format' ),$v_last_updated );
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php print(history_get_events($v_id)); ;
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php print_user_with_subject( $v_handler_id, $v_id ) ;
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo get_enum_element( 'priority', $v_priority );
echo "</td>";
}
$name_index++; ?>
<?php
/* Libellé de la version de détéction dont l id est récupéré de la table bug_table*/
$sql1 = "SELECT `version`
FROM `$g_mantis_project_version_table`
WHERE id='$v_id_version'";
$resultSQL1 = db_query( $sql1 );
$row = db_fetch_array( $resultSQL1 );
$v_id_version = $row['version'];
//Libellé de la version de prise en compte dont l'id est récupéré de la table bug_table
$sql2 = "SELECT `version`
FROM `$g_mantis_project_version_table`
WHERE id='$v_fixed_version'";
$resultSQL2 = db_query( $sql2 );
$row = db_fetch_array( $resultSQL2 );
$v_fixed_version = $row['version'];
?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo $v_id_version;
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo $v_fixed_version;
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo get_enum_element( 'resolution', $v_resolution );
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php if ($v_bug_duration != 0) echo $v_bug_duration ;
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo $v_duplicate_id;
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo $v2_steps_to_reproduce;
echo "</td>";
}
$name_index++; ?>
<?php if ( ( $name_index < $field_name_count ) && ( !isset( $t_prefs[$name_index] ) || ( 1 == $t_prefs[$name_index] ) ) ) { ?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php echo $v2_additional_information;
echo "</td>";
}
$name_index++; ?>
<?php
$stage_id = helper_get_current_stage();
$t_related_custom_field_ids = custom_field_get_linked_ids_excel($project_id,$f_typeRequest);
foreach( $t_related_custom_field_ids as $t_id ) {
$t_val = get_by_name_and_bug_id( $v_id , $t_id );
?>
<td class=xl2216681 nowrap style='border-top:none;border-left:none'>
<?php if (lang_get_defaulted($t_val) != '' )
echo lang_get_defaulted($t_val) ;
else echo $t_val ; ?>
</td>
<?php
}
?>
</tr>
<?php
} #isset
}
} #for loop
?>
Merci d'avance,
A bientôt.