Posted by grobot on May 31, 2009 at 9:37am
| Project: | Node import |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
The addition of Storm content types to Node Import would make Storm even more awesome.
Example use cases:
* Import timesheet / invoice item entries from time recorder apps (eg OfficeTime, etc)
* Import organisation & invoice data from other billing apps (eg vTiger, SugarCRM, etc)
Happy to collab on this with others interested in making it happen - let me know if you're keen.
Comments
#1
OK, have kicked this off - pretty painless actually, which is a good sign. Have added Storm Organisation support now, I expect to get onto invoice and invoice item support pretty shortly.
To add this code to node_import, extract the attached tarball in
modules/node_import/supportedso it creates the new directorymodules/node_import/supported/stormThis code will ultimately need to be added to node_import module, but I'm keen to keep it in the Storm issue queue until we're ready to provide the support files to that module, then transfer the ticket / code over.
Because our use case is importing an existing system with its own keys for organisation, invoice, invoice item etc, I've added CCK fields in my site to map these. For our import we'll need to post-process these to map the items to the correct new invoice, organisation, etc. This last probably won't be part of the first release of node_import support, but I'll document the process we used, because I'm sure it'll be useful for others looking at moving to Storm.
#2
Thanks @xurizaemon,
Please could anyone who needs this sort of thing review this!
#3
I have added support for import stormperson. just unpack tgz file in
modules/node_import/supported.It is working, but not perfectly, there are some errors, and manually choosing organization_nid field - but it is possible to import organizations and people very easy. This code only uses very basic node_import functionality, for more advanced features I would need to get deep into node_import module - so any example (some other module, some other code) would be great.
I do not suggest to run this on production site, but you can test it on backup and development sites.
This is enough for me to satisfy mine current needs, but I would like to finish this import thing - just don't know when exactly.
If someone have any suggestion/code/example post here.
Other important thing are examples of .csv files, And I will post them here as soon as I make them.
#4
I couldn't get your person patch to work alongside the organisation patch as I received the following errors:
warning: preg_match() expects parameter 2 to be string, array given in /var/www/includes/bootstrap.inc on line 771.warning: Illegal offset type in isset or empty in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1205.
warning: Illegal offset type in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1206.
warning: Illegal offset type in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1209.
warning: preg_match() expects parameter 2 to be string, array given in /var/www/includes/bootstrap.inc on line 771.
warning: Illegal offset type in isset or empty in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1205.
warning: Illegal offset type in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1206.
warning: Illegal offset type in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1209.
warning: preg_match() expects parameter 2 to be string, array given in /var/www/includes/bootstrap.inc on line 771.
warning: Illegal offset type in isset or empty in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1205.
warning: Illegal offset type in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1206.
warning: Illegal offset type in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1209.
warning: preg_match() expects parameter 2 to be string, array given in /var/www/includes/bootstrap.inc on line 771.
warning: Illegal offset type in isset or empty in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1205.
warning: Illegal offset type in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1206.
warning: Illegal offset type in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1209.
warning: preg_match() expects parameter 2 to be string, array given in /var/www/includes/bootstrap.inc on line 771.
warning: Illegal offset type in isset or empty in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1205.
warning: Illegal offset type in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1206.
warning: Illegal offset type in /var/www/sites/test.ctscomputing.com/modules/node_import/node_import.admin.inc on line 1209.
The only way I could get both working indendently was to manually check the node type otherwise organisation and person hooks were both called.
So in stormorganisation.inc I changed line 15 to:
if (('stormorganization' == node_import_type_is_node($type))) {And in stormperson.inc I changed line 15 to:
if (('stormperson' == node_import_type_is_node($type))) {#5
My use case was to enable the imporation of Organizations and then import Persons, linking them to the pre-existing Organization.
I investigated using the node_import node_reference type, however this is specific to the CCK node_reference and didn't seem to work with the basic node reference in storm. So I altered the node_import.inc to add another field type for basic_node_reference. This is used to set the organization_nid when provided with the organization_title. So in your csv you can specify the Organization title and the code will find the pre-existing node reference and put this in the organization_nid.
Attached is a patch to apply to node_import.inc and the two include files to put in the node_import/supported/storm directory are in the zip file
#6
Since this has been reviewed a few times now, i'm moving over to the Node import queue for review there.
If it gets into the node import module, i'll add links in the Storm documentation to point people in the right direction.