[Bug 1557159] [NEW] Issues with export/import of UserRoles for Programs

Public bug reported:

This is DHIS2.21 (21037) on Ubuntu Linux 15.10.

There seem to be several issues with import of Programs and their
related data items. The general scenario is that I've developed a
tracker form for DATIM which I want to be able to import to other
machines. I do an export consisting of all the program data types (the
form uses both stages and sections) as well as option sets and data
elements.

In practice, I reduce the dump by filtering on the lastupdated property.
For a time I was also filtering on the associated user but I determined
that (a) the user appears to be the creating user, not the last editor;
and (b) some element types (such as user roles) don't seem to save user
information.

One problem is that when importing a file which has stub references to
user roles but doesn't explicitly include user roles, the program/role
relationships are not asserted, which keeps the program from showing up
in the Event Capture app.

A second problem is that when a more complete file (including user
roles) is subsequently updated, the resulting program and elements are
corrupted.

However, if the complete file is imported an initial time (or the
programs deleted and the file imported), everything works fine.

The attached file is the complete import file; the incomplete version
can be made by just removing the toplevel userRoles element.

** Affects: dhis2
     Importance: Undecided
         Status: New

** Attachment added: "Complete import file"
   https://bugs.launchpad.net/bugs/1557159/+attachment/4599225/+files/metadata_import.xml

···

--
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/1557159

Title:
  Issues with export/import of UserRoles for Programs

Status in DHIS:
  New

Bug description:
  This is DHIS2.21 (21037) on Ubuntu Linux 15.10.

  There seem to be several issues with import of Programs and their
  related data items. The general scenario is that I've developed a
  tracker form for DATIM which I want to be able to import to other
  machines. I do an export consisting of all the program data types
  (the form uses both stages and sections) as well as option sets and
  data elements.

  In practice, I reduce the dump by filtering on the lastupdated
  property. For a time I was also filtering on the associated user but
  I determined that (a) the user appears to be the creating user, not
  the last editor; and (b) some element types (such as user roles) don't
  seem to save user information.

  One problem is that when importing a file which has stub references to
  user roles but doesn't explicitly include user roles, the program/role
  relationships are not asserted, which keeps the program from showing
  up in the Event Capture app.

  A second problem is that when a more complete file (including user
  roles) is subsequently updated, the resulting program and elements are
  corrupted.

  However, if the complete file is imported an initial time (or the
  programs deleted and the file imported), everything works fine.

  The attached file is the complete import file; the incomplete version
  can be made by just removing the toplevel userRoles element.

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1557159/+subscriptions