Can't import Mantis BT data

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
peterthoeny
Posts: 4
Joined: 01 Nov 2011, 21:59

Can't import Mantis BT data

Post by peterthoeny »

I am new to MantisBT. I installed MantisBT 1.2.8 and can create bug items. Now I try to import data from another Mantis. I have a data-2.xml.xls file which seems to be an xml export of an other Mantis database. I can open it up in Excel, and in vi I can see that it is an xml file.

In Manage => [ Manage Plugins ] I installed the "Import/Export issues 1.0" plugin. When I try to import data-2.xml.xls file I get an empty page with url https://example.com/mantisbt/plugin.php ... ort_action and no data is imported. Any idea what is wrong?

I also tried the csv approach by installing "Mantis CSV Importer 1.3.0b" from git. I converted the xml to csv using Excel and tried to import it using [ Import CSV file ]. When I try to import all fields i get this error:
APPLICATION WARNING #300: String "plugin_Csv_import_result_nothing_success_ct" not found.

When I try to import without the ID field i get this error:
APPLICATION ERROR 0001200: Invalid e-mail address.

Any idea what is wrong? The import tools seem buggy. Any way to fix it? Any other way to import data into MantisBT?

Thanks,
Peter
atrol
Site Admin
Posts: 8534
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Can't import Mantis BT data

Post by atrol »

Can you give an example of the XML-File?
If the file is generated by "Import/Export issues 1.0" plugin it should start with the following lines

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<mantis version="1.2.8" urlbase="http://127.0.0.1:80/mantisbt/" issuelink="#" notelink="~" format="1">
Please use Search before posting and read the Manual
peterthoeny
Posts: 4
Joined: 01 Nov 2011, 21:59

Re: Can't import Mantis BT data

Post by peterthoeny »

Thank you atrol for replying. The xml starts with:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?><?mso-application progid="Excel.Sheet"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"><Worksheet ss:Name="Argonaut"><Table><Column ss:Index="1" ss:AutoFitWidth="0" ss:Width="110"/><Row><Cell><Data ss:Type="String">ID</Data></Cell><Cell><Data ss:Type="String">Project</Data></Cell><Cell><Data ss:Typ
e="String">Reporter</Data></Cell><Cell><Data ss:Type="String">Assigned To</Data></Cell><Cell><Data ss:Type="String">Pr
iority</Data></Cell><Cell><Data ss:Type="String">Severity</Data></Cell><Cell><Data ss:Type="String">Reproducibility</D
ata></Cell><Cell><Data ss:Type="String">Product Version</Data></Cell><Cell><Data ss:Type="String">Category</Data></Cel
l><Cell><Data ss:Type="String">Date Submitted</Data></Cell><Cell><Data ss:Type="String">OS</Data></Cell><Cell><Data ss
:Type="String">OS Version</Data></Cell><Cell><Data ss:Type="String">Platform</Data></Cell><Cell><Data ss:Type="String"
>View Status</Data></Cell><Cell><Data ss:Type="String">Updated</Data></Cell><Cell><Data ss:Type="String">Summary</Data
></Cell><Cell><Data ss:Type="String">Status</Data></Cell><Cell><Data ss:Type="String">Resolution</Data></Cell><Cell><D
ata ss:Type="String">Fixed in Version</Data></Cell></Row><Row><Cell><Data ss:Type="Number">0000767</Data></Cell>
<Cell><Data ss:Type="String">Argonaut</Data></Cell>
I realize now that it must have been edited & saved with Excel. That looks like the reason why the xml import does not work.

The converted csv starts like this:

Code: Select all

ID,Project,Reporter,Assigned To,Priority,Severity,Reproducibility,Product Version,Category,Date Submitted,OS,OS Version,Platform,View Status,Updated,Summary,Status,Resolution,Fixed in Version
767,Argonaut,name1,name2,normal,minor,always,Beta_phase,Android,2011-10-13,,,Android,public,2011-10-13,"Application doesn't generate validation message for the invalid email address, request goes on server first.",assigned,open,
This format looks OK to me. Not sure why the csv import fails.
atrol
Site Admin
Posts: 8534
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Can't import Mantis BT data

Post by atrol »

peterthoeny wrote: This format looks OK to me. Not sure why the csv import fails.
I don't think the csv is OK.
I am missing the mandatory "Description" field.
Please use Search before posting and read the Manual
peterthoeny
Posts: 4
Joined: 01 Nov 2011, 21:59

Re: Can't import Mantis BT data

Post by peterthoeny »

Thanks atrol for the hint. I tried adding a Description field but it still gave me the email error.

I did a brute force import: Wrote a script that uses curl to push data record by record via http posts. Problem solved (with much more effort than it should be).

Thanks for your help!
atrol
Site Admin
Posts: 8534
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Can't import Mantis BT data

Post by atrol »

peterthoeny wrote:Wrote a script that uses curl to push data record by record via http posts.
Would be great to have this attached to this thread as an example for other users.
Please use Search before posting and read the Manual
peterthoeny
Posts: 4
Joined: 01 Nov 2011, 21:59

Re: Can't import Mantis BT data

Post by peterthoeny »

Attached is the csv2mantis.pl file, it is a (really) quick and dirty Perl script to push a csv file into Mantis. I am more used to Perl than PHP, hence my choice. The script has a dependency on the curl tool. Make sure to edit the script and fix the domain name in two locations, and the password (yes, it could be done nicer, it fits my one time use purpose).

The CSV file is assumed to be of format:

Code: Select all

ID,Reporter,Assigned To,Priority,Severity,Reproducibility,Product Version,Category,Date Submitted,OS,OS Version,Platform,View Status,Updated,Summary,Description,Status,Resolution,Fixed in Version
37,UserA,UserB,high,major,sometimes,,Android,2011-07-13,,,,public,2011-09-15,Application freeze in Foobar tab,(missing),closed,fixed,(missing)
Attachments
csv2mantis.pl.txt
Quick and dirty Perl script to push a cvs file into Mantis
(4.12 KiB) Downloaded 1171 times
atrol
Site Admin
Posts: 8534
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Can't import Mantis BT data

Post by atrol »

peterthoeny wrote:it fits my one time use purpose
and will be a good point to start for other users.
Thanks for your contribution.
Please use Search before posting and read the Manual
Post Reply