braini75 / msproject_import

Redmine-Plugin: XML-Task-Importer for MS Project
9 stars 11 forks source link

Import does not start automatically #20

Closed mijalis closed 6 years ago

mijalis commented 6 years ago

When I access /msproject_import/upload?project_id=testprj analyze runs smoothly with no errors or warnings. The problem is that it does not run the actual import...After playing around and debugging I managed to import the xml successfully by just changing the URL to: /msproject_import/run?project_id=testprj

The importer worked fine, as it should be, showing the progress bar of tasks being imported. I guess that after analyze some redirection does not work as it should?

Thanks.

braini75 commented 6 years ago

Hi, you need to push a button to actually do the import, after running the analyze.

mijalis commented 6 years ago

Thanks for the reply, I can only see the Analyze button. So there must be another one?

braini75 commented 6 years ago

After "Analyze" there will be a page with the "Import"-Button! (Analyze does not modify the system, but running an emulation of the import only.)

msproject-importbutton

mijalis commented 6 years ago

That's the problem.. i never get to this point.. although Analyze runs fine, it doesn't display the import page.

mijalis commented 6 years ago

After some more debugging I finally found the problem. In ProjectLibre version 1.7.0 generated xml files <OutlineLevel> numbering begins from 1 Your code (app/controllers/msproj_imp_controller.rb) checks for "0":

                    if child.elements['OutlineLevel'].text == '0'
                        project_parent_issue = true
                    end
                else
                    if child.elements['OutlineLevel'].text == '0'

Therefore project_parent_issue is always false, and it goes there:

        if !project_parent_issue
            flash[:error] = error
            flash[:warning] = warning unless warning.blank?
            @parent_issues = get_issue_project_parent
            render :action => 'upload'

That is why I never get to the Import page, and I also don't get an error message.

Example Task part of the xml file generated from ProjectLibre:

    <Tasks>
        <Task>
            <UID>1</UID>
            <ID>1</ID>
            <Name>task1</Name>
            <Type>0</Type>
            <IsNull>0</IsNull>
            <CreateDate>2018-01-17T12:24:00</CreateDate>
            <WBS></WBS>
            <OutlineNumber>1</OutlineNumber>
            <OutlineLevel>1</OutlineLevel>
            <Priority>500</Priority>
            <Start>2018-01-17T08:00:00</Start>
            <Finish>2018-01-30T17:00:00</Finish>
            <Duration>PT80H0M0S</Duration>
            <DurationFormat>7</DurationFormat>
            <ResumeValid>0</ResumeValid>
            <EffortDriven>1</EffortDriven>
            <Recurring>0</Recurring>
            <OverAllocated>0</OverAllocated>
            <Estimated>0</Estimated>
            <Milestone>0</Milestone>
            <Summary>0</Summary>
            <Critical>0</Critical>
            <IsSubproject>0</IsSubproject>
            <IsSubprojectReadOnly>0</IsSubprojectReadOnly>
            <ExternalTask>0</ExternalTask>
            <TotalSlack>960000</TotalSlack>
            <FixedCostAccrual>2</FixedCostAccrual>
            <RemainingDuration>PT80H0M0S</RemainingDuration>
            <ConstraintType>0</ConstraintType>
            <CalendarUID>-1</CalendarUID>
            <ConstraintDate>1970-01-01T00:00:00</ConstraintDate>
            <LevelAssignments>0</LevelAssignments>
            <LevelingCanSplit>0</LevelingCanSplit>
            <LevelingDelay>0</LevelingDelay>
            <LevelingDelayFormat>7</LevelingDelayFormat>
            <IgnoreResourceCalendar>0</IgnoreResourceCalendar>
            <HideBar>0</HideBar>
            <Rollup>0</Rollup>
            <EarnedValueMethod>0</EarnedValueMethod>
            <Active>1</Active>
            <Manual>0</Manual>
        </Task>
    </Tasks>

When I changed the code to check for "1" everything worked flawlessly: if child.elements['OutlineLevel'].text == '1'

luciof55 commented 6 years ago

Hi.

I could fix the problem.

First, take in consideration that this plugins is for MS Project, but we could add some configuration options to support others applications.

We could add the OutlineLevel option, and compare this value instead of "0" o "1".

Second, if no root task was found, adds the correct message error.

Regards.

mijalis commented 6 years ago

Yes, that's true..it is for MS project... It could be handy if you could add an option.. Thanks.