News:

Looking for documentation? Take a look on our wiki

Main Menu

VM1 to VM2: Migrated userfields not functioning as expected

Started by mbarry, January 15, 2014, 16:48:42 PM

Previous topic - Next topic

mbarry

As part of the migration process the vm_userfield are ported across via portUsers() and inserted into virtuemart_userfields

Scenario:
        Run the VM2 Migration tool with "everything" selected".
       
        As Administrator
        Select Configuration->Shopper Fields Panel
        Select an imported Shopper Field that is not one of the first 26 (these are automatically imported during VM2 installation)
        A good example would be a multicheckbox field
               
Issue:
       Although the userfield can be displayed, it is not possible to view or add check box elements to the field.     

Solution:
      It was discovered that a space was being added to the 'type' value in Table `#__virtuemart_userfields` so instead of "multicheckbox" the value inserted was " multicheckbox"
     
      The bug is in line 521, $q = 'INSERT INTO `#__virtuemart_userfields` a space is prefixed to all fields following the $field->name. This caused the migrated types not to work.
      Line 521 change
        From
            VALUES ( "'.$field->name.'"," '.$field->title .'"," '.$field->description .'"," '.$field->type .'"," '.$field->maxlength .'"," '.$field->size .'"," '.$field->required .'"," '.$field->ordering .'"," '.$field->cols .'"," '.$field->rows .'"," '.$field->value .'"," '.$field->default .'"," '.$field->published .'"," '.$field->registration .'"," '.$field->shipment .'"," '.$field->account .'"," '.$field->readonly .'"," '.$field->calculated .'"," '.$field->sys .'"," '.$field->vendor_id .'"," '.$field->params .'" )';
        To
           VALUES ( "'.$field->name.'", "'.$field->title.'", "'.$field->description.'", "'.$field->type.'", "'.$field->maxlength.'", "'.$field->size.'", "'.$field->required.'", "'.$field->ordering.'", "'.$field->cols.'", "'.$field->rows.'", "'.$field->value.'", "'.$field->default.'", "'.$field->published.'", "'.$field->registration.'", "'.$field->shipment.'", "'.$field->account.'", "'.$field->readonly.'", "'.$field->calculated.'", "'.$field->sys.'", "'.$field->vendor_id.'", "'.$field->params.'" )';

Affected files:
       administrator/components/com_virtuemart/helpers/migrator.php  line 521