I have recently started to implement this module in our drupal 7 intranet site. The issue I am facing is when the mailbox has email from a user in the valid email domain and automatic account creation is disabled, I get the following error:

Fetching mail for IT Support...
Error messageWarning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of D:\webroot\mpgportal7\public\drupal\includes\entity.inc).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of D:\webroot\mpgportal7\public\drupal\includes\entity.inc).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 184 of D:\webroot\mpgportal7\public\drupal\sites\all\modules\entity\includes\entity.controller.inc).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of D:\webroot\mpgportal7\public\drupal\includes\entity.inc).
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7409 of D:\webroot\mpgportal7\public\drupal\includes\common.inc).
The website encountered an unexpected error. Please try again later.

If allow creation of accounts, it properly processes the email and creates the ticket.

Comments

jeremy’s picture

Unfortunately this is not currently supported by the module. What would you prefer the module do with this sort of email? Map it to a specific catch-all email account? Ignore the email altogether?

gardnerjp’s picture

I want it to do the following based on description of option:

You can override the global setting for autocreating users by selecting an option in this list. If enabled, new user accounts will be automatically created if emails are received from unnknown email addresses. If disabled, notification emails will be sent when emails are discarded notifying the sender that they have to register to be able to create or update support tickets via email.

Please elaborate? If the module does not support this, why have the option to enable this functionality.

Other option would be to allow creation of tickets for all emails and have them auto assigned to specified user. If no specified user, then send notification that registration is required first.

Our drupal is integrated with LDAP and so they normally get account created as soon as browser opens. But, if they send email first, I want to control that and not get error.

jeremy’s picture

I stand corrected. I forgot about that feature, it was originally added here:
#544268: Make auto-account creation optional

Evidently the functionality is simply broken in the 7.x port of this module, thanks for reporting it! Patches welcome, otherwise hopefully we'll have a chance to review/fix it sooner than later.

gardnerjp’s picture

It breaks when drupal_mail gets called.

nikhilrdeshpande’s picture

I am having exact same errors.
We do not want automatic creations of users, But want to fetch the email.
How was this issue resolved?

Thanks
Nikhil

jeremy’s picture

Priority: Normal » Major

It's not yet resolved; increasing the priority.

jeremy’s picture

Assigned: Unassigned » jeremy
BManuel’s picture

Hi Jeremy what is the ETA on this, would you need us to chip-in to get this thing done asap.
thanks
BM

daften’s picture

daften’s picture

Also need this fixed ASAP :) Can I help?

BManuel’s picture

Hey Daften,
I could not wait, so I switch to osTicket https://github.com/osTicket/osTicket-1.7 does the job very well.
BM

daften’s picture

Thanks for the update, I'll look at that system and try to fix this bug :)

daften’s picture

Found more info.

The problem is when notifying.
in the hook_mail function, support_mail_tokens is called, that causes the problem.
Further down, in that function, when node_view is called (line 1491)

It probably starts with this message:
Notice: Trying to get property of non-object in support_mail_tokens() (line 1466 of /usr/share/drupal7/studenteninternet/sites/all/modules/support/support.module).

And I think the problems begin because $nid is empty. That then again comes from $params being empty in support_mail. That's because $params is empty in _support_mail_deny.

Don't know how to fix this though

zietbukuel’s picture

Any update on this?

HypervisedEd’s picture

Version: 7.x-1.0-beta3 » 7.x-1.0-rc2

I'm just curious, how can a module be considered a release candidate when such a basic function of the module breaks the entire module? This module isn't ready for a Drupal 7 production site if it breaks this easily.

I think this really should be re-branded as a dev version for drupal 7 in my opinion, especially when the module isn't being supported (this issue has been breaking sites for months).

