Error in converting to fields when non-ascii characters in field_name

sjs - July 5, 2007 - 14:34
Project:Flexinode to CCK Converter
Version:4.7.x-0.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work
Description

I tried to use this module to convert a flexinode type to cck which had field named "Sisältö" (content in finnish). This generated an error because the cck filters the non-ascii characters creating field_name=field_sislt, but flexiconvert didn't make the same filtering, but used "field_sisältö" instead. This is fixed in the attached patch (output of git-diff), but the patch is slightly confusing since my editor removed extra spaces at the end of lines also. Anyway.. these are the lines that matter:

//// Copied from content_admin.inc: function _content_admin_field_add_new_submit
$cckfield = trim($label);
$cckfield = drupal_strtolower($cckfield);
$cckfield = str_replace(array(' ', '-'), '_', $cckfield);
$cckfield = preg_replace('/[^a-z0-9_]/', '', $cckfield);
$cckfield = 'field_'. $cckfield;
$cckfield = substr($cckfield, 0, 31);

AttachmentSize
flexiconvert_diff.txt6.81 KB

#1

sjs - July 5, 2007 - 14:48

Forgot one thing.. The ascii-filter -fix helped a bit (flexiconvert didn't display errors), but node.type was still "flexinode-1" instead of "content_tiedote" (name of content type was "Tiedote" in both flexinode and cck), so I had to change that by running..

update node set type='content_tiedote' where nid IN (select nid from node_content_tiedote);

And I also had difficulties filtering this node type at domain.com/admin/node. Filtering generated an empty list although I was able to edit and display the the converted nodes (using the old node.nids).

These errors might also have something to do with my cck version (content.module,v 1.56.2.17 2006/08/21), which is very old because the automatic update for cck produced an error, and I haven't had the time to update it manually..

#2

anarcat - April 30, 2009 - 16:55
Status:active» needs work

Please reroll the patch without whitespace changes.

 
 

Drupal is a registered trademark of Dries Buytaert.