Hey,
I'm am trying to import a CRM core contact with migrate via MigrateDestinationCRMCoreContact. But I get the following error:

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /batch?id=5&op=do StatusText: OK ResponseText: ( ! ) Fatal error: Call to undefined method stdClass::uri() in entity/entity.module on line 1141 Call Stack #TimeMemoryFunctionLocation 10.0006242488{main}( )../index.php:0 20.441831514352menu_execute_active_handler( )../index.php:33 30.450032168320call_user_func_array:{includes/menu.inc:519} ( )../menu.inc:519 40.450032168544system_batch_page( )../menu.inc:519 50.450032168648_batch_page( )../system.admin.inc:2379 60.450132169560_batch_do( )../batch.inc:80 70.450132169800_batch_process( )../batch.inc:161 80.456632671568call_user_func_array:{includes/batch.inc:284} ( )../batch.inc:284 90.456632671888migrate_ui_batch( )../batch.inc:284 100.476734235704MigrationBase->processImport( )../migrate_ui.pages.inc:593 110.480034250088Migration->import( )../base.inc:1073 120.482534288952MigrateDestinationCRMCoreContact->import( )../migration.inc:723 130.498935727960crm_core_contact_save( )../crm_core_contact.migrate.inc:130 140.502435980584CRMCoreContactController->save( )../crm_core_contact.module:763 150.502435981328EntityAPIController->save( )../crm_core_contact.controller.inc:107 160.534040675920EntityAPIController->invoke( )../entity.controller.inc:450 170.537440678656module_invoke_all( )../entity.controller.inc:355 180.538340682824call_user_func_array:{includes/module.inc:895} ( )../module.inc:895 190.538340683336erpal_platform_core_entity_insert( )../module.inc:895 200.538340683512entity_uri( )../erpal_platform_core.module:54 210.538440683544entity_class_uri( )../common.inc:8096

Maybe it is similar to this one #2344893: Feeds import of Contact gives: Fatal error: Call to undefined method stdClass::uri(), but I couldn't figure out how to fix this yet.
Any Ideas how I could solve this?
Thx in advance.

Comments

bechtold created an issue. See original summary.

bechtold’s picture

Im down to crm_core_contact.migrate.inc the import function on line 75.
The problem is, that the stdClass should be a CRMCoreContactEntity.
The object given and used as CRMCoreContactEntity coming from migrate is only a set of destinationValues, not the real entity.

If i run
$contact = entity_get_controller('crm_core_contact')->create($values);
at the beginning of the function the entity will be created, but I couldn't figure out how to set the contact_name field yet.

RoSk0’s picture

Status: Active » Closed (works as designed)

Hi,
You are looking for issue in the wrong place I think.
Take a closer look at your backtrace, you will notice this line:
190.538340683336erpal_platform_core_entity_insert( )../module.inc:895
Which tells us that you have used ERPAL Platform to test CRM Core, which is not good imho.
I should check you requirements and be 100% sure that you need both of this projects.
If it's still the case and the issue is in CRM Core and not ERPAL feel free to reopen this issue with a patch.

bechtold’s picture

Status: Closed (works as designed) » Active

Hey,
do you know that ERPAL Platform ships with CRM Core? So it was not my decision to use them together.
I'm actually one of the maintainers of ERPAL Platform now so I would be really interested in why you think these two should not be used together?
Would you be interested in talking about that?

But I was able to advance with my problem a little bit.
When I create a correct CRMCoreContactEntity as stated above and add the name field by hand the name is stripped by the prepare() function.
If I add the name field after the prepare function it works fine.
That's what I figured out so far, it doesn't solve the problem, but I want to leave this as a protocol here, just in case some one else has similar problems.

In general I don't think this is a problem of ERPAL.
ERPAL's hook_entity_insert() doesn't manipulate the entity.
So I am now also testing in a blank Drupal, non ERPAL installation to see if I can reproduce it there.

But I also realized that i completely overlooked crm_core_data_import module, so I pause my actual work on my own importer and give this a try first.

I reopen this, because otherwise Drupal will not notify us about any ongoing discussion. I hope it is ok if we close it later.
Cheers
bechtold

RoSk0’s picture

It looks like I missed the fact that CRM Core is used by ERPAL. This is good to know and I happy to help with any issues but can;t promise any time frames now.

Yuri’s picture

This has nothing to do with ERPAL, I receive a similar error with a clean drupal install just now.

Fatal error: Call to undefined method stdClass::label() in /home/tullia/public_html/sites/all/modules/crm_core/modules/crm_core_contact/includes/crm_core_contact.controller.inc on line 107

matthieu_collet’s picture

Like Yuri, same error without Erpal, on a new clean Drupal install

I can't import anything in my contacts

RoSk0’s picture

Version: 7.x-0.980 » 7.x-1.x-dev

Issue with "Fatal error: Call to undefined method stdClass::label()" is a separate issue to this and I have just pushed the fix.
Will try to figure out what is the issue with uri() method.

Tokoh’s picture

I've just struck this problem also. Ive stripped away all of the fields and am using a csv file as input with just one column of number 1 to 6. I've use this as the value of the primary field of an individual.

Has anyone made an progress with this? What alternatives have you used?

RoSk0’s picture

Status: Active » Closed (works as designed)

Not sure how can we fix this issue inside CRM Core because it is not problem of this module.
As a workaround you can revoke access to 'view erpal debug output' or disable debug messages in ERPAL for migration time.

Closing this.

rmcom’s picture

@RoSk0

I also get the following error message on a clean install:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=29&op=do StatusText: Service unavailable (with message) ResponseText: Error: Call to undefined method stdClass::label() in CRMCoreContactController->save() (line 107 of /var/www/html/sites/all/modules/crm_core/modules/crm_core_contact/includes/crm_core_contact.controller.inc).

You mentioned in #8 that you were pushing a fix.

Where can we follow that fix? Any news on it?

RoSk0’s picture

Fix mentioned in #8 have being pushed to 1.x branch commit hash eaf8e27, should be available in latest dev version.

rmcom’s picture

Thank you very much! I hope this will be in the next D7 release.

For all others, the fix can be seen here:

http://cgit.drupalcode.org/crm_core/commit/?h=7.x-1.x&id=eaf8e2780108973...