Notice: Trying to get property of non-object in support_mail_tokens() (line 1466 of /var/www/drupal/sites/all/modules/support/support.module).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /var/www/drupal/includes/entity.inc).
Notice: Trying to get property of non-object in support_mail_tokens() (line 1480 of /var/www/drupal/sites/all/modules/support/support.module).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /var/www/drupal/includes/entity.inc).
Notice: Trying to get property of non-object in support_mail_tokens() (line 1482 of /var/www/drupal/sites/all/modules/support/support.module).
Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 219 of /var/www/drupal/sites/all/modules/entity/includes/entity.controller.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 355 of /var/www/drupal/includes/entity.inc).
Notice: Trying to get property of non-object in support_mail_tokens() (line 1483 of /var/www/drupal/sites/all/modules/support/support.module).
Notice: Trying to get property of non-object in support_mail_tokens() (line 1483 of /var/www/drupal/sites/all/modules/support/support.module).
Notice: Trying to get property of non-object in support_mail_tokens() (line 1484 of /var/www/drupal/sites/all/modules/support/support.module).
Notice: Undefined property: stdClass::$type in _node_extract_type() (line 385 of /var/www/drupal/modules/node/node.module).
Notice: Undefined property: stdClass::$nid in node_build_content() (line 1425 of /var/www/drupal/modules/node/node.module).
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7663 of /var/www/drupal/includes/common.inc).
The website encountered an unexpected error. Please try again later.

daften’s picture

Agreed

RaceCorp’s picture

So maybe not the best way to approach it, but I seemed to have gotten it to at least not fail on me for fetching emails when automatic account creation is disabled. It's a hack, but it worked. Line 1324 of support.module add:

if(!$param['nid']) return;

Hope that leads to a better solution.

RaceCorp’s picture

Also had to add

return user_load(1); //Set to admin so it doesn't get lost

to line 721 of support.module so that the tickets aren't dropped on the floor.

(Sorry about the nonexistent patch files...Was having troubles with git...)

ryan.ryan’s picture

RaceCorp, could you provide the context of the code surrounding what you added. The code for you param nid doesn't fit on line 1324 anymore.

drein’s picture

I have the same problem, but is this module abandoned? the hack you suggest prevent only the errors, or is a working solution? sorry but after having configured the module, spending time to setup the system, it is absurde that a rc2 is in this state!

RaceCorp’s picture

Sorry, here's the context of #17

/**
 * Implementation of hook_mail().
 */
function support_mail($key, &$message, $params) {   
  if(!$params['nid']) return; //nid isn't set for anon
  $language = $message['language'];
  $variables = support_mail_tokens($params['account'], $language, $params['nid'], (isset($params['comment']) ? $params['comment'] : new stdClass()), $
params['suppress']);
  $message['subject'] .= _support_mail_text($key . '_subject', $language, $variables, $params['integrate_email']);
  $message['body'] = array(_support_mail_text($key . '_body', $language, $variables, $params['integrate_email']));
  $node = node_load($params['nid']);
  if ($client = support_client_load($node->client)) {
    if ($client->integrate_email) {

Here's the context of #18

function support_account_load($from, $ticket, $subject, $client) {
  $uid = db_query("SELECT uid FROM {users} WHERE mail = :mail", array(':mail' => $from))->fetchField();
  if ($uid) {
    // TODO Convert "user_load" to "user_load_multiple" if "$uid" is other than a uid.
    // To return a single user object, wrap "user_load_multiple" with "array_shift" or equivalent.
    // Example: array_shift(user_load_multiple(array(), $uid))
    return user_load($uid);
  }
  else if ($client->user_creation == 2 || ($client->user_creation == 0 && variable_get('support_autocreate_users', TRUE) == FALSE)) {
    // User does not exist and the setting to allow automatic creation is
    // disabled.  Send notification to user.
    watchdog('support', 'An autocreation of a user from the e-mail address: !from was denied. The client recieving the request was: !client', array('!
from' => utf8_encode($from), '!client' => $client->name));
    _support_mail_deny($from);
    return user_load(1); //Set to admin so it doesn't get lost
  }
  else {
purencool’s picture

Status: Active » Closed (outdated)