once a flexinode is created, adding a new field causes all existing data to be lost (except the title and description fields). i've looked in the database and the data is still there but when displaying the node it is not. this only happens when adding a new field not when editing or deleting an exisiting one.

CommentFileSizeAuthor
#1 lost_data_on_adding_field.patch1.22 KBAnonymous (not verified)

Comments

Anonymous’s picture

StatusFileSize
new1.22 KB

After doing some digging the problem is down to the SQL query in flexinode_load().

The query returns nothing if a given flexinode field doesn't have a corresponding record in the flexinode_data table (exactly what happens when you add a new flexinode field).

Attached patch fixes the problem by slightly modifying the SQL query.

killes@www.drop.org’s picture

Assigned: Unassigned » killes@www.drop.org

Thanks a lot, I applied the patch both to 4.4. and cvs.

killes@www.drop.org’s picture

this is of course fixed now.

Anonymous’s picture

JoranLawrence’s picture

Version: » 4.6.x-1.x-dev
Status: Closed (fixed) » Active

This problem still happens when a node is shown in the Flexinode table output. For instance, if you add a new field to flexinode-1 and then view flexinode/table/1 the table will be empty! The data isn't lost however. You just have to go through and edit/submit each node of type flexinode-1 independently and they will be restored to the table.

I believe the problem is buried in the SQL of flexinode_page_table similar to what was going on with flexinode_load.

rcbiggs’s picture

Has anything been done with this? I could really use a fix for this.

rcbiggs’s picture

I attempted to make the SQL change, similar to flexinode_load, but it did not seem to correct the bug.

My SQL skills are not that developed, however, so I could have missed something.

I really would benefit from having this defect fixed.

Bèr Kessels’s picture

Title: losing data when adding a field to an existing flexinode » field is not used when adding a field to an existing flexinode
rcbiggs’s picture

Upon consulting with a more SQL knowledgable team member, this fix in "flexinode_page_table" works:

Comment out the $where_clauses[] assignment, and incorporate into $table_joins[]...

$table_joins[] = 'LEFT JOIN {flexinode_data} ' . $fieldname . ' ON (n.nid = ' . $fieldname . '.nid AND ' . $fieldname . '.field_id = ' . $field->field_id . ')';
#$where_clauses[] = $fieldname .'.field_id = '. $field->field_id;

This may not be the ideal fix, but it serves my purposes...

I leave the actual (i.e., more elegant) patch/fix to those more proficient than I...

michelle’s picture

Awesome!

I just asked killes the other day if this was in his queue to fix and he said no so I had resigned myself to not being able to make a couple changes to my flexinode until I had time to sort out the SQL and fix this. Now I don't have to. Thanks!

Michelle

michelle’s picture

Version: 4.6.x-1.x-dev » 4.7.x-1.x-dev
Component: Code » Miscellaneous
Status: Active » Closed (fixed)

Ancient issue... Getting it out of my list. Flexinode is dead.

Michelle