CSV export help
Moderators: Developer, Contributor
-
- Posts: 1
- Joined: 21 Mar 2005, 07:33
CSV export help
How can I get the description field to be part of the CSV export in mantis? Does this require customization or is it part of the standard feature?
I am trying to do the same...
in custom_functions_inc.php :
now is only custom_function_override_print_column_value left.
any suggestions?
I have read Victor's blog entry on customization, but it doesn't help me much in this case...
thanks in advance
edit: curly brackets are all messed up with a [ code ] tag... Preview shows them fine though.
in custom_functions_inc.php :
Code: Select all
function custom_function_override_get_columns_to_view( $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
$t_columns = array();
if ( $p_columns_target == COLUMNS_TARGET_CSV_PAGE ) {
...skip...
$t_columns[] = 'description';
...skip...
}
}
function print_column_title_description ( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE )
{
if ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE )
{...skip...}
else
{
echo lang_get( 'description' );
}
}
function csv_format_description( $p_description )
{
return csv_escape_string( $p_description );
}
any suggestions?
I have read Victor's blog entry on customization, but it doesn't help me much in this case...
thanks in advance
edit: curly brackets are all messed up with a [ code ] tag... Preview shows them fine though.
for the benefit of other noobies like myself...
what I ended up doing is (not sure if it is the best way - am a php noobie as well):
csv_export.php :
and have edited the resulting output in csv_format_description(), so no html is printed out (like )
what I ended up doing is (not sure if it is the best way - am a php noobie as well):
csv_export.php :
Code: Select all
$t_function = 'csv_format_' . $t_column;
# patch start
if ( $t_column === 'description' )
{
$f_bug_id = $t_row ['id' ];
$t_bug = bug_prepare_display ( bug_get ( $f_bug_id , true ) );
echo $t_function( $t_bug->description );
}
else
{
echo $t_function( $t_row[ $t_column ] );
}
# patch end
Tried the way webwesen did. It does works well.
However, I got a new problem. Lines will not be broke in the exported .csv file if the reporter uses hard return to make sentences/strings in lines in the Summary field. Open the .csv file in MS Excel, layout would be in a mess with "<br />" there, but no line breaks in the cell.
Any ideas?
Thanks,
Kelvin
However, I got a new problem. Lines will not be broke in the exported .csv file if the reporter uses hard return to make sentences/strings in lines in the Summary field. Open the .csv file in MS Excel, layout would be in a mess with "<br />" there, but no line breaks in the cell.
Any ideas?
Thanks,
Kelvin
Obviously generating <br /> is wrong. Is the correct behaviour to generate a new line in the out (i.e. in the middle of a cell value)?
Can you test this and see if Excel can import it successfully (i.e. by editing the csv file manually before importing it in Excel.
Please report this issue in the bugtracker.
Regards,
Victor
MantisConnect
http://www.futureware.biz/mantisconnect/
Can you test this and see if Excel can import it successfully (i.e. by editing the csv file manually before importing it in Excel.
Please report this issue in the bugtracker.
Regards,
Victor
MantisConnect
http://www.futureware.biz/mantisconnect/
Oppss!!! I didn't notice the the bug is in the code above. There is nothing to report then except a feature request + a link to this thread.
Try the code below:
In csv_export.php:
Replace:
With:
Try the code below:
In csv_export.php:
Replace:
Code: Select all
$t_function = 'csv_format_' . $t_column;
echo $t_function( $t_row[ $t_column ] );
Code: Select all
$t_function = 'csv_format_' . $t_column;
# patch start
if ( $t_column === 'description' )
{
$t_bug_id = $t_row ['id' ];
$t_description = bug_get_field( $t_bug_id, 'description' );
echo csv_escape_string( $t_description );
}
else
{
echo $t_function( $t_row[ $t_column ] );
}
# patch end
after vboctor's patch I get:
in cvs file in 'Description' column.
I am running 1.0.1
my ugly code above worked though...
Code: Select all
<p style="color:red">APPLICATION WARNING #403: Database field 'description' not found.</p>
I am running 1.0.1
my ugly code above worked though...
Re: CSV export help
Went for the buggy code that is working:)
The other one gave also gave me the 403 error code, added steps_to_reproduce with out a hassle.
If you can only fill me in with what you meant with:
Thanks for the buggy code, just need a way to be able to allow hard coded returns.
The other one gave also gave me the 403 error code, added steps_to_reproduce with out a hassle.
If you can only fill me in with what you meant with:
Anyhow, allmost kicked Mantis out of the project I'm on because of lack of this featureand have edited the resulting output in csv_format_description(), so no html is printed out (like )
Thanks for the buggy code, just need a way to be able to allow hard coded returns.
Re: CSV export help
By the way, I've checked in recently code that supports export 'description'. 'additional_information' and 'steps_to_reproduce' to the View Issues, Print Issues, CSV export, and Excel export. The columns to be included is now customizable through the user interface and can be specific for each user. Administrators can use the Manage pages to customize the global defaults and defaults per project. Users can use the My Account -> Manage Columns page to do the same. The user can select a different set of columns per project per format. Also multi-line fields are supported in all formats.
This work will be included in Mantis 1.2.0.
This work will be included in Mantis 1.2.0.
Migrate your MantisBT to the MantisHub Cloud
Re: CSV export help
Excellent, is this change something that we can easily migrate into a 1.1.1 install? This is the #1 feature my users have been requesting.
Re: CSV export help
Not easy but it is possible. This would take a couple of consulting hours. If interested, please contact me via the Contact Us page.
Migrate your MantisBT to the MantisHub Cloud
Re: CSV export help
Am currently on mantis version 1.1.8. It doesn't seem to have "My Account -> Manage Columns page".
May I know how to get the "Description" field into the CSV Export file for mantis vwe 1.1.8..
Have been searching for a solution today and also dig into the php files on servers..
Thank in advance for any help render...
May I know how to get the "Description" field into the CSV Export file for mantis vwe 1.1.8..
Have been searching for a solution today and also dig into the php files on servers..
Thank in advance for any help render...