Error message when trying to import:
Database fields can only be matched to one column of the csv file.

Implementation of hook_validate has changed.

Note:
http://api.drupal.org/api/function/hook_validate/6
http://api.drupal.org/api/function/hook_validate/5

Comments

robert castelo’s picture

Can you explain what actions you took to cause this error, and also further explain what the error is?

Database fields can only be matched to one column of the CSV file by design.

robert castelo’s picture

Version: 6.x-0.4 » 6.x-1.1

Note that User Import 6.x-1.1 is the most current version and may already have a fix for the reported bug.

coupet’s picture

Reference:
Drupal 6.10
User Import 6.x-1.1

I commented out user_import_edit_validate and imported all nodes perfectly without changing the matching.

It might be related to the following issue:
hook_validate() doesn't get $form_state passed to it
http://drupal.org/node/241364

robert castelo’s picture

Still not clear on what the issue is, coupet can you provide a proper explanation?

coupet’s picture

Robert,

error message is generated by this function.

function user_import_edit_validate($form, &$form_state) {

  $fields = array();

  foreach ($form_state['values']['field_match'] as $row => $values) {

    // check each field is unique
    if ($values['field_match'] != '0' && $values['field_match'] != '-------------' && in_array($values['field_match'], $fields)) {
      form_set_error('field_match', t('Database fields can only be matched to one column of the csv file.'));
    }
 
    $fields[$values['field_match']] = $values['field_match'];
 
    // check email address has been selected
    if ($values['field_match'] == 'user-email') $email = TRUE;
  }

  if (!$email) form_set_error('email', t('One column of the csv file must be set as the email address.'));

  if ($form_state['values']['name']) {
     $form_state['values']['name'] = rtrim($form_state['values']['name']);
   
     if (drupal_strlen($form_state['values']['name']) < 1 || drupal_strlen($form_state['values']['name']) > 25) {
      form_set_error('name', t('Name of saved settings must be 25 characters or less.'));
     }
  }  
    
  return;
}

Let me know if further info is desired.

robert castelo’s picture

What settings result in this bug?

I need to know how to reproduce it.

coupet’s picture

Category: bug » support
Status: Active » Fixed

Robert,

I have tested again on a new install and import works perfectly. Unable to recreate problem. Works as expected. Sorry for the inconvenience.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